diff --git a/.stats.yml b/.stats.yml index b0a6dec0e28..23110f1f4d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 126 +configured_endpoints: 1359 diff --git a/README.md b/README.md index e9258057dd4..90519c18a2d 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,10 @@ import ( func main() { client := cloudflare.NewClient( - option.WithAPIKey("my-cloudflare-api-key"), // defaults to os.LookupEnv("CLOUDFLARE_API_KEY") - option.WithEmail("dev@cloudflare.com"), // defaults to os.LookupEnv("CLOUDFLARE_EMAIL") + option.WithAPIEmail("dev@cloudflare.com"), // defaults to os.LookupEnv("CLOUDFLARE_API_EMAIL") + option.WithAPIKey("my-cloudflare-api-key"), // defaults to os.LookupEnv("CLOUDFLARE_API_KEY") + option.WithAPIToken("my-cloudflare-api-token"), // defaults to os.LookupEnv("CLOUDFLARE_API_TOKEN") + option.WithUserServiceKey("my-cloudflare-user-service-key"), // defaults to os.LookupEnv("CLOUDFLARE_USER_SERVICE_KEY") ) zoneNewResponse, err := client.Zones.New(context.TODO(), cloudflare.ZoneNewParams{ Account: cloudflare.F(cloudflare.ZoneNewParamsAccount{ diff --git a/account.go b/account.go new file mode 100644 index 00000000000..f720c1defde --- /dev/null +++ b/account.go @@ -0,0 +1,392 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountService 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 [NewAccountService] method instead. +type AccountService struct { + Options []option.RequestOption + Addresses *AccountAddressService + Billings *AccountBillingService + BrandProtections *AccountBrandProtectionService + CfdTunnels *AccountCfdTunnelService + CustomPages *AccountCustomPageService + Diagnostics *AccountDiagnosticService + Dlp *AccountDlpService + DNSFirewalls *AccountDNSFirewallService + Emails *AccountEmailService + Firewalls *AccountFirewallService + Images *AccountImageService + Intel *AccountIntelService + LoadBalancers *AccountLoadBalancerService + Logpushes *AccountLogpushService + Logs *AccountLogService + Magic *AccountMagicService + Members *AccountMemberService + Mnms *AccountMnmService + MtlsCertificates *AccountMtlsCertificateService + Pages *AccountPageService + Pcaps *AccountPcapService + R2 *AccountR2Service + Railguns *AccountRailgunService + Registrar *AccountRegistrarService + RequestTracers *AccountRequestTracerService + Roles *AccountRoleService + Rules *AccountRuleService + SecondaryDNS *AccountSecondaryDNSService + Storages *AccountStorageService + Streams *AccountStreamService + Subscriptions *AccountSubscriptionService + Teamnet *AccountTeamnetService + Tunnels *AccountTunnelService + Workers *AccountWorkerService + Gateway *AccountGatewayService + Rulesets *AccountRulesetService + Access *AccountAccessService + Alerting *AccountAlertingService + CustomNs *AccountCustomNService + Devices *AccountDeviceService + Addressing *AccountAddressingService + AI *AccountAIService + Challenges *AccountChallengeService + D1 *AccountD1Service + Dex *AccountDexService + Hyperdrive *AccountHyperdriveService + PagesProjects *AccountPagesProjectService + Rum *AccountRumService + VectorizeIndexes *AccountVectorizeIndexService + WarpConnector *AccountWarpConnectorService + Zerotrust *AccountZerotrustService + Urlscanner *AccountUrlscannerService +} + +// NewAccountService 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 NewAccountService(opts ...option.RequestOption) (r *AccountService) { + r = &AccountService{} + r.Options = opts + r.Addresses = NewAccountAddressService(opts...) + r.Billings = NewAccountBillingService(opts...) + r.BrandProtections = NewAccountBrandProtectionService(opts...) + r.CfdTunnels = NewAccountCfdTunnelService(opts...) + r.CustomPages = NewAccountCustomPageService(opts...) + r.Diagnostics = NewAccountDiagnosticService(opts...) + r.Dlp = NewAccountDlpService(opts...) + r.DNSFirewalls = NewAccountDNSFirewallService(opts...) + r.Emails = NewAccountEmailService(opts...) + r.Firewalls = NewAccountFirewallService(opts...) + r.Images = NewAccountImageService(opts...) + r.Intel = NewAccountIntelService(opts...) + r.LoadBalancers = NewAccountLoadBalancerService(opts...) + r.Logpushes = NewAccountLogpushService(opts...) + r.Logs = NewAccountLogService(opts...) + r.Magic = NewAccountMagicService(opts...) + r.Members = NewAccountMemberService(opts...) + r.Mnms = NewAccountMnmService(opts...) + r.MtlsCertificates = NewAccountMtlsCertificateService(opts...) + r.Pages = NewAccountPageService(opts...) + r.Pcaps = NewAccountPcapService(opts...) + r.R2 = NewAccountR2Service(opts...) + r.Railguns = NewAccountRailgunService(opts...) + r.Registrar = NewAccountRegistrarService(opts...) + r.RequestTracers = NewAccountRequestTracerService(opts...) + r.Roles = NewAccountRoleService(opts...) + r.Rules = NewAccountRuleService(opts...) + r.SecondaryDNS = NewAccountSecondaryDNSService(opts...) + r.Storages = NewAccountStorageService(opts...) + r.Streams = NewAccountStreamService(opts...) + r.Subscriptions = NewAccountSubscriptionService(opts...) + r.Teamnet = NewAccountTeamnetService(opts...) + r.Tunnels = NewAccountTunnelService(opts...) + r.Workers = NewAccountWorkerService(opts...) + r.Gateway = NewAccountGatewayService(opts...) + r.Rulesets = NewAccountRulesetService(opts...) + r.Access = NewAccountAccessService(opts...) + r.Alerting = NewAccountAlertingService(opts...) + r.CustomNs = NewAccountCustomNService(opts...) + r.Devices = NewAccountDeviceService(opts...) + r.Addressing = NewAccountAddressingService(opts...) + r.AI = NewAccountAIService(opts...) + r.Challenges = NewAccountChallengeService(opts...) + r.D1 = NewAccountD1Service(opts...) + r.Dex = NewAccountDexService(opts...) + r.Hyperdrive = NewAccountHyperdriveService(opts...) + r.PagesProjects = NewAccountPagesProjectService(opts...) + r.Rum = NewAccountRumService(opts...) + r.VectorizeIndexes = NewAccountVectorizeIndexService(opts...) + r.WarpConnector = NewAccountWarpConnectorService(opts...) + r.Zerotrust = NewAccountZerotrustService(opts...) + r.Urlscanner = NewAccountUrlscannerService(opts...) + return +} + +// Get information about a specific account that you are a member of. +func (r *AccountService) Get(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update an existing account. +func (r *AccountService) Update(ctx context.Context, identifier interface{}, body AccountUpdateParams, opts ...option.RequestOption) (res *AccountUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// List all accounts you have ownership or verified access to. +func (r *AccountService) AccountsListAccounts(ctx context.Context, query AccountAccountsListAccountsParams, opts ...option.RequestOption) (res *shared.Page[AccountAccountsListAccountsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "accounts" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountGetResponse struct { + Errors []AccountGetResponseError `json:"errors"` + Messages []AccountGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountGetResponseSuccess `json:"success"` + JSON accountGetResponseJSON `json:"-"` +} + +// accountGetResponseJSON contains the JSON metadata for the struct +// [AccountGetResponse] +type accountGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGetResponseErrorJSON `json:"-"` +} + +// accountGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountGetResponseError] +type accountGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGetResponseMessageJSON `json:"-"` +} + +// accountGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountGetResponseMessage] +type accountGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGetResponseSuccess bool + +const ( + AccountGetResponseSuccessTrue AccountGetResponseSuccess = true +) + +type AccountUpdateResponse struct { + Errors []AccountUpdateResponseError `json:"errors"` + Messages []AccountUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountUpdateResponseSuccess `json:"success"` + JSON accountUpdateResponseJSON `json:"-"` +} + +// accountUpdateResponseJSON contains the JSON metadata for the struct +// [AccountUpdateResponse] +type accountUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountUpdateResponseErrorJSON `json:"-"` +} + +// accountUpdateResponseErrorJSON contains the JSON metadata for the struct +// [AccountUpdateResponseError] +type accountUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountUpdateResponseMessageJSON `json:"-"` +} + +// accountUpdateResponseMessageJSON contains the JSON metadata for the struct +// [AccountUpdateResponseMessage] +type accountUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountUpdateResponseSuccess bool + +const ( + AccountUpdateResponseSuccessTrue AccountUpdateResponseSuccess = true +) + +type AccountAccountsListAccountsResponse = interface{} + +type AccountUpdateParams struct { + // Account name + Name param.Field[string] `json:"name,required"` + // Account settings + Settings param.Field[AccountUpdateParamsSettings] `json:"settings"` +} + +func (r AccountUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Account settings +type AccountUpdateParamsSettings struct { + // Specifies the default nameservers to be used for new zones added to this + // account. + // + // - `cloudflare.standard` for Cloudflare-branded nameservers + // - `custom.account` for account custom nameservers + // - `custom.tenant` for tenant custom nameservers + // + // See + // [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) + // for more information. + DefaultNameservers param.Field[AccountUpdateParamsSettingsDefaultNameservers] `json:"default_nameservers"` + // Indicates whether membership in this account requires that Two-Factor + // Authentication is enabled + EnforceTwofactor param.Field[bool] `json:"enforce_twofactor"` + // Indicates whether new zones should use the account-level custom nameservers by + // default + UseAccountCustomNsByDefault param.Field[bool] `json:"use_account_custom_ns_by_default"` +} + +func (r AccountUpdateParamsSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Specifies the default nameservers to be used for new zones added to this +// account. +// +// - `cloudflare.standard` for Cloudflare-branded nameservers +// - `custom.account` for account custom nameservers +// - `custom.tenant` for tenant custom nameservers +// +// See +// [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) +// for more information. +type AccountUpdateParamsSettingsDefaultNameservers string + +const ( + AccountUpdateParamsSettingsDefaultNameserversCloudflareStandard AccountUpdateParamsSettingsDefaultNameservers = "cloudflare.standard" + AccountUpdateParamsSettingsDefaultNameserversCustomAccount AccountUpdateParamsSettingsDefaultNameservers = "custom.account" + AccountUpdateParamsSettingsDefaultNameserversCustomTenant AccountUpdateParamsSettingsDefaultNameservers = "custom.tenant" +) + +type AccountAccountsListAccountsParams struct { + // Direction to order results. + Direction param.Field[AccountAccountsListAccountsParamsDirection] `query:"direction"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [AccountAccountsListAccountsParams]'s query parameters as +// `url.Values`. +func (r AccountAccountsListAccountsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order results. +type AccountAccountsListAccountsParamsDirection string + +const ( + AccountAccountsListAccountsParamsDirectionAsc AccountAccountsListAccountsParamsDirection = "asc" + AccountAccountsListAccountsParamsDirectionDesc AccountAccountsListAccountsParamsDirection = "desc" +) diff --git a/account_test.go b/account_test.go new file mode 100644 index 00000000000..3da6c21adde --- /dev/null +++ b/account_test.go @@ -0,0 +1,107 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Get(context.TODO(), map[string]interface{}{}) + 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 TestAccountUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Update( + context.TODO(), + map[string]interface{}{}, + cloudflare.AccountUpdateParams{ + Name: cloudflare.F("Demo Account"), + Settings: cloudflare.F(cloudflare.AccountUpdateParamsSettings{ + DefaultNameservers: cloudflare.F(cloudflare.AccountUpdateParamsSettingsDefaultNameserversCloudflareStandard), + EnforceTwofactor: cloudflare.F(true), + UseAccountCustomNsByDefault: cloudflare.F(true), + }), + }, + ) + 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 TestAccountAccountsListAccountsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.AccountsListAccounts(context.TODO(), cloudflare.AccountAccountsListAccountsParams{ + Direction: cloudflare.F(cloudflare.AccountAccountsListAccountsParamsDirectionDesc), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }) + 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/accountaccess.go b/accountaccess.go new file mode 100644 index 00000000000..135f512e4b6 --- /dev/null +++ b/accountaccess.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessService 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 [NewAccountAccessService] method +// instead. +type AccountAccessService struct { + Options []option.RequestOption + Bookmarks *AccountAccessBookmarkService + Certificates *AccountAccessCertificateService + CustomPages *AccountAccessCustomPageService + Groups *AccountAccessGroupService + IdentityProviders *AccountAccessIdentityProviderService + Keys *AccountAccessKeyService + Logs *AccountAccessLogService + Organizations *AccountAccessOrganizationService + Seats *AccountAccessSeatService + ServiceTokens *AccountAccessServiceTokenService + Tags *AccountAccessTagService + Users *AccountAccessUserService +} + +// NewAccountAccessService 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 NewAccountAccessService(opts ...option.RequestOption) (r *AccountAccessService) { + r = &AccountAccessService{} + r.Options = opts + r.Bookmarks = NewAccountAccessBookmarkService(opts...) + r.Certificates = NewAccountAccessCertificateService(opts...) + r.CustomPages = NewAccountAccessCustomPageService(opts...) + r.Groups = NewAccountAccessGroupService(opts...) + r.IdentityProviders = NewAccountAccessIdentityProviderService(opts...) + r.Keys = NewAccountAccessKeyService(opts...) + r.Logs = NewAccountAccessLogService(opts...) + r.Organizations = NewAccountAccessOrganizationService(opts...) + r.Seats = NewAccountAccessSeatService(opts...) + r.ServiceTokens = NewAccountAccessServiceTokenService(opts...) + r.Tags = NewAccountAccessTagService(opts...) + r.Users = NewAccountAccessUserService(opts...) + return +} diff --git a/accountaccessbookmark.go b/accountaccessbookmark.go new file mode 100644 index 00000000000..9ea43deb040 --- /dev/null +++ b/accountaccessbookmark.go @@ -0,0 +1,605 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessBookmarkService 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 [NewAccountAccessBookmarkService] +// method instead. +type AccountAccessBookmarkService struct { + Options []option.RequestOption +} + +// NewAccountAccessBookmarkService 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 NewAccountAccessBookmarkService(opts ...option.RequestOption) (r *AccountAccessBookmarkService) { + r = &AccountAccessBookmarkService{} + r.Options = opts + return +} + +// Create a new Bookmark application. +func (r *AccountAccessBookmarkService) New(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountAccessBookmarkNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/access/bookmarks/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Fetches a single Bookmark application. +func (r *AccountAccessBookmarkService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountAccessBookmarkGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/access/bookmarks/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured Bookmark application. +func (r *AccountAccessBookmarkService) Update(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountAccessBookmarkUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/access/bookmarks/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +// Deletes a Bookmark application. +func (r *AccountAccessBookmarkService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountAccessBookmarkDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/access/bookmarks/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists Bookmark applications. +func (r *AccountAccessBookmarkService) AccessBookmarkApplicationsDeprecatedListBookmarkApplications(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/access/bookmarks", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessBookmarkNewResponse struct { + Errors []AccountAccessBookmarkNewResponseError `json:"errors"` + Messages []AccountAccessBookmarkNewResponseMessage `json:"messages"` + Result AccountAccessBookmarkNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessBookmarkNewResponseSuccess `json:"success"` + JSON accountAccessBookmarkNewResponseJSON `json:"-"` +} + +// accountAccessBookmarkNewResponseJSON contains the JSON metadata for the struct +// [AccountAccessBookmarkNewResponse] +type accountAccessBookmarkNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkNewResponseErrorJSON `json:"-"` +} + +// accountAccessBookmarkNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkNewResponseError] +type accountAccessBookmarkNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkNewResponseMessageJSON `json:"-"` +} + +// accountAccessBookmarkNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkNewResponseMessage] +type accountAccessBookmarkNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkNewResponseResult struct { + // The unique identifier for the Bookmark application. + ID interface{} `json:"id"` + // Displays the application in the App Launcher. + AppLauncherVisible bool `json:"app_launcher_visible"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The domain of the Bookmark application. + Domain string `json:"domain"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL string `json:"logo_url"` + // The name of the Bookmark application. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessBookmarkNewResponseResultJSON `json:"-"` +} + +// accountAccessBookmarkNewResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkNewResponseResult] +type accountAccessBookmarkNewResponseResultJSON struct { + ID apijson.Field + AppLauncherVisible apijson.Field + CreatedAt apijson.Field + Domain apijson.Field + LogoURL apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessBookmarkNewResponseSuccess bool + +const ( + AccountAccessBookmarkNewResponseSuccessTrue AccountAccessBookmarkNewResponseSuccess = true +) + +type AccountAccessBookmarkGetResponse struct { + Errors []AccountAccessBookmarkGetResponseError `json:"errors"` + Messages []AccountAccessBookmarkGetResponseMessage `json:"messages"` + Result AccountAccessBookmarkGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessBookmarkGetResponseSuccess `json:"success"` + JSON accountAccessBookmarkGetResponseJSON `json:"-"` +} + +// accountAccessBookmarkGetResponseJSON contains the JSON metadata for the struct +// [AccountAccessBookmarkGetResponse] +type accountAccessBookmarkGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkGetResponseErrorJSON `json:"-"` +} + +// accountAccessBookmarkGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkGetResponseError] +type accountAccessBookmarkGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkGetResponseMessageJSON `json:"-"` +} + +// accountAccessBookmarkGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkGetResponseMessage] +type accountAccessBookmarkGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkGetResponseResult struct { + // The unique identifier for the Bookmark application. + ID interface{} `json:"id"` + // Displays the application in the App Launcher. + AppLauncherVisible bool `json:"app_launcher_visible"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The domain of the Bookmark application. + Domain string `json:"domain"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL string `json:"logo_url"` + // The name of the Bookmark application. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessBookmarkGetResponseResultJSON `json:"-"` +} + +// accountAccessBookmarkGetResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkGetResponseResult] +type accountAccessBookmarkGetResponseResultJSON struct { + ID apijson.Field + AppLauncherVisible apijson.Field + CreatedAt apijson.Field + Domain apijson.Field + LogoURL apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessBookmarkGetResponseSuccess bool + +const ( + AccountAccessBookmarkGetResponseSuccessTrue AccountAccessBookmarkGetResponseSuccess = true +) + +type AccountAccessBookmarkUpdateResponse struct { + Errors []AccountAccessBookmarkUpdateResponseError `json:"errors"` + Messages []AccountAccessBookmarkUpdateResponseMessage `json:"messages"` + Result AccountAccessBookmarkUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessBookmarkUpdateResponseSuccess `json:"success"` + JSON accountAccessBookmarkUpdateResponseJSON `json:"-"` +} + +// accountAccessBookmarkUpdateResponseJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkUpdateResponse] +type accountAccessBookmarkUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkUpdateResponseErrorJSON `json:"-"` +} + +// accountAccessBookmarkUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkUpdateResponseError] +type accountAccessBookmarkUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkUpdateResponseMessageJSON `json:"-"` +} + +// accountAccessBookmarkUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountAccessBookmarkUpdateResponseMessage] +type accountAccessBookmarkUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkUpdateResponseResult struct { + // The unique identifier for the Bookmark application. + ID interface{} `json:"id"` + // Displays the application in the App Launcher. + AppLauncherVisible bool `json:"app_launcher_visible"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The domain of the Bookmark application. + Domain string `json:"domain"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL string `json:"logo_url"` + // The name of the Bookmark application. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessBookmarkUpdateResponseResultJSON `json:"-"` +} + +// accountAccessBookmarkUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkUpdateResponseResult] +type accountAccessBookmarkUpdateResponseResultJSON struct { + ID apijson.Field + AppLauncherVisible apijson.Field + CreatedAt apijson.Field + Domain apijson.Field + LogoURL apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessBookmarkUpdateResponseSuccess bool + +const ( + AccountAccessBookmarkUpdateResponseSuccessTrue AccountAccessBookmarkUpdateResponseSuccess = true +) + +type AccountAccessBookmarkDeleteResponse struct { + Errors []AccountAccessBookmarkDeleteResponseError `json:"errors"` + Messages []AccountAccessBookmarkDeleteResponseMessage `json:"messages"` + Result AccountAccessBookmarkDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessBookmarkDeleteResponseSuccess `json:"success"` + JSON accountAccessBookmarkDeleteResponseJSON `json:"-"` +} + +// accountAccessBookmarkDeleteResponseJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkDeleteResponse] +type accountAccessBookmarkDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkDeleteResponseErrorJSON `json:"-"` +} + +// accountAccessBookmarkDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkDeleteResponseError] +type accountAccessBookmarkDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkDeleteResponseMessageJSON `json:"-"` +} + +// accountAccessBookmarkDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountAccessBookmarkDeleteResponseMessage] +type accountAccessBookmarkDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAccessBookmarkDeleteResponseResultJSON `json:"-"` +} + +// accountAccessBookmarkDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessBookmarkDeleteResponseResult] +type accountAccessBookmarkDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessBookmarkDeleteResponseSuccess bool + +const ( + AccountAccessBookmarkDeleteResponseSuccessTrue AccountAccessBookmarkDeleteResponseSuccess = true +) + +type AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponse struct { + Errors []AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseError `json:"errors"` + Messages []AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseMessage `json:"messages"` + Result []AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResult `json:"result"` + ResultInfo AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseSuccess `json:"success"` + JSON accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseJSON `json:"-"` +} + +// accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponse] +type accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseErrorJSON `json:"-"` +} + +// accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseError] +type accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseMessageJSON `json:"-"` +} + +// accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseMessage] +type accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResult struct { + // The unique identifier for the Bookmark application. + ID interface{} `json:"id"` + // Displays the application in the App Launcher. + AppLauncherVisible bool `json:"app_launcher_visible"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The domain of the Bookmark application. + Domain string `json:"domain"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL string `json:"logo_url"` + // The name of the Bookmark application. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultJSON `json:"-"` +} + +// accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResult] +type accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultJSON struct { + ID apijson.Field + AppLauncherVisible apijson.Field + CreatedAt apijson.Field + Domain apijson.Field + LogoURL apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultInfoJSON `json:"-"` +} + +// accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultInfo] +type accountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseSuccess bool + +const ( + AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseSuccessTrue AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponseSuccess = true +) diff --git a/accountaccessbookmark_test.go b/accountaccessbookmark_test.go new file mode 100644 index 00000000000..0d215fb710a --- /dev/null +++ b/accountaccessbookmark_test.go @@ -0,0 +1,160 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessBookmarkNew(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Bookmarks.New( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessBookmarkGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Bookmarks.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessBookmarkUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Bookmarks.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessBookmarkDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Bookmarks.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplications(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Bookmarks.AccessBookmarkApplicationsDeprecatedListBookmarkApplications(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountaccesscertificate.go b/accountaccesscertificate.go new file mode 100644 index 00000000000..555ec9fbf62 --- /dev/null +++ b/accountaccesscertificate.go @@ -0,0 +1,632 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessCertificateService 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 +// [NewAccountAccessCertificateService] method instead. +type AccountAccessCertificateService struct { + Options []option.RequestOption + Settings *AccountAccessCertificateSettingService +} + +// NewAccountAccessCertificateService 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 NewAccountAccessCertificateService(opts ...option.RequestOption) (r *AccountAccessCertificateService) { + r = &AccountAccessCertificateService{} + r.Options = opts + r.Settings = NewAccountAccessCertificateSettingService(opts...) + return +} + +// Fetches a single mTLS certificate. +func (r *AccountAccessCertificateService) Get(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessCertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/certificates/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured mTLS certificate. +func (r *AccountAccessCertificateService) Update(ctx context.Context, identifier string, uuid string, body AccountAccessCertificateUpdateParams, opts ...option.RequestOption) (res *AccountAccessCertificateUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/certificates/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an mTLS certificate. +func (r *AccountAccessCertificateService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessCertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/certificates/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds a new mTLS root certificate to Access. +func (r *AccountAccessCertificateService) AccessMTlsAuthenticationAddAnMTlsCertificate(ctx context.Context, identifier string, body AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateParams, opts ...option.RequestOption) (res *AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/certificates", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all mTLS root certificates. +func (r *AccountAccessCertificateService) AccessMTlsAuthenticationListMTlsCertificates(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/certificates", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessCertificateGetResponse struct { + Errors []AccountAccessCertificateGetResponseError `json:"errors"` + Messages []AccountAccessCertificateGetResponseMessage `json:"messages"` + Result AccountAccessCertificateGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCertificateGetResponseSuccess `json:"success"` + JSON accountAccessCertificateGetResponseJSON `json:"-"` +} + +// accountAccessCertificateGetResponseJSON contains the JSON metadata for the +// struct [AccountAccessCertificateGetResponse] +type accountAccessCertificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateGetResponseErrorJSON `json:"-"` +} + +// accountAccessCertificateGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessCertificateGetResponseError] +type accountAccessCertificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateGetResponseMessageJSON `json:"-"` +} + +// accountAccessCertificateGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountAccessCertificateGetResponseMessage] +type accountAccessCertificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateGetResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCertificateGetResponseResultJSON `json:"-"` +} + +// accountAccessCertificateGetResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessCertificateGetResponseResult] +type accountAccessCertificateGetResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCertificateGetResponseSuccess bool + +const ( + AccountAccessCertificateGetResponseSuccessTrue AccountAccessCertificateGetResponseSuccess = true +) + +type AccountAccessCertificateUpdateResponse struct { + Errors []AccountAccessCertificateUpdateResponseError `json:"errors"` + Messages []AccountAccessCertificateUpdateResponseMessage `json:"messages"` + Result AccountAccessCertificateUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCertificateUpdateResponseSuccess `json:"success"` + JSON accountAccessCertificateUpdateResponseJSON `json:"-"` +} + +// accountAccessCertificateUpdateResponseJSON contains the JSON metadata for the +// struct [AccountAccessCertificateUpdateResponse] +type accountAccessCertificateUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateUpdateResponseErrorJSON `json:"-"` +} + +// accountAccessCertificateUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountAccessCertificateUpdateResponseError] +type accountAccessCertificateUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateUpdateResponseMessageJSON `json:"-"` +} + +// accountAccessCertificateUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountAccessCertificateUpdateResponseMessage] +type accountAccessCertificateUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateUpdateResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCertificateUpdateResponseResultJSON `json:"-"` +} + +// accountAccessCertificateUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountAccessCertificateUpdateResponseResult] +type accountAccessCertificateUpdateResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCertificateUpdateResponseSuccess bool + +const ( + AccountAccessCertificateUpdateResponseSuccessTrue AccountAccessCertificateUpdateResponseSuccess = true +) + +type AccountAccessCertificateDeleteResponse struct { + Errors []AccountAccessCertificateDeleteResponseError `json:"errors"` + Messages []AccountAccessCertificateDeleteResponseMessage `json:"messages"` + Result AccountAccessCertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCertificateDeleteResponseSuccess `json:"success"` + JSON accountAccessCertificateDeleteResponseJSON `json:"-"` +} + +// accountAccessCertificateDeleteResponseJSON contains the JSON metadata for the +// struct [AccountAccessCertificateDeleteResponse] +type accountAccessCertificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateDeleteResponseErrorJSON `json:"-"` +} + +// accountAccessCertificateDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountAccessCertificateDeleteResponseError] +type accountAccessCertificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateDeleteResponseMessageJSON `json:"-"` +} + +// accountAccessCertificateDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountAccessCertificateDeleteResponseMessage] +type accountAccessCertificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAccessCertificateDeleteResponseResultJSON `json:"-"` +} + +// accountAccessCertificateDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountAccessCertificateDeleteResponseResult] +type accountAccessCertificateDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCertificateDeleteResponseSuccess bool + +const ( + AccountAccessCertificateDeleteResponseSuccessTrue AccountAccessCertificateDeleteResponseSuccess = true +) + +type AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponse struct { + Errors []AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseError `json:"errors"` + Messages []AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseMessage `json:"messages"` + Result AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseSuccess `json:"success"` + JSON accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponse] +type accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseErrorJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseError] +type accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseMessageJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseMessage] +type accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseResultJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseResult] +type accountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseSuccess bool + +const ( + AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseSuccessTrue AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponseSuccess = true +) + +type AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponse struct { + Errors []AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseError `json:"errors"` + Messages []AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseMessage `json:"messages"` + Result []AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResult `json:"result"` + ResultInfo AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseSuccess `json:"success"` + JSON accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponse] +type accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseErrorJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseError] +type accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseMessageJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseMessage] +type accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResult] +type accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultInfoJSON `json:"-"` +} + +// accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultInfo] +type accountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseSuccess bool + +const ( + AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseSuccessTrue AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponseSuccess = true +) + +type AccountAccessCertificateUpdateParams struct { + // The hostnames of the applications that will use this certificate. + AssociatedHostnames param.Field[[]string] `json:"associated_hostnames,required"` + // The name of the certificate. + Name param.Field[string] `json:"name"` +} + +func (r AccountAccessCertificateUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateParams struct { + // The certificate content. + Certificate param.Field[string] `json:"certificate,required"` + // The name of the certificate. + Name param.Field[string] `json:"name,required"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames param.Field[[]string] `json:"associated_hostnames"` +} + +func (r AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccesscertificate_test.go b/accountaccesscertificate_test.go new file mode 100644 index 00000000000..ac939b47129 --- /dev/null +++ b/accountaccesscertificate_test.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Certificates.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessCertificateUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Certificates.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountAccessCertificateUpdateParams{ + AssociatedHostnames: cloudflare.F([]string{"admin.example.com", "admin.example.com", "admin.example.com"}), + Name: cloudflare.F("Allow devs"), + }, + ) + 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 TestAccountAccessCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Certificates.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Certificates.AccessMTlsAuthenticationAddAnMTlsCertificate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateParams{ + Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIGAjCCA+qgAwIBAgIJAI7kymlF7CWT...N4RI7KKB7nikiuUf8vhULKy5IX10\nDrUtmu/B\n-----END CERTIFICATE-----"), + Name: cloudflare.F("Allow devs"), + AssociatedHostnames: cloudflare.F([]string{"admin.example.com", "admin.example.com", "admin.example.com"}), + }, + ) + 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 TestAccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificates(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Certificates.AccessMTlsAuthenticationListMTlsCertificates(context.TODO(), "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/accountaccesscertificatesetting.go b/accountaccesscertificatesetting.go new file mode 100644 index 00000000000..3b0138bda23 --- /dev/null +++ b/accountaccesscertificatesetting.go @@ -0,0 +1,323 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessCertificateSettingService 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 +// [NewAccountAccessCertificateSettingService] method instead. +type AccountAccessCertificateSettingService struct { + Options []option.RequestOption +} + +// NewAccountAccessCertificateSettingService 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 NewAccountAccessCertificateSettingService(opts ...option.RequestOption) (r *AccountAccessCertificateSettingService) { + r = &AccountAccessCertificateSettingService{} + r.Options = opts + return +} + +// Updates an mTLS certificate's hostname settings. +func (r *AccountAccessCertificateSettingService) Update(ctx context.Context, identifier string, body AccountAccessCertificateSettingUpdateParams, opts ...option.RequestOption) (res *AccountAccessCertificateSettingUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/certificates/settings", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// List all mTLS hostname settings for this account. +func (r *AccountAccessCertificateSettingService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessCertificateSettingListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/certificates/settings", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessCertificateSettingUpdateResponse struct { + Errors []AccountAccessCertificateSettingUpdateResponseError `json:"errors"` + Messages []AccountAccessCertificateSettingUpdateResponseMessage `json:"messages"` + Result []AccountAccessCertificateSettingUpdateResponseResult `json:"result"` + ResultInfo AccountAccessCertificateSettingUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessCertificateSettingUpdateResponseSuccess `json:"success"` + JSON accountAccessCertificateSettingUpdateResponseJSON `json:"-"` +} + +// accountAccessCertificateSettingUpdateResponseJSON contains the JSON metadata for +// the struct [AccountAccessCertificateSettingUpdateResponse] +type accountAccessCertificateSettingUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateSettingUpdateResponseErrorJSON `json:"-"` +} + +// accountAccessCertificateSettingUpdateResponseErrorJSON contains the JSON +// metadata for the struct [AccountAccessCertificateSettingUpdateResponseError] +type accountAccessCertificateSettingUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateSettingUpdateResponseMessageJSON `json:"-"` +} + +// accountAccessCertificateSettingUpdateResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessCertificateSettingUpdateResponseMessage] +type accountAccessCertificateSettingUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingUpdateResponseResult struct { + // Request client certificates for this hostname in China. Can only be set to true + // if this zone is china network enabled. + ChinaNetwork bool `json:"china_network,required"` + // Client Certificate Forwarding is a feature that takes the client cert provided + // by the eyeball to the edge, and forwards it to the origin as a HTTP header to + // allow logging on the origin. + ClientCertificateForwarding bool `json:"client_certificate_forwarding,required"` + // The hostname that these settings apply to. + Hostname string `json:"hostname,required"` + JSON accountAccessCertificateSettingUpdateResponseResultJSON `json:"-"` +} + +// accountAccessCertificateSettingUpdateResponseResultJSON contains the JSON +// metadata for the struct [AccountAccessCertificateSettingUpdateResponseResult] +type accountAccessCertificateSettingUpdateResponseResultJSON struct { + ChinaNetwork apijson.Field + ClientCertificateForwarding apijson.Field + Hostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessCertificateSettingUpdateResponseResultInfoJSON `json:"-"` +} + +// accountAccessCertificateSettingUpdateResponseResultInfoJSON contains the JSON +// metadata for the struct +// [AccountAccessCertificateSettingUpdateResponseResultInfo] +type accountAccessCertificateSettingUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCertificateSettingUpdateResponseSuccess bool + +const ( + AccountAccessCertificateSettingUpdateResponseSuccessTrue AccountAccessCertificateSettingUpdateResponseSuccess = true +) + +type AccountAccessCertificateSettingListResponse struct { + Errors []AccountAccessCertificateSettingListResponseError `json:"errors"` + Messages []AccountAccessCertificateSettingListResponseMessage `json:"messages"` + Result []AccountAccessCertificateSettingListResponseResult `json:"result"` + ResultInfo AccountAccessCertificateSettingListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessCertificateSettingListResponseSuccess `json:"success"` + JSON accountAccessCertificateSettingListResponseJSON `json:"-"` +} + +// accountAccessCertificateSettingListResponseJSON contains the JSON metadata for +// the struct [AccountAccessCertificateSettingListResponse] +type accountAccessCertificateSettingListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateSettingListResponseErrorJSON `json:"-"` +} + +// accountAccessCertificateSettingListResponseErrorJSON contains the JSON metadata +// for the struct [AccountAccessCertificateSettingListResponseError] +type accountAccessCertificateSettingListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCertificateSettingListResponseMessageJSON `json:"-"` +} + +// accountAccessCertificateSettingListResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessCertificateSettingListResponseMessage] +type accountAccessCertificateSettingListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingListResponseResult struct { + // Request client certificates for this hostname in China. Can only be set to true + // if this zone is china network enabled. + ChinaNetwork bool `json:"china_network,required"` + // Client Certificate Forwarding is a feature that takes the client cert provided + // by the eyeball to the edge, and forwards it to the origin as a HTTP header to + // allow logging on the origin. + ClientCertificateForwarding bool `json:"client_certificate_forwarding,required"` + // The hostname that these settings apply to. + Hostname string `json:"hostname,required"` + JSON accountAccessCertificateSettingListResponseResultJSON `json:"-"` +} + +// accountAccessCertificateSettingListResponseResultJSON contains the JSON metadata +// for the struct [AccountAccessCertificateSettingListResponseResult] +type accountAccessCertificateSettingListResponseResultJSON struct { + ChinaNetwork apijson.Field + ClientCertificateForwarding apijson.Field + Hostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCertificateSettingListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessCertificateSettingListResponseResultInfoJSON `json:"-"` +} + +// accountAccessCertificateSettingListResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountAccessCertificateSettingListResponseResultInfo] +type accountAccessCertificateSettingListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCertificateSettingListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCertificateSettingListResponseSuccess bool + +const ( + AccountAccessCertificateSettingListResponseSuccessTrue AccountAccessCertificateSettingListResponseSuccess = true +) + +type AccountAccessCertificateSettingUpdateParams struct { + Settings param.Field[[]AccountAccessCertificateSettingUpdateParamsSetting] `json:"settings,required"` +} + +func (r AccountAccessCertificateSettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessCertificateSettingUpdateParamsSetting struct { + // Request client certificates for this hostname in China. Can only be set to true + // if this zone is china network enabled. + ChinaNetwork param.Field[bool] `json:"china_network,required"` + // Client Certificate Forwarding is a feature that takes the client cert provided + // by the eyeball to the edge, and forwards it to the origin as a HTTP header to + // allow logging on the origin. + ClientCertificateForwarding param.Field[bool] `json:"client_certificate_forwarding,required"` + // The hostname that these settings apply to. + Hostname param.Field[string] `json:"hostname,required"` +} + +func (r AccountAccessCertificateSettingUpdateParamsSetting) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccesscertificatesetting_test.go b/accountaccesscertificatesetting_test.go new file mode 100644 index 00000000000..06aa581dcb1 --- /dev/null +++ b/accountaccesscertificatesetting_test.go @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessCertificateSettingUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Certificates.Settings.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessCertificateSettingUpdateParams{ + Settings: cloudflare.F([]cloudflare.AccountAccessCertificateSettingUpdateParamsSetting{{ + ChinaNetwork: cloudflare.F(false), + ClientCertificateForwarding: cloudflare.F(true), + Hostname: cloudflare.F("admin.example.com"), + }, { + ChinaNetwork: cloudflare.F(false), + ClientCertificateForwarding: cloudflare.F(true), + Hostname: cloudflare.F("admin.example.com"), + }, { + ChinaNetwork: cloudflare.F(false), + ClientCertificateForwarding: cloudflare.F(true), + Hostname: cloudflare.F("admin.example.com"), + }}), + }, + ) + 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 TestAccountAccessCertificateSettingList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Certificates.Settings.List(context.TODO(), "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/accountaccesscustompage.go b/accountaccesscustompage.go new file mode 100644 index 00000000000..6a0b104cf9a --- /dev/null +++ b/accountaccesscustompage.go @@ -0,0 +1,670 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessCustomPageService 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 +// [NewAccountAccessCustomPageService] method instead. +type AccountAccessCustomPageService struct { + Options []option.RequestOption +} + +// NewAccountAccessCustomPageService 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 NewAccountAccessCustomPageService(opts ...option.RequestOption) (r *AccountAccessCustomPageService) { + r = &AccountAccessCustomPageService{} + r.Options = opts + return +} + +// Create a custom page +func (r *AccountAccessCustomPageService) New(ctx context.Context, identifier string, body AccountAccessCustomPageNewParams, opts ...option.RequestOption) (res *AccountAccessCustomPageNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/custom_pages", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List custom pages +func (r *AccountAccessCustomPageService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessCustomPageListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/custom_pages", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a custom page +func (r *AccountAccessCustomPageService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessCustomPageDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/custom_pages/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Fetches a custom page and also returns its HTML. +func (r *AccountAccessCustomPageService) GetCustomPage(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessCustomPageGetCustomPageResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/custom_pages/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a custom page +func (r *AccountAccessCustomPageService) UpdateCustomPage(ctx context.Context, identifier string, uuid string, body AccountAccessCustomPageUpdateCustomPageParams, opts ...option.RequestOption) (res *AccountAccessCustomPageUpdateCustomPageResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/custom_pages/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountAccessCustomPageNewResponse struct { + Errors []AccountAccessCustomPageNewResponseError `json:"errors"` + Messages []AccountAccessCustomPageNewResponseMessage `json:"messages"` + Result AccountAccessCustomPageNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCustomPageNewResponseSuccess `json:"success"` + JSON accountAccessCustomPageNewResponseJSON `json:"-"` +} + +// accountAccessCustomPageNewResponseJSON contains the JSON metadata for the struct +// [AccountAccessCustomPageNewResponse] +type accountAccessCustomPageNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageNewResponseErrorJSON `json:"-"` +} + +// accountAccessCustomPageNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessCustomPageNewResponseError] +type accountAccessCustomPageNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageNewResponseMessageJSON `json:"-"` +} + +// accountAccessCustomPageNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessCustomPageNewResponseMessage] +type accountAccessCustomPageNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageNewResponseResult struct { + // Custom page name. + Name string `json:"name,required"` + // Custom page type. + Type AccountAccessCustomPageNewResponseResultType `json:"type,required"` + // Number of apps the custom page is assigned to. + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // UUID + Uid string `json:"uid"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCustomPageNewResponseResultJSON `json:"-"` +} + +// accountAccessCustomPageNewResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessCustomPageNewResponseResult] +type accountAccessCustomPageNewResponseResultJSON struct { + Name apijson.Field + Type apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + Uid apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Custom page type. +type AccountAccessCustomPageNewResponseResultType string + +const ( + AccountAccessCustomPageNewResponseResultTypeIdentityDenied AccountAccessCustomPageNewResponseResultType = "identity_denied" + AccountAccessCustomPageNewResponseResultTypeForbidden AccountAccessCustomPageNewResponseResultType = "forbidden" +) + +// Whether the API call was successful +type AccountAccessCustomPageNewResponseSuccess bool + +const ( + AccountAccessCustomPageNewResponseSuccessTrue AccountAccessCustomPageNewResponseSuccess = true +) + +type AccountAccessCustomPageListResponse struct { + Errors []AccountAccessCustomPageListResponseError `json:"errors"` + Messages []AccountAccessCustomPageListResponseMessage `json:"messages"` + Result []AccountAccessCustomPageListResponseResult `json:"result"` + ResultInfo AccountAccessCustomPageListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessCustomPageListResponseSuccess `json:"success"` + JSON accountAccessCustomPageListResponseJSON `json:"-"` +} + +// accountAccessCustomPageListResponseJSON contains the JSON metadata for the +// struct [AccountAccessCustomPageListResponse] +type accountAccessCustomPageListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageListResponseErrorJSON `json:"-"` +} + +// accountAccessCustomPageListResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessCustomPageListResponseError] +type accountAccessCustomPageListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageListResponseMessageJSON `json:"-"` +} + +// accountAccessCustomPageListResponseMessageJSON contains the JSON metadata for +// the struct [AccountAccessCustomPageListResponseMessage] +type accountAccessCustomPageListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageListResponseResult struct { + // Custom page name. + Name string `json:"name,required"` + // Custom page type. + Type AccountAccessCustomPageListResponseResultType `json:"type,required"` + // Number of apps the custom page is assigned to. + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // UUID + Uid string `json:"uid"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCustomPageListResponseResultJSON `json:"-"` +} + +// accountAccessCustomPageListResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessCustomPageListResponseResult] +type accountAccessCustomPageListResponseResultJSON struct { + Name apijson.Field + Type apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + Uid apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Custom page type. +type AccountAccessCustomPageListResponseResultType string + +const ( + AccountAccessCustomPageListResponseResultTypeIdentityDenied AccountAccessCustomPageListResponseResultType = "identity_denied" + AccountAccessCustomPageListResponseResultTypeForbidden AccountAccessCustomPageListResponseResultType = "forbidden" +) + +type AccountAccessCustomPageListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessCustomPageListResponseResultInfoJSON `json:"-"` +} + +// accountAccessCustomPageListResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountAccessCustomPageListResponseResultInfo] +type accountAccessCustomPageListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCustomPageListResponseSuccess bool + +const ( + AccountAccessCustomPageListResponseSuccessTrue AccountAccessCustomPageListResponseSuccess = true +) + +type AccountAccessCustomPageDeleteResponse struct { + Errors []AccountAccessCustomPageDeleteResponseError `json:"errors"` + Messages []AccountAccessCustomPageDeleteResponseMessage `json:"messages"` + Result AccountAccessCustomPageDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCustomPageDeleteResponseSuccess `json:"success"` + JSON accountAccessCustomPageDeleteResponseJSON `json:"-"` +} + +// accountAccessCustomPageDeleteResponseJSON contains the JSON metadata for the +// struct [AccountAccessCustomPageDeleteResponse] +type accountAccessCustomPageDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageDeleteResponseErrorJSON `json:"-"` +} + +// accountAccessCustomPageDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountAccessCustomPageDeleteResponseError] +type accountAccessCustomPageDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageDeleteResponseMessageJSON `json:"-"` +} + +// accountAccessCustomPageDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountAccessCustomPageDeleteResponseMessage] +type accountAccessCustomPageDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAccessCustomPageDeleteResponseResultJSON `json:"-"` +} + +// accountAccessCustomPageDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountAccessCustomPageDeleteResponseResult] +type accountAccessCustomPageDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessCustomPageDeleteResponseSuccess bool + +const ( + AccountAccessCustomPageDeleteResponseSuccessTrue AccountAccessCustomPageDeleteResponseSuccess = true +) + +type AccountAccessCustomPageGetCustomPageResponse struct { + Errors []AccountAccessCustomPageGetCustomPageResponseError `json:"errors"` + Messages []AccountAccessCustomPageGetCustomPageResponseMessage `json:"messages"` + Result AccountAccessCustomPageGetCustomPageResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCustomPageGetCustomPageResponseSuccess `json:"success"` + JSON accountAccessCustomPageGetCustomPageResponseJSON `json:"-"` +} + +// accountAccessCustomPageGetCustomPageResponseJSON contains the JSON metadata for +// the struct [AccountAccessCustomPageGetCustomPageResponse] +type accountAccessCustomPageGetCustomPageResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageGetCustomPageResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageGetCustomPageResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageGetCustomPageResponseErrorJSON `json:"-"` +} + +// accountAccessCustomPageGetCustomPageResponseErrorJSON contains the JSON metadata +// for the struct [AccountAccessCustomPageGetCustomPageResponseError] +type accountAccessCustomPageGetCustomPageResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageGetCustomPageResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageGetCustomPageResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageGetCustomPageResponseMessageJSON `json:"-"` +} + +// accountAccessCustomPageGetCustomPageResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessCustomPageGetCustomPageResponseMessage] +type accountAccessCustomPageGetCustomPageResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageGetCustomPageResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageGetCustomPageResponseResult struct { + // Custom page HTML. + CustomHTML string `json:"custom_html,required"` + // Custom page name. + Name string `json:"name,required"` + // Custom page type. + Type AccountAccessCustomPageGetCustomPageResponseResultType `json:"type,required"` + // Number of apps the custom page is assigned to. + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // UUID + Uid string `json:"uid"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCustomPageGetCustomPageResponseResultJSON `json:"-"` +} + +// accountAccessCustomPageGetCustomPageResponseResultJSON contains the JSON +// metadata for the struct [AccountAccessCustomPageGetCustomPageResponseResult] +type accountAccessCustomPageGetCustomPageResponseResultJSON struct { + CustomHTML apijson.Field + Name apijson.Field + Type apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + Uid apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageGetCustomPageResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Custom page type. +type AccountAccessCustomPageGetCustomPageResponseResultType string + +const ( + AccountAccessCustomPageGetCustomPageResponseResultTypeIdentityDenied AccountAccessCustomPageGetCustomPageResponseResultType = "identity_denied" + AccountAccessCustomPageGetCustomPageResponseResultTypeForbidden AccountAccessCustomPageGetCustomPageResponseResultType = "forbidden" +) + +// Whether the API call was successful +type AccountAccessCustomPageGetCustomPageResponseSuccess bool + +const ( + AccountAccessCustomPageGetCustomPageResponseSuccessTrue AccountAccessCustomPageGetCustomPageResponseSuccess = true +) + +type AccountAccessCustomPageUpdateCustomPageResponse struct { + Errors []AccountAccessCustomPageUpdateCustomPageResponseError `json:"errors"` + Messages []AccountAccessCustomPageUpdateCustomPageResponseMessage `json:"messages"` + Result AccountAccessCustomPageUpdateCustomPageResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessCustomPageUpdateCustomPageResponseSuccess `json:"success"` + JSON accountAccessCustomPageUpdateCustomPageResponseJSON `json:"-"` +} + +// accountAccessCustomPageUpdateCustomPageResponseJSON contains the JSON metadata +// for the struct [AccountAccessCustomPageUpdateCustomPageResponse] +type accountAccessCustomPageUpdateCustomPageResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageUpdateCustomPageResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageUpdateCustomPageResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageUpdateCustomPageResponseErrorJSON `json:"-"` +} + +// accountAccessCustomPageUpdateCustomPageResponseErrorJSON contains the JSON +// metadata for the struct [AccountAccessCustomPageUpdateCustomPageResponseError] +type accountAccessCustomPageUpdateCustomPageResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageUpdateCustomPageResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageUpdateCustomPageResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessCustomPageUpdateCustomPageResponseMessageJSON `json:"-"` +} + +// accountAccessCustomPageUpdateCustomPageResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessCustomPageUpdateCustomPageResponseMessage] +type accountAccessCustomPageUpdateCustomPageResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageUpdateCustomPageResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessCustomPageUpdateCustomPageResponseResult struct { + // Custom page name. + Name string `json:"name,required"` + // Custom page type. + Type AccountAccessCustomPageUpdateCustomPageResponseResultType `json:"type,required"` + // Number of apps the custom page is assigned to. + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // UUID + Uid string `json:"uid"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessCustomPageUpdateCustomPageResponseResultJSON `json:"-"` +} + +// accountAccessCustomPageUpdateCustomPageResponseResultJSON contains the JSON +// metadata for the struct [AccountAccessCustomPageUpdateCustomPageResponseResult] +type accountAccessCustomPageUpdateCustomPageResponseResultJSON struct { + Name apijson.Field + Type apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + Uid apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessCustomPageUpdateCustomPageResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Custom page type. +type AccountAccessCustomPageUpdateCustomPageResponseResultType string + +const ( + AccountAccessCustomPageUpdateCustomPageResponseResultTypeIdentityDenied AccountAccessCustomPageUpdateCustomPageResponseResultType = "identity_denied" + AccountAccessCustomPageUpdateCustomPageResponseResultTypeForbidden AccountAccessCustomPageUpdateCustomPageResponseResultType = "forbidden" +) + +// Whether the API call was successful +type AccountAccessCustomPageUpdateCustomPageResponseSuccess bool + +const ( + AccountAccessCustomPageUpdateCustomPageResponseSuccessTrue AccountAccessCustomPageUpdateCustomPageResponseSuccess = true +) + +type AccountAccessCustomPageNewParams struct { + // Custom page HTML. + CustomHTML param.Field[string] `json:"custom_html,required"` + // Custom page name. + Name param.Field[string] `json:"name,required"` + // Custom page type. + Type param.Field[AccountAccessCustomPageNewParamsType] `json:"type,required"` + // Number of apps the custom page is assigned to. + AppCount param.Field[int64] `json:"app_count"` +} + +func (r AccountAccessCustomPageNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Custom page type. +type AccountAccessCustomPageNewParamsType string + +const ( + AccountAccessCustomPageNewParamsTypeIdentityDenied AccountAccessCustomPageNewParamsType = "identity_denied" + AccountAccessCustomPageNewParamsTypeForbidden AccountAccessCustomPageNewParamsType = "forbidden" +) + +type AccountAccessCustomPageUpdateCustomPageParams struct { + // Custom page HTML. + CustomHTML param.Field[string] `json:"custom_html,required"` + // Custom page name. + Name param.Field[string] `json:"name,required"` + // Custom page type. + Type param.Field[AccountAccessCustomPageUpdateCustomPageParamsType] `json:"type,required"` + // Number of apps the custom page is assigned to. + AppCount param.Field[int64] `json:"app_count"` +} + +func (r AccountAccessCustomPageUpdateCustomPageParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Custom page type. +type AccountAccessCustomPageUpdateCustomPageParamsType string + +const ( + AccountAccessCustomPageUpdateCustomPageParamsTypeIdentityDenied AccountAccessCustomPageUpdateCustomPageParamsType = "identity_denied" + AccountAccessCustomPageUpdateCustomPageParamsTypeForbidden AccountAccessCustomPageUpdateCustomPageParamsType = "forbidden" +) diff --git a/accountaccesscustompage_test.go b/accountaccesscustompage_test.go new file mode 100644 index 00000000000..ac36e41302e --- /dev/null +++ b/accountaccesscustompage_test.go @@ -0,0 +1,171 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessCustomPageNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.CustomPages.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessCustomPageNewParams{ + CustomHTML: cloudflare.F("

Access Denied

"), + Name: cloudflare.F("string"), + Type: cloudflare.F(cloudflare.AccountAccessCustomPageNewParamsTypeIdentityDenied), + AppCount: cloudflare.F(int64(0)), + }, + ) + 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 TestAccountAccessCustomPageList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.CustomPages.List(context.TODO(), "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()) + } +} + +func TestAccountAccessCustomPageDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.CustomPages.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessCustomPageGetCustomPage(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.CustomPages.GetCustomPage( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessCustomPageUpdateCustomPageWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.CustomPages.UpdateCustomPage( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountAccessCustomPageUpdateCustomPageParams{ + CustomHTML: cloudflare.F("

Access Denied

"), + Name: cloudflare.F("string"), + Type: cloudflare.F(cloudflare.AccountAccessCustomPageUpdateCustomPageParamsTypeIdentityDenied), + AppCount: cloudflare.F(int64(0)), + }, + ) + 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/accountaccessgroup.go b/accountaccessgroup.go new file mode 100644 index 00000000000..229535dbe4b --- /dev/null +++ b/accountaccessgroup.go @@ -0,0 +1,15550 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessGroupService 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 [NewAccountAccessGroupService] method +// instead. +type AccountAccessGroupService struct { + Options []option.RequestOption +} + +// NewAccountAccessGroupService 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 NewAccountAccessGroupService(opts ...option.RequestOption) (r *AccountAccessGroupService) { + r = &AccountAccessGroupService{} + r.Options = opts + return +} + +// Fetches a single Access group. +func (r *AccountAccessGroupService) Get(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessGroupGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/groups/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured Access group. +func (r *AccountAccessGroupService) Update(ctx context.Context, identifier string, uuid string, body AccountAccessGroupUpdateParams, opts ...option.RequestOption) (res *AccountAccessGroupUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/groups/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an Access group. +func (r *AccountAccessGroupService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessGroupDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/groups/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new Access group. +func (r *AccountAccessGroupService) AccessGroupsNewAnAccessGroup(ctx context.Context, identifier string, body AccountAccessGroupAccessGroupsNewAnAccessGroupParams, opts ...option.RequestOption) (res *AccountAccessGroupAccessGroupsNewAnAccessGroupResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/groups", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all Access groups. +func (r *AccountAccessGroupService) AccessGroupsListAccessGroups(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessGroupAccessGroupsListAccessGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/groups", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessGroupGetResponse struct { + Errors []AccountAccessGroupGetResponseError `json:"errors"` + Messages []AccountAccessGroupGetResponseMessage `json:"messages"` + Result AccountAccessGroupGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessGroupGetResponseSuccess `json:"success"` + JSON accountAccessGroupGetResponseJSON `json:"-"` +} + +// accountAccessGroupGetResponseJSON contains the JSON metadata for the struct +// [AccountAccessGroupGetResponse] +type accountAccessGroupGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupGetResponseErrorJSON `json:"-"` +} + +// accountAccessGroupGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseError] +type accountAccessGroupGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupGetResponseMessageJSON `json:"-"` +} + +// accountAccessGroupGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessGroupGetResponseMessage] +type accountAccessGroupGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupGetResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []AccountAccessGroupGetResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []AccountAccessGroupGetResponseResultInclude `json:"include"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + IsDefault []AccountAccessGroupGetResponseResultIsDefault `json:"is_default"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []AccountAccessGroupGetResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessGroupGetResponseResultJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessGroupGetResponseResult] +type accountAccessGroupGetResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + IsDefault apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupGetResponseResultExcludePajwohLqEmailRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqDomainRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqEveryoneRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqIPRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqIPListRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqCertificateRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqCountryRule], +// [AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule] or +// [AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule]. +type AccountAccessGroupGetResponseResultExclude interface { + implementsAccountAccessGroupGetResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupGetResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupGetResponseResultExcludePajwohLqEmailRule struct { + Email AccountAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqEmailRule] +type accountAccessGroupGetResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqEmailRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail] +type accountAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRule] +type accountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList] +type accountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupGetResponseResultExcludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqDomainRule] +type accountAccessGroupGetResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqDomainRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupGetResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqEveryoneRule] +type accountAccessGroupGetResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqEveryoneRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +// Matches an IP address block. +type AccountAccessGroupGetResponseResultExcludePajwohLqIPRule struct { + IP AccountAccessGroupGetResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqIPRule] +type accountAccessGroupGetResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqIPRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqIPRuleIP] +type accountAccessGroupGetResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupGetResponseResultExcludePajwohLqIPListRule struct { + IPList AccountAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqIPListRule] +type accountAccessGroupGetResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqIPListRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList] +type accountAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupGetResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqCertificateRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqCertificateRule] +type accountAccessGroupGetResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqCertificateRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +// Matches an Access group. +type AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule] +type accountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule] +type accountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule] +type accountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule] +type accountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule] +type accountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule] +type accountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule] +type accountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule] +type accountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupGetResponseResultExcludePajwohLqCountryRule struct { + Geo AccountAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqCountryRule] +type accountAccessGroupGetResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqCountryRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo] +type accountAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule] +type accountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule] +type accountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule) implementsAccountAccessGroupGetResponseResultExclude() { +} + +type AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupGetResponseResultIncludePajwohLqEmailRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqDomainRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqEveryoneRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqIPRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqIPListRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqCertificateRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqCountryRule], +// [AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule] or +// [AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule]. +type AccountAccessGroupGetResponseResultInclude interface { + implementsAccountAccessGroupGetResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupGetResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupGetResponseResultIncludePajwohLqEmailRule struct { + Email AccountAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqEmailRule] +type accountAccessGroupGetResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqEmailRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail] +type accountAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRule] +type accountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList] +type accountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupGetResponseResultIncludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqDomainRule] +type accountAccessGroupGetResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqDomainRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupGetResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqEveryoneRule] +type accountAccessGroupGetResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqEveryoneRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +// Matches an IP address block. +type AccountAccessGroupGetResponseResultIncludePajwohLqIPRule struct { + IP AccountAccessGroupGetResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqIPRule] +type accountAccessGroupGetResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqIPRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqIPRuleIP] +type accountAccessGroupGetResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupGetResponseResultIncludePajwohLqIPListRule struct { + IPList AccountAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqIPListRule] +type accountAccessGroupGetResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqIPListRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList] +type accountAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupGetResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqCertificateRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqCertificateRule] +type accountAccessGroupGetResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqCertificateRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +// Matches an Access group. +type AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule] +type accountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule] +type accountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule] +type accountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule] +type accountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule] +type accountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule] +type accountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule] +type accountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule] +type accountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupGetResponseResultIncludePajwohLqCountryRule struct { + Geo AccountAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqCountryRule] +type accountAccessGroupGetResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqCountryRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo] +type accountAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule] +type accountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule] +type accountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule) implementsAccountAccessGroupGetResponseResultInclude() { +} + +type AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRule], +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +// or [AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRule]. +type AccountAccessGroupGetResponseResultIsDefault interface { + implementsAccountAccessGroupGetResponseResultIsDefault() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupGetResponseResultIsDefault)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRule struct { + Email AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleEmail] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRule struct { + EmailList AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleEmailList] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRule struct { + EmailDomain AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleEmailDomain] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqEveryoneRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +// Matches an IP address block. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRule struct { + IP AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleJSON contains the JSON +// metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleIPJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleIP] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRule struct { + IPList AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleIPList] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqCertificateRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +// Matches an Access group. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRule struct { + Group AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleGroup] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRule struct { + Okta AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleOkta] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRule struct { + Saml AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleSaml] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRule struct { + Geo AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleGeo] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRule] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRule) implementsAccountAccessGroupGetResponseResultIsDefault() { +} + +type AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupGetResponseResultRequirePajwohLqEmailRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqDomainRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqEveryoneRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqIPRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqIPListRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqCertificateRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqCountryRule], +// [AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule] or +// [AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule]. +type AccountAccessGroupGetResponseResultRequire interface { + implementsAccountAccessGroupGetResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupGetResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupGetResponseResultRequirePajwohLqEmailRule struct { + Email AccountAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqEmailRule] +type accountAccessGroupGetResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqEmailRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail] +type accountAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRule struct { + EmailList AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRule] +type accountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList] +type accountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupGetResponseResultRequirePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqDomainRule] +type accountAccessGroupGetResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqDomainRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain] +type accountAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupGetResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqEveryoneRule] +type accountAccessGroupGetResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqEveryoneRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +// Matches an IP address block. +type AccountAccessGroupGetResponseResultRequirePajwohLqIPRule struct { + IP AccountAccessGroupGetResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqIPRuleJSON contains the JSON +// metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqIPRule] +type accountAccessGroupGetResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqIPRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqIPRuleIP] +type accountAccessGroupGetResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupGetResponseResultRequirePajwohLqIPListRule struct { + IPList AccountAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqIPListRule] +type accountAccessGroupGetResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqIPListRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList] +type accountAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupGetResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqCertificateRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqCertificateRule] +type accountAccessGroupGetResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqCertificateRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +// Matches an Access group. +type AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule struct { + Group AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule] +type accountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup] +type accountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule] +type accountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule] +type accountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule] +type accountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule] +type accountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta] +type accountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule] +type accountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml] +type accountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule] +type accountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule] +type accountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupGetResponseResultRequirePajwohLqCountryRule struct { + Geo AccountAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqCountryRule] +type accountAccessGroupGetResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqCountryRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo] +type accountAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule] +type accountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule] +type accountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule) implementsAccountAccessGroupGetResponseResultRequire() { +} + +type AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessGroupGetResponseSuccess bool + +const ( + AccountAccessGroupGetResponseSuccessTrue AccountAccessGroupGetResponseSuccess = true +) + +type AccountAccessGroupUpdateResponse struct { + Errors []AccountAccessGroupUpdateResponseError `json:"errors"` + Messages []AccountAccessGroupUpdateResponseMessage `json:"messages"` + Result AccountAccessGroupUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessGroupUpdateResponseSuccess `json:"success"` + JSON accountAccessGroupUpdateResponseJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseJSON contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponse] +type accountAccessGroupUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupUpdateResponseErrorJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessGroupUpdateResponseError] +type accountAccessGroupUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupUpdateResponseMessageJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessGroupUpdateResponseMessage] +type accountAccessGroupUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupUpdateResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []AccountAccessGroupUpdateResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []AccountAccessGroupUpdateResponseResultInclude `json:"include"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + IsDefault []AccountAccessGroupUpdateResponseResultIsDefault `json:"is_default"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []AccountAccessGroupUpdateResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessGroupUpdateResponseResultJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessGroupUpdateResponseResult] +type accountAccessGroupUpdateResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + IsDefault apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRule], +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule] +// or [AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule]. +type AccountAccessGroupUpdateResponseResultExclude interface { + implementsAccountAccessGroupUpdateResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupUpdateResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRule struct { + Email AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail] +type accountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList] +type accountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +// Matches an IP address block. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRule struct { + IP AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIPJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP] +type accountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRule struct { + IPList AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList] +type accountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +// Matches an Access group. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRule struct { + Geo AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo] +type accountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule] +type accountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule) implementsAccountAccessGroupUpdateResponseResultExclude() { +} + +type AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRule], +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule] +// or [AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule]. +type AccountAccessGroupUpdateResponseResultInclude interface { + implementsAccountAccessGroupUpdateResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupUpdateResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRule struct { + Email AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail] +type accountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList] +type accountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +// Matches an IP address block. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRule struct { + IP AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIPJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP] +type accountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRule struct { + IPList AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList] +type accountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +// Matches an Access group. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRule struct { + Geo AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo] +type accountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule] +type accountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule) implementsAccountAccessGroupUpdateResponseResultInclude() { +} + +type AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRule], +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +// or [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRule]. +type AccountAccessGroupUpdateResponseResultIsDefault interface { + implementsAccountAccessGroupUpdateResponseResultIsDefault() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupUpdateResponseResultIsDefault)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRule struct { + Email AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleEmail] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRule struct { + EmailList AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleEmailList] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRule struct { + EmailDomain AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleEmailDomain] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqEveryoneRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +// Matches an IP address block. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRule struct { + IP AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleIPJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleIP] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRule struct { + IPList AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleIPList] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCertificateRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +// Matches an Access group. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRule struct { + Group AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleGroup] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRule struct { + Okta AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleOkta] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRule struct { + Saml AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleSaml] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRule struct { + Geo AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleGeo] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRule] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRule) implementsAccountAccessGroupUpdateResponseResultIsDefault() { +} + +type AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRule], +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule] +// or [AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule]. +type AccountAccessGroupUpdateResponseResultRequire interface { + implementsAccountAccessGroupUpdateResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupUpdateResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRule struct { + Email AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail] +type accountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule struct { + EmailList AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList] +type accountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain] +type accountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +// Matches an IP address block. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRule struct { + IP AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIPJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP] +type accountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRule struct { + IPList AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList] +type accountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +// Matches an Access group. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule struct { + Group AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup] +type accountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta] +type accountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml] +type accountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRule struct { + Geo AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo] +type accountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule] +type accountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule) implementsAccountAccessGroupUpdateResponseResultRequire() { +} + +type AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessGroupUpdateResponseSuccess bool + +const ( + AccountAccessGroupUpdateResponseSuccessTrue AccountAccessGroupUpdateResponseSuccess = true +) + +type AccountAccessGroupDeleteResponse struct { + Errors []AccountAccessGroupDeleteResponseError `json:"errors"` + Messages []AccountAccessGroupDeleteResponseMessage `json:"messages"` + Result AccountAccessGroupDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessGroupDeleteResponseSuccess `json:"success"` + JSON accountAccessGroupDeleteResponseJSON `json:"-"` +} + +// accountAccessGroupDeleteResponseJSON contains the JSON metadata for the struct +// [AccountAccessGroupDeleteResponse] +type accountAccessGroupDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupDeleteResponseErrorJSON `json:"-"` +} + +// accountAccessGroupDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessGroupDeleteResponseError] +type accountAccessGroupDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupDeleteResponseMessageJSON `json:"-"` +} + +// accountAccessGroupDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessGroupDeleteResponseMessage] +type accountAccessGroupDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAccessGroupDeleteResponseResultJSON `json:"-"` +} + +// accountAccessGroupDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessGroupDeleteResponseResult] +type accountAccessGroupDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessGroupDeleteResponseSuccess bool + +const ( + AccountAccessGroupDeleteResponseSuccessTrue AccountAccessGroupDeleteResponseSuccess = true +) + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponse struct { + Errors []AccountAccessGroupAccessGroupsNewAnAccessGroupResponseError `json:"errors"` + Messages []AccountAccessGroupAccessGroupsNewAnAccessGroupResponseMessage `json:"messages"` + Result AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessGroupAccessGroupsNewAnAccessGroupResponseSuccess `json:"success"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseJSON contains the JSON +// metadata for the struct [AccountAccessGroupAccessGroupsNewAnAccessGroupResponse] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseErrorJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseError] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseMessageJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseMessage] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude `json:"include"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + IsDefault []AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault `json:"is_default"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResult] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + IsDefault apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude interface { + implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude interface { + implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault interface { + implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire interface { + implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsNewAnAccessGroupResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessGroupAccessGroupsNewAnAccessGroupResponseSuccess bool + +const ( + AccountAccessGroupAccessGroupsNewAnAccessGroupResponseSuccessTrue AccountAccessGroupAccessGroupsNewAnAccessGroupResponseSuccess = true +) + +type AccountAccessGroupAccessGroupsListAccessGroupsResponse struct { + Errors []AccountAccessGroupAccessGroupsListAccessGroupsResponseError `json:"errors"` + Messages []AccountAccessGroupAccessGroupsListAccessGroupsResponseMessage `json:"messages"` + Result []AccountAccessGroupAccessGroupsListAccessGroupsResponseResult `json:"result"` + ResultInfo AccountAccessGroupAccessGroupsListAccessGroupsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessGroupAccessGroupsListAccessGroupsResponseSuccess `json:"success"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseJSON contains the JSON +// metadata for the struct [AccountAccessGroupAccessGroupsListAccessGroupsResponse] +type accountAccessGroupAccessGroupsListAccessGroupsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseErrorJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseError] +type accountAccessGroupAccessGroupsListAccessGroupsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseMessageJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseMessage] +type accountAccessGroupAccessGroupsListAccessGroupsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []AccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude `json:"include"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + IsDefault []AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault `json:"is_default"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultJSON contains the +// JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResult] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + IsDefault apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude interface { + implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultExclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude interface { + implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultInclude() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault interface { + implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefault() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultIsDefaultPajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRule] +// or +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire interface { + implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRule struct { + Email AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleEmailJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleEmail] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRule struct { + EmailList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleEmailList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRule struct { + EmailDomain AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleEmailDomain] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRule struct { + IP AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleIPJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleIP] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRule struct { + IPList AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleIPListJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleIPList] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRule struct { + Group AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleGroup] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRule struct { + Okta AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleOkta] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRule struct { + Saml AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleSaml] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRule struct { + Geo AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleGeoJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleGeo] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRule] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequire() { +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessGroupAccessGroupsListAccessGroupsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessGroupAccessGroupsListAccessGroupsResponseResultInfoJSON `json:"-"` +} + +// accountAccessGroupAccessGroupsListAccessGroupsResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountAccessGroupAccessGroupsListAccessGroupsResponseResultInfo] +type accountAccessGroupAccessGroupsListAccessGroupsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessGroupAccessGroupsListAccessGroupsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessGroupAccessGroupsListAccessGroupsResponseSuccess bool + +const ( + AccountAccessGroupAccessGroupsListAccessGroupsResponseSuccessTrue AccountAccessGroupAccessGroupsListAccessGroupsResponseSuccess = true +) + +type AccountAccessGroupUpdateParams struct { + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include param.Field[[]AccountAccessGroupUpdateParamsInclude] `json:"include,required"` + // The name of the Access group. + Name param.Field[string] `json:"name,required"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude param.Field[[]AccountAccessGroupUpdateParamsExclude] `json:"exclude"` + // Whether this is the default group + IsDefault param.Field[bool] `json:"is_default"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require param.Field[[]AccountAccessGroupUpdateParamsRequire] `json:"require"` +} + +func (r AccountAccessGroupUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqEmailListRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqDomainRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqEveryoneRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqIPRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqIPListRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqCertificateRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqCountryRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule], +// [AccountAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule]. +type AccountAccessGroupUpdateParamsInclude interface { + implementsAccountAccessGroupUpdateParamsInclude() +} + +// Matches a specific email. +type AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule struct { + Email param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type AccountAccessGroupUpdateParamsIncludePajwohLqEmailListRule struct { + EmailList param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEmailListRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type AccountAccessGroupUpdateParamsIncludePajwohLqDomainRule struct { + EmailDomain param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqDomainRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type AccountAccessGroupUpdateParamsIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqEveryoneRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +// Matches an IP address block. +type AccountAccessGroupUpdateParamsIncludePajwohLqIPRule struct { + IP param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqIPRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type AccountAccessGroupUpdateParamsIncludePajwohLqIPListRule struct { + IPList param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqIPListRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type AccountAccessGroupUpdateParamsIncludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqCertificateRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +// Matches an Access group. +type AccountAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule struct { + Group param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule struct { + AzureAd param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule struct { + Okta param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule struct { + Saml param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type AccountAccessGroupUpdateParamsIncludePajwohLqCountryRule struct { + Geo param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqCountryRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type AccountAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[AccountAccessGroupUpdateParamsIncludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule) implementsAccountAccessGroupUpdateParamsInclude() { +} + +type AccountAccessGroupUpdateParamsIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r AccountAccessGroupUpdateParamsIncludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqEmailListRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqDomainRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqEveryoneRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqIPRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqIPListRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqCertificateRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqCountryRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule], +// [AccountAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule]. +type AccountAccessGroupUpdateParamsExclude interface { + implementsAccountAccessGroupUpdateParamsExclude() +} + +// Matches a specific email. +type AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule struct { + Email param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type AccountAccessGroupUpdateParamsExcludePajwohLqEmailListRule struct { + EmailList param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEmailListRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type AccountAccessGroupUpdateParamsExcludePajwohLqDomainRule struct { + EmailDomain param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqDomainRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type AccountAccessGroupUpdateParamsExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqEveryoneRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +// Matches an IP address block. +type AccountAccessGroupUpdateParamsExcludePajwohLqIPRule struct { + IP param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqIPRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type AccountAccessGroupUpdateParamsExcludePajwohLqIPListRule struct { + IPList param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqIPListRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type AccountAccessGroupUpdateParamsExcludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqCertificateRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +// Matches an Access group. +type AccountAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule struct { + Group param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule struct { + AzureAd param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule struct { + Okta param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule struct { + Saml param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type AccountAccessGroupUpdateParamsExcludePajwohLqCountryRule struct { + Geo param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqCountryRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type AccountAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[AccountAccessGroupUpdateParamsExcludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule) implementsAccountAccessGroupUpdateParamsExclude() { +} + +type AccountAccessGroupUpdateParamsExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r AccountAccessGroupUpdateParamsExcludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqEmailListRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqDomainRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqEveryoneRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqIPRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqIPListRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqCertificateRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqCountryRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule], +// [AccountAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule]. +type AccountAccessGroupUpdateParamsRequire interface { + implementsAccountAccessGroupUpdateParamsRequire() +} + +// Matches a specific email. +type AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule struct { + Email param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type AccountAccessGroupUpdateParamsRequirePajwohLqEmailListRule struct { + EmailList param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEmailListRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type AccountAccessGroupUpdateParamsRequirePajwohLqDomainRule struct { + EmailDomain param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqDomainRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type AccountAccessGroupUpdateParamsRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqEveryoneRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +// Matches an IP address block. +type AccountAccessGroupUpdateParamsRequirePajwohLqIPRule struct { + IP param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqIPRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type AccountAccessGroupUpdateParamsRequirePajwohLqIPListRule struct { + IPList param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqIPListRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type AccountAccessGroupUpdateParamsRequirePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqCertificateRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +// Matches an Access group. +type AccountAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule struct { + Group param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule struct { + AzureAd param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule struct { + Okta param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule struct { + Saml param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule struct { + ServiceToken param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type AccountAccessGroupUpdateParamsRequirePajwohLqCountryRule struct { + Geo param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqCountryRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type AccountAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule struct { + DevicePosture param.Field[AccountAccessGroupUpdateParamsRequirePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule) implementsAccountAccessGroupUpdateParamsRequire() { +} + +type AccountAccessGroupUpdateParamsRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r AccountAccessGroupUpdateParamsRequirePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParams struct { + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include param.Field[[]AccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude] `json:"include,required"` + // The name of the Access group. + Name param.Field[string] `json:"name,required"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude param.Field[[]AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude] `json:"exclude"` + // Whether this is the default group + IsDefault param.Field[bool] `json:"is_default"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require param.Field[[]AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire] `json:"require"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAuthenticationMethodRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude interface { + implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule struct { + Email param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailListRule struct { + EmailList param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDomainRule struct { + EmailDomain param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPRule struct { + IP param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPListRule struct { + IPList param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAccessGroupRule struct { + Group param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAzureGroupRule struct { + AzureAd param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqOktaGroupRule struct { + Okta param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqSamlGroupRule struct { + Saml param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCountryRule struct { + Geo param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAuthenticationMethodRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude interface { + implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule struct { + Email param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailListRule struct { + EmailList param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDomainRule struct { + EmailDomain param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPRule struct { + IP param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPListRule struct { + IPList param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAccessGroupRule struct { + Group param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAzureGroupRule struct { + AzureAd param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqOktaGroupRule struct { + Okta param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqSamlGroupRule struct { + Saml param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCountryRule struct { + Geo param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDomainRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEveryoneRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPListRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCertificateRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAccessGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAzureGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGitHubOrganizationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGsuiteGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqOktaGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqSamlGroupRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAnyValidServiceTokenRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqExternalEvaluationRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCountryRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAuthenticationMethodRule], +// [AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDevicePostureRule]. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire interface { + implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() +} + +// Matches a specific email. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule struct { + Email param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailListRule struct { + EmailList param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDomainRule struct { + EmailDomain param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDomainRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEveryoneRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +// Matches an IP address block. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPRule struct { + IP param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPListRule struct { + IPList param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPListRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCertificateRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +// Matches an Access group. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAccessGroupRule struct { + Group param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAccessGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAzureGroupRule struct { + AzureAd param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAzureGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGitHubOrganizationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGsuiteGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqOktaGroupRule struct { + Okta param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqOktaGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqSamlGroupRule struct { + Saml param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqSamlGroupRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqServiceTokenRule struct { + ServiceToken param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAnyValidServiceTokenRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqExternalEvaluationRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCountryRule struct { + Geo param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCountryRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAuthenticationMethodRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDevicePostureRule struct { + DevicePosture param.Field[AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDevicePostureRule) implementsAccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire() { +} + +type AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccessgroup_test.go b/accountaccessgroup_test.go new file mode 100644 index 00000000000..fef37470d28 --- /dev/null +++ b/accountaccessgroup_test.go @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessGroupGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Groups.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessGroupUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Groups.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountAccessGroupUpdateParams{ + Include: cloudflare.F([]cloudflare.AccountAccessGroupUpdateParamsInclude{cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + Name: cloudflare.F("Allow devs"), + Exclude: cloudflare.F([]cloudflare.AccountAccessGroupUpdateParamsExclude{cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + IsDefault: cloudflare.F(true), + Require: cloudflare.F([]cloudflare.AccountAccessGroupUpdateParamsRequire{cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule(cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + }, + ) + 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 TestAccountAccessGroupDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Groups.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessGroupAccessGroupsNewAnAccessGroupWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Groups.AccessGroupsNewAnAccessGroup( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParams{ + Include: cloudflare.F([]cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsInclude{cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + Name: cloudflare.F("Allow devs"), + Exclude: cloudflare.F([]cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExclude{cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + IsDefault: cloudflare.F(true), + Require: cloudflare.F([]cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequire{cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + }, + ) + 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 TestAccountAccessGroupAccessGroupsListAccessGroups(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Groups.AccessGroupsListAccessGroups(context.TODO(), "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/accountaccessidentityprovider.go b/accountaccessidentityprovider.go new file mode 100644 index 00000000000..3cf8a7389f7 --- /dev/null +++ b/accountaccessidentityprovider.go @@ -0,0 +1,9948 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessIdentityProviderService 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 +// [NewAccountAccessIdentityProviderService] method instead. +type AccountAccessIdentityProviderService struct { + Options []option.RequestOption +} + +// NewAccountAccessIdentityProviderService 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 NewAccountAccessIdentityProviderService(opts ...option.RequestOption) (r *AccountAccessIdentityProviderService) { + r = &AccountAccessIdentityProviderService{} + r.Options = opts + return +} + +// Fetches a configured identity provider. +func (r *AccountAccessIdentityProviderService) Get(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessIdentityProviderGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/identity_providers/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured identity provider. +func (r *AccountAccessIdentityProviderService) Update(ctx context.Context, identifier string, uuid string, body AccountAccessIdentityProviderUpdateParams, opts ...option.RequestOption) (res *AccountAccessIdentityProviderUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/identity_providers/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an identity provider from Access. +func (r *AccountAccessIdentityProviderService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessIdentityProviderDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/identity_providers/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds a new identity provider to Access. +func (r *AccountAccessIdentityProviderService) AccessIdentityProvidersAddAnAccessIdentityProvider(ctx context.Context, identifier string, body AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams, opts ...option.RequestOption) (res *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/identity_providers", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all configured identity providers. +func (r *AccountAccessIdentityProviderService) AccessIdentityProvidersListAccessIdentityProviders(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/identity_providers", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessIdentityProviderGetResponse struct { + Errors []AccountAccessIdentityProviderGetResponseError `json:"errors"` + Messages []AccountAccessIdentityProviderGetResponseMessage `json:"messages"` + Result AccountAccessIdentityProviderGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessIdentityProviderGetResponseSuccess `json:"success"` + JSON accountAccessIdentityProviderGetResponseJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseJSON contains the JSON metadata for the +// struct [AccountAccessIdentityProviderGetResponse] +type accountAccessIdentityProviderGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderGetResponseErrorJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountAccessIdentityProviderGetResponseError] +type accountAccessIdentityProviderGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderGetResponseMessageJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseMessageJSON contains the JSON metadata +// for the struct [AccountAccessIdentityProviderGetResponseMessage] +type accountAccessIdentityProviderGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAd], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqCentrify], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqFacebook], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGitHub], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogle], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleApps], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedin], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOidc], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOkta], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOnelogin], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqPingone], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqSaml], +// [AccountAccessIdentityProviderGetResponseResultPajwohLqYandex] or +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepin]. +type AccountAccessIdentityProviderGetResponseResult interface { + implementsAccountAccessIdentityProviderGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessIdentityProviderGetResponseResult)(nil)).Elem(), "") +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAd struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAd] +type accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAd) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + EmailClaimName apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqAzureAdType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqCentrify struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqCentrify] +type accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqCentrify) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqCentrifyType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqFacebook struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqFacebookJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqFacebookJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqFacebook] +type accountAccessIdentityProviderGetResponseResultPajwohLqFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqFacebook) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqFacebookConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqFacebookConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqFacebookScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqFacebookType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqGitHub struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGitHubJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGitHubJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGitHub] +type accountAccessIdentityProviderGetResponseResultPajwohLqGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqGitHub) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGitHubConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGitHubConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGitHubScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqGitHubType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogle struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGoogleJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGoogleJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogle] +type accountAccessIdentityProviderGetResponseResultPajwohLqGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqGoogle) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGoogleConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGoogleConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqGoogleConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGoogleScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleApps struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleApps] +type accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleApps) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqGoogleAppsType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedin] +type accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedin) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqLinkedinType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOidc struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOidcJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOidcJSON contains the JSON +// metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOidc] +type accountAccessIdentityProviderGetResponseResultPajwohLqOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqOidc) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOidcConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOidcConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOidcConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOidcScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOidcScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOidcScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqOidcTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqOidcType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOkta struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOktaJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOktaJSON contains the JSON +// metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOkta] +type accountAccessIdentityProviderGetResponseResultPajwohLqOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqOkta) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID string `json:"authorization_server_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOktaConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOktaConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOktaConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqOktaConfigJSON struct { + AuthorizationServerID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOktaScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOktaScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOktaScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqOktaTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqOktaType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOnelogin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOneloginJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOneloginJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOnelogin] +type accountAccessIdentityProviderGetResponseResultPajwohLqOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqOnelogin) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOneloginConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOneloginConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqOneloginConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOneloginScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqOneloginType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqPingone struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqPingoneJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqPingoneJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqPingone] +type accountAccessIdentityProviderGetResponseResultPajwohLqPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqPingone) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqPingoneConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqPingoneConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqPingoneConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqPingoneScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqPingoneType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqSaml struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqSamlJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqSamlJSON contains the JSON +// metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqSaml] +type accountAccessIdentityProviderGetResponseResultPajwohLqSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqSaml) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigHeaderAttributeJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigHeaderAttribute] +type accountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqSamlScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqSamlScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqSamlScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqSamlTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqSamlType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqYandex struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderGetResponseResultPajwohLqYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqYandexJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqYandexJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqYandex] +type accountAccessIdentityProviderGetResponseResultPajwohLqYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqYandex) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqYandexConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqYandexConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqYandexConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqYandexScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqYandexScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqYandexScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "onetimepin" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeAzureAd AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "azureAD" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeSaml AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "saml" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeCentrify AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "centrify" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeFacebook AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "facebook" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeGitHub AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "github" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeGoogleApps AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "google-apps" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeGoogle AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "google" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeLinkedin AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "linkedin" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeOidc AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "oidc" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeOkta AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "okta" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeOnelogin AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "onelogin" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypePingone AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "pingone" + AccountAccessIdentityProviderGetResponseResultPajwohLqYandexTypeYandex AccountAccessIdentityProviderGetResponseResultPajwohLqYandexType = "yandex" +) + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepin struct { + // UUID + ID string `json:"id"` + Config interface{} `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinScimConfig `json:"scim_config"` + Type AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinType `json:"type"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepin] +type accountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepin) implementsAccountAccessIdentityProviderGetResponseResult() { +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinScimConfig] +type accountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinType string + +const ( + AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinTypeOnetimepin AccountAccessIdentityProviderGetResponseResultPajwohLqOnetimepinType = "onetimepin" +) + +// Whether the API call was successful +type AccountAccessIdentityProviderGetResponseSuccess bool + +const ( + AccountAccessIdentityProviderGetResponseSuccessTrue AccountAccessIdentityProviderGetResponseSuccess = true +) + +type AccountAccessIdentityProviderUpdateResponse struct { + Errors []AccountAccessIdentityProviderUpdateResponseError `json:"errors"` + Messages []AccountAccessIdentityProviderUpdateResponseMessage `json:"messages"` + Result AccountAccessIdentityProviderUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessIdentityProviderUpdateResponseSuccess `json:"success"` + JSON accountAccessIdentityProviderUpdateResponseJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseJSON contains the JSON metadata for +// the struct [AccountAccessIdentityProviderUpdateResponse] +type accountAccessIdentityProviderUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderUpdateResponseErrorJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountAccessIdentityProviderUpdateResponseError] +type accountAccessIdentityProviderUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderUpdateResponseMessageJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessIdentityProviderUpdateResponseMessage] +type accountAccessIdentityProviderUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAd], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrify], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebook], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHub], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogle], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleApps], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedin], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidc], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOkta], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnelogin], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingone], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqSaml], +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandex] or +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepin]. +type AccountAccessIdentityProviderUpdateResponseResult interface { + implementsAccountAccessIdentityProviderUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessIdentityProviderUpdateResponseResult)(nil)).Elem(), "") +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAd struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAd] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAd) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + EmailClaimName apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqAzureAdType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrify struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrify] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrify) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqCentrifyType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebook struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebook] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebook) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqFacebookType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHub struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHub] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHub) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqGitHubType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogle struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogle] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogle) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleApps struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleApps] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleApps) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqGoogleAppsType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedin] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedin) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqLinkedinType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidc struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidc] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidc) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqOidcType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOkta struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOkta] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqOkta) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID string `json:"authorization_server_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaConfigJSON struct { + AuthorizationServerID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqOktaType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnelogin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnelogin] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnelogin) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqOneloginType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingone struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingone] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingone) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqPingoneType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqSaml struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqSaml] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqSaml) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigHeaderAttributeJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigHeaderAttribute] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqSamlType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandex struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexJSON contains the +// JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandex] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandex) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "onetimepin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeAzureAd AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "azureAD" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeSaml AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "saml" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeCentrify AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "centrify" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeFacebook AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "facebook" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeGitHub AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "github" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeGoogleApps AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "google-apps" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeGoogle AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "google" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeLinkedin AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "linkedin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeOidc AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "oidc" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeOkta AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "okta" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeOnelogin AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "onelogin" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypePingone AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "pingone" + AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexTypeYandex AccountAccessIdentityProviderUpdateResponseResultPajwohLqYandexType = "yandex" +) + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepin struct { + // UUID + ID string `json:"id"` + Config interface{} `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinScimConfig `json:"scim_config"` + Type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinType `json:"type"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinJSON contains +// the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepin] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepin) implementsAccountAccessIdentityProviderUpdateResponseResult() { +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinScimConfig] +type accountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinType string + +const ( + AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinTypeOnetimepin AccountAccessIdentityProviderUpdateResponseResultPajwohLqOnetimepinType = "onetimepin" +) + +// Whether the API call was successful +type AccountAccessIdentityProviderUpdateResponseSuccess bool + +const ( + AccountAccessIdentityProviderUpdateResponseSuccessTrue AccountAccessIdentityProviderUpdateResponseSuccess = true +) + +type AccountAccessIdentityProviderDeleteResponse struct { + Errors []AccountAccessIdentityProviderDeleteResponseError `json:"errors"` + Messages []AccountAccessIdentityProviderDeleteResponseMessage `json:"messages"` + Result AccountAccessIdentityProviderDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessIdentityProviderDeleteResponseSuccess `json:"success"` + JSON accountAccessIdentityProviderDeleteResponseJSON `json:"-"` +} + +// accountAccessIdentityProviderDeleteResponseJSON contains the JSON metadata for +// the struct [AccountAccessIdentityProviderDeleteResponse] +type accountAccessIdentityProviderDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderDeleteResponseErrorJSON `json:"-"` +} + +// accountAccessIdentityProviderDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountAccessIdentityProviderDeleteResponseError] +type accountAccessIdentityProviderDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderDeleteResponseMessageJSON `json:"-"` +} + +// accountAccessIdentityProviderDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessIdentityProviderDeleteResponseMessage] +type accountAccessIdentityProviderDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAccessIdentityProviderDeleteResponseResultJSON `json:"-"` +} + +// accountAccessIdentityProviderDeleteResponseResultJSON contains the JSON metadata +// for the struct [AccountAccessIdentityProviderDeleteResponseResult] +type accountAccessIdentityProviderDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessIdentityProviderDeleteResponseSuccess bool + +const ( + AccountAccessIdentityProviderDeleteResponseSuccessTrue AccountAccessIdentityProviderDeleteResponseSuccess = true +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponse struct { + Errors []AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseError `json:"errors"` + Messages []AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseMessage `json:"messages"` + Result AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseSuccess `json:"success"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponse] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseErrorJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseError] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseMessageJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseMessage] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAd], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrify], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebook], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHub], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogle], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleApps], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedin], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidc], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOkta], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnelogin], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingone], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSaml], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandex] +// or +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepin]. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult interface { + implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult)(nil)).Elem(), "") +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAd struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAd] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAd) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + EmailClaimName apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqAzureAdType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrify struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrify] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrify) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqCentrifyType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebook struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebook] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebook) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqFacebookType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHub struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHub] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHub) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGitHubType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogle struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogle] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogle) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleApps struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleApps] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleApps) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqGoogleAppsType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedin] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedin) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqLinkedinType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidc struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidc] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidc) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOidcType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOkta struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOkta] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOkta) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID string `json:"authorization_server_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaConfigJSON struct { + AuthorizationServerID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOktaType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnelogin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnelogin] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnelogin) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOneloginType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingone struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingone] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingone) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqPingoneType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSaml struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSaml] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSaml) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigHeaderAttributeJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigHeaderAttribute] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqSamlType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandex struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandex] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandex) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqYandexType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepin struct { + // UUID + ID string `json:"id"` + Config interface{} `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinScimConfig `json:"scim_config"` + Type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepin] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepin) implementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResult() { +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseResultPajwohLqOnetimepinType = "onetimepin" +) + +// Whether the API call was successful +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseSuccess bool + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseSuccessTrue AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponseSuccess = true +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponse struct { + Errors []AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseError `json:"errors"` + Messages []AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseMessage `json:"messages"` + Result []AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult `json:"result"` + ResultInfo AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseSuccess `json:"success"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponse] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseErrorJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseError] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseMessageJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseMessage] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAd], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrify], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebook], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHub], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogle], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleApps], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedin], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidc], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOkta], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOnelogin], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingone], +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSaml] +// or +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandex]. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult interface { + implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult)(nil)).Elem(), "") +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAd struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAd] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAd) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + EmailClaimName apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqAzureAdType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrify struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrify] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrify) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqCentrifyType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebook struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebook] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebook) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqFacebookType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHub struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHub] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHub) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGitHubType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogle struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogle] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogle) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleApps struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleApps] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleApps) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqGoogleAppsType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedin] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedin) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqLinkedinType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidc struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidc] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidc) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOidcType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOkta struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOkta] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOkta) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID string `json:"authorization_server_id"` + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaConfigJSON struct { + AuthorizationServerID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOktaType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOnelogin struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOnelogin] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOnelogin) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqOneloginType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingone struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingone] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingone) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneConfig struct { + // Custom claims + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName string `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqPingoneType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSaml struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSaml] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSaml) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigHeaderAttributeJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigHeaderAttribute] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqSamlType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandex struct { + // UUID + ID string `json:"id"` + Config AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType `json:"type"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandex] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandex) implementsAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResult() { +} + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexScimConfigJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexScimConfigJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexScimConfig] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypePingone AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultPajwohLqYandexType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultInfoJSON `json:"-"` +} + +// accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultInfo] +type accountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseSuccess bool + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseSuccessTrue AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponseSuccess = true +) + +// This interface is a union satisfied by one of the following: +// [AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAd], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqCentrify], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqFacebook], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqGitHub], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqGoogle], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleApps], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedin], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqOidc], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqOkta], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqOnelogin], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqPingone], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqSaml], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqYandex], +// [AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepin]. +type AccountAccessIdentityProviderUpdateParams interface { + ImplementsAccountAccessIdentityProviderUpdateParams() +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAd struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAd) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled param.Field[bool] `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID param.Field[string] `json:"directory_id"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Should Cloudflare try to load groups from your account + SupportGroups param.Field[bool] `json:"support_groups"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqCentrify struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqCentrify) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqCentrify) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyConfig struct { + // Your centrify account url + CentrifyAccount param.Field[string] `json:"centrify_account"` + // Your centrify app id + CentrifyAppID param.Field[string] `json:"centrify_app_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqCentrifyType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqFacebook struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqFacebook) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqFacebook) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqFacebookType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqGitHub struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGitHub) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqGitHub) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqGitHubType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogle struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGoogle) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqGoogle) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleApps struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleApps) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleApps) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsConfig struct { + // Your companies TLD + AppsDomain param.Field[string] `json:"apps_domain"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqGoogleAppsType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedin struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedin) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqLinkedinType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOidc struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOidcConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOidcScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOidc) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqOidc) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL param.Field[string] `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL param.Field[string] `json:"certs_url"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // OAuth scopes + Scopes param.Field[[]string] `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL param.Field[string] `json:"token_url"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOidcConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOidcScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqOidcTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqOidcType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOkta struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOktaConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOktaScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqOkta) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID param.Field[string] `json:"authorization_server_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your okta account url + OktaAccount param.Field[string] `json:"okta_account"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOktaConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOktaScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqOktaTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqOktaType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOnelogin struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOnelogin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqOnelogin) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount param.Field[string] `json:"onelogin_account"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqOneloginType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqPingone struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqPingone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqPingone) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID param.Field[string] `json:"ping_env_id"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqPingoneType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqSaml struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqSamlConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqSamlScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqSaml) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes param.Field[[]string] `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName param.Field[string] `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes param.Field[[]AccountAccessIdentityProviderUpdateParamsPajwohLqSamlConfigHeaderAttribute] `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts param.Field[[]string] `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL param.Field[string] `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest param.Field[bool] `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL param.Field[string] `json:"sso_target_url"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqSamlConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName param.Field[string] `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName param.Field[string] `json:"header_name"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqSamlConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqSamlScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqSamlTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqSamlType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqYandex struct { + Config param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqYandexConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqYandexScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqYandex) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqYandex) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqYandexConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqYandexConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqYandexScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "onetimepin" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeAzureAd AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "azureAD" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeSaml AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "saml" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeCentrify AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "centrify" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeFacebook AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "facebook" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeGitHub AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "github" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeGoogleApps AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "google-apps" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeGoogle AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "google" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeLinkedin AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "linkedin" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeOidc AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "oidc" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeOkta AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "okta" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeOnelogin AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "onelogin" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypePingone AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "pingone" + AccountAccessIdentityProviderUpdateParamsPajwohLqYandexTypeYandex AccountAccessIdentityProviderUpdateParamsPajwohLqYandexType = "yandex" +) + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepin struct { + Config param.Field[interface{}] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepinScimConfig] `json:"scim_config"` + Type param.Field[AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepinType] `json:"type"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepin) ImplementsAccountAccessIdentityProviderUpdateParams() { + +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepinType string + +const ( + AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepinTypeOnetimepin AccountAccessIdentityProviderUpdateParamsPajwohLqOnetimepinType = "onetimepin" +) + +// This interface is a union satisfied by one of the following: +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAd], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrify], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebook], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHub], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogle], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleApps], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedin], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidc], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOkta], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnelogin], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingone], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSaml], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandex], +// [AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepin]. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams interface { + ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAd struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAd) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled param.Field[bool] `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID param.Field[string] `json:"directory_id"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Should Cloudflare try to load groups from your account + SupportGroups param.Field[bool] `json:"support_groups"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrify struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrify) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrify) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyConfig struct { + // Your centrify account url + CentrifyAccount param.Field[string] `json:"centrify_account"` + // Your centrify app id + CentrifyAppID param.Field[string] `json:"centrify_app_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqCentrifyType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebook struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebook) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebook) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqFacebookType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHub struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHub) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHub) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGitHubType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogle struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogle) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogle) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleApps struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleApps) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleApps) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsConfig struct { + // Your companies TLD + AppsDomain param.Field[string] `json:"apps_domain"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqGoogleAppsType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedin struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedin) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqLinkedinType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidc struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidc) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidc) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL param.Field[string] `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL param.Field[string] `json:"certs_url"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // OAuth scopes + Scopes param.Field[[]string] `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL param.Field[string] `json:"token_url"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOidcType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOkta struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOkta) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID param.Field[string] `json:"authorization_server_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your okta account url + OktaAccount param.Field[string] `json:"okta_account"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOktaType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnelogin struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnelogin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnelogin) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount param.Field[string] `json:"onelogin_account"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOneloginType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingone struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingone) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID param.Field[string] `json:"ping_env_id"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqPingoneType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSaml struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSaml) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes param.Field[[]string] `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName param.Field[string] `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes param.Field[[]AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlConfigHeaderAttribute] `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts param.Field[[]string] `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL param.Field[string] `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest param.Field[bool] `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL param.Field[string] `json:"sso_target_url"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName param.Field[string] `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName param.Field[string] `json:"header_name"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqSamlType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandex struct { + Config param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandex) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandex) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "onetimepin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeAzureAd AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "azureAD" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeSaml AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "saml" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeCentrify AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "centrify" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeFacebook AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "facebook" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeGitHub AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "github" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeGoogleApps AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "google-apps" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeGoogle AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "google" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeLinkedin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "linkedin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeOidc AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "oidc" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeOkta AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "okta" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeOnelogin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "onelogin" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypePingone AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "pingone" + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexTypeYandex AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqYandexType = "yandex" +) + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepin struct { + Config param.Field[interface{}] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepinScimConfig] `json:"scim_config"` + Type param.Field[AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepinType] `json:"type"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepin) ImplementsAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams() { + +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepinType string + +const ( + AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepinTypeOnetimepin AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqOnetimepinType = "onetimepin" +) diff --git a/accountaccessidentityprovider_test.go b/accountaccessidentityprovider_test.go new file mode 100644 index 00000000000..527a7a34d2e --- /dev/null +++ b/accountaccessidentityprovider_test.go @@ -0,0 +1,199 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessIdentityProviderGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.IdentityProviders.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessIdentityProviderUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.IdentityProviders.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAd{ + Config: cloudflare.F(cloudflare.AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdConfig{ + ClientID: cloudflare.F(""), + ClientSecret: cloudflare.F(""), + Claims: cloudflare.F([]string{"email_verified", "preferred_username", "custom_claim_name"}), + EmailClaimName: cloudflare.F("custom_claim_name"), + ConditionalAccessEnabled: cloudflare.F(true), + DirectoryID: cloudflare.F(""), + SupportGroups: cloudflare.F(true), + }), + Name: cloudflare.F("Widget Corps IDP"), + ScimConfig: cloudflare.F(cloudflare.AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdScimConfig{ + Enabled: cloudflare.F(true), + GroupMemberDeprovision: cloudflare.F(true), + SeatDeprovision: cloudflare.F(true), + Secret: cloudflare.F("string"), + UserDeprovision: cloudflare.F(true), + }), + Type: cloudflare.F(cloudflare.AccountAccessIdentityProviderUpdateParamsPajwohLqAzureAdTypeOnetimepin), + }, + ) + 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 TestAccountAccessIdentityProviderDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.IdentityProviders.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.IdentityProviders.AccessIdentityProvidersAddAnAccessIdentityProvider( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAd{ + Config: cloudflare.F(cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdConfig{ + ClientID: cloudflare.F(""), + ClientSecret: cloudflare.F(""), + Claims: cloudflare.F([]string{"email_verified", "preferred_username", "custom_claim_name"}), + EmailClaimName: cloudflare.F("custom_claim_name"), + ConditionalAccessEnabled: cloudflare.F(true), + DirectoryID: cloudflare.F(""), + SupportGroups: cloudflare.F(true), + }), + Name: cloudflare.F("Widget Corps IDP"), + ScimConfig: cloudflare.F(cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdScimConfig{ + Enabled: cloudflare.F(true), + GroupMemberDeprovision: cloudflare.F(true), + SeatDeprovision: cloudflare.F(true), + Secret: cloudflare.F("string"), + UserDeprovision: cloudflare.F(true), + }), + Type: cloudflare.F(cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParamsPajwohLqAzureAdTypeOnetimepin), + }, + ) + 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 TestAccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProviders(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.IdentityProviders.AccessIdentityProvidersListAccessIdentityProviders(context.TODO(), "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/accountaccesskey.go b/accountaccesskey.go new file mode 100644 index 00000000000..f37c7884067 --- /dev/null +++ b/accountaccesskey.go @@ -0,0 +1,263 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountAccessKeyService 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 [NewAccountAccessKeyService] method +// instead. +type AccountAccessKeyService struct { + Options []option.RequestOption + Rotates *AccountAccessKeyRotateService +} + +// NewAccountAccessKeyService 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 NewAccountAccessKeyService(opts ...option.RequestOption) (r *AccountAccessKeyService) { + r = &AccountAccessKeyService{} + r.Options = opts + r.Rotates = NewAccountAccessKeyRotateService(opts...) + return +} + +// Gets the Access key rotation settings for an account. +func (r *AccountAccessKeyService) AccessKeyConfigurationGetTheAccessKeyConfiguration(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/keys", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the Access key rotation settings for an account. +func (r *AccountAccessKeyService) AccessKeyConfigurationUpdateTheAccessKeyConfiguration(ctx context.Context, identifier string, body AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationParams, opts ...option.RequestOption) (res *AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/keys", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponse struct { + // The number of days until the next key rotation. + DaysUntilNextRotation float64 `json:"days_until_next_rotation"` + Errors []AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseError `json:"errors"` + // The number of days between key rotations. + KeyRotationIntervalDays float64 `json:"key_rotation_interval_days"` + // The timestamp of the previous key rotation. + LastKeyRotationAt time.Time `json:"last_key_rotation_at" format:"date-time"` + Messages []AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseMessage `json:"messages"` + Result AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseSuccess `json:"success"` + JSON accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseJSON `json:"-"` +} + +// accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponse] +type accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseJSON struct { + DaysUntilNextRotation apijson.Field + Errors apijson.Field + KeyRotationIntervalDays apijson.Field + LastKeyRotationAt apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseErrorJSON `json:"-"` +} + +// accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseError] +type accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseMessageJSON `json:"-"` +} + +// accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseMessage] +type accountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseResultUnknown] +// or [shared.UnionString]. +type AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseResult interface { + ImplementsAccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseSuccess bool + +const ( + AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseSuccessTrue AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseSuccess = true +) + +type AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponse struct { + // The number of days until the next key rotation. + DaysUntilNextRotation float64 `json:"days_until_next_rotation"` + Errors []AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseError `json:"errors"` + // The number of days between key rotations. + KeyRotationIntervalDays float64 `json:"key_rotation_interval_days"` + // The timestamp of the previous key rotation. + LastKeyRotationAt time.Time `json:"last_key_rotation_at" format:"date-time"` + Messages []AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseMessage `json:"messages"` + Result AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseSuccess `json:"success"` + JSON accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseJSON `json:"-"` +} + +// accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponse] +type accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseJSON struct { + DaysUntilNextRotation apijson.Field + Errors apijson.Field + KeyRotationIntervalDays apijson.Field + LastKeyRotationAt apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseErrorJSON `json:"-"` +} + +// accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseError] +type accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseMessageJSON `json:"-"` +} + +// accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseMessage] +type accountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseResultUnknown] +// or [shared.UnionString]. +type AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseResult interface { + ImplementsAccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseSuccess bool + +const ( + AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseSuccessTrue AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseSuccess = true +) + +type AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationParams struct { + // The number of days between key rotations. + KeyRotationIntervalDays param.Field[float64] `json:"key_rotation_interval_days,required"` +} + +func (r AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccesskey_test.go b/accountaccesskey_test.go new file mode 100644 index 00000000000..60b5a1db9fb --- /dev/null +++ b/accountaccesskey_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Keys.AccessKeyConfigurationGetTheAccessKeyConfiguration(context.TODO(), "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()) + } +} + +func TestAccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Keys.AccessKeyConfigurationUpdateTheAccessKeyConfiguration( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationParams{ + KeyRotationIntervalDays: cloudflare.F(30.000000), + }, + ) + 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/accountaccesskeyrotate.go b/accountaccesskeyrotate.go new file mode 100644 index 00000000000..bf74ee7df60 --- /dev/null +++ b/accountaccesskeyrotate.go @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountAccessKeyRotateService 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 [NewAccountAccessKeyRotateService] +// method instead. +type AccountAccessKeyRotateService struct { + Options []option.RequestOption +} + +// NewAccountAccessKeyRotateService 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 NewAccountAccessKeyRotateService(opts ...option.RequestOption) (r *AccountAccessKeyRotateService) { + r = &AccountAccessKeyRotateService{} + r.Options = opts + return +} + +// Perfoms a key rotation for an account. +func (r *AccountAccessKeyRotateService) AccessKeyConfigurationRotateAccessKeys(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/keys/rotate", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponse struct { + // The number of days until the next key rotation. + DaysUntilNextRotation float64 `json:"days_until_next_rotation"` + Errors []AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseError `json:"errors"` + // The number of days between key rotations. + KeyRotationIntervalDays float64 `json:"key_rotation_interval_days"` + // The timestamp of the previous key rotation. + LastKeyRotationAt time.Time `json:"last_key_rotation_at" format:"date-time"` + Messages []AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseMessage `json:"messages"` + Result AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseSuccess `json:"success"` + JSON accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseJSON `json:"-"` +} + +// accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponse] +type accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseJSON struct { + DaysUntilNextRotation apijson.Field + Errors apijson.Field + KeyRotationIntervalDays apijson.Field + LastKeyRotationAt apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseErrorJSON `json:"-"` +} + +// accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseError] +type accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseMessageJSON `json:"-"` +} + +// accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseMessage] +type accountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseResultUnknown] +// or [shared.UnionString]. +type AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseResult interface { + ImplementsAccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseSuccess bool + +const ( + AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseSuccessTrue AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseSuccess = true +) diff --git a/accountaccesskeyrotate_test.go b/accountaccesskeyrotate_test.go new file mode 100644 index 00000000000..12ab1b21070 --- /dev/null +++ b/accountaccesskeyrotate_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeys(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Keys.Rotates.AccessKeyConfigurationRotateAccessKeys(context.TODO(), "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/accountaccesslog.go b/accountaccesslog.go new file mode 100644 index 00000000000..23e6c51497a --- /dev/null +++ b/accountaccesslog.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessLogService 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 [NewAccountAccessLogService] method +// instead. +type AccountAccessLogService struct { + Options []option.RequestOption + AccessRequests *AccountAccessLogAccessRequestService +} + +// NewAccountAccessLogService 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 NewAccountAccessLogService(opts ...option.RequestOption) (r *AccountAccessLogService) { + r = &AccountAccessLogService{} + r.Options = opts + r.AccessRequests = NewAccountAccessLogAccessRequestService(opts...) + return +} diff --git a/accountaccesslogaccessrequest.go b/accountaccesslogaccessrequest.go new file mode 100644 index 00000000000..d944cce5222 --- /dev/null +++ b/accountaccesslogaccessrequest.go @@ -0,0 +1,184 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessLogAccessRequestService 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 +// [NewAccountAccessLogAccessRequestService] method instead. +type AccountAccessLogAccessRequestService struct { + Options []option.RequestOption +} + +// NewAccountAccessLogAccessRequestService 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 NewAccountAccessLogAccessRequestService(opts ...option.RequestOption) (r *AccountAccessLogAccessRequestService) { + r = &AccountAccessLogAccessRequestService{} + r.Options = opts + return +} + +// Gets a list of Access authentication audit logs for an account. +func (r *AccountAccessLogAccessRequestService) AccessAuthenticationLogsGetAccessAuthenticationLogs(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/logs/access_requests", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponse struct { + Errors []AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseError `json:"errors"` + Messages []AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseMessage `json:"messages"` + Result []AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResult `json:"result"` + ResultInfo AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseSuccess `json:"success"` + JSON accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseJSON `json:"-"` +} + +// accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponse] +type accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseErrorJSON `json:"-"` +} + +// accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseError] +type accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseMessageJSON `json:"-"` +} + +// accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseMessage] +type accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResult struct { + // The event that occurred, such as a login attempt. + Action string `json:"action"` + // The result of the authentication event. + Allowed bool `json:"allowed"` + // The URL of the Access application. + AppDomain string `json:"app_domain"` + // The unique identifier for the Access application. + AppUid interface{} `json:"app_uid"` + // The IdP used to authenticate. + Connection string `json:"connection"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The IP address of the authenticating user. + IPAddress string `json:"ip_address"` + // The unique identifier for the request to Cloudflare. + RayID string `json:"ray_id"` + // The email address of the authenticating user. + UserEmail string `json:"user_email" format:"email"` + JSON accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultJSON `json:"-"` +} + +// accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResult] +type accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultJSON struct { + Action apijson.Field + Allowed apijson.Field + AppDomain apijson.Field + AppUid apijson.Field + Connection apijson.Field + CreatedAt apijson.Field + IPAddress apijson.Field + RayID apijson.Field + UserEmail apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultInfoJSON `json:"-"` +} + +// accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultInfo] +type accountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseSuccess bool + +const ( + AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseSuccessTrue AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponseSuccess = true +) diff --git a/accountaccesslogaccessrequest_test.go b/accountaccesslogaccessrequest_test.go new file mode 100644 index 00000000000..6a890c1ec87 --- /dev/null +++ b/accountaccesslogaccessrequest_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Logs.AccessRequests.AccessAuthenticationLogsGetAccessAuthenticationLogs(context.TODO(), "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/accountaccessorganization.go b/accountaccessorganization.go new file mode 100644 index 00000000000..07107398e8d --- /dev/null +++ b/accountaccessorganization.go @@ -0,0 +1,698 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessOrganizationService 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 +// [NewAccountAccessOrganizationService] method instead. +type AccountAccessOrganizationService struct { + Options []option.RequestOption + RevokeUsers *AccountAccessOrganizationRevokeUserService +} + +// NewAccountAccessOrganizationService 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 NewAccountAccessOrganizationService(opts ...option.RequestOption) (r *AccountAccessOrganizationService) { + r = &AccountAccessOrganizationService{} + r.Options = opts + r.RevokeUsers = NewAccountAccessOrganizationRevokeUserService(opts...) + return +} + +// Sets up a Zero Trust organization for your account. +func (r *AccountAccessOrganizationService) ZeroTrustOrganizationNewYourZeroTrustOrganization(ctx context.Context, identifier string, body AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParams, opts ...option.RequestOption) (res *AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/organizations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Returns the configuration for your Zero Trust organization. +func (r *AccountAccessOrganizationService) ZeroTrustOrganizationGetYourZeroTrustOrganization(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/organizations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the configuration for your Zero Trust organization. +func (r *AccountAccessOrganizationService) ZeroTrustOrganizationUpdateYourZeroTrustOrganization(ctx context.Context, identifier string, body AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams, opts ...option.RequestOption) (res *AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/organizations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponse struct { + Errors []AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError `json:"errors"` + Messages []AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage `json:"messages"` + Result AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccess `json:"success"` + JSON accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponse] +type accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseErrorJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError] +type accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessageJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage] +type accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain string `json:"auth_domain"` + // When set to `true`, users skip the identity provider selection step during + // login. + AutoRedirectToIdentity bool `json:"auto_redirect_to_identity"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + CustomPages AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultCustomPages `json:"custom_pages"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly bool `json:"is_ui_read_only"` + LoginDesign AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign `json:"login_design"` + // The name of your Zero Trust organization. + Name string `json:"name"` + // The amount of time that tokens issued for applications will be valid. Must be in + // the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, + // h. + SessionDuration string `json:"session_duration"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason string `json:"ui_read_only_toggle_reason"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time"` + JSON accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult] +type accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultJSON struct { + AuthDomain apijson.Field + AutoRedirectToIdentity apijson.Field + CreatedAt apijson.Field + CustomPages apijson.Field + IsUiReadOnly apijson.Field + LoginDesign apijson.Field + Name apijson.Field + SessionDuration apijson.Field + UiReadOnlyToggleReason apijson.Field + UpdatedAt apijson.Field + UserSeatExpirationInactiveTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultCustomPages struct { + // The uid of the custom page to use when a user is denied access after failing a + // non-identity rule. + Forbidden string `json:"forbidden"` + // The uid of the custom page to use when a user is denied access. + IdentityDenied string `json:"identity_denied"` + JSON accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultCustomPagesJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultCustomPagesJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultCustomPages] +type accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultCustomPagesJSON struct { + Forbidden apijson.Field + IdentityDenied apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultCustomPages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign struct { + // The background color on your login page. + BackgroundColor string `json:"background_color"` + // The text at the bottom of your login page. + FooterText string `json:"footer_text"` + // The text at the top of your login page. + HeaderText string `json:"header_text"` + // The URL of the logo on your login page. + LogoPath string `json:"logo_path"` + // The text color on your login page. + TextColor string `json:"text_color"` + JSON accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesignJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesignJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign] +type accountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesignJSON struct { + BackgroundColor apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + TextColor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccess bool + +const ( + AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccessTrue AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccess = true +) + +type AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponse struct { + Errors []AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError `json:"errors"` + Messages []AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage `json:"messages"` + Result AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccess `json:"success"` + JSON accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponse] +type accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseErrorJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError] +type accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessageJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage] +type accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain string `json:"auth_domain"` + // When set to `true`, users skip the identity provider selection step during + // login. + AutoRedirectToIdentity bool `json:"auto_redirect_to_identity"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + CustomPages AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultCustomPages `json:"custom_pages"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly bool `json:"is_ui_read_only"` + LoginDesign AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign `json:"login_design"` + // The name of your Zero Trust organization. + Name string `json:"name"` + // The amount of time that tokens issued for applications will be valid. Must be in + // the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, + // h. + SessionDuration string `json:"session_duration"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason string `json:"ui_read_only_toggle_reason"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time"` + JSON accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult] +type accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultJSON struct { + AuthDomain apijson.Field + AutoRedirectToIdentity apijson.Field + CreatedAt apijson.Field + CustomPages apijson.Field + IsUiReadOnly apijson.Field + LoginDesign apijson.Field + Name apijson.Field + SessionDuration apijson.Field + UiReadOnlyToggleReason apijson.Field + UpdatedAt apijson.Field + UserSeatExpirationInactiveTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultCustomPages struct { + // The uid of the custom page to use when a user is denied access after failing a + // non-identity rule. + Forbidden string `json:"forbidden"` + // The uid of the custom page to use when a user is denied access. + IdentityDenied string `json:"identity_denied"` + JSON accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultCustomPagesJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultCustomPagesJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultCustomPages] +type accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultCustomPagesJSON struct { + Forbidden apijson.Field + IdentityDenied apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultCustomPages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign struct { + // The background color on your login page. + BackgroundColor string `json:"background_color"` + // The text at the bottom of your login page. + FooterText string `json:"footer_text"` + // The text at the top of your login page. + HeaderText string `json:"header_text"` + // The URL of the logo on your login page. + LogoPath string `json:"logo_path"` + // The text color on your login page. + TextColor string `json:"text_color"` + JSON accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesignJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesignJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign] +type accountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesignJSON struct { + BackgroundColor apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + TextColor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccess bool + +const ( + AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccessTrue AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccess = true +) + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse struct { + Errors []AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError `json:"errors"` + Messages []AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage `json:"messages"` + Result AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccess `json:"success"` + JSON accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse] +type accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseErrorJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError] +type accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessageJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage] +type accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain string `json:"auth_domain"` + // When set to `true`, users skip the identity provider selection step during + // login. + AutoRedirectToIdentity bool `json:"auto_redirect_to_identity"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + CustomPages AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultCustomPages `json:"custom_pages"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly bool `json:"is_ui_read_only"` + LoginDesign AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign `json:"login_design"` + // The name of your Zero Trust organization. + Name string `json:"name"` + // The amount of time that tokens issued for applications will be valid. Must be in + // the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, + // h. + SessionDuration string `json:"session_duration"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason string `json:"ui_read_only_toggle_reason"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time"` + JSON accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult] +type accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultJSON struct { + AuthDomain apijson.Field + AutoRedirectToIdentity apijson.Field + CreatedAt apijson.Field + CustomPages apijson.Field + IsUiReadOnly apijson.Field + LoginDesign apijson.Field + Name apijson.Field + SessionDuration apijson.Field + UiReadOnlyToggleReason apijson.Field + UpdatedAt apijson.Field + UserSeatExpirationInactiveTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultCustomPages struct { + // The uid of the custom page to use when a user is denied access after failing a + // non-identity rule. + Forbidden string `json:"forbidden"` + // The uid of the custom page to use when a user is denied access. + IdentityDenied string `json:"identity_denied"` + JSON accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultCustomPagesJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultCustomPagesJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultCustomPages] +type accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultCustomPagesJSON struct { + Forbidden apijson.Field + IdentityDenied apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultCustomPages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign struct { + // The background color on your login page. + BackgroundColor string `json:"background_color"` + // The text at the bottom of your login page. + FooterText string `json:"footer_text"` + // The text at the top of your login page. + HeaderText string `json:"header_text"` + // The URL of the logo on your login page. + LogoPath string `json:"logo_path"` + // The text color on your login page. + TextColor string `json:"text_color"` + JSON accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesignJSON `json:"-"` +} + +// accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesignJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign] +type accountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesignJSON struct { + BackgroundColor apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + TextColor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccess bool + +const ( + AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccessTrue AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccess = true +) + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParams struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain param.Field[string] `json:"auth_domain,required"` + // The name of your Zero Trust organization. + Name param.Field[string] `json:"name,required"` + // When set to `true`, users skip the identity provider selection step during + // login. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly param.Field[bool] `json:"is_ui_read_only"` + LoginDesign param.Field[AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign] `json:"login_design"` + // The amount of time that tokens issued for applications will be valid. Must be in + // the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, + // h. + SessionDuration param.Field[string] `json:"session_duration"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason param.Field[string] `json:"ui_read_only_toggle_reason"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime param.Field[string] `json:"user_seat_expiration_inactive_time"` +} + +func (r AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign struct { + // The background color on your login page. + BackgroundColor param.Field[string] `json:"background_color"` + // The text at the bottom of your login page. + FooterText param.Field[string] `json:"footer_text"` + // The text at the top of your login page. + HeaderText param.Field[string] `json:"header_text"` + // The URL of the logo on your login page. + LogoPath param.Field[string] `json:"logo_path"` + // The text color on your login page. + TextColor param.Field[string] `json:"text_color"` +} + +func (r AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain param.Field[string] `json:"auth_domain"` + // When set to `true`, users skip the identity provider selection step during + // login. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + CustomPages param.Field[AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsCustomPages] `json:"custom_pages"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly param.Field[bool] `json:"is_ui_read_only"` + LoginDesign param.Field[AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign] `json:"login_design"` + // The name of your Zero Trust organization. + Name param.Field[string] `json:"name"` + // The amount of time that tokens issued for applications will be valid. Must be in + // the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, + // h. + SessionDuration param.Field[string] `json:"session_duration"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason param.Field[string] `json:"ui_read_only_toggle_reason"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime param.Field[string] `json:"user_seat_expiration_inactive_time"` +} + +func (r AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsCustomPages struct { + // The uid of the custom page to use when a user is denied access after failing a + // non-identity rule. + Forbidden param.Field[string] `json:"forbidden"` + // The uid of the custom page to use when a user is denied access. + IdentityDenied param.Field[string] `json:"identity_denied"` +} + +func (r AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsCustomPages) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign struct { + // The background color on your login page. + BackgroundColor param.Field[string] `json:"background_color"` + // The text at the bottom of your login page. + FooterText param.Field[string] `json:"footer_text"` + // The text at the top of your login page. + HeaderText param.Field[string] `json:"header_text"` + // The URL of the logo on your login page. + LogoPath param.Field[string] `json:"logo_path"` + // The text color on your login page. + TextColor param.Field[string] `json:"text_color"` +} + +func (r AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccessorganization_test.go b/accountaccessorganization_test.go new file mode 100644 index 00000000000..6ffd000166b --- /dev/null +++ b/accountaccessorganization_test.go @@ -0,0 +1,134 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Organizations.ZeroTrustOrganizationNewYourZeroTrustOrganization( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParams{ + AuthDomain: cloudflare.F("test.cloudflareaccess.com"), + Name: cloudflare.F("Widget Corps Internal Applications"), + AutoRedirectToIdentity: cloudflare.F(true), + IsUiReadOnly: cloudflare.F(true), + LoginDesign: cloudflare.F(cloudflare.AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign{ + BackgroundColor: cloudflare.F("#c5ed1b"), + FooterText: cloudflare.F("This is an example description."), + HeaderText: cloudflare.F("This is an example description."), + LogoPath: cloudflare.F("https://example.com/logo.png"), + TextColor: cloudflare.F("#c5ed1b"), + }), + SessionDuration: cloudflare.F("24h"), + UiReadOnlyToggleReason: cloudflare.F("Temporarily turn off the UI read only lock to make a change via the UI"), + UserSeatExpirationInactiveTime: cloudflare.F("720h"), + }, + ) + 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 TestAccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganization(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Organizations.ZeroTrustOrganizationGetYourZeroTrustOrganization(context.TODO(), "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()) + } +} + +func TestAccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Organizations.ZeroTrustOrganizationUpdateYourZeroTrustOrganization( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams{ + AuthDomain: cloudflare.F("test.cloudflareaccess.com"), + AutoRedirectToIdentity: cloudflare.F(true), + CustomPages: cloudflare.F(cloudflare.AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsCustomPages{ + Forbidden: cloudflare.F("699d98642c564d2e855e9661899b7252"), + IdentityDenied: cloudflare.F("699d98642c564d2e855e9661899b7252"), + }), + IsUiReadOnly: cloudflare.F(true), + LoginDesign: cloudflare.F(cloudflare.AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign{ + BackgroundColor: cloudflare.F("#c5ed1b"), + FooterText: cloudflare.F("This is an example description."), + HeaderText: cloudflare.F("This is an example description."), + LogoPath: cloudflare.F("https://example.com/logo.png"), + TextColor: cloudflare.F("#c5ed1b"), + }), + Name: cloudflare.F("Widget Corps Internal Applications"), + SessionDuration: cloudflare.F("24h"), + UiReadOnlyToggleReason: cloudflare.F("Temporarily turn off the UI read only lock to make a change via the UI"), + UserSeatExpirationInactiveTime: cloudflare.F("720h"), + }, + ) + 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/accountaccessorganizationrevokeuser.go b/accountaccessorganizationrevokeuser.go new file mode 100644 index 00000000000..a7c48b15cab --- /dev/null +++ b/accountaccessorganizationrevokeuser.go @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessOrganizationRevokeUserService 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 +// [NewAccountAccessOrganizationRevokeUserService] method instead. +type AccountAccessOrganizationRevokeUserService struct { + Options []option.RequestOption +} + +// NewAccountAccessOrganizationRevokeUserService 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 NewAccountAccessOrganizationRevokeUserService(opts ...option.RequestOption) (r *AccountAccessOrganizationRevokeUserService) { + r = &AccountAccessOrganizationRevokeUserService{} + r.Options = opts + return +} + +// Revokes a user's access across all applications. +func (r *AccountAccessOrganizationRevokeUserService) ZeroTrustOrganizationRevokeAllAccessTokensForAUser(ctx context.Context, identifier string, body AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserParams, opts ...option.RequestOption) (res *AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/organizations/revoke_user", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponse struct { + Result AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseResult `json:"result"` + Success AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseSuccess `json:"success"` + JSON accountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseJSON `json:"-"` +} + +// accountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponse] +type accountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseResult bool + +const ( + AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseResultTrue AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseResult = true + AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseResultFalse AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseResult = false +) + +type AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseSuccess bool + +const ( + AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseSuccessTrue AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseSuccess = true + AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseSuccessFalse AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponseSuccess = false +) + +type AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserParams struct { + // The email of the user to revoke. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccessorganizationrevokeuser_test.go b/accountaccessorganizationrevokeuser_test.go new file mode 100644 index 00000000000..eb674b0a8ab --- /dev/null +++ b/accountaccessorganizationrevokeuser_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUser(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Organizations.RevokeUsers.ZeroTrustOrganizationRevokeAllAccessTokensForAUser( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserParams{ + Email: cloudflare.F("test@example.com"), + }, + ) + 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/accountaccessseat.go b/accountaccessseat.go new file mode 100644 index 00000000000..5788f172d79 --- /dev/null +++ b/accountaccessseat.go @@ -0,0 +1,191 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessSeatService 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 [NewAccountAccessSeatService] method +// instead. +type AccountAccessSeatService struct { + Options []option.RequestOption +} + +// NewAccountAccessSeatService 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 NewAccountAccessSeatService(opts ...option.RequestOption) (r *AccountAccessSeatService) { + r = &AccountAccessSeatService{} + r.Options = opts + return +} + +// Removes a user from a Zero Trust seat when both `access_seat` and `gateway_seat` +// are set to false. +func (r *AccountAccessSeatService) ZeroTrustSeatsUpdateAUserSeat(ctx context.Context, identifier string, body AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParams, opts ...option.RequestOption) (res *AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/seats", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponse struct { + Errors []AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseError `json:"errors"` + Messages []AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseMessage `json:"messages"` + Result []AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResult `json:"result"` + ResultInfo AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseSuccess `json:"success"` + JSON accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseJSON `json:"-"` +} + +// accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseJSON contains the JSON +// metadata for the struct [AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponse] +type accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseErrorJSON `json:"-"` +} + +// accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseError] +type accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseMessageJSON `json:"-"` +} + +// accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseMessage] +type accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResult struct { + // True if the seat is part of Access. + AccessSeat bool `json:"access_seat"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // True if the seat is part of Gateway. + GatewaySeat bool `json:"gateway_seat"` + // Identifier + SeatUid string `json:"seat_uid"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultJSON `json:"-"` +} + +// accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultJSON contains the +// JSON metadata for the struct +// [AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResult] +type accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultJSON struct { + AccessSeat apijson.Field + CreatedAt apijson.Field + GatewaySeat apijson.Field + SeatUid apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultInfoJSON `json:"-"` +} + +// accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultInfo] +type accountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseSuccess bool + +const ( + AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseSuccessTrue AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponseSuccess = true +) + +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParams struct { + Body param.Field[[]AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParamsBody] `json:"body,required"` +} + +func (r AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParamsBody struct { + // True if the seat is part of Access. + AccessSeat param.Field[bool] `json:"access_seat,required"` + // True if the seat is part of Gateway. + GatewaySeat param.Field[bool] `json:"gateway_seat,required"` +} + +func (r AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccessseat_test.go b/accountaccessseat_test.go new file mode 100644 index 00000000000..cac534efe1a --- /dev/null +++ b/accountaccessseat_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessSeatZeroTrustSeatsUpdateAUserSeat(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Seats.ZeroTrustSeatsUpdateAUserSeat( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParams{ + Body: cloudflare.F([]cloudflare.AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParamsBody{{ + AccessSeat: cloudflare.F(false), + GatewaySeat: cloudflare.F(false), + }, { + AccessSeat: cloudflare.F(false), + GatewaySeat: cloudflare.F(false), + }, { + AccessSeat: cloudflare.F(false), + GatewaySeat: cloudflare.F(false), + }}), + }, + ) + 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/accountaccessservicetoken.go b/accountaccessservicetoken.go new file mode 100644 index 00000000000..6bb2d52b279 --- /dev/null +++ b/accountaccessservicetoken.go @@ -0,0 +1,551 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessServiceTokenService 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 +// [NewAccountAccessServiceTokenService] method instead. +type AccountAccessServiceTokenService struct { + Options []option.RequestOption + Refreshes *AccountAccessServiceTokenRefreshService + Rotates *AccountAccessServiceTokenRotateService +} + +// NewAccountAccessServiceTokenService 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 NewAccountAccessServiceTokenService(opts ...option.RequestOption) (r *AccountAccessServiceTokenService) { + r = &AccountAccessServiceTokenService{} + r.Options = opts + r.Refreshes = NewAccountAccessServiceTokenRefreshService(opts...) + r.Rotates = NewAccountAccessServiceTokenRotateService(opts...) + return +} + +// Updates a configured service token. +func (r *AccountAccessServiceTokenService) Update(ctx context.Context, identifier string, uuid string, body AccountAccessServiceTokenUpdateParams, opts ...option.RequestOption) (res *AccountAccessServiceTokenUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/service_tokens/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a service token. +func (r *AccountAccessServiceTokenService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessServiceTokenDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/service_tokens/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Generates a new service token. **Note:** This is the only time you can get the +// Client Secret. If you lose the Client Secret, you will have to rotate the Client +// Secret or create a new service token. +func (r *AccountAccessServiceTokenService) AccessServiceTokensNewAServiceToken(ctx context.Context, identifier string, body AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenParams, opts ...option.RequestOption) (res *AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/service_tokens", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all service tokens. +func (r *AccountAccessServiceTokenService) AccessServiceTokensListServiceTokens(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/service_tokens", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessServiceTokenUpdateResponse struct { + Errors []AccountAccessServiceTokenUpdateResponseError `json:"errors"` + Messages []AccountAccessServiceTokenUpdateResponseMessage `json:"messages"` + Result AccountAccessServiceTokenUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessServiceTokenUpdateResponseSuccess `json:"success"` + JSON accountAccessServiceTokenUpdateResponseJSON `json:"-"` +} + +// accountAccessServiceTokenUpdateResponseJSON contains the JSON metadata for the +// struct [AccountAccessServiceTokenUpdateResponse] +type accountAccessServiceTokenUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenUpdateResponseErrorJSON `json:"-"` +} + +// accountAccessServiceTokenUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountAccessServiceTokenUpdateResponseError] +type accountAccessServiceTokenUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenUpdateResponseMessageJSON `json:"-"` +} + +// accountAccessServiceTokenUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountAccessServiceTokenUpdateResponseMessage] +type accountAccessServiceTokenUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenUpdateResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessServiceTokenUpdateResponseResultJSON `json:"-"` +} + +// accountAccessServiceTokenUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountAccessServiceTokenUpdateResponseResult] +type accountAccessServiceTokenUpdateResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessServiceTokenUpdateResponseSuccess bool + +const ( + AccountAccessServiceTokenUpdateResponseSuccessTrue AccountAccessServiceTokenUpdateResponseSuccess = true +) + +type AccountAccessServiceTokenDeleteResponse struct { + Errors []AccountAccessServiceTokenDeleteResponseError `json:"errors"` + Messages []AccountAccessServiceTokenDeleteResponseMessage `json:"messages"` + Result AccountAccessServiceTokenDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessServiceTokenDeleteResponseSuccess `json:"success"` + JSON accountAccessServiceTokenDeleteResponseJSON `json:"-"` +} + +// accountAccessServiceTokenDeleteResponseJSON contains the JSON metadata for the +// struct [AccountAccessServiceTokenDeleteResponse] +type accountAccessServiceTokenDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenDeleteResponseErrorJSON `json:"-"` +} + +// accountAccessServiceTokenDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountAccessServiceTokenDeleteResponseError] +type accountAccessServiceTokenDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenDeleteResponseMessageJSON `json:"-"` +} + +// accountAccessServiceTokenDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountAccessServiceTokenDeleteResponseMessage] +type accountAccessServiceTokenDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenDeleteResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessServiceTokenDeleteResponseResultJSON `json:"-"` +} + +// accountAccessServiceTokenDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountAccessServiceTokenDeleteResponseResult] +type accountAccessServiceTokenDeleteResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessServiceTokenDeleteResponseSuccess bool + +const ( + AccountAccessServiceTokenDeleteResponseSuccessTrue AccountAccessServiceTokenDeleteResponseSuccess = true +) + +type AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponse struct { + Errors []AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseError `json:"errors"` + Messages []AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseMessage `json:"messages"` + Result AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseSuccess `json:"success"` + JSON accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponse] +type accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseErrorJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseError] +type accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseMessageJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseMessage] +type accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + // The Client Secret for the service token. Access will check for this value in the + // `CF-Access-Client-Secret` request header. + ClientSecret string `json:"client_secret"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseResultJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseResult] +type accountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseSuccess bool + +const ( + AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseSuccessTrue AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponseSuccess = true +) + +type AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponse struct { + Errors []AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseError `json:"errors"` + Messages []AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseMessage `json:"messages"` + Result []AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResult `json:"result"` + ResultInfo AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseSuccess `json:"success"` + JSON accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponse] +type accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseErrorJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseError] +type accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseMessageJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseMessage] +type accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResult] +type accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultInfoJSON `json:"-"` +} + +// accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultInfo] +type accountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseSuccess bool + +const ( + AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseSuccessTrue AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponseSuccess = true +) + +type AccountAccessServiceTokenUpdateParams struct { + // 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 param.Field[string] `json:"duration"` + // The name of the service token. + Name param.Field[string] `json:"name"` +} + +func (r AccountAccessServiceTokenUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenParams struct { + // The name of the service token. + Name param.Field[string] `json:"name,required"` + // 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 param.Field[string] `json:"duration"` +} + +func (r AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccessservicetoken_test.go b/accountaccessservicetoken_test.go new file mode 100644 index 00000000000..e35e551001e --- /dev/null +++ b/accountaccessservicetoken_test.go @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessServiceTokenUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.ServiceTokens.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountAccessServiceTokenUpdateParams{ + Duration: cloudflare.F("60m"), + Name: cloudflare.F("CI/CD token"), + }, + ) + 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 TestAccountAccessServiceTokenDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.ServiceTokens.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessServiceTokenAccessServiceTokensNewAServiceTokenWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.ServiceTokens.AccessServiceTokensNewAServiceToken( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenParams{ + Name: cloudflare.F("CI/CD token"), + Duration: cloudflare.F("60m"), + }, + ) + 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 TestAccountAccessServiceTokenAccessServiceTokensListServiceTokens(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.ServiceTokens.AccessServiceTokensListServiceTokens(context.TODO(), "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/accountaccessservicetokenrefresh.go b/accountaccessservicetokenrefresh.go new file mode 100644 index 00000000000..ba97060f5d5 --- /dev/null +++ b/accountaccessservicetokenrefresh.go @@ -0,0 +1,147 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessServiceTokenRefreshService 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 +// [NewAccountAccessServiceTokenRefreshService] method instead. +type AccountAccessServiceTokenRefreshService struct { + Options []option.RequestOption +} + +// NewAccountAccessServiceTokenRefreshService 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 NewAccountAccessServiceTokenRefreshService(opts ...option.RequestOption) (r *AccountAccessServiceTokenRefreshService) { + r = &AccountAccessServiceTokenRefreshService{} + r.Options = opts + return +} + +// Refreshes the expiration of a service token. +func (r *AccountAccessServiceTokenRefreshService) AccessServiceTokensRefreshAServiceToken(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/service_tokens/%s/refresh", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponse struct { + Errors []AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseError `json:"errors"` + Messages []AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseMessage `json:"messages"` + Result AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseSuccess `json:"success"` + JSON accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseJSON `json:"-"` +} + +// accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponse] +type accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseErrorJSON `json:"-"` +} + +// accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseError] +type accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseMessageJSON `json:"-"` +} + +// accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseMessage] +type accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseResultJSON `json:"-"` +} + +// accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseResult] +type accountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseSuccess bool + +const ( + AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseSuccessTrue AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponseSuccess = true +) diff --git a/accountaccessservicetokenrefresh_test.go b/accountaccessservicetokenrefresh_test.go new file mode 100644 index 00000000000..b837c9ce9e5 --- /dev/null +++ b/accountaccessservicetokenrefresh_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceToken(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.ServiceTokens.Refreshes.AccessServiceTokensRefreshAServiceToken( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/accountaccessservicetokenrotate.go b/accountaccessservicetokenrotate.go new file mode 100644 index 00000000000..54a56cf057f --- /dev/null +++ b/accountaccessservicetokenrotate.go @@ -0,0 +1,151 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessServiceTokenRotateService 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 +// [NewAccountAccessServiceTokenRotateService] method instead. +type AccountAccessServiceTokenRotateService struct { + Options []option.RequestOption +} + +// NewAccountAccessServiceTokenRotateService 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 NewAccountAccessServiceTokenRotateService(opts ...option.RequestOption) (r *AccountAccessServiceTokenRotateService) { + r = &AccountAccessServiceTokenRotateService{} + r.Options = opts + return +} + +// Generates a new Client Secret for a service token and revokes the old one. +func (r *AccountAccessServiceTokenRotateService) AccessServiceTokensRotateAServiceToken(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/service_tokens/%s/rotate", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponse struct { + Errors []AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseError `json:"errors"` + Messages []AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseMessage `json:"messages"` + Result AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseSuccess `json:"success"` + JSON accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseJSON `json:"-"` +} + +// accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponse] +type accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseErrorJSON `json:"-"` +} + +// accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseError] +type accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseMessageJSON `json:"-"` +} + +// accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseMessage] +type accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + // The Client Secret for the service token. Access will check for this value in the + // `CF-Access-Client-Secret` request header. + ClientSecret string `json:"client_secret"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseResultJSON `json:"-"` +} + +// accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseResult] +type accountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseSuccess bool + +const ( + AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseSuccessTrue AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponseSuccess = true +) diff --git a/accountaccessservicetokenrotate_test.go b/accountaccessservicetokenrotate_test.go new file mode 100644 index 00000000000..550acaf658e --- /dev/null +++ b/accountaccessservicetokenrotate_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceToken(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.ServiceTokens.Rotates.AccessServiceTokensRotateAServiceToken( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/accountaccesstag.go b/accountaccesstag.go new file mode 100644 index 00000000000..9dce9503cca --- /dev/null +++ b/accountaccesstag.go @@ -0,0 +1,592 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessTagService 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 [NewAccountAccessTagService] method +// instead. +type AccountAccessTagService struct { + Options []option.RequestOption +} + +// NewAccountAccessTagService 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 NewAccountAccessTagService(opts ...option.RequestOption) (r *AccountAccessTagService) { + r = &AccountAccessTagService{} + r.Options = opts + return +} + +// Create a tag +func (r *AccountAccessTagService) NewTag(ctx context.Context, identifier string, body AccountAccessTagNewTagParams, opts ...option.RequestOption) (res *AccountAccessTagNewTagResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/tags", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Delete a tag +func (r *AccountAccessTagService) DeleteTag(ctx context.Context, identifier string, name string, opts ...option.RequestOption) (res *AccountAccessTagDeleteTagResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/tags/%s", identifier, name) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Get a tag +func (r *AccountAccessTagService) GetTag(ctx context.Context, identifier string, name string, opts ...option.RequestOption) (res *AccountAccessTagGetTagResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/tags/%s", identifier, name) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// List tags +func (r *AccountAccessTagService) ListTags(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessTagListTagsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/tags", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a tag +func (r *AccountAccessTagService) UpdateTag(ctx context.Context, identifier string, params AccountAccessTagUpdateTagParams, opts ...option.RequestOption) (res *AccountAccessTagUpdateTagResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/tags/%s", identifier, params.PathName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) + return +} + +type AccountAccessTagNewTagResponse struct { + Errors []AccountAccessTagNewTagResponseError `json:"errors"` + Messages []AccountAccessTagNewTagResponseMessage `json:"messages"` + // A tag + Result AccountAccessTagNewTagResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessTagNewTagResponseSuccess `json:"success"` + JSON accountAccessTagNewTagResponseJSON `json:"-"` +} + +// accountAccessTagNewTagResponseJSON contains the JSON metadata for the struct +// [AccountAccessTagNewTagResponse] +type accountAccessTagNewTagResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagNewTagResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagNewTagResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagNewTagResponseErrorJSON `json:"-"` +} + +// accountAccessTagNewTagResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessTagNewTagResponseError] +type accountAccessTagNewTagResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagNewTagResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagNewTagResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagNewTagResponseMessageJSON `json:"-"` +} + +// accountAccessTagNewTagResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessTagNewTagResponseMessage] +type accountAccessTagNewTagResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagNewTagResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A tag +type AccountAccessTagNewTagResponseResult struct { + // The name of the tag + Name string `json:"name,required"` + // The number of applications that have this tag + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessTagNewTagResponseResultJSON `json:"-"` +} + +// accountAccessTagNewTagResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessTagNewTagResponseResult] +type accountAccessTagNewTagResponseResultJSON struct { + Name apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagNewTagResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessTagNewTagResponseSuccess bool + +const ( + AccountAccessTagNewTagResponseSuccessTrue AccountAccessTagNewTagResponseSuccess = true +) + +type AccountAccessTagDeleteTagResponse struct { + Errors []AccountAccessTagDeleteTagResponseError `json:"errors"` + Messages []AccountAccessTagDeleteTagResponseMessage `json:"messages"` + Result AccountAccessTagDeleteTagResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessTagDeleteTagResponseSuccess `json:"success"` + JSON accountAccessTagDeleteTagResponseJSON `json:"-"` +} + +// accountAccessTagDeleteTagResponseJSON contains the JSON metadata for the struct +// [AccountAccessTagDeleteTagResponse] +type accountAccessTagDeleteTagResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagDeleteTagResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagDeleteTagResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagDeleteTagResponseErrorJSON `json:"-"` +} + +// accountAccessTagDeleteTagResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessTagDeleteTagResponseError] +type accountAccessTagDeleteTagResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagDeleteTagResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagDeleteTagResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagDeleteTagResponseMessageJSON `json:"-"` +} + +// accountAccessTagDeleteTagResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessTagDeleteTagResponseMessage] +type accountAccessTagDeleteTagResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagDeleteTagResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagDeleteTagResponseResult struct { + // The name of the tag + Name string `json:"name"` + JSON accountAccessTagDeleteTagResponseResultJSON `json:"-"` +} + +// accountAccessTagDeleteTagResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessTagDeleteTagResponseResult] +type accountAccessTagDeleteTagResponseResultJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagDeleteTagResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessTagDeleteTagResponseSuccess bool + +const ( + AccountAccessTagDeleteTagResponseSuccessTrue AccountAccessTagDeleteTagResponseSuccess = true +) + +type AccountAccessTagGetTagResponse struct { + Errors []AccountAccessTagGetTagResponseError `json:"errors"` + Messages []AccountAccessTagGetTagResponseMessage `json:"messages"` + // A tag + Result AccountAccessTagGetTagResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessTagGetTagResponseSuccess `json:"success"` + JSON accountAccessTagGetTagResponseJSON `json:"-"` +} + +// accountAccessTagGetTagResponseJSON contains the JSON metadata for the struct +// [AccountAccessTagGetTagResponse] +type accountAccessTagGetTagResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagGetTagResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagGetTagResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagGetTagResponseErrorJSON `json:"-"` +} + +// accountAccessTagGetTagResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessTagGetTagResponseError] +type accountAccessTagGetTagResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagGetTagResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagGetTagResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagGetTagResponseMessageJSON `json:"-"` +} + +// accountAccessTagGetTagResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessTagGetTagResponseMessage] +type accountAccessTagGetTagResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagGetTagResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A tag +type AccountAccessTagGetTagResponseResult struct { + // The name of the tag + Name string `json:"name,required"` + // The number of applications that have this tag + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessTagGetTagResponseResultJSON `json:"-"` +} + +// accountAccessTagGetTagResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessTagGetTagResponseResult] +type accountAccessTagGetTagResponseResultJSON struct { + Name apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagGetTagResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessTagGetTagResponseSuccess bool + +const ( + AccountAccessTagGetTagResponseSuccessTrue AccountAccessTagGetTagResponseSuccess = true +) + +type AccountAccessTagListTagsResponse struct { + Errors []AccountAccessTagListTagsResponseError `json:"errors"` + Messages []AccountAccessTagListTagsResponseMessage `json:"messages"` + Result []AccountAccessTagListTagsResponseResult `json:"result"` + ResultInfo AccountAccessTagListTagsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessTagListTagsResponseSuccess `json:"success"` + JSON accountAccessTagListTagsResponseJSON `json:"-"` +} + +// accountAccessTagListTagsResponseJSON contains the JSON metadata for the struct +// [AccountAccessTagListTagsResponse] +type accountAccessTagListTagsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagListTagsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagListTagsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagListTagsResponseErrorJSON `json:"-"` +} + +// accountAccessTagListTagsResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessTagListTagsResponseError] +type accountAccessTagListTagsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagListTagsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagListTagsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagListTagsResponseMessageJSON `json:"-"` +} + +// accountAccessTagListTagsResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessTagListTagsResponseMessage] +type accountAccessTagListTagsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagListTagsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A tag +type AccountAccessTagListTagsResponseResult struct { + // The name of the tag + Name string `json:"name,required"` + // The number of applications that have this tag + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessTagListTagsResponseResultJSON `json:"-"` +} + +// accountAccessTagListTagsResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessTagListTagsResponseResult] +type accountAccessTagListTagsResponseResultJSON struct { + Name apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagListTagsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagListTagsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessTagListTagsResponseResultInfoJSON `json:"-"` +} + +// accountAccessTagListTagsResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountAccessTagListTagsResponseResultInfo] +type accountAccessTagListTagsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagListTagsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessTagListTagsResponseSuccess bool + +const ( + AccountAccessTagListTagsResponseSuccessTrue AccountAccessTagListTagsResponseSuccess = true +) + +type AccountAccessTagUpdateTagResponse struct { + Errors []AccountAccessTagUpdateTagResponseError `json:"errors"` + Messages []AccountAccessTagUpdateTagResponseMessage `json:"messages"` + // A tag + Result AccountAccessTagUpdateTagResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessTagUpdateTagResponseSuccess `json:"success"` + JSON accountAccessTagUpdateTagResponseJSON `json:"-"` +} + +// accountAccessTagUpdateTagResponseJSON contains the JSON metadata for the struct +// [AccountAccessTagUpdateTagResponse] +type accountAccessTagUpdateTagResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagUpdateTagResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagUpdateTagResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagUpdateTagResponseErrorJSON `json:"-"` +} + +// accountAccessTagUpdateTagResponseErrorJSON contains the JSON metadata for the +// struct [AccountAccessTagUpdateTagResponseError] +type accountAccessTagUpdateTagResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagUpdateTagResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessTagUpdateTagResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessTagUpdateTagResponseMessageJSON `json:"-"` +} + +// accountAccessTagUpdateTagResponseMessageJSON contains the JSON metadata for the +// struct [AccountAccessTagUpdateTagResponseMessage] +type accountAccessTagUpdateTagResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagUpdateTagResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A tag +type AccountAccessTagUpdateTagResponseResult struct { + // The name of the tag + Name string `json:"name,required"` + // The number of applications that have this tag + AppCount int64 `json:"app_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessTagUpdateTagResponseResultJSON `json:"-"` +} + +// accountAccessTagUpdateTagResponseResultJSON contains the JSON metadata for the +// struct [AccountAccessTagUpdateTagResponseResult] +type accountAccessTagUpdateTagResponseResultJSON struct { + Name apijson.Field + AppCount apijson.Field + CreatedAt apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessTagUpdateTagResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessTagUpdateTagResponseSuccess bool + +const ( + AccountAccessTagUpdateTagResponseSuccessTrue AccountAccessTagUpdateTagResponseSuccess = true +) + +type AccountAccessTagNewTagParams struct { + // The name of the tag + Name param.Field[string] `json:"name,required"` +} + +func (r AccountAccessTagNewTagParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAccessTagUpdateTagParams struct { + // The name of the tag + PathName param.Field[string] `path:"name,required"` + // The name of the tag + BodyName param.Field[string] `json:"name,required"` +} + +func (r AccountAccessTagUpdateTagParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaccesstag_test.go b/accountaccesstag_test.go new file mode 100644 index 00000000000..bdf6a3ac0c5 --- /dev/null +++ b/accountaccesstag_test.go @@ -0,0 +1,165 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessTagNewTag(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Tags.NewTag( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessTagNewTagParams{ + Name: cloudflare.F("engineers"), + }, + ) + 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 TestAccountAccessTagDeleteTag(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Tags.DeleteTag( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "engineers", + ) + 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 TestAccountAccessTagGetTag(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Tags.GetTag( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "engineers", + ) + 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 TestAccountAccessTagListTags(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Tags.ListTags(context.TODO(), "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()) + } +} + +func TestAccountAccessTagUpdateTag(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Tags.UpdateTag( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAccessTagUpdateTagParams{ + PathName: cloudflare.F("engineers"), + BodyName: cloudflare.F("engineers"), + }, + ) + 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/accountaccessuser.go b/accountaccessuser.go new file mode 100644 index 00000000000..a9099dd1166 --- /dev/null +++ b/accountaccessuser.go @@ -0,0 +1,187 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessUserService 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 [NewAccountAccessUserService] method +// instead. +type AccountAccessUserService struct { + Options []option.RequestOption + ActiveSessions *AccountAccessUserActiveSessionService + LastSeenIdentity *AccountAccessUserLastSeenIdentityService + FailedLogins *AccountAccessUserFailedLoginService +} + +// NewAccountAccessUserService 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 NewAccountAccessUserService(opts ...option.RequestOption) (r *AccountAccessUserService) { + r = &AccountAccessUserService{} + r.Options = opts + r.ActiveSessions = NewAccountAccessUserActiveSessionService(opts...) + r.LastSeenIdentity = NewAccountAccessUserLastSeenIdentityService(opts...) + r.FailedLogins = NewAccountAccessUserFailedLoginService(opts...) + return +} + +// Gets a list of users for an account. +func (r *AccountAccessUserService) ZeroTrustUsersGetUsers(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountAccessUserZeroTrustUsersGetUsersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/users", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessUserZeroTrustUsersGetUsersResponse struct { + Errors []AccountAccessUserZeroTrustUsersGetUsersResponseError `json:"errors"` + Messages []AccountAccessUserZeroTrustUsersGetUsersResponseMessage `json:"messages"` + Result []AccountAccessUserZeroTrustUsersGetUsersResponseResult `json:"result"` + ResultInfo AccountAccessUserZeroTrustUsersGetUsersResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessUserZeroTrustUsersGetUsersResponseSuccess `json:"success"` + JSON accountAccessUserZeroTrustUsersGetUsersResponseJSON `json:"-"` +} + +// accountAccessUserZeroTrustUsersGetUsersResponseJSON contains the JSON metadata +// for the struct [AccountAccessUserZeroTrustUsersGetUsersResponse] +type accountAccessUserZeroTrustUsersGetUsersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserZeroTrustUsersGetUsersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserZeroTrustUsersGetUsersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserZeroTrustUsersGetUsersResponseErrorJSON `json:"-"` +} + +// accountAccessUserZeroTrustUsersGetUsersResponseErrorJSON contains the JSON +// metadata for the struct [AccountAccessUserZeroTrustUsersGetUsersResponseError] +type accountAccessUserZeroTrustUsersGetUsersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserZeroTrustUsersGetUsersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserZeroTrustUsersGetUsersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserZeroTrustUsersGetUsersResponseMessageJSON `json:"-"` +} + +// accountAccessUserZeroTrustUsersGetUsersResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessUserZeroTrustUsersGetUsersResponseMessage] +type accountAccessUserZeroTrustUsersGetUsersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserZeroTrustUsersGetUsersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserZeroTrustUsersGetUsersResponseResult struct { + // UUID + ID string `json:"id"` + // True if the user has authenticated with Cloudflare Access. + AccessSeat bool `json:"access_seat"` + // The number of active devices registered to the user. + ActiveDeviceCount float64 `json:"active_device_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The email of the user. + Email string `json:"email" format:"email"` + // True if the user has logged into the WARP client. + GatewaySeat bool `json:"gateway_seat"` + // The time at which the user last successfully logged in. + LastSuccessfulLogin time.Time `json:"last_successful_login" format:"date-time"` + // The name of the user. + Name string `json:"name"` + // The unique API identifier for the Zero Trust seat. + SeatUid interface{} `json:"seat_uid"` + // The unique API identifier for the user. + Uid interface{} `json:"uid"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountAccessUserZeroTrustUsersGetUsersResponseResultJSON `json:"-"` +} + +// accountAccessUserZeroTrustUsersGetUsersResponseResultJSON contains the JSON +// metadata for the struct [AccountAccessUserZeroTrustUsersGetUsersResponseResult] +type accountAccessUserZeroTrustUsersGetUsersResponseResultJSON struct { + ID apijson.Field + AccessSeat apijson.Field + ActiveDeviceCount apijson.Field + CreatedAt apijson.Field + Email apijson.Field + GatewaySeat apijson.Field + LastSuccessfulLogin apijson.Field + Name apijson.Field + SeatUid apijson.Field + Uid apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserZeroTrustUsersGetUsersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserZeroTrustUsersGetUsersResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + JSON accountAccessUserZeroTrustUsersGetUsersResponseResultInfoJSON `json:"-"` +} + +// accountAccessUserZeroTrustUsersGetUsersResponseResultInfoJSON contains the JSON +// metadata for the struct +// [AccountAccessUserZeroTrustUsersGetUsersResponseResultInfo] +type accountAccessUserZeroTrustUsersGetUsersResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserZeroTrustUsersGetUsersResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessUserZeroTrustUsersGetUsersResponseSuccess bool + +const ( + AccountAccessUserZeroTrustUsersGetUsersResponseSuccessTrue AccountAccessUserZeroTrustUsersGetUsersResponseSuccess = true +) diff --git a/accountaccessuser_test.go b/accountaccessuser_test.go new file mode 100644 index 00000000000..e00e4a7119b --- /dev/null +++ b/accountaccessuser_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessUserZeroTrustUsersGetUsers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Users.ZeroTrustUsersGetUsers(context.TODO(), "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/accountaccessuseractivesession.go b/accountaccessuseractivesession.go new file mode 100644 index 00000000000..8454eea30ce --- /dev/null +++ b/accountaccessuseractivesession.go @@ -0,0 +1,381 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessUserActiveSessionService 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 +// [NewAccountAccessUserActiveSessionService] method instead. +type AccountAccessUserActiveSessionService struct { + Options []option.RequestOption +} + +// NewAccountAccessUserActiveSessionService 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 NewAccountAccessUserActiveSessionService(opts ...option.RequestOption) (r *AccountAccessUserActiveSessionService) { + r = &AccountAccessUserActiveSessionService{} + r.Options = opts + return +} + +// Get active sessions for a single user. +func (r *AccountAccessUserActiveSessionService) List(ctx context.Context, identifier string, id string, opts ...option.RequestOption) (res *AccountAccessUserActiveSessionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/users/%s/active_sessions", identifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Get an active session for a single user. +func (r *AccountAccessUserActiveSessionService) GetActiveSession(ctx context.Context, identifier string, id string, nonce string, opts ...option.RequestOption) (res *AccountAccessUserActiveSessionGetActiveSessionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/users/%s/active_sessions/%s", identifier, id, nonce) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessUserActiveSessionListResponse struct { + Errors []AccountAccessUserActiveSessionListResponseError `json:"errors"` + Messages []AccountAccessUserActiveSessionListResponseMessage `json:"messages"` + Result []AccountAccessUserActiveSessionListResponseResult `json:"result"` + ResultInfo AccountAccessUserActiveSessionListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessUserActiveSessionListResponseSuccess `json:"success"` + JSON accountAccessUserActiveSessionListResponseJSON `json:"-"` +} + +// accountAccessUserActiveSessionListResponseJSON contains the JSON metadata for +// the struct [AccountAccessUserActiveSessionListResponse] +type accountAccessUserActiveSessionListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserActiveSessionListResponseErrorJSON `json:"-"` +} + +// accountAccessUserActiveSessionListResponseErrorJSON contains the JSON metadata +// for the struct [AccountAccessUserActiveSessionListResponseError] +type accountAccessUserActiveSessionListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserActiveSessionListResponseMessageJSON `json:"-"` +} + +// accountAccessUserActiveSessionListResponseMessageJSON contains the JSON metadata +// for the struct [AccountAccessUserActiveSessionListResponseMessage] +type accountAccessUserActiveSessionListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionListResponseResult struct { + Expiration int64 `json:"expiration"` + Metadata AccountAccessUserActiveSessionListResponseResultMetadata `json:"metadata"` + Name string `json:"name"` + JSON accountAccessUserActiveSessionListResponseResultJSON `json:"-"` +} + +// accountAccessUserActiveSessionListResponseResultJSON contains the JSON metadata +// for the struct [AccountAccessUserActiveSessionListResponseResult] +type accountAccessUserActiveSessionListResponseResultJSON struct { + Expiration apijson.Field + Metadata apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionListResponseResultMetadata struct { + Apps interface{} `json:"apps"` + Expires int64 `json:"expires"` + Iat int64 `json:"iat"` + Nonce string `json:"nonce"` + Ttl int64 `json:"ttl"` + JSON accountAccessUserActiveSessionListResponseResultMetadataJSON `json:"-"` +} + +// accountAccessUserActiveSessionListResponseResultMetadataJSON contains the JSON +// metadata for the struct +// [AccountAccessUserActiveSessionListResponseResultMetadata] +type accountAccessUserActiveSessionListResponseResultMetadataJSON struct { + Apps apijson.Field + Expires apijson.Field + Iat apijson.Field + Nonce apijson.Field + Ttl apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionListResponseResultMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessUserActiveSessionListResponseResultInfoJSON `json:"-"` +} + +// accountAccessUserActiveSessionListResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountAccessUserActiveSessionListResponseResultInfo] +type accountAccessUserActiveSessionListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessUserActiveSessionListResponseSuccess bool + +const ( + AccountAccessUserActiveSessionListResponseSuccessTrue AccountAccessUserActiveSessionListResponseSuccess = true +) + +type AccountAccessUserActiveSessionGetActiveSessionResponse struct { + Errors []AccountAccessUserActiveSessionGetActiveSessionResponseError `json:"errors"` + Messages []AccountAccessUserActiveSessionGetActiveSessionResponseMessage `json:"messages"` + Result AccountAccessUserActiveSessionGetActiveSessionResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessUserActiveSessionGetActiveSessionResponseSuccess `json:"success"` + JSON accountAccessUserActiveSessionGetActiveSessionResponseJSON `json:"-"` +} + +// accountAccessUserActiveSessionGetActiveSessionResponseJSON contains the JSON +// metadata for the struct [AccountAccessUserActiveSessionGetActiveSessionResponse] +type accountAccessUserActiveSessionGetActiveSessionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionGetActiveSessionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionGetActiveSessionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserActiveSessionGetActiveSessionResponseErrorJSON `json:"-"` +} + +// accountAccessUserActiveSessionGetActiveSessionResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountAccessUserActiveSessionGetActiveSessionResponseError] +type accountAccessUserActiveSessionGetActiveSessionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionGetActiveSessionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionGetActiveSessionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserActiveSessionGetActiveSessionResponseMessageJSON `json:"-"` +} + +// accountAccessUserActiveSessionGetActiveSessionResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountAccessUserActiveSessionGetActiveSessionResponseMessage] +type accountAccessUserActiveSessionGetActiveSessionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionGetActiveSessionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionGetActiveSessionResponseResult struct { + AccountID string `json:"account_id"` + AuthStatus string `json:"auth_status"` + CommonName string `json:"common_name"` + DeviceID string `json:"device_id"` + DeviceSessions interface{} `json:"device_sessions"` + DevicePosture interface{} `json:"devicePosture"` + Email string `json:"email"` + Geo AccountAccessUserActiveSessionGetActiveSessionResponseResultGeo `json:"geo"` + Iat float64 `json:"iat"` + Idp AccountAccessUserActiveSessionGetActiveSessionResponseResultIdp `json:"idp"` + IP string `json:"ip"` + IsGateway bool `json:"is_gateway"` + IsWarp bool `json:"is_warp"` + IsActive bool `json:"isActive"` + MtlsAuth AccountAccessUserActiveSessionGetActiveSessionResponseResultMtlsAuth `json:"mtls_auth"` + ServiceTokenID string `json:"service_token_id"` + ServiceTokenStatus bool `json:"service_token_status"` + UserUuid string `json:"user_uuid"` + Version float64 `json:"version"` + JSON accountAccessUserActiveSessionGetActiveSessionResponseResultJSON `json:"-"` +} + +// accountAccessUserActiveSessionGetActiveSessionResponseResultJSON contains the +// JSON metadata for the struct +// [AccountAccessUserActiveSessionGetActiveSessionResponseResult] +type accountAccessUserActiveSessionGetActiveSessionResponseResultJSON struct { + AccountID apijson.Field + AuthStatus apijson.Field + CommonName apijson.Field + DeviceID apijson.Field + DeviceSessions apijson.Field + DevicePosture apijson.Field + Email apijson.Field + Geo apijson.Field + Iat apijson.Field + Idp apijson.Field + IP apijson.Field + IsGateway apijson.Field + IsWarp apijson.Field + IsActive apijson.Field + MtlsAuth apijson.Field + ServiceTokenID apijson.Field + ServiceTokenStatus apijson.Field + UserUuid apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionGetActiveSessionResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionGetActiveSessionResponseResultGeo struct { + Country string `json:"country"` + JSON accountAccessUserActiveSessionGetActiveSessionResponseResultGeoJSON `json:"-"` +} + +// accountAccessUserActiveSessionGetActiveSessionResponseResultGeoJSON contains the +// JSON metadata for the struct +// [AccountAccessUserActiveSessionGetActiveSessionResponseResultGeo] +type accountAccessUserActiveSessionGetActiveSessionResponseResultGeoJSON struct { + Country apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionGetActiveSessionResponseResultGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionGetActiveSessionResponseResultIdp struct { + ID string `json:"id"` + Type string `json:"type"` + JSON accountAccessUserActiveSessionGetActiveSessionResponseResultIdpJSON `json:"-"` +} + +// accountAccessUserActiveSessionGetActiveSessionResponseResultIdpJSON contains the +// JSON metadata for the struct +// [AccountAccessUserActiveSessionGetActiveSessionResponseResultIdp] +type accountAccessUserActiveSessionGetActiveSessionResponseResultIdpJSON struct { + ID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionGetActiveSessionResponseResultIdp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserActiveSessionGetActiveSessionResponseResultMtlsAuth struct { + AuthStatus string `json:"auth_status"` + CertIssuerDn string `json:"cert_issuer_dn"` + CertIssuerSki string `json:"cert_issuer_ski"` + CertPresented bool `json:"cert_presented"` + CertSerial string `json:"cert_serial"` + JSON accountAccessUserActiveSessionGetActiveSessionResponseResultMtlsAuthJSON `json:"-"` +} + +// accountAccessUserActiveSessionGetActiveSessionResponseResultMtlsAuthJSON +// contains the JSON metadata for the struct +// [AccountAccessUserActiveSessionGetActiveSessionResponseResultMtlsAuth] +type accountAccessUserActiveSessionGetActiveSessionResponseResultMtlsAuthJSON struct { + AuthStatus apijson.Field + CertIssuerDn apijson.Field + CertIssuerSki apijson.Field + CertPresented apijson.Field + CertSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserActiveSessionGetActiveSessionResponseResultMtlsAuth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessUserActiveSessionGetActiveSessionResponseSuccess bool + +const ( + AccountAccessUserActiveSessionGetActiveSessionResponseSuccessTrue AccountAccessUserActiveSessionGetActiveSessionResponseSuccess = true +) diff --git a/accountaccessuseractivesession_test.go b/accountaccessuseractivesession_test.go new file mode 100644 index 00000000000..8d43a8368ed --- /dev/null +++ b/accountaccessuseractivesession_test.go @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessUserActiveSessionList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Users.ActiveSessions.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountAccessUserActiveSessionGetActiveSession(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Users.ActiveSessions.GetActiveSession( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "X1aXj1lFVcqqyoXF", + ) + 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/accountaccessuserfailedlogin.go b/accountaccessuserfailedlogin.go new file mode 100644 index 00000000000..b473a4164bf --- /dev/null +++ b/accountaccessuserfailedlogin.go @@ -0,0 +1,161 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessUserFailedLoginService 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 +// [NewAccountAccessUserFailedLoginService] method instead. +type AccountAccessUserFailedLoginService struct { + Options []option.RequestOption +} + +// NewAccountAccessUserFailedLoginService 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 NewAccountAccessUserFailedLoginService(opts ...option.RequestOption) (r *AccountAccessUserFailedLoginService) { + r = &AccountAccessUserFailedLoginService{} + r.Options = opts + return +} + +// Get all failed login attempts for a single user. +func (r *AccountAccessUserFailedLoginService) ZeroTrustUsersGetFailedLogins(ctx context.Context, identifier string, id string, opts ...option.RequestOption) (res *AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/users/%s/failed_logins", identifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponse struct { + Errors []AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseError `json:"errors"` + Messages []AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseMessage `json:"messages"` + Result []AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResult `json:"result"` + ResultInfo AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseSuccess `json:"success"` + JSON accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseJSON `json:"-"` +} + +// accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseJSON contains +// the JSON metadata for the struct +// [AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponse] +type accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseErrorJSON `json:"-"` +} + +// accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseError] +type accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseMessageJSON `json:"-"` +} + +// accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseMessage] +type accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResult struct { + Expiration int64 `json:"expiration"` + Metadata interface{} `json:"metadata"` + JSON accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultJSON `json:"-"` +} + +// accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResult] +type accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultJSON struct { + Expiration apijson.Field + Metadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultInfoJSON `json:"-"` +} + +// accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultInfo] +type accountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseSuccess bool + +const ( + AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseSuccessTrue AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponseSuccess = true +) diff --git a/accountaccessuserfailedlogin_test.go b/accountaccessuserfailedlogin_test.go new file mode 100644 index 00000000000..1ec07b03966 --- /dev/null +++ b/accountaccessuserfailedlogin_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessUserFailedLoginZeroTrustUsersGetFailedLogins(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Users.FailedLogins.ZeroTrustUsersGetFailedLogins( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/accountaccessuserlastseenidentity.go b/accountaccessuserlastseenidentity.go new file mode 100644 index 00000000000..f4f3108ad56 --- /dev/null +++ b/accountaccessuserlastseenidentity.go @@ -0,0 +1,221 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAccessUserLastSeenIdentityService 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 +// [NewAccountAccessUserLastSeenIdentityService] method instead. +type AccountAccessUserLastSeenIdentityService struct { + Options []option.RequestOption +} + +// NewAccountAccessUserLastSeenIdentityService 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 NewAccountAccessUserLastSeenIdentityService(opts ...option.RequestOption) (r *AccountAccessUserLastSeenIdentityService) { + r = &AccountAccessUserLastSeenIdentityService{} + r.Options = opts + return +} + +// Get last seen identity for a single user. +func (r *AccountAccessUserLastSeenIdentityService) Get(ctx context.Context, identifier string, id string, opts ...option.RequestOption) (res *AccountAccessUserLastSeenIdentityGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/access/users/%s/last_seen_identity", identifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAccessUserLastSeenIdentityGetResponse struct { + Errors []AccountAccessUserLastSeenIdentityGetResponseError `json:"errors"` + Messages []AccountAccessUserLastSeenIdentityGetResponseMessage `json:"messages"` + Result AccountAccessUserLastSeenIdentityGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAccessUserLastSeenIdentityGetResponseSuccess `json:"success"` + JSON accountAccessUserLastSeenIdentityGetResponseJSON `json:"-"` +} + +// accountAccessUserLastSeenIdentityGetResponseJSON contains the JSON metadata for +// the struct [AccountAccessUserLastSeenIdentityGetResponse] +type accountAccessUserLastSeenIdentityGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserLastSeenIdentityGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserLastSeenIdentityGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserLastSeenIdentityGetResponseErrorJSON `json:"-"` +} + +// accountAccessUserLastSeenIdentityGetResponseErrorJSON contains the JSON metadata +// for the struct [AccountAccessUserLastSeenIdentityGetResponseError] +type accountAccessUserLastSeenIdentityGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserLastSeenIdentityGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserLastSeenIdentityGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAccessUserLastSeenIdentityGetResponseMessageJSON `json:"-"` +} + +// accountAccessUserLastSeenIdentityGetResponseMessageJSON contains the JSON +// metadata for the struct [AccountAccessUserLastSeenIdentityGetResponseMessage] +type accountAccessUserLastSeenIdentityGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserLastSeenIdentityGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserLastSeenIdentityGetResponseResult struct { + AccountID string `json:"account_id"` + AuthStatus string `json:"auth_status"` + CommonName string `json:"common_name"` + DeviceID string `json:"device_id"` + DeviceSessions interface{} `json:"device_sessions"` + DevicePosture interface{} `json:"devicePosture"` + Email string `json:"email"` + Geo AccountAccessUserLastSeenIdentityGetResponseResultGeo `json:"geo"` + Iat float64 `json:"iat"` + Idp AccountAccessUserLastSeenIdentityGetResponseResultIdp `json:"idp"` + IP string `json:"ip"` + IsGateway bool `json:"is_gateway"` + IsWarp bool `json:"is_warp"` + MtlsAuth AccountAccessUserLastSeenIdentityGetResponseResultMtlsAuth `json:"mtls_auth"` + ServiceTokenID string `json:"service_token_id"` + ServiceTokenStatus bool `json:"service_token_status"` + UserUuid string `json:"user_uuid"` + Version float64 `json:"version"` + JSON accountAccessUserLastSeenIdentityGetResponseResultJSON `json:"-"` +} + +// accountAccessUserLastSeenIdentityGetResponseResultJSON contains the JSON +// metadata for the struct [AccountAccessUserLastSeenIdentityGetResponseResult] +type accountAccessUserLastSeenIdentityGetResponseResultJSON struct { + AccountID apijson.Field + AuthStatus apijson.Field + CommonName apijson.Field + DeviceID apijson.Field + DeviceSessions apijson.Field + DevicePosture apijson.Field + Email apijson.Field + Geo apijson.Field + Iat apijson.Field + Idp apijson.Field + IP apijson.Field + IsGateway apijson.Field + IsWarp apijson.Field + MtlsAuth apijson.Field + ServiceTokenID apijson.Field + ServiceTokenStatus apijson.Field + UserUuid apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserLastSeenIdentityGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserLastSeenIdentityGetResponseResultGeo struct { + Country string `json:"country"` + JSON accountAccessUserLastSeenIdentityGetResponseResultGeoJSON `json:"-"` +} + +// accountAccessUserLastSeenIdentityGetResponseResultGeoJSON contains the JSON +// metadata for the struct [AccountAccessUserLastSeenIdentityGetResponseResultGeo] +type accountAccessUserLastSeenIdentityGetResponseResultGeoJSON struct { + Country apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserLastSeenIdentityGetResponseResultGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserLastSeenIdentityGetResponseResultIdp struct { + ID string `json:"id"` + Type string `json:"type"` + JSON accountAccessUserLastSeenIdentityGetResponseResultIdpJSON `json:"-"` +} + +// accountAccessUserLastSeenIdentityGetResponseResultIdpJSON contains the JSON +// metadata for the struct [AccountAccessUserLastSeenIdentityGetResponseResultIdp] +type accountAccessUserLastSeenIdentityGetResponseResultIdpJSON struct { + ID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserLastSeenIdentityGetResponseResultIdp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAccessUserLastSeenIdentityGetResponseResultMtlsAuth struct { + AuthStatus string `json:"auth_status"` + CertIssuerDn string `json:"cert_issuer_dn"` + CertIssuerSki string `json:"cert_issuer_ski"` + CertPresented bool `json:"cert_presented"` + CertSerial string `json:"cert_serial"` + JSON accountAccessUserLastSeenIdentityGetResponseResultMtlsAuthJSON `json:"-"` +} + +// accountAccessUserLastSeenIdentityGetResponseResultMtlsAuthJSON contains the JSON +// metadata for the struct +// [AccountAccessUserLastSeenIdentityGetResponseResultMtlsAuth] +type accountAccessUserLastSeenIdentityGetResponseResultMtlsAuthJSON struct { + AuthStatus apijson.Field + CertIssuerDn apijson.Field + CertIssuerSki apijson.Field + CertPresented apijson.Field + CertSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAccessUserLastSeenIdentityGetResponseResultMtlsAuth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAccessUserLastSeenIdentityGetResponseSuccess bool + +const ( + AccountAccessUserLastSeenIdentityGetResponseSuccessTrue AccountAccessUserLastSeenIdentityGetResponseSuccess = true +) diff --git a/accountaccessuserlastseenidentity_test.go b/accountaccessuserlastseenidentity_test.go new file mode 100644 index 00000000000..45e92d7209b --- /dev/null +++ b/accountaccessuserlastseenidentity_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAccessUserLastSeenIdentityGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Access.Users.LastSeenIdentity.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/accountaddress.go b/accountaddress.go new file mode 100644 index 00000000000..13b52d241bf --- /dev/null +++ b/accountaddress.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressService 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 [NewAccountAddressService] method +// instead. +type AccountAddressService struct { + Options []option.RequestOption + AddressMaps *AccountAddressAddressMapService + LoaDocuments *AccountAddressLoaDocumentService + Prefixes *AccountAddressPrefixService +} + +// NewAccountAddressService 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 NewAccountAddressService(opts ...option.RequestOption) (r *AccountAddressService) { + r = &AccountAddressService{} + r.Options = opts + r.AddressMaps = NewAccountAddressAddressMapService(opts...) + r.LoaDocuments = NewAccountAddressLoaDocumentService(opts...) + r.Prefixes = NewAccountAddressPrefixService(opts...) + return +} diff --git a/accountaddressaddressmap.go b/accountaddressaddressmap.go new file mode 100644 index 00000000000..0db5b4f6d52 --- /dev/null +++ b/accountaddressaddressmap.go @@ -0,0 +1,817 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressAddressMapService 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 +// [NewAccountAddressAddressMapService] method instead. +type AccountAddressAddressMapService struct { + Options []option.RequestOption + Accounts *AccountAddressAddressMapAccountService + IPs *AccountAddressAddressMapIPService + Zones *AccountAddressAddressMapZoneService +} + +// NewAccountAddressAddressMapService 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 NewAccountAddressAddressMapService(opts ...option.RequestOption) (r *AccountAddressAddressMapService) { + r = &AccountAddressAddressMapService{} + r.Options = opts + r.Accounts = NewAccountAddressAddressMapAccountService(opts...) + r.IPs = NewAccountAddressAddressMapIPService(opts...) + r.Zones = NewAccountAddressAddressMapZoneService(opts...) + return +} + +// Create a new address map under the account. +func (r *AccountAddressAddressMapService) New(ctx context.Context, accountIdentifier string, body AccountAddressAddressMapNewParams, opts ...option.RequestOption) (res *AccountAddressAddressMapNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Show a particular address map owned by the account. +func (r *AccountAddressAddressMapService) Get(ctx context.Context, accountIdentifier string, addressMapIdentifier string, opts ...option.RequestOption) (res *AccountAddressAddressMapGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", accountIdentifier, addressMapIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify properties of an address map owned by the account. +func (r *AccountAddressAddressMapService) Update(ctx context.Context, accountIdentifier string, addressMapIdentifier string, body AccountAddressAddressMapUpdateParams, opts ...option.RequestOption) (res *AccountAddressAddressMapUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", accountIdentifier, addressMapIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// List all address maps owned by the account. +func (r *AccountAddressAddressMapService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountAddressAddressMapListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a particular address map owned by the account. An Address Map must be +// disabled before it can be deleted. +func (r *AccountAddressAddressMapService) Delete(ctx context.Context, accountIdentifier string, addressMapIdentifier string, opts ...option.RequestOption) (res *AccountAddressAddressMapDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", accountIdentifier, addressMapIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AccountAddressAddressMapNewResponse struct { + Errors []AccountAddressAddressMapNewResponseError `json:"errors"` + Messages []AccountAddressAddressMapNewResponseMessage `json:"messages"` + Result AccountAddressAddressMapNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressAddressMapNewResponseSuccess `json:"success"` + JSON accountAddressAddressMapNewResponseJSON `json:"-"` +} + +// accountAddressAddressMapNewResponseJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapNewResponse] +type accountAddressAddressMapNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapNewResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapNewResponseError] +type accountAddressAddressMapNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapNewResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapNewResponseMessageJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapNewResponseMessage] +type accountAddressAddressMapNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapNewResponseResult struct { + // 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. + CanDelete bool `json:"can_delete"` + // If set to false, then the IPs on the Address Map cannot be modified via the API. + // This is true for Cloudflare-managed maps. + CanModifyIPs bool `json:"can_modify_ips"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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 + // handshake from a client without an SNI, it will respond with the default SNI on + // those IPs. The default SNI can be any valid zone or subdomain owned by the + // account. + DefaultSni string `json:"default_sni,nullable"` + // An optional description field which may be used to describe the types of IPs or + // zones on the map. + Description string `json:"description,nullable"` + // Whether the Address Map is enabled or not. Cloudflare's DNS will not respond + // with IP addresses on an Address Map until the map is enabled. + Enabled bool `json:"enabled,nullable"` + // The set of IPs on the Address Map. + IPs []AccountAddressAddressMapNewResponseResultIP `json:"ips"` + // Zones and Accounts which will be assigned IPs on this Address Map. A zone + // membership will take priority over an account membership. + Memberships []AccountAddressAddressMapNewResponseResultMembership `json:"memberships"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + JSON accountAddressAddressMapNewResponseResultJSON `json:"-"` +} + +// accountAddressAddressMapNewResponseResultJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapNewResponseResult] +type accountAddressAddressMapNewResponseResultJSON struct { + ID apijson.Field + CanDelete apijson.Field + CanModifyIPs apijson.Field + CreatedAt apijson.Field + DefaultSni apijson.Field + Description apijson.Field + Enabled apijson.Field + IPs apijson.Field + Memberships apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapNewResponseResultIP struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // An IPv4 or IPv6 address. + IP string `json:"ip"` + JSON accountAddressAddressMapNewResponseResultIPJSON `json:"-"` +} + +// accountAddressAddressMapNewResponseResultIPJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapNewResponseResultIP] +type accountAddressAddressMapNewResponseResultIPJSON struct { + CreatedAt apijson.Field + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapNewResponseResultIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapNewResponseResultMembership struct { + // Controls whether the membership can be deleted via the API or not. + CanDelete bool `json:"can_delete"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Identifier + Identifier string `json:"identifier"` + // The type of the membership. + Kind AccountAddressAddressMapNewResponseResultMembershipsKind `json:"kind"` + JSON accountAddressAddressMapNewResponseResultMembershipJSON `json:"-"` +} + +// accountAddressAddressMapNewResponseResultMembershipJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapNewResponseResultMembership] +type accountAddressAddressMapNewResponseResultMembershipJSON struct { + CanDelete apijson.Field + CreatedAt apijson.Field + Identifier apijson.Field + Kind apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapNewResponseResultMembership) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the membership. +type AccountAddressAddressMapNewResponseResultMembershipsKind string + +const ( + AccountAddressAddressMapNewResponseResultMembershipsKindZone AccountAddressAddressMapNewResponseResultMembershipsKind = "zone" + AccountAddressAddressMapNewResponseResultMembershipsKindAccount AccountAddressAddressMapNewResponseResultMembershipsKind = "account" +) + +// Whether the API call was successful +type AccountAddressAddressMapNewResponseSuccess bool + +const ( + AccountAddressAddressMapNewResponseSuccessTrue AccountAddressAddressMapNewResponseSuccess = true +) + +type AccountAddressAddressMapGetResponse struct { + Errors []AccountAddressAddressMapGetResponseError `json:"errors"` + Messages []AccountAddressAddressMapGetResponseMessage `json:"messages"` + Result AccountAddressAddressMapGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressAddressMapGetResponseSuccess `json:"success"` + JSON accountAddressAddressMapGetResponseJSON `json:"-"` +} + +// accountAddressAddressMapGetResponseJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapGetResponse] +type accountAddressAddressMapGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapGetResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapGetResponseError] +type accountAddressAddressMapGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapGetResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapGetResponseMessage] +type accountAddressAddressMapGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapGetResponseResult struct { + // 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. + CanDelete bool `json:"can_delete"` + // If set to false, then the IPs on the Address Map cannot be modified via the API. + // This is true for Cloudflare-managed maps. + CanModifyIPs bool `json:"can_modify_ips"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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 + // handshake from a client without an SNI, it will respond with the default SNI on + // those IPs. The default SNI can be any valid zone or subdomain owned by the + // account. + DefaultSni string `json:"default_sni,nullable"` + // An optional description field which may be used to describe the types of IPs or + // zones on the map. + Description string `json:"description,nullable"` + // Whether the Address Map is enabled or not. Cloudflare's DNS will not respond + // with IP addresses on an Address Map until the map is enabled. + Enabled bool `json:"enabled,nullable"` + // The set of IPs on the Address Map. + IPs []AccountAddressAddressMapGetResponseResultIP `json:"ips"` + // Zones and Accounts which will be assigned IPs on this Address Map. A zone + // membership will take priority over an account membership. + Memberships []AccountAddressAddressMapGetResponseResultMembership `json:"memberships"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + JSON accountAddressAddressMapGetResponseResultJSON `json:"-"` +} + +// accountAddressAddressMapGetResponseResultJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapGetResponseResult] +type accountAddressAddressMapGetResponseResultJSON struct { + ID apijson.Field + CanDelete apijson.Field + CanModifyIPs apijson.Field + CreatedAt apijson.Field + DefaultSni apijson.Field + Description apijson.Field + Enabled apijson.Field + IPs apijson.Field + Memberships apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapGetResponseResultIP struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // An IPv4 or IPv6 address. + IP string `json:"ip"` + JSON accountAddressAddressMapGetResponseResultIPJSON `json:"-"` +} + +// accountAddressAddressMapGetResponseResultIPJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapGetResponseResultIP] +type accountAddressAddressMapGetResponseResultIPJSON struct { + CreatedAt apijson.Field + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapGetResponseResultIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapGetResponseResultMembership struct { + // Controls whether the membership can be deleted via the API or not. + CanDelete bool `json:"can_delete"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Identifier + Identifier string `json:"identifier"` + // The type of the membership. + Kind AccountAddressAddressMapGetResponseResultMembershipsKind `json:"kind"` + JSON accountAddressAddressMapGetResponseResultMembershipJSON `json:"-"` +} + +// accountAddressAddressMapGetResponseResultMembershipJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapGetResponseResultMembership] +type accountAddressAddressMapGetResponseResultMembershipJSON struct { + CanDelete apijson.Field + CreatedAt apijson.Field + Identifier apijson.Field + Kind apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapGetResponseResultMembership) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the membership. +type AccountAddressAddressMapGetResponseResultMembershipsKind string + +const ( + AccountAddressAddressMapGetResponseResultMembershipsKindZone AccountAddressAddressMapGetResponseResultMembershipsKind = "zone" + AccountAddressAddressMapGetResponseResultMembershipsKindAccount AccountAddressAddressMapGetResponseResultMembershipsKind = "account" +) + +// Whether the API call was successful +type AccountAddressAddressMapGetResponseSuccess bool + +const ( + AccountAddressAddressMapGetResponseSuccessTrue AccountAddressAddressMapGetResponseSuccess = true +) + +type AccountAddressAddressMapUpdateResponse struct { + Errors []AccountAddressAddressMapUpdateResponseError `json:"errors"` + Messages []AccountAddressAddressMapUpdateResponseMessage `json:"messages"` + Result AccountAddressAddressMapUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressAddressMapUpdateResponseSuccess `json:"success"` + JSON accountAddressAddressMapUpdateResponseJSON `json:"-"` +} + +// accountAddressAddressMapUpdateResponseJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapUpdateResponse] +type accountAddressAddressMapUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapUpdateResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapUpdateResponseError] +type accountAddressAddressMapUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapUpdateResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapUpdateResponseMessage] +type accountAddressAddressMapUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapUpdateResponseResult struct { + // 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. + CanDelete bool `json:"can_delete"` + // If set to false, then the IPs on the Address Map cannot be modified via the API. + // This is true for Cloudflare-managed maps. + CanModifyIPs bool `json:"can_modify_ips"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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 + // handshake from a client without an SNI, it will respond with the default SNI on + // those IPs. The default SNI can be any valid zone or subdomain owned by the + // account. + DefaultSni string `json:"default_sni,nullable"` + // An optional description field which may be used to describe the types of IPs or + // zones on the map. + Description string `json:"description,nullable"` + // Whether the Address Map is enabled or not. Cloudflare's DNS will not respond + // with IP addresses on an Address Map until the map is enabled. + Enabled bool `json:"enabled,nullable"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + JSON accountAddressAddressMapUpdateResponseResultJSON `json:"-"` +} + +// accountAddressAddressMapUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapUpdateResponseResult] +type accountAddressAddressMapUpdateResponseResultJSON struct { + ID apijson.Field + CanDelete apijson.Field + CanModifyIPs apijson.Field + CreatedAt apijson.Field + DefaultSni apijson.Field + Description apijson.Field + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapUpdateResponseSuccess bool + +const ( + AccountAddressAddressMapUpdateResponseSuccessTrue AccountAddressAddressMapUpdateResponseSuccess = true +) + +type AccountAddressAddressMapListResponse struct { + Errors []AccountAddressAddressMapListResponseError `json:"errors"` + Messages []AccountAddressAddressMapListResponseMessage `json:"messages"` + Result []AccountAddressAddressMapListResponseResult `json:"result"` + ResultInfo AccountAddressAddressMapListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapListResponseSuccess `json:"success"` + JSON accountAddressAddressMapListResponseJSON `json:"-"` +} + +// accountAddressAddressMapListResponseJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapListResponse] +type accountAddressAddressMapListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapListResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapListResponseErrorJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapListResponseError] +type accountAddressAddressMapListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapListResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapListResponseMessageJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapListResponseMessage] +type accountAddressAddressMapListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapListResponseResult struct { + // 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. + CanDelete bool `json:"can_delete"` + // If set to false, then the IPs on the Address Map cannot be modified via the API. + // This is true for Cloudflare-managed maps. + CanModifyIPs bool `json:"can_modify_ips"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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 + // handshake from a client without an SNI, it will respond with the default SNI on + // those IPs. The default SNI can be any valid zone or subdomain owned by the + // account. + DefaultSni string `json:"default_sni,nullable"` + // An optional description field which may be used to describe the types of IPs or + // zones on the map. + Description string `json:"description,nullable"` + // Whether the Address Map is enabled or not. Cloudflare's DNS will not respond + // with IP addresses on an Address Map until the map is enabled. + Enabled bool `json:"enabled,nullable"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + JSON accountAddressAddressMapListResponseResultJSON `json:"-"` +} + +// accountAddressAddressMapListResponseResultJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapListResponseResult] +type accountAddressAddressMapListResponseResultJSON struct { + ID apijson.Field + CanDelete apijson.Field + CanModifyIPs apijson.Field + CreatedAt apijson.Field + DefaultSni apijson.Field + Description apijson.Field + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapListResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapListResponseResultInfoJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapListResponseResultInfo] +type accountAddressAddressMapListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapListResponseSuccess bool + +const ( + AccountAddressAddressMapListResponseSuccessTrue AccountAddressAddressMapListResponseSuccess = true +) + +type AccountAddressAddressMapDeleteResponse struct { + Errors []AccountAddressAddressMapDeleteResponseError `json:"errors"` + Messages []AccountAddressAddressMapDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressAddressMapDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapDeleteResponseSuccess `json:"success"` + JSON accountAddressAddressMapDeleteResponseJSON `json:"-"` +} + +// accountAddressAddressMapDeleteResponseJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapDeleteResponse] +type accountAddressAddressMapDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapDeleteResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapDeleteResponseError] +type accountAddressAddressMapDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapDeleteResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapDeleteResponseMessage] +type accountAddressAddressMapDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapDeleteResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapDeleteResponseResultInfoJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapDeleteResponseResultInfo] +type accountAddressAddressMapDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapDeleteResponseSuccess bool + +const ( + AccountAddressAddressMapDeleteResponseSuccessTrue AccountAddressAddressMapDeleteResponseSuccess = true +) + +type AccountAddressAddressMapNewParams struct { + // An optional description field which may be used to describe the types of IPs or + // zones on the map. + Description param.Field[string] `json:"description"` + // Whether the Address Map is enabled or not. Cloudflare's DNS will not respond + // with IP addresses on an Address Map until the map is enabled. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountAddressAddressMapNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAddressAddressMapUpdateParams struct { + // 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 + // handshake from a client without an SNI, it will respond with the default SNI on + // those IPs. The default SNI can be any valid zone or subdomain owned by the + // account. + DefaultSni param.Field[string] `json:"default_sni"` + // An optional description field which may be used to describe the types of IPs or + // zones on the map. + Description param.Field[string] `json:"description"` + // Whether the Address Map is enabled or not. Cloudflare's DNS will not respond + // with IP addresses on an Address Map until the map is enabled. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountAddressAddressMapUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaddressaddressmap_test.go b/accountaddressaddressmap_test.go new file mode 100644 index 00000000000..f8ebd6ee0aa --- /dev/null +++ b/accountaddressaddressmap_test.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressAddressMapNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressAddressMapNewParams{ + Description: cloudflare.F("My Ecommerce zones"), + Enabled: cloudflare.F(true), + }, + ) + 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 TestAccountAddressAddressMapGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressAddressMapUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressAddressMapUpdateParams{ + DefaultSni: cloudflare.F("*.example.com"), + Description: cloudflare.F("My Ecommerce zones"), + Enabled: cloudflare.F(true), + }, + ) + 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 TestAccountAddressAddressMapList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.List(context.TODO(), "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()) + } +} + +func TestAccountAddressAddressMapDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountaddressaddressmapaccount.go b/accountaddressaddressmapaccount.go new file mode 100644 index 00000000000..205703f86c7 --- /dev/null +++ b/accountaddressaddressmapaccount.go @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressAddressMapAccountService 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 +// [NewAccountAddressAddressMapAccountService] method instead. +type AccountAddressAddressMapAccountService struct { + Options []option.RequestOption +} + +// NewAccountAddressAddressMapAccountService 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 NewAccountAddressAddressMapAccountService(opts ...option.RequestOption) (r *AccountAddressAddressMapAccountService) { + r = &AccountAddressAddressMapAccountService{} + r.Options = opts + return +} + +// Add an account as a member of a particular address map. +func (r *AccountAddressAddressMapAccountService) Update(ctx context.Context, accountIdentifier1 string, addressMapIdentifier string, accountIdentifier string, opts ...option.RequestOption) (res *AccountAddressAddressMapAccountUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/accounts/%s", accountIdentifier1, addressMapIdentifier, accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +// Remove an account as a member of a particular address map. +func (r *AccountAddressAddressMapAccountService) Delete(ctx context.Context, accountIdentifier1 string, addressMapIdentifier string, accountIdentifier string, opts ...option.RequestOption) (res *AccountAddressAddressMapAccountDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/accounts/%s", accountIdentifier1, addressMapIdentifier, accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AccountAddressAddressMapAccountUpdateResponse struct { + Errors []AccountAddressAddressMapAccountUpdateResponseError `json:"errors"` + Messages []AccountAddressAddressMapAccountUpdateResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressAddressMapAccountUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapAccountUpdateResponseSuccess `json:"success"` + JSON accountAddressAddressMapAccountUpdateResponseJSON `json:"-"` +} + +// accountAddressAddressMapAccountUpdateResponseJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapAccountUpdateResponse] +type accountAddressAddressMapAccountUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapAccountUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapAccountUpdateResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapAccountUpdateResponseErrorJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapAccountUpdateResponseError] +type accountAddressAddressMapAccountUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapAccountUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapAccountUpdateResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapAccountUpdateResponseMessageJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapAccountUpdateResponseMessage] +type accountAddressAddressMapAccountUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapAccountUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapAccountUpdateResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapAccountUpdateResponseResultInfoJSON contains the JSON +// metadata for the struct +// [AccountAddressAddressMapAccountUpdateResponseResultInfo] +type accountAddressAddressMapAccountUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapAccountUpdateResponseSuccess bool + +const ( + AccountAddressAddressMapAccountUpdateResponseSuccessTrue AccountAddressAddressMapAccountUpdateResponseSuccess = true +) + +type AccountAddressAddressMapAccountDeleteResponse struct { + Errors []AccountAddressAddressMapAccountDeleteResponseError `json:"errors"` + Messages []AccountAddressAddressMapAccountDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressAddressMapAccountDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapAccountDeleteResponseSuccess `json:"success"` + JSON accountAddressAddressMapAccountDeleteResponseJSON `json:"-"` +} + +// accountAddressAddressMapAccountDeleteResponseJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapAccountDeleteResponse] +type accountAddressAddressMapAccountDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapAccountDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapAccountDeleteResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapAccountDeleteResponseErrorJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapAccountDeleteResponseError] +type accountAddressAddressMapAccountDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapAccountDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapAccountDeleteResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapAccountDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapAccountDeleteResponseMessage] +type accountAddressAddressMapAccountDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapAccountDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapAccountDeleteResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapAccountDeleteResponseResultInfoJSON contains the JSON +// metadata for the struct +// [AccountAddressAddressMapAccountDeleteResponseResultInfo] +type accountAddressAddressMapAccountDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapAccountDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapAccountDeleteResponseSuccess bool + +const ( + AccountAddressAddressMapAccountDeleteResponseSuccessTrue AccountAddressAddressMapAccountDeleteResponseSuccess = true +) diff --git a/accountaddressaddressmapaccount_test.go b/accountaddressaddressmapaccount_test.go new file mode 100644 index 00000000000..ac5c4a44f2e --- /dev/null +++ b/accountaddressaddressmapaccount_test.go @@ -0,0 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressAddressMapAccountUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.Accounts.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressAddressMapAccountDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.Accounts.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountaddressaddressmapip.go b/accountaddressaddressmapip.go new file mode 100644 index 00000000000..ee1774daf3f --- /dev/null +++ b/accountaddressaddressmapip.go @@ -0,0 +1,243 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressAddressMapIPService 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 +// [NewAccountAddressAddressMapIPService] method instead. +type AccountAddressAddressMapIPService struct { + Options []option.RequestOption +} + +// NewAccountAddressAddressMapIPService 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 NewAccountAddressAddressMapIPService(opts ...option.RequestOption) (r *AccountAddressAddressMapIPService) { + r = &AccountAddressAddressMapIPService{} + r.Options = opts + return +} + +// Add an IP from a prefix owned by the account to a particular address map. +func (r *AccountAddressAddressMapIPService) Update(ctx context.Context, accountIdentifier string, addressMapIdentifier string, ipAddress string, opts ...option.RequestOption) (res *AccountAddressAddressMapIPUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/ips/%s", accountIdentifier, addressMapIdentifier, ipAddress) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +// Remove an IP from a particular address map. +func (r *AccountAddressAddressMapIPService) Delete(ctx context.Context, accountIdentifier string, addressMapIdentifier string, ipAddress string, opts ...option.RequestOption) (res *AccountAddressAddressMapIPDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/ips/%s", accountIdentifier, addressMapIdentifier, ipAddress) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AccountAddressAddressMapIPUpdateResponse struct { + Errors []AccountAddressAddressMapIPUpdateResponseError `json:"errors"` + Messages []AccountAddressAddressMapIPUpdateResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressAddressMapIPUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapIPUpdateResponseSuccess `json:"success"` + JSON accountAddressAddressMapIPUpdateResponseJSON `json:"-"` +} + +// accountAddressAddressMapIPUpdateResponseJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapIPUpdateResponse] +type accountAddressAddressMapIPUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapIPUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapIPUpdateResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapIPUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapIPUpdateResponseError] +type accountAddressAddressMapIPUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapIPUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapIPUpdateResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapIPUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapIPUpdateResponseMessage] +type accountAddressAddressMapIPUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapIPUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapIPUpdateResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapIPUpdateResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapIPUpdateResponseResultInfo] +type accountAddressAddressMapIPUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapIPUpdateResponseSuccess bool + +const ( + AccountAddressAddressMapIPUpdateResponseSuccessTrue AccountAddressAddressMapIPUpdateResponseSuccess = true +) + +type AccountAddressAddressMapIPDeleteResponse struct { + Errors []AccountAddressAddressMapIPDeleteResponseError `json:"errors"` + Messages []AccountAddressAddressMapIPDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressAddressMapIPDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapIPDeleteResponseSuccess `json:"success"` + JSON accountAddressAddressMapIPDeleteResponseJSON `json:"-"` +} + +// accountAddressAddressMapIPDeleteResponseJSON contains the JSON metadata for the +// struct [AccountAddressAddressMapIPDeleteResponse] +type accountAddressAddressMapIPDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapIPDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapIPDeleteResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapIPDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapIPDeleteResponseError] +type accountAddressAddressMapIPDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapIPDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapIPDeleteResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapIPDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapIPDeleteResponseMessage] +type accountAddressAddressMapIPDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapIPDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapIPDeleteResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapIPDeleteResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapIPDeleteResponseResultInfo] +type accountAddressAddressMapIPDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapIPDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapIPDeleteResponseSuccess bool + +const ( + AccountAddressAddressMapIPDeleteResponseSuccessTrue AccountAddressAddressMapIPDeleteResponseSuccess = true +) diff --git a/accountaddressaddressmapip_test.go b/accountaddressaddressmapip_test.go new file mode 100644 index 00000000000..3f430553b1a --- /dev/null +++ b/accountaddressaddressmapip_test.go @@ -0,0 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressAddressMapIPUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.IPs.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "192.0.2.1", + ) + 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 TestAccountAddressAddressMapIPDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.IPs.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "192.0.2.1", + ) + 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/accountaddressaddressmapzone.go b/accountaddressaddressmapzone.go new file mode 100644 index 00000000000..926e7417726 --- /dev/null +++ b/accountaddressaddressmapzone.go @@ -0,0 +1,243 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressAddressMapZoneService 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 +// [NewAccountAddressAddressMapZoneService] method instead. +type AccountAddressAddressMapZoneService struct { + Options []option.RequestOption +} + +// NewAccountAddressAddressMapZoneService 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 NewAccountAddressAddressMapZoneService(opts ...option.RequestOption) (r *AccountAddressAddressMapZoneService) { + r = &AccountAddressAddressMapZoneService{} + r.Options = opts + return +} + +// Add a zone as a member of a particular address map. +func (r *AccountAddressAddressMapZoneService) Update(ctx context.Context, accountIdentifier string, addressMapIdentifier string, zoneIdentifier string, opts ...option.RequestOption) (res *AccountAddressAddressMapZoneUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/zones/%s", accountIdentifier, addressMapIdentifier, zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +// Remove a zone as a member of a particular address map. +func (r *AccountAddressAddressMapZoneService) Delete(ctx context.Context, accountIdentifier string, addressMapIdentifier string, zoneIdentifier string, opts ...option.RequestOption) (res *AccountAddressAddressMapZoneDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/zones/%s", accountIdentifier, addressMapIdentifier, zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AccountAddressAddressMapZoneUpdateResponse struct { + Errors []AccountAddressAddressMapZoneUpdateResponseError `json:"errors"` + Messages []AccountAddressAddressMapZoneUpdateResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressAddressMapZoneUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapZoneUpdateResponseSuccess `json:"success"` + JSON accountAddressAddressMapZoneUpdateResponseJSON `json:"-"` +} + +// accountAddressAddressMapZoneUpdateResponseJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapZoneUpdateResponse] +type accountAddressAddressMapZoneUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapZoneUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapZoneUpdateResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapZoneUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapZoneUpdateResponseError] +type accountAddressAddressMapZoneUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapZoneUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapZoneUpdateResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapZoneUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapZoneUpdateResponseMessage] +type accountAddressAddressMapZoneUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapZoneUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapZoneUpdateResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapZoneUpdateResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapZoneUpdateResponseResultInfo] +type accountAddressAddressMapZoneUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapZoneUpdateResponseSuccess bool + +const ( + AccountAddressAddressMapZoneUpdateResponseSuccessTrue AccountAddressAddressMapZoneUpdateResponseSuccess = true +) + +type AccountAddressAddressMapZoneDeleteResponse struct { + Errors []AccountAddressAddressMapZoneDeleteResponseError `json:"errors"` + Messages []AccountAddressAddressMapZoneDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressAddressMapZoneDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressAddressMapZoneDeleteResponseSuccess `json:"success"` + JSON accountAddressAddressMapZoneDeleteResponseJSON `json:"-"` +} + +// accountAddressAddressMapZoneDeleteResponseJSON contains the JSON metadata for +// the struct [AccountAddressAddressMapZoneDeleteResponse] +type accountAddressAddressMapZoneDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapZoneDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapZoneDeleteResponseErrorJSON `json:"-"` +} + +// accountAddressAddressMapZoneDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapZoneDeleteResponseError] +type accountAddressAddressMapZoneDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapZoneDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressAddressMapZoneDeleteResponseMessageJSON `json:"-"` +} + +// accountAddressAddressMapZoneDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountAddressAddressMapZoneDeleteResponseMessage] +type accountAddressAddressMapZoneDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressAddressMapZoneDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressAddressMapZoneDeleteResponseResultInfoJSON `json:"-"` +} + +// accountAddressAddressMapZoneDeleteResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountAddressAddressMapZoneDeleteResponseResultInfo] +type accountAddressAddressMapZoneDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressAddressMapZoneDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressAddressMapZoneDeleteResponseSuccess bool + +const ( + AccountAddressAddressMapZoneDeleteResponseSuccessTrue AccountAddressAddressMapZoneDeleteResponseSuccess = true +) diff --git a/accountaddressaddressmapzone_test.go b/accountaddressaddressmapzone_test.go new file mode 100644 index 00000000000..2f2ff628a58 --- /dev/null +++ b/accountaddressaddressmapzone_test.go @@ -0,0 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressAddressMapZoneUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.Zones.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressAddressMapZoneDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.AddressMaps.Zones.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountaddressing.go b/accountaddressing.go new file mode 100644 index 00000000000..175b10aca02 --- /dev/null +++ b/accountaddressing.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressingService 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 [NewAccountAddressingService] method +// instead. +type AccountAddressingService struct { + Options []option.RequestOption + Prefixes *AccountAddressingPrefixService + Services *AccountAddressingServiceService +} + +// NewAccountAddressingService 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 NewAccountAddressingService(opts ...option.RequestOption) (r *AccountAddressingService) { + r = &AccountAddressingService{} + r.Options = opts + r.Prefixes = NewAccountAddressingPrefixService(opts...) + r.Services = NewAccountAddressingServiceService(opts...) + return +} diff --git a/accountaddressingprefix.go b/accountaddressingprefix.go new file mode 100644 index 00000000000..d0e482971f7 --- /dev/null +++ b/accountaddressingprefix.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressingPrefixService 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 +// [NewAccountAddressingPrefixService] method instead. +type AccountAddressingPrefixService struct { + Options []option.RequestOption + Bindings *AccountAddressingPrefixBindingService +} + +// NewAccountAddressingPrefixService 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 NewAccountAddressingPrefixService(opts ...option.RequestOption) (r *AccountAddressingPrefixService) { + r = &AccountAddressingPrefixService{} + r.Options = opts + r.Bindings = NewAccountAddressingPrefixBindingService(opts...) + return +} diff --git a/accountaddressingprefixbinding.go b/accountaddressingprefixbinding.go new file mode 100644 index 00000000000..ed189190842 --- /dev/null +++ b/accountaddressingprefixbinding.go @@ -0,0 +1,566 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountAddressingPrefixBindingService 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 +// [NewAccountAddressingPrefixBindingService] method instead. +type AccountAddressingPrefixBindingService struct { + Options []option.RequestOption +} + +// NewAccountAddressingPrefixBindingService 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 NewAccountAddressingPrefixBindingService(opts ...option.RequestOption) (r *AccountAddressingPrefixBindingService) { + r = &AccountAddressingPrefixBindingService{} + r.Options = opts + return +} + +// Creates a new Service Binding, routing traffic to IPs within the given CIDR to a +// service running on Cloudflare's network. **Note:** This API may only be used on +// prefixes currently configured with a Magic Transit service binding, and only +// allows creating service bindings for the Cloudflare CDN or Cloudflare Spectrum. +func (r *AccountAddressingPrefixBindingService) New(ctx context.Context, accountIdentifier string, prefixIdentifier string, body AccountAddressingPrefixBindingNewParams, opts ...option.RequestOption) (res *AccountAddressingPrefixBindingNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetch a single Service Binding +func (r *AccountAddressingPrefixBindingService) Get(ctx context.Context, accountIdentifier string, prefixIdentifier string, bindingIdentifier string, opts ...option.RequestOption) (res *AccountAddressingPrefixBindingGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings/%s", accountIdentifier, prefixIdentifier, bindingIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// List the Cloudflare services this prefix is currently bound to. Traffic sent to +// an address within an IP prefix will be routed to the Cloudflare service of the +// most-specific Service Binding matching the address. **Example:** binding +// `192.0.2.0/24` to Cloudflare Magic Transit and `192.0.2.1/32` to the Cloudflare +// CDN would route traffic for `192.0.2.1` to the CDN, and traffic for all other +// IPs in the prefix to Cloudflare Magic Transit. +func (r *AccountAddressingPrefixBindingService) List(ctx context.Context, accountIdentifier string, prefixIdentifier string, opts ...option.RequestOption) (res *AccountAddressingPrefixBindingListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a Service Binding +func (r *AccountAddressingPrefixBindingService) Delete(ctx context.Context, accountIdentifier string, prefixIdentifier string, bindingIdentifier string, opts ...option.RequestOption) (res *AccountAddressingPrefixBindingDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings/%s", accountIdentifier, prefixIdentifier, bindingIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AccountAddressingPrefixBindingNewResponse struct { + Errors []AccountAddressingPrefixBindingNewResponseError `json:"errors"` + Messages []AccountAddressingPrefixBindingNewResponseMessage `json:"messages"` + Result AccountAddressingPrefixBindingNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressingPrefixBindingNewResponseSuccess `json:"success"` + JSON accountAddressingPrefixBindingNewResponseJSON `json:"-"` +} + +// accountAddressingPrefixBindingNewResponseJSON contains the JSON metadata for the +// struct [AccountAddressingPrefixBindingNewResponse] +type accountAddressingPrefixBindingNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingNewResponseErrorJSON `json:"-"` +} + +// accountAddressingPrefixBindingNewResponseErrorJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingNewResponseError] +type accountAddressingPrefixBindingNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingNewResponseMessageJSON `json:"-"` +} + +// accountAddressingPrefixBindingNewResponseMessageJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingNewResponseMessage] +type accountAddressingPrefixBindingNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingNewResponseResult struct { + // 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 AccountAddressingPrefixBindingNewResponseResultProvisioning `json:"provisioning"` + // Identifier + ServiceID string `json:"service_id"` + // Name of a service running on the Cloudflare network + ServiceName string `json:"service_name"` + JSON accountAddressingPrefixBindingNewResponseResultJSON `json:"-"` +} + +// accountAddressingPrefixBindingNewResponseResultJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingNewResponseResult] +type accountAddressingPrefixBindingNewResponseResultJSON struct { + ID apijson.Field + Cidr apijson.Field + Provisioning apijson.Field + ServiceID apijson.Field + ServiceName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of a Service Binding's deployment to the Cloudflare network +type AccountAddressingPrefixBindingNewResponseResultProvisioning 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 AccountAddressingPrefixBindingNewResponseResultProvisioningState `json:"state"` + JSON accountAddressingPrefixBindingNewResponseResultProvisioningJSON `json:"-"` +} + +// accountAddressingPrefixBindingNewResponseResultProvisioningJSON contains the +// JSON metadata for the struct +// [AccountAddressingPrefixBindingNewResponseResultProvisioning] +type accountAddressingPrefixBindingNewResponseResultProvisioningJSON struct { + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingNewResponseResultProvisioning) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// 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. +type AccountAddressingPrefixBindingNewResponseResultProvisioningState string + +const ( + AccountAddressingPrefixBindingNewResponseResultProvisioningStateProvisioning AccountAddressingPrefixBindingNewResponseResultProvisioningState = "provisioning" + AccountAddressingPrefixBindingNewResponseResultProvisioningStateActive AccountAddressingPrefixBindingNewResponseResultProvisioningState = "active" +) + +// Whether the API call was successful +type AccountAddressingPrefixBindingNewResponseSuccess bool + +const ( + AccountAddressingPrefixBindingNewResponseSuccessTrue AccountAddressingPrefixBindingNewResponseSuccess = true +) + +type AccountAddressingPrefixBindingGetResponse struct { + Errors []AccountAddressingPrefixBindingGetResponseError `json:"errors"` + Messages []AccountAddressingPrefixBindingGetResponseMessage `json:"messages"` + Result AccountAddressingPrefixBindingGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressingPrefixBindingGetResponseSuccess `json:"success"` + JSON accountAddressingPrefixBindingGetResponseJSON `json:"-"` +} + +// accountAddressingPrefixBindingGetResponseJSON contains the JSON metadata for the +// struct [AccountAddressingPrefixBindingGetResponse] +type accountAddressingPrefixBindingGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingGetResponseErrorJSON `json:"-"` +} + +// accountAddressingPrefixBindingGetResponseErrorJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingGetResponseError] +type accountAddressingPrefixBindingGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingGetResponseMessageJSON `json:"-"` +} + +// accountAddressingPrefixBindingGetResponseMessageJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingGetResponseMessage] +type accountAddressingPrefixBindingGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingGetResponseResult struct { + // 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 AccountAddressingPrefixBindingGetResponseResultProvisioning `json:"provisioning"` + // Identifier + ServiceID string `json:"service_id"` + // Name of a service running on the Cloudflare network + ServiceName string `json:"service_name"` + JSON accountAddressingPrefixBindingGetResponseResultJSON `json:"-"` +} + +// accountAddressingPrefixBindingGetResponseResultJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingGetResponseResult] +type accountAddressingPrefixBindingGetResponseResultJSON struct { + ID apijson.Field + Cidr apijson.Field + Provisioning apijson.Field + ServiceID apijson.Field + ServiceName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of a Service Binding's deployment to the Cloudflare network +type AccountAddressingPrefixBindingGetResponseResultProvisioning 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 AccountAddressingPrefixBindingGetResponseResultProvisioningState `json:"state"` + JSON accountAddressingPrefixBindingGetResponseResultProvisioningJSON `json:"-"` +} + +// accountAddressingPrefixBindingGetResponseResultProvisioningJSON contains the +// JSON metadata for the struct +// [AccountAddressingPrefixBindingGetResponseResultProvisioning] +type accountAddressingPrefixBindingGetResponseResultProvisioningJSON struct { + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingGetResponseResultProvisioning) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// 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. +type AccountAddressingPrefixBindingGetResponseResultProvisioningState string + +const ( + AccountAddressingPrefixBindingGetResponseResultProvisioningStateProvisioning AccountAddressingPrefixBindingGetResponseResultProvisioningState = "provisioning" + AccountAddressingPrefixBindingGetResponseResultProvisioningStateActive AccountAddressingPrefixBindingGetResponseResultProvisioningState = "active" +) + +// Whether the API call was successful +type AccountAddressingPrefixBindingGetResponseSuccess bool + +const ( + AccountAddressingPrefixBindingGetResponseSuccessTrue AccountAddressingPrefixBindingGetResponseSuccess = true +) + +type AccountAddressingPrefixBindingListResponse struct { + Errors []AccountAddressingPrefixBindingListResponseError `json:"errors"` + Messages []AccountAddressingPrefixBindingListResponseMessage `json:"messages"` + Result []AccountAddressingPrefixBindingListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressingPrefixBindingListResponseSuccess `json:"success"` + JSON accountAddressingPrefixBindingListResponseJSON `json:"-"` +} + +// accountAddressingPrefixBindingListResponseJSON contains the JSON metadata for +// the struct [AccountAddressingPrefixBindingListResponse] +type accountAddressingPrefixBindingListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingListResponseErrorJSON `json:"-"` +} + +// accountAddressingPrefixBindingListResponseErrorJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingListResponseError] +type accountAddressingPrefixBindingListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingListResponseMessageJSON `json:"-"` +} + +// accountAddressingPrefixBindingListResponseMessageJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingListResponseMessage] +type accountAddressingPrefixBindingListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingListResponseResult struct { + // 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 AccountAddressingPrefixBindingListResponseResultProvisioning `json:"provisioning"` + // Identifier + ServiceID string `json:"service_id"` + // Name of a service running on the Cloudflare network + ServiceName string `json:"service_name"` + JSON accountAddressingPrefixBindingListResponseResultJSON `json:"-"` +} + +// accountAddressingPrefixBindingListResponseResultJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingListResponseResult] +type accountAddressingPrefixBindingListResponseResultJSON struct { + ID apijson.Field + Cidr apijson.Field + Provisioning apijson.Field + ServiceID apijson.Field + ServiceName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of a Service Binding's deployment to the Cloudflare network +type AccountAddressingPrefixBindingListResponseResultProvisioning 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 AccountAddressingPrefixBindingListResponseResultProvisioningState `json:"state"` + JSON accountAddressingPrefixBindingListResponseResultProvisioningJSON `json:"-"` +} + +// accountAddressingPrefixBindingListResponseResultProvisioningJSON contains the +// JSON metadata for the struct +// [AccountAddressingPrefixBindingListResponseResultProvisioning] +type accountAddressingPrefixBindingListResponseResultProvisioningJSON struct { + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingListResponseResultProvisioning) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// 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. +type AccountAddressingPrefixBindingListResponseResultProvisioningState string + +const ( + AccountAddressingPrefixBindingListResponseResultProvisioningStateProvisioning AccountAddressingPrefixBindingListResponseResultProvisioningState = "provisioning" + AccountAddressingPrefixBindingListResponseResultProvisioningStateActive AccountAddressingPrefixBindingListResponseResultProvisioningState = "active" +) + +// Whether the API call was successful +type AccountAddressingPrefixBindingListResponseSuccess bool + +const ( + AccountAddressingPrefixBindingListResponseSuccessTrue AccountAddressingPrefixBindingListResponseSuccess = true +) + +type AccountAddressingPrefixBindingDeleteResponse struct { + Errors []AccountAddressingPrefixBindingDeleteResponseError `json:"errors,required"` + Messages []AccountAddressingPrefixBindingDeleteResponseMessage `json:"messages,required"` + Result AccountAddressingPrefixBindingDeleteResponseResult `json:"result,required"` + // Whether the API call was successful + Success AccountAddressingPrefixBindingDeleteResponseSuccess `json:"success,required"` + JSON accountAddressingPrefixBindingDeleteResponseJSON `json:"-"` +} + +// accountAddressingPrefixBindingDeleteResponseJSON contains the JSON metadata for +// the struct [AccountAddressingPrefixBindingDeleteResponse] +type accountAddressingPrefixBindingDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingDeleteResponseErrorJSON `json:"-"` +} + +// accountAddressingPrefixBindingDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountAddressingPrefixBindingDeleteResponseError] +type accountAddressingPrefixBindingDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingPrefixBindingDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingPrefixBindingDeleteResponseMessageJSON `json:"-"` +} + +// accountAddressingPrefixBindingDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountAddressingPrefixBindingDeleteResponseMessage] +type accountAddressingPrefixBindingDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingPrefixBindingDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountAddressingPrefixBindingDeleteResponseResultUnknown], +// [AccountAddressingPrefixBindingDeleteResponseResultArray] or +// [shared.UnionString]. +type AccountAddressingPrefixBindingDeleteResponseResult interface { + ImplementsAccountAddressingPrefixBindingDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountAddressingPrefixBindingDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AccountAddressingPrefixBindingDeleteResponseResultArray []interface{} + +func (r AccountAddressingPrefixBindingDeleteResponseResultArray) ImplementsAccountAddressingPrefixBindingDeleteResponseResult() { +} + +// Whether the API call was successful +type AccountAddressingPrefixBindingDeleteResponseSuccess bool + +const ( + AccountAddressingPrefixBindingDeleteResponseSuccessTrue AccountAddressingPrefixBindingDeleteResponseSuccess = true +) + +type AccountAddressingPrefixBindingNewParams struct { + // IP Prefix in Classless Inter-Domain Routing format. + Cidr param.Field[string] `json:"cidr"` + // Identifier + ServiceID param.Field[string] `json:"service_id"` +} + +func (r AccountAddressingPrefixBindingNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaddressingprefixbinding_test.go b/accountaddressingprefixbinding_test.go new file mode 100644 index 00000000000..74deb3f7a22 --- /dev/null +++ b/accountaddressingprefixbinding_test.go @@ -0,0 +1,140 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressingPrefixBindingNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addressing.Prefixes.Bindings.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressingPrefixBindingNewParams{ + Cidr: cloudflare.F("192.0.2.0/24"), + ServiceID: cloudflare.F("2db684ee7ca04e159946fd05b99e1bcd"), + }, + ) + 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 TestAccountAddressingPrefixBindingGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addressing.Prefixes.Bindings.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressingPrefixBindingList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addressing.Prefixes.Bindings.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressingPrefixBindingDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addressing.Prefixes.Bindings.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountaddressingservice.go b/accountaddressingservice.go new file mode 100644 index 00000000000..a8551aacbb3 --- /dev/null +++ b/accountaddressingservice.go @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressingServiceService 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 +// [NewAccountAddressingServiceService] method instead. +type AccountAddressingServiceService struct { + Options []option.RequestOption +} + +// NewAccountAddressingServiceService 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 NewAccountAddressingServiceService(opts ...option.RequestOption) (r *AccountAddressingServiceService) { + r = &AccountAddressingServiceService{} + r.Options = opts + return +} + +// Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a +// service running on the Cloudflare network to enable a Cloudflare product on the +// IP addresses. This endpoint can be used as a reference of available services on +// the Cloudflare network, and their service IDs. +func (r *AccountAddressingServiceService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountAddressingServiceListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/services", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAddressingServiceListResponse struct { + Errors []AccountAddressingServiceListResponseError `json:"errors"` + Messages []AccountAddressingServiceListResponseMessage `json:"messages"` + Result []AccountAddressingServiceListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressingServiceListResponseSuccess `json:"success"` + JSON accountAddressingServiceListResponseJSON `json:"-"` +} + +// accountAddressingServiceListResponseJSON contains the JSON metadata for the +// struct [AccountAddressingServiceListResponse] +type accountAddressingServiceListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingServiceListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingServiceListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingServiceListResponseErrorJSON `json:"-"` +} + +// accountAddressingServiceListResponseErrorJSON contains the JSON metadata for the +// struct [AccountAddressingServiceListResponseError] +type accountAddressingServiceListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingServiceListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingServiceListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressingServiceListResponseMessageJSON `json:"-"` +} + +// accountAddressingServiceListResponseMessageJSON contains the JSON metadata for +// the struct [AccountAddressingServiceListResponseMessage] +type accountAddressingServiceListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingServiceListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressingServiceListResponseResult struct { + // Identifier + ID string `json:"id"` + // Name of a service running on the Cloudflare network + Name string `json:"name"` + JSON accountAddressingServiceListResponseResultJSON `json:"-"` +} + +// accountAddressingServiceListResponseResultJSON contains the JSON metadata for +// the struct [AccountAddressingServiceListResponseResult] +type accountAddressingServiceListResponseResultJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressingServiceListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressingServiceListResponseSuccess bool + +const ( + AccountAddressingServiceListResponseSuccessTrue AccountAddressingServiceListResponseSuccess = true +) diff --git a/accountaddressingservice_test.go b/accountaddressingservice_test.go new file mode 100644 index 00000000000..1a23a8213ef --- /dev/null +++ b/accountaddressingservice_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressingServiceList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addressing.Services.List(context.TODO(), "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/accountaddressloadocument.go b/accountaddressloadocument.go new file mode 100644 index 00000000000..4f59851d9c8 --- /dev/null +++ b/accountaddressloadocument.go @@ -0,0 +1,142 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressLoaDocumentService 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 +// [NewAccountAddressLoaDocumentService] method instead. +type AccountAddressLoaDocumentService struct { + Options []option.RequestOption + Downloads *AccountAddressLoaDocumentDownloadService +} + +// NewAccountAddressLoaDocumentService 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 NewAccountAddressLoaDocumentService(opts ...option.RequestOption) (r *AccountAddressLoaDocumentService) { + r = &AccountAddressLoaDocumentService{} + r.Options = opts + r.Downloads = NewAccountAddressLoaDocumentDownloadService(opts...) + return +} + +// Submit LOA document (pdf format) under the account. +func (r *AccountAddressLoaDocumentService) IPAddressManagementPrefixesUploadLoaDocument(ctx context.Context, accountIdentifier string, body AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentParams, opts ...option.RequestOption) (res *AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/loa_documents", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponse struct { + Errors []AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseError `json:"errors"` + Messages []AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseMessage `json:"messages"` + Result AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseSuccess `json:"success"` + JSON accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseJSON `json:"-"` +} + +// accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseJSON +// contains the JSON metadata for the struct +// [AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponse] +type accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseErrorJSON `json:"-"` +} + +// accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseError] +type accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseMessageJSON `json:"-"` +} + +// accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseMessage] +type accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseResult struct { + // Name of LOA document. + Filename string `json:"filename"` + JSON accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseResultJSON `json:"-"` +} + +// accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseResult] +type accountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseResultJSON struct { + Filename apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseSuccess bool + +const ( + AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseSuccessTrue AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponseSuccess = true +) + +type AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentParams struct { + // LOA document to upload. + LoaDocument param.Field[string] `json:"loa_document,required"` +} + +func (r AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaddressloadocument_test.go b/accountaddressloadocument_test.go new file mode 100644 index 00000000000..86fabe6b58f --- /dev/null +++ b/accountaddressloadocument_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocument(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.LoaDocuments.IPAddressManagementPrefixesUploadLoaDocument( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentParams{ + LoaDocument: cloudflare.F("@document.pdf"), + }, + ) + 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/accountaddressloadocumentdownload.go b/accountaddressloadocumentdownload.go new file mode 100644 index 00000000000..e96a9ce856c --- /dev/null +++ b/accountaddressloadocumentdownload.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressLoaDocumentDownloadService 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 +// [NewAccountAddressLoaDocumentDownloadService] method instead. +type AccountAddressLoaDocumentDownloadService struct { + Options []option.RequestOption +} + +// NewAccountAddressLoaDocumentDownloadService 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 NewAccountAddressLoaDocumentDownloadService(opts ...option.RequestOption) (r *AccountAddressLoaDocumentDownloadService) { + r = &AccountAddressLoaDocumentDownloadService{} + r.Options = opts + return +} + +// Download specified LOA document under the account. +func (r *AccountAddressLoaDocumentDownloadService) List(ctx context.Context, accountIdentifier string, loaDocumentIdentifier string, opts ...option.RequestOption) (res *AccountAddressLoaDocumentDownloadListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/loa_documents/%s/download", accountIdentifier, loaDocumentIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAddressLoaDocumentDownloadListResponse = interface{} diff --git a/accountaddressloadocumentdownload_test.go b/accountaddressloadocumentdownload_test.go new file mode 100644 index 00000000000..65648eeb610 --- /dev/null +++ b/accountaddressloadocumentdownload_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressLoaDocumentDownloadList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.LoaDocuments.Downloads.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "d933b1530bc56c9953cf8ce166da8004", + ) + 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/accountaddressprefix.go b/accountaddressprefix.go new file mode 100644 index 00000000000..88f5e70dc46 --- /dev/null +++ b/accountaddressprefix.go @@ -0,0 +1,735 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressPrefixService 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 [NewAccountAddressPrefixService] +// method instead. +type AccountAddressPrefixService struct { + Options []option.RequestOption + Bgps *AccountAddressPrefixBgpService + Delegations *AccountAddressPrefixDelegationService +} + +// NewAccountAddressPrefixService 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 NewAccountAddressPrefixService(opts ...option.RequestOption) (r *AccountAddressPrefixService) { + r = &AccountAddressPrefixService{} + r.Options = opts + r.Bgps = NewAccountAddressPrefixBgpService(opts...) + r.Delegations = NewAccountAddressPrefixDelegationService(opts...) + return +} + +// List a particular prefix owned by the account. +func (r *AccountAddressPrefixService) Get(ctx context.Context, accountIdentifier string, prefixIdentifier string, opts ...option.RequestOption) (res *AccountAddressPrefixGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify the description for a prefix owned by the account. +func (r *AccountAddressPrefixService) Update(ctx context.Context, accountIdentifier string, prefixIdentifier string, body AccountAddressPrefixUpdateParams, opts ...option.RequestOption) (res *AccountAddressPrefixUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete an unapproved prefix owned by the account. +func (r *AccountAddressPrefixService) Delete(ctx context.Context, accountIdentifier string, prefixIdentifier string, opts ...option.RequestOption) (res *AccountAddressPrefixDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Add a new prefix under the account. +func (r *AccountAddressPrefixService) IPAddressManagementPrefixesAddPrefix(ctx context.Context, accountIdentifier string, body AccountAddressPrefixIPAddressManagementPrefixesAddPrefixParams, opts ...option.RequestOption) (res *AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all prefixes owned by the account. +func (r *AccountAddressPrefixService) IPAddressManagementPrefixesListPrefixes(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAddressPrefixGetResponse struct { + Errors []AccountAddressPrefixGetResponseError `json:"errors"` + Messages []AccountAddressPrefixGetResponseMessage `json:"messages"` + Result AccountAddressPrefixGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressPrefixGetResponseSuccess `json:"success"` + JSON accountAddressPrefixGetResponseJSON `json:"-"` +} + +// accountAddressPrefixGetResponseJSON contains the JSON metadata for the struct +// [AccountAddressPrefixGetResponse] +type accountAddressPrefixGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixGetResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountAddressPrefixGetResponseError] +type accountAddressPrefixGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixGetResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountAddressPrefixGetResponseMessage] +type accountAddressPrefixGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixGetResponseResult struct { + // Identifier + ID string `json:"id"` + // Identifier + AccountID string `json:"account_id"` + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Approval state of the prefix (P = pending, V = active). + Approved string `json:"approved"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Description of the prefix. + Description string `json:"description"` + // Identifier for the uploaded LOA document. + LoaDocumentID string `json:"loa_document_id,nullable"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON accountAddressPrefixGetResponseResultJSON `json:"-"` +} + +// accountAddressPrefixGetResponseResultJSON contains the JSON metadata for the +// struct [AccountAddressPrefixGetResponseResult] +type accountAddressPrefixGetResponseResultJSON struct { + ID apijson.Field + AccountID apijson.Field + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + Approved apijson.Field + ASN apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + Description apijson.Field + LoaDocumentID apijson.Field + ModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixGetResponseSuccess bool + +const ( + AccountAddressPrefixGetResponseSuccessTrue AccountAddressPrefixGetResponseSuccess = true +) + +type AccountAddressPrefixUpdateResponse struct { + Errors []AccountAddressPrefixUpdateResponseError `json:"errors"` + Messages []AccountAddressPrefixUpdateResponseMessage `json:"messages"` + Result AccountAddressPrefixUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressPrefixUpdateResponseSuccess `json:"success"` + JSON accountAddressPrefixUpdateResponseJSON `json:"-"` +} + +// accountAddressPrefixUpdateResponseJSON contains the JSON metadata for the struct +// [AccountAddressPrefixUpdateResponse] +type accountAddressPrefixUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixUpdateResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountAddressPrefixUpdateResponseError] +type accountAddressPrefixUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixUpdateResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountAddressPrefixUpdateResponseMessage] +type accountAddressPrefixUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixUpdateResponseResult struct { + // Identifier + ID string `json:"id"` + // Identifier + AccountID string `json:"account_id"` + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Approval state of the prefix (P = pending, V = active). + Approved string `json:"approved"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Description of the prefix. + Description string `json:"description"` + // Identifier for the uploaded LOA document. + LoaDocumentID string `json:"loa_document_id,nullable"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON accountAddressPrefixUpdateResponseResultJSON `json:"-"` +} + +// accountAddressPrefixUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountAddressPrefixUpdateResponseResult] +type accountAddressPrefixUpdateResponseResultJSON struct { + ID apijson.Field + AccountID apijson.Field + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + Approved apijson.Field + ASN apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + Description apijson.Field + LoaDocumentID apijson.Field + ModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixUpdateResponseSuccess bool + +const ( + AccountAddressPrefixUpdateResponseSuccessTrue AccountAddressPrefixUpdateResponseSuccess = true +) + +type AccountAddressPrefixDeleteResponse struct { + Errors []AccountAddressPrefixDeleteResponseError `json:"errors"` + Messages []AccountAddressPrefixDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAddressPrefixDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressPrefixDeleteResponseSuccess `json:"success"` + JSON accountAddressPrefixDeleteResponseJSON `json:"-"` +} + +// accountAddressPrefixDeleteResponseJSON contains the JSON metadata for the struct +// [AccountAddressPrefixDeleteResponse] +type accountAddressPrefixDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDeleteResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountAddressPrefixDeleteResponseError] +type accountAddressPrefixDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDeleteResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountAddressPrefixDeleteResponseMessage] +type accountAddressPrefixDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressPrefixDeleteResponseResultInfoJSON `json:"-"` +} + +// accountAddressPrefixDeleteResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountAddressPrefixDeleteResponseResultInfo] +type accountAddressPrefixDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixDeleteResponseSuccess bool + +const ( + AccountAddressPrefixDeleteResponseSuccessTrue AccountAddressPrefixDeleteResponseSuccess = true +) + +type AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponse struct { + Errors []AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseError `json:"errors"` + Messages []AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseMessage `json:"messages"` + Result AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseSuccess `json:"success"` + JSON accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseJSON contains +// the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponse] +type accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseError] +type accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseMessage] +type accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseResult struct { + // Identifier + ID string `json:"id"` + // Identifier + AccountID string `json:"account_id"` + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Approval state of the prefix (P = pending, V = active). + Approved string `json:"approved"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Description of the prefix. + Description string `json:"description"` + // Identifier for the uploaded LOA document. + LoaDocumentID string `json:"loa_document_id,nullable"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseResultJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseResult] +type accountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseResultJSON struct { + ID apijson.Field + AccountID apijson.Field + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + Approved apijson.Field + ASN apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + Description apijson.Field + LoaDocumentID apijson.Field + ModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseSuccess bool + +const ( + AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseSuccessTrue AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponseSuccess = true +) + +type AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponse struct { + Errors []AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseError `json:"errors"` + Messages []AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseMessage `json:"messages"` + Result []AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResult `json:"result"` + ResultInfo AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseSuccess `json:"success"` + JSON accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseJSON contains +// the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponse] +type accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseError] +type accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseMessage] +type accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResult struct { + // Identifier + ID string `json:"id"` + // Identifier + AccountID string `json:"account_id"` + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Approval state of the prefix (P = pending, V = active). + Approved string `json:"approved"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Description of the prefix. + Description string `json:"description"` + // Identifier for the uploaded LOA document. + LoaDocumentID string `json:"loa_document_id,nullable"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResult] +type accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultJSON struct { + ID apijson.Field + AccountID apijson.Field + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + Approved apijson.Field + ASN apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + Description apijson.Field + LoaDocumentID apijson.Field + ModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultInfoJSON `json:"-"` +} + +// accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultInfo] +type accountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseSuccess bool + +const ( + AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseSuccessTrue AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponseSuccess = true +) + +type AccountAddressPrefixUpdateParams struct { + // Description of the prefix. + Description param.Field[string] `json:"description,required"` +} + +func (r AccountAddressPrefixUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountAddressPrefixIPAddressManagementPrefixesAddPrefixParams struct { + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN param.Field[int64] `json:"asn,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr param.Field[string] `json:"cidr,required"` + // Identifier for the uploaded LOA document. + LoaDocumentID param.Field[string] `json:"loa_document_id,required"` +} + +func (r AccountAddressPrefixIPAddressManagementPrefixesAddPrefixParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaddressprefix_test.go b/accountaddressprefix_test.go new file mode 100644 index 00000000000..09491cc2344 --- /dev/null +++ b/accountaddressprefix_test.go @@ -0,0 +1,167 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressPrefixGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressPrefixUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressPrefixUpdateParams{ + Description: cloudflare.F("Internal test prefix"), + }, + ) + 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 TestAccountAddressPrefixDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressPrefixIPAddressManagementPrefixesAddPrefix(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.IPAddressManagementPrefixesAddPrefix( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressPrefixIPAddressManagementPrefixesAddPrefixParams{ + ASN: cloudflare.F(int64(209242)), + Cidr: cloudflare.F("192.0.2.0/24"), + LoaDocumentID: cloudflare.F("d933b1530bc56c9953cf8ce166da8004"), + }, + ) + 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 TestAccountAddressPrefixIPAddressManagementPrefixesListPrefixes(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.IPAddressManagementPrefixesListPrefixes(context.TODO(), "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/accountaddressprefixbgp.go b/accountaddressprefixbgp.go new file mode 100644 index 00000000000..bc91c80948d --- /dev/null +++ b/accountaddressprefixbgp.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressPrefixBgpService 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 +// [NewAccountAddressPrefixBgpService] method instead. +type AccountAddressPrefixBgpService struct { + Options []option.RequestOption + Statuses *AccountAddressPrefixBgpStatusService +} + +// NewAccountAddressPrefixBgpService 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 NewAccountAddressPrefixBgpService(opts ...option.RequestOption) (r *AccountAddressPrefixBgpService) { + r = &AccountAddressPrefixBgpService{} + r.Options = opts + r.Statuses = NewAccountAddressPrefixBgpStatusService(opts...) + return +} diff --git a/accountaddressprefixbgpstatus.go b/accountaddressprefixbgpstatus.go new file mode 100644 index 00000000000..22bfad619b6 --- /dev/null +++ b/accountaddressprefixbgpstatus.go @@ -0,0 +1,248 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressPrefixBgpStatusService 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 +// [NewAccountAddressPrefixBgpStatusService] method instead. +type AccountAddressPrefixBgpStatusService struct { + Options []option.RequestOption +} + +// NewAccountAddressPrefixBgpStatusService 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 NewAccountAddressPrefixBgpStatusService(opts ...option.RequestOption) (r *AccountAddressPrefixBgpStatusService) { + r = &AccountAddressPrefixBgpStatusService{} + r.Options = opts + return +} + +// List the current advertisement state for a prefix. +func (r *AccountAddressPrefixBgpStatusService) IPAddressManagementDynamicAdvertisementGetAdvertisementStatus(ctx context.Context, accountIdentifier string, prefixIdentifier string, opts ...option.RequestOption) (res *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/status", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Advertise or withdraw BGP route for a prefix. +func (r *AccountAddressPrefixBgpStatusService) IPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatus(ctx context.Context, accountIdentifier string, prefixIdentifier string, body AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusParams, opts ...option.RequestOption) (res *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/status", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponse struct { + Errors []AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseError `json:"errors"` + Messages []AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseMessage `json:"messages"` + Result AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseSuccess `json:"success"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponse] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseError] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseMessage] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseResult struct { + // 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. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseResultJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseResult] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseResultJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseSuccess bool + +const ( + AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseSuccessTrue AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponseSuccess = true +) + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponse struct { + Errors []AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseError `json:"errors"` + Messages []AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseMessage `json:"messages"` + Result AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseSuccess `json:"success"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponse] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseError] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseMessage] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseResult struct { + // 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. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + JSON accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseResultJSON `json:"-"` +} + +// accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseResult] +type accountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseResultJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseSuccess bool + +const ( + AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseSuccessTrue AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponseSuccess = true +) + +type AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusParams struct { + // Enablement of prefix advertisement to the Internet. + Advertised param.Field[bool] `json:"advertised,required"` +} + +func (r AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaddressprefixbgpstatus_test.go b/accountaddressprefixbgpstatus_test.go new file mode 100644 index 00000000000..be9398b8d66 --- /dev/null +++ b/accountaddressprefixbgpstatus_test.go @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatus(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Bgps.Statuses.IPAddressManagementDynamicAdvertisementGetAdvertisementStatus( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatus(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Bgps.Statuses.IPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatus( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusParams{ + Advertised: cloudflare.F(true), + }, + ) + 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/accountaddressprefixdelegation.go b/accountaddressprefixdelegation.go new file mode 100644 index 00000000000..7d3ebc6c123 --- /dev/null +++ b/accountaddressprefixdelegation.go @@ -0,0 +1,393 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAddressPrefixDelegationService 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 +// [NewAccountAddressPrefixDelegationService] method instead. +type AccountAddressPrefixDelegationService struct { + Options []option.RequestOption +} + +// NewAccountAddressPrefixDelegationService 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 NewAccountAddressPrefixDelegationService(opts ...option.RequestOption) (r *AccountAddressPrefixDelegationService) { + r = &AccountAddressPrefixDelegationService{} + r.Options = opts + return +} + +// Delete an account delegation for a given IP prefix. +func (r *AccountAddressPrefixDelegationService) Delete(ctx context.Context, accountIdentifier string, prefixIdentifier string, delegationIdentifier string, opts ...option.RequestOption) (res *AccountAddressPrefixDelegationDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/delegations/%s", accountIdentifier, prefixIdentifier, delegationIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new account delegation for a given IP prefix. +func (r *AccountAddressPrefixDelegationService) IPAddressManagementPrefixDelegationNewPrefixDelegation(ctx context.Context, accountIdentifier string, prefixIdentifier string, body AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationParams, opts ...option.RequestOption) (res *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/delegations", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all delegations for a given account IP prefix. +func (r *AccountAddressPrefixDelegationService) IPAddressManagementPrefixDelegationListPrefixDelegations(ctx context.Context, accountIdentifier string, prefixIdentifier string, opts ...option.RequestOption) (res *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/delegations", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAddressPrefixDelegationDeleteResponse struct { + Errors []AccountAddressPrefixDelegationDeleteResponseError `json:"errors"` + Messages []AccountAddressPrefixDelegationDeleteResponseMessage `json:"messages"` + Result AccountAddressPrefixDelegationDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressPrefixDelegationDeleteResponseSuccess `json:"success"` + JSON accountAddressPrefixDelegationDeleteResponseJSON `json:"-"` +} + +// accountAddressPrefixDelegationDeleteResponseJSON contains the JSON metadata for +// the struct [AccountAddressPrefixDelegationDeleteResponse] +type accountAddressPrefixDelegationDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDelegationDeleteResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixDelegationDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountAddressPrefixDelegationDeleteResponseError] +type accountAddressPrefixDelegationDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDelegationDeleteResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixDelegationDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountAddressPrefixDelegationDeleteResponseMessage] +type accountAddressPrefixDelegationDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationDeleteResponseResult struct { + // Delegation identifier tag. + ID string `json:"id"` + JSON accountAddressPrefixDelegationDeleteResponseResultJSON `json:"-"` +} + +// accountAddressPrefixDelegationDeleteResponseResultJSON contains the JSON +// metadata for the struct [AccountAddressPrefixDelegationDeleteResponseResult] +type accountAddressPrefixDelegationDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixDelegationDeleteResponseSuccess bool + +const ( + AccountAddressPrefixDelegationDeleteResponseSuccessTrue AccountAddressPrefixDelegationDeleteResponseSuccess = true +) + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponse struct { + Errors []AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseError `json:"errors"` + Messages []AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseMessage `json:"messages"` + Result AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseSuccess `json:"success"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponse] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseError] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseMessage] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseResult struct { + // Delegation identifier tag. + ID string `json:"id"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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 + ParentPrefixID string `json:"parent_prefix_id"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseResultJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseResult] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseResultJSON struct { + ID apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + DelegatedAccountID apijson.Field + ModifiedAt apijson.Field + ParentPrefixID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseSuccess bool + +const ( + AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseSuccessTrue AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponseSuccess = true +) + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponse struct { + Errors []AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseError `json:"errors"` + Messages []AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseMessage `json:"messages"` + Result []AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResult `json:"result"` + ResultInfo AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseSuccess `json:"success"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponse] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseErrorJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseError] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseMessageJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseMessage] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResult struct { + // Delegation identifier tag. + ID string `json:"id"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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 + ParentPrefixID string `json:"parent_prefix_id"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResult] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultJSON struct { + ID apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + DelegatedAccountID apijson.Field + ModifiedAt apijson.Field + ParentPrefixID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultInfoJSON `json:"-"` +} + +// accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultInfo] +type accountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseSuccess bool + +const ( + AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseSuccessTrue AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponseSuccess = true +) + +type AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationParams struct { + // IP Prefix in Classless Inter-Domain Routing format. + Cidr param.Field[string] `json:"cidr,required"` + // Account identifier for the account to which prefix is being delegated. + DelegatedAccountID param.Field[string] `json:"delegated_account_id,required"` +} + +func (r AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountaddressprefixdelegation_test.go b/accountaddressprefixdelegation_test.go new file mode 100644 index 00000000000..977caa66c4e --- /dev/null +++ b/accountaddressprefixdelegation_test.go @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAddressPrefixDelegationDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Delegations.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "d933b1530bc56c9953cf8ce166da8004", + ) + 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 TestAccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegation(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Delegations.IPAddressManagementPrefixDelegationNewPrefixDelegation( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationParams{ + Cidr: cloudflare.F("192.0.2.0/24"), + DelegatedAccountID: cloudflare.F("b1946ac92492d2347c6235b4d2611184"), + }, + ) + 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 TestAccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegations(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Addresses.Prefixes.Delegations.IPAddressManagementPrefixDelegationListPrefixDelegations( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountai.go b/accountai.go new file mode 100644 index 00000000000..ff4686b6d62 --- /dev/null +++ b/accountai.go @@ -0,0 +1,92 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAIService 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 [NewAccountAIService] method instead. +type AccountAIService struct { + Options []option.RequestOption +} + +// NewAccountAIService 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 NewAccountAIService(opts ...option.RequestOption) (r *AccountAIService) { + r = &AccountAIService{} + r.Options = opts + return +} + +// This endpoint provides users with the capability to run specific AI models +// on-demand. +// +// By submitting the required input data, users can receive real-time predictions +// or results generated by the chosen AI model. The endpoint supports various AI +// model types, ensuring flexibility and adaptability for diverse use cases. +func (r *AccountAIService) Run(ctx context.Context, accountIdentifier string, modelName string, body AccountAIRunParams, opts ...option.RequestOption) (res *AccountAIRunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/ai/run/%s", accountIdentifier, modelName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountAIRunResponse struct { + Errors []AccountAIRunResponseError `json:"errors,required"` + Messages []string `json:"messages,required"` + Result interface{} `json:"result,required"` + Success bool `json:"success,required"` + JSON accountAIRunResponseJSON `json:"-"` +} + +// accountAIRunResponseJSON contains the JSON metadata for the struct +// [AccountAIRunResponse] +type accountAIRunResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAIRunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAIRunResponseError struct { + Message string `json:"message,required"` + JSON accountAIRunResponseErrorJSON `json:"-"` +} + +// accountAIRunResponseErrorJSON contains the JSON metadata for the struct +// [AccountAIRunResponseError] +type accountAIRunResponseErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAIRunResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAIRunParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountAIRunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountai_test.go b/accountai_test.go new file mode 100644 index 00000000000..04fca74054e --- /dev/null +++ b/accountai_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAIRun(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.AI.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "string", + cloudflare.AccountAIRunParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountalerting.go b/accountalerting.go new file mode 100644 index 00000000000..be735c9ef9a --- /dev/null +++ b/accountalerting.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAlertingService 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 [NewAccountAlertingService] method +// instead. +type AccountAlertingService struct { + Options []option.RequestOption + V3 *AccountAlertingV3Service +} + +// NewAccountAlertingService 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 NewAccountAlertingService(opts ...option.RequestOption) (r *AccountAlertingService) { + r = &AccountAlertingService{} + r.Options = opts + r.V3 = NewAccountAlertingV3Service(opts...) + return +} diff --git a/accountalertingv3.go b/accountalertingv3.go new file mode 100644 index 00000000000..f93e36406ff --- /dev/null +++ b/accountalertingv3.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAlertingV3Service 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 [NewAccountAlertingV3Service] method +// instead. +type AccountAlertingV3Service struct { + Options []option.RequestOption + AvailableAlerts *AccountAlertingV3AvailableAlertService + Destinations *AccountAlertingV3DestinationService +} + +// NewAccountAlertingV3Service 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 NewAccountAlertingV3Service(opts ...option.RequestOption) (r *AccountAlertingV3Service) { + r = &AccountAlertingV3Service{} + r.Options = opts + r.AvailableAlerts = NewAccountAlertingV3AvailableAlertService(opts...) + r.Destinations = NewAccountAlertingV3DestinationService(opts...) + return +} diff --git a/accountalertingv3availablealert.go b/accountalertingv3availablealert.go new file mode 100644 index 00000000000..4b63d42858c --- /dev/null +++ b/accountalertingv3availablealert.go @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAlertingV3AvailableAlertService 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 +// [NewAccountAlertingV3AvailableAlertService] method instead. +type AccountAlertingV3AvailableAlertService struct { + Options []option.RequestOption +} + +// NewAccountAlertingV3AvailableAlertService 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 NewAccountAlertingV3AvailableAlertService(opts ...option.RequestOption) (r *AccountAlertingV3AvailableAlertService) { + r = &AccountAlertingV3AvailableAlertService{} + r.Options = opts + return +} + +// Gets a list of all alert types for which an account is eligible. +func (r *AccountAlertingV3AvailableAlertService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountAlertingV3AvailableAlertListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/available_alerts", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAlertingV3AvailableAlertListResponse struct { + Errors []AccountAlertingV3AvailableAlertListResponseError `json:"errors"` + Messages []AccountAlertingV3AvailableAlertListResponseMessage `json:"messages"` + Result interface{} `json:"result"` + ResultInfo AccountAlertingV3AvailableAlertListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAlertingV3AvailableAlertListResponseSuccess `json:"success"` + JSON accountAlertingV3AvailableAlertListResponseJSON `json:"-"` +} + +// accountAlertingV3AvailableAlertListResponseJSON contains the JSON metadata for +// the struct [AccountAlertingV3AvailableAlertListResponse] +type accountAlertingV3AvailableAlertListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3AvailableAlertListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3AvailableAlertListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3AvailableAlertListResponseErrorJSON `json:"-"` +} + +// accountAlertingV3AvailableAlertListResponseErrorJSON contains the JSON metadata +// for the struct [AccountAlertingV3AvailableAlertListResponseError] +type accountAlertingV3AvailableAlertListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3AvailableAlertListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3AvailableAlertListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3AvailableAlertListResponseMessageJSON `json:"-"` +} + +// accountAlertingV3AvailableAlertListResponseMessageJSON contains the JSON +// metadata for the struct [AccountAlertingV3AvailableAlertListResponseMessage] +type accountAlertingV3AvailableAlertListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3AvailableAlertListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3AvailableAlertListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAlertingV3AvailableAlertListResponseResultInfoJSON `json:"-"` +} + +// accountAlertingV3AvailableAlertListResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountAlertingV3AvailableAlertListResponseResultInfo] +type accountAlertingV3AvailableAlertListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3AvailableAlertListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3AvailableAlertListResponseSuccess bool + +const ( + AccountAlertingV3AvailableAlertListResponseSuccessTrue AccountAlertingV3AvailableAlertListResponseSuccess = true +) diff --git a/accountalertingv3availablealert_test.go b/accountalertingv3availablealert_test.go new file mode 100644 index 00000000000..88be2113da4 --- /dev/null +++ b/accountalertingv3availablealert_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAlertingV3AvailableAlertList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.AvailableAlerts.List(context.TODO(), "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/accountalertingv3destination.go b/accountalertingv3destination.go new file mode 100644 index 00000000000..971f8e7c88f --- /dev/null +++ b/accountalertingv3destination.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAlertingV3DestinationService 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 +// [NewAccountAlertingV3DestinationService] method instead. +type AccountAlertingV3DestinationService struct { + Options []option.RequestOption + Eligible *AccountAlertingV3DestinationEligibleService + Pagerduty *AccountAlertingV3DestinationPagerdutyService + Webhooks *AccountAlertingV3DestinationWebhookService +} + +// NewAccountAlertingV3DestinationService 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 NewAccountAlertingV3DestinationService(opts ...option.RequestOption) (r *AccountAlertingV3DestinationService) { + r = &AccountAlertingV3DestinationService{} + r.Options = opts + r.Eligible = NewAccountAlertingV3DestinationEligibleService(opts...) + r.Pagerduty = NewAccountAlertingV3DestinationPagerdutyService(opts...) + r.Webhooks = NewAccountAlertingV3DestinationWebhookService(opts...) + return +} diff --git a/accountalertingv3destinationeligible.go b/accountalertingv3destinationeligible.go new file mode 100644 index 00000000000..943d4b52198 --- /dev/null +++ b/accountalertingv3destinationeligible.go @@ -0,0 +1,140 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAlertingV3DestinationEligibleService 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 +// [NewAccountAlertingV3DestinationEligibleService] method instead. +type AccountAlertingV3DestinationEligibleService struct { + Options []option.RequestOption +} + +// NewAccountAlertingV3DestinationEligibleService 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 NewAccountAlertingV3DestinationEligibleService(opts ...option.RequestOption) (r *AccountAlertingV3DestinationEligibleService) { + r = &AccountAlertingV3DestinationEligibleService{} + r.Options = opts + return +} + +// Get a list of all delivery mechanism types for which an account is eligible. +func (r *AccountAlertingV3DestinationEligibleService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationEligibleListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/eligible", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAlertingV3DestinationEligibleListResponse struct { + Errors []AccountAlertingV3DestinationEligibleListResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationEligibleListResponseMessage `json:"messages"` + Result interface{} `json:"result"` + ResultInfo AccountAlertingV3DestinationEligibleListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAlertingV3DestinationEligibleListResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationEligibleListResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationEligibleListResponseJSON contains the JSON metadata +// for the struct [AccountAlertingV3DestinationEligibleListResponse] +type accountAlertingV3DestinationEligibleListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationEligibleListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationEligibleListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationEligibleListResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationEligibleListResponseErrorJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationEligibleListResponseError] +type accountAlertingV3DestinationEligibleListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationEligibleListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationEligibleListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationEligibleListResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationEligibleListResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationEligibleListResponseMessage] +type accountAlertingV3DestinationEligibleListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationEligibleListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationEligibleListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAlertingV3DestinationEligibleListResponseResultInfoJSON `json:"-"` +} + +// accountAlertingV3DestinationEligibleListResponseResultInfoJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationEligibleListResponseResultInfo] +type accountAlertingV3DestinationEligibleListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationEligibleListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationEligibleListResponseSuccess bool + +const ( + AccountAlertingV3DestinationEligibleListResponseSuccessTrue AccountAlertingV3DestinationEligibleListResponseSuccess = true +) diff --git a/accountalertingv3destinationeligible_test.go b/accountalertingv3destinationeligible_test.go new file mode 100644 index 00000000000..47018838ce3 --- /dev/null +++ b/accountalertingv3destinationeligible_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAlertingV3DestinationEligibleList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Eligible.List(context.TODO(), "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/accountalertingv3destinationpagerduty.go b/accountalertingv3destinationpagerduty.go new file mode 100644 index 00000000000..b0279388a27 --- /dev/null +++ b/accountalertingv3destinationpagerduty.go @@ -0,0 +1,466 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAlertingV3DestinationPagerdutyService 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 +// [NewAccountAlertingV3DestinationPagerdutyService] method instead. +type AccountAlertingV3DestinationPagerdutyService struct { + Options []option.RequestOption +} + +// NewAccountAlertingV3DestinationPagerdutyService 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 NewAccountAlertingV3DestinationPagerdutyService(opts ...option.RequestOption) (r *AccountAlertingV3DestinationPagerdutyService) { + r = &AccountAlertingV3DestinationPagerdutyService{} + r.Options = opts + return +} + +// Get a list of all configured PagerDuty services. +func (r *AccountAlertingV3DestinationPagerdutyService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationPagerdutyListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/pagerduty", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes all the PagerDuty Services connected to the account. +func (r *AccountAlertingV3DestinationPagerdutyService) Delete(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationPagerdutyDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/pagerduty", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new token for integrating with PagerDuty. +func (r *AccountAlertingV3DestinationPagerdutyService) Connect(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationPagerdutyConnectResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/pagerduty/connect", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Links PagerDuty with the account using the integration token. +func (r *AccountAlertingV3DestinationPagerdutyService) Link(ctx context.Context, accountID string, tokenID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationPagerdutyLinkResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/pagerduty/connect/%s", accountID, tokenID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountAlertingV3DestinationPagerdutyListResponse struct { + Errors []AccountAlertingV3DestinationPagerdutyListResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationPagerdutyListResponseMessage `json:"messages"` + Result []AccountAlertingV3DestinationPagerdutyListResponseResult `json:"result"` + ResultInfo AccountAlertingV3DestinationPagerdutyListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAlertingV3DestinationPagerdutyListResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationPagerdutyListResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyListResponseJSON contains the JSON metadata +// for the struct [AccountAlertingV3DestinationPagerdutyListResponse] +type accountAlertingV3DestinationPagerdutyListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyListResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyListResponseErrorJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationPagerdutyListResponseError] +type accountAlertingV3DestinationPagerdutyListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyListResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyListResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyListResponseMessage] +type accountAlertingV3DestinationPagerdutyListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyListResponseResult struct { + // UUID + ID string `json:"id"` + // The name of the pagerduty service. + Name string `json:"name"` + JSON accountAlertingV3DestinationPagerdutyListResponseResultJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyListResponseResultJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyListResponseResult] +type accountAlertingV3DestinationPagerdutyListResponseResultJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAlertingV3DestinationPagerdutyListResponseResultInfoJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyListResponseResultInfoJSON contains the +// JSON metadata for the struct +// [AccountAlertingV3DestinationPagerdutyListResponseResultInfo] +type accountAlertingV3DestinationPagerdutyListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationPagerdutyListResponseSuccess bool + +const ( + AccountAlertingV3DestinationPagerdutyListResponseSuccessTrue AccountAlertingV3DestinationPagerdutyListResponseSuccess = true +) + +type AccountAlertingV3DestinationPagerdutyDeleteResponse struct { + Errors []AccountAlertingV3DestinationPagerdutyDeleteResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationPagerdutyDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAlertingV3DestinationPagerdutyDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAlertingV3DestinationPagerdutyDeleteResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationPagerdutyDeleteResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyDeleteResponseJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationPagerdutyDeleteResponse] +type accountAlertingV3DestinationPagerdutyDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyDeleteResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyDeleteResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyDeleteResponseError] +type accountAlertingV3DestinationPagerdutyDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyDeleteResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyDeleteResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyDeleteResponseMessage] +type accountAlertingV3DestinationPagerdutyDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAlertingV3DestinationPagerdutyDeleteResponseResultInfoJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyDeleteResponseResultInfoJSON contains the +// JSON metadata for the struct +// [AccountAlertingV3DestinationPagerdutyDeleteResponseResultInfo] +type accountAlertingV3DestinationPagerdutyDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationPagerdutyDeleteResponseSuccess bool + +const ( + AccountAlertingV3DestinationPagerdutyDeleteResponseSuccessTrue AccountAlertingV3DestinationPagerdutyDeleteResponseSuccess = true +) + +type AccountAlertingV3DestinationPagerdutyConnectResponse struct { + Errors []AccountAlertingV3DestinationPagerdutyConnectResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationPagerdutyConnectResponseMessage `json:"messages"` + Result AccountAlertingV3DestinationPagerdutyConnectResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAlertingV3DestinationPagerdutyConnectResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationPagerdutyConnectResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyConnectResponseJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationPagerdutyConnectResponse] +type accountAlertingV3DestinationPagerdutyConnectResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyConnectResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyConnectResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyConnectResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyConnectResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyConnectResponseError] +type accountAlertingV3DestinationPagerdutyConnectResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyConnectResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyConnectResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyConnectResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyConnectResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountAlertingV3DestinationPagerdutyConnectResponseMessage] +type accountAlertingV3DestinationPagerdutyConnectResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyConnectResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyConnectResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAlertingV3DestinationPagerdutyConnectResponseResultJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyConnectResponseResultJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyConnectResponseResult] +type accountAlertingV3DestinationPagerdutyConnectResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyConnectResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationPagerdutyConnectResponseSuccess bool + +const ( + AccountAlertingV3DestinationPagerdutyConnectResponseSuccessTrue AccountAlertingV3DestinationPagerdutyConnectResponseSuccess = true +) + +type AccountAlertingV3DestinationPagerdutyLinkResponse struct { + Errors []AccountAlertingV3DestinationPagerdutyLinkResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationPagerdutyLinkResponseMessage `json:"messages"` + Result AccountAlertingV3DestinationPagerdutyLinkResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAlertingV3DestinationPagerdutyLinkResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationPagerdutyLinkResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyLinkResponseJSON contains the JSON metadata +// for the struct [AccountAlertingV3DestinationPagerdutyLinkResponse] +type accountAlertingV3DestinationPagerdutyLinkResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyLinkResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyLinkResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyLinkResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyLinkResponseErrorJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationPagerdutyLinkResponseError] +type accountAlertingV3DestinationPagerdutyLinkResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyLinkResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyLinkResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationPagerdutyLinkResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyLinkResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyLinkResponseMessage] +type accountAlertingV3DestinationPagerdutyLinkResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyLinkResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationPagerdutyLinkResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAlertingV3DestinationPagerdutyLinkResponseResultJSON `json:"-"` +} + +// accountAlertingV3DestinationPagerdutyLinkResponseResultJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationPagerdutyLinkResponseResult] +type accountAlertingV3DestinationPagerdutyLinkResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationPagerdutyLinkResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationPagerdutyLinkResponseSuccess bool + +const ( + AccountAlertingV3DestinationPagerdutyLinkResponseSuccessTrue AccountAlertingV3DestinationPagerdutyLinkResponseSuccess = true +) diff --git a/accountalertingv3destinationpagerduty_test.go b/accountalertingv3destinationpagerduty_test.go new file mode 100644 index 00000000000..c28a81564c7 --- /dev/null +++ b/accountalertingv3destinationpagerduty_test.go @@ -0,0 +1,122 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAlertingV3DestinationPagerdutyList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Pagerduty.List(context.TODO(), "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()) + } +} + +func TestAccountAlertingV3DestinationPagerdutyDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Pagerduty.Delete(context.TODO(), "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()) + } +} + +func TestAccountAlertingV3DestinationPagerdutyConnect(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Pagerduty.Connect(context.TODO(), "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()) + } +} + +func TestAccountAlertingV3DestinationPagerdutyLink(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Pagerduty.Link( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "8c71e667571b4f61b94d9e4b12158038", + ) + 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/accountalertingv3destinationwebhook.go b/accountalertingv3destinationwebhook.go new file mode 100644 index 00000000000..d204c36c0e9 --- /dev/null +++ b/accountalertingv3destinationwebhook.go @@ -0,0 +1,543 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountAlertingV3DestinationWebhookService 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 +// [NewAccountAlertingV3DestinationWebhookService] method instead. +type AccountAlertingV3DestinationWebhookService struct { + Options []option.RequestOption +} + +// NewAccountAlertingV3DestinationWebhookService 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 NewAccountAlertingV3DestinationWebhookService(opts ...option.RequestOption) (r *AccountAlertingV3DestinationWebhookService) { + r = &AccountAlertingV3DestinationWebhookService{} + r.Options = opts + return +} + +// Creates a new webhook destination. +func (r *AccountAlertingV3DestinationWebhookService) New(ctx context.Context, accountID string, body AccountAlertingV3DestinationWebhookNewParams, opts ...option.RequestOption) (res *AccountAlertingV3DestinationWebhookNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get details for a single webhooks destination. +func (r *AccountAlertingV3DestinationWebhookService) Get(ctx context.Context, accountID string, webhookID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationWebhookGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks/%s", accountID, webhookID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Gets a list of all configured webhook destinations. +func (r *AccountAlertingV3DestinationWebhookService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationWebhookListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a configured webhook destination. +func (r *AccountAlertingV3DestinationWebhookService) Delete(ctx context.Context, accountID string, webhookID string, opts ...option.RequestOption) (res *AccountAlertingV3DestinationWebhookDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks/%s", accountID, webhookID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AccountAlertingV3DestinationWebhookNewResponse struct { + Errors []AccountAlertingV3DestinationWebhookNewResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationWebhookNewResponseMessage `json:"messages"` + Result AccountAlertingV3DestinationWebhookNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAlertingV3DestinationWebhookNewResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationWebhookNewResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookNewResponseJSON contains the JSON metadata +// for the struct [AccountAlertingV3DestinationWebhookNewResponse] +type accountAlertingV3DestinationWebhookNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookNewResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookNewResponseErrorJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookNewResponseError] +type accountAlertingV3DestinationWebhookNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookNewResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookNewResponseMessageJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookNewResponseMessage] +type accountAlertingV3DestinationWebhookNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookNewResponseResult struct { + // UUID + ID string `json:"id"` + JSON accountAlertingV3DestinationWebhookNewResponseResultJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookNewResponseResultJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookNewResponseResult] +type accountAlertingV3DestinationWebhookNewResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationWebhookNewResponseSuccess bool + +const ( + AccountAlertingV3DestinationWebhookNewResponseSuccessTrue AccountAlertingV3DestinationWebhookNewResponseSuccess = true +) + +type AccountAlertingV3DestinationWebhookGetResponse struct { + Errors []AccountAlertingV3DestinationWebhookGetResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationWebhookGetResponseMessage `json:"messages"` + Result AccountAlertingV3DestinationWebhookGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountAlertingV3DestinationWebhookGetResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationWebhookGetResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookGetResponseJSON contains the JSON metadata +// for the struct [AccountAlertingV3DestinationWebhookGetResponse] +type accountAlertingV3DestinationWebhookGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookGetResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookGetResponseErrorJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookGetResponseError] +type accountAlertingV3DestinationWebhookGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookGetResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookGetResponseMessageJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookGetResponseMessage] +type accountAlertingV3DestinationWebhookGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookGetResponseResult struct { + // The unique identifier of a webhook + ID string `json:"id"` + // Timestamp of when the webhook destination was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of the last time an attempt to dispatch a notification to this webhook + // failed. + LastFailure time.Time `json:"last_failure" format:"date-time"` + // Timestamp of the last time Cloudflare was able to successfully dispatch a + // notification using this webhook. + LastSuccess time.Time `json:"last_success" format:"date-time"` + // The name of the webhook destination. This will be included in the request body + // when you receive a webhook notification. + Name string `json:"name"` + // Optional secret that will be passed in the `cf-webhook-auth` header when + // dispatching generic webhook notifications or formatted for supported + // destinations. Secrets are not returned in any API response body. + Secret string `json:"secret"` + // Type of webhook endpoint. + Type AccountAlertingV3DestinationWebhookGetResponseResultType `json:"type"` + // The POST endpoint to call when dispatching a notification. + URL string `json:"url"` + JSON accountAlertingV3DestinationWebhookGetResponseResultJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookGetResponseResultJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookGetResponseResult] +type accountAlertingV3DestinationWebhookGetResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + LastFailure apijson.Field + LastSuccess apijson.Field + Name apijson.Field + Secret apijson.Field + Type apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of webhook endpoint. +type AccountAlertingV3DestinationWebhookGetResponseResultType string + +const ( + AccountAlertingV3DestinationWebhookGetResponseResultTypeSlack AccountAlertingV3DestinationWebhookGetResponseResultType = "slack" + AccountAlertingV3DestinationWebhookGetResponseResultTypeGeneric AccountAlertingV3DestinationWebhookGetResponseResultType = "generic" + AccountAlertingV3DestinationWebhookGetResponseResultTypeGchat AccountAlertingV3DestinationWebhookGetResponseResultType = "gchat" +) + +// Whether the API call was successful +type AccountAlertingV3DestinationWebhookGetResponseSuccess bool + +const ( + AccountAlertingV3DestinationWebhookGetResponseSuccessTrue AccountAlertingV3DestinationWebhookGetResponseSuccess = true +) + +type AccountAlertingV3DestinationWebhookListResponse struct { + Errors []AccountAlertingV3DestinationWebhookListResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationWebhookListResponseMessage `json:"messages"` + Result []AccountAlertingV3DestinationWebhookListResponseResult `json:"result"` + ResultInfo AccountAlertingV3DestinationWebhookListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAlertingV3DestinationWebhookListResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationWebhookListResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookListResponseJSON contains the JSON metadata +// for the struct [AccountAlertingV3DestinationWebhookListResponse] +type accountAlertingV3DestinationWebhookListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookListResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookListResponseErrorJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookListResponseError] +type accountAlertingV3DestinationWebhookListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookListResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookListResponseMessageJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookListResponseMessage] +type accountAlertingV3DestinationWebhookListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookListResponseResult struct { + // The unique identifier of a webhook + ID string `json:"id"` + // Timestamp of when the webhook destination was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of the last time an attempt to dispatch a notification to this webhook + // failed. + LastFailure time.Time `json:"last_failure" format:"date-time"` + // Timestamp of the last time Cloudflare was able to successfully dispatch a + // notification using this webhook. + LastSuccess time.Time `json:"last_success" format:"date-time"` + // The name of the webhook destination. This will be included in the request body + // when you receive a webhook notification. + Name string `json:"name"` + // Optional secret that will be passed in the `cf-webhook-auth` header when + // dispatching generic webhook notifications or formatted for supported + // destinations. Secrets are not returned in any API response body. + Secret string `json:"secret"` + // Type of webhook endpoint. + Type AccountAlertingV3DestinationWebhookListResponseResultType `json:"type"` + // The POST endpoint to call when dispatching a notification. + URL string `json:"url"` + JSON accountAlertingV3DestinationWebhookListResponseResultJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookListResponseResultJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookListResponseResult] +type accountAlertingV3DestinationWebhookListResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + LastFailure apijson.Field + LastSuccess apijson.Field + Name apijson.Field + Secret apijson.Field + Type apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of webhook endpoint. +type AccountAlertingV3DestinationWebhookListResponseResultType string + +const ( + AccountAlertingV3DestinationWebhookListResponseResultTypeSlack AccountAlertingV3DestinationWebhookListResponseResultType = "slack" + AccountAlertingV3DestinationWebhookListResponseResultTypeGeneric AccountAlertingV3DestinationWebhookListResponseResultType = "generic" + AccountAlertingV3DestinationWebhookListResponseResultTypeGchat AccountAlertingV3DestinationWebhookListResponseResultType = "gchat" +) + +type AccountAlertingV3DestinationWebhookListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAlertingV3DestinationWebhookListResponseResultInfoJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookListResponseResultInfoJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationWebhookListResponseResultInfo] +type accountAlertingV3DestinationWebhookListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationWebhookListResponseSuccess bool + +const ( + AccountAlertingV3DestinationWebhookListResponseSuccessTrue AccountAlertingV3DestinationWebhookListResponseSuccess = true +) + +type AccountAlertingV3DestinationWebhookDeleteResponse struct { + Errors []AccountAlertingV3DestinationWebhookDeleteResponseError `json:"errors"` + Messages []AccountAlertingV3DestinationWebhookDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountAlertingV3DestinationWebhookDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountAlertingV3DestinationWebhookDeleteResponseSuccess `json:"success"` + JSON accountAlertingV3DestinationWebhookDeleteResponseJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookDeleteResponseJSON contains the JSON metadata +// for the struct [AccountAlertingV3DestinationWebhookDeleteResponse] +type accountAlertingV3DestinationWebhookDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookDeleteResponseErrorJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookDeleteResponseErrorJSON contains the JSON +// metadata for the struct [AccountAlertingV3DestinationWebhookDeleteResponseError] +type accountAlertingV3DestinationWebhookDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountAlertingV3DestinationWebhookDeleteResponseMessageJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookDeleteResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountAlertingV3DestinationWebhookDeleteResponseMessage] +type accountAlertingV3DestinationWebhookDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountAlertingV3DestinationWebhookDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountAlertingV3DestinationWebhookDeleteResponseResultInfoJSON `json:"-"` +} + +// accountAlertingV3DestinationWebhookDeleteResponseResultInfoJSON contains the +// JSON metadata for the struct +// [AccountAlertingV3DestinationWebhookDeleteResponseResultInfo] +type accountAlertingV3DestinationWebhookDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountAlertingV3DestinationWebhookDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountAlertingV3DestinationWebhookDeleteResponseSuccess bool + +const ( + AccountAlertingV3DestinationWebhookDeleteResponseSuccessTrue AccountAlertingV3DestinationWebhookDeleteResponseSuccess = true +) + +type AccountAlertingV3DestinationWebhookNewParams struct { + // The name of the webhook destination. This will be included in the request body + // when you receive a webhook notification. + Name param.Field[string] `json:"name,required"` + // The POST endpoint to call when dispatching a notification. + URL param.Field[string] `json:"url,required"` + // Optional secret that will be passed in the `cf-webhook-auth` header when + // dispatching generic webhook notifications or formatted for supported + // destinations. Secrets are not returned in any API response body. + Secret param.Field[string] `json:"secret"` +} + +func (r AccountAlertingV3DestinationWebhookNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountalertingv3destinationwebhook_test.go b/accountalertingv3destinationwebhook_test.go new file mode 100644 index 00000000000..6e7cb42ddae --- /dev/null +++ b/accountalertingv3destinationwebhook_test.go @@ -0,0 +1,134 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountAlertingV3DestinationWebhookNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Webhooks.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountAlertingV3DestinationWebhookNewParams{ + Name: cloudflare.F("Slack Webhook"), + URL: cloudflare.F("https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd"), + Secret: cloudflare.F("string"), + }, + ) + 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 TestAccountAlertingV3DestinationWebhookGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Webhooks.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "b115d5ec-15c6-41ee-8b76-92c449b5227b", + ) + 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 TestAccountAlertingV3DestinationWebhookList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Webhooks.List(context.TODO(), "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()) + } +} + +func TestAccountAlertingV3DestinationWebhookDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Alerting.V3.Destinations.Webhooks.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "b115d5ec-15c6-41ee-8b76-92c449b5227b", + ) + 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/accountbilling.go b/accountbilling.go new file mode 100644 index 00000000000..04e33f765ee --- /dev/null +++ b/accountbilling.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountBillingService 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 [NewAccountBillingService] method +// instead. +type AccountBillingService struct { + Options []option.RequestOption + Profiles *AccountBillingProfileService +} + +// NewAccountBillingService 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 NewAccountBillingService(opts ...option.RequestOption) (r *AccountBillingService) { + r = &AccountBillingService{} + r.Options = opts + r.Profiles = NewAccountBillingProfileService(opts...) + return +} diff --git a/accountbillingprofile.go b/accountbillingprofile.go new file mode 100644 index 00000000000..b8520c3ea38 --- /dev/null +++ b/accountbillingprofile.go @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountBillingProfileService 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 [NewAccountBillingProfileService] +// method instead. +type AccountBillingProfileService struct { + Options []option.RequestOption +} + +// NewAccountBillingProfileService 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 NewAccountBillingProfileService(opts ...option.RequestOption) (r *AccountBillingProfileService) { + r = &AccountBillingProfileService{} + r.Options = opts + return +} + +// Gets the current billing profile for the account. +func (r *AccountBillingProfileService) AccountBillingProfileBillingProfileDetails(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/billing/profile", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponse struct { + Errors []AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseError `json:"errors"` + Messages []AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseSuccess `json:"success"` + JSON accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseJSON `json:"-"` +} + +// accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseJSON +// contains the JSON metadata for the struct +// [AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponse] +type accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseErrorJSON `json:"-"` +} + +// accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseError] +type accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseMessageJSON `json:"-"` +} + +// accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseMessage] +type accountBillingProfileAccountBillingProfileBillingProfileDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseSuccess bool + +const ( + AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseSuccessTrue AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponseSuccess = true +) diff --git a/accountbillingprofile_test.go b/accountbillingprofile_test.go new file mode 100644 index 00000000000..12525e4113e --- /dev/null +++ b/accountbillingprofile_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountBillingProfileAccountBillingProfileBillingProfileDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Billings.Profiles.AccountBillingProfileBillingProfileDetails(context.TODO(), map[string]interface{}{}) + 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/accountbrandprotection.go b/accountbrandprotection.go new file mode 100644 index 00000000000..723cb05f918 --- /dev/null +++ b/accountbrandprotection.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountBrandProtectionService 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 [NewAccountBrandProtectionService] +// method instead. +type AccountBrandProtectionService struct { + Options []option.RequestOption + Submits *AccountBrandProtectionSubmitService + URLInfos *AccountBrandProtectionURLInfoService +} + +// NewAccountBrandProtectionService 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 NewAccountBrandProtectionService(opts ...option.RequestOption) (r *AccountBrandProtectionService) { + r = &AccountBrandProtectionService{} + r.Options = opts + r.Submits = NewAccountBrandProtectionSubmitService(opts...) + r.URLInfos = NewAccountBrandProtectionURLInfoService(opts...) + return +} diff --git a/accountbrandprotectionsubmit.go b/accountbrandprotectionsubmit.go new file mode 100644 index 00000000000..929a3e89a5b --- /dev/null +++ b/accountbrandprotectionsubmit.go @@ -0,0 +1,210 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountBrandProtectionSubmitService 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 +// [NewAccountBrandProtectionSubmitService] method instead. +type AccountBrandProtectionSubmitService struct { + Options []option.RequestOption +} + +// NewAccountBrandProtectionSubmitService 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 NewAccountBrandProtectionSubmitService(opts ...option.RequestOption) (r *AccountBrandProtectionSubmitService) { + r = &AccountBrandProtectionSubmitService{} + r.Options = opts + return +} + +// Submit suspicious URL for scanning +func (r *AccountBrandProtectionSubmitService) PhishingURLScannerSubmitSuspiciousURLForScanning(ctx context.Context, accountIdentifier string, body AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningParams, opts ...option.RequestOption) (res *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/brand-protection/submit", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponse struct { + Errors []AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseError `json:"errors"` + Messages []AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseMessage `json:"messages"` + Result AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResult `json:"result"` + // Whether the API call was successful + Success AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseSuccess `json:"success"` + JSON accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseJSON `json:"-"` +} + +// accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponse] +type accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseErrorJSON `json:"-"` +} + +// accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseError] +type accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseMessageJSON `json:"-"` +} + +// accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseMessage] +type accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResult struct { + // URLs that were excluded from scanning because their domain is in our no-scan + // list. + ExcludedURLs []AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultExcludedURL `json:"excluded_urls"` + // URLs that were skipped because the same URL is currently being scanned + SkippedURLs []AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSkippedURL `json:"skipped_urls"` + // URLs that were successfully submitted for scanning. + SubmittedURLs []AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSubmittedURL `json:"submitted_urls"` + JSON accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultJSON `json:"-"` +} + +// accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResult] +type accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultJSON struct { + ExcludedURLs apijson.Field + SkippedURLs apijson.Field + SubmittedURLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultExcludedURL struct { + // URL that was excluded. + URL string `json:"url"` + JSON accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultExcludedURLJSON `json:"-"` +} + +// accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultExcludedURLJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultExcludedURL] +type accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultExcludedURLJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultExcludedURL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSkippedURL struct { + // URL that was skipped. + URL string `json:"url"` + // ID of the submission of that URL that is currently scanning. + URLID int64 `json:"url_id"` + JSON accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSkippedURLJSON `json:"-"` +} + +// accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSkippedURLJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSkippedURL] +type accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSkippedURLJSON struct { + URL apijson.Field + URLID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSkippedURL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSubmittedURL struct { + // URL that was submitted. + URL string `json:"url"` + // ID assigned to this URL submission. Used to retrieve scanning results. + URLID int64 `json:"url_id"` + JSON accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSubmittedURLJSON `json:"-"` +} + +// accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSubmittedURLJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSubmittedURL] +type accountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSubmittedURLJSON struct { + URL apijson.Field + URLID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseResultSubmittedURL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseSuccess bool + +const ( + AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseSuccessTrue AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponseSuccess = true +) + +type AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningParams struct { + // URL(s) to filter submissions results by + URL param.Field[string] `json:"url" format:"uri"` +} + +func (r AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountbrandprotectionsubmit_test.go b/accountbrandprotectionsubmit_test.go new file mode 100644 index 00000000000..c9d34ad9f8c --- /dev/null +++ b/accountbrandprotectionsubmit_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.BrandProtections.Submits.PhishingURLScannerSubmitSuspiciousURLForScanning( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningParams{ + URL: cloudflare.F("https://www.cloudflare.com"), + }, + ) + 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/accountbrandprotectionurlinfo.go b/accountbrandprotectionurlinfo.go new file mode 100644 index 00000000000..2af2a8903db --- /dev/null +++ b/accountbrandprotectionurlinfo.go @@ -0,0 +1,283 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountBrandProtectionURLInfoService 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 +// [NewAccountBrandProtectionURLInfoService] method instead. +type AccountBrandProtectionURLInfoService struct { + Options []option.RequestOption +} + +// NewAccountBrandProtectionURLInfoService 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 NewAccountBrandProtectionURLInfoService(opts ...option.RequestOption) (r *AccountBrandProtectionURLInfoService) { + r = &AccountBrandProtectionURLInfoService{} + r.Options = opts + return +} + +// Get results for a URL scan +func (r *AccountBrandProtectionURLInfoService) PhishingURLInformationGetResultsForAURLScan(ctx context.Context, accountIdentifier string, query AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAURLScanParams, opts ...option.RequestOption) (res *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/brand-protection/url-info", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponse struct { + Errors []AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseError `json:"errors"` + Messages []AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseMessage `json:"messages"` + Result AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResult `json:"result"` + // Whether the API call was successful + Success AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseSuccess `json:"success"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponse] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseErrorJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseError] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseMessageJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseMessage] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResult struct { + // List of categorizations applied to this submission. + Categorizations []AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultCategorization `json:"categorizations"` + // List of model results for completed scans. + ModelResults []AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultModelResult `json:"model_results"` + // List of signatures that matched against site content found when crawling the + // URL. + RuleMatches []AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultRuleMatch `json:"rule_matches"` + // Status of the most recent scan found. + ScanStatus AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultScanStatus `json:"scan_status"` + // For internal use. + ScreenshotDownloadSignature string `json:"screenshot_download_signature"` + // For internal use. + ScreenshotPath string `json:"screenshot_path"` + // URL that was submitted. + URL string `json:"url"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResult] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultJSON struct { + Categorizations apijson.Field + ModelResults apijson.Field + RuleMatches apijson.Field + ScanStatus apijson.Field + ScreenshotDownloadSignature apijson.Field + ScreenshotPath apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultCategorization struct { + // Name of the category applied. + Category string `json:"category"` + // Result of human review for this categorization. + VerificationStatus string `json:"verification_status"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultCategorizationJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultCategorizationJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultCategorization] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultCategorizationJSON struct { + Category apijson.Field + VerificationStatus apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultCategorization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultModelResult struct { + // Name of the model. + ModelName string `json:"model_name"` + // Score output by the model for this submission. + ModelScore float64 `json:"model_score"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultModelResultJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultModelResultJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultModelResult] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultModelResultJSON struct { + ModelName apijson.Field + ModelScore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultModelResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultRuleMatch struct { + // For internal use. + Banning bool `json:"banning"` + // For internal use. + Blocking bool `json:"blocking"` + // Description of the signature that matched. + Description string `json:"description"` + // Name of the signature that matched. + Name string `json:"name"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultRuleMatchJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultRuleMatchJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultRuleMatch] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultRuleMatchJSON struct { + Banning apijson.Field + Blocking apijson.Field + Description apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultRuleMatch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the most recent scan found. +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultScanStatus struct { + // Timestamp of when the submission was processed. + LastProcessed string `json:"last_processed"` + // For internal use. + ScanComplete bool `json:"scan_complete"` + // Status code that the crawler received when loading the submitted URL. + StatusCode int64 `json:"status_code"` + // ID of the most recent submission. + SubmissionID int64 `json:"submission_id"` + JSON accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultScanStatusJSON `json:"-"` +} + +// accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultScanStatusJSON +// contains the JSON metadata for the struct +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultScanStatus] +type accountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultScanStatusJSON struct { + LastProcessed apijson.Field + ScanComplete apijson.Field + StatusCode apijson.Field + SubmissionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseResultScanStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseSuccess bool + +const ( + AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseSuccessTrue AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponseSuccess = true +) + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAURLScanParams struct { + URL param.Field[string] `query:"url"` + URLIDParam param.Field[AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanParamsURLIDParam] `query:"url_id_param"` +} + +// URLQuery serializes +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAURLScanParams]'s +// query parameters as `url.Values`. +func (r AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAURLScanParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanParamsURLIDParam struct { + // Submission ID(s) to filter submission results by. + URLID param.Field[int64] `query:"url_id"` +} + +// URLQuery serializes +// [AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanParamsURLIDParam]'s +// query parameters as `url.Values`. +func (r AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanParamsURLIDParam) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountbrandprotectionurlinfo_test.go b/accountbrandprotectionurlinfo_test.go new file mode 100644 index 00000000000..7a1edf79b5d --- /dev/null +++ b/accountbrandprotectionurlinfo_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAURLScanWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.BrandProtections.URLInfos.PhishingURLInformationGetResultsForAURLScan( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAURLScanParams{ + URL: cloudflare.F("string"), + URLIDParam: cloudflare.F(cloudflare.AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanParamsURLIDParam{ + URLID: cloudflare.F(int64(0)), + }), + }, + ) + 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/accountcfdtunnel.go b/accountcfdtunnel.go new file mode 100644 index 00000000000..74b04e734b9 --- /dev/null +++ b/accountcfdtunnel.go @@ -0,0 +1,1670 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCfdTunnelService 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 [NewAccountCfdTunnelService] method +// instead. +type AccountCfdTunnelService struct { + Options []option.RequestOption + Configurations *AccountCfdTunnelConfigurationService + Connections *AccountCfdTunnelConnectionService + Connectors *AccountCfdTunnelConnectorService + Management *AccountCfdTunnelManagementService + Tokens *AccountCfdTunnelTokenService +} + +// NewAccountCfdTunnelService 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 NewAccountCfdTunnelService(opts ...option.RequestOption) (r *AccountCfdTunnelService) { + r = &AccountCfdTunnelService{} + r.Options = opts + r.Configurations = NewAccountCfdTunnelConfigurationService(opts...) + r.Connections = NewAccountCfdTunnelConnectionService(opts...) + r.Connectors = NewAccountCfdTunnelConnectorService(opts...) + r.Management = NewAccountCfdTunnelManagementService(opts...) + r.Tokens = NewAccountCfdTunnelTokenService(opts...) + return +} + +// Fetches a single Cloudflare Tunnel. +func (r *AccountCfdTunnelService) Get(ctx context.Context, accountIdentifier string, tunnelID string, opts ...option.RequestOption) (res *AccountCfdTunnelGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an existing Cloudflare Tunnel. +func (r *AccountCfdTunnelService) Update(ctx context.Context, accountIdentifier string, tunnelID string, body AccountCfdTunnelUpdateParams, opts ...option.RequestOption) (res *AccountCfdTunnelUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes a Cloudflare Tunnel from an account. +func (r *AccountCfdTunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelID string, body AccountCfdTunnelDeleteParams, opts ...option.RequestOption) (res *AccountCfdTunnelDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Creates a new Cloudflare Tunnel in an account. +func (r *AccountCfdTunnelService) CloudflareTunnelNewACloudflareTunnel(ctx context.Context, accountIdentifier string, body AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParams, opts ...option.RequestOption) (res *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists and filters Cloudflare Tunnels in an account. +func (r *AccountCfdTunnelService) CloudflareTunnelListCloudflareTunnels(ctx context.Context, accountIdentifier string, query AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsParams, opts ...option.RequestOption) (res *shared.Page[AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountCfdTunnelGetResponse struct { + Errors []AccountCfdTunnelGetResponseError `json:"errors"` + Messages []AccountCfdTunnelGetResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountCfdTunnelGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelGetResponseSuccess `json:"success"` + JSON accountCfdTunnelGetResponseJSON `json:"-"` +} + +// accountCfdTunnelGetResponseJSON contains the JSON metadata for the struct +// [AccountCfdTunnelGetResponse] +type accountCfdTunnelGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelGetResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountCfdTunnelGetResponseError] +type accountCfdTunnelGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelGetResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountCfdTunnelGetResponseMessage] +type accountCfdTunnelGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnel] or +// [AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountCfdTunnelGetResponseResult interface { + implementsAccountCfdTunnelGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountCfdTunnelGetResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelGetResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountCfdTunnelGetResponseResultXk6JhoizCfdTunnelJSON contains the JSON +// metadata for the struct [AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnel] +type accountCfdTunnelGetResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnel) implementsAccountCfdTunnelGetResponseResult() { +} + +type AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelGetResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelGetResponseResultXk6JhoizCfdTunnelConnectionJSON contains the +// JSON metadata for the struct +// [AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelConnection] +type accountCfdTunnelGetResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunTypeGre AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunTypeCni AccountCfdTunnelGetResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelJSON contains the +// JSON metadata for the struct +// [AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnel] +type accountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountCfdTunnelGetResponseResult() { +} + +type AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountCfdTunnelGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountCfdTunnelGetResponseSuccess bool + +const ( + AccountCfdTunnelGetResponseSuccessTrue AccountCfdTunnelGetResponseSuccess = true +) + +type AccountCfdTunnelUpdateResponse struct { + Errors []AccountCfdTunnelUpdateResponseError `json:"errors"` + Messages []AccountCfdTunnelUpdateResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountCfdTunnelUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelUpdateResponseSuccess `json:"success"` + JSON accountCfdTunnelUpdateResponseJSON `json:"-"` +} + +// accountCfdTunnelUpdateResponseJSON contains the JSON metadata for the struct +// [AccountCfdTunnelUpdateResponse] +type accountCfdTunnelUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelUpdateResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountCfdTunnelUpdateResponseError] +type accountCfdTunnelUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelUpdateResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountCfdTunnelUpdateResponseMessage] +type accountCfdTunnelUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnel] or +// [AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountCfdTunnelUpdateResponseResult interface { + implementsAccountCfdTunnelUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountCfdTunnelUpdateResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelJSON contains the JSON +// metadata for the struct [AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnel] +type accountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnel) implementsAccountCfdTunnelUpdateResponseResult() { +} + +type AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelConnectionJSON contains the +// JSON metadata for the struct +// [AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelConnection] +type accountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunTypeGre AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunTypeCni AccountCfdTunnelUpdateResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelJSON contains the +// JSON metadata for the struct +// [AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnel] +type accountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountCfdTunnelUpdateResponseResult() { +} + +type AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountCfdTunnelUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountCfdTunnelUpdateResponseSuccess bool + +const ( + AccountCfdTunnelUpdateResponseSuccessTrue AccountCfdTunnelUpdateResponseSuccess = true +) + +type AccountCfdTunnelDeleteResponse struct { + Errors []AccountCfdTunnelDeleteResponseError `json:"errors"` + Messages []AccountCfdTunnelDeleteResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountCfdTunnelDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelDeleteResponseSuccess `json:"success"` + JSON accountCfdTunnelDeleteResponseJSON `json:"-"` +} + +// accountCfdTunnelDeleteResponseJSON contains the JSON metadata for the struct +// [AccountCfdTunnelDeleteResponse] +type accountCfdTunnelDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelDeleteResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountCfdTunnelDeleteResponseError] +type accountCfdTunnelDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelDeleteResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountCfdTunnelDeleteResponseMessage] +type accountCfdTunnelDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnel] or +// [AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountCfdTunnelDeleteResponseResult interface { + implementsAccountCfdTunnelDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountCfdTunnelDeleteResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelJSON contains the JSON +// metadata for the struct [AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnel] +type accountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnel) implementsAccountCfdTunnelDeleteResponseResult() { +} + +type AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelConnectionJSON contains the +// JSON metadata for the struct +// [AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelConnection] +type accountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunTypeGre AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunTypeCni AccountCfdTunnelDeleteResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelJSON contains the +// JSON metadata for the struct +// [AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnel] +type accountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountCfdTunnelDeleteResponseResult() { +} + +type AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountCfdTunnelDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountCfdTunnelDeleteResponseSuccess bool + +const ( + AccountCfdTunnelDeleteResponseSuccessTrue AccountCfdTunnelDeleteResponseSuccess = true +) + +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponse struct { + Errors []AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseError `json:"errors"` + Messages []AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResult `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseSuccess `json:"success"` + JSON accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseJSON contains the +// JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponse] +type accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseError] +type accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseMessage] +type accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnel] +// or +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResult interface { + implementsAccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnel] +type accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnel) implementsAccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResult() { +} + +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelConnection] +type accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunTypeGre AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunTypeCni AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnel] +type accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResult() { +} + +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseSuccess bool + +const ( + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseSuccessTrue AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponseSuccess = true +) + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by +// [AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnel] +// or +// [AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnel]. +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse interface { + implementsAccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnel] +type accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnel) implementsAccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse() { +} + +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelConnection] +type accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunType string + +const ( + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunTypeCfdTunnel AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunTypeWarpConnector AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunType = "warp_connector" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunTypeIPSec AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunType = "ip_sec" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunTypeGre AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunType = "gre" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunTypeCni AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnel] +type accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnel) implementsAccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse() { +} + +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelConnection] +type accountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeGre AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeCni AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +type AccountCfdTunnelUpdateParams struct { + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name"` + // Sets the password required to run a locally-managed tunnel. Must be at least 32 + // bytes and encoded as a base64 string. + TunnelSecret param.Field[string] `json:"tunnel_secret"` +} + +func (r AccountCfdTunnelUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountCfdTunnelDeleteParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountCfdTunnelDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParams struct { + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name,required"` + // Indicates if this is a locally or remotely configured tunnel. If `local`, manage + // the tunnel using a YAML file on the origin machine. If `cloudflare`, manage the + // tunnel on the Zero Trust dashboard or using the + // [Cloudflare Tunnel configuration](https://api.cloudflare.com/#cloudflare-tunnel-configuration-properties) + // endpoint. + ConfigSrc param.Field[AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParamsConfigSrc] `json:"config_src"` + // Sets the password required to run a locally-managed tunnel. Must be at least 32 + // bytes and encoded as a base64 string. + TunnelSecret param.Field[string] `json:"tunnel_secret"` +} + +func (r AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Indicates if this is a locally or remotely configured tunnel. If `local`, manage +// the tunnel using a YAML file on the origin machine. If `cloudflare`, manage the +// tunnel on the Zero Trust dashboard or using the +// [Cloudflare Tunnel configuration](https://api.cloudflare.com/#cloudflare-tunnel-configuration-properties) +// endpoint. +type AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParamsConfigSrc string + +const ( + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParamsConfigSrcLocal AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParamsConfigSrc = "local" + AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParamsConfigSrcCloudflare AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParamsConfigSrc = "cloudflare" +) + +type AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsParams struct { + ExcludePrefix param.Field[string] `query:"exclude_prefix"` + // If provided, include only tunnels that were created (and not deleted) before + // this time. + ExistedAt param.Field[time.Time] `query:"existed_at" format:"date-time"` + IncludePrefix param.Field[string] `query:"include_prefix"` + // If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If + // empty, all tunnels will be included. + IsDeleted param.Field[bool] `query:"is_deleted"` + // A user-friendly name for the tunnel. + Name param.Field[string] `query:"name"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of results to display. + PerPage param.Field[float64] `query:"per_page"` + WasActiveAt param.Field[time.Time] `query:"was_active_at" format:"date-time"` + WasInactiveAt param.Field[time.Time] `query:"was_inactive_at" format:"date-time"` +} + +// URLQuery serializes +// [AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsParams]'s query parameters +// as `url.Values`. +func (r AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountcfdtunnel_test.go b/accountcfdtunnel_test.go new file mode 100644 index 00000000000..2d905e332c7 --- /dev/null +++ b/accountcfdtunnel_test.go @@ -0,0 +1,186 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCfdTunnelGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountCfdTunnelUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountCfdTunnelUpdateParams{ + Name: cloudflare.F("blog"), + TunnelSecret: cloudflare.F("AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg="), + }, + ) + 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 TestAccountCfdTunnelDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountCfdTunnelDeleteParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountCfdTunnelCloudflareTunnelNewACloudflareTunnelWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.CloudflareTunnelNewACloudflareTunnel( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParams{ + Name: cloudflare.F("blog"), + ConfigSrc: cloudflare.F(cloudflare.AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParamsConfigSrcCloudflare), + TunnelSecret: cloudflare.F("AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg="), + }, + ) + 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 TestAccountCfdTunnelCloudflareTunnelListCloudflareTunnelsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.CloudflareTunnelListCloudflareTunnels( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsParams{ + ExcludePrefix: cloudflare.F("vpc1-"), + ExistedAt: cloudflare.F(time.Now()), + IncludePrefix: cloudflare.F("vpc1-"), + IsDeleted: cloudflare.F(true), + Name: cloudflare.F("blog"), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + WasActiveAt: cloudflare.F(time.Now()), + WasInactiveAt: cloudflare.F(time.Now()), + }, + ) + 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/accountcfdtunnelconfiguration.go b/accountcfdtunnelconfiguration.go new file mode 100644 index 00000000000..9378b3def88 --- /dev/null +++ b/accountcfdtunnelconfiguration.go @@ -0,0 +1,368 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCfdTunnelConfigurationService 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 +// [NewAccountCfdTunnelConfigurationService] method instead. +type AccountCfdTunnelConfigurationService struct { + Options []option.RequestOption +} + +// NewAccountCfdTunnelConfigurationService 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 NewAccountCfdTunnelConfigurationService(opts ...option.RequestOption) (r *AccountCfdTunnelConfigurationService) { + r = &AccountCfdTunnelConfigurationService{} + r.Options = opts + return +} + +// Gets the configuration for a remotely-managed tunnel +func (r *AccountCfdTunnelConfigurationService) CloudflareTunnelConfigurationGetConfiguration(ctx context.Context, accountIdentifier string, tunnelID string, opts ...option.RequestOption) (res *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s/configurations", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Adds or updates the configuration for a remotely-managed tunnel. +func (r *AccountCfdTunnelConfigurationService) CloudflareTunnelConfigurationPutConfiguration(ctx context.Context, accountIdentifier string, tunnelID string, body AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParams, opts ...option.RequestOption) (res *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s/configurations", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponse struct { + Errors []AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseError `json:"errors"` + Messages []AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseSuccess `json:"success"` + JSON accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseJSON `json:"-"` +} + +// accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponse] +type accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseError] +type accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseMessage] +type accountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseSuccess bool + +const ( + AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseSuccessTrue AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponseSuccess = true +) + +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponse struct { + Errors []AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseError `json:"errors"` + Messages []AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseSuccess `json:"success"` + JSON accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseJSON `json:"-"` +} + +// accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponse] +type accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseError] +type accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseMessage] +type accountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseSuccess bool + +const ( + AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseSuccessTrue AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponseSuccess = true +) + +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParams struct { + // The tunnel configuration and ingress rules. + Config param.Field[AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfig] `json:"config"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The tunnel configuration and ingress rules. +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfig struct { + // List of public hostname definitions + Ingress param.Field[[]AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngress] `json:"ingress"` + // Configuration parameters of connection between cloudflared and origin server. + OriginRequest param.Field[AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequest] `json:"originRequest"` + // Enable private network access from WARP users to private network routes + WarpRouting param.Field[AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigWarpRouting] `json:"warp-routing"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Public hostname +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngress struct { + // Public hostname for this service. + Hostname param.Field[string] `json:"hostname,required"` + // Protocol and address of destination server. Supported protocols: http://, + // https://, unix://, tcp://, ssh://, rdp://, unix+tls://, smb://. Alternatively + // can return a HTTP status code http_status:[code] e.g. 'http_status:404'. + Service param.Field[string] `json:"service,required"` + // Configuration parameters of connection between cloudflared and origin server. + OriginRequest param.Field[AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequest] `json:"originRequest"` + // Requests with this path route to this public hostname. + Path param.Field[string] `json:"path"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngress) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configuration parameters of connection between cloudflared and origin server. +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequest struct { + // For all L7 requests to this hostname, cloudflared will validate each request's + // Cf-Access-Jwt-Assertion request header. + Access param.Field[AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequestAccess] `json:"access"` + // Path to the certificate authority (CA) for the certificate of your origin. This + // option should be used only if your certificate is not signed by Cloudflare. + CaPool param.Field[string] `json:"caPool"` + // Timeout for establishing a new TCP connection to your origin server. This + // excludes the time taken to establish TLS, which is controlled by tlsTimeout. + ConnectTimeout param.Field[int64] `json:"connectTimeout"` + // Disables chunked transfer encoding. Useful if you are running a WSGI server. + DisableChunkedEncoding param.Field[bool] `json:"disableChunkedEncoding"` + // Attempt to connect to origin using HTTP2. Origin must be configured as https. + Http2Origin param.Field[bool] `json:"http2Origin"` + // Sets the HTTP Host header on requests sent to the local service. + HTTPHostHeader param.Field[string] `json:"httpHostHeader"` + // Maximum number of idle keepalive connections between Tunnel and your origin. + // This does not restrict the total number of concurrent connections. + KeepAliveConnections param.Field[int64] `json:"keepAliveConnections"` + // Timeout after which an idle keepalive connection can be discarded. + KeepAliveTimeout param.Field[int64] `json:"keepAliveTimeout"` + // Disable the “happy eyeballs” algorithm for IPv4/IPv6 fallback if your local + // network has misconfigured one of the protocols. + NoHappyEyeballs param.Field[bool] `json:"noHappyEyeballs"` + // Disables TLS verification of the certificate presented by your origin. Will + // allow any certificate from the origin to be accepted. + NoTlsVerify param.Field[bool] `json:"noTLSVerify"` + // Hostname that cloudflared should expect from your origin server certificate. + OriginServerName param.Field[string] `json:"originServerName"` + // cloudflared starts a proxy server to translate HTTP traffic into TCP when + // proxying, for example, SSH or RDP. This configures what type of proxy will be + // started. Valid options are: "" for the regular proxy and "socks" for a SOCKS5 + // proxy. + ProxyType param.Field[string] `json:"proxyType"` + // The timeout after which a TCP keepalive packet is sent on a connection between + // Tunnel and the origin server. + TcpKeepAlive param.Field[int64] `json:"tcpKeepAlive"` + // Timeout for completing a TLS handshake to your origin server, if you have chosen + // to connect Tunnel to an HTTPS server. + TlsTimeout param.Field[int64] `json:"tlsTimeout"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// For all L7 requests to this hostname, cloudflared will validate each request's +// Cf-Access-Jwt-Assertion request header. +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequestAccess struct { + // Access applications that are allowed to reach this hostname for this Tunnel. + // Audience tags can be identified in the dashboard or via the List Access policies + // API. + AudTag param.Field[[]string] `json:"audTag,required"` + TeamName param.Field[string] `json:"teamName,required"` + // Deny traffic that has not fulfilled Access authorization. + Required param.Field[bool] `json:"required"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequestAccess) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configuration parameters of connection between cloudflared and origin server. +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequest struct { + // For all L7 requests to this hostname, cloudflared will validate each request's + // Cf-Access-Jwt-Assertion request header. + Access param.Field[AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequestAccess] `json:"access"` + // Path to the certificate authority (CA) for the certificate of your origin. This + // option should be used only if your certificate is not signed by Cloudflare. + CaPool param.Field[string] `json:"caPool"` + // Timeout for establishing a new TCP connection to your origin server. This + // excludes the time taken to establish TLS, which is controlled by tlsTimeout. + ConnectTimeout param.Field[int64] `json:"connectTimeout"` + // Disables chunked transfer encoding. Useful if you are running a WSGI server. + DisableChunkedEncoding param.Field[bool] `json:"disableChunkedEncoding"` + // Attempt to connect to origin using HTTP2. Origin must be configured as https. + Http2Origin param.Field[bool] `json:"http2Origin"` + // Sets the HTTP Host header on requests sent to the local service. + HTTPHostHeader param.Field[string] `json:"httpHostHeader"` + // Maximum number of idle keepalive connections between Tunnel and your origin. + // This does not restrict the total number of concurrent connections. + KeepAliveConnections param.Field[int64] `json:"keepAliveConnections"` + // Timeout after which an idle keepalive connection can be discarded. + KeepAliveTimeout param.Field[int64] `json:"keepAliveTimeout"` + // Disable the “happy eyeballs” algorithm for IPv4/IPv6 fallback if your local + // network has misconfigured one of the protocols. + NoHappyEyeballs param.Field[bool] `json:"noHappyEyeballs"` + // Disables TLS verification of the certificate presented by your origin. Will + // allow any certificate from the origin to be accepted. + NoTlsVerify param.Field[bool] `json:"noTLSVerify"` + // Hostname that cloudflared should expect from your origin server certificate. + OriginServerName param.Field[string] `json:"originServerName"` + // cloudflared starts a proxy server to translate HTTP traffic into TCP when + // proxying, for example, SSH or RDP. This configures what type of proxy will be + // started. Valid options are: "" for the regular proxy and "socks" for a SOCKS5 + // proxy. + ProxyType param.Field[string] `json:"proxyType"` + // The timeout after which a TCP keepalive packet is sent on a connection between + // Tunnel and the origin server. + TcpKeepAlive param.Field[int64] `json:"tcpKeepAlive"` + // Timeout for completing a TLS handshake to your origin server, if you have chosen + // to connect Tunnel to an HTTPS server. + TlsTimeout param.Field[int64] `json:"tlsTimeout"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// For all L7 requests to this hostname, cloudflared will validate each request's +// Cf-Access-Jwt-Assertion request header. +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequestAccess struct { + // Access applications that are allowed to reach this hostname for this Tunnel. + // Audience tags can be identified in the dashboard or via the List Access policies + // API. + AudTag param.Field[[]string] `json:"audTag,required"` + TeamName param.Field[string] `json:"teamName,required"` + // Deny traffic that has not fulfilled Access authorization. + Required param.Field[bool] `json:"required"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequestAccess) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enable private network access from WARP users to private network routes +type AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigWarpRouting struct { + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigWarpRouting) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountcfdtunnelconfiguration_test.go b/accountcfdtunnelconfiguration_test.go new file mode 100644 index 00000000000..ee8588b9869 --- /dev/null +++ b/accountcfdtunnelconfiguration_test.go @@ -0,0 +1,174 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Configurations.CloudflareTunnelConfigurationGetConfiguration( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Configurations.CloudflareTunnelConfigurationPutConfiguration( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParams{ + Config: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfig{ + Ingress: cloudflare.F([]cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngress{{ + Hostname: cloudflare.F("tunnel.example.com"), + OriginRequest: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequest{ + Access: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequestAccess{ + AudTag: cloudflare.F([]string{"string", "string", "string"}), + Required: cloudflare.F(true), + TeamName: cloudflare.F("string"), + }), + CaPool: cloudflare.F("string"), + ConnectTimeout: cloudflare.F(int64(0)), + DisableChunkedEncoding: cloudflare.F(true), + Http2Origin: cloudflare.F(true), + HTTPHostHeader: cloudflare.F("string"), + KeepAliveConnections: cloudflare.F(int64(0)), + KeepAliveTimeout: cloudflare.F(int64(0)), + NoHappyEyeballs: cloudflare.F(true), + NoTlsVerify: cloudflare.F(true), + OriginServerName: cloudflare.F("string"), + ProxyType: cloudflare.F("string"), + TcpKeepAlive: cloudflare.F(int64(0)), + TlsTimeout: cloudflare.F(int64(0)), + }), + Path: cloudflare.F("subpath"), + Service: cloudflare.F("https://localhost:8001"), + }, { + Hostname: cloudflare.F("tunnel.example.com"), + OriginRequest: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequest{ + Access: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequestAccess{ + AudTag: cloudflare.F([]string{"string", "string", "string"}), + Required: cloudflare.F(true), + TeamName: cloudflare.F("string"), + }), + CaPool: cloudflare.F("string"), + ConnectTimeout: cloudflare.F(int64(0)), + DisableChunkedEncoding: cloudflare.F(true), + Http2Origin: cloudflare.F(true), + HTTPHostHeader: cloudflare.F("string"), + KeepAliveConnections: cloudflare.F(int64(0)), + KeepAliveTimeout: cloudflare.F(int64(0)), + NoHappyEyeballs: cloudflare.F(true), + NoTlsVerify: cloudflare.F(true), + OriginServerName: cloudflare.F("string"), + ProxyType: cloudflare.F("string"), + TcpKeepAlive: cloudflare.F(int64(0)), + TlsTimeout: cloudflare.F(int64(0)), + }), + Path: cloudflare.F("subpath"), + Service: cloudflare.F("https://localhost:8001"), + }, { + Hostname: cloudflare.F("tunnel.example.com"), + OriginRequest: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequest{ + Access: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigIngressOriginRequestAccess{ + AudTag: cloudflare.F([]string{"string", "string", "string"}), + Required: cloudflare.F(true), + TeamName: cloudflare.F("string"), + }), + CaPool: cloudflare.F("string"), + ConnectTimeout: cloudflare.F(int64(0)), + DisableChunkedEncoding: cloudflare.F(true), + Http2Origin: cloudflare.F(true), + HTTPHostHeader: cloudflare.F("string"), + KeepAliveConnections: cloudflare.F(int64(0)), + KeepAliveTimeout: cloudflare.F(int64(0)), + NoHappyEyeballs: cloudflare.F(true), + NoTlsVerify: cloudflare.F(true), + OriginServerName: cloudflare.F("string"), + ProxyType: cloudflare.F("string"), + TcpKeepAlive: cloudflare.F(int64(0)), + TlsTimeout: cloudflare.F(int64(0)), + }), + Path: cloudflare.F("subpath"), + Service: cloudflare.F("https://localhost:8001"), + }}), + OriginRequest: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequest{ + Access: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigOriginRequestAccess{ + AudTag: cloudflare.F([]string{"string", "string", "string"}), + Required: cloudflare.F(true), + TeamName: cloudflare.F("string"), + }), + CaPool: cloudflare.F("string"), + ConnectTimeout: cloudflare.F(int64(0)), + DisableChunkedEncoding: cloudflare.F(true), + Http2Origin: cloudflare.F(true), + HTTPHostHeader: cloudflare.F("string"), + KeepAliveConnections: cloudflare.F(int64(0)), + KeepAliveTimeout: cloudflare.F(int64(0)), + NoHappyEyeballs: cloudflare.F(true), + NoTlsVerify: cloudflare.F(true), + OriginServerName: cloudflare.F("string"), + ProxyType: cloudflare.F("string"), + TcpKeepAlive: cloudflare.F(int64(0)), + TlsTimeout: cloudflare.F(int64(0)), + }), + WarpRouting: cloudflare.F(cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParamsConfigWarpRouting{ + Enabled: cloudflare.F(true), + }), + }), + }, + ) + 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/accountcfdtunnelconnection.go b/accountcfdtunnelconnection.go new file mode 100644 index 00000000000..b337c1bbe11 --- /dev/null +++ b/accountcfdtunnelconnection.go @@ -0,0 +1,327 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCfdTunnelConnectionService 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 +// [NewAccountCfdTunnelConnectionService] method instead. +type AccountCfdTunnelConnectionService struct { + Options []option.RequestOption +} + +// NewAccountCfdTunnelConnectionService 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 NewAccountCfdTunnelConnectionService(opts ...option.RequestOption) (r *AccountCfdTunnelConnectionService) { + r = &AccountCfdTunnelConnectionService{} + r.Options = opts + return +} + +// Removes a connection (aka Cloudflare Tunnel Connector) from a Cloudflare Tunnel +// independently of its current state. If no connector id (client_id) is provided +// all connectors will be removed. We recommend running this command after rotating +// tokens. +func (r *AccountCfdTunnelConnectionService) Delete(ctx context.Context, accountIdentifier string, tunnelID string, params AccountCfdTunnelConnectionDeleteParams, opts ...option.RequestOption) (res *AccountCfdTunnelConnectionDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s/connections", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &res, opts...) + return +} + +// Fetches connection details for a Cloudflare Tunnel. +func (r *AccountCfdTunnelConnectionService) CloudflareTunnelListCloudflareTunnelConnections(ctx context.Context, accountIdentifier string, tunnelID string, opts ...option.RequestOption) (res *AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s/connections", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountCfdTunnelConnectionDeleteResponse struct { + Errors []AccountCfdTunnelConnectionDeleteResponseError `json:"errors"` + Messages []AccountCfdTunnelConnectionDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelConnectionDeleteResponseSuccess `json:"success"` + JSON accountCfdTunnelConnectionDeleteResponseJSON `json:"-"` +} + +// accountCfdTunnelConnectionDeleteResponseJSON contains the JSON metadata for the +// struct [AccountCfdTunnelConnectionDeleteResponse] +type accountCfdTunnelConnectionDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectionDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConnectionDeleteResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelConnectionDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountCfdTunnelConnectionDeleteResponseError] +type accountCfdTunnelConnectionDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectionDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConnectionDeleteResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelConnectionDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountCfdTunnelConnectionDeleteResponseMessage] +type accountCfdTunnelConnectionDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCfdTunnelConnectionDeleteResponseSuccess bool + +const ( + AccountCfdTunnelConnectionDeleteResponseSuccessTrue AccountCfdTunnelConnectionDeleteResponseSuccess = true +) + +type AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponse struct { + Errors []AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseError `json:"errors"` + Messages []AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseMessage `json:"messages"` + Result []AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResult `json:"result"` + ResultInfo AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseSuccess `json:"success"` + JSON accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseJSON `json:"-"` +} + +// accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponse] +type accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseError] +type accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseMessage] +type accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A client (typically cloudflared) that maintains connections to a Cloudflare data +// center. +type AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResult struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // The cloudflared OS architecture used to establish this connection. + Arch string `json:"arch"` + // The version of the remote tunnel configuration. Used internally to sync + // cloudflared with the Zero Trust dashboard. + ConfigVersion int64 `json:"config_version"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Conns []AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultConn `json:"conns"` + // Features enabled for the Cloudflare Tunnel. + Features []string `json:"features"` + // Timestamp of when the tunnel connection was started. + RunAt time.Time `json:"run_at" format:"date-time"` + // The cloudflared version used to establish this connection. + Version string `json:"version"` + JSON accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultJSON `json:"-"` +} + +// accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResult] +type accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultJSON struct { + ID apijson.Field + Arch apijson.Field + ConfigVersion apijson.Field + Conns apijson.Field + Features apijson.Field + RunAt apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultConn struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultConnJSON `json:"-"` +} + +// accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultConnJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultConn] +type accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultConnJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultConn) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultInfoJSON `json:"-"` +} + +// accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultInfo] +type accountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseSuccess bool + +const ( + AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseSuccessTrue AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponseSuccess = true +) + +type AccountCfdTunnelConnectionDeleteParams struct { + Body param.Field[interface{}] `json:"body,required"` + // UUID of the Cloudflare Tunnel Connector to disconnect. + ClientID param.Field[string] `query:"client_id"` +} + +func (r AccountCfdTunnelConnectionDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +// URLQuery serializes [AccountCfdTunnelConnectionDeleteParams]'s query parameters +// as `url.Values`. +func (r AccountCfdTunnelConnectionDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountcfdtunnelconnection_test.go b/accountcfdtunnelconnection_test.go new file mode 100644 index 00000000000..43243044c04 --- /dev/null +++ b/accountcfdtunnelconnection_test.go @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCfdTunnelConnectionDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Connections.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountCfdTunnelConnectionDeleteParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + ClientID: cloudflare.F("string"), + }, + ) + 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 TestAccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnections(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Connections.CloudflareTunnelListCloudflareTunnelConnections( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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/accountcfdtunnelconnector.go b/accountcfdtunnelconnector.go new file mode 100644 index 00000000000..a79b01da062 --- /dev/null +++ b/accountcfdtunnelconnector.go @@ -0,0 +1,192 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCfdTunnelConnectorService 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 +// [NewAccountCfdTunnelConnectorService] method instead. +type AccountCfdTunnelConnectorService struct { + Options []option.RequestOption +} + +// NewAccountCfdTunnelConnectorService 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 NewAccountCfdTunnelConnectorService(opts ...option.RequestOption) (r *AccountCfdTunnelConnectorService) { + r = &AccountCfdTunnelConnectorService{} + r.Options = opts + return +} + +// Fetches connector and connection details for a Cloudflare Tunnel. +func (r *AccountCfdTunnelConnectorService) Get(ctx context.Context, accountIdentifier string, tunnelID string, connectorID string, opts ...option.RequestOption) (res *AccountCfdTunnelConnectorGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s/connectors/%s", accountIdentifier, tunnelID, connectorID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountCfdTunnelConnectorGetResponse struct { + Errors []AccountCfdTunnelConnectorGetResponseError `json:"errors"` + Messages []AccountCfdTunnelConnectorGetResponseMessage `json:"messages"` + // A client (typically cloudflared) that maintains connections to a Cloudflare data + // center. + Result AccountCfdTunnelConnectorGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelConnectorGetResponseSuccess `json:"success"` + JSON accountCfdTunnelConnectorGetResponseJSON `json:"-"` +} + +// accountCfdTunnelConnectorGetResponseJSON contains the JSON metadata for the +// struct [AccountCfdTunnelConnectorGetResponse] +type accountCfdTunnelConnectorGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectorGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectorGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConnectorGetResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelConnectorGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountCfdTunnelConnectorGetResponseError] +type accountCfdTunnelConnectorGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectorGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectorGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelConnectorGetResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelConnectorGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountCfdTunnelConnectorGetResponseMessage] +type accountCfdTunnelConnectorGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectorGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A client (typically cloudflared) that maintains connections to a Cloudflare data +// center. +type AccountCfdTunnelConnectorGetResponseResult struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // The cloudflared OS architecture used to establish this connection. + Arch string `json:"arch"` + // The version of the remote tunnel configuration. Used internally to sync + // cloudflared with the Zero Trust dashboard. + ConfigVersion int64 `json:"config_version"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Conns []AccountCfdTunnelConnectorGetResponseResultConn `json:"conns"` + // Features enabled for the Cloudflare Tunnel. + Features []string `json:"features"` + // Timestamp of when the tunnel connection was started. + RunAt time.Time `json:"run_at" format:"date-time"` + // The cloudflared version used to establish this connection. + Version string `json:"version"` + JSON accountCfdTunnelConnectorGetResponseResultJSON `json:"-"` +} + +// accountCfdTunnelConnectorGetResponseResultJSON contains the JSON metadata for +// the struct [AccountCfdTunnelConnectorGetResponseResult] +type accountCfdTunnelConnectorGetResponseResultJSON struct { + ID apijson.Field + Arch apijson.Field + ConfigVersion apijson.Field + Conns apijson.Field + Features apijson.Field + RunAt apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectorGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelConnectorGetResponseResultConn struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountCfdTunnelConnectorGetResponseResultConnJSON `json:"-"` +} + +// accountCfdTunnelConnectorGetResponseResultConnJSON contains the JSON metadata +// for the struct [AccountCfdTunnelConnectorGetResponseResultConn] +type accountCfdTunnelConnectorGetResponseResultConnJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelConnectorGetResponseResultConn) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCfdTunnelConnectorGetResponseSuccess bool + +const ( + AccountCfdTunnelConnectorGetResponseSuccessTrue AccountCfdTunnelConnectorGetResponseSuccess = true +) diff --git a/accountcfdtunnelconnector_test.go b/accountcfdtunnelconnector_test.go new file mode 100644 index 00000000000..10dec5dfedb --- /dev/null +++ b/accountcfdtunnelconnector_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCfdTunnelConnectorGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Connectors.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + "1bedc50d-42b3-473c-b108-ff3d10c0d925", + ) + 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/accountcfdtunnelmanagement.go b/accountcfdtunnelmanagement.go new file mode 100644 index 00000000000..4559a40f53a --- /dev/null +++ b/accountcfdtunnelmanagement.go @@ -0,0 +1,125 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCfdTunnelManagementService 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 +// [NewAccountCfdTunnelManagementService] method instead. +type AccountCfdTunnelManagementService struct { + Options []option.RequestOption +} + +// NewAccountCfdTunnelManagementService 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 NewAccountCfdTunnelManagementService(opts ...option.RequestOption) (r *AccountCfdTunnelManagementService) { + r = &AccountCfdTunnelManagementService{} + r.Options = opts + return +} + +// Gets a management token used to access the management resources (i.e. Streaming +// Logs) of a tunnel. +func (r *AccountCfdTunnelManagementService) List(ctx context.Context, accountIdentifier string, tunnelID string, body AccountCfdTunnelManagementListParams, opts ...option.RequestOption) (res *AccountCfdTunnelManagementListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s/management", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountCfdTunnelManagementListResponse struct { + Errors []AccountCfdTunnelManagementListResponseError `json:"errors"` + Messages []AccountCfdTunnelManagementListResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelManagementListResponseSuccess `json:"success"` + JSON accountCfdTunnelManagementListResponseJSON `json:"-"` +} + +// accountCfdTunnelManagementListResponseJSON contains the JSON metadata for the +// struct [AccountCfdTunnelManagementListResponse] +type accountCfdTunnelManagementListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelManagementListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelManagementListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelManagementListResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelManagementListResponseErrorJSON contains the JSON metadata for +// the struct [AccountCfdTunnelManagementListResponseError] +type accountCfdTunnelManagementListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelManagementListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelManagementListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelManagementListResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelManagementListResponseMessageJSON contains the JSON metadata for +// the struct [AccountCfdTunnelManagementListResponseMessage] +type accountCfdTunnelManagementListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelManagementListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCfdTunnelManagementListResponseSuccess bool + +const ( + AccountCfdTunnelManagementListResponseSuccessTrue AccountCfdTunnelManagementListResponseSuccess = true +) + +type AccountCfdTunnelManagementListParams struct { + Resources param.Field[[]AccountCfdTunnelManagementListParamsResource] `json:"resources,required"` +} + +func (r AccountCfdTunnelManagementListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Management resources the token will have access to. +type AccountCfdTunnelManagementListParamsResource string + +const ( + AccountCfdTunnelManagementListParamsResourceLogs AccountCfdTunnelManagementListParamsResource = "logs" +) diff --git a/accountcfdtunnelmanagement_test.go b/accountcfdtunnelmanagement_test.go new file mode 100644 index 00000000000..5a95c42c330 --- /dev/null +++ b/accountcfdtunnelmanagement_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCfdTunnelManagementList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Management.List( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountCfdTunnelManagementListParams{ + Resources: cloudflare.F([]cloudflare.AccountCfdTunnelManagementListParamsResource{cloudflare.AccountCfdTunnelManagementListParamsResourceLogs}), + }, + ) + 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/accountcfdtunneltoken.go b/accountcfdtunneltoken.go new file mode 100644 index 00000000000..d8d69b256bd --- /dev/null +++ b/accountcfdtunneltoken.go @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCfdTunnelTokenService 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 [NewAccountCfdTunnelTokenService] +// method instead. +type AccountCfdTunnelTokenService struct { + Options []option.RequestOption +} + +// NewAccountCfdTunnelTokenService 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 NewAccountCfdTunnelTokenService(opts ...option.RequestOption) (r *AccountCfdTunnelTokenService) { + r = &AccountCfdTunnelTokenService{} + r.Options = opts + return +} + +// Gets the token used to associate cloudflared with a specific tunnel. +func (r *AccountCfdTunnelTokenService) CloudflareTunnelGetACloudflareTunnelToken(ctx context.Context, accountIdentifier string, tunnelID string, opts ...option.RequestOption) (res *AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s/token", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponse struct { + Errors []AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseError `json:"errors"` + Messages []AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseSuccess `json:"success"` + JSON accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseJSON `json:"-"` +} + +// accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponse] +type accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseErrorJSON `json:"-"` +} + +// accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseError] +type accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseMessageJSON `json:"-"` +} + +// accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseMessage] +type accountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseSuccess bool + +const ( + AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseSuccessTrue AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponseSuccess = true +) diff --git a/accountcfdtunneltoken_test.go b/accountcfdtunneltoken_test.go new file mode 100644 index 00000000000..89d17cc3d73 --- /dev/null +++ b/accountcfdtunneltoken_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelToken(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CfdTunnels.Tokens.CloudflareTunnelGetACloudflareTunnelToken( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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/accountchallenge.go b/accountchallenge.go new file mode 100644 index 00000000000..ad5292a7c01 --- /dev/null +++ b/accountchallenge.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountChallengeService 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 [NewAccountChallengeService] method +// instead. +type AccountChallengeService struct { + Options []option.RequestOption + Widgets *AccountChallengeWidgetService +} + +// NewAccountChallengeService 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 NewAccountChallengeService(opts ...option.RequestOption) (r *AccountChallengeService) { + r = &AccountChallengeService{} + r.Options = opts + r.Widgets = NewAccountChallengeWidgetService(opts...) + return +} diff --git a/accountchallengewidget.go b/accountchallengewidget.go new file mode 100644 index 00000000000..3f4d9daa503 --- /dev/null +++ b/accountchallengewidget.go @@ -0,0 +1,1091 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountChallengeWidgetService 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 [NewAccountChallengeWidgetService] +// method instead. +type AccountChallengeWidgetService struct { + Options []option.RequestOption +} + +// NewAccountChallengeWidgetService 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 NewAccountChallengeWidgetService(opts ...option.RequestOption) (r *AccountChallengeWidgetService) { + r = &AccountChallengeWidgetService{} + r.Options = opts + return +} + +// Lists challenge widgets. +func (r *AccountChallengeWidgetService) New(ctx context.Context, accountIdentifier string, params AccountChallengeWidgetNewParams, opts ...option.RequestOption) (res *AccountChallengeWidgetNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/challenges/widgets", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) + return +} + +// Show a single challenge widget configuration. +func (r *AccountChallengeWidgetService) Get(ctx context.Context, accountIdentifier string, sitekey string, opts ...option.RequestOption) (res *AccountChallengeWidgetGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/challenges/widgets/%s", accountIdentifier, sitekey) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update the configuration of a widget. +func (r *AccountChallengeWidgetService) Update(ctx context.Context, accountIdentifier string, sitekey string, body AccountChallengeWidgetUpdateParams, opts ...option.RequestOption) (res *AccountChallengeWidgetUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/challenges/widgets/%s", accountIdentifier, sitekey) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists all turnstile widgets of an account. +func (r *AccountChallengeWidgetService) List(ctx context.Context, accountIdentifier string, query AccountChallengeWidgetListParams, opts ...option.RequestOption) (res *shared.Page[AccountChallengeWidgetListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/challenges/widgets", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Destroy a Turnstile Widget. +func (r *AccountChallengeWidgetService) Delete(ctx context.Context, accountIdentifier string, sitekey string, opts ...option.RequestOption) (res *AccountChallengeWidgetDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/challenges/widgets/%s", accountIdentifier, sitekey) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Generate a new secret key for this widget. If `invalidate_immediately` is set to +// `false`, the previous secret remains valid for 2 hours. +// +// Note that secrets cannot be rotated again during the grace period. +func (r *AccountChallengeWidgetService) RotateSecret(ctx context.Context, accountIdentifier string, sitekey string, body AccountChallengeWidgetRotateSecretParams, opts ...option.RequestOption) (res *AccountChallengeWidgetRotateSecretResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/challenges/widgets/%s/rotate_secret", accountIdentifier, sitekey) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountChallengeWidgetNewResponse struct { + Errors []AccountChallengeWidgetNewResponseError `json:"errors"` + Messages []AccountChallengeWidgetNewResponseMessage `json:"messages"` + // A Turnstile widget's detailed configuration + Result AccountChallengeWidgetNewResponseResult `json:"result"` + ResultInfo AccountChallengeWidgetNewResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success bool `json:"success"` + JSON accountChallengeWidgetNewResponseJSON `json:"-"` +} + +// accountChallengeWidgetNewResponseJSON contains the JSON metadata for the struct +// [AccountChallengeWidgetNewResponse] +type accountChallengeWidgetNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetNewResponseErrorJSON `json:"-"` +} + +// accountChallengeWidgetNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetNewResponseError] +type accountChallengeWidgetNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetNewResponseMessageJSON `json:"-"` +} + +// accountChallengeWidgetNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetNewResponseMessage] +type accountChallengeWidgetNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Turnstile widget's detailed configuration +type AccountChallengeWidgetNewResponseResult struct { + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode bool `json:"bot_fight_mode,required"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel AccountChallengeWidgetNewResponseResultClearanceLevel `json:"clearance_level,required"` + // When the widget was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + Domains []string `json:"domains,required"` + // Widget Mode + Mode AccountChallengeWidgetNewResponseResultMode `json:"mode,required"` + // When the widget was modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name string `json:"name,required"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel bool `json:"offlabel,required"` + // Region where this widget can be used. + Region AccountChallengeWidgetNewResponseResultRegion `json:"region,required"` + // Secret key for this widget. + Secret string `json:"secret,required"` + // Widget item identifier tag. + Sitekey string `json:"sitekey,required"` + JSON accountChallengeWidgetNewResponseResultJSON `json:"-"` +} + +// accountChallengeWidgetNewResponseResultJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetNewResponseResult] +type accountChallengeWidgetNewResponseResultJSON struct { + BotFightMode apijson.Field + ClearanceLevel apijson.Field + CreatedOn apijson.Field + Domains apijson.Field + Mode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Offlabel apijson.Field + Region apijson.Field + Secret apijson.Field + Sitekey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetNewResponseResultClearanceLevel string + +const ( + AccountChallengeWidgetNewResponseResultClearanceLevelNoClearance AccountChallengeWidgetNewResponseResultClearanceLevel = "no_clearance" + AccountChallengeWidgetNewResponseResultClearanceLevelJschallenge AccountChallengeWidgetNewResponseResultClearanceLevel = "jschallenge" + AccountChallengeWidgetNewResponseResultClearanceLevelManaged AccountChallengeWidgetNewResponseResultClearanceLevel = "managed" + AccountChallengeWidgetNewResponseResultClearanceLevelInteractive AccountChallengeWidgetNewResponseResultClearanceLevel = "interactive" +) + +// Widget Mode +type AccountChallengeWidgetNewResponseResultMode string + +const ( + AccountChallengeWidgetNewResponseResultModeNonInteractive AccountChallengeWidgetNewResponseResultMode = "non-interactive" + AccountChallengeWidgetNewResponseResultModeInvisible AccountChallengeWidgetNewResponseResultMode = "invisible" + AccountChallengeWidgetNewResponseResultModeManaged AccountChallengeWidgetNewResponseResultMode = "managed" +) + +// Region where this widget can be used. +type AccountChallengeWidgetNewResponseResultRegion string + +const ( + AccountChallengeWidgetNewResponseResultRegionWorld AccountChallengeWidgetNewResponseResultRegion = "world" +) + +type AccountChallengeWidgetNewResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count,required"` + // Current page within paginated list of results + Page float64 `json:"page,required"` + // Number of results per page of results + PerPage float64 `json:"per_page,required"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count,required"` + JSON accountChallengeWidgetNewResponseResultInfoJSON `json:"-"` +} + +// accountChallengeWidgetNewResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountChallengeWidgetNewResponseResultInfo] +type accountChallengeWidgetNewResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetNewResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetGetResponse struct { + Errors []AccountChallengeWidgetGetResponseError `json:"errors"` + Messages []AccountChallengeWidgetGetResponseMessage `json:"messages"` + // A Turnstile widget's detailed configuration + Result AccountChallengeWidgetGetResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON accountChallengeWidgetGetResponseJSON `json:"-"` +} + +// accountChallengeWidgetGetResponseJSON contains the JSON metadata for the struct +// [AccountChallengeWidgetGetResponse] +type accountChallengeWidgetGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetGetResponseErrorJSON `json:"-"` +} + +// accountChallengeWidgetGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetGetResponseError] +type accountChallengeWidgetGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetGetResponseMessageJSON `json:"-"` +} + +// accountChallengeWidgetGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetGetResponseMessage] +type accountChallengeWidgetGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Turnstile widget's detailed configuration +type AccountChallengeWidgetGetResponseResult struct { + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode bool `json:"bot_fight_mode,required"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel AccountChallengeWidgetGetResponseResultClearanceLevel `json:"clearance_level,required"` + // When the widget was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + Domains []string `json:"domains,required"` + // Widget Mode + Mode AccountChallengeWidgetGetResponseResultMode `json:"mode,required"` + // When the widget was modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name string `json:"name,required"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel bool `json:"offlabel,required"` + // Region where this widget can be used. + Region AccountChallengeWidgetGetResponseResultRegion `json:"region,required"` + // Secret key for this widget. + Secret string `json:"secret,required"` + // Widget item identifier tag. + Sitekey string `json:"sitekey,required"` + JSON accountChallengeWidgetGetResponseResultJSON `json:"-"` +} + +// accountChallengeWidgetGetResponseResultJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetGetResponseResult] +type accountChallengeWidgetGetResponseResultJSON struct { + BotFightMode apijson.Field + ClearanceLevel apijson.Field + CreatedOn apijson.Field + Domains apijson.Field + Mode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Offlabel apijson.Field + Region apijson.Field + Secret apijson.Field + Sitekey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetGetResponseResultClearanceLevel string + +const ( + AccountChallengeWidgetGetResponseResultClearanceLevelNoClearance AccountChallengeWidgetGetResponseResultClearanceLevel = "no_clearance" + AccountChallengeWidgetGetResponseResultClearanceLevelJschallenge AccountChallengeWidgetGetResponseResultClearanceLevel = "jschallenge" + AccountChallengeWidgetGetResponseResultClearanceLevelManaged AccountChallengeWidgetGetResponseResultClearanceLevel = "managed" + AccountChallengeWidgetGetResponseResultClearanceLevelInteractive AccountChallengeWidgetGetResponseResultClearanceLevel = "interactive" +) + +// Widget Mode +type AccountChallengeWidgetGetResponseResultMode string + +const ( + AccountChallengeWidgetGetResponseResultModeNonInteractive AccountChallengeWidgetGetResponseResultMode = "non-interactive" + AccountChallengeWidgetGetResponseResultModeInvisible AccountChallengeWidgetGetResponseResultMode = "invisible" + AccountChallengeWidgetGetResponseResultModeManaged AccountChallengeWidgetGetResponseResultMode = "managed" +) + +// Region where this widget can be used. +type AccountChallengeWidgetGetResponseResultRegion string + +const ( + AccountChallengeWidgetGetResponseResultRegionWorld AccountChallengeWidgetGetResponseResultRegion = "world" +) + +type AccountChallengeWidgetUpdateResponse struct { + Errors []AccountChallengeWidgetUpdateResponseError `json:"errors"` + Messages []AccountChallengeWidgetUpdateResponseMessage `json:"messages"` + // A Turnstile widget's detailed configuration + Result AccountChallengeWidgetUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON accountChallengeWidgetUpdateResponseJSON `json:"-"` +} + +// accountChallengeWidgetUpdateResponseJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetUpdateResponse] +type accountChallengeWidgetUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetUpdateResponseErrorJSON `json:"-"` +} + +// accountChallengeWidgetUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetUpdateResponseError] +type accountChallengeWidgetUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetUpdateResponseMessageJSON `json:"-"` +} + +// accountChallengeWidgetUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountChallengeWidgetUpdateResponseMessage] +type accountChallengeWidgetUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Turnstile widget's detailed configuration +type AccountChallengeWidgetUpdateResponseResult struct { + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode bool `json:"bot_fight_mode,required"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel AccountChallengeWidgetUpdateResponseResultClearanceLevel `json:"clearance_level,required"` + // When the widget was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + Domains []string `json:"domains,required"` + // Widget Mode + Mode AccountChallengeWidgetUpdateResponseResultMode `json:"mode,required"` + // When the widget was modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name string `json:"name,required"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel bool `json:"offlabel,required"` + // Region where this widget can be used. + Region AccountChallengeWidgetUpdateResponseResultRegion `json:"region,required"` + // Secret key for this widget. + Secret string `json:"secret,required"` + // Widget item identifier tag. + Sitekey string `json:"sitekey,required"` + JSON accountChallengeWidgetUpdateResponseResultJSON `json:"-"` +} + +// accountChallengeWidgetUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountChallengeWidgetUpdateResponseResult] +type accountChallengeWidgetUpdateResponseResultJSON struct { + BotFightMode apijson.Field + ClearanceLevel apijson.Field + CreatedOn apijson.Field + Domains apijson.Field + Mode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Offlabel apijson.Field + Region apijson.Field + Secret apijson.Field + Sitekey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetUpdateResponseResultClearanceLevel string + +const ( + AccountChallengeWidgetUpdateResponseResultClearanceLevelNoClearance AccountChallengeWidgetUpdateResponseResultClearanceLevel = "no_clearance" + AccountChallengeWidgetUpdateResponseResultClearanceLevelJschallenge AccountChallengeWidgetUpdateResponseResultClearanceLevel = "jschallenge" + AccountChallengeWidgetUpdateResponseResultClearanceLevelManaged AccountChallengeWidgetUpdateResponseResultClearanceLevel = "managed" + AccountChallengeWidgetUpdateResponseResultClearanceLevelInteractive AccountChallengeWidgetUpdateResponseResultClearanceLevel = "interactive" +) + +// Widget Mode +type AccountChallengeWidgetUpdateResponseResultMode string + +const ( + AccountChallengeWidgetUpdateResponseResultModeNonInteractive AccountChallengeWidgetUpdateResponseResultMode = "non-interactive" + AccountChallengeWidgetUpdateResponseResultModeInvisible AccountChallengeWidgetUpdateResponseResultMode = "invisible" + AccountChallengeWidgetUpdateResponseResultModeManaged AccountChallengeWidgetUpdateResponseResultMode = "managed" +) + +// Region where this widget can be used. +type AccountChallengeWidgetUpdateResponseResultRegion string + +const ( + AccountChallengeWidgetUpdateResponseResultRegionWorld AccountChallengeWidgetUpdateResponseResultRegion = "world" +) + +// A Turnstile Widgets configuration as it appears in listings +type AccountChallengeWidgetListResponse struct { + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode bool `json:"bot_fight_mode,required"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel AccountChallengeWidgetListResponseClearanceLevel `json:"clearance_level,required"` + // When the widget was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + Domains []string `json:"domains,required"` + // Widget Mode + Mode AccountChallengeWidgetListResponseMode `json:"mode,required"` + // When the widget was modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name string `json:"name,required"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel bool `json:"offlabel,required"` + // Region where this widget can be used. + Region AccountChallengeWidgetListResponseRegion `json:"region,required"` + // Widget item identifier tag. + Sitekey string `json:"sitekey,required"` + JSON accountChallengeWidgetListResponseJSON `json:"-"` +} + +// accountChallengeWidgetListResponseJSON contains the JSON metadata for the struct +// [AccountChallengeWidgetListResponse] +type accountChallengeWidgetListResponseJSON struct { + BotFightMode apijson.Field + ClearanceLevel apijson.Field + CreatedOn apijson.Field + Domains apijson.Field + Mode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Offlabel apijson.Field + Region apijson.Field + Sitekey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetListResponseClearanceLevel string + +const ( + AccountChallengeWidgetListResponseClearanceLevelNoClearance AccountChallengeWidgetListResponseClearanceLevel = "no_clearance" + AccountChallengeWidgetListResponseClearanceLevelJschallenge AccountChallengeWidgetListResponseClearanceLevel = "jschallenge" + AccountChallengeWidgetListResponseClearanceLevelManaged AccountChallengeWidgetListResponseClearanceLevel = "managed" + AccountChallengeWidgetListResponseClearanceLevelInteractive AccountChallengeWidgetListResponseClearanceLevel = "interactive" +) + +// Widget Mode +type AccountChallengeWidgetListResponseMode string + +const ( + AccountChallengeWidgetListResponseModeNonInteractive AccountChallengeWidgetListResponseMode = "non-interactive" + AccountChallengeWidgetListResponseModeInvisible AccountChallengeWidgetListResponseMode = "invisible" + AccountChallengeWidgetListResponseModeManaged AccountChallengeWidgetListResponseMode = "managed" +) + +// Region where this widget can be used. +type AccountChallengeWidgetListResponseRegion string + +const ( + AccountChallengeWidgetListResponseRegionWorld AccountChallengeWidgetListResponseRegion = "world" +) + +type AccountChallengeWidgetDeleteResponse struct { + Errors []AccountChallengeWidgetDeleteResponseError `json:"errors"` + Messages []AccountChallengeWidgetDeleteResponseMessage `json:"messages"` + // A Turnstile widget's detailed configuration + Result AccountChallengeWidgetDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON accountChallengeWidgetDeleteResponseJSON `json:"-"` +} + +// accountChallengeWidgetDeleteResponseJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetDeleteResponse] +type accountChallengeWidgetDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetDeleteResponseErrorJSON `json:"-"` +} + +// accountChallengeWidgetDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountChallengeWidgetDeleteResponseError] +type accountChallengeWidgetDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetDeleteResponseMessageJSON `json:"-"` +} + +// accountChallengeWidgetDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountChallengeWidgetDeleteResponseMessage] +type accountChallengeWidgetDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Turnstile widget's detailed configuration +type AccountChallengeWidgetDeleteResponseResult struct { + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode bool `json:"bot_fight_mode,required"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel AccountChallengeWidgetDeleteResponseResultClearanceLevel `json:"clearance_level,required"` + // When the widget was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + Domains []string `json:"domains,required"` + // Widget Mode + Mode AccountChallengeWidgetDeleteResponseResultMode `json:"mode,required"` + // When the widget was modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name string `json:"name,required"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel bool `json:"offlabel,required"` + // Region where this widget can be used. + Region AccountChallengeWidgetDeleteResponseResultRegion `json:"region,required"` + // Secret key for this widget. + Secret string `json:"secret,required"` + // Widget item identifier tag. + Sitekey string `json:"sitekey,required"` + JSON accountChallengeWidgetDeleteResponseResultJSON `json:"-"` +} + +// accountChallengeWidgetDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountChallengeWidgetDeleteResponseResult] +type accountChallengeWidgetDeleteResponseResultJSON struct { + BotFightMode apijson.Field + ClearanceLevel apijson.Field + CreatedOn apijson.Field + Domains apijson.Field + Mode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Offlabel apijson.Field + Region apijson.Field + Secret apijson.Field + Sitekey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetDeleteResponseResultClearanceLevel string + +const ( + AccountChallengeWidgetDeleteResponseResultClearanceLevelNoClearance AccountChallengeWidgetDeleteResponseResultClearanceLevel = "no_clearance" + AccountChallengeWidgetDeleteResponseResultClearanceLevelJschallenge AccountChallengeWidgetDeleteResponseResultClearanceLevel = "jschallenge" + AccountChallengeWidgetDeleteResponseResultClearanceLevelManaged AccountChallengeWidgetDeleteResponseResultClearanceLevel = "managed" + AccountChallengeWidgetDeleteResponseResultClearanceLevelInteractive AccountChallengeWidgetDeleteResponseResultClearanceLevel = "interactive" +) + +// Widget Mode +type AccountChallengeWidgetDeleteResponseResultMode string + +const ( + AccountChallengeWidgetDeleteResponseResultModeNonInteractive AccountChallengeWidgetDeleteResponseResultMode = "non-interactive" + AccountChallengeWidgetDeleteResponseResultModeInvisible AccountChallengeWidgetDeleteResponseResultMode = "invisible" + AccountChallengeWidgetDeleteResponseResultModeManaged AccountChallengeWidgetDeleteResponseResultMode = "managed" +) + +// Region where this widget can be used. +type AccountChallengeWidgetDeleteResponseResultRegion string + +const ( + AccountChallengeWidgetDeleteResponseResultRegionWorld AccountChallengeWidgetDeleteResponseResultRegion = "world" +) + +type AccountChallengeWidgetRotateSecretResponse struct { + Errors []AccountChallengeWidgetRotateSecretResponseError `json:"errors"` + Messages []AccountChallengeWidgetRotateSecretResponseMessage `json:"messages"` + // A Turnstile widget's detailed configuration + Result AccountChallengeWidgetRotateSecretResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON accountChallengeWidgetRotateSecretResponseJSON `json:"-"` +} + +// accountChallengeWidgetRotateSecretResponseJSON contains the JSON metadata for +// the struct [AccountChallengeWidgetRotateSecretResponse] +type accountChallengeWidgetRotateSecretResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetRotateSecretResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetRotateSecretResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetRotateSecretResponseErrorJSON `json:"-"` +} + +// accountChallengeWidgetRotateSecretResponseErrorJSON contains the JSON metadata +// for the struct [AccountChallengeWidgetRotateSecretResponseError] +type accountChallengeWidgetRotateSecretResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetRotateSecretResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountChallengeWidgetRotateSecretResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountChallengeWidgetRotateSecretResponseMessageJSON `json:"-"` +} + +// accountChallengeWidgetRotateSecretResponseMessageJSON contains the JSON metadata +// for the struct [AccountChallengeWidgetRotateSecretResponseMessage] +type accountChallengeWidgetRotateSecretResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetRotateSecretResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Turnstile widget's detailed configuration +type AccountChallengeWidgetRotateSecretResponseResult struct { + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode bool `json:"bot_fight_mode,required"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel AccountChallengeWidgetRotateSecretResponseResultClearanceLevel `json:"clearance_level,required"` + // When the widget was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + Domains []string `json:"domains,required"` + // Widget Mode + Mode AccountChallengeWidgetRotateSecretResponseResultMode `json:"mode,required"` + // When the widget was modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name string `json:"name,required"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel bool `json:"offlabel,required"` + // Region where this widget can be used. + Region AccountChallengeWidgetRotateSecretResponseResultRegion `json:"region,required"` + // Secret key for this widget. + Secret string `json:"secret,required"` + // Widget item identifier tag. + Sitekey string `json:"sitekey,required"` + JSON accountChallengeWidgetRotateSecretResponseResultJSON `json:"-"` +} + +// accountChallengeWidgetRotateSecretResponseResultJSON contains the JSON metadata +// for the struct [AccountChallengeWidgetRotateSecretResponseResult] +type accountChallengeWidgetRotateSecretResponseResultJSON struct { + BotFightMode apijson.Field + ClearanceLevel apijson.Field + CreatedOn apijson.Field + Domains apijson.Field + Mode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Offlabel apijson.Field + Region apijson.Field + Secret apijson.Field + Sitekey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountChallengeWidgetRotateSecretResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetRotateSecretResponseResultClearanceLevel string + +const ( + AccountChallengeWidgetRotateSecretResponseResultClearanceLevelNoClearance AccountChallengeWidgetRotateSecretResponseResultClearanceLevel = "no_clearance" + AccountChallengeWidgetRotateSecretResponseResultClearanceLevelJschallenge AccountChallengeWidgetRotateSecretResponseResultClearanceLevel = "jschallenge" + AccountChallengeWidgetRotateSecretResponseResultClearanceLevelManaged AccountChallengeWidgetRotateSecretResponseResultClearanceLevel = "managed" + AccountChallengeWidgetRotateSecretResponseResultClearanceLevelInteractive AccountChallengeWidgetRotateSecretResponseResultClearanceLevel = "interactive" +) + +// Widget Mode +type AccountChallengeWidgetRotateSecretResponseResultMode string + +const ( + AccountChallengeWidgetRotateSecretResponseResultModeNonInteractive AccountChallengeWidgetRotateSecretResponseResultMode = "non-interactive" + AccountChallengeWidgetRotateSecretResponseResultModeInvisible AccountChallengeWidgetRotateSecretResponseResultMode = "invisible" + AccountChallengeWidgetRotateSecretResponseResultModeManaged AccountChallengeWidgetRotateSecretResponseResultMode = "managed" +) + +// Region where this widget can be used. +type AccountChallengeWidgetRotateSecretResponseResultRegion string + +const ( + AccountChallengeWidgetRotateSecretResponseResultRegionWorld AccountChallengeWidgetRotateSecretResponseResultRegion = "world" +) + +type AccountChallengeWidgetNewParams struct { + Domains param.Field[[]string] `json:"domains,required"` + // Widget Mode + Mode param.Field[AccountChallengeWidgetNewParamsMode] `json:"mode,required"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name param.Field[string] `json:"name,required"` + // Direction to order widgets. + Direction param.Field[AccountChallengeWidgetNewParamsDirection] `query:"direction"` + // Field to order widgets by. + Order param.Field[AccountChallengeWidgetNewParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode param.Field[bool] `json:"bot_fight_mode"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel param.Field[AccountChallengeWidgetNewParamsClearanceLevel] `json:"clearance_level"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel param.Field[bool] `json:"offlabel"` + // Region where this widget can be used. + Region param.Field[AccountChallengeWidgetNewParamsRegion] `json:"region"` +} + +func (r AccountChallengeWidgetNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// URLQuery serializes [AccountChallengeWidgetNewParams]'s query parameters as +// `url.Values`. +func (r AccountChallengeWidgetNewParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Widget Mode +type AccountChallengeWidgetNewParamsMode string + +const ( + AccountChallengeWidgetNewParamsModeNonInteractive AccountChallengeWidgetNewParamsMode = "non-interactive" + AccountChallengeWidgetNewParamsModeInvisible AccountChallengeWidgetNewParamsMode = "invisible" + AccountChallengeWidgetNewParamsModeManaged AccountChallengeWidgetNewParamsMode = "managed" +) + +// Direction to order widgets. +type AccountChallengeWidgetNewParamsDirection string + +const ( + AccountChallengeWidgetNewParamsDirectionAsc AccountChallengeWidgetNewParamsDirection = "asc" + AccountChallengeWidgetNewParamsDirectionDesc AccountChallengeWidgetNewParamsDirection = "desc" +) + +// Field to order widgets by. +type AccountChallengeWidgetNewParamsOrder string + +const ( + AccountChallengeWidgetNewParamsOrderID AccountChallengeWidgetNewParamsOrder = "id" + AccountChallengeWidgetNewParamsOrderSitekey AccountChallengeWidgetNewParamsOrder = "sitekey" + AccountChallengeWidgetNewParamsOrderName AccountChallengeWidgetNewParamsOrder = "name" + AccountChallengeWidgetNewParamsOrderCreatedOn AccountChallengeWidgetNewParamsOrder = "created_on" + AccountChallengeWidgetNewParamsOrderModifiedOn AccountChallengeWidgetNewParamsOrder = "modified_on" +) + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetNewParamsClearanceLevel string + +const ( + AccountChallengeWidgetNewParamsClearanceLevelNoClearance AccountChallengeWidgetNewParamsClearanceLevel = "no_clearance" + AccountChallengeWidgetNewParamsClearanceLevelJschallenge AccountChallengeWidgetNewParamsClearanceLevel = "jschallenge" + AccountChallengeWidgetNewParamsClearanceLevelManaged AccountChallengeWidgetNewParamsClearanceLevel = "managed" + AccountChallengeWidgetNewParamsClearanceLevelInteractive AccountChallengeWidgetNewParamsClearanceLevel = "interactive" +) + +// Region where this widget can be used. +type AccountChallengeWidgetNewParamsRegion string + +const ( + AccountChallengeWidgetNewParamsRegionWorld AccountChallengeWidgetNewParamsRegion = "world" +) + +type AccountChallengeWidgetUpdateParams struct { + Domains param.Field[[]string] `json:"domains,required"` + // Widget Mode + Mode param.Field[AccountChallengeWidgetUpdateParamsMode] `json:"mode,required"` + // Human readable widget name. Not unique. Cloudflare suggests that you set this to + // a meaningful string to make it easier to identify your widget, and where it is + // used. + Name param.Field[string] `json:"name,required"` + // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive + // challenges in response to malicious bots (ENT only). + BotFightMode param.Field[bool] `json:"bot_fight_mode"` + // If Turnstile is embedded on a Cloudflare site and the widget should grant + // challenge clearance, this setting can determine the clearance level to be set + ClearanceLevel param.Field[AccountChallengeWidgetUpdateParamsClearanceLevel] `json:"clearance_level"` + // Do not show any Cloudflare branding on the widget (ENT only). + Offlabel param.Field[bool] `json:"offlabel"` +} + +func (r AccountChallengeWidgetUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Widget Mode +type AccountChallengeWidgetUpdateParamsMode string + +const ( + AccountChallengeWidgetUpdateParamsModeNonInteractive AccountChallengeWidgetUpdateParamsMode = "non-interactive" + AccountChallengeWidgetUpdateParamsModeInvisible AccountChallengeWidgetUpdateParamsMode = "invisible" + AccountChallengeWidgetUpdateParamsModeManaged AccountChallengeWidgetUpdateParamsMode = "managed" +) + +// If Turnstile is embedded on a Cloudflare site and the widget should grant +// challenge clearance, this setting can determine the clearance level to be set +type AccountChallengeWidgetUpdateParamsClearanceLevel string + +const ( + AccountChallengeWidgetUpdateParamsClearanceLevelNoClearance AccountChallengeWidgetUpdateParamsClearanceLevel = "no_clearance" + AccountChallengeWidgetUpdateParamsClearanceLevelJschallenge AccountChallengeWidgetUpdateParamsClearanceLevel = "jschallenge" + AccountChallengeWidgetUpdateParamsClearanceLevelManaged AccountChallengeWidgetUpdateParamsClearanceLevel = "managed" + AccountChallengeWidgetUpdateParamsClearanceLevelInteractive AccountChallengeWidgetUpdateParamsClearanceLevel = "interactive" +) + +type AccountChallengeWidgetListParams struct { + // Direction to order widgets. + Direction param.Field[AccountChallengeWidgetListParamsDirection] `query:"direction"` + // Field to order widgets by. + Order param.Field[AccountChallengeWidgetListParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [AccountChallengeWidgetListParams]'s query parameters as +// `url.Values`. +func (r AccountChallengeWidgetListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order widgets. +type AccountChallengeWidgetListParamsDirection string + +const ( + AccountChallengeWidgetListParamsDirectionAsc AccountChallengeWidgetListParamsDirection = "asc" + AccountChallengeWidgetListParamsDirectionDesc AccountChallengeWidgetListParamsDirection = "desc" +) + +// Field to order widgets by. +type AccountChallengeWidgetListParamsOrder string + +const ( + AccountChallengeWidgetListParamsOrderID AccountChallengeWidgetListParamsOrder = "id" + AccountChallengeWidgetListParamsOrderSitekey AccountChallengeWidgetListParamsOrder = "sitekey" + AccountChallengeWidgetListParamsOrderName AccountChallengeWidgetListParamsOrder = "name" + AccountChallengeWidgetListParamsOrderCreatedOn AccountChallengeWidgetListParamsOrder = "created_on" + AccountChallengeWidgetListParamsOrderModifiedOn AccountChallengeWidgetListParamsOrder = "modified_on" +) + +type AccountChallengeWidgetRotateSecretParams struct { + // If `invalidate_immediately` is set to `false`, the previous secret will remain + // valid for two hours. Otherwise, the secret is immediately invalidated, and + // requests using it will be rejected. + InvalidateImmediately param.Field[bool] `json:"invalidate_immediately"` +} + +func (r AccountChallengeWidgetRotateSecretParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountchallengewidget_test.go b/accountchallengewidget_test.go new file mode 100644 index 00000000000..c5fb92e4e56 --- /dev/null +++ b/accountchallengewidget_test.go @@ -0,0 +1,222 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountChallengeWidgetNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Challenges.Widgets.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountChallengeWidgetNewParams{ + Domains: cloudflare.F([]string{"203.0.113.1", "cloudflare.com", "blog.example.com"}), + Mode: cloudflare.F(cloudflare.AccountChallengeWidgetNewParamsModeInvisible), + Name: cloudflare.F("blog.cloudflare.com login form"), + Direction: cloudflare.F(cloudflare.AccountChallengeWidgetNewParamsDirectionAsc), + Order: cloudflare.F(cloudflare.AccountChallengeWidgetNewParamsOrderID), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + BotFightMode: cloudflare.F(true), + ClearanceLevel: cloudflare.F(cloudflare.AccountChallengeWidgetNewParamsClearanceLevelInteractive), + Offlabel: cloudflare.F(true), + Region: cloudflare.F(cloudflare.AccountChallengeWidgetNewParamsRegionWorld), + }, + ) + 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 TestAccountChallengeWidgetGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Challenges.Widgets.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0x4AAF00AAAABn0R22HWm-YUc", + ) + 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 TestAccountChallengeWidgetUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Challenges.Widgets.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0x4AAF00AAAABn0R22HWm-YUc", + cloudflare.AccountChallengeWidgetUpdateParams{ + Domains: cloudflare.F([]string{"203.0.113.1", "cloudflare.com", "blog.example.com"}), + Mode: cloudflare.F(cloudflare.AccountChallengeWidgetUpdateParamsModeInvisible), + Name: cloudflare.F("blog.cloudflare.com login form"), + BotFightMode: cloudflare.F(true), + ClearanceLevel: cloudflare.F(cloudflare.AccountChallengeWidgetUpdateParamsClearanceLevelInteractive), + Offlabel: cloudflare.F(true), + }, + ) + 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 TestAccountChallengeWidgetListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Challenges.Widgets.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountChallengeWidgetListParams{ + Direction: cloudflare.F(cloudflare.AccountChallengeWidgetListParamsDirectionAsc), + Order: cloudflare.F(cloudflare.AccountChallengeWidgetListParamsOrderID), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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 TestAccountChallengeWidgetDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Challenges.Widgets.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0x4AAF00AAAABn0R22HWm-YUc", + ) + 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 TestAccountChallengeWidgetRotateSecretWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Challenges.Widgets.RotateSecret( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0x4AAF00AAAABn0R22HWm-YUc", + cloudflare.AccountChallengeWidgetRotateSecretParams{ + InvalidateImmediately: cloudflare.F(true), + }, + ) + 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/accountcustomn.go b/accountcustomn.go new file mode 100644 index 00000000000..78497eccad2 --- /dev/null +++ b/accountcustomn.go @@ -0,0 +1,486 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCustomNService 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 [NewAccountCustomNService] method +// instead. +type AccountCustomNService struct { + Options []option.RequestOption + Availabilities *AccountCustomNAvailabilityService + Verifies *AccountCustomNVerifyService +} + +// NewAccountCustomNService 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 NewAccountCustomNService(opts ...option.RequestOption) (r *AccountCustomNService) { + r = &AccountCustomNService{} + r.Options = opts + r.Availabilities = NewAccountCustomNAvailabilityService(opts...) + r.Verifies = NewAccountCustomNVerifyService(opts...) + return +} + +// Delete Account Custom Nameserver +func (r *AccountCustomNService) Delete(ctx context.Context, identifier string, nsName string, opts ...option.RequestOption) (res *AccountCustomNDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_ns/%s", identifier, nsName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Add Account Custom Nameserver +func (r *AccountCustomNService) AccountLevelCustomNameserversAddAccountCustomNameserver(ctx context.Context, identifier string, body AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverParams, opts ...option.RequestOption) (res *AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_ns", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List an account's custom nameservers. +func (r *AccountCustomNService) AccountLevelCustomNameserversListAccountCustomNameservers(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_ns", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountCustomNDeleteResponse struct { + Errors []AccountCustomNDeleteResponseError `json:"errors"` + Messages []AccountCustomNDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo AccountCustomNDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountCustomNDeleteResponseSuccess `json:"success"` + JSON accountCustomNDeleteResponseJSON `json:"-"` +} + +// accountCustomNDeleteResponseJSON contains the JSON metadata for the struct +// [AccountCustomNDeleteResponse] +type accountCustomNDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNDeleteResponseErrorJSON `json:"-"` +} + +// accountCustomNDeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountCustomNDeleteResponseError] +type accountCustomNDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNDeleteResponseMessageJSON `json:"-"` +} + +// accountCustomNDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountCustomNDeleteResponseMessage] +type accountCustomNDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountCustomNDeleteResponseResultInfoJSON `json:"-"` +} + +// accountCustomNDeleteResponseResultInfoJSON contains the JSON metadata for the +// struct [AccountCustomNDeleteResponseResultInfo] +type accountCustomNDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCustomNDeleteResponseSuccess bool + +const ( + AccountCustomNDeleteResponseSuccessTrue AccountCustomNDeleteResponseSuccess = true +) + +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponse struct { + Errors []AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseError `json:"errors"` + Messages []AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseMessage `json:"messages"` + // A single account custom nameserver. + Result AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResult `json:"result"` + // Whether the API call was successful + Success AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseSuccess `json:"success"` + JSON accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponse] +type accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseErrorJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseError] +type accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseMessageJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseMessage] +type accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A single account custom nameserver. +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResult struct { + // A and AAAA records associated with the nameserver. + DNSRecords []AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecord `json:"dns_records,required"` + // The FQDN of the name server. + NsName string `json:"ns_name,required" format:"hostname"` + // Verification status of the nameserver. + Status AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatus `json:"status,required"` + // Identifier + ZoneTag string `json:"zone_tag,required"` + // The number of the set that this name server belongs to. + NsSet float64 `json:"ns_set"` + JSON accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResult] +type accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultJSON struct { + DNSRecords apijson.Field + NsName apijson.Field + Status apijson.Field + ZoneTag apijson.Field + NsSet apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecord struct { + // DNS record type. + Type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordsType `json:"type"` + // DNS record contents (an IPv4 or IPv6 address). + Value string `json:"value"` + JSON accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecord] +type accountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DNS record type. +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordsType string + +const ( + AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordsTypeA AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordsType = "A" + AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordsTypeAaaa AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultDNSRecordsType = "AAAA" +) + +// Verification status of the nameserver. +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatus string + +const ( + AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatusMoved AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatus = "moved" + AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatusPending AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatus = "pending" + AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatusVerified AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseResultStatus = "verified" +) + +// Whether the API call was successful +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseSuccess bool + +const ( + AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseSuccessTrue AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponseSuccess = true +) + +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponse struct { + Errors []AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseError `json:"errors"` + Messages []AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseMessage `json:"messages"` + Result []AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResult `json:"result"` + ResultInfo AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseSuccess `json:"success"` + JSON accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponse] +type accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseErrorJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseError] +type accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseMessageJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseMessage] +type accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A single account custom nameserver. +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResult struct { + // A and AAAA records associated with the nameserver. + DNSRecords []AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecord `json:"dns_records,required"` + // The FQDN of the name server. + NsName string `json:"ns_name,required" format:"hostname"` + // Verification status of the nameserver. + Status AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatus `json:"status,required"` + // Identifier + ZoneTag string `json:"zone_tag,required"` + // The number of the set that this name server belongs to. + NsSet float64 `json:"ns_set"` + JSON accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResult] +type accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultJSON struct { + DNSRecords apijson.Field + NsName apijson.Field + Status apijson.Field + ZoneTag apijson.Field + NsSet apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecord struct { + // DNS record type. + Type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordsType `json:"type"` + // DNS record contents (an IPv4 or IPv6 address). + Value string `json:"value"` + JSON accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecord] +type accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DNS record type. +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordsType string + +const ( + AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordsTypeA AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordsType = "A" + AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordsTypeAaaa AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultDNSRecordsType = "AAAA" +) + +// Verification status of the nameserver. +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatus string + +const ( + AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatusMoved AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatus = "moved" + AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatusPending AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatus = "pending" + AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatusVerified AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultStatus = "verified" +) + +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultInfoJSON `json:"-"` +} + +// accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultInfo] +type accountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseSuccess bool + +const ( + AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseSuccessTrue AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponseSuccess = true +) + +type AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverParams struct { + // The FQDN of the name server. + NsName param.Field[string] `json:"ns_name,required" format:"hostname"` + // The number of the set that this name server belongs to. + NsSet param.Field[float64] `json:"ns_set"` +} + +func (r AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountcustomn_test.go b/accountcustomn_test.go new file mode 100644 index 00000000000..4f559bfc625 --- /dev/null +++ b/accountcustomn_test.go @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCustomNDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomNs.Delete( + context.TODO(), + "372e67954025e0ba6aaa6d586b9e0b59", + "ns1.example.com", + ) + 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 TestAccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomNs.AccountLevelCustomNameserversAddAccountCustomNameserver( + context.TODO(), + "372e67954025e0ba6aaa6d586b9e0b59", + cloudflare.AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverParams{ + NsName: cloudflare.F("ns1.example.com"), + NsSet: cloudflare.F(1.000000), + }, + ) + 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 TestAccountCustomNAccountLevelCustomNameserversListAccountCustomNameservers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomNs.AccountLevelCustomNameserversListAccountCustomNameservers(context.TODO(), "372e67954025e0ba6aaa6d586b9e0b59") + 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/accountcustomnavailability.go b/accountcustomnavailability.go new file mode 100644 index 00000000000..2f3c04081c4 --- /dev/null +++ b/accountcustomnavailability.go @@ -0,0 +1,141 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCustomNAvailabilityService 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 +// [NewAccountCustomNAvailabilityService] method instead. +type AccountCustomNAvailabilityService struct { + Options []option.RequestOption +} + +// NewAccountCustomNAvailabilityService 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 NewAccountCustomNAvailabilityService(opts ...option.RequestOption) (r *AccountCustomNAvailabilityService) { + r = &AccountCustomNAvailabilityService{} + r.Options = opts + return +} + +// Get Eligible Zones for Account Custom Nameservers +func (r *AccountCustomNAvailabilityService) AccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameservers(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_ns/availability", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponse struct { + Errors []AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseError `json:"errors"` + Messages []AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseMessage `json:"messages"` + Result []string `json:"result" format:"hostname"` + ResultInfo AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseSuccess `json:"success"` + JSON accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseJSON `json:"-"` +} + +// accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseJSON +// contains the JSON metadata for the struct +// [AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponse] +type accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseErrorJSON `json:"-"` +} + +// accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseError] +type accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseMessageJSON `json:"-"` +} + +// accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseMessage] +type accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseResultInfoJSON `json:"-"` +} + +// accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseResultInfo] +type accountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseSuccess bool + +const ( + AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseSuccessTrue AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponseSuccess = true +) diff --git a/accountcustomnavailability_test.go b/accountcustomnavailability_test.go new file mode 100644 index 00000000000..de5179a4f80 --- /dev/null +++ b/accountcustomnavailability_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameservers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomNs.Availabilities.AccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameservers(context.TODO(), "372e67954025e0ba6aaa6d586b9e0b59") + 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/accountcustomnverify.go b/accountcustomnverify.go new file mode 100644 index 00000000000..41dfb3e394a --- /dev/null +++ b/accountcustomnverify.go @@ -0,0 +1,212 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCustomNVerifyService 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 [NewAccountCustomNVerifyService] +// method instead. +type AccountCustomNVerifyService struct { + Options []option.RequestOption +} + +// NewAccountCustomNVerifyService 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 NewAccountCustomNVerifyService(opts ...option.RequestOption) (r *AccountCustomNVerifyService) { + r = &AccountCustomNVerifyService{} + r.Options = opts + return +} + +// Verify Account Custom Nameserver Glue Records +func (r *AccountCustomNVerifyService) AccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecords(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_ns/verify", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponse struct { + Errors []AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseError `json:"errors"` + Messages []AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseMessage `json:"messages"` + Result []AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResult `json:"result"` + ResultInfo AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseSuccess `json:"success"` + JSON accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseJSON `json:"-"` +} + +// accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseJSON +// contains the JSON metadata for the struct +// [AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponse] +type accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseErrorJSON `json:"-"` +} + +// accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseError] +type accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseMessageJSON `json:"-"` +} + +// accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseMessage] +type accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A single account custom nameserver. +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResult struct { + // A and AAAA records associated with the nameserver. + DNSRecords []AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecord `json:"dns_records,required"` + // The FQDN of the name server. + NsName string `json:"ns_name,required" format:"hostname"` + // Verification status of the nameserver. + Status AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatus `json:"status,required"` + // Identifier + ZoneTag string `json:"zone_tag,required"` + // The number of the set that this name server belongs to. + NsSet float64 `json:"ns_set"` + JSON accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultJSON `json:"-"` +} + +// accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResult] +type accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultJSON struct { + DNSRecords apijson.Field + NsName apijson.Field + Status apijson.Field + ZoneTag apijson.Field + NsSet apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecord struct { + // DNS record type. + Type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordsType `json:"type"` + // DNS record contents (an IPv4 or IPv6 address). + Value string `json:"value"` + JSON accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordJSON `json:"-"` +} + +// accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordJSON +// contains the JSON metadata for the struct +// [AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecord] +type accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DNS record type. +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordsType string + +const ( + AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordsTypeA AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordsType = "A" + AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordsTypeAaaa AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultDNSRecordsType = "AAAA" +) + +// Verification status of the nameserver. +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatus string + +const ( + AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatusMoved AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatus = "moved" + AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatusPending AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatus = "pending" + AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatusVerified AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultStatus = "verified" +) + +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultInfoJSON `json:"-"` +} + +// accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultInfo] +type accountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseSuccess bool + +const ( + AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseSuccessTrue AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponseSuccess = true +) diff --git a/accountcustomnverify_test.go b/accountcustomnverify_test.go new file mode 100644 index 00000000000..cb96da021d9 --- /dev/null +++ b/accountcustomnverify_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecords(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomNs.Verifies.AccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecords(context.TODO(), "372e67954025e0ba6aaa6d586b9e0b59") + 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/accountcustompage.go b/accountcustompage.go new file mode 100644 index 00000000000..c17b5362eef --- /dev/null +++ b/accountcustompage.go @@ -0,0 +1,315 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountCustomPageService 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 [NewAccountCustomPageService] method +// instead. +type AccountCustomPageService struct { + Options []option.RequestOption +} + +// NewAccountCustomPageService 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 NewAccountCustomPageService(opts ...option.RequestOption) (r *AccountCustomPageService) { + r = &AccountCustomPageService{} + r.Options = opts + return +} + +// Fetches the details of a custom page. +func (r *AccountCustomPageService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountCustomPageGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_pages/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the configuration of an existing custom page. +func (r *AccountCustomPageService) Update(ctx context.Context, accountIdentifier string, identifier string, body AccountCustomPageUpdateParams, opts ...option.RequestOption) (res *AccountCustomPageUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_pages/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Fetches all the custom pages at the account level. +func (r *AccountCustomPageService) CustomPagesForAnAccountListCustomPages(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountCustomPageCustomPagesForAnAccountListCustomPagesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/custom_pages", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountCustomPageGetResponse struct { + Errors []AccountCustomPageGetResponseError `json:"errors"` + Messages []AccountCustomPageGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountCustomPageGetResponseSuccess `json:"success"` + JSON accountCustomPageGetResponseJSON `json:"-"` +} + +// accountCustomPageGetResponseJSON contains the JSON metadata for the struct +// [AccountCustomPageGetResponse] +type accountCustomPageGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomPageGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomPageGetResponseErrorJSON `json:"-"` +} + +// accountCustomPageGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountCustomPageGetResponseError] +type accountCustomPageGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomPageGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomPageGetResponseMessageJSON `json:"-"` +} + +// accountCustomPageGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountCustomPageGetResponseMessage] +type accountCustomPageGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCustomPageGetResponseSuccess bool + +const ( + AccountCustomPageGetResponseSuccessTrue AccountCustomPageGetResponseSuccess = true +) + +type AccountCustomPageUpdateResponse struct { + Errors []AccountCustomPageUpdateResponseError `json:"errors"` + Messages []AccountCustomPageUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountCustomPageUpdateResponseSuccess `json:"success"` + JSON accountCustomPageUpdateResponseJSON `json:"-"` +} + +// accountCustomPageUpdateResponseJSON contains the JSON metadata for the struct +// [AccountCustomPageUpdateResponse] +type accountCustomPageUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomPageUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomPageUpdateResponseErrorJSON `json:"-"` +} + +// accountCustomPageUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountCustomPageUpdateResponseError] +type accountCustomPageUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomPageUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomPageUpdateResponseMessageJSON `json:"-"` +} + +// accountCustomPageUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountCustomPageUpdateResponseMessage] +type accountCustomPageUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCustomPageUpdateResponseSuccess bool + +const ( + AccountCustomPageUpdateResponseSuccessTrue AccountCustomPageUpdateResponseSuccess = true +) + +type AccountCustomPageCustomPagesForAnAccountListCustomPagesResponse struct { + Errors []AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseError `json:"errors"` + Messages []AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseSuccess `json:"success"` + JSON accountCustomPageCustomPagesForAnAccountListCustomPagesResponseJSON `json:"-"` +} + +// accountCustomPageCustomPagesForAnAccountListCustomPagesResponseJSON contains the +// JSON metadata for the struct +// [AccountCustomPageCustomPagesForAnAccountListCustomPagesResponse] +type accountCustomPageCustomPagesForAnAccountListCustomPagesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageCustomPagesForAnAccountListCustomPagesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomPageCustomPagesForAnAccountListCustomPagesResponseErrorJSON `json:"-"` +} + +// accountCustomPageCustomPagesForAnAccountListCustomPagesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseError] +type accountCustomPageCustomPagesForAnAccountListCustomPagesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountCustomPageCustomPagesForAnAccountListCustomPagesResponseMessageJSON `json:"-"` +} + +// accountCustomPageCustomPagesForAnAccountListCustomPagesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseMessage] +type accountCustomPageCustomPagesForAnAccountListCustomPagesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountCustomPageCustomPagesForAnAccountListCustomPagesResponseResultInfoJSON `json:"-"` +} + +// accountCustomPageCustomPagesForAnAccountListCustomPagesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseResultInfo] +type accountCustomPageCustomPagesForAnAccountListCustomPagesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseSuccess bool + +const ( + AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseSuccessTrue AccountCustomPageCustomPagesForAnAccountListCustomPagesResponseSuccess = true +) + +type AccountCustomPageUpdateParams struct { + // The custom page state. + State param.Field[AccountCustomPageUpdateParamsState] `json:"state,required"` + // The URL associated with the custom page. + URL param.Field[string] `json:"url,required" format:"uri"` +} + +func (r AccountCustomPageUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The custom page state. +type AccountCustomPageUpdateParamsState string + +const ( + AccountCustomPageUpdateParamsStateDefault AccountCustomPageUpdateParamsState = "default" + AccountCustomPageUpdateParamsStateCustomized AccountCustomPageUpdateParamsState = "customized" +) diff --git a/accountcustompage_test.go b/accountcustompage_test.go new file mode 100644 index 00000000000..89dd89ea2e4 --- /dev/null +++ b/accountcustompage_test.go @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountCustomPageGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomPages.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountCustomPageUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomPages.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountCustomPageUpdateParams{ + State: cloudflare.F(cloudflare.AccountCustomPageUpdateParamsStateDefault), + URL: cloudflare.F("http://www.example.com"), + }, + ) + 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 TestAccountCustomPageCustomPagesForAnAccountListCustomPages(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.CustomPages.CustomPagesForAnAccountListCustomPages(context.TODO(), "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/accountd1.go b/accountd1.go new file mode 100644 index 00000000000..de60b1eb395 --- /dev/null +++ b/accountd1.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountD1Service 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 [NewAccountD1Service] method instead. +type AccountD1Service struct { + Options []option.RequestOption + Databases *AccountD1DatabaseService +} + +// NewAccountD1Service 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 NewAccountD1Service(opts ...option.RequestOption) (r *AccountD1Service) { + r = &AccountD1Service{} + r.Options = opts + r.Databases = NewAccountD1DatabaseService(opts...) + return +} diff --git a/accountd1database.go b/accountd1database.go new file mode 100644 index 00000000000..d9425b5ec49 --- /dev/null +++ b/accountd1database.go @@ -0,0 +1,581 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountD1DatabaseService 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 [NewAccountD1DatabaseService] method +// instead. +type AccountD1DatabaseService struct { + Options []option.RequestOption +} + +// NewAccountD1DatabaseService 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 NewAccountD1DatabaseService(opts ...option.RequestOption) (r *AccountD1DatabaseService) { + r = &AccountD1DatabaseService{} + r.Options = opts + return +} + +// Returns the created D1 database. +func (r *AccountD1DatabaseService) New(ctx context.Context, accountIdentifier string, body AccountD1DatabaseNewParams, opts ...option.RequestOption) (res *AccountD1DatabaseNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/d1/database", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Returns the specified D1 database. +func (r *AccountD1DatabaseService) Get(ctx context.Context, accountIdentifier string, databaseIdentifier string, opts ...option.RequestOption) (res *AccountD1DatabaseGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/d1/database/%s", accountIdentifier, databaseIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Returns a list of D1 databases. +func (r *AccountD1DatabaseService) List(ctx context.Context, accountIdentifier string, query AccountD1DatabaseListParams, opts ...option.RequestOption) (res *AccountD1DatabaseListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/d1/database", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Deletes the specified D1 database. +func (r *AccountD1DatabaseService) Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string, opts ...option.RequestOption) (res *AccountD1DatabaseDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/d1/database/%s", accountIdentifier, databaseIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Returns the query result. +func (r *AccountD1DatabaseService) Query(ctx context.Context, accountIdentifier string, databaseIdentifier string, body AccountD1DatabaseQueryParams, opts ...option.RequestOption) (res *AccountD1DatabaseQueryResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/d1/database/%s/query", accountIdentifier, databaseIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountD1DatabaseNewResponse struct { + Errors []AccountD1DatabaseNewResponseError `json:"errors"` + Messages []AccountD1DatabaseNewResponseMessage `json:"messages"` + Result AccountD1DatabaseNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountD1DatabaseNewResponseSuccess `json:"success"` + JSON accountD1DatabaseNewResponseJSON `json:"-"` +} + +// accountD1DatabaseNewResponseJSON contains the JSON metadata for the struct +// [AccountD1DatabaseNewResponse] +type accountD1DatabaseNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseNewResponseErrorJSON `json:"-"` +} + +// accountD1DatabaseNewResponseErrorJSON contains the JSON metadata for the struct +// [AccountD1DatabaseNewResponseError] +type accountD1DatabaseNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseNewResponseMessageJSON `json:"-"` +} + +// accountD1DatabaseNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountD1DatabaseNewResponseMessage] +type accountD1DatabaseNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseNewResponseResult struct { + // Specifies the timestamp the resource was created as an ISO8601 string. + CreatedAt interface{} `json:"created_at"` + Name string `json:"name"` + Uuid string `json:"uuid"` + Version string `json:"version"` + JSON accountD1DatabaseNewResponseResultJSON `json:"-"` +} + +// accountD1DatabaseNewResponseResultJSON contains the JSON metadata for the struct +// [AccountD1DatabaseNewResponseResult] +type accountD1DatabaseNewResponseResultJSON struct { + CreatedAt apijson.Field + Name apijson.Field + Uuid apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountD1DatabaseNewResponseSuccess bool + +const ( + AccountD1DatabaseNewResponseSuccessTrue AccountD1DatabaseNewResponseSuccess = true +) + +type AccountD1DatabaseGetResponse struct { + Errors []AccountD1DatabaseGetResponseError `json:"errors"` + Messages []AccountD1DatabaseGetResponseMessage `json:"messages"` + Result AccountD1DatabaseGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountD1DatabaseGetResponseSuccess `json:"success"` + JSON accountD1DatabaseGetResponseJSON `json:"-"` +} + +// accountD1DatabaseGetResponseJSON contains the JSON metadata for the struct +// [AccountD1DatabaseGetResponse] +type accountD1DatabaseGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseGetResponseErrorJSON `json:"-"` +} + +// accountD1DatabaseGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountD1DatabaseGetResponseError] +type accountD1DatabaseGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseGetResponseMessageJSON `json:"-"` +} + +// accountD1DatabaseGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountD1DatabaseGetResponseMessage] +type accountD1DatabaseGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseGetResponseResult struct { + // Specifies the timestamp the resource was created as an ISO8601 string. + CreatedAt interface{} `json:"created_at"` + // The D1 database's size, in bytes. + FileSize float64 `json:"file_size"` + Name string `json:"name"` + NumTables float64 `json:"num_tables"` + Uuid string `json:"uuid"` + Version string `json:"version"` + JSON accountD1DatabaseGetResponseResultJSON `json:"-"` +} + +// accountD1DatabaseGetResponseResultJSON contains the JSON metadata for the struct +// [AccountD1DatabaseGetResponseResult] +type accountD1DatabaseGetResponseResultJSON struct { + CreatedAt apijson.Field + FileSize apijson.Field + Name apijson.Field + NumTables apijson.Field + Uuid apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountD1DatabaseGetResponseSuccess bool + +const ( + AccountD1DatabaseGetResponseSuccessTrue AccountD1DatabaseGetResponseSuccess = true +) + +type AccountD1DatabaseListResponse struct { + Errors []AccountD1DatabaseListResponseError `json:"errors"` + Messages []AccountD1DatabaseListResponseMessage `json:"messages"` + Result []AccountD1DatabaseListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountD1DatabaseListResponseSuccess `json:"success"` + JSON accountD1DatabaseListResponseJSON `json:"-"` +} + +// accountD1DatabaseListResponseJSON contains the JSON metadata for the struct +// [AccountD1DatabaseListResponse] +type accountD1DatabaseListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseListResponseErrorJSON `json:"-"` +} + +// accountD1DatabaseListResponseErrorJSON contains the JSON metadata for the struct +// [AccountD1DatabaseListResponseError] +type accountD1DatabaseListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseListResponseMessageJSON `json:"-"` +} + +// accountD1DatabaseListResponseMessageJSON contains the JSON metadata for the +// struct [AccountD1DatabaseListResponseMessage] +type accountD1DatabaseListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseListResponseResult struct { + // Specifies the timestamp the resource was created as an ISO8601 string. + CreatedAt interface{} `json:"created_at"` + Name string `json:"name"` + Uuid string `json:"uuid"` + Version string `json:"version"` + JSON accountD1DatabaseListResponseResultJSON `json:"-"` +} + +// accountD1DatabaseListResponseResultJSON contains the JSON metadata for the +// struct [AccountD1DatabaseListResponseResult] +type accountD1DatabaseListResponseResultJSON struct { + CreatedAt apijson.Field + Name apijson.Field + Uuid apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountD1DatabaseListResponseSuccess bool + +const ( + AccountD1DatabaseListResponseSuccessTrue AccountD1DatabaseListResponseSuccess = true +) + +type AccountD1DatabaseDeleteResponse struct { + Errors []AccountD1DatabaseDeleteResponseError `json:"errors"` + Messages []AccountD1DatabaseDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result,nullable"` + // Whether the API call was successful + Success AccountD1DatabaseDeleteResponseSuccess `json:"success"` + JSON accountD1DatabaseDeleteResponseJSON `json:"-"` +} + +// accountD1DatabaseDeleteResponseJSON contains the JSON metadata for the struct +// [AccountD1DatabaseDeleteResponse] +type accountD1DatabaseDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseDeleteResponseErrorJSON `json:"-"` +} + +// accountD1DatabaseDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountD1DatabaseDeleteResponseError] +type accountD1DatabaseDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseDeleteResponseMessageJSON `json:"-"` +} + +// accountD1DatabaseDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountD1DatabaseDeleteResponseMessage] +type accountD1DatabaseDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountD1DatabaseDeleteResponseSuccess bool + +const ( + AccountD1DatabaseDeleteResponseSuccessTrue AccountD1DatabaseDeleteResponseSuccess = true +) + +type AccountD1DatabaseQueryResponse struct { + Errors []AccountD1DatabaseQueryResponseError `json:"errors"` + Messages []AccountD1DatabaseQueryResponseMessage `json:"messages"` + Result []AccountD1DatabaseQueryResponseResult `json:"result"` + // Whether the API call was successful + Success AccountD1DatabaseQueryResponseSuccess `json:"success"` + JSON accountD1DatabaseQueryResponseJSON `json:"-"` +} + +// accountD1DatabaseQueryResponseJSON contains the JSON metadata for the struct +// [AccountD1DatabaseQueryResponse] +type accountD1DatabaseQueryResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseQueryResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseQueryResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseQueryResponseErrorJSON `json:"-"` +} + +// accountD1DatabaseQueryResponseErrorJSON contains the JSON metadata for the +// struct [AccountD1DatabaseQueryResponseError] +type accountD1DatabaseQueryResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseQueryResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseQueryResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountD1DatabaseQueryResponseMessageJSON `json:"-"` +} + +// accountD1DatabaseQueryResponseMessageJSON contains the JSON metadata for the +// struct [AccountD1DatabaseQueryResponseMessage] +type accountD1DatabaseQueryResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseQueryResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseQueryResponseResult struct { + Meta AccountD1DatabaseQueryResponseResultMeta `json:"meta"` + Results []interface{} `json:"results"` + Success bool `json:"success"` + JSON accountD1DatabaseQueryResponseResultJSON `json:"-"` +} + +// accountD1DatabaseQueryResponseResultJSON contains the JSON metadata for the +// struct [AccountD1DatabaseQueryResponseResult] +type accountD1DatabaseQueryResponseResultJSON struct { + Meta apijson.Field + Results apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseQueryResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountD1DatabaseQueryResponseResultMeta struct { + ChangedDB bool `json:"changed_db"` + Changes float64 `json:"changes"` + Duration float64 `json:"duration"` + LastRowID float64 `json:"last_row_id"` + RowsRead float64 `json:"rows_read"` + RowsWritten float64 `json:"rows_written"` + SizeAfter float64 `json:"size_after"` + JSON accountD1DatabaseQueryResponseResultMetaJSON `json:"-"` +} + +// accountD1DatabaseQueryResponseResultMetaJSON contains the JSON metadata for the +// struct [AccountD1DatabaseQueryResponseResultMeta] +type accountD1DatabaseQueryResponseResultMetaJSON struct { + ChangedDB apijson.Field + Changes apijson.Field + Duration apijson.Field + LastRowID apijson.Field + RowsRead apijson.Field + RowsWritten apijson.Field + SizeAfter apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountD1DatabaseQueryResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountD1DatabaseQueryResponseSuccess bool + +const ( + AccountD1DatabaseQueryResponseSuccessTrue AccountD1DatabaseQueryResponseSuccess = true +) + +type AccountD1DatabaseNewParams struct { + Name param.Field[string] `json:"name,required"` +} + +func (r AccountD1DatabaseNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountD1DatabaseListParams struct { + // a database name to search for. + Name param.Field[string] `query:"name"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [AccountD1DatabaseListParams]'s query parameters as +// `url.Values`. +func (r AccountD1DatabaseListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountD1DatabaseQueryParams struct { + Sql param.Field[string] `json:"sql,required"` + Params param.Field[[]string] `json:"params"` +} + +func (r AccountD1DatabaseQueryParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountd1database_test.go b/accountd1database_test.go new file mode 100644 index 00000000000..8b205965b3a --- /dev/null +++ b/accountd1database_test.go @@ -0,0 +1,174 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountD1DatabaseNew(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.D1.Databases.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountD1DatabaseNewParams{ + Name: cloudflare.F("my-database"), + }, + ) + 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 TestAccountD1DatabaseGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.D1.Databases.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ) + 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 TestAccountD1DatabaseListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.D1.Databases.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountD1DatabaseListParams{ + Name: cloudflare.F("string"), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(10.000000), + }, + ) + 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 TestAccountD1DatabaseDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.D1.Databases.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ) + 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 TestAccountD1DatabaseQueryWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.D1.Databases.Query( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + cloudflare.AccountD1DatabaseQueryParams{ + Sql: cloudflare.F("SELECT * FROM myTable WHERE field = ? OR field = ?;"), + Params: cloudflare.F([]string{"firstParam", "secondParam"}), + }, + ) + 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/accountdevice.go b/accountdevice.go new file mode 100644 index 00000000000..da4c3d3a484 --- /dev/null +++ b/accountdevice.go @@ -0,0 +1,338 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDeviceService 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 [NewAccountDeviceService] method +// instead. +type AccountDeviceService struct { + Options []option.RequestOption + DexTests *AccountDeviceDexTestService + Networks *AccountDeviceNetworkService + Policies *AccountDevicePolicyService + Postures *AccountDevicePostureService + Revokes *AccountDeviceRevokeService + Settings *AccountDeviceSettingService + Unrevokes *AccountDeviceUnrevokeService + OverrideCodes *AccountDeviceOverrideCodeService +} + +// NewAccountDeviceService 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 NewAccountDeviceService(opts ...option.RequestOption) (r *AccountDeviceService) { + r = &AccountDeviceService{} + r.Options = opts + r.DexTests = NewAccountDeviceDexTestService(opts...) + r.Networks = NewAccountDeviceNetworkService(opts...) + r.Policies = NewAccountDevicePolicyService(opts...) + r.Postures = NewAccountDevicePostureService(opts...) + r.Revokes = NewAccountDeviceRevokeService(opts...) + r.Settings = NewAccountDeviceSettingService(opts...) + r.Unrevokes = NewAccountDeviceUnrevokeService(opts...) + r.OverrideCodes = NewAccountDeviceOverrideCodeService(opts...) + return +} + +// Fetches details for a single device. +func (r *AccountDeviceService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDeviceGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Fetches a list of enrolled devices. +func (r *AccountDeviceService) DevicesListDevices(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDeviceDevicesListDevicesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDeviceGetResponse struct { + Errors []AccountDeviceGetResponseError `json:"errors"` + Messages []AccountDeviceGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful. + Success AccountDeviceGetResponseSuccess `json:"success"` + JSON accountDeviceGetResponseJSON `json:"-"` +} + +// accountDeviceGetResponseJSON contains the JSON metadata for the struct +// [AccountDeviceGetResponse] +type accountDeviceGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceGetResponseErrorJSON `json:"-"` +} + +// accountDeviceGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountDeviceGetResponseError] +type accountDeviceGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceGetResponseMessageJSON `json:"-"` +} + +// accountDeviceGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountDeviceGetResponseMessage] +type accountDeviceGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceGetResponseSuccess bool + +const ( + AccountDeviceGetResponseSuccessTrue AccountDeviceGetResponseSuccess = true +) + +type AccountDeviceDevicesListDevicesResponse struct { + Errors []AccountDeviceDevicesListDevicesResponseError `json:"errors"` + Messages []AccountDeviceDevicesListDevicesResponseMessage `json:"messages"` + Result []AccountDeviceDevicesListDevicesResponseResult `json:"result"` + ResultInfo AccountDeviceDevicesListDevicesResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDeviceDevicesListDevicesResponseSuccess `json:"success"` + JSON accountDeviceDevicesListDevicesResponseJSON `json:"-"` +} + +// accountDeviceDevicesListDevicesResponseJSON contains the JSON metadata for the +// struct [AccountDeviceDevicesListDevicesResponse] +type accountDeviceDevicesListDevicesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDevicesListDevicesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDevicesListDevicesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDevicesListDevicesResponseErrorJSON `json:"-"` +} + +// accountDeviceDevicesListDevicesResponseErrorJSON contains the JSON metadata for +// the struct [AccountDeviceDevicesListDevicesResponseError] +type accountDeviceDevicesListDevicesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDevicesListDevicesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDevicesListDevicesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDevicesListDevicesResponseMessageJSON `json:"-"` +} + +// accountDeviceDevicesListDevicesResponseMessageJSON contains the JSON metadata +// for the struct [AccountDeviceDevicesListDevicesResponseMessage] +type accountDeviceDevicesListDevicesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDevicesListDevicesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDevicesListDevicesResponseResult struct { + // Device ID. + ID string `json:"id"` + // When the device was created. + Created time.Time `json:"created" format:"date-time"` + // True if the device was deleted. + Deleted bool `json:"deleted"` + DeviceType AccountDeviceDevicesListDevicesResponseResultDeviceType `json:"device_type"` + // IPv4 or IPv6 address. + IP string `json:"ip"` + // The device's public key. + Key string `json:"key"` + // When the device last connected to Cloudflare services. + LastSeen time.Time `json:"last_seen" format:"date-time"` + // The device mac address. + MacAddress string `json:"mac_address"` + // The device manufacturer name. + Manufacturer string `json:"manufacturer"` + // The device model name. + Model string `json:"model"` + // The device name. + Name string `json:"name"` + // The Linux distro name. + OsDistroName string `json:"os_distro_name"` + // The Linux distro revision. + OsDistroRevision string `json:"os_distro_revision"` + // The operating system version. + OsVersion string `json:"os_version"` + // The operating system version extra parameter. + OsVersionExtra string `json:"os_version_extra"` + // When the device was revoked. + RevokedAt time.Time `json:"revoked_at" format:"date-time"` + // The device serial number. + SerialNumber string `json:"serial_number"` + // When the device was updated. + Updated time.Time `json:"updated" format:"date-time"` + User AccountDeviceDevicesListDevicesResponseResultUser `json:"user"` + // The WARP client version. + Version string `json:"version"` + JSON accountDeviceDevicesListDevicesResponseResultJSON `json:"-"` +} + +// accountDeviceDevicesListDevicesResponseResultJSON contains the JSON metadata for +// the struct [AccountDeviceDevicesListDevicesResponseResult] +type accountDeviceDevicesListDevicesResponseResultJSON struct { + ID apijson.Field + Created apijson.Field + Deleted apijson.Field + DeviceType apijson.Field + IP apijson.Field + Key apijson.Field + LastSeen apijson.Field + MacAddress apijson.Field + Manufacturer apijson.Field + Model apijson.Field + Name apijson.Field + OsDistroName apijson.Field + OsDistroRevision apijson.Field + OsVersion apijson.Field + OsVersionExtra apijson.Field + RevokedAt apijson.Field + SerialNumber apijson.Field + Updated apijson.Field + User apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDevicesListDevicesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDevicesListDevicesResponseResultDeviceType string + +const ( + AccountDeviceDevicesListDevicesResponseResultDeviceTypeWindows AccountDeviceDevicesListDevicesResponseResultDeviceType = "windows" + AccountDeviceDevicesListDevicesResponseResultDeviceTypeMac AccountDeviceDevicesListDevicesResponseResultDeviceType = "mac" + AccountDeviceDevicesListDevicesResponseResultDeviceTypeLinux AccountDeviceDevicesListDevicesResponseResultDeviceType = "linux" + AccountDeviceDevicesListDevicesResponseResultDeviceTypeAndroid AccountDeviceDevicesListDevicesResponseResultDeviceType = "android" + AccountDeviceDevicesListDevicesResponseResultDeviceTypeIos AccountDeviceDevicesListDevicesResponseResultDeviceType = "ios" +) + +type AccountDeviceDevicesListDevicesResponseResultUser struct { + // UUID + ID string `json:"id"` + // The contact email address of the user. + Email string `json:"email"` + // The enrolled device user's name. + Name string `json:"name"` + JSON accountDeviceDevicesListDevicesResponseResultUserJSON `json:"-"` +} + +// accountDeviceDevicesListDevicesResponseResultUserJSON contains the JSON metadata +// for the struct [AccountDeviceDevicesListDevicesResponseResultUser] +type accountDeviceDevicesListDevicesResponseResultUserJSON struct { + ID apijson.Field + Email apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDevicesListDevicesResponseResultUser) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDevicesListDevicesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDeviceDevicesListDevicesResponseResultInfoJSON `json:"-"` +} + +// accountDeviceDevicesListDevicesResponseResultInfoJSON contains the JSON metadata +// for the struct [AccountDeviceDevicesListDevicesResponseResultInfo] +type accountDeviceDevicesListDevicesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDevicesListDevicesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceDevicesListDevicesResponseSuccess bool + +const ( + AccountDeviceDevicesListDevicesResponseSuccessTrue AccountDeviceDevicesListDevicesResponseSuccess = true +) diff --git a/accountdevice_test.go b/accountdevice_test.go new file mode 100644 index 00000000000..df56ab1b6a8 --- /dev/null +++ b/accountdevice_test.go @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDeviceGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDeviceDevicesListDevices(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.DevicesListDevices(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountdevicedextest.go b/accountdevicedextest.go new file mode 100644 index 00000000000..1d7c4ce9cc0 --- /dev/null +++ b/accountdevicedextest.go @@ -0,0 +1,776 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDeviceDexTestService 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 [NewAccountDeviceDexTestService] +// method instead. +type AccountDeviceDexTestService struct { + Options []option.RequestOption +} + +// NewAccountDeviceDexTestService 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 NewAccountDeviceDexTestService(opts ...option.RequestOption) (r *AccountDeviceDexTestService) { + r = &AccountDeviceDexTestService{} + r.Options = opts + return +} + +// Fetch a single DEX test. +func (r *AccountDeviceDexTestService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDeviceDexTestGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/dex_tests/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a DEX test. +func (r *AccountDeviceDexTestService) Update(ctx context.Context, identifier interface{}, uuid string, body AccountDeviceDexTestUpdateParams, opts ...option.RequestOption) (res *AccountDeviceDexTestUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/dex_tests/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete a Device DEX test. Returns the remaining device dex tests for the +// account. +func (r *AccountDeviceDexTestService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDeviceDexTestDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/dex_tests/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a DEX test. +func (r *AccountDeviceDexTestService) DeviceDexTestNewDeviceDexTest(ctx context.Context, identifier interface{}, body AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParams, opts ...option.RequestOption) (res *AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/dex_tests", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetch all DEX tests. +func (r *AccountDeviceDexTestService) DeviceDexTestDetails(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDeviceDexTestDeviceDexTestDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/dex_tests", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDeviceDexTestGetResponse struct { + Errors []AccountDeviceDexTestGetResponseError `json:"errors"` + Messages []AccountDeviceDexTestGetResponseMessage `json:"messages"` + Result AccountDeviceDexTestGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceDexTestGetResponseSuccess `json:"success"` + JSON accountDeviceDexTestGetResponseJSON `json:"-"` +} + +// accountDeviceDexTestGetResponseJSON contains the JSON metadata for the struct +// [AccountDeviceDexTestGetResponse] +type accountDeviceDexTestGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestGetResponseErrorJSON `json:"-"` +} + +// accountDeviceDexTestGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestGetResponseError] +type accountDeviceDexTestGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestGetResponseMessageJSON `json:"-"` +} + +// accountDeviceDexTestGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestGetResponseMessage] +type accountDeviceDexTestGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestGetResponseResult struct { + // The configuration object which contains the details for the WARP client to + // conduct the test. + Data AccountDeviceDexTestGetResponseResultData `json:"data,required"` + // Determines whether or not the test is active. + Enabled bool `json:"enabled,required"` + // How often the test will run. + Interval string `json:"interval,required"` + // The name of the DEX test. Must be unique. + Name string `json:"name,required"` + // Additional details about the test. + Description string `json:"description"` + JSON accountDeviceDexTestGetResponseResultJSON `json:"-"` +} + +// accountDeviceDexTestGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestGetResponseResult] +type accountDeviceDexTestGetResponseResultJSON struct { + Data apijson.Field + Enabled apijson.Field + Interval apijson.Field + Name apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object which contains the details for the WARP client to +// conduct the test. +type AccountDeviceDexTestGetResponseResultData struct { + // The desired endpoint to test. + Host string `json:"host"` + // The type of test. + Kind string `json:"kind"` + // The HTTP request method type. + Method string `json:"method"` + JSON accountDeviceDexTestGetResponseResultDataJSON `json:"-"` +} + +// accountDeviceDexTestGetResponseResultDataJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestGetResponseResultData] +type accountDeviceDexTestGetResponseResultDataJSON struct { + Host apijson.Field + Kind apijson.Field + Method apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestGetResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceDexTestGetResponseSuccess bool + +const ( + AccountDeviceDexTestGetResponseSuccessTrue AccountDeviceDexTestGetResponseSuccess = true +) + +type AccountDeviceDexTestUpdateResponse struct { + Errors []AccountDeviceDexTestUpdateResponseError `json:"errors"` + Messages []AccountDeviceDexTestUpdateResponseMessage `json:"messages"` + Result AccountDeviceDexTestUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceDexTestUpdateResponseSuccess `json:"success"` + JSON accountDeviceDexTestUpdateResponseJSON `json:"-"` +} + +// accountDeviceDexTestUpdateResponseJSON contains the JSON metadata for the struct +// [AccountDeviceDexTestUpdateResponse] +type accountDeviceDexTestUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestUpdateResponseErrorJSON `json:"-"` +} + +// accountDeviceDexTestUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestUpdateResponseError] +type accountDeviceDexTestUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestUpdateResponseMessageJSON `json:"-"` +} + +// accountDeviceDexTestUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestUpdateResponseMessage] +type accountDeviceDexTestUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestUpdateResponseResult struct { + // The configuration object which contains the details for the WARP client to + // conduct the test. + Data AccountDeviceDexTestUpdateResponseResultData `json:"data,required"` + // Determines whether or not the test is active. + Enabled bool `json:"enabled,required"` + // How often the test will run. + Interval string `json:"interval,required"` + // The name of the DEX test. Must be unique. + Name string `json:"name,required"` + // Additional details about the test. + Description string `json:"description"` + JSON accountDeviceDexTestUpdateResponseResultJSON `json:"-"` +} + +// accountDeviceDexTestUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestUpdateResponseResult] +type accountDeviceDexTestUpdateResponseResultJSON struct { + Data apijson.Field + Enabled apijson.Field + Interval apijson.Field + Name apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object which contains the details for the WARP client to +// conduct the test. +type AccountDeviceDexTestUpdateResponseResultData struct { + // The desired endpoint to test. + Host string `json:"host"` + // The type of test. + Kind string `json:"kind"` + // The HTTP request method type. + Method string `json:"method"` + JSON accountDeviceDexTestUpdateResponseResultDataJSON `json:"-"` +} + +// accountDeviceDexTestUpdateResponseResultDataJSON contains the JSON metadata for +// the struct [AccountDeviceDexTestUpdateResponseResultData] +type accountDeviceDexTestUpdateResponseResultDataJSON struct { + Host apijson.Field + Kind apijson.Field + Method apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestUpdateResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceDexTestUpdateResponseSuccess bool + +const ( + AccountDeviceDexTestUpdateResponseSuccessTrue AccountDeviceDexTestUpdateResponseSuccess = true +) + +type AccountDeviceDexTestDeleteResponse struct { + Errors []AccountDeviceDexTestDeleteResponseError `json:"errors"` + Messages []AccountDeviceDexTestDeleteResponseMessage `json:"messages"` + Result []AccountDeviceDexTestDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceDexTestDeleteResponseSuccess `json:"success"` + JSON accountDeviceDexTestDeleteResponseJSON `json:"-"` +} + +// accountDeviceDexTestDeleteResponseJSON contains the JSON metadata for the struct +// [AccountDeviceDexTestDeleteResponse] +type accountDeviceDexTestDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestDeleteResponseErrorJSON `json:"-"` +} + +// accountDeviceDexTestDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestDeleteResponseError] +type accountDeviceDexTestDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestDeleteResponseMessageJSON `json:"-"` +} + +// accountDeviceDexTestDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestDeleteResponseMessage] +type accountDeviceDexTestDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeleteResponseResult struct { + // The configuration object which contains the details for the WARP client to + // conduct the test. + Data AccountDeviceDexTestDeleteResponseResultData `json:"data,required"` + // Determines whether or not the test is active. + Enabled bool `json:"enabled,required"` + // How often the test will run. + Interval string `json:"interval,required"` + // The name of the DEX test. Must be unique. + Name string `json:"name,required"` + // Additional details about the test. + Description string `json:"description"` + JSON accountDeviceDexTestDeleteResponseResultJSON `json:"-"` +} + +// accountDeviceDexTestDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountDeviceDexTestDeleteResponseResult] +type accountDeviceDexTestDeleteResponseResultJSON struct { + Data apijson.Field + Enabled apijson.Field + Interval apijson.Field + Name apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object which contains the details for the WARP client to +// conduct the test. +type AccountDeviceDexTestDeleteResponseResultData struct { + // The desired endpoint to test. + Host string `json:"host"` + // The type of test. + Kind string `json:"kind"` + // The HTTP request method type. + Method string `json:"method"` + JSON accountDeviceDexTestDeleteResponseResultDataJSON `json:"-"` +} + +// accountDeviceDexTestDeleteResponseResultDataJSON contains the JSON metadata for +// the struct [AccountDeviceDexTestDeleteResponseResultData] +type accountDeviceDexTestDeleteResponseResultDataJSON struct { + Host apijson.Field + Kind apijson.Field + Method apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeleteResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceDexTestDeleteResponseSuccess bool + +const ( + AccountDeviceDexTestDeleteResponseSuccessTrue AccountDeviceDexTestDeleteResponseSuccess = true +) + +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponse struct { + Errors []AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseError `json:"errors"` + Messages []AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseMessage `json:"messages"` + Result AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseSuccess `json:"success"` + JSON accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseJSON contains the JSON +// metadata for the struct +// [AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponse] +type accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseErrorJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseError] +type accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseMessageJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseMessage] +type accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResult struct { + // The configuration object which contains the details for the WARP client to + // conduct the test. + Data AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultData `json:"data,required"` + // Determines whether or not the test is active. + Enabled bool `json:"enabled,required"` + // How often the test will run. + Interval string `json:"interval,required"` + // The name of the DEX test. Must be unique. + Name string `json:"name,required"` + // Additional details about the test. + Description string `json:"description"` + JSON accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultJSON contains the +// JSON metadata for the struct +// [AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResult] +type accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultJSON struct { + Data apijson.Field + Enabled apijson.Field + Interval apijson.Field + Name apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object which contains the details for the WARP client to +// conduct the test. +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultData struct { + // The desired endpoint to test. + Host string `json:"host"` + // The type of test. + Kind string `json:"kind"` + // The HTTP request method type. + Method string `json:"method"` + JSON accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultDataJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultDataJSON contains +// the JSON metadata for the struct +// [AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultData] +type accountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultDataJSON struct { + Host apijson.Field + Kind apijson.Field + Method apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseSuccess bool + +const ( + AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseSuccessTrue AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponseSuccess = true +) + +type AccountDeviceDexTestDeviceDexTestDetailsResponse struct { + Errors []AccountDeviceDexTestDeviceDexTestDetailsResponseError `json:"errors"` + Messages []AccountDeviceDexTestDeviceDexTestDetailsResponseMessage `json:"messages"` + Result []AccountDeviceDexTestDeviceDexTestDetailsResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceDexTestDeviceDexTestDetailsResponseSuccess `json:"success"` + JSON accountDeviceDexTestDeviceDexTestDetailsResponseJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestDetailsResponseJSON contains the JSON metadata +// for the struct [AccountDeviceDexTestDeviceDexTestDetailsResponse] +type accountDeviceDexTestDeviceDexTestDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeviceDexTestDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestDeviceDexTestDetailsResponseErrorJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestDetailsResponseErrorJSON contains the JSON +// metadata for the struct [AccountDeviceDexTestDeviceDexTestDetailsResponseError] +type accountDeviceDexTestDeviceDexTestDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeviceDexTestDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceDexTestDeviceDexTestDetailsResponseMessageJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestDetailsResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountDeviceDexTestDeviceDexTestDetailsResponseMessage] +type accountDeviceDexTestDeviceDexTestDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceDexTestDeviceDexTestDetailsResponseResult struct { + // The configuration object which contains the details for the WARP client to + // conduct the test. + Data AccountDeviceDexTestDeviceDexTestDetailsResponseResultData `json:"data,required"` + // Determines whether or not the test is active. + Enabled bool `json:"enabled,required"` + // How often the test will run. + Interval string `json:"interval,required"` + // The name of the DEX test. Must be unique. + Name string `json:"name,required"` + // Additional details about the test. + Description string `json:"description"` + JSON accountDeviceDexTestDeviceDexTestDetailsResponseResultJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestDetailsResponseResultJSON contains the JSON +// metadata for the struct [AccountDeviceDexTestDeviceDexTestDetailsResponseResult] +type accountDeviceDexTestDeviceDexTestDetailsResponseResultJSON struct { + Data apijson.Field + Enabled apijson.Field + Interval apijson.Field + Name apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object which contains the details for the WARP client to +// conduct the test. +type AccountDeviceDexTestDeviceDexTestDetailsResponseResultData struct { + // The desired endpoint to test. + Host string `json:"host"` + // The type of test. + Kind string `json:"kind"` + // The HTTP request method type. + Method string `json:"method"` + JSON accountDeviceDexTestDeviceDexTestDetailsResponseResultDataJSON `json:"-"` +} + +// accountDeviceDexTestDeviceDexTestDetailsResponseResultDataJSON contains the JSON +// metadata for the struct +// [AccountDeviceDexTestDeviceDexTestDetailsResponseResultData] +type accountDeviceDexTestDeviceDexTestDetailsResponseResultDataJSON struct { + Host apijson.Field + Kind apijson.Field + Method apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceDexTestDeviceDexTestDetailsResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceDexTestDeviceDexTestDetailsResponseSuccess bool + +const ( + AccountDeviceDexTestDeviceDexTestDetailsResponseSuccessTrue AccountDeviceDexTestDeviceDexTestDetailsResponseSuccess = true +) + +type AccountDeviceDexTestUpdateParams struct { + // The configuration object which contains the details for the WARP client to + // conduct the test. + Data param.Field[AccountDeviceDexTestUpdateParamsData] `json:"data,required"` + // Determines whether or not the test is active. + Enabled param.Field[bool] `json:"enabled,required"` + // How often the test will run. + Interval param.Field[string] `json:"interval,required"` + // The name of the DEX test. Must be unique. + Name param.Field[string] `json:"name,required"` + // Additional details about the test. + Description param.Field[string] `json:"description"` +} + +func (r AccountDeviceDexTestUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration object which contains the details for the WARP client to +// conduct the test. +type AccountDeviceDexTestUpdateParamsData struct { + // The desired endpoint to test. + Host param.Field[string] `json:"host"` + // The type of test. + Kind param.Field[string] `json:"kind"` + // The HTTP request method type. + Method param.Field[string] `json:"method"` +} + +func (r AccountDeviceDexTestUpdateParamsData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParams struct { + // The configuration object which contains the details for the WARP client to + // conduct the test. + Data param.Field[AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParamsData] `json:"data,required"` + // Determines whether or not the test is active. + Enabled param.Field[bool] `json:"enabled,required"` + // How often the test will run. + Interval param.Field[string] `json:"interval,required"` + // The name of the DEX test. Must be unique. + Name param.Field[string] `json:"name,required"` + // Additional details about the test. + Description param.Field[string] `json:"description"` +} + +func (r AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration object which contains the details for the WARP client to +// conduct the test. +type AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParamsData struct { + // The desired endpoint to test. + Host param.Field[string] `json:"host"` + // The type of test. + Kind param.Field[string] `json:"kind"` + // The HTTP request method type. + Method param.Field[string] `json:"method"` +} + +func (r AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParamsData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdevicedextest_test.go b/accountdevicedextest_test.go new file mode 100644 index 00000000000..67e7a1a8d0a --- /dev/null +++ b/accountdevicedextest_test.go @@ -0,0 +1,181 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDeviceDexTestGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.DexTests.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDeviceDexTestUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.DexTests.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDeviceDexTestUpdateParams{ + Data: cloudflare.F(cloudflare.AccountDeviceDexTestUpdateParamsData{ + Host: cloudflare.F("https://dash.cloudflare.com"), + Kind: cloudflare.F("http"), + Method: cloudflare.F("GET"), + }), + Enabled: cloudflare.F(true), + Interval: cloudflare.F("30m"), + Name: cloudflare.F("HTTP dash health check"), + Description: cloudflare.F("Checks the dash endpoint every 30 minutes"), + }, + ) + 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 TestAccountDeviceDexTestDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.DexTests.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDeviceDexTestDeviceDexTestNewDeviceDexTestWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.DexTests.DeviceDexTestNewDeviceDexTest( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParams{ + Data: cloudflare.F(cloudflare.AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParamsData{ + Host: cloudflare.F("https://dash.cloudflare.com"), + Kind: cloudflare.F("http"), + Method: cloudflare.F("GET"), + }), + Enabled: cloudflare.F(true), + Interval: cloudflare.F("30m"), + Name: cloudflare.F("HTTP dash health check"), + Description: cloudflare.F("Checks the dash endpoint every 30 minutes"), + }, + ) + 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 TestAccountDeviceDexTestDeviceDexTestDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.DexTests.DeviceDexTestDetails(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountdevicenetwork.go b/accountdevicenetwork.go new file mode 100644 index 00000000000..48c493b021c --- /dev/null +++ b/accountdevicenetwork.go @@ -0,0 +1,866 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDeviceNetworkService 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 [NewAccountDeviceNetworkService] +// method instead. +type AccountDeviceNetworkService struct { + Options []option.RequestOption +} + +// NewAccountDeviceNetworkService 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 NewAccountDeviceNetworkService(opts ...option.RequestOption) (r *AccountDeviceNetworkService) { + r = &AccountDeviceNetworkService{} + r.Options = opts + return +} + +// Fetches details for a single managed network. +func (r *AccountDeviceNetworkService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDeviceNetworkGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/networks/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured device managed network. +func (r *AccountDeviceNetworkService) Update(ctx context.Context, identifier interface{}, uuid string, body AccountDeviceNetworkUpdateParams, opts ...option.RequestOption) (res *AccountDeviceNetworkUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/networks/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a device managed network and fetches a list of the remaining device +// managed networks for an account. +func (r *AccountDeviceNetworkService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDeviceNetworkDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/networks/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new device managed network. +func (r *AccountDeviceNetworkService) DeviceManagedNetworksNewDeviceManagedNetwork(ctx context.Context, identifier interface{}, body AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParams, opts ...option.RequestOption) (res *AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/networks", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches a list of managed networks for an account. +func (r *AccountDeviceNetworkService) DeviceManagedNetworksListDeviceManagedNetworks(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/networks", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDeviceNetworkGetResponse struct { + Errors []AccountDeviceNetworkGetResponseError `json:"errors"` + Messages []AccountDeviceNetworkGetResponseMessage `json:"messages"` + Result AccountDeviceNetworkGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceNetworkGetResponseSuccess `json:"success"` + JSON accountDeviceNetworkGetResponseJSON `json:"-"` +} + +// accountDeviceNetworkGetResponseJSON contains the JSON metadata for the struct +// [AccountDeviceNetworkGetResponse] +type accountDeviceNetworkGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkGetResponseErrorJSON `json:"-"` +} + +// accountDeviceNetworkGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkGetResponseError] +type accountDeviceNetworkGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkGetResponseMessageJSON `json:"-"` +} + +// accountDeviceNetworkGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkGetResponseMessage] +type accountDeviceNetworkGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkGetResponseResult struct { + // The configuration object containing information for the WARP client to detect + // the managed network. + Config AccountDeviceNetworkGetResponseResultConfig `json:"config"` + // The name of the device managed network. This name must be unique. + Name string `json:"name"` + // API UUID. + NetworkID string `json:"network_id"` + // The type of device managed network. + Type AccountDeviceNetworkGetResponseResultType `json:"type"` + JSON accountDeviceNetworkGetResponseResultJSON `json:"-"` +} + +// accountDeviceNetworkGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkGetResponseResult] +type accountDeviceNetworkGetResponseResultJSON struct { + Config apijson.Field + Name apijson.Field + NetworkID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing information for the WARP client to detect +// the managed network. +type AccountDeviceNetworkGetResponseResultConfig struct { + // A network address of the form "host:port" that the WARP client will use to + // detect the presence of a TLS host. + TlsSockaddr string `json:"tls_sockaddr,required"` + // The SHA-256 hash of the TLS certificate presented by the host found at + // tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + // timestamp, etc) will be used to validate the certificate. + Sha256 string `json:"sha256"` + JSON accountDeviceNetworkGetResponseResultConfigJSON `json:"-"` +} + +// accountDeviceNetworkGetResponseResultConfigJSON contains the JSON metadata for +// the struct [AccountDeviceNetworkGetResponseResultConfig] +type accountDeviceNetworkGetResponseResultConfigJSON struct { + TlsSockaddr apijson.Field + Sha256 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkGetResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device managed network. +type AccountDeviceNetworkGetResponseResultType string + +const ( + AccountDeviceNetworkGetResponseResultTypeTls AccountDeviceNetworkGetResponseResultType = "tls" +) + +// Whether the API call was successful. +type AccountDeviceNetworkGetResponseSuccess bool + +const ( + AccountDeviceNetworkGetResponseSuccessTrue AccountDeviceNetworkGetResponseSuccess = true +) + +type AccountDeviceNetworkUpdateResponse struct { + Errors []AccountDeviceNetworkUpdateResponseError `json:"errors"` + Messages []AccountDeviceNetworkUpdateResponseMessage `json:"messages"` + Result AccountDeviceNetworkUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceNetworkUpdateResponseSuccess `json:"success"` + JSON accountDeviceNetworkUpdateResponseJSON `json:"-"` +} + +// accountDeviceNetworkUpdateResponseJSON contains the JSON metadata for the struct +// [AccountDeviceNetworkUpdateResponse] +type accountDeviceNetworkUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkUpdateResponseErrorJSON `json:"-"` +} + +// accountDeviceNetworkUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkUpdateResponseError] +type accountDeviceNetworkUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkUpdateResponseMessageJSON `json:"-"` +} + +// accountDeviceNetworkUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkUpdateResponseMessage] +type accountDeviceNetworkUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkUpdateResponseResult struct { + // The configuration object containing information for the WARP client to detect + // the managed network. + Config AccountDeviceNetworkUpdateResponseResultConfig `json:"config"` + // The name of the device managed network. This name must be unique. + Name string `json:"name"` + // API UUID. + NetworkID string `json:"network_id"` + // The type of device managed network. + Type AccountDeviceNetworkUpdateResponseResultType `json:"type"` + JSON accountDeviceNetworkUpdateResponseResultJSON `json:"-"` +} + +// accountDeviceNetworkUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkUpdateResponseResult] +type accountDeviceNetworkUpdateResponseResultJSON struct { + Config apijson.Field + Name apijson.Field + NetworkID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing information for the WARP client to detect +// the managed network. +type AccountDeviceNetworkUpdateResponseResultConfig struct { + // A network address of the form "host:port" that the WARP client will use to + // detect the presence of a TLS host. + TlsSockaddr string `json:"tls_sockaddr,required"` + // The SHA-256 hash of the TLS certificate presented by the host found at + // tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + // timestamp, etc) will be used to validate the certificate. + Sha256 string `json:"sha256"` + JSON accountDeviceNetworkUpdateResponseResultConfigJSON `json:"-"` +} + +// accountDeviceNetworkUpdateResponseResultConfigJSON contains the JSON metadata +// for the struct [AccountDeviceNetworkUpdateResponseResultConfig] +type accountDeviceNetworkUpdateResponseResultConfigJSON struct { + TlsSockaddr apijson.Field + Sha256 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkUpdateResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device managed network. +type AccountDeviceNetworkUpdateResponseResultType string + +const ( + AccountDeviceNetworkUpdateResponseResultTypeTls AccountDeviceNetworkUpdateResponseResultType = "tls" +) + +// Whether the API call was successful. +type AccountDeviceNetworkUpdateResponseSuccess bool + +const ( + AccountDeviceNetworkUpdateResponseSuccessTrue AccountDeviceNetworkUpdateResponseSuccess = true +) + +type AccountDeviceNetworkDeleteResponse struct { + Errors []AccountDeviceNetworkDeleteResponseError `json:"errors"` + Messages []AccountDeviceNetworkDeleteResponseMessage `json:"messages"` + Result []AccountDeviceNetworkDeleteResponseResult `json:"result"` + ResultInfo AccountDeviceNetworkDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDeviceNetworkDeleteResponseSuccess `json:"success"` + JSON accountDeviceNetworkDeleteResponseJSON `json:"-"` +} + +// accountDeviceNetworkDeleteResponseJSON contains the JSON metadata for the struct +// [AccountDeviceNetworkDeleteResponse] +type accountDeviceNetworkDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkDeleteResponseErrorJSON `json:"-"` +} + +// accountDeviceNetworkDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkDeleteResponseError] +type accountDeviceNetworkDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkDeleteResponseMessageJSON `json:"-"` +} + +// accountDeviceNetworkDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkDeleteResponseMessage] +type accountDeviceNetworkDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeleteResponseResult struct { + // The configuration object containing information for the WARP client to detect + // the managed network. + Config AccountDeviceNetworkDeleteResponseResultConfig `json:"config"` + // The name of the device managed network. This name must be unique. + Name string `json:"name"` + // API UUID. + NetworkID string `json:"network_id"` + // The type of device managed network. + Type AccountDeviceNetworkDeleteResponseResultType `json:"type"` + JSON accountDeviceNetworkDeleteResponseResultJSON `json:"-"` +} + +// accountDeviceNetworkDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountDeviceNetworkDeleteResponseResult] +type accountDeviceNetworkDeleteResponseResultJSON struct { + Config apijson.Field + Name apijson.Field + NetworkID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing information for the WARP client to detect +// the managed network. +type AccountDeviceNetworkDeleteResponseResultConfig struct { + // A network address of the form "host:port" that the WARP client will use to + // detect the presence of a TLS host. + TlsSockaddr string `json:"tls_sockaddr,required"` + // The SHA-256 hash of the TLS certificate presented by the host found at + // tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + // timestamp, etc) will be used to validate the certificate. + Sha256 string `json:"sha256"` + JSON accountDeviceNetworkDeleteResponseResultConfigJSON `json:"-"` +} + +// accountDeviceNetworkDeleteResponseResultConfigJSON contains the JSON metadata +// for the struct [AccountDeviceNetworkDeleteResponseResultConfig] +type accountDeviceNetworkDeleteResponseResultConfigJSON struct { + TlsSockaddr apijson.Field + Sha256 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeleteResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device managed network. +type AccountDeviceNetworkDeleteResponseResultType string + +const ( + AccountDeviceNetworkDeleteResponseResultTypeTls AccountDeviceNetworkDeleteResponseResultType = "tls" +) + +type AccountDeviceNetworkDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDeviceNetworkDeleteResponseResultInfoJSON `json:"-"` +} + +// accountDeviceNetworkDeleteResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountDeviceNetworkDeleteResponseResultInfo] +type accountDeviceNetworkDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceNetworkDeleteResponseSuccess bool + +const ( + AccountDeviceNetworkDeleteResponseSuccessTrue AccountDeviceNetworkDeleteResponseSuccess = true +) + +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponse struct { + Errors []AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseError `json:"errors"` + Messages []AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseMessage `json:"messages"` + Result AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseSuccess `json:"success"` + JSON accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponse] +type accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseErrorJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseError] +type accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseMessageJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseMessage] +type accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResult struct { + // The configuration object containing information for the WARP client to detect + // the managed network. + Config AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultConfig `json:"config"` + // The name of the device managed network. This name must be unique. + Name string `json:"name"` + // API UUID. + NetworkID string `json:"network_id"` + // The type of device managed network. + Type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultType `json:"type"` + JSON accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResult] +type accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultJSON struct { + Config apijson.Field + Name apijson.Field + NetworkID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing information for the WARP client to detect +// the managed network. +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultConfig struct { + // A network address of the form "host:port" that the WARP client will use to + // detect the presence of a TLS host. + TlsSockaddr string `json:"tls_sockaddr,required"` + // The SHA-256 hash of the TLS certificate presented by the host found at + // tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + // timestamp, etc) will be used to validate the certificate. + Sha256 string `json:"sha256"` + JSON accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultConfigJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultConfigJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultConfig] +type accountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultConfigJSON struct { + TlsSockaddr apijson.Field + Sha256 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device managed network. +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultType string + +const ( + AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultTypeTls AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseResultType = "tls" +) + +// Whether the API call was successful. +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseSuccess bool + +const ( + AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseSuccessTrue AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponseSuccess = true +) + +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponse struct { + Errors []AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseError `json:"errors"` + Messages []AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseMessage `json:"messages"` + Result []AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResult `json:"result"` + ResultInfo AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseSuccess `json:"success"` + JSON accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponse] +type accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseErrorJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseError] +type accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseMessageJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseMessage] +type accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResult struct { + // The configuration object containing information for the WARP client to detect + // the managed network. + Config AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultConfig `json:"config"` + // The name of the device managed network. This name must be unique. + Name string `json:"name"` + // API UUID. + NetworkID string `json:"network_id"` + // The type of device managed network. + Type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultType `json:"type"` + JSON accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResult] +type accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultJSON struct { + Config apijson.Field + Name apijson.Field + NetworkID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing information for the WARP client to detect +// the managed network. +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultConfig struct { + // A network address of the form "host:port" that the WARP client will use to + // detect the presence of a TLS host. + TlsSockaddr string `json:"tls_sockaddr,required"` + // The SHA-256 hash of the TLS certificate presented by the host found at + // tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + // timestamp, etc) will be used to validate the certificate. + Sha256 string `json:"sha256"` + JSON accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultConfigJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultConfigJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultConfig] +type accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultConfigJSON struct { + TlsSockaddr apijson.Field + Sha256 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device managed network. +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultType string + +const ( + AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultTypeTls AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultType = "tls" +) + +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultInfoJSON `json:"-"` +} + +// accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultInfo] +type accountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseSuccess bool + +const ( + AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseSuccessTrue AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponseSuccess = true +) + +type AccountDeviceNetworkUpdateParams struct { + // The configuration object containing information for the WARP client to detect + // the managed network. + Config param.Field[AccountDeviceNetworkUpdateParamsConfig] `json:"config"` + // The name of the device managed network. This name must be unique. + Name param.Field[string] `json:"name"` + // The type of device managed network. + Type param.Field[AccountDeviceNetworkUpdateParamsType] `json:"type"` +} + +func (r AccountDeviceNetworkUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration object containing information for the WARP client to detect +// the managed network. +type AccountDeviceNetworkUpdateParamsConfig struct { + // A network address of the form "host:port" that the WARP client will use to + // detect the presence of a TLS host. + TlsSockaddr param.Field[string] `json:"tls_sockaddr,required"` + // The SHA-256 hash of the TLS certificate presented by the host found at + // tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + // timestamp, etc) will be used to validate the certificate. + Sha256 param.Field[string] `json:"sha256"` +} + +func (r AccountDeviceNetworkUpdateParamsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of device managed network. +type AccountDeviceNetworkUpdateParamsType string + +const ( + AccountDeviceNetworkUpdateParamsTypeTls AccountDeviceNetworkUpdateParamsType = "tls" +) + +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParams struct { + // The configuration object containing information for the WARP client to detect + // the managed network. + Config param.Field[AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsConfig] `json:"config,required"` + // The name of the device managed network. This name must be unique. + Name param.Field[string] `json:"name,required"` + // The type of device managed network. + Type param.Field[AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsType] `json:"type,required"` +} + +func (r AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration object containing information for the WARP client to detect +// the managed network. +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsConfig struct { + // A network address of the form "host:port" that the WARP client will use to + // detect the presence of a TLS host. + TlsSockaddr param.Field[string] `json:"tls_sockaddr,required"` + // The SHA-256 hash of the TLS certificate presented by the host found at + // tls_sockaddr. If absent, regular certificate verification (trusted roots, valid + // timestamp, etc) will be used to validate the certificate. + Sha256 param.Field[string] `json:"sha256"` +} + +func (r AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of device managed network. +type AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsType string + +const ( + AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsTypeTls AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsType = "tls" +) diff --git a/accountdevicenetwork_test.go b/accountdevicenetwork_test.go new file mode 100644 index 00000000000..ef08cd7cc76 --- /dev/null +++ b/accountdevicenetwork_test.go @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDeviceNetworkGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Networks.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDeviceNetworkUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Networks.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDeviceNetworkUpdateParams{ + Config: cloudflare.F(cloudflare.AccountDeviceNetworkUpdateParamsConfig{ + Sha256: cloudflare.F("b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c"), + TlsSockaddr: cloudflare.F("foo.bar:1234"), + }), + Name: cloudflare.F("managed-network-1"), + Type: cloudflare.F(cloudflare.AccountDeviceNetworkUpdateParamsTypeTls), + }, + ) + 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 TestAccountDeviceNetworkDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Networks.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Networks.DeviceManagedNetworksNewDeviceManagedNetwork( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParams{ + Config: cloudflare.F(cloudflare.AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsConfig{ + Sha256: cloudflare.F("b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c"), + TlsSockaddr: cloudflare.F("foo.bar:1234"), + }), + Name: cloudflare.F("managed-network-1"), + Type: cloudflare.F(cloudflare.AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParamsTypeTls), + }, + ) + 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 TestAccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworks(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Networks.DeviceManagedNetworksListDeviceManagedNetworks(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountdeviceoverridecode.go b/accountdeviceoverridecode.go new file mode 100644 index 00000000000..d390f1fe514 --- /dev/null +++ b/accountdeviceoverridecode.go @@ -0,0 +1,191 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDeviceOverrideCodeService 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 +// [NewAccountDeviceOverrideCodeService] method instead. +type AccountDeviceOverrideCodeService struct { + Options []option.RequestOption +} + +// NewAccountDeviceOverrideCodeService 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 NewAccountDeviceOverrideCodeService(opts ...option.RequestOption) (r *AccountDeviceOverrideCodeService) { + r = &AccountDeviceOverrideCodeService{} + r.Options = opts + return +} + +// Fetches a one-time use admin override code for a device. This relies on the +// **Admin Override** setting being enabled in your device configuration. +func (r *AccountDeviceOverrideCodeService) DevicesListAdminOverrideCodeForDevice(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/%s/override_codes", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponse struct { + Errors []AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseError `json:"errors"` + Messages []AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseMessage `json:"messages"` + Result AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResult `json:"result"` + ResultInfo AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseSuccess `json:"success"` + JSON accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseJSON `json:"-"` +} + +// accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseJSON +// contains the JSON metadata for the struct +// [AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponse] +type accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseErrorJSON `json:"-"` +} + +// accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseError] +type accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseMessageJSON `json:"-"` +} + +// accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseMessage] +type accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResult struct { + DisableForTime AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultDisableForTime `json:"disable_for_time"` + JSON accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultJSON `json:"-"` +} + +// accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResult] +type accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultJSON struct { + DisableForTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultDisableForTime struct { + // Override code that is valid for 1 hour. + Number1 interface{} `json:"1"` + // Override code that is valid for 12 hour2. + Number12 interface{} `json:"12"` + // Override code that is valid for 24 hour.2. + Number24 interface{} `json:"24"` + // Override code that is valid for 3 hours. + Number3 interface{} `json:"3"` + // Override code that is valid for 6 hours. + Number6 interface{} `json:"6"` + JSON accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultDisableForTimeJSON `json:"-"` +} + +// accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultDisableForTimeJSON +// contains the JSON metadata for the struct +// [AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultDisableForTime] +type accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultDisableForTimeJSON struct { + Number1 apijson.Field + Number12 apijson.Field + Number24 apijson.Field + Number3 apijson.Field + Number6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultDisableForTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultInfoJSON `json:"-"` +} + +// accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultInfo] +type accountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseSuccess bool + +const ( + AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseSuccessTrue AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponseSuccess = true +) diff --git a/accountdeviceoverridecode_test.go b/accountdeviceoverridecode_test.go new file mode 100644 index 00000000000..d8688a2ef33 --- /dev/null +++ b/accountdeviceoverridecode_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDevice(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.OverrideCodes.DevicesListAdminOverrideCodeForDevice( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/accountdevicepolicy.go b/accountdevicepolicy.go new file mode 100644 index 00000000000..2a02ba17d21 --- /dev/null +++ b/accountdevicepolicy.go @@ -0,0 +1,2204 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDevicePolicyService 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 [NewAccountDevicePolicyService] +// method instead. +type AccountDevicePolicyService struct { + Options []option.RequestOption + Excludes *AccountDevicePolicyExcludeService + FallbackDomains *AccountDevicePolicyFallbackDomainService + Includes *AccountDevicePolicyIncludeService +} + +// NewAccountDevicePolicyService 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 NewAccountDevicePolicyService(opts ...option.RequestOption) (r *AccountDevicePolicyService) { + r = &AccountDevicePolicyService{} + r.Options = opts + r.Excludes = NewAccountDevicePolicyExcludeService(opts...) + r.FallbackDomains = NewAccountDevicePolicyFallbackDomainService(opts...) + r.Includes = NewAccountDevicePolicyIncludeService(opts...) + return +} + +// Fetches a device settings profile by ID. +func (r *AccountDevicePolicyService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePolicyGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured device settings profile. +func (r *AccountDevicePolicyService) Update(ctx context.Context, identifier interface{}, uuid string, body AccountDevicePolicyUpdateParams, opts ...option.RequestOption) (res *AccountDevicePolicyUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes a device settings profile and fetches a list of the remaining profiles +// for an account. +func (r *AccountDevicePolicyService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePolicyDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a device settings profile to be applied to certain devices matching the +// criteria. +func (r *AccountDevicePolicyService) DevicesNewDeviceSettingsPolicy(ctx context.Context, identifier interface{}, body AccountDevicePolicyDevicesNewDeviceSettingsPolicyParams, opts ...option.RequestOption) (res *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches the default device settings profile for an account. +func (r *AccountDevicePolicyService) DevicesGetDefaultDeviceSettingsPolicy(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Fetches a list of the device settings profiles for an account. +func (r *AccountDevicePolicyService) DevicesListDeviceSettingsPolicies(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policies", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the default device settings profile for an account. +func (r *AccountDevicePolicyService) DevicesUpdateDefaultDeviceSettingsPolicy(ctx context.Context, identifier interface{}, body AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParams, opts ...option.RequestOption) (res *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type AccountDevicePolicyGetResponse struct { + Errors []AccountDevicePolicyGetResponseError `json:"errors"` + Messages []AccountDevicePolicyGetResponseMessage `json:"messages"` + Result AccountDevicePolicyGetResponseResult `json:"result"` + ResultInfo AccountDevicePolicyGetResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyGetResponseSuccess `json:"success"` + JSON accountDevicePolicyGetResponseJSON `json:"-"` +} + +// accountDevicePolicyGetResponseJSON contains the JSON metadata for the struct +// [AccountDevicePolicyGetResponse] +type accountDevicePolicyGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyGetResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountDevicePolicyGetResponseError] +type accountDevicePolicyGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyGetResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDevicePolicyGetResponseMessage] +type accountDevicePolicyGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseResult struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch bool `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates bool `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave bool `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect float64 `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal float64 `json:"captive_portal"` + // Whether the policy is the default policy for an account. + Default bool `json:"default"` + // A description of the policy. + Description string `json:"description"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback bool `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled bool `json:"enabled"` + Exclude []AccountDevicePolicyGetResponseResultExclude `json:"exclude"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs bool `json:"exclude_office_ips"` + FallbackDomains []AccountDevicePolicyGetResponseResultFallbackDomain `json:"fallback_domains"` + GatewayUniqueID string `json:"gateway_unique_id"` + Include []AccountDevicePolicyGetResponseResultInclude `json:"include"` + // The amount of time in minutes a user is allowed access to their LAN. A value of + // 0 will allow LAN access until the next WARP reconnection, such as a reboot or a + // laptop waking from sleep. Note that this field is omitted from the response if + // null or unset. + LanAllowMinutes float64 `json:"lan_allow_minutes"` + // The size of the subnet for the local access network. Note that this field is + // omitted from the response if null or unset. + LanAllowSubnetSize float64 `json:"lan_allow_subnet_size"` + // The wirefilter expression to match devices. + Match string `json:"match"` + // The name of the device settings profile. + Name string `json:"name"` + // Device ID. + PolicyID string `json:"policy_id"` + // The precedence of the policy. Lower values indicate higher precedence. Policies + // will be evaluated in ascending order of this field. + Precedence float64 `json:"precedence"` + ServiceModeV2 AccountDevicePolicyGetResponseResultServiceModeV2 `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL string `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked bool `json:"switch_locked"` + JSON accountDevicePolicyGetResponseResultJSON `json:"-"` +} + +// accountDevicePolicyGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDevicePolicyGetResponseResult] +type accountDevicePolicyGetResponseResultJSON struct { + AllowModeSwitch apijson.Field + AllowUpdates apijson.Field + AllowedToLeave apijson.Field + AutoConnect apijson.Field + CaptivePortal apijson.Field + Default apijson.Field + Description apijson.Field + DisableAutoFallback apijson.Field + Enabled apijson.Field + Exclude apijson.Field + ExcludeOfficeIPs apijson.Field + FallbackDomains apijson.Field + GatewayUniqueID apijson.Field + Include apijson.Field + LanAllowMinutes apijson.Field + LanAllowSubnetSize apijson.Field + Match apijson.Field + Name apijson.Field + PolicyID apijson.Field + Precedence apijson.Field + ServiceModeV2 apijson.Field + SupportURL apijson.Field + SwitchLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseResultExclude struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyGetResponseResultExcludeJSON `json:"-"` +} + +// accountDevicePolicyGetResponseResultExcludeJSON contains the JSON metadata for +// the struct [AccountDevicePolicyGetResponseResultExclude] +type accountDevicePolicyGetResponseResultExcludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseResultExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseResultFallbackDomain struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyGetResponseResultFallbackDomainJSON `json:"-"` +} + +// accountDevicePolicyGetResponseResultFallbackDomainJSON contains the JSON +// metadata for the struct [AccountDevicePolicyGetResponseResultFallbackDomain] +type accountDevicePolicyGetResponseResultFallbackDomainJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseResultFallbackDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseResultInclude struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyGetResponseResultIncludeJSON `json:"-"` +} + +// accountDevicePolicyGetResponseResultIncludeJSON contains the JSON metadata for +// the struct [AccountDevicePolicyGetResponseResultInclude] +type accountDevicePolicyGetResponseResultIncludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseResultInclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseResultServiceModeV2 struct { + // The mode to run the WARP client under. + Mode string `json:"mode"` + // The port number when used with proxy mode. + Port float64 `json:"port"` + JSON accountDevicePolicyGetResponseResultServiceModeV2JSON `json:"-"` +} + +// accountDevicePolicyGetResponseResultServiceModeV2JSON contains the JSON metadata +// for the struct [AccountDevicePolicyGetResponseResultServiceModeV2] +type accountDevicePolicyGetResponseResultServiceModeV2JSON struct { + Mode apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseResultServiceModeV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyGetResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyGetResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyGetResponseResultInfoJSON contains the JSON metadata for the +// struct [AccountDevicePolicyGetResponseResultInfo] +type accountDevicePolicyGetResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyGetResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyGetResponseSuccess bool + +const ( + AccountDevicePolicyGetResponseSuccessTrue AccountDevicePolicyGetResponseSuccess = true +) + +type AccountDevicePolicyUpdateResponse struct { + Errors []AccountDevicePolicyUpdateResponseError `json:"errors"` + Messages []AccountDevicePolicyUpdateResponseMessage `json:"messages"` + Result AccountDevicePolicyUpdateResponseResult `json:"result"` + ResultInfo AccountDevicePolicyUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyUpdateResponseSuccess `json:"success"` + JSON accountDevicePolicyUpdateResponseJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseJSON contains the JSON metadata for the struct +// [AccountDevicePolicyUpdateResponse] +type accountDevicePolicyUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyUpdateResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountDevicePolicyUpdateResponseError] +type accountDevicePolicyUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyUpdateResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountDevicePolicyUpdateResponseMessage] +type accountDevicePolicyUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseResult struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch bool `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates bool `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave bool `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect float64 `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal float64 `json:"captive_portal"` + // Whether the policy is the default policy for an account. + Default bool `json:"default"` + // A description of the policy. + Description string `json:"description"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback bool `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled bool `json:"enabled"` + Exclude []AccountDevicePolicyUpdateResponseResultExclude `json:"exclude"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs bool `json:"exclude_office_ips"` + FallbackDomains []AccountDevicePolicyUpdateResponseResultFallbackDomain `json:"fallback_domains"` + GatewayUniqueID string `json:"gateway_unique_id"` + Include []AccountDevicePolicyUpdateResponseResultInclude `json:"include"` + // The amount of time in minutes a user is allowed access to their LAN. A value of + // 0 will allow LAN access until the next WARP reconnection, such as a reboot or a + // laptop waking from sleep. Note that this field is omitted from the response if + // null or unset. + LanAllowMinutes float64 `json:"lan_allow_minutes"` + // The size of the subnet for the local access network. Note that this field is + // omitted from the response if null or unset. + LanAllowSubnetSize float64 `json:"lan_allow_subnet_size"` + // The wirefilter expression to match devices. + Match string `json:"match"` + // The name of the device settings profile. + Name string `json:"name"` + // Device ID. + PolicyID string `json:"policy_id"` + // The precedence of the policy. Lower values indicate higher precedence. Policies + // will be evaluated in ascending order of this field. + Precedence float64 `json:"precedence"` + ServiceModeV2 AccountDevicePolicyUpdateResponseResultServiceModeV2 `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL string `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked bool `json:"switch_locked"` + JSON accountDevicePolicyUpdateResponseResultJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountDevicePolicyUpdateResponseResult] +type accountDevicePolicyUpdateResponseResultJSON struct { + AllowModeSwitch apijson.Field + AllowUpdates apijson.Field + AllowedToLeave apijson.Field + AutoConnect apijson.Field + CaptivePortal apijson.Field + Default apijson.Field + Description apijson.Field + DisableAutoFallback apijson.Field + Enabled apijson.Field + Exclude apijson.Field + ExcludeOfficeIPs apijson.Field + FallbackDomains apijson.Field + GatewayUniqueID apijson.Field + Include apijson.Field + LanAllowMinutes apijson.Field + LanAllowSubnetSize apijson.Field + Match apijson.Field + Name apijson.Field + PolicyID apijson.Field + Precedence apijson.Field + ServiceModeV2 apijson.Field + SupportURL apijson.Field + SwitchLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseResultExclude struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyUpdateResponseResultExcludeJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseResultExcludeJSON contains the JSON metadata +// for the struct [AccountDevicePolicyUpdateResponseResultExclude] +type accountDevicePolicyUpdateResponseResultExcludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseResultExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseResultFallbackDomain struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyUpdateResponseResultFallbackDomainJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseResultFallbackDomainJSON contains the JSON +// metadata for the struct [AccountDevicePolicyUpdateResponseResultFallbackDomain] +type accountDevicePolicyUpdateResponseResultFallbackDomainJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseResultFallbackDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseResultInclude struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyUpdateResponseResultIncludeJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseResultIncludeJSON contains the JSON metadata +// for the struct [AccountDevicePolicyUpdateResponseResultInclude] +type accountDevicePolicyUpdateResponseResultIncludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseResultInclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseResultServiceModeV2 struct { + // The mode to run the WARP client under. + Mode string `json:"mode"` + // The port number when used with proxy mode. + Port float64 `json:"port"` + JSON accountDevicePolicyUpdateResponseResultServiceModeV2JSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseResultServiceModeV2JSON contains the JSON +// metadata for the struct [AccountDevicePolicyUpdateResponseResultServiceModeV2] +type accountDevicePolicyUpdateResponseResultServiceModeV2JSON struct { + Mode apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseResultServiceModeV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyUpdateResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyUpdateResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountDevicePolicyUpdateResponseResultInfo] +type accountDevicePolicyUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyUpdateResponseSuccess bool + +const ( + AccountDevicePolicyUpdateResponseSuccessTrue AccountDevicePolicyUpdateResponseSuccess = true +) + +type AccountDevicePolicyDeleteResponse struct { + Errors []AccountDevicePolicyDeleteResponseError `json:"errors"` + Messages []AccountDevicePolicyDeleteResponseMessage `json:"messages"` + Result []AccountDevicePolicyDeleteResponseResult `json:"result"` + ResultInfo AccountDevicePolicyDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyDeleteResponseSuccess `json:"success"` + JSON accountDevicePolicyDeleteResponseJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseJSON contains the JSON metadata for the struct +// [AccountDevicePolicyDeleteResponse] +type accountDevicePolicyDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDeleteResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountDevicePolicyDeleteResponseError] +type accountDevicePolicyDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDeleteResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountDevicePolicyDeleteResponseMessage] +type accountDevicePolicyDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseResult struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch bool `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates bool `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave bool `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect float64 `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal float64 `json:"captive_portal"` + // Whether the policy is the default policy for an account. + Default bool `json:"default"` + // A description of the policy. + Description string `json:"description"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback bool `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled bool `json:"enabled"` + Exclude []AccountDevicePolicyDeleteResponseResultExclude `json:"exclude"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs bool `json:"exclude_office_ips"` + FallbackDomains []AccountDevicePolicyDeleteResponseResultFallbackDomain `json:"fallback_domains"` + GatewayUniqueID string `json:"gateway_unique_id"` + Include []AccountDevicePolicyDeleteResponseResultInclude `json:"include"` + // The amount of time in minutes a user is allowed access to their LAN. A value of + // 0 will allow LAN access until the next WARP reconnection, such as a reboot or a + // laptop waking from sleep. Note that this field is omitted from the response if + // null or unset. + LanAllowMinutes float64 `json:"lan_allow_minutes"` + // The size of the subnet for the local access network. Note that this field is + // omitted from the response if null or unset. + LanAllowSubnetSize float64 `json:"lan_allow_subnet_size"` + // The wirefilter expression to match devices. + Match string `json:"match"` + // The name of the device settings profile. + Name string `json:"name"` + // Device ID. + PolicyID string `json:"policy_id"` + // The precedence of the policy. Lower values indicate higher precedence. Policies + // will be evaluated in ascending order of this field. + Precedence float64 `json:"precedence"` + ServiceModeV2 AccountDevicePolicyDeleteResponseResultServiceModeV2 `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL string `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked bool `json:"switch_locked"` + JSON accountDevicePolicyDeleteResponseResultJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountDevicePolicyDeleteResponseResult] +type accountDevicePolicyDeleteResponseResultJSON struct { + AllowModeSwitch apijson.Field + AllowUpdates apijson.Field + AllowedToLeave apijson.Field + AutoConnect apijson.Field + CaptivePortal apijson.Field + Default apijson.Field + Description apijson.Field + DisableAutoFallback apijson.Field + Enabled apijson.Field + Exclude apijson.Field + ExcludeOfficeIPs apijson.Field + FallbackDomains apijson.Field + GatewayUniqueID apijson.Field + Include apijson.Field + LanAllowMinutes apijson.Field + LanAllowSubnetSize apijson.Field + Match apijson.Field + Name apijson.Field + PolicyID apijson.Field + Precedence apijson.Field + ServiceModeV2 apijson.Field + SupportURL apijson.Field + SwitchLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseResultExclude struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyDeleteResponseResultExcludeJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseResultExcludeJSON contains the JSON metadata +// for the struct [AccountDevicePolicyDeleteResponseResultExclude] +type accountDevicePolicyDeleteResponseResultExcludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseResultExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseResultFallbackDomain struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyDeleteResponseResultFallbackDomainJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseResultFallbackDomainJSON contains the JSON +// metadata for the struct [AccountDevicePolicyDeleteResponseResultFallbackDomain] +type accountDevicePolicyDeleteResponseResultFallbackDomainJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseResultFallbackDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseResultInclude struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyDeleteResponseResultIncludeJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseResultIncludeJSON contains the JSON metadata +// for the struct [AccountDevicePolicyDeleteResponseResultInclude] +type accountDevicePolicyDeleteResponseResultIncludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseResultInclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseResultServiceModeV2 struct { + // The mode to run the WARP client under. + Mode string `json:"mode"` + // The port number when used with proxy mode. + Port float64 `json:"port"` + JSON accountDevicePolicyDeleteResponseResultServiceModeV2JSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseResultServiceModeV2JSON contains the JSON +// metadata for the struct [AccountDevicePolicyDeleteResponseResultServiceModeV2] +type accountDevicePolicyDeleteResponseResultServiceModeV2JSON struct { + Mode apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseResultServiceModeV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyDeleteResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyDeleteResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountDevicePolicyDeleteResponseResultInfo] +type accountDevicePolicyDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyDeleteResponseSuccess bool + +const ( + AccountDevicePolicyDeleteResponseSuccessTrue AccountDevicePolicyDeleteResponseSuccess = true +) + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseMessage `json:"messages"` + Result AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseJSON contains the JSON +// metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponse] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseError] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseMessage] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResult struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch bool `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates bool `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave bool `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect float64 `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal float64 `json:"captive_portal"` + // Whether the policy is the default policy for an account. + Default bool `json:"default"` + // A description of the policy. + Description string `json:"description"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback bool `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled bool `json:"enabled"` + Exclude []AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultExclude `json:"exclude"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs bool `json:"exclude_office_ips"` + FallbackDomains []AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultFallbackDomain `json:"fallback_domains"` + GatewayUniqueID string `json:"gateway_unique_id"` + Include []AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInclude `json:"include"` + // The amount of time in minutes a user is allowed access to their LAN. A value of + // 0 will allow LAN access until the next WARP reconnection, such as a reboot or a + // laptop waking from sleep. Note that this field is omitted from the response if + // null or unset. + LanAllowMinutes float64 `json:"lan_allow_minutes"` + // The size of the subnet for the local access network. Note that this field is + // omitted from the response if null or unset. + LanAllowSubnetSize float64 `json:"lan_allow_subnet_size"` + // The wirefilter expression to match devices. + Match string `json:"match"` + // The name of the device settings profile. + Name string `json:"name"` + // Device ID. + PolicyID string `json:"policy_id"` + // The precedence of the policy. Lower values indicate higher precedence. Policies + // will be evaluated in ascending order of this field. + Precedence float64 `json:"precedence"` + ServiceModeV2 AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultServiceModeV2 `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL string `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked bool `json:"switch_locked"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultJSON contains the +// JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResult] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultJSON struct { + AllowModeSwitch apijson.Field + AllowUpdates apijson.Field + AllowedToLeave apijson.Field + AutoConnect apijson.Field + CaptivePortal apijson.Field + Default apijson.Field + Description apijson.Field + DisableAutoFallback apijson.Field + Enabled apijson.Field + Exclude apijson.Field + ExcludeOfficeIPs apijson.Field + FallbackDomains apijson.Field + GatewayUniqueID apijson.Field + Include apijson.Field + LanAllowMinutes apijson.Field + LanAllowSubnetSize apijson.Field + Match apijson.Field + Name apijson.Field + PolicyID apijson.Field + Precedence apijson.Field + ServiceModeV2 apijson.Field + SupportURL apijson.Field + SwitchLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultExclude struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultExcludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultExcludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultExclude] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultExcludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultFallbackDomain struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultFallbackDomainJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultFallbackDomainJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultFallbackDomain] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultFallbackDomainJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultFallbackDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInclude struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultIncludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultIncludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInclude] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultIncludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultServiceModeV2 struct { + // The mode to run the WARP client under. + Mode string `json:"mode"` + // The port number when used with proxy mode. + Port float64 `json:"port"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultServiceModeV2JSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultServiceModeV2JSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultServiceModeV2] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultServiceModeV2JSON struct { + Mode apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultServiceModeV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseMessage `json:"messages"` + Result AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponse] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseError] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseMessage] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResult struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch bool `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates bool `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave bool `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect float64 `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal float64 `json:"captive_portal"` + // Whether the policy will be applied to matching devices. + Default bool `json:"default"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback bool `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled bool `json:"enabled"` + Exclude []AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultExclude `json:"exclude"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs bool `json:"exclude_office_ips"` + FallbackDomains []AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultFallbackDomain `json:"fallback_domains"` + GatewayUniqueID string `json:"gateway_unique_id"` + Include []AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInclude `json:"include"` + ServiceModeV2 AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultServiceModeV2 `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL string `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked bool `json:"switch_locked"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResult] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultJSON struct { + AllowModeSwitch apijson.Field + AllowUpdates apijson.Field + AllowedToLeave apijson.Field + AutoConnect apijson.Field + CaptivePortal apijson.Field + Default apijson.Field + DisableAutoFallback apijson.Field + Enabled apijson.Field + Exclude apijson.Field + ExcludeOfficeIPs apijson.Field + FallbackDomains apijson.Field + GatewayUniqueID apijson.Field + Include apijson.Field + ServiceModeV2 apijson.Field + SupportURL apijson.Field + SwitchLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultExclude struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultExcludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultExcludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultExclude] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultExcludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultFallbackDomain struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultFallbackDomainJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultFallbackDomainJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultFallbackDomain] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultFallbackDomainJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultFallbackDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInclude struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultIncludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultIncludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInclude] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultIncludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultServiceModeV2 struct { + // The mode to run the WARP client under. + Mode string `json:"mode"` + // The port number when used with proxy mode. + Port float64 `json:"port"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultServiceModeV2JSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultServiceModeV2JSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultServiceModeV2] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultServiceModeV2JSON struct { + Mode apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultServiceModeV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponse struct { + Errors []AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseError `json:"errors"` + Messages []AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseMessage `json:"messages"` + Result []AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResult `json:"result"` + ResultInfo AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseSuccess `json:"success"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseJSON contains the +// JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponse] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseError] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseMessage] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResult struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch bool `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates bool `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave bool `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect float64 `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal float64 `json:"captive_portal"` + // Whether the policy is the default policy for an account. + Default bool `json:"default"` + // A description of the policy. + Description string `json:"description"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback bool `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled bool `json:"enabled"` + Exclude []AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultExclude `json:"exclude"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs bool `json:"exclude_office_ips"` + FallbackDomains []AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultFallbackDomain `json:"fallback_domains"` + GatewayUniqueID string `json:"gateway_unique_id"` + Include []AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInclude `json:"include"` + // The amount of time in minutes a user is allowed access to their LAN. A value of + // 0 will allow LAN access until the next WARP reconnection, such as a reboot or a + // laptop waking from sleep. Note that this field is omitted from the response if + // null or unset. + LanAllowMinutes float64 `json:"lan_allow_minutes"` + // The size of the subnet for the local access network. Note that this field is + // omitted from the response if null or unset. + LanAllowSubnetSize float64 `json:"lan_allow_subnet_size"` + // The wirefilter expression to match devices. + Match string `json:"match"` + // The name of the device settings profile. + Name string `json:"name"` + // Device ID. + PolicyID string `json:"policy_id"` + // The precedence of the policy. Lower values indicate higher precedence. Policies + // will be evaluated in ascending order of this field. + Precedence float64 `json:"precedence"` + ServiceModeV2 AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultServiceModeV2 `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL string `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked bool `json:"switch_locked"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResult] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultJSON struct { + AllowModeSwitch apijson.Field + AllowUpdates apijson.Field + AllowedToLeave apijson.Field + AutoConnect apijson.Field + CaptivePortal apijson.Field + Default apijson.Field + Description apijson.Field + DisableAutoFallback apijson.Field + Enabled apijson.Field + Exclude apijson.Field + ExcludeOfficeIPs apijson.Field + FallbackDomains apijson.Field + GatewayUniqueID apijson.Field + Include apijson.Field + LanAllowMinutes apijson.Field + LanAllowSubnetSize apijson.Field + Match apijson.Field + Name apijson.Field + PolicyID apijson.Field + Precedence apijson.Field + ServiceModeV2 apijson.Field + SupportURL apijson.Field + SwitchLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultExclude struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultExcludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultExcludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultExclude] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultExcludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultFallbackDomain struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultFallbackDomainJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultFallbackDomainJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultFallbackDomain] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultFallbackDomainJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultFallbackDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInclude struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultIncludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultIncludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInclude] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultIncludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultServiceModeV2 struct { + // The mode to run the WARP client under. + Mode string `json:"mode"` + // The port number when used with proxy mode. + Port float64 `json:"port"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultServiceModeV2JSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultServiceModeV2JSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultServiceModeV2] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultServiceModeV2JSON struct { + Mode apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultServiceModeV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInfo] +type accountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseSuccess bool + +const ( + AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseSuccessTrue AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponseSuccess = true +) + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseMessage `json:"messages"` + Result AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponse] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseError] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseMessage] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResult struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch bool `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates bool `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave bool `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect float64 `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal float64 `json:"captive_portal"` + // Whether the policy will be applied to matching devices. + Default bool `json:"default"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback bool `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled bool `json:"enabled"` + Exclude []AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultExclude `json:"exclude"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs bool `json:"exclude_office_ips"` + FallbackDomains []AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultFallbackDomain `json:"fallback_domains"` + GatewayUniqueID string `json:"gateway_unique_id"` + Include []AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInclude `json:"include"` + ServiceModeV2 AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultServiceModeV2 `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL string `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked bool `json:"switch_locked"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResult] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultJSON struct { + AllowModeSwitch apijson.Field + AllowUpdates apijson.Field + AllowedToLeave apijson.Field + AutoConnect apijson.Field + CaptivePortal apijson.Field + Default apijson.Field + DisableAutoFallback apijson.Field + Enabled apijson.Field + Exclude apijson.Field + ExcludeOfficeIPs apijson.Field + FallbackDomains apijson.Field + GatewayUniqueID apijson.Field + Include apijson.Field + ServiceModeV2 apijson.Field + SupportURL apijson.Field + SwitchLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultExclude struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultExcludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultExcludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultExclude] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultExcludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultFallbackDomain struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultFallbackDomainJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultFallbackDomainJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultFallbackDomain] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultFallbackDomainJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultFallbackDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInclude struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultIncludeJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultIncludeJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInclude] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultIncludeJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultServiceModeV2 struct { + // The mode to run the WARP client under. + Mode string `json:"mode"` + // The port number when used with proxy mode. + Port float64 `json:"port"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultServiceModeV2JSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultServiceModeV2JSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultServiceModeV2] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultServiceModeV2JSON struct { + Mode apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultServiceModeV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyUpdateParams struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch param.Field[bool] `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates param.Field[bool] `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave param.Field[bool] `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect param.Field[float64] `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal param.Field[float64] `json:"captive_portal"` + // A description of the policy. + Description param.Field[string] `json:"description"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback param.Field[bool] `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled param.Field[bool] `json:"enabled"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs param.Field[bool] `json:"exclude_office_ips"` + // The wirefilter expression to match devices. + Match param.Field[string] `json:"match"` + // The name of the device settings profile. + Name param.Field[string] `json:"name"` + // The precedence of the policy. Lower values indicate higher precedence. Policies + // will be evaluated in ascending order of this field. + Precedence param.Field[float64] `json:"precedence"` + ServiceModeV2 param.Field[AccountDevicePolicyUpdateParamsServiceModeV2] `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL param.Field[string] `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked param.Field[bool] `json:"switch_locked"` +} + +func (r AccountDevicePolicyUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyUpdateParamsServiceModeV2 struct { + // The mode to run the WARP client under. + Mode param.Field[string] `json:"mode"` + // The port number when used with proxy mode. + Port param.Field[float64] `json:"port"` +} + +func (r AccountDevicePolicyUpdateParamsServiceModeV2) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyParams struct { + // The wirefilter expression to match devices. + Match param.Field[string] `json:"match,required"` + // The name of the device settings profile. + Name param.Field[string] `json:"name,required"` + // The precedence of the policy. Lower values indicate higher precedence. Policies + // will be evaluated in ascending order of this field. + Precedence param.Field[float64] `json:"precedence,required"` + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch param.Field[bool] `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates param.Field[bool] `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave param.Field[bool] `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect param.Field[float64] `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal param.Field[float64] `json:"captive_portal"` + // A description of the policy. + Description param.Field[string] `json:"description"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback param.Field[bool] `json:"disable_auto_fallback"` + // Whether the policy will be applied to matching devices. + Enabled param.Field[bool] `json:"enabled"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs param.Field[bool] `json:"exclude_office_ips"` + // The amount of time in minutes a user is allowed access to their LAN. A value of + // 0 will allow LAN access until the next WARP reconnection, such as a reboot or a + // laptop waking from sleep. Note that this field is omitted from the response if + // null or unset. + LanAllowMinutes param.Field[float64] `json:"lan_allow_minutes"` + // The size of the subnet for the local access network. Note that this field is + // omitted from the response if null or unset. + LanAllowSubnetSize param.Field[float64] `json:"lan_allow_subnet_size"` + ServiceModeV2 param.Field[AccountDevicePolicyDevicesNewDeviceSettingsPolicyParamsServiceModeV2] `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL param.Field[string] `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked param.Field[bool] `json:"switch_locked"` +} + +func (r AccountDevicePolicyDevicesNewDeviceSettingsPolicyParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyDevicesNewDeviceSettingsPolicyParamsServiceModeV2 struct { + // The mode to run the WARP client under. + Mode param.Field[string] `json:"mode"` + // The port number when used with proxy mode. + Port param.Field[float64] `json:"port"` +} + +func (r AccountDevicePolicyDevicesNewDeviceSettingsPolicyParamsServiceModeV2) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParams struct { + // Whether to allow the user to switch WARP between modes. + AllowModeSwitch param.Field[bool] `json:"allow_mode_switch"` + // Whether to receive update notifications when a new version of the client is + // available. + AllowUpdates param.Field[bool] `json:"allow_updates"` + // Whether to allow devices to leave the organization. + AllowedToLeave param.Field[bool] `json:"allowed_to_leave"` + // The amount of time in minutes to reconnect after having been disabled. + AutoConnect param.Field[float64] `json:"auto_connect"` + // Turn on the captive portal after the specified amount of time. + CaptivePortal param.Field[float64] `json:"captive_portal"` + // If the `dns_server` field of a fallback domain is not present, the client will + // fall back to a best guess of the default/system DNS resolvers unless this policy + // option is set to `true`. + DisableAutoFallback param.Field[bool] `json:"disable_auto_fallback"` + // Whether to add Microsoft IPs to Split Tunnel exclusions. + ExcludeOfficeIPs param.Field[bool] `json:"exclude_office_ips"` + ServiceModeV2 param.Field[AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParamsServiceModeV2] `json:"service_mode_v2"` + // The URL to launch when the Send Feedback button is clicked. + SupportURL param.Field[string] `json:"support_url"` + // Whether to allow the user to turn off the WARP switch and disconnect the client. + SwitchLocked param.Field[bool] `json:"switch_locked"` +} + +func (r AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParamsServiceModeV2 struct { + // The mode to run the WARP client under. + Mode param.Field[string] `json:"mode"` + // The port number when used with proxy mode. + Port param.Field[float64] `json:"port"` +} + +func (r AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParamsServiceModeV2) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdevicepolicy_test.go b/accountdevicepolicy_test.go new file mode 100644 index 00000000000..ac09b884a1f --- /dev/null +++ b/accountdevicepolicy_test.go @@ -0,0 +1,271 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDevicePolicyGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePolicyUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDevicePolicyUpdateParams{ + AllowModeSwitch: cloudflare.F(true), + AllowUpdates: cloudflare.F(true), + AllowedToLeave: cloudflare.F(true), + AutoConnect: cloudflare.F(0.000000), + CaptivePortal: cloudflare.F(180.000000), + Description: cloudflare.F("Policy for test teams."), + DisableAutoFallback: cloudflare.F(true), + Enabled: cloudflare.F(true), + ExcludeOfficeIPs: cloudflare.F(true), + Match: cloudflare.F("user.identity == \"test@cloudflare.com\""), + Name: cloudflare.F("Allow Developers"), + Precedence: cloudflare.F(100.000000), + ServiceModeV2: cloudflare.F(cloudflare.AccountDevicePolicyUpdateParamsServiceModeV2{ + Mode: cloudflare.F("proxy"), + Port: cloudflare.F(3000.000000), + }), + SupportURL: cloudflare.F("https://1.1.1.1/help"), + SwitchLocked: cloudflare.F(true), + }, + ) + 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 TestAccountDevicePolicyDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePolicyDevicesNewDeviceSettingsPolicyWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.DevicesNewDeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDevicePolicyDevicesNewDeviceSettingsPolicyParams{ + Match: cloudflare.F("user.identity == \"test@cloudflare.com\""), + Name: cloudflare.F("Allow Developers"), + Precedence: cloudflare.F(100.000000), + AllowModeSwitch: cloudflare.F(true), + AllowUpdates: cloudflare.F(true), + AllowedToLeave: cloudflare.F(true), + AutoConnect: cloudflare.F(0.000000), + CaptivePortal: cloudflare.F(180.000000), + Description: cloudflare.F("Policy for test teams."), + DisableAutoFallback: cloudflare.F(true), + Enabled: cloudflare.F(true), + ExcludeOfficeIPs: cloudflare.F(true), + LanAllowMinutes: cloudflare.F(30.000000), + LanAllowSubnetSize: cloudflare.F(24.000000), + ServiceModeV2: cloudflare.F(cloudflare.AccountDevicePolicyDevicesNewDeviceSettingsPolicyParamsServiceModeV2{ + Mode: cloudflare.F("proxy"), + Port: cloudflare.F(3000.000000), + }), + SupportURL: cloudflare.F("https://1.1.1.1/help"), + SwitchLocked: cloudflare.F(true), + }, + ) + 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 TestAccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicy(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.DevicesGetDefaultDeviceSettingsPolicy(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountDevicePolicyDevicesListDeviceSettingsPolicies(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.DevicesListDeviceSettingsPolicies(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.DevicesUpdateDefaultDeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParams{ + AllowModeSwitch: cloudflare.F(true), + AllowUpdates: cloudflare.F(true), + AllowedToLeave: cloudflare.F(true), + AutoConnect: cloudflare.F(0.000000), + CaptivePortal: cloudflare.F(180.000000), + DisableAutoFallback: cloudflare.F(true), + ExcludeOfficeIPs: cloudflare.F(true), + ServiceModeV2: cloudflare.F(cloudflare.AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParamsServiceModeV2{ + Mode: cloudflare.F("proxy"), + Port: cloudflare.F(3000.000000), + }), + SupportURL: cloudflare.F("https://1.1.1.1/help"), + SwitchLocked: cloudflare.F(true), + }, + ) + 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/accountdevicepolicyexclude.go b/accountdevicepolicyexclude.go new file mode 100644 index 00000000000..09695992946 --- /dev/null +++ b/accountdevicepolicyexclude.go @@ -0,0 +1,628 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDevicePolicyExcludeService 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 +// [NewAccountDevicePolicyExcludeService] method instead. +type AccountDevicePolicyExcludeService struct { + Options []option.RequestOption +} + +// NewAccountDevicePolicyExcludeService 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 NewAccountDevicePolicyExcludeService(opts ...option.RequestOption) (r *AccountDevicePolicyExcludeService) { + r = &AccountDevicePolicyExcludeService{} + r.Options = opts + return +} + +// Fetches the list of routes excluded from the WARP client's tunnel. +func (r *AccountDevicePolicyExcludeService) DevicesGetSplitTunnelExcludeList(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/exclude", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Fetches the list of routes excluded from the WARP client's tunnel for a specific +// device settings profile. +func (r *AccountDevicePolicyExcludeService) DevicesGetSplitTunnelExcludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s/exclude", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Sets the list of routes excluded from the WARP client's tunnel. +func (r *AccountDevicePolicyExcludeService) DevicesSetSplitTunnelExcludeList(ctx context.Context, identifier interface{}, body AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParams, opts ...option.RequestOption) (res *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/exclude", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Sets the list of routes excluded from the WARP client's tunnel for a specific +// device settings profile. +func (r *AccountDevicePolicyExcludeService) DevicesSetSplitTunnelExcludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, body AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParams, opts ...option.RequestOption) (res *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s/exclude", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponse struct { + Errors []AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseError `json:"errors"` + Messages []AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseMessage `json:"messages"` + Result []AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResult `json:"result"` + ResultInfo AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseSuccess `json:"success"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponse] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseError] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseMessage] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResult struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResult] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultInfo] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseSuccess bool + +const ( + AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseSuccessTrue AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponseSuccess = true +) + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage `json:"messages"` + Result []AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponse] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponse struct { + Errors []AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseError `json:"errors"` + Messages []AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseMessage `json:"messages"` + Result []AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResult `json:"result"` + ResultInfo AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseSuccess `json:"success"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponse] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseError] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseMessage] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResult struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResult] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultInfo] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseSuccess bool + +const ( + AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseSuccessTrue AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponseSuccess = true +) + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage `json:"messages"` + Result []AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponse] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address string `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host string `json:"host"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParams struct { + Body param.Field[[]AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParamsBody] `json:"body,required"` +} + +func (r AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParamsBody struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address param.Field[string] `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description param.Field[string] `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host param.Field[string] `json:"host"` +} + +func (r AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParams struct { + Body param.Field[[]AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParamsBody] `json:"body,required"` +} + +func (r AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParamsBody struct { + // The address in CIDR format to exclude from the tunnel. If `address` is present, + // `host` must not be present. + Address param.Field[string] `json:"address,required"` + // A description of the Split Tunnel item, displayed in the client UI. + Description param.Field[string] `json:"description,required"` + // The domain name to exclude from the tunnel. If `host` is present, `address` must + // not be present. + Host param.Field[string] `json:"host"` +} + +func (r AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdevicepolicyexclude_test.go b/accountdevicepolicyexclude_test.go new file mode 100644 index 00000000000..1e977e105b8 --- /dev/null +++ b/accountdevicepolicyexclude_test.go @@ -0,0 +1,159 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Excludes.DevicesGetSplitTunnelExcludeList(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicy(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Excludes.DevicesGetSplitTunnelExcludeListForADeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Excludes.DevicesSetSplitTunnelExcludeList( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParams{ + Body: cloudflare.F([]cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParamsBody{{ + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Exclude testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Exclude testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Exclude testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }}), + }, + ) + 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 TestAccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicy(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Excludes.DevicesSetSplitTunnelExcludeListForADeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParams{ + Body: cloudflare.F([]cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParamsBody{{ + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Exclude testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Exclude testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Exclude testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }}), + }, + ) + 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/accountdevicepolicyfallbackdomain.go b/accountdevicepolicyfallbackdomain.go new file mode 100644 index 00000000000..c62db80fb76 --- /dev/null +++ b/accountdevicepolicyfallbackdomain.go @@ -0,0 +1,620 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDevicePolicyFallbackDomainService 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 +// [NewAccountDevicePolicyFallbackDomainService] method instead. +type AccountDevicePolicyFallbackDomainService struct { + Options []option.RequestOption +} + +// NewAccountDevicePolicyFallbackDomainService 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 NewAccountDevicePolicyFallbackDomainService(opts ...option.RequestOption) (r *AccountDevicePolicyFallbackDomainService) { + r = &AccountDevicePolicyFallbackDomainService{} + r.Options = opts + return +} + +// Fetches a list of domains to bypass Gateway DNS resolution. These domains will +// use the specified local DNS resolver instead. +func (r *AccountDevicePolicyFallbackDomainService) DevicesGetLocalDomainFallbackList(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/fallback_domains", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Fetches the list of domains to bypass Gateway DNS resolution from a specified +// device settings profile. These domains will use the specified local DNS resolver +// instead. +func (r *AccountDevicePolicyFallbackDomainService) DevicesGetLocalDomainFallbackListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s/fallback_domains", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Sets the list of domains to bypass Gateway DNS resolution. These domains will +// use the specified local DNS resolver instead. +func (r *AccountDevicePolicyFallbackDomainService) DevicesSetLocalDomainFallbackList(ctx context.Context, identifier interface{}, body AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParams, opts ...option.RequestOption) (res *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/fallback_domains", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Sets the list of domains to bypass Gateway DNS resolution. These domains will +// use the specified local DNS resolver instead. This will only apply to the +// specified device settings profile. +func (r *AccountDevicePolicyFallbackDomainService) DevicesSetLocalDomainFallbackListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, body AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParams, opts ...option.RequestOption) (res *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s/fallback_domains", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponse struct { + Errors []AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseError `json:"errors"` + Messages []AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseMessage `json:"messages"` + Result []AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResult `json:"result"` + ResultInfo AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseSuccess `json:"success"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponse] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseError] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseMessage] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResult struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResult] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultInfo] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseSuccess bool + +const ( + AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseSuccessTrue AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponseSuccess = true +) + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage `json:"messages"` + Result []AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponse] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseError] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponse struct { + Errors []AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseError `json:"errors"` + Messages []AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseMessage `json:"messages"` + Result []AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResult `json:"result"` + ResultInfo AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseSuccess `json:"success"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponse] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseError] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseMessage] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResult struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResult] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultInfo] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseSuccess bool + +const ( + AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseSuccessTrue AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponseSuccess = true +) + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage `json:"messages"` + Result []AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponse] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseError] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult struct { + // The domain suffix to match when resolving locally. + Suffix string `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description string `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer []interface{} `json:"dns_server"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultJSON struct { + Suffix apijson.Field + Description apijson.Field + DNSServer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParams struct { + Body param.Field[[]AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParamsBody] `json:"body,required"` +} + +func (r AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParamsBody struct { + // The domain suffix to match when resolving locally. + Suffix param.Field[string] `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description param.Field[string] `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer param.Field[[]interface{}] `json:"dns_server"` +} + +func (r AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParams struct { + Body param.Field[[]AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParamsBody] `json:"body,required"` +} + +func (r AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParamsBody struct { + // The domain suffix to match when resolving locally. + Suffix param.Field[string] `json:"suffix,required"` + // A description of the fallback domain, displayed in the client UI. + Description param.Field[string] `json:"description"` + // A list of IP addresses to handle domain resolution. + DNSServer param.Field[[]interface{}] `json:"dns_server"` +} + +func (r AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdevicepolicyfallbackdomain_test.go b/accountdevicepolicyfallbackdomain_test.go new file mode 100644 index 00000000000..7d35116c0b3 --- /dev/null +++ b/accountdevicepolicyfallbackdomain_test.go @@ -0,0 +1,159 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.FallbackDomains.DevicesGetLocalDomainFallbackList(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicy(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.FallbackDomains.DevicesGetLocalDomainFallbackListForADeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.FallbackDomains.DevicesSetLocalDomainFallbackList( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParams{ + Body: cloudflare.F([]cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParamsBody{{ + Description: cloudflare.F("Domain bypass for local development"), + DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + Suffix: cloudflare.F("example.com"), + }, { + Description: cloudflare.F("Domain bypass for local development"), + DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + Suffix: cloudflare.F("example.com"), + }, { + Description: cloudflare.F("Domain bypass for local development"), + DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + Suffix: cloudflare.F("example.com"), + }}), + }, + ) + 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 TestAccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicy(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.FallbackDomains.DevicesSetLocalDomainFallbackListForADeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParams{ + Body: cloudflare.F([]cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParamsBody{{ + Description: cloudflare.F("Domain bypass for local development"), + DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + Suffix: cloudflare.F("example.com"), + }, { + Description: cloudflare.F("Domain bypass for local development"), + DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + Suffix: cloudflare.F("example.com"), + }, { + Description: cloudflare.F("Domain bypass for local development"), + DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + Suffix: cloudflare.F("example.com"), + }}), + }, + ) + 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/accountdevicepolicyinclude.go b/accountdevicepolicyinclude.go new file mode 100644 index 00000000000..a4ef7fafa02 --- /dev/null +++ b/accountdevicepolicyinclude.go @@ -0,0 +1,628 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDevicePolicyIncludeService 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 +// [NewAccountDevicePolicyIncludeService] method instead. +type AccountDevicePolicyIncludeService struct { + Options []option.RequestOption +} + +// NewAccountDevicePolicyIncludeService 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 NewAccountDevicePolicyIncludeService(opts ...option.RequestOption) (r *AccountDevicePolicyIncludeService) { + r = &AccountDevicePolicyIncludeService{} + r.Options = opts + return +} + +// Fetches the list of routes included in the WARP client's tunnel. +func (r *AccountDevicePolicyIncludeService) DevicesGetSplitTunnelIncludeList(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/include", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Fetches the list of routes included in the WARP client's tunnel for a specific +// device settings profile. +func (r *AccountDevicePolicyIncludeService) DevicesGetSplitTunnelIncludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s/include", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Sets the list of routes included in the WARP client's tunnel. +func (r *AccountDevicePolicyIncludeService) DevicesSetSplitTunnelIncludeList(ctx context.Context, identifier interface{}, body AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParams, opts ...option.RequestOption) (res *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/include", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Sets the list of routes included in the WARP client's tunnel for a specific +// device settings profile. +func (r *AccountDevicePolicyIncludeService) DevicesSetSplitTunnelIncludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, body AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParams, opts ...option.RequestOption) (res *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/policy/%s/include", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponse struct { + Errors []AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseError `json:"errors"` + Messages []AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseMessage `json:"messages"` + Result []AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResult `json:"result"` + ResultInfo AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseSuccess `json:"success"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponse] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseError] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseMessage] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResult struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResult] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultInfo] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseSuccess bool + +const ( + AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseSuccessTrue AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponseSuccess = true +) + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage `json:"messages"` + Result []AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponse] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponse struct { + Errors []AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseError `json:"errors"` + Messages []AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseMessage `json:"messages"` + Result []AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResult `json:"result"` + ResultInfo AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseSuccess `json:"success"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseJSON contains +// the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponse] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseError] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseMessage] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResult struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResult] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultInfo] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseSuccess bool + +const ( + AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseSuccessTrue AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponseSuccess = true +) + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponse struct { + Errors []AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError `json:"errors"` + Messages []AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage `json:"messages"` + Result []AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult `json:"result"` + ResultInfo AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccess `json:"success"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponse] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseErrorJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessageJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address string `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description string `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host string `json:"host"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultJSON struct { + Address apijson.Field + Description apijson.Field + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfoJSON `json:"-"` +} + +// accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo] +type accountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccess bool + +const ( + AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccessTrue AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponseSuccess = true +) + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParams struct { + Body param.Field[[]AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParamsBody] `json:"body,required"` +} + +func (r AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParamsBody struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address param.Field[string] `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description param.Field[string] `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host param.Field[string] `json:"host"` +} + +func (r AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParams struct { + Body param.Field[[]AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParamsBody] `json:"body,required"` +} + +func (r AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParamsBody struct { + // The address in CIDR format to include in the tunnel. If address is present, host + // must not be present. + Address param.Field[string] `json:"address,required"` + // A description of the split tunnel item, displayed in the client UI. + Description param.Field[string] `json:"description,required"` + // The domain name to include in the tunnel. If host is present, address must not + // be present. + Host param.Field[string] `json:"host"` +} + +func (r AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdevicepolicyinclude_test.go b/accountdevicepolicyinclude_test.go new file mode 100644 index 00000000000..92b311f9282 --- /dev/null +++ b/accountdevicepolicyinclude_test.go @@ -0,0 +1,159 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Includes.DevicesGetSplitTunnelIncludeList(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicy(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Includes.DevicesGetSplitTunnelIncludeListForADeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Includes.DevicesSetSplitTunnelIncludeList( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParams{ + Body: cloudflare.F([]cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParamsBody{{ + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Include testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Include testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Include testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }}), + }, + ) + 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 TestAccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicy(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Policies.Includes.DevicesSetSplitTunnelIncludeListForADeviceSettingsPolicy( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParams{ + Body: cloudflare.F([]cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParamsBody{{ + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Include testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Include testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }, { + Address: cloudflare.F("192.0.2.0/24"), + Description: cloudflare.F("Include testing domains from the tunnel"), + Host: cloudflare.F("*.example.com"), + }}), + }, + ) + 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/accountdeviceposture.go b/accountdeviceposture.go new file mode 100644 index 00000000000..4c4162773ba --- /dev/null +++ b/accountdeviceposture.go @@ -0,0 +1,4727 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDevicePostureService 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 [NewAccountDevicePostureService] +// method instead. +type AccountDevicePostureService struct { + Options []option.RequestOption + Integrations *AccountDevicePostureIntegrationService +} + +// NewAccountDevicePostureService 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 NewAccountDevicePostureService(opts ...option.RequestOption) (r *AccountDevicePostureService) { + r = &AccountDevicePostureService{} + r.Options = opts + r.Integrations = NewAccountDevicePostureIntegrationService(opts...) + return +} + +// Fetches a single device posture rule. +func (r *AccountDevicePostureService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePostureGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a device posture rule. +func (r *AccountDevicePostureService) Update(ctx context.Context, identifier interface{}, uuid string, body AccountDevicePostureUpdateParams, opts ...option.RequestOption) (res *AccountDevicePostureUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a device posture rule. +func (r *AccountDevicePostureService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePostureDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new device posture rule. +func (r *AccountDevicePostureService) DevicePostureRulesNewDevicePostureRule(ctx context.Context, identifier interface{}, body AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParams, opts ...option.RequestOption) (res *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches device posture rules for a Zero Trust account. +func (r *AccountDevicePostureService) DevicePostureRulesListDevicePostureRules(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDevicePostureGetResponse struct { + Errors []AccountDevicePostureGetResponseError `json:"errors"` + Messages []AccountDevicePostureGetResponseMessage `json:"messages"` + Result AccountDevicePostureGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDevicePostureGetResponseSuccess `json:"success"` + JSON accountDevicePostureGetResponseJSON `json:"-"` +} + +// accountDevicePostureGetResponseJSON contains the JSON metadata for the struct +// [AccountDevicePostureGetResponse] +type accountDevicePostureGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureGetResponseErrorJSON `json:"-"` +} + +// accountDevicePostureGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountDevicePostureGetResponseError] +type accountDevicePostureGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureGetResponseMessageJSON `json:"-"` +} + +// accountDevicePostureGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDevicePostureGetResponseMessage] +type accountDevicePostureGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureGetResponseResult struct { + // API UUID. + ID string `json:"id"` + // The description of the device posture rule. + Description string `json:"description"` + // Sets the expiration time for a posture check result. If empty, the result + // remains valid until it is overwritten by new data from the WARP client. + Expiration string `json:"expiration"` + // The value to be checked against. + Input AccountDevicePostureGetResponseResultInput `json:"input"` + // The conditions that the client must match to run the rule. + Match []AccountDevicePostureGetResponseResultMatch `json:"match"` + // The name of the device posture rule. + Name string `json:"name"` + // Polling frequency for the WARP client posture check. Default: `5m` (poll every + // five minutes). Minimum: `1m`. + Schedule string `json:"schedule"` + // The type of device posture rule. + Type AccountDevicePostureGetResponseResultType `json:"type"` + JSON accountDevicePostureGetResponseResultJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDevicePostureGetResponseResult] +type accountDevicePostureGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expiration apijson.Field + Input apijson.Field + Match apijson.Field + Name apijson.Field + Schedule apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The value to be checked against. +// +// Union satisfied by +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhDiskEncryptionInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhClientCertificateInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequest], +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequest] or +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequest]. +type AccountDevicePostureGetResponseResultInput interface { + implementsAccountDevicePostureGetResponseResultInput() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountDevicePostureGetResponseResultInput)(nil)).Elem(), "") +} + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // Whether or not file exists + Exists bool `json:"exists"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhFileInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhFileInputRequestJSON contains +// the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhFileInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Exists apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating system +type AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemWindows AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "windows" + AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemLinux AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "linux" + AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemMac AccountDevicePostureGetResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequest struct { + // List ID. + ID string `json:"id,required"` + // Operating System + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON struct { + ID apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating System +type AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemAndroid AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "android" + AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemIos AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "ios" + AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemChromeos AccountDevicePostureGetResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "chromeos" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem `json:"operating_system,required"` + // Domain + Domain string `json:"domain"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON struct { + OperatingSystem apijson.Field + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating System +type AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystemWindows AccountDevicePostureGetResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem = "windows" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem `json:"operating_system,required"` + // Operator + Operator AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperator `json:"operator,required"` + // Version of OS + Version string `json:"version,required"` + // Operating System Distribution Name (linux only) + OsDistroName string `json:"os_distro_name"` + // Version of OS Distribution (linux only) + OsDistroRevision string `json:"os_distro_revision"` + // Product Verison Extra that Mac OS uses (mac only) + OsVersionExtra string `json:"os_version_extra"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhOsVersionInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhOsVersionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhOsVersionInputRequestJSON struct { + OperatingSystem apijson.Field + Operator apijson.Field + Version apijson.Field + OsDistroName apijson.Field + OsDistroRevision apijson.Field + OsVersionExtra apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating System +type AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystemWindows AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem = "windows" +) + +// Operator +type AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperator string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown5 AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<" + AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown6 AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown7 AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">" + AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown8 AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown9 AccountDevicePostureGetResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "==" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequest struct { + // Enabled + Enabled bool `json:"enabled,required"` + // Operating System + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhFirewallInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhFirewallInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhFirewallInputRequestJSON struct { + Enabled apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating System +type AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemWindows AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "windows" + AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemMac AccountDevicePostureGetResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhSentineloneInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhSentineloneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhSentineloneInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating system +type AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemWindows AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "windows" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemLinux AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "linux" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemMac AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating system +type AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemWindows AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "windows" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemLinux AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "linux" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemMac AccountDevicePostureGetResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhDiskEncryptionInputRequest struct { + // List of volume names to be checked for encryption. + CheckDisks []string `json:"checkDisks"` + // Whether to check all disks for encryption. + RequireAll bool `json:"requireAll"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhDiskEncryptionInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON struct { + CheckDisks apijson.Field + RequireAll apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem `json:"operating_system,required"` + // Path for the application. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhApplicationInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhApplicationInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhApplicationInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operating system +type AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemWindows AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "windows" + AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemLinux AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "linux" + AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemMac AccountDevicePostureGetResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhClientCertificateInputRequest struct { + // UUID of Cloudflare managed certificate. + CertificateID string `json:"certificate_id,required"` + // Common Name that is protected by the certificate + Cn string `json:"cn,required"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhClientCertificateInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON struct { + CertificateID apijson.Field + Cn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhClientCertificateInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhClientCertificateInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusCompliant AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "compliant" + AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusNoncompliant AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusUnknown AccountDevicePostureGetResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "unknown" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Operator + Operator AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator `json:"operator"` + // Os Version + Os string `json:"os"` + // overall + Overall string `json:"overall"` + // SensorConfig + SensorConfig string `json:"sensor_config"` + // Version + Version string `json:"version"` + // Version Operator + VersionOperator AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator `json:"versionOperator"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON struct { + ConnectionID apijson.Field + Operator apijson.Field + Os apijson.Field + Overall apijson.Field + SensorConfig apijson.Field + Version apijson.Field + VersionOperator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operator +type AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown15 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown16 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown17 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown18 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown19 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "==" +) + +// Version Operator +type AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown25 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown26 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown27 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown28 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown29 AccountDevicePostureGetResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "==" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhIntuneInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhIntuneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhIntuneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusCompliant AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "compliant" + AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNoncompliant AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusUnknown AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "unknown" + AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNotapplicable AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "notapplicable" + AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusIngraceperiod AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "ingraceperiod" + AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusError AccountDevicePostureGetResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "error" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Count Operator + CountOperator AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperator `json:"countOperator,required"` + // The Number of Issues. + IssueCount string `json:"issue_count,required"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhKolideInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhKolideInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhKolideInputRequestJSON struct { + ConnectionID apijson.Field + CountOperator apijson.Field + IssueCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Count Operator +type AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperator string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown35 AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<" + AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown36 AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown37 AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">" + AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown38 AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown39 AccountDevicePostureGetResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "==" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // For more details on eid last seen, refer to the Tanium documentation. + EidLastSeen string `json:"eid_last_seen"` + // Operator to evaluate risk_level or eid_last_seen. + Operator AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperator `json:"operator"` + // For more details on risk level, refer to the Tanium documentation. + RiskLevel AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel `json:"risk_level"` + // Score Operator + ScoreOperator AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator `json:"scoreOperator"` + // For more details on total score, refer to the Tanium documentation. + TotalScore float64 `json:"total_score"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhTaniumInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhTaniumInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhTaniumInputRequestJSON struct { + ConnectionID apijson.Field + EidLastSeen apijson.Field + Operator apijson.Field + RiskLevel apijson.Field + ScoreOperator apijson.Field + TotalScore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Operator to evaluate risk_level or eid_last_seen. +type AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperator string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown45 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown46 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown47 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown48 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown49 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "==" +) + +// For more details on risk level, refer to the Tanium documentation. +type AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelLow AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "low" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelMedium AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "medium" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelHigh AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "high" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelCritical AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "critical" +) + +// Score Operator +type AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown55 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown56 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown57 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown58 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown59 AccountDevicePostureGetResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "==" +) + +type AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // The Number of active threats. + ActiveThreats float64 `json:"active_threats"` + // Whether device is infected. + Infected bool `json:"infected"` + // Whether device is active. + IsActive bool `json:"is_active"` + // Network status of device. + NetworkStatus AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus `json:"network_status"` + // operator + Operator AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator `json:"operator"` + JSON accountDevicePostureGetResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequest] +type accountDevicePostureGetResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON struct { + ConnectionID apijson.Field + ActiveThreats apijson.Field + Infected apijson.Field + IsActive apijson.Field + NetworkStatus apijson.Field + Operator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) implementsAccountDevicePostureGetResponseResultInput() { +} + +// Network status of device. +type AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnected AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connected" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnected AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnected" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnecting AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnecting" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnecting AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connecting" +) + +// operator +type AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator string + +const ( + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown65 AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown66 AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown67 AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown68 AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">=" + AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown69 AccountDevicePostureGetResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "==" +) + +type AccountDevicePostureGetResponseResultMatch struct { + Platform AccountDevicePostureGetResponseResultMatchPlatform `json:"platform"` + JSON accountDevicePostureGetResponseResultMatchJSON `json:"-"` +} + +// accountDevicePostureGetResponseResultMatchJSON contains the JSON metadata for +// the struct [AccountDevicePostureGetResponseResultMatch] +type accountDevicePostureGetResponseResultMatchJSON struct { + Platform apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureGetResponseResultMatch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureGetResponseResultMatchPlatform string + +const ( + AccountDevicePostureGetResponseResultMatchPlatformWindows AccountDevicePostureGetResponseResultMatchPlatform = "windows" + AccountDevicePostureGetResponseResultMatchPlatformMac AccountDevicePostureGetResponseResultMatchPlatform = "mac" + AccountDevicePostureGetResponseResultMatchPlatformLinux AccountDevicePostureGetResponseResultMatchPlatform = "linux" + AccountDevicePostureGetResponseResultMatchPlatformAndroid AccountDevicePostureGetResponseResultMatchPlatform = "android" + AccountDevicePostureGetResponseResultMatchPlatformIos AccountDevicePostureGetResponseResultMatchPlatform = "ios" +) + +// The type of device posture rule. +type AccountDevicePostureGetResponseResultType string + +const ( + AccountDevicePostureGetResponseResultTypeFile AccountDevicePostureGetResponseResultType = "file" + AccountDevicePostureGetResponseResultTypeApplication AccountDevicePostureGetResponseResultType = "application" + AccountDevicePostureGetResponseResultTypeTanium AccountDevicePostureGetResponseResultType = "tanium" + AccountDevicePostureGetResponseResultTypeGateway AccountDevicePostureGetResponseResultType = "gateway" + AccountDevicePostureGetResponseResultTypeWarp AccountDevicePostureGetResponseResultType = "warp" + AccountDevicePostureGetResponseResultTypeDiskEncryption AccountDevicePostureGetResponseResultType = "disk_encryption" + AccountDevicePostureGetResponseResultTypeSentinelone AccountDevicePostureGetResponseResultType = "sentinelone" + AccountDevicePostureGetResponseResultTypeCarbonblack AccountDevicePostureGetResponseResultType = "carbonblack" + AccountDevicePostureGetResponseResultTypeFirewall AccountDevicePostureGetResponseResultType = "firewall" + AccountDevicePostureGetResponseResultTypeOsVersion AccountDevicePostureGetResponseResultType = "os_version" + AccountDevicePostureGetResponseResultTypeDomainJoined AccountDevicePostureGetResponseResultType = "domain_joined" + AccountDevicePostureGetResponseResultTypeClientCertificate AccountDevicePostureGetResponseResultType = "client_certificate" + AccountDevicePostureGetResponseResultTypeUniqueClientID AccountDevicePostureGetResponseResultType = "unique_client_id" + AccountDevicePostureGetResponseResultTypeKolide AccountDevicePostureGetResponseResultType = "kolide" + AccountDevicePostureGetResponseResultTypeTaniumS2s AccountDevicePostureGetResponseResultType = "tanium_s2s" + AccountDevicePostureGetResponseResultTypeCrowdstrikeS2s AccountDevicePostureGetResponseResultType = "crowdstrike_s2s" + AccountDevicePostureGetResponseResultTypeIntune AccountDevicePostureGetResponseResultType = "intune" + AccountDevicePostureGetResponseResultTypeWorkspaceOne AccountDevicePostureGetResponseResultType = "workspace_one" + AccountDevicePostureGetResponseResultTypeSentineloneS2s AccountDevicePostureGetResponseResultType = "sentinelone_s2s" +) + +// Whether the API call was successful. +type AccountDevicePostureGetResponseSuccess bool + +const ( + AccountDevicePostureGetResponseSuccessTrue AccountDevicePostureGetResponseSuccess = true +) + +type AccountDevicePostureUpdateResponse struct { + Errors []AccountDevicePostureUpdateResponseError `json:"errors"` + Messages []AccountDevicePostureUpdateResponseMessage `json:"messages"` + Result AccountDevicePostureUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDevicePostureUpdateResponseSuccess `json:"success"` + JSON accountDevicePostureUpdateResponseJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseJSON contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponse] +type accountDevicePostureUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureUpdateResponseErrorJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountDevicePostureUpdateResponseError] +type accountDevicePostureUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureUpdateResponseMessageJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountDevicePostureUpdateResponseMessage] +type accountDevicePostureUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureUpdateResponseResult struct { + // API UUID. + ID string `json:"id"` + // The description of the device posture rule. + Description string `json:"description"` + // Sets the expiration time for a posture check result. If empty, the result + // remains valid until it is overwritten by new data from the WARP client. + Expiration string `json:"expiration"` + // The value to be checked against. + Input AccountDevicePostureUpdateResponseResultInput `json:"input"` + // The conditions that the client must match to run the rule. + Match []AccountDevicePostureUpdateResponseResultMatch `json:"match"` + // The name of the device posture rule. + Name string `json:"name"` + // Polling frequency for the WARP client posture check. Default: `5m` (poll every + // five minutes). Minimum: `1m`. + Schedule string `json:"schedule"` + // The type of device posture rule. + Type AccountDevicePostureUpdateResponseResultType `json:"type"` + JSON accountDevicePostureUpdateResponseResultJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountDevicePostureUpdateResponseResult] +type accountDevicePostureUpdateResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expiration apijson.Field + Input apijson.Field + Match apijson.Field + Name apijson.Field + Schedule apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The value to be checked against. +// +// Union satisfied by +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDiskEncryptionInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhClientCertificateInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequest], +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequest] or +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequest]. +type AccountDevicePostureUpdateResponseResultInput interface { + implementsAccountDevicePostureUpdateResponseResultInput() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountDevicePostureUpdateResponseResultInput)(nil)).Elem(), "") +} + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // Whether or not file exists + Exists bool `json:"exists"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhFileInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhFileInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhFileInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Exists apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating system +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemWindows AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemLinux AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemMac AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequest struct { + // List ID. + ID string `json:"id,required"` + // Operating System + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON struct { + ID apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating System +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemAndroid AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "android" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemIos AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "ios" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemChromeos AccountDevicePostureUpdateResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "chromeos" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem `json:"operating_system,required"` + // Domain + Domain string `json:"domain"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON struct { + OperatingSystem apijson.Field + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating System +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystemWindows AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem = "windows" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem `json:"operating_system,required"` + // Operator + Operator AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperator `json:"operator,required"` + // Version of OS + Version string `json:"version,required"` + // Operating System Distribution Name (linux only) + OsDistroName string `json:"os_distro_name"` + // Version of OS Distribution (linux only) + OsDistroRevision string `json:"os_distro_revision"` + // Product Verison Extra that Mac OS uses (mac only) + OsVersionExtra string `json:"os_version_extra"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhOsVersionInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhOsVersionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhOsVersionInputRequestJSON struct { + OperatingSystem apijson.Field + Operator apijson.Field + Version apijson.Field + OsDistroName apijson.Field + OsDistroRevision apijson.Field + OsVersionExtra apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating System +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystemWindows AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem = "windows" +) + +// Operator +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperator string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown75 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown76 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown77 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown78 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown79 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "==" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequest struct { + // Enabled + Enabled bool `json:"enabled,required"` + // Operating System + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhFirewallInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhFirewallInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhFirewallInputRequestJSON struct { + Enabled apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating System +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemWindows AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemMac AccountDevicePostureUpdateResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhSentineloneInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhSentineloneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhSentineloneInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating system +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemWindows AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemLinux AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemMac AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating system +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemWindows AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemLinux AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemMac AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDiskEncryptionInputRequest struct { + // List of volume names to be checked for encryption. + CheckDisks []string `json:"checkDisks"` + // Whether to check all disks for encryption. + RequireAll bool `json:"requireAll"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDiskEncryptionInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON struct { + CheckDisks apijson.Field + RequireAll apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem `json:"operating_system,required"` + // Path for the application. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhApplicationInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhApplicationInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhApplicationInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operating system +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemWindows AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemLinux AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemMac AccountDevicePostureUpdateResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhClientCertificateInputRequest struct { + // UUID of Cloudflare managed certificate. + CertificateID string `json:"certificate_id,required"` + // Common Name that is protected by the certificate + Cn string `json:"cn,required"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhClientCertificateInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON struct { + CertificateID apijson.Field + Cn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhClientCertificateInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhClientCertificateInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusCompliant AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "compliant" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusNoncompliant AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusUnknown AccountDevicePostureUpdateResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "unknown" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Operator + Operator AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator `json:"operator"` + // Os Version + Os string `json:"os"` + // overall + Overall string `json:"overall"` + // SensorConfig + SensorConfig string `json:"sensor_config"` + // Version + Version string `json:"version"` + // Version Operator + VersionOperator AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator `json:"versionOperator"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON struct { + ConnectionID apijson.Field + Operator apijson.Field + Os apijson.Field + Overall apijson.Field + SensorConfig apijson.Field + Version apijson.Field + VersionOperator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operator +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown85 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown86 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown87 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown88 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown89 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "==" +) + +// Version Operator +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown95 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown96 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown97 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown98 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown99 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "==" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhIntuneInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhIntuneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhIntuneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusCompliant AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "compliant" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNoncompliant AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusUnknown AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "unknown" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNotapplicable AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "notapplicable" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusIngraceperiod AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "ingraceperiod" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusError AccountDevicePostureUpdateResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "error" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Count Operator + CountOperator AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperator `json:"countOperator,required"` + // The Number of Issues. + IssueCount string `json:"issue_count,required"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhKolideInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhKolideInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhKolideInputRequestJSON struct { + ConnectionID apijson.Field + CountOperator apijson.Field + IssueCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Count Operator +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperator string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown105 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown106 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown107 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown108 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown109 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "==" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // For more details on eid last seen, refer to the Tanium documentation. + EidLastSeen string `json:"eid_last_seen"` + // Operator to evaluate risk_level or eid_last_seen. + Operator AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperator `json:"operator"` + // For more details on risk level, refer to the Tanium documentation. + RiskLevel AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel `json:"risk_level"` + // Score Operator + ScoreOperator AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator `json:"scoreOperator"` + // For more details on total score, refer to the Tanium documentation. + TotalScore float64 `json:"total_score"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhTaniumInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhTaniumInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhTaniumInputRequestJSON struct { + ConnectionID apijson.Field + EidLastSeen apijson.Field + Operator apijson.Field + RiskLevel apijson.Field + ScoreOperator apijson.Field + TotalScore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Operator to evaluate risk_level or eid_last_seen. +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperator string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown115 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown116 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown117 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown118 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown119 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "==" +) + +// For more details on risk level, refer to the Tanium documentation. +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelLow AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "low" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelMedium AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "medium" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelHigh AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "high" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelCritical AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "critical" +) + +// Score Operator +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown125 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown126 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown127 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown128 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown129 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "==" +) + +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // The Number of active threats. + ActiveThreats float64 `json:"active_threats"` + // Whether device is infected. + Infected bool `json:"infected"` + // Whether device is active. + IsActive bool `json:"is_active"` + // Network status of device. + NetworkStatus AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus `json:"network_status"` + // operator + Operator AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator `json:"operator"` + JSON accountDevicePostureUpdateResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequest] +type accountDevicePostureUpdateResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON struct { + ConnectionID apijson.Field + ActiveThreats apijson.Field + Infected apijson.Field + IsActive apijson.Field + NetworkStatus apijson.Field + Operator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) implementsAccountDevicePostureUpdateResponseResultInput() { +} + +// Network status of device. +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnected AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connected" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnected AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnected" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnecting AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnecting" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnecting AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connecting" +) + +// operator +type AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator string + +const ( + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown135 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown136 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown137 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown138 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">=" + AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown139 AccountDevicePostureUpdateResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "==" +) + +type AccountDevicePostureUpdateResponseResultMatch struct { + Platform AccountDevicePostureUpdateResponseResultMatchPlatform `json:"platform"` + JSON accountDevicePostureUpdateResponseResultMatchJSON `json:"-"` +} + +// accountDevicePostureUpdateResponseResultMatchJSON contains the JSON metadata for +// the struct [AccountDevicePostureUpdateResponseResultMatch] +type accountDevicePostureUpdateResponseResultMatchJSON struct { + Platform apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureUpdateResponseResultMatch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureUpdateResponseResultMatchPlatform string + +const ( + AccountDevicePostureUpdateResponseResultMatchPlatformWindows AccountDevicePostureUpdateResponseResultMatchPlatform = "windows" + AccountDevicePostureUpdateResponseResultMatchPlatformMac AccountDevicePostureUpdateResponseResultMatchPlatform = "mac" + AccountDevicePostureUpdateResponseResultMatchPlatformLinux AccountDevicePostureUpdateResponseResultMatchPlatform = "linux" + AccountDevicePostureUpdateResponseResultMatchPlatformAndroid AccountDevicePostureUpdateResponseResultMatchPlatform = "android" + AccountDevicePostureUpdateResponseResultMatchPlatformIos AccountDevicePostureUpdateResponseResultMatchPlatform = "ios" +) + +// The type of device posture rule. +type AccountDevicePostureUpdateResponseResultType string + +const ( + AccountDevicePostureUpdateResponseResultTypeFile AccountDevicePostureUpdateResponseResultType = "file" + AccountDevicePostureUpdateResponseResultTypeApplication AccountDevicePostureUpdateResponseResultType = "application" + AccountDevicePostureUpdateResponseResultTypeTanium AccountDevicePostureUpdateResponseResultType = "tanium" + AccountDevicePostureUpdateResponseResultTypeGateway AccountDevicePostureUpdateResponseResultType = "gateway" + AccountDevicePostureUpdateResponseResultTypeWarp AccountDevicePostureUpdateResponseResultType = "warp" + AccountDevicePostureUpdateResponseResultTypeDiskEncryption AccountDevicePostureUpdateResponseResultType = "disk_encryption" + AccountDevicePostureUpdateResponseResultTypeSentinelone AccountDevicePostureUpdateResponseResultType = "sentinelone" + AccountDevicePostureUpdateResponseResultTypeCarbonblack AccountDevicePostureUpdateResponseResultType = "carbonblack" + AccountDevicePostureUpdateResponseResultTypeFirewall AccountDevicePostureUpdateResponseResultType = "firewall" + AccountDevicePostureUpdateResponseResultTypeOsVersion AccountDevicePostureUpdateResponseResultType = "os_version" + AccountDevicePostureUpdateResponseResultTypeDomainJoined AccountDevicePostureUpdateResponseResultType = "domain_joined" + AccountDevicePostureUpdateResponseResultTypeClientCertificate AccountDevicePostureUpdateResponseResultType = "client_certificate" + AccountDevicePostureUpdateResponseResultTypeUniqueClientID AccountDevicePostureUpdateResponseResultType = "unique_client_id" + AccountDevicePostureUpdateResponseResultTypeKolide AccountDevicePostureUpdateResponseResultType = "kolide" + AccountDevicePostureUpdateResponseResultTypeTaniumS2s AccountDevicePostureUpdateResponseResultType = "tanium_s2s" + AccountDevicePostureUpdateResponseResultTypeCrowdstrikeS2s AccountDevicePostureUpdateResponseResultType = "crowdstrike_s2s" + AccountDevicePostureUpdateResponseResultTypeIntune AccountDevicePostureUpdateResponseResultType = "intune" + AccountDevicePostureUpdateResponseResultTypeWorkspaceOne AccountDevicePostureUpdateResponseResultType = "workspace_one" + AccountDevicePostureUpdateResponseResultTypeSentineloneS2s AccountDevicePostureUpdateResponseResultType = "sentinelone_s2s" +) + +// Whether the API call was successful. +type AccountDevicePostureUpdateResponseSuccess bool + +const ( + AccountDevicePostureUpdateResponseSuccessTrue AccountDevicePostureUpdateResponseSuccess = true +) + +type AccountDevicePostureDeleteResponse struct { + Errors []AccountDevicePostureDeleteResponseError `json:"errors"` + Messages []AccountDevicePostureDeleteResponseMessage `json:"messages"` + Result AccountDevicePostureDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDevicePostureDeleteResponseSuccess `json:"success"` + JSON accountDevicePostureDeleteResponseJSON `json:"-"` +} + +// accountDevicePostureDeleteResponseJSON contains the JSON metadata for the struct +// [AccountDevicePostureDeleteResponse] +type accountDevicePostureDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureDeleteResponseErrorJSON `json:"-"` +} + +// accountDevicePostureDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountDevicePostureDeleteResponseError] +type accountDevicePostureDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureDeleteResponseMessageJSON `json:"-"` +} + +// accountDevicePostureDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountDevicePostureDeleteResponseMessage] +type accountDevicePostureDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDeleteResponseResult struct { + // API UUID. + ID string `json:"id"` + JSON accountDevicePostureDeleteResponseResultJSON `json:"-"` +} + +// accountDevicePostureDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountDevicePostureDeleteResponseResult] +type accountDevicePostureDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePostureDeleteResponseSuccess bool + +const ( + AccountDevicePostureDeleteResponseSuccessTrue AccountDevicePostureDeleteResponseSuccess = true +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponse struct { + Errors []AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseError `json:"errors"` + Messages []AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseMessage `json:"messages"` + Result AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseSuccess `json:"success"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseJSON contains +// the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponse] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseErrorJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseError] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseMessageJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseMessage] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResult struct { + // API UUID. + ID string `json:"id"` + // The description of the device posture rule. + Description string `json:"description"` + // Sets the expiration time for a posture check result. If empty, the result + // remains valid until it is overwritten by new data from the WARP client. + Expiration string `json:"expiration"` + // The value to be checked against. + Input AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput `json:"input"` + // The conditions that the client must match to run the rule. + Match []AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatch `json:"match"` + // The name of the device posture rule. + Name string `json:"name"` + // Polling frequency for the WARP client posture check. Default: `5m` (poll every + // five minutes). Minimum: `1m`. + Schedule string `json:"schedule"` + // The type of device posture rule. + Type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType `json:"type"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResult] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expiration apijson.Field + Input apijson.Field + Match apijson.Field + Name apijson.Field + Schedule apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The value to be checked against. +// +// Union satisfied by +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDiskEncryptionInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhClientCertificateInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequest] +// or +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequest]. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput interface { + implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput)(nil)).Elem(), "") +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // Whether or not file exists + Exists bool `json:"exists"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhFileInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhFileInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhFileInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Exists apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequest struct { + // List ID. + ID string `json:"id,required"` + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON struct { + ID apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemAndroid AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "android" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemIos AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "ios" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemChromeos AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "chromeos" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem `json:"operating_system,required"` + // Domain + Domain string `json:"domain"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON struct { + OperatingSystem apijson.Field + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem = "windows" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem `json:"operating_system,required"` + // Operator + Operator AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperator `json:"operator,required"` + // Version of OS + Version string `json:"version,required"` + // Operating System Distribution Name (linux only) + OsDistroName string `json:"os_distro_name"` + // Version of OS Distribution (linux only) + OsDistroRevision string `json:"os_distro_revision"` + // Product Verison Extra that Mac OS uses (mac only) + OsVersionExtra string `json:"os_version_extra"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhOsVersionInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhOsVersionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhOsVersionInputRequestJSON struct { + OperatingSystem apijson.Field + Operator apijson.Field + Version apijson.Field + OsDistroName apijson.Field + OsDistroRevision apijson.Field + OsVersionExtra apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem = "windows" +) + +// Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown145 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown146 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown147 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown148 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown149 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequest struct { + // Enabled + Enabled bool `json:"enabled,required"` + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhFirewallInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhFirewallInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhFirewallInputRequestJSON struct { + Enabled apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhSentineloneInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhSentineloneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhSentineloneInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDiskEncryptionInputRequest struct { + // List of volume names to be checked for encryption. + CheckDisks []string `json:"checkDisks"` + // Whether to check all disks for encryption. + RequireAll bool `json:"requireAll"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDiskEncryptionInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON struct { + CheckDisks apijson.Field + RequireAll apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem `json:"operating_system,required"` + // Path for the application. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhApplicationInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhApplicationInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhApplicationInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhClientCertificateInputRequest struct { + // UUID of Cloudflare managed certificate. + CertificateID string `json:"certificate_id,required"` + // Common Name that is protected by the certificate + Cn string `json:"cn,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhClientCertificateInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON struct { + CertificateID apijson.Field + Cn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhClientCertificateInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhClientCertificateInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusCompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "compliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusNoncompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusUnknown AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "unknown" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Operator + Operator AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator `json:"operator"` + // Os Version + Os string `json:"os"` + // overall + Overall string `json:"overall"` + // SensorConfig + SensorConfig string `json:"sensor_config"` + // Version + Version string `json:"version"` + // Version Operator + VersionOperator AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator `json:"versionOperator"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON struct { + ConnectionID apijson.Field + Operator apijson.Field + Os apijson.Field + Overall apijson.Field + SensorConfig apijson.Field + Version apijson.Field + VersionOperator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown155 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown156 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown157 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown158 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown159 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "==" +) + +// Version Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown165 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown166 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown167 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown168 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown169 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhIntuneInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhIntuneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhIntuneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusCompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "compliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNoncompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusUnknown AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "unknown" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNotapplicable AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "notapplicable" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusIngraceperiod AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "ingraceperiod" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusError AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "error" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Count Operator + CountOperator AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperator `json:"countOperator,required"` + // The Number of Issues. + IssueCount string `json:"issue_count,required"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhKolideInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhKolideInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhKolideInputRequestJSON struct { + ConnectionID apijson.Field + CountOperator apijson.Field + IssueCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Count Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown175 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown176 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown177 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown178 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown179 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // For more details on eid last seen, refer to the Tanium documentation. + EidLastSeen string `json:"eid_last_seen"` + // Operator to evaluate risk_level or eid_last_seen. + Operator AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperator `json:"operator"` + // For more details on risk level, refer to the Tanium documentation. + RiskLevel AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel `json:"risk_level"` + // Score Operator + ScoreOperator AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator `json:"scoreOperator"` + // For more details on total score, refer to the Tanium documentation. + TotalScore float64 `json:"total_score"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhTaniumInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhTaniumInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhTaniumInputRequestJSON struct { + ConnectionID apijson.Field + EidLastSeen apijson.Field + Operator apijson.Field + RiskLevel apijson.Field + ScoreOperator apijson.Field + TotalScore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Operator to evaluate risk_level or eid_last_seen. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown185 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown186 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown187 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown188 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown189 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "==" +) + +// For more details on risk level, refer to the Tanium documentation. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelLow AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "low" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelMedium AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "medium" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelHigh AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "high" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelCritical AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "critical" +) + +// Score Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown195 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown196 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown197 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown198 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown199 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // The Number of active threats. + ActiveThreats float64 `json:"active_threats"` + // Whether device is infected. + Infected bool `json:"infected"` + // Whether device is active. + IsActive bool `json:"is_active"` + // Network status of device. + NetworkStatus AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus `json:"network_status"` + // operator + Operator AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator `json:"operator"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequest] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON struct { + ConnectionID apijson.Field + ActiveThreats apijson.Field + Infected apijson.Field + IsActive apijson.Field + NetworkStatus apijson.Field + Operator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInput() { +} + +// Network status of device. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnected AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connected" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnected AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnected" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnecting AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnecting" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnecting AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connecting" +) + +// operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown205 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown206 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown207 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown208 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown209 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatch struct { + Platform AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatform `json:"platform"` + JSON accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatch] +type accountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchJSON struct { + Platform apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatform string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatformWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatform = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatformMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatform = "mac" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatformLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatform = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatformAndroid AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatform = "android" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatformIos AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultMatchPlatform = "ios" +) + +// The type of device posture rule. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeFile AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "file" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeApplication AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "application" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeTanium AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "tanium" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeGateway AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "gateway" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeWarp AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "warp" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeDiskEncryption AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "disk_encryption" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeSentinelone AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "sentinelone" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeCarbonblack AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "carbonblack" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeFirewall AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "firewall" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeOsVersion AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "os_version" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeDomainJoined AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "domain_joined" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeClientCertificate AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "client_certificate" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeUniqueClientID AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "unique_client_id" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeKolide AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "kolide" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeTaniumS2s AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "tanium_s2s" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeCrowdstrikeS2s AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "crowdstrike_s2s" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeIntune AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "intune" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeWorkspaceOne AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "workspace_one" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultTypeSentineloneS2s AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseResultType = "sentinelone_s2s" +) + +// Whether the API call was successful. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseSuccess bool + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseSuccessTrue AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponseSuccess = true +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponse struct { + Errors []AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseError `json:"errors"` + Messages []AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseMessage `json:"messages"` + Result []AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResult `json:"result"` + ResultInfo AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseSuccess `json:"success"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponse] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseErrorJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseError] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseMessageJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseMessage] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResult struct { + // API UUID. + ID string `json:"id"` + // The description of the device posture rule. + Description string `json:"description"` + // Sets the expiration time for a posture check result. If empty, the result + // remains valid until it is overwritten by new data from the WARP client. + Expiration string `json:"expiration"` + // The value to be checked against. + Input AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput `json:"input"` + // The conditions that the client must match to run the rule. + Match []AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatch `json:"match"` + // The name of the device posture rule. + Name string `json:"name"` + // Polling frequency for the WARP client posture check. Default: `5m` (poll every + // five minutes). Minimum: `1m`. + Schedule string `json:"schedule"` + // The type of device posture rule. + Type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType `json:"type"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResult] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expiration apijson.Field + Input apijson.Field + Match apijson.Field + Name apijson.Field + Schedule apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The value to be checked against. +// +// Union satisfied by +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDiskEncryptionInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhClientCertificateInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequest], +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequest] +// or +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequest]. +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput interface { + implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput)(nil)).Elem(), "") +} + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // Whether or not file exists + Exists bool `json:"exists"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhFileInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhFileInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhFileInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Exists apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFileInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequest struct { + // List ID. + ID string `json:"id,required"` + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhUniqueClientIDInputRequestJSON struct { + ID apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemAndroid AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "android" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemIos AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "ios" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemChromeos AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "chromeos" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem `json:"operating_system,required"` + // Domain + Domain string `json:"domain"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhDomainJoinedInputRequestJSON struct { + OperatingSystem apijson.Field + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem = "windows" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequest struct { + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem `json:"operating_system,required"` + // Operator + Operator AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperator `json:"operator,required"` + // Version of OS + Version string `json:"version,required"` + // Operating System Distribution Name (linux only) + OsDistroName string `json:"os_distro_name"` + // Version of OS Distribution (linux only) + OsDistroRevision string `json:"os_distro_revision"` + // Product Verison Extra that Mac OS uses (mac only) + OsVersionExtra string `json:"os_version_extra"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhOsVersionInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhOsVersionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhOsVersionInputRequestJSON struct { + OperatingSystem apijson.Field + Operator apijson.Field + Version apijson.Field + OsDistroName apijson.Field + OsDistroRevision apijson.Field + OsVersionExtra apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatingSystem = "windows" +) + +// Operator +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown215 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown216 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown217 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown218 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperatorUnknown219 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhOsVersionInputRequestOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequest struct { + // Enabled + Enabled bool `json:"enabled,required"` + // Operating System + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem `json:"operating_system,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhFirewallInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhFirewallInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhFirewallInputRequestJSON struct { + Enabled apijson.Field + OperatingSystem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhFirewallInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhSentineloneInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhSentineloneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhSentineloneInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem `json:"operating_system,required"` + // File path. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhCarbonblackInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDiskEncryptionInputRequest struct { + // List of volume names to be checked for encryption. + CheckDisks []string `json:"checkDisks"` + // Whether to check all disks for encryption. + RequireAll bool `json:"requireAll"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDiskEncryptionInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhDiskEncryptionInputRequestJSON struct { + CheckDisks apijson.Field + RequireAll apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhDiskEncryptionInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequest struct { + // Operating system + OperatingSystem AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem `json:"operating_system,required"` + // Path for the application. + Path string `json:"path,required"` + // SHA-256. + Sha256 string `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint string `json:"thumbprint"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhApplicationInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhApplicationInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhApplicationInputRequestJSON struct { + OperatingSystem apijson.Field + Path apijson.Field + Sha256 apijson.Field + Thumbprint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhApplicationInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhClientCertificateInputRequest struct { + // UUID of Cloudflare managed certificate. + CertificateID string `json:"certificate_id,required"` + // Common Name that is protected by the certificate + Cn string `json:"cn,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhClientCertificateInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhClientCertificateInputRequestJSON struct { + CertificateID apijson.Field + Cn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhClientCertificateInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhClientCertificateInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhWorkspaceOneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusCompliant AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "compliant" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusNoncompliant AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusUnknown AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "unknown" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Operator + Operator AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator `json:"operator"` + // Os Version + Os string `json:"os"` + // overall + Overall string `json:"overall"` + // SensorConfig + SensorConfig string `json:"sensor_config"` + // Version + Version string `json:"version"` + // Version Operator + VersionOperator AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator `json:"versionOperator"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhCrowdstrikeInputRequestJSON struct { + ConnectionID apijson.Field + Operator apijson.Field + Os apijson.Field + Overall apijson.Field + SensorConfig apijson.Field + Version apijson.Field + VersionOperator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operator +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown225 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown226 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown227 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown228 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown229 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestOperator = "==" +) + +// Version Operator +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown235 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown236 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown237 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown238 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown239 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequest struct { + // Compliance Status + ComplianceStatus AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhIntuneInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhIntuneInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhIntuneInputRequestJSON struct { + ComplianceStatus apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Compliance Status +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusCompliant AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "compliant" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNoncompliant AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusUnknown AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "unknown" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusNotapplicable AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "notapplicable" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusIngraceperiod AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "ingraceperiod" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatusError AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhIntuneInputRequestComplianceStatus = "error" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // Count Operator + CountOperator AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperator `json:"countOperator,required"` + // The Number of Issues. + IssueCount string `json:"issue_count,required"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhKolideInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhKolideInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhKolideInputRequestJSON struct { + ConnectionID apijson.Field + CountOperator apijson.Field + IssueCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Count Operator +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperator string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown245 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown246 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "<=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown247 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown248 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = ">=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperatorUnknown249 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhKolideInputRequestCountOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // For more details on eid last seen, refer to the Tanium documentation. + EidLastSeen string `json:"eid_last_seen"` + // Operator to evaluate risk_level or eid_last_seen. + Operator AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperator `json:"operator"` + // For more details on risk level, refer to the Tanium documentation. + RiskLevel AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel `json:"risk_level"` + // Score Operator + ScoreOperator AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator `json:"scoreOperator"` + // For more details on total score, refer to the Tanium documentation. + TotalScore float64 `json:"total_score"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhTaniumInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhTaniumInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhTaniumInputRequestJSON struct { + ConnectionID apijson.Field + EidLastSeen apijson.Field + Operator apijson.Field + RiskLevel apijson.Field + ScoreOperator apijson.Field + TotalScore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Operator to evaluate risk_level or eid_last_seen. +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown255 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown256 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown257 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown258 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperatorUnknown259 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestOperator = "==" +) + +// For more details on risk level, refer to the Tanium documentation. +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelLow AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "low" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelMedium AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "medium" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelHigh AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "high" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevelCritical AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestRiskLevel = "critical" +) + +// Score Operator +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown265 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown266 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "<=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown267 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown268 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = ">=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown269 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhTaniumInputRequestScoreOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequest struct { + // Posture Integration ID. + ConnectionID string `json:"connection_id,required"` + // The Number of active threats. + ActiveThreats float64 `json:"active_threats"` + // Whether device is infected. + Infected bool `json:"infected"` + // Whether device is active. + IsActive bool `json:"is_active"` + // Network status of device. + NetworkStatus AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus `json:"network_status"` + // operator + Operator AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator `json:"operator"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequest] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZr7Sv6YhSentineloneS2sInputRequestJSON struct { + ConnectionID apijson.Field + ActiveThreats apijson.Field + Infected apijson.Field + IsActive apijson.Field + NetworkStatus apijson.Field + Operator apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequest) implementsAccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInput() { +} + +// Network status of device. +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnected AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connected" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnected AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnected" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnecting AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnecting" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnecting AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connecting" +) + +// operator +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown275 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown276 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown277 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown278 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown279 AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInputZR7Sv6YhSentineloneS2sInputRequestOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatch struct { + Platform AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatform `json:"platform"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatch] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchJSON struct { + Platform apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatform string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatformWindows AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatform = "windows" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatformMac AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatform = "mac" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatformLinux AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatform = "linux" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatformAndroid AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatform = "android" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatformIos AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultMatchPlatform = "ios" +) + +// The type of device posture rule. +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType string + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeFile AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "file" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeApplication AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "application" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeTanium AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "tanium" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeGateway AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "gateway" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeWarp AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "warp" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeDiskEncryption AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "disk_encryption" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeSentinelone AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "sentinelone" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeCarbonblack AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "carbonblack" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeFirewall AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "firewall" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeOsVersion AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "os_version" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeDomainJoined AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "domain_joined" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeClientCertificate AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "client_certificate" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeUniqueClientID AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "unique_client_id" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeKolide AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "kolide" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeTaniumS2s AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "tanium_s2s" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeCrowdstrikeS2s AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "crowdstrike_s2s" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeIntune AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "intune" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeWorkspaceOne AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "workspace_one" + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultTypeSentineloneS2s AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultType = "sentinelone_s2s" +) + +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInfoJSON `json:"-"` +} + +// accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInfo] +type accountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseSuccess bool + +const ( + AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseSuccessTrue AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponseSuccess = true +) + +type AccountDevicePostureUpdateParams struct { + // The name of the device posture rule. + Name param.Field[string] `json:"name,required"` + // The type of device posture rule. + Type param.Field[AccountDevicePostureUpdateParamsType] `json:"type,required"` + // The description of the device posture rule. + Description param.Field[string] `json:"description"` + // Sets the expiration time for a posture check result. If empty, the result + // remains valid until it is overwritten by new data from the WARP client. + Expiration param.Field[string] `json:"expiration"` + // The value to be checked against. + Input param.Field[AccountDevicePostureUpdateParamsInput] `json:"input"` + // The conditions that the client must match to run the rule. + Match param.Field[[]AccountDevicePostureUpdateParamsMatch] `json:"match"` + // Polling frequency for the WARP client posture check. Default: `5m` (poll every + // five minutes). Minimum: `1m`. + Schedule param.Field[string] `json:"schedule"` +} + +func (r AccountDevicePostureUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of device posture rule. +type AccountDevicePostureUpdateParamsType string + +const ( + AccountDevicePostureUpdateParamsTypeFile AccountDevicePostureUpdateParamsType = "file" + AccountDevicePostureUpdateParamsTypeApplication AccountDevicePostureUpdateParamsType = "application" + AccountDevicePostureUpdateParamsTypeTanium AccountDevicePostureUpdateParamsType = "tanium" + AccountDevicePostureUpdateParamsTypeGateway AccountDevicePostureUpdateParamsType = "gateway" + AccountDevicePostureUpdateParamsTypeWarp AccountDevicePostureUpdateParamsType = "warp" + AccountDevicePostureUpdateParamsTypeDiskEncryption AccountDevicePostureUpdateParamsType = "disk_encryption" + AccountDevicePostureUpdateParamsTypeSentinelone AccountDevicePostureUpdateParamsType = "sentinelone" + AccountDevicePostureUpdateParamsTypeCarbonblack AccountDevicePostureUpdateParamsType = "carbonblack" + AccountDevicePostureUpdateParamsTypeFirewall AccountDevicePostureUpdateParamsType = "firewall" + AccountDevicePostureUpdateParamsTypeOsVersion AccountDevicePostureUpdateParamsType = "os_version" + AccountDevicePostureUpdateParamsTypeDomainJoined AccountDevicePostureUpdateParamsType = "domain_joined" + AccountDevicePostureUpdateParamsTypeClientCertificate AccountDevicePostureUpdateParamsType = "client_certificate" + AccountDevicePostureUpdateParamsTypeUniqueClientID AccountDevicePostureUpdateParamsType = "unique_client_id" + AccountDevicePostureUpdateParamsTypeKolide AccountDevicePostureUpdateParamsType = "kolide" + AccountDevicePostureUpdateParamsTypeTaniumS2s AccountDevicePostureUpdateParamsType = "tanium_s2s" + AccountDevicePostureUpdateParamsTypeCrowdstrikeS2s AccountDevicePostureUpdateParamsType = "crowdstrike_s2s" + AccountDevicePostureUpdateParamsTypeIntune AccountDevicePostureUpdateParamsType = "intune" + AccountDevicePostureUpdateParamsTypeWorkspaceOne AccountDevicePostureUpdateParamsType = "workspace_one" + AccountDevicePostureUpdateParamsTypeSentineloneS2s AccountDevicePostureUpdateParamsType = "sentinelone_s2s" +) + +// The value to be checked against. +// +// Satisfied by [AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhDiskEncryptionInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhClientCertificateInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequest], +// [AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequest]. +type AccountDevicePostureUpdateParamsInput interface { + implementsAccountDevicePostureUpdateParamsInput() +} + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystem] `json:"operating_system,required"` + // File path. + Path param.Field[string] `json:"path,required"` + // Whether or not file exists + Exists param.Field[bool] `json:"exists"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating system +type AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystemWindows AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystemLinux AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystemMac AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequest struct { + // List ID. + ID param.Field[string] `json:"id,required"` + // Operating System + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem] `json:"operating_system,required"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating System +type AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemAndroid AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "android" + AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemIos AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "ios" + AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemChromeos AccountDevicePostureUpdateParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "chromeos" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequest struct { + // Operating System + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem] `json:"operating_system,required"` + // Domain + Domain param.Field[string] `json:"domain"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating System +type AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystemWindows AccountDevicePostureUpdateParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem = "windows" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequest struct { + // Operating System + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystem] `json:"operating_system,required"` + // Operator + Operator param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperator] `json:"operator,required"` + // Version of OS + Version param.Field[string] `json:"version,required"` + // Operating System Distribution Name (linux only) + OsDistroName param.Field[string] `json:"os_distro_name"` + // Version of OS Distribution (linux only) + OsDistroRevision param.Field[string] `json:"os_distro_revision"` + // Product Verison Extra that Mac OS uses (mac only) + OsVersionExtra param.Field[string] `json:"os_version_extra"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating System +type AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystemWindows AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystem = "windows" +) + +// Operator +type AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperator string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown285 AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperator = "<" + AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown286 AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperator = "<=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown287 AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperator = ">" + AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown288 AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperator = ">=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown289 AccountDevicePostureUpdateParamsInputZR7Sv6YhOsVersionInputRequestOperator = "==" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequest struct { + // Enabled + Enabled param.Field[bool] `json:"enabled,required"` + // Operating System + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem] `json:"operating_system,required"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating System +type AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequestOperatingSystemWindows AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequestOperatingSystemMac AccountDevicePostureUpdateParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem] `json:"operating_system,required"` + // File path. + Path param.Field[string] `json:"path,required"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating system +type AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystemWindows AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystemLinux AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystemMac AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem] `json:"operating_system,required"` + // File path. + Path param.Field[string] `json:"path,required"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating system +type AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystemWindows AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystemLinux AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystemMac AccountDevicePostureUpdateParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhDiskEncryptionInputRequest struct { + // List of volume names to be checked for encryption. + CheckDisks param.Field[[]string] `json:"checkDisks"` + // Whether to check all disks for encryption. + RequireAll param.Field[bool] `json:"requireAll"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhDiskEncryptionInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhDiskEncryptionInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem] `json:"operating_system,required"` + // Path for the application. + Path param.Field[string] `json:"path,required"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operating system +type AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystemWindows AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem = "windows" + AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystemLinux AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem = "linux" + AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystemMac AccountDevicePostureUpdateParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhClientCertificateInputRequest struct { + // UUID of Cloudflare managed certificate. + CertificateID param.Field[string] `json:"certificate_id,required"` + // Common Name that is protected by the certificate + Cn param.Field[string] `json:"cn,required"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhClientCertificateInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhClientCertificateInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequest struct { + // Compliance Status + ComplianceStatus param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus] `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Compliance Status +type AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusCompliant AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "compliant" + AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusNoncompliant AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusUnknown AccountDevicePostureUpdateParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "unknown" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // Operator + Operator param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator] `json:"operator"` + // Os Version + Os param.Field[string] `json:"os"` + // overall + Overall param.Field[string] `json:"overall"` + // SensorConfig + SensorConfig param.Field[string] `json:"sensor_config"` + // Version + Version param.Field[string] `json:"version"` + // Version Operator + VersionOperator param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator] `json:"versionOperator"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operator +type AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown295 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown296 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown297 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown298 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown299 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = "==" +) + +// Version Operator +type AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown305 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown306 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown307 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown308 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown309 AccountDevicePostureUpdateParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "==" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequest struct { + // Compliance Status + ComplianceStatus param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus] `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Compliance Status +type AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusCompliant AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "compliant" + AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusNoncompliant AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusUnknown AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "unknown" + AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusNotapplicable AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "notapplicable" + AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusIngraceperiod AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "ingraceperiod" + AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusError AccountDevicePostureUpdateParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "error" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // Count Operator + CountOperator param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperator] `json:"countOperator,required"` + // The Number of Issues. + IssueCount param.Field[string] `json:"issue_count,required"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Count Operator +type AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperator string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown315 AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperator = "<" + AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown316 AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperator = "<=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown317 AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperator = ">" + AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown318 AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperator = ">=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown319 AccountDevicePostureUpdateParamsInputZR7Sv6YhKolideInputRequestCountOperator = "==" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // For more details on eid last seen, refer to the Tanium documentation. + EidLastSeen param.Field[string] `json:"eid_last_seen"` + // Operator to evaluate risk_level or eid_last_seen. + Operator param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperator] `json:"operator"` + // For more details on risk level, refer to the Tanium documentation. + RiskLevel param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevel] `json:"risk_level"` + // Score Operator + ScoreOperator param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperator] `json:"scoreOperator"` + // For more details on total score, refer to the Tanium documentation. + TotalScore param.Field[float64] `json:"total_score"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Operator to evaluate risk_level or eid_last_seen. +type AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperator string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown325 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperator = "<" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown326 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperator = "<=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown327 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperator = ">" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown328 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperator = ">=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown329 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestOperator = "==" +) + +// For more details on risk level, refer to the Tanium documentation. +type AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevel string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevelLow AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "low" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevelMedium AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "medium" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevelHigh AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "high" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevelCritical AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "critical" +) + +// Score Operator +type AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperator string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown335 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = "<" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown336 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = "<=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown337 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = ">" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown338 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = ">=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown339 AccountDevicePostureUpdateParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = "==" +) + +type AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The Number of active threats. + ActiveThreats param.Field[float64] `json:"active_threats"` + // Whether device is infected. + Infected param.Field[bool] `json:"infected"` + // Whether device is active. + IsActive param.Field[bool] `json:"is_active"` + // Network status of device. + NetworkStatus param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus] `json:"network_status"` + // operator + Operator param.Field[AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator] `json:"operator"` +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequest) implementsAccountDevicePostureUpdateParamsInput() { +} + +// Network status of device. +type AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnected AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connected" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnected AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnected" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnecting AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnecting" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnecting AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connecting" +) + +// operator +type AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator string + +const ( + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown345 AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown346 AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown347 AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown348 AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">=" + AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown349 AccountDevicePostureUpdateParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = "==" +) + +type AccountDevicePostureUpdateParamsMatch struct { + Platform param.Field[AccountDevicePostureUpdateParamsMatchPlatform] `json:"platform"` +} + +func (r AccountDevicePostureUpdateParamsMatch) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePostureUpdateParamsMatchPlatform string + +const ( + AccountDevicePostureUpdateParamsMatchPlatformWindows AccountDevicePostureUpdateParamsMatchPlatform = "windows" + AccountDevicePostureUpdateParamsMatchPlatformMac AccountDevicePostureUpdateParamsMatchPlatform = "mac" + AccountDevicePostureUpdateParamsMatchPlatformLinux AccountDevicePostureUpdateParamsMatchPlatform = "linux" + AccountDevicePostureUpdateParamsMatchPlatformAndroid AccountDevicePostureUpdateParamsMatchPlatform = "android" + AccountDevicePostureUpdateParamsMatchPlatformIos AccountDevicePostureUpdateParamsMatchPlatform = "ios" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParams struct { + // The name of the device posture rule. + Name param.Field[string] `json:"name,required"` + // The type of device posture rule. + Type param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType] `json:"type,required"` + // The description of the device posture rule. + Description param.Field[string] `json:"description"` + // Sets the expiration time for a posture check result. If empty, the result + // remains valid until it is overwritten by new data from the WARP client. + Expiration param.Field[string] `json:"expiration"` + // The value to be checked against. + Input param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput] `json:"input"` + // The conditions that the client must match to run the rule. + Match param.Field[[]AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatch] `json:"match"` + // Polling frequency for the WARP client posture check. Default: `5m` (poll every + // five minutes). Minimum: `1m`. + Schedule param.Field[string] `json:"schedule"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of device posture rule. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeFile AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "file" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeApplication AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "application" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeTanium AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "tanium" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeGateway AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "gateway" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeWarp AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "warp" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeDiskEncryption AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "disk_encryption" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeSentinelone AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "sentinelone" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeCarbonblack AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "carbonblack" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeFirewall AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "firewall" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeOsVersion AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "os_version" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeDomainJoined AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "domain_joined" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeClientCertificate AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "client_certificate" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeUniqueClientID AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "unique_client_id" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeKolide AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "kolide" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeTaniumS2s AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "tanium_s2s" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeCrowdstrikeS2s AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "crowdstrike_s2s" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeIntune AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "intune" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeWorkspaceOne AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "workspace_one" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeSentineloneS2s AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsType = "sentinelone_s2s" +) + +// The value to be checked against. +// +// Satisfied by +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDiskEncryptionInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhClientCertificateInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequest], +// [AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequest]. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput interface { + implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystem] `json:"operating_system,required"` + // File path. + Path param.Field[string] `json:"path,required"` + // Whether or not file exists + Exists param.Field[bool] `json:"exists"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequest struct { + // List ID. + ID param.Field[string] `json:"id,required"` + // Operating System + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem] `json:"operating_system,required"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemAndroid AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "android" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemIos AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "ios" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystemChromeos AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhUniqueClientIDInputRequestOperatingSystem = "chromeos" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequest struct { + // Operating System + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem] `json:"operating_system,required"` + // Domain + Domain param.Field[string] `json:"domain"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDomainJoinedInputRequestOperatingSystem = "windows" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequest struct { + // Operating System + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystem] `json:"operating_system,required"` + // Operator + Operator param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperator] `json:"operator,required"` + // Version of OS + Version param.Field[string] `json:"version,required"` + // Operating System Distribution Name (linux only) + OsDistroName param.Field[string] `json:"os_distro_name"` + // Version of OS Distribution (linux only) + OsDistroRevision param.Field[string] `json:"os_distro_revision"` + // Product Verison Extra that Mac OS uses (mac only) + OsVersionExtra param.Field[string] `json:"os_version_extra"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatingSystem = "windows" +) + +// Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown355 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown356 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown357 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown358 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperatorUnknown359 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhOsVersionInputRequestOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequest struct { + // Enabled + Enabled param.Field[bool] `json:"enabled,required"` + // Operating System + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem] `json:"operating_system,required"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating System +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFirewallInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem] `json:"operating_system,required"` + // File path. + Path param.Field[string] `json:"path,required"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem] `json:"operating_system,required"` + // File path. + Path param.Field[string] `json:"path,required"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCarbonblackInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDiskEncryptionInputRequest struct { + // List of volume names to be checked for encryption. + CheckDisks param.Field[[]string] `json:"checkDisks"` + // Whether to check all disks for encryption. + RequireAll param.Field[bool] `json:"requireAll"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDiskEncryptionInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhDiskEncryptionInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequest struct { + // Operating system + OperatingSystem param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem] `json:"operating_system,required"` + // Path for the application. + Path param.Field[string] `json:"path,required"` + // SHA-256. + Sha256 param.Field[string] `json:"sha256"` + // Signing certificate thumbprint. + Thumbprint param.Field[string] `json:"thumbprint"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operating system +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystemWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystemLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystemMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhApplicationInputRequestOperatingSystem = "mac" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhClientCertificateInputRequest struct { + // UUID of Cloudflare managed certificate. + CertificateID param.Field[string] `json:"certificate_id,required"` + // Common Name that is protected by the certificate + Cn param.Field[string] `json:"cn,required"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhClientCertificateInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhClientCertificateInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequest struct { + // Compliance Status + ComplianceStatus param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus] `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Compliance Status +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusCompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "compliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusNoncompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatusUnknown AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhWorkspaceOneInputRequestComplianceStatus = "unknown" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // Operator + Operator param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator] `json:"operator"` + // Os Version + Os param.Field[string] `json:"os"` + // overall + Overall param.Field[string] `json:"overall"` + // SensorConfig + SensorConfig param.Field[string] `json:"sensor_config"` + // Version + Version param.Field[string] `json:"version"` + // Version Operator + VersionOperator param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator] `json:"versionOperator"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown365 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown366 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown367 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown368 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperatorUnknown369 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestOperator = "==" +) + +// Version Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown375 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown376 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown377 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown378 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperatorUnknown379 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhCrowdstrikeInputRequestVersionOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequest struct { + // Compliance Status + ComplianceStatus param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus] `json:"compliance_status,required"` + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Compliance Status +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusCompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "compliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusNoncompliant AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "noncompliant" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusUnknown AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "unknown" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusNotapplicable AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "notapplicable" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusIngraceperiod AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "ingraceperiod" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatusError AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhIntuneInputRequestComplianceStatus = "error" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // Count Operator + CountOperator param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperator] `json:"countOperator,required"` + // The Number of Issues. + IssueCount param.Field[string] `json:"issue_count,required"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Count Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown385 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown386 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown387 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown388 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperatorUnknown389 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhKolideInputRequestCountOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // For more details on eid last seen, refer to the Tanium documentation. + EidLastSeen param.Field[string] `json:"eid_last_seen"` + // Operator to evaluate risk_level or eid_last_seen. + Operator param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperator] `json:"operator"` + // For more details on risk level, refer to the Tanium documentation. + RiskLevel param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevel] `json:"risk_level"` + // Score Operator + ScoreOperator param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperator] `json:"scoreOperator"` + // For more details on total score, refer to the Tanium documentation. + TotalScore param.Field[float64] `json:"total_score"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Operator to evaluate risk_level or eid_last_seen. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown395 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown396 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown397 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown398 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperatorUnknown399 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestOperator = "==" +) + +// For more details on risk level, refer to the Tanium documentation. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevel string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevelLow AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "low" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevelMedium AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "medium" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevelHigh AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "high" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevelCritical AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestRiskLevel = "critical" +) + +// Score Operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown405 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown406 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown407 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown408 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperatorUnknown409 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhTaniumInputRequestScoreOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequest struct { + // Posture Integration ID. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The Number of active threats. + ActiveThreats param.Field[float64] `json:"active_threats"` + // Whether device is infected. + Infected param.Field[bool] `json:"infected"` + // Whether device is active. + IsActive param.Field[bool] `json:"is_active"` + // Network status of device. + NetworkStatus param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus] `json:"network_status"` + // operator + Operator param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator] `json:"operator"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequest) implementsAccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput() { +} + +// Network status of device. +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnected AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connected" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnected AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnected" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusDisconnecting AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "disconnecting" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatusConnecting AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestNetworkStatus = "connecting" +) + +// operator +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown415 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown416 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = "<=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown417 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown418 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = ">=" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperatorUnknown419 AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhSentineloneS2sInputRequestOperator = "==" +) + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatch struct { + Platform param.Field[AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatform] `json:"platform"` +} + +func (r AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatch) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatform string + +const ( + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformWindows AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatform = "windows" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformMac AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatform = "mac" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformLinux AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatform = "linux" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformAndroid AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatform = "android" + AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformIos AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatform = "ios" +) diff --git a/accountdeviceposture_test.go b/accountdeviceposture_test.go new file mode 100644 index 00000000000..7c8e166069d --- /dev/null +++ b/accountdeviceposture_test.go @@ -0,0 +1,201 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDevicePostureGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePostureUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDevicePostureUpdateParams{ + Name: cloudflare.F("Admin Serial Numbers"), + Type: cloudflare.F(cloudflare.AccountDevicePostureUpdateParamsTypeFile), + Description: cloudflare.F("The rule for admin serial numbers"), + Expiration: cloudflare.F("1h"), + Input: cloudflare.F[cloudflare.AccountDevicePostureUpdateParamsInput](cloudflare.AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequest(cloudflare.AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequest{ + Exists: cloudflare.F(true), + OperatingSystem: cloudflare.F(cloudflare.AccountDevicePostureUpdateParamsInputZR7Sv6YhFileInputRequestOperatingSystemMac), + Path: cloudflare.F("/bin/cat"), + Sha256: cloudflare.F("https://api.us-2.crowdstrike.com"), + Thumbprint: cloudflare.F("0aabab210bdb998e9cf45da2c9ce352977ab531c681b74cf1e487be1bbe9fe6e"), + })), + Match: cloudflare.F([]cloudflare.AccountDevicePostureUpdateParamsMatch{{ + Platform: cloudflare.F(cloudflare.AccountDevicePostureUpdateParamsMatchPlatformWindows), + }, { + Platform: cloudflare.F(cloudflare.AccountDevicePostureUpdateParamsMatchPlatformWindows), + }, { + Platform: cloudflare.F(cloudflare.AccountDevicePostureUpdateParamsMatchPlatformWindows), + }}), + Schedule: cloudflare.F("1h"), + }, + ) + 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 TestAccountDevicePostureDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePostureDevicePostureRulesNewDevicePostureRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.DevicePostureRulesNewDevicePostureRule( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParams{ + Name: cloudflare.F("Admin Serial Numbers"), + Type: cloudflare.F(cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsTypeFile), + Description: cloudflare.F("The rule for admin serial numbers"), + Expiration: cloudflare.F("1h"), + Input: cloudflare.F[cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInput](cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequest(cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequest{ + Exists: cloudflare.F(true), + OperatingSystem: cloudflare.F(cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsInputZR7Sv6YhFileInputRequestOperatingSystemMac), + Path: cloudflare.F("/bin/cat"), + Sha256: cloudflare.F("https://api.us-2.crowdstrike.com"), + Thumbprint: cloudflare.F("0aabab210bdb998e9cf45da2c9ce352977ab531c681b74cf1e487be1bbe9fe6e"), + })), + Match: cloudflare.F([]cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatch{{ + Platform: cloudflare.F(cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformWindows), + }, { + Platform: cloudflare.F(cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformWindows), + }, { + Platform: cloudflare.F(cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParamsMatchPlatformWindows), + }}), + Schedule: cloudflare.F("1h"), + }, + ) + 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 TestAccountDevicePostureDevicePostureRulesListDevicePostureRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.DevicePostureRulesListDevicePostureRules(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountdevicepostureintegration.go b/accountdevicepostureintegration.go new file mode 100644 index 00000000000..60febd360de --- /dev/null +++ b/accountdevicepostureintegration.go @@ -0,0 +1,1056 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDevicePostureIntegrationService 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 +// [NewAccountDevicePostureIntegrationService] method instead. +type AccountDevicePostureIntegrationService struct { + Options []option.RequestOption +} + +// NewAccountDevicePostureIntegrationService 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 NewAccountDevicePostureIntegrationService(opts ...option.RequestOption) (r *AccountDevicePostureIntegrationService) { + r = &AccountDevicePostureIntegrationService{} + r.Options = opts + return +} + +// Fetches details for a single device posture integration. +func (r *AccountDevicePostureIntegrationService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePostureIntegrationGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/integration/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured device posture integration. +func (r *AccountDevicePostureIntegrationService) Update(ctx context.Context, identifier interface{}, uuid string, body AccountDevicePostureIntegrationUpdateParams, opts ...option.RequestOption) (res *AccountDevicePostureIntegrationUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/integration/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete a configured device posture integration. +func (r *AccountDevicePostureIntegrationService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountDevicePostureIntegrationDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/integration/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new device posture integration. +func (r *AccountDevicePostureIntegrationService) DevicePostureIntegrationsNewDevicePostureIntegration(ctx context.Context, identifier interface{}, body AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParams, opts ...option.RequestOption) (res *AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/integration", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches the list of device posture integrations for an account. +func (r *AccountDevicePostureIntegrationService) DevicePostureIntegrationsListDevicePostureIntegrations(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/posture/integration", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDevicePostureIntegrationGetResponse struct { + Errors []AccountDevicePostureIntegrationGetResponseError `json:"errors"` + Messages []AccountDevicePostureIntegrationGetResponseMessage `json:"messages"` + Result AccountDevicePostureIntegrationGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDevicePostureIntegrationGetResponseSuccess `json:"success"` + JSON accountDevicePostureIntegrationGetResponseJSON `json:"-"` +} + +// accountDevicePostureIntegrationGetResponseJSON contains the JSON metadata for +// the struct [AccountDevicePostureIntegrationGetResponse] +type accountDevicePostureIntegrationGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationGetResponseErrorJSON `json:"-"` +} + +// accountDevicePostureIntegrationGetResponseErrorJSON contains the JSON metadata +// for the struct [AccountDevicePostureIntegrationGetResponseError] +type accountDevicePostureIntegrationGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationGetResponseMessageJSON `json:"-"` +} + +// accountDevicePostureIntegrationGetResponseMessageJSON contains the JSON metadata +// for the struct [AccountDevicePostureIntegrationGetResponseMessage] +type accountDevicePostureIntegrationGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationGetResponseResult struct { + // API UUID. + ID string `json:"id"` + // The configuration object containing third-party integration information. + Config AccountDevicePostureIntegrationGetResponseResultConfig `json:"config"` + // The interval between each posture check with the third-party API. Use `m` for + // minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). + Interval string `json:"interval"` + // The name of the device posture integration. + Name string `json:"name"` + // The type of device posture integration. + Type AccountDevicePostureIntegrationGetResponseResultType `json:"type"` + JSON accountDevicePostureIntegrationGetResponseResultJSON `json:"-"` +} + +// accountDevicePostureIntegrationGetResponseResultJSON contains the JSON metadata +// for the struct [AccountDevicePostureIntegrationGetResponseResult] +type accountDevicePostureIntegrationGetResponseResultJSON struct { + ID apijson.Field + Config apijson.Field + Interval apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing third-party integration information. +type AccountDevicePostureIntegrationGetResponseResultConfig struct { + // The Workspace One API URL provided in the Workspace One Admin Dashboard. + APIURL string `json:"api_url,required"` + // The Workspace One Authorization URL depending on your region. + AuthURL string `json:"auth_url,required"` + // The Workspace One client ID provided in the Workspace One Admin Dashboard. + ClientID string `json:"client_id,required"` + JSON accountDevicePostureIntegrationGetResponseResultConfigJSON `json:"-"` +} + +// accountDevicePostureIntegrationGetResponseResultConfigJSON contains the JSON +// metadata for the struct [AccountDevicePostureIntegrationGetResponseResultConfig] +type accountDevicePostureIntegrationGetResponseResultConfigJSON struct { + APIURL apijson.Field + AuthURL apijson.Field + ClientID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationGetResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device posture integration. +type AccountDevicePostureIntegrationGetResponseResultType string + +const ( + AccountDevicePostureIntegrationGetResponseResultTypeWorkspaceOne AccountDevicePostureIntegrationGetResponseResultType = "workspace_one" + AccountDevicePostureIntegrationGetResponseResultTypeCrowdstrikeS2s AccountDevicePostureIntegrationGetResponseResultType = "crowdstrike_s2s" + AccountDevicePostureIntegrationGetResponseResultTypeUptycs AccountDevicePostureIntegrationGetResponseResultType = "uptycs" + AccountDevicePostureIntegrationGetResponseResultTypeIntune AccountDevicePostureIntegrationGetResponseResultType = "intune" + AccountDevicePostureIntegrationGetResponseResultTypeKolide AccountDevicePostureIntegrationGetResponseResultType = "kolide" + AccountDevicePostureIntegrationGetResponseResultTypeTanium AccountDevicePostureIntegrationGetResponseResultType = "tanium" + AccountDevicePostureIntegrationGetResponseResultTypeSentineloneS2s AccountDevicePostureIntegrationGetResponseResultType = "sentinelone_s2s" +) + +// Whether the API call was successful. +type AccountDevicePostureIntegrationGetResponseSuccess bool + +const ( + AccountDevicePostureIntegrationGetResponseSuccessTrue AccountDevicePostureIntegrationGetResponseSuccess = true +) + +type AccountDevicePostureIntegrationUpdateResponse struct { + Errors []AccountDevicePostureIntegrationUpdateResponseError `json:"errors"` + Messages []AccountDevicePostureIntegrationUpdateResponseMessage `json:"messages"` + Result AccountDevicePostureIntegrationUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDevicePostureIntegrationUpdateResponseSuccess `json:"success"` + JSON accountDevicePostureIntegrationUpdateResponseJSON `json:"-"` +} + +// accountDevicePostureIntegrationUpdateResponseJSON contains the JSON metadata for +// the struct [AccountDevicePostureIntegrationUpdateResponse] +type accountDevicePostureIntegrationUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationUpdateResponseErrorJSON `json:"-"` +} + +// accountDevicePostureIntegrationUpdateResponseErrorJSON contains the JSON +// metadata for the struct [AccountDevicePostureIntegrationUpdateResponseError] +type accountDevicePostureIntegrationUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationUpdateResponseMessageJSON `json:"-"` +} + +// accountDevicePostureIntegrationUpdateResponseMessageJSON contains the JSON +// metadata for the struct [AccountDevicePostureIntegrationUpdateResponseMessage] +type accountDevicePostureIntegrationUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationUpdateResponseResult struct { + // API UUID. + ID string `json:"id"` + // The configuration object containing third-party integration information. + Config AccountDevicePostureIntegrationUpdateResponseResultConfig `json:"config"` + // The interval between each posture check with the third-party API. Use `m` for + // minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). + Interval string `json:"interval"` + // The name of the device posture integration. + Name string `json:"name"` + // The type of device posture integration. + Type AccountDevicePostureIntegrationUpdateResponseResultType `json:"type"` + JSON accountDevicePostureIntegrationUpdateResponseResultJSON `json:"-"` +} + +// accountDevicePostureIntegrationUpdateResponseResultJSON contains the JSON +// metadata for the struct [AccountDevicePostureIntegrationUpdateResponseResult] +type accountDevicePostureIntegrationUpdateResponseResultJSON struct { + ID apijson.Field + Config apijson.Field + Interval apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing third-party integration information. +type AccountDevicePostureIntegrationUpdateResponseResultConfig struct { + // The Workspace One API URL provided in the Workspace One Admin Dashboard. + APIURL string `json:"api_url,required"` + // The Workspace One Authorization URL depending on your region. + AuthURL string `json:"auth_url,required"` + // The Workspace One client ID provided in the Workspace One Admin Dashboard. + ClientID string `json:"client_id,required"` + JSON accountDevicePostureIntegrationUpdateResponseResultConfigJSON `json:"-"` +} + +// accountDevicePostureIntegrationUpdateResponseResultConfigJSON contains the JSON +// metadata for the struct +// [AccountDevicePostureIntegrationUpdateResponseResultConfig] +type accountDevicePostureIntegrationUpdateResponseResultConfigJSON struct { + APIURL apijson.Field + AuthURL apijson.Field + ClientID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationUpdateResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device posture integration. +type AccountDevicePostureIntegrationUpdateResponseResultType string + +const ( + AccountDevicePostureIntegrationUpdateResponseResultTypeWorkspaceOne AccountDevicePostureIntegrationUpdateResponseResultType = "workspace_one" + AccountDevicePostureIntegrationUpdateResponseResultTypeCrowdstrikeS2s AccountDevicePostureIntegrationUpdateResponseResultType = "crowdstrike_s2s" + AccountDevicePostureIntegrationUpdateResponseResultTypeUptycs AccountDevicePostureIntegrationUpdateResponseResultType = "uptycs" + AccountDevicePostureIntegrationUpdateResponseResultTypeIntune AccountDevicePostureIntegrationUpdateResponseResultType = "intune" + AccountDevicePostureIntegrationUpdateResponseResultTypeKolide AccountDevicePostureIntegrationUpdateResponseResultType = "kolide" + AccountDevicePostureIntegrationUpdateResponseResultTypeTanium AccountDevicePostureIntegrationUpdateResponseResultType = "tanium" + AccountDevicePostureIntegrationUpdateResponseResultTypeSentineloneS2s AccountDevicePostureIntegrationUpdateResponseResultType = "sentinelone_s2s" +) + +// Whether the API call was successful. +type AccountDevicePostureIntegrationUpdateResponseSuccess bool + +const ( + AccountDevicePostureIntegrationUpdateResponseSuccessTrue AccountDevicePostureIntegrationUpdateResponseSuccess = true +) + +type AccountDevicePostureIntegrationDeleteResponse struct { + Errors []AccountDevicePostureIntegrationDeleteResponseError `json:"errors"` + Messages []AccountDevicePostureIntegrationDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result,nullable"` + // Whether the API call was successful. + Success AccountDevicePostureIntegrationDeleteResponseSuccess `json:"success"` + JSON accountDevicePostureIntegrationDeleteResponseJSON `json:"-"` +} + +// accountDevicePostureIntegrationDeleteResponseJSON contains the JSON metadata for +// the struct [AccountDevicePostureIntegrationDeleteResponse] +type accountDevicePostureIntegrationDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationDeleteResponseErrorJSON `json:"-"` +} + +// accountDevicePostureIntegrationDeleteResponseErrorJSON contains the JSON +// metadata for the struct [AccountDevicePostureIntegrationDeleteResponseError] +type accountDevicePostureIntegrationDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationDeleteResponseMessageJSON `json:"-"` +} + +// accountDevicePostureIntegrationDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountDevicePostureIntegrationDeleteResponseMessage] +type accountDevicePostureIntegrationDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePostureIntegrationDeleteResponseSuccess bool + +const ( + AccountDevicePostureIntegrationDeleteResponseSuccessTrue AccountDevicePostureIntegrationDeleteResponseSuccess = true +) + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponse struct { + Errors []AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseError `json:"errors"` + Messages []AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseMessage `json:"messages"` + Result AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseSuccess `json:"success"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponse] +type accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseErrorJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseError] +type accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseMessageJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseMessage] +type accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResult struct { + // API UUID. + ID string `json:"id"` + // The configuration object containing third-party integration information. + Config AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultConfig `json:"config"` + // The interval between each posture check with the third-party API. Use `m` for + // minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). + Interval string `json:"interval"` + // The name of the device posture integration. + Name string `json:"name"` + // The type of device posture integration. + Type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType `json:"type"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResult] +type accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultJSON struct { + ID apijson.Field + Config apijson.Field + Interval apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing third-party integration information. +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultConfig struct { + // The Workspace One API URL provided in the Workspace One Admin Dashboard. + APIURL string `json:"api_url,required"` + // The Workspace One Authorization URL depending on your region. + AuthURL string `json:"auth_url,required"` + // The Workspace One client ID provided in the Workspace One Admin Dashboard. + ClientID string `json:"client_id,required"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultConfigJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultConfigJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultConfig] +type accountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultConfigJSON struct { + APIURL apijson.Field + AuthURL apijson.Field + ClientID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device posture integration. +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType string + +const ( + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultTypeWorkspaceOne AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType = "workspace_one" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultTypeCrowdstrikeS2s AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType = "crowdstrike_s2s" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultTypeUptycs AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType = "uptycs" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultTypeIntune AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType = "intune" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultTypeKolide AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType = "kolide" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultTypeTanium AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType = "tanium" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultTypeSentineloneS2s AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseResultType = "sentinelone_s2s" +) + +// Whether the API call was successful. +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseSuccess bool + +const ( + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseSuccessTrue AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponseSuccess = true +) + +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponse struct { + Errors []AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseError `json:"errors"` + Messages []AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseMessage `json:"messages"` + Result []AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResult `json:"result"` + ResultInfo AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseSuccess `json:"success"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponse] +type accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseErrorJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseError] +type accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseMessageJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseMessage] +type accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResult struct { + // API UUID. + ID string `json:"id"` + // The configuration object containing third-party integration information. + Config AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultConfig `json:"config"` + // The interval between each posture check with the third-party API. Use `m` for + // minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). + Interval string `json:"interval"` + // The name of the device posture integration. + Name string `json:"name"` + // The type of device posture integration. + Type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType `json:"type"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResult] +type accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultJSON struct { + ID apijson.Field + Config apijson.Field + Interval apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object containing third-party integration information. +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultConfig struct { + // The Workspace One API URL provided in the Workspace One Admin Dashboard. + APIURL string `json:"api_url,required"` + // The Workspace One Authorization URL depending on your region. + AuthURL string `json:"auth_url,required"` + // The Workspace One client ID provided in the Workspace One Admin Dashboard. + ClientID string `json:"client_id,required"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultConfigJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultConfigJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultConfig] +type accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultConfigJSON struct { + APIURL apijson.Field + AuthURL apijson.Field + ClientID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device posture integration. +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType string + +const ( + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultTypeWorkspaceOne AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType = "workspace_one" + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultTypeCrowdstrikeS2s AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType = "crowdstrike_s2s" + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultTypeUptycs AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType = "uptycs" + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultTypeIntune AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType = "intune" + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultTypeKolide AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType = "kolide" + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultTypeTanium AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType = "tanium" + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultTypeSentineloneS2s AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultType = "sentinelone_s2s" +) + +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultInfoJSON `json:"-"` +} + +// accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultInfo] +type accountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseSuccess bool + +const ( + AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseSuccessTrue AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponseSuccess = true +) + +type AccountDevicePostureIntegrationUpdateParams struct { + // The configuration object containing third-party integration information. + Config param.Field[AccountDevicePostureIntegrationUpdateParamsConfig] `json:"config"` + // The interval between each posture check with the third-party API. Use `m` for + // minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). + Interval param.Field[string] `json:"interval"` + // The name of the device posture integration. + Name param.Field[string] `json:"name"` + // The type of device posture integration. + Type param.Field[AccountDevicePostureIntegrationUpdateParamsType] `json:"type"` +} + +func (r AccountDevicePostureIntegrationUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration object containing third-party integration information. +// +// Satisfied by +// [AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhWorkspaceOneConfigRequest], +// [AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhCrowdstrikeConfigRequest], +// [AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhUptycsConfigRequest], +// [AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhIntuneConfigRequest], +// [AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhKolideConfigRequest], +// [AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhTaniumConfigRequest], +// [AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhSentineloneS2sConfigRequest]. +type AccountDevicePostureIntegrationUpdateParamsConfig interface { + implementsAccountDevicePostureIntegrationUpdateParamsConfig() +} + +type AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhWorkspaceOneConfigRequest struct { + // The Workspace One API URL provided in the Workspace One Admin Dashboard. + APIURL param.Field[string] `json:"api_url,required"` + // The Workspace One Authorization URL depending on your region. + AuthURL param.Field[string] `json:"auth_url,required"` + // The Workspace One client ID provided in the Workspace One Admin Dashboard. + ClientID param.Field[string] `json:"client_id,required"` + // The Workspace One client secret provided in the Workspace One Admin Dashboard. + ClientSecret param.Field[string] `json:"client_secret,required"` +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhWorkspaceOneConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhWorkspaceOneConfigRequest) implementsAccountDevicePostureIntegrationUpdateParamsConfig() { +} + +type AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhCrowdstrikeConfigRequest struct { + // The Crowdstrike API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The Crowdstrike client ID. + ClientID param.Field[string] `json:"client_id,required"` + // The Crowdstrike client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // The Crowdstrike customer ID. + CustomerID param.Field[string] `json:"customer_id,required"` +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhCrowdstrikeConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhCrowdstrikeConfigRequest) implementsAccountDevicePostureIntegrationUpdateParamsConfig() { +} + +type AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhUptycsConfigRequest struct { + // The Uptycs API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The Uptycs client secret. + ClientKey param.Field[string] `json:"client_key,required"` + // The Uptycs client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // The Uptycs customer ID. + CustomerID param.Field[string] `json:"customer_id,required"` +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhUptycsConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhUptycsConfigRequest) implementsAccountDevicePostureIntegrationUpdateParamsConfig() { +} + +type AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhIntuneConfigRequest struct { + // The Intune client ID. + ClientID param.Field[string] `json:"client_id,required"` + // The Intune client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // The Intune customer ID. + CustomerID param.Field[string] `json:"customer_id,required"` +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhIntuneConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhIntuneConfigRequest) implementsAccountDevicePostureIntegrationUpdateParamsConfig() { +} + +type AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhKolideConfigRequest struct { + // The Kolide client ID. + ClientID param.Field[string] `json:"client_id,required"` + // The Kolide client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhKolideConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhKolideConfigRequest) implementsAccountDevicePostureIntegrationUpdateParamsConfig() { +} + +type AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhTaniumConfigRequest struct { + // The Tanium API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The Tanium client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // If present, this id will be passed in the `CF-Access-Client-ID` header when + // hitting the `api_url` + AccessClientID param.Field[string] `json:"access_client_id"` + // If present, this secret will be passed in the `CF-Access-Client-Secret` header + // when hitting the `api_url` + AccessClientSecret param.Field[string] `json:"access_client_secret"` +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhTaniumConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhTaniumConfigRequest) implementsAccountDevicePostureIntegrationUpdateParamsConfig() { +} + +type AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhSentineloneS2sConfigRequest struct { + // The SentinelOne S2S API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The SentinelOne S2S client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhSentineloneS2sConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhSentineloneS2sConfigRequest) implementsAccountDevicePostureIntegrationUpdateParamsConfig() { +} + +// The type of device posture integration. +type AccountDevicePostureIntegrationUpdateParamsType string + +const ( + AccountDevicePostureIntegrationUpdateParamsTypeWorkspaceOne AccountDevicePostureIntegrationUpdateParamsType = "workspace_one" + AccountDevicePostureIntegrationUpdateParamsTypeCrowdstrikeS2s AccountDevicePostureIntegrationUpdateParamsType = "crowdstrike_s2s" + AccountDevicePostureIntegrationUpdateParamsTypeUptycs AccountDevicePostureIntegrationUpdateParamsType = "uptycs" + AccountDevicePostureIntegrationUpdateParamsTypeIntune AccountDevicePostureIntegrationUpdateParamsType = "intune" + AccountDevicePostureIntegrationUpdateParamsTypeKolide AccountDevicePostureIntegrationUpdateParamsType = "kolide" + AccountDevicePostureIntegrationUpdateParamsTypeTanium AccountDevicePostureIntegrationUpdateParamsType = "tanium" + AccountDevicePostureIntegrationUpdateParamsTypeSentineloneS2s AccountDevicePostureIntegrationUpdateParamsType = "sentinelone_s2s" +) + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParams struct { + // The configuration object containing third-party integration information. + Config param.Field[AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig] `json:"config,required"` + // The interval between each posture check with the third-party API. Use `m` for + // minutes (e.g. `5m`) and `h` for hours (e.g. `12h`). + Interval param.Field[string] `json:"interval,required"` + // The name of the device posture integration. + Name param.Field[string] `json:"name,required"` + // The type of device posture integration. + Type param.Field[AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType] `json:"type,required"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration object containing third-party integration information. +// +// Satisfied by +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhWorkspaceOneConfigRequest], +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhCrowdstrikeConfigRequest], +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhUptycsConfigRequest], +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhIntuneConfigRequest], +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhKolideConfigRequest], +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhTaniumConfigRequest], +// [AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhSentineloneS2sConfigRequest]. +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig interface { + implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhWorkspaceOneConfigRequest struct { + // The Workspace One API URL provided in the Workspace One Admin Dashboard. + APIURL param.Field[string] `json:"api_url,required"` + // The Workspace One Authorization URL depending on your region. + AuthURL param.Field[string] `json:"auth_url,required"` + // The Workspace One client ID provided in the Workspace One Admin Dashboard. + ClientID param.Field[string] `json:"client_id,required"` + // The Workspace One client secret provided in the Workspace One Admin Dashboard. + ClientSecret param.Field[string] `json:"client_secret,required"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhWorkspaceOneConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhWorkspaceOneConfigRequest) implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() { +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhCrowdstrikeConfigRequest struct { + // The Crowdstrike API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The Crowdstrike client ID. + ClientID param.Field[string] `json:"client_id,required"` + // The Crowdstrike client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // The Crowdstrike customer ID. + CustomerID param.Field[string] `json:"customer_id,required"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhCrowdstrikeConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhCrowdstrikeConfigRequest) implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() { +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhUptycsConfigRequest struct { + // The Uptycs API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The Uptycs client secret. + ClientKey param.Field[string] `json:"client_key,required"` + // The Uptycs client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // The Uptycs customer ID. + CustomerID param.Field[string] `json:"customer_id,required"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhUptycsConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhUptycsConfigRequest) implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() { +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhIntuneConfigRequest struct { + // The Intune client ID. + ClientID param.Field[string] `json:"client_id,required"` + // The Intune client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // The Intune customer ID. + CustomerID param.Field[string] `json:"customer_id,required"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhIntuneConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhIntuneConfigRequest) implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() { +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhKolideConfigRequest struct { + // The Kolide client ID. + ClientID param.Field[string] `json:"client_id,required"` + // The Kolide client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhKolideConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhKolideConfigRequest) implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() { +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhTaniumConfigRequest struct { + // The Tanium API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The Tanium client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` + // If present, this id will be passed in the `CF-Access-Client-ID` header when + // hitting the `api_url` + AccessClientID param.Field[string] `json:"access_client_id"` + // If present, this secret will be passed in the `CF-Access-Client-Secret` header + // when hitting the `api_url` + AccessClientSecret param.Field[string] `json:"access_client_secret"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhTaniumConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhTaniumConfigRequest) implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() { +} + +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhSentineloneS2sConfigRequest struct { + // The SentinelOne S2S API URL. + APIURL param.Field[string] `json:"api_url,required"` + // The SentinelOne S2S client secret. + ClientSecret param.Field[string] `json:"client_secret,required"` +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhSentineloneS2sConfigRequest) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhSentineloneS2sConfigRequest) implementsAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig() { +} + +// The type of device posture integration. +type AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType string + +const ( + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeWorkspaceOne AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType = "workspace_one" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeCrowdstrikeS2s AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType = "crowdstrike_s2s" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeUptycs AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType = "uptycs" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeIntune AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType = "intune" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeKolide AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType = "kolide" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeTanium AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType = "tanium" + AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeSentineloneS2s AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsType = "sentinelone_s2s" +) diff --git a/accountdevicepostureintegration_test.go b/accountdevicepostureintegration_test.go new file mode 100644 index 00000000000..b132158e6f4 --- /dev/null +++ b/accountdevicepostureintegration_test.go @@ -0,0 +1,181 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDevicePostureIntegrationGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Integrations.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePostureIntegrationUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Integrations.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDevicePostureIntegrationUpdateParams{ + Config: cloudflare.F[cloudflare.AccountDevicePostureIntegrationUpdateParamsConfig](cloudflare.AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhWorkspaceOneConfigRequest(cloudflare.AccountDevicePostureIntegrationUpdateParamsConfigZR7Sv6YhWorkspaceOneConfigRequest{ + APIURL: cloudflare.F("https://as123.awmdm.com/API"), + AuthURL: cloudflare.F("https://na.uemauth.vmwservices.com/connect/token"), + ClientID: cloudflare.F("example client id"), + ClientSecret: cloudflare.F("example client secret"), + })), + Interval: cloudflare.F("10m"), + Name: cloudflare.F("My Workspace One Integration"), + Type: cloudflare.F(cloudflare.AccountDevicePostureIntegrationUpdateParamsTypeWorkspaceOne), + }, + ) + 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 TestAccountDevicePostureIntegrationDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Integrations.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Integrations.DevicePostureIntegrationsNewDevicePostureIntegration( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParams{ + Config: cloudflare.F[cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfig](cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhWorkspaceOneConfigRequest(cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsConfigZR7Sv6YhWorkspaceOneConfigRequest{ + APIURL: cloudflare.F("https://as123.awmdm.com/API"), + AuthURL: cloudflare.F("https://na.uemauth.vmwservices.com/connect/token"), + ClientID: cloudflare.F("example client id"), + ClientSecret: cloudflare.F("example client secret"), + })), + Interval: cloudflare.F("10m"), + Name: cloudflare.F("My Workspace One Integration"), + Type: cloudflare.F(cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParamsTypeWorkspaceOne), + }, + ) + 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 TestAccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrations(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Postures.Integrations.DevicePostureIntegrationsListDevicePostureIntegrations(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountdevicerevoke.go b/accountdevicerevoke.go new file mode 100644 index 00000000000..9284e0310e5 --- /dev/null +++ b/accountdevicerevoke.go @@ -0,0 +1,140 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountDeviceRevokeService 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 [NewAccountDeviceRevokeService] +// method instead. +type AccountDeviceRevokeService struct { + Options []option.RequestOption +} + +// NewAccountDeviceRevokeService 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 NewAccountDeviceRevokeService(opts ...option.RequestOption) (r *AccountDeviceRevokeService) { + r = &AccountDeviceRevokeService{} + r.Options = opts + return +} + +// Revokes a list of devices. +func (r *AccountDeviceRevokeService) DevicesRevokeDevices(ctx context.Context, identifier interface{}, body AccountDeviceRevokeDevicesRevokeDevicesParams, opts ...option.RequestOption) (res *AccountDeviceRevokeDevicesRevokeDevicesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/revoke", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountDeviceRevokeDevicesRevokeDevicesResponse struct { + Errors []AccountDeviceRevokeDevicesRevokeDevicesResponseError `json:"errors"` + Messages []AccountDeviceRevokeDevicesRevokeDevicesResponseMessage `json:"messages"` + Result AccountDeviceRevokeDevicesRevokeDevicesResponseResult `json:"result,nullable"` + // Whether the API call was successful. + Success AccountDeviceRevokeDevicesRevokeDevicesResponseSuccess `json:"success"` + JSON accountDeviceRevokeDevicesRevokeDevicesResponseJSON `json:"-"` +} + +// accountDeviceRevokeDevicesRevokeDevicesResponseJSON contains the JSON metadata +// for the struct [AccountDeviceRevokeDevicesRevokeDevicesResponse] +type accountDeviceRevokeDevicesRevokeDevicesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceRevokeDevicesRevokeDevicesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceRevokeDevicesRevokeDevicesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceRevokeDevicesRevokeDevicesResponseErrorJSON `json:"-"` +} + +// accountDeviceRevokeDevicesRevokeDevicesResponseErrorJSON contains the JSON +// metadata for the struct [AccountDeviceRevokeDevicesRevokeDevicesResponseError] +type accountDeviceRevokeDevicesRevokeDevicesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceRevokeDevicesRevokeDevicesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceRevokeDevicesRevokeDevicesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceRevokeDevicesRevokeDevicesResponseMessageJSON `json:"-"` +} + +// accountDeviceRevokeDevicesRevokeDevicesResponseMessageJSON contains the JSON +// metadata for the struct [AccountDeviceRevokeDevicesRevokeDevicesResponseMessage] +type accountDeviceRevokeDevicesRevokeDevicesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceRevokeDevicesRevokeDevicesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountDeviceRevokeDevicesRevokeDevicesResponseResultUnknown] or +// [shared.UnionString]. +type AccountDeviceRevokeDevicesRevokeDevicesResponseResult interface { + ImplementsAccountDeviceRevokeDevicesRevokeDevicesResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDeviceRevokeDevicesRevokeDevicesResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful. +type AccountDeviceRevokeDevicesRevokeDevicesResponseSuccess bool + +const ( + AccountDeviceRevokeDevicesRevokeDevicesResponseSuccessTrue AccountDeviceRevokeDevicesRevokeDevicesResponseSuccess = true +) + +type AccountDeviceRevokeDevicesRevokeDevicesParams struct { + // A list of device ids to revoke. + Body param.Field[[]string] `json:"body,required"` +} + +func (r AccountDeviceRevokeDevicesRevokeDevicesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountdevicerevoke_test.go b/accountdevicerevoke_test.go new file mode 100644 index 00000000000..21048e0bea7 --- /dev/null +++ b/accountdevicerevoke_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDeviceRevokeDevicesRevokeDevices(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Revokes.DevicesRevokeDevices( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDeviceRevokeDevicesRevokeDevicesParams{ + Body: cloudflare.F([]string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}), + }, + ) + 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/accountdevicesetting.go b/accountdevicesetting.go new file mode 100644 index 00000000000..6ff69cb8c6a --- /dev/null +++ b/accountdevicesetting.go @@ -0,0 +1,263 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDeviceSettingService 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 [NewAccountDeviceSettingService] +// method instead. +type AccountDeviceSettingService struct { + Options []option.RequestOption +} + +// NewAccountDeviceSettingService 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 NewAccountDeviceSettingService(opts ...option.RequestOption) (r *AccountDeviceSettingService) { + r = &AccountDeviceSettingService{} + r.Options = opts + return +} + +// Describes the current device settings for a Zero Trust account. +func (r *AccountDeviceSettingService) ZeroTrustAccountsGetDeviceSettingsForZeroTrustAccount(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/settings", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the current device settings for a Zero Trust account. +func (r *AccountDeviceSettingService) ZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccount(ctx context.Context, identifier interface{}, body AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountParams, opts ...option.RequestOption) (res *AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/settings", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponse struct { + Errors []AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseError `json:"errors"` + Messages []AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseMessage `json:"messages"` + Result AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseSuccess `json:"success"` + JSON accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponse] +type accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseErrorJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseError] +type accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseMessageJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseMessage] +type accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseResult struct { + // Enable gateway proxy filtering on TCP. + GatewayProxyEnabled bool `json:"gateway_proxy_enabled"` + // Enable gateway proxy filtering on UDP. + GatewayUdpProxyEnabled bool `json:"gateway_udp_proxy_enabled"` + // Enable installation of cloudflare managed root certificate. + RootCertificateInstallationEnabled bool `json:"root_certificate_installation_enabled"` + // Enable using CGNAT virtual IPv4. + UseZtVirtualIP bool `json:"use_zt_virtual_ip"` + JSON accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseResultJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseResult] +type accountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseResultJSON struct { + GatewayProxyEnabled apijson.Field + GatewayUdpProxyEnabled apijson.Field + RootCertificateInstallationEnabled apijson.Field + UseZtVirtualIP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseSuccess bool + +const ( + AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseSuccessTrue AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponseSuccess = true +) + +type AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponse struct { + Errors []AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseError `json:"errors"` + Messages []AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseMessage `json:"messages"` + Result AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseSuccess `json:"success"` + JSON accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponse] +type accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseErrorJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseError] +type accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseMessageJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseMessage] +type accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseResult struct { + // Enable gateway proxy filtering on TCP. + GatewayProxyEnabled bool `json:"gateway_proxy_enabled"` + // Enable gateway proxy filtering on UDP. + GatewayUdpProxyEnabled bool `json:"gateway_udp_proxy_enabled"` + // Enable installation of cloudflare managed root certificate. + RootCertificateInstallationEnabled bool `json:"root_certificate_installation_enabled"` + // Enable using CGNAT virtual IPv4. + UseZtVirtualIP bool `json:"use_zt_virtual_ip"` + JSON accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseResultJSON `json:"-"` +} + +// accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseResult] +type accountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseResultJSON struct { + GatewayProxyEnabled apijson.Field + GatewayUdpProxyEnabled apijson.Field + RootCertificateInstallationEnabled apijson.Field + UseZtVirtualIP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful. +type AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseSuccess bool + +const ( + AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseSuccessTrue AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponseSuccess = true +) + +type AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountParams struct { + // Enable gateway proxy filtering on TCP. + GatewayProxyEnabled param.Field[bool] `json:"gateway_proxy_enabled"` + // Enable gateway proxy filtering on UDP. + GatewayUdpProxyEnabled param.Field[bool] `json:"gateway_udp_proxy_enabled"` + // Enable installation of cloudflare managed root certificate. + RootCertificateInstallationEnabled param.Field[bool] `json:"root_certificate_installation_enabled"` + // Enable using CGNAT virtual IPv4. + UseZtVirtualIP param.Field[bool] `json:"use_zt_virtual_ip"` +} + +func (r AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdevicesetting_test.go b/accountdevicesetting_test.go new file mode 100644 index 00000000000..ceb07bbd3ba --- /dev/null +++ b/accountdevicesetting_test.go @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccount(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Settings.ZeroTrustAccountsGetDeviceSettingsForZeroTrustAccount(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Settings.ZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccount( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountParams{ + GatewayProxyEnabled: cloudflare.F(true), + GatewayUdpProxyEnabled: cloudflare.F(true), + RootCertificateInstallationEnabled: cloudflare.F(true), + UseZtVirtualIP: cloudflare.F(true), + }, + ) + 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/accountdeviceunrevoke.go b/accountdeviceunrevoke.go new file mode 100644 index 00000000000..01e9ffdad5f --- /dev/null +++ b/accountdeviceunrevoke.go @@ -0,0 +1,142 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountDeviceUnrevokeService 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 [NewAccountDeviceUnrevokeService] +// method instead. +type AccountDeviceUnrevokeService struct { + Options []option.RequestOption +} + +// NewAccountDeviceUnrevokeService 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 NewAccountDeviceUnrevokeService(opts ...option.RequestOption) (r *AccountDeviceUnrevokeService) { + r = &AccountDeviceUnrevokeService{} + r.Options = opts + return +} + +// Unrevokes a list of devices. +func (r *AccountDeviceUnrevokeService) DevicesUnrevokeDevices(ctx context.Context, identifier interface{}, body AccountDeviceUnrevokeDevicesUnrevokeDevicesParams, opts ...option.RequestOption) (res *AccountDeviceUnrevokeDevicesUnrevokeDevicesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/devices/unrevoke", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountDeviceUnrevokeDevicesUnrevokeDevicesResponse struct { + Errors []AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseError `json:"errors"` + Messages []AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseMessage `json:"messages"` + Result AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseResult `json:"result,nullable"` + // Whether the API call was successful. + Success AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseSuccess `json:"success"` + JSON accountDeviceUnrevokeDevicesUnrevokeDevicesResponseJSON `json:"-"` +} + +// accountDeviceUnrevokeDevicesUnrevokeDevicesResponseJSON contains the JSON +// metadata for the struct [AccountDeviceUnrevokeDevicesUnrevokeDevicesResponse] +type accountDeviceUnrevokeDevicesUnrevokeDevicesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceUnrevokeDevicesUnrevokeDevicesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceUnrevokeDevicesUnrevokeDevicesResponseErrorJSON `json:"-"` +} + +// accountDeviceUnrevokeDevicesUnrevokeDevicesResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseError] +type accountDeviceUnrevokeDevicesUnrevokeDevicesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDeviceUnrevokeDevicesUnrevokeDevicesResponseMessageJSON `json:"-"` +} + +// accountDeviceUnrevokeDevicesUnrevokeDevicesResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseMessage] +type accountDeviceUnrevokeDevicesUnrevokeDevicesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseResultUnknown] or +// [shared.UnionString]. +type AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseResult interface { + ImplementsAccountDeviceUnrevokeDevicesUnrevokeDevicesResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful. +type AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseSuccess bool + +const ( + AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseSuccessTrue AccountDeviceUnrevokeDevicesUnrevokeDevicesResponseSuccess = true +) + +type AccountDeviceUnrevokeDevicesUnrevokeDevicesParams struct { + // A list of device ids to unrevoke. + Body param.Field[[]string] `json:"body,required"` +} + +func (r AccountDeviceUnrevokeDevicesUnrevokeDevicesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountdeviceunrevoke_test.go b/accountdeviceunrevoke_test.go new file mode 100644 index 00000000000..516313eecc1 --- /dev/null +++ b/accountdeviceunrevoke_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDeviceUnrevokeDevicesUnrevokeDevices(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Devices.Unrevokes.DevicesUnrevokeDevices( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountDeviceUnrevokeDevicesUnrevokeDevicesParams{ + Body: cloudflare.F([]string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}), + }, + ) + 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/accountdex.go b/accountdex.go new file mode 100644 index 00000000000..3f9bbabc2bf --- /dev/null +++ b/accountdex.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexService 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 [NewAccountDexService] method instead. +type AccountDexService struct { + Options []option.RequestOption + Colos *AccountDexColoService + FleetStatusDevices *AccountDexFleetStatusDeviceService + FleetStatusLive *AccountDexFleetStatusLiveService + FleetStatusOverTime *AccountDexFleetStatusOverTimeService + HTTPTests *AccountDexHTTPTestService + Tests *AccountDexTestService + TracerouteTestResults *AccountDexTracerouteTestResultService + TracerouteTests *AccountDexTracerouteTestService +} + +// NewAccountDexService 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 NewAccountDexService(opts ...option.RequestOption) (r *AccountDexService) { + r = &AccountDexService{} + r.Options = opts + r.Colos = NewAccountDexColoService(opts...) + r.FleetStatusDevices = NewAccountDexFleetStatusDeviceService(opts...) + r.FleetStatusLive = NewAccountDexFleetStatusLiveService(opts...) + r.FleetStatusOverTime = NewAccountDexFleetStatusOverTimeService(opts...) + r.HTTPTests = NewAccountDexHTTPTestService(opts...) + r.Tests = NewAccountDexTestService(opts...) + r.TracerouteTestResults = NewAccountDexTracerouteTestResultService(opts...) + r.TracerouteTests = NewAccountDexTracerouteTestService(opts...) + return +} diff --git a/accountdexcolo.go b/accountdexcolo.go new file mode 100644 index 00000000000..9e69364865e --- /dev/null +++ b/accountdexcolo.go @@ -0,0 +1,195 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexColoService 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 [NewAccountDexColoService] method +// instead. +type AccountDexColoService struct { + Options []option.RequestOption +} + +// NewAccountDexColoService 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 NewAccountDexColoService(opts ...option.RequestOption) (r *AccountDexColoService) { + r = &AccountDexColoService{} + r.Options = opts + return +} + +// List Cloudflare colos that account's devices were connected to during a time +// period, sorted by usage starting from the most used colo. Colos without traffic +// are also returned and sorted alphabetically. +func (r *AccountDexColoService) List(ctx context.Context, accountIdentifier string, query AccountDexColoListParams, opts ...option.RequestOption) (res *AccountDexColoListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/colos", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexColoListResponse struct { + Errors []AccountDexColoListResponseError `json:"errors"` + Messages []AccountDexColoListResponseMessage `json:"messages"` + // array of colos. + Result []AccountDexColoListResponseResult `json:"result"` + ResultInfo AccountDexColoListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountDexColoListResponseSuccess `json:"success"` + JSON accountDexColoListResponseJSON `json:"-"` +} + +// accountDexColoListResponseJSON contains the JSON metadata for the struct +// [AccountDexColoListResponse] +type accountDexColoListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexColoListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexColoListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexColoListResponseErrorJSON `json:"-"` +} + +// accountDexColoListResponseErrorJSON contains the JSON metadata for the struct +// [AccountDexColoListResponseError] +type accountDexColoListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexColoListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexColoListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexColoListResponseMessageJSON `json:"-"` +} + +// accountDexColoListResponseMessageJSON contains the JSON metadata for the struct +// [AccountDexColoListResponseMessage] +type accountDexColoListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexColoListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexColoListResponseResult struct { + // Airport code + AirportCode string `json:"airportCode,required"` + // City + City string `json:"city,required"` + // Country code + CountryCode string `json:"countryCode,required"` + JSON accountDexColoListResponseResultJSON `json:"-"` +} + +// accountDexColoListResponseResultJSON contains the JSON metadata for the struct +// [AccountDexColoListResponseResult] +type accountDexColoListResponseResultJSON struct { + AirportCode apijson.Field + City apijson.Field + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexColoListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexColoListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDexColoListResponseResultInfoJSON `json:"-"` +} + +// accountDexColoListResponseResultInfoJSON contains the JSON metadata for the +// struct [AccountDexColoListResponseResultInfo] +type accountDexColoListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexColoListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDexColoListResponseSuccess bool + +const ( + AccountDexColoListResponseSuccessTrue AccountDexColoListResponseSuccess = true +) + +type AccountDexColoListParams struct { + // End time for connection period in RFC3339 (ISO 8601) format. + TimeEnd param.Field[string] `query:"timeEnd,required"` + // Start time for connection period in RFC3339 (ISO 8601) format. + TimeStart param.Field[string] `query:"timeStart,required"` + // Type of usage that colos should be sorted by. If unspecified, returns all + // Cloudflare colos sorted alphabetically. + SortBy param.Field[AccountDexColoListParamsSortBy] `query:"sortBy"` +} + +// URLQuery serializes [AccountDexColoListParams]'s query parameters as +// `url.Values`. +func (r AccountDexColoListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Type of usage that colos should be sorted by. If unspecified, returns all +// Cloudflare colos sorted alphabetically. +type AccountDexColoListParamsSortBy string + +const ( + AccountDexColoListParamsSortByFleetStatusUsage AccountDexColoListParamsSortBy = "fleet-status-usage" + AccountDexColoListParamsSortByApplicationTestsUsage AccountDexColoListParamsSortBy = "application-tests-usage" +) diff --git a/accountdexcolo_test.go b/accountdexcolo_test.go new file mode 100644 index 00000000000..f4d054eb597 --- /dev/null +++ b/accountdexcolo_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexColoListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.Colos.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountDexColoListParams{ + TimeEnd: cloudflare.F("2023-08-24T20:45:00Z"), + TimeStart: cloudflare.F("2023-08-20T20:45:00Z"), + SortBy: cloudflare.F(cloudflare.AccountDexColoListParamsSortByFleetStatusUsage), + }, + ) + 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/accountdexfleetstatusdevice.go b/accountdexfleetstatusdevice.go new file mode 100644 index 00000000000..0f3165e2442 --- /dev/null +++ b/accountdexfleetstatusdevice.go @@ -0,0 +1,136 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexFleetStatusDeviceService 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 +// [NewAccountDexFleetStatusDeviceService] method instead. +type AccountDexFleetStatusDeviceService struct { + Options []option.RequestOption +} + +// NewAccountDexFleetStatusDeviceService 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 NewAccountDexFleetStatusDeviceService(opts ...option.RequestOption) (r *AccountDexFleetStatusDeviceService) { + r = &AccountDexFleetStatusDeviceService{} + r.Options = opts + return +} + +// List details for devices using WARP +func (r *AccountDexFleetStatusDeviceService) List(ctx context.Context, accountIdentifier string, query AccountDexFleetStatusDeviceListParams, opts ...option.RequestOption) (res *shared.Page[AccountDexFleetStatusDeviceListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/dex/fleet-status/devices", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountDexFleetStatusDeviceListResponse struct { + // Cloudflare colo + Colo string `json:"colo,required"` + // Device identifier (UUID v4) + DeviceID string `json:"deviceId,required"` + // Operating system + Platform string `json:"platform,required"` + // Network status + Status string `json:"status,required"` + // WARP client version + Version string `json:"version,required"` + // Device identifier (human readable) + DeviceName string `json:"deviceName"` + // User contact email address + PersonEmail string `json:"personEmail"` + JSON accountDexFleetStatusDeviceListResponseJSON `json:"-"` +} + +// accountDexFleetStatusDeviceListResponseJSON contains the JSON metadata for the +// struct [AccountDexFleetStatusDeviceListResponse] +type accountDexFleetStatusDeviceListResponseJSON struct { + Colo apijson.Field + DeviceID apijson.Field + Platform apijson.Field + Status apijson.Field + Version apijson.Field + DeviceName apijson.Field + PersonEmail apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusDeviceListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusDeviceListParams struct { + // Page number of paginated results + Page param.Field[float64] `query:"page,required"` + // Number of items per page + PerPage param.Field[float64] `query:"per_page,required"` + // Timestamp in ISO format + TimeEnd param.Field[string] `query:"time_end,required"` + // Timestamp in ISO format + TimeStart param.Field[string] `query:"time_start,required"` + // Cloudflare colo + Colo param.Field[string] `query:"colo"` + // Device-specific ID, given as UUID v4 + DeviceID param.Field[string] `query:"device_id"` + // The mode under which the WARP client is run + Mode param.Field[string] `query:"mode"` + // Operating system + Platform param.Field[string] `query:"platform"` + // Dimension to sort results by + SortBy param.Field[AccountDexFleetStatusDeviceListParamsSortBy] `query:"sort_by"` + // Network status + Status param.Field[string] `query:"status"` + // WARP client version + Version param.Field[string] `query:"version"` +} + +// URLQuery serializes [AccountDexFleetStatusDeviceListParams]'s query parameters +// as `url.Values`. +func (r AccountDexFleetStatusDeviceListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Dimension to sort results by +type AccountDexFleetStatusDeviceListParamsSortBy string + +const ( + AccountDexFleetStatusDeviceListParamsSortByColo AccountDexFleetStatusDeviceListParamsSortBy = "colo" + AccountDexFleetStatusDeviceListParamsSortByDeviceID AccountDexFleetStatusDeviceListParamsSortBy = "device_id" + AccountDexFleetStatusDeviceListParamsSortByMode AccountDexFleetStatusDeviceListParamsSortBy = "mode" + AccountDexFleetStatusDeviceListParamsSortByPlatform AccountDexFleetStatusDeviceListParamsSortBy = "platform" + AccountDexFleetStatusDeviceListParamsSortByStatus AccountDexFleetStatusDeviceListParamsSortBy = "status" + AccountDexFleetStatusDeviceListParamsSortByTimestamp AccountDexFleetStatusDeviceListParamsSortBy = "timestamp" + AccountDexFleetStatusDeviceListParamsSortByVersion AccountDexFleetStatusDeviceListParamsSortBy = "version" +) diff --git a/accountdexfleetstatusdevice_test.go b/accountdexfleetstatusdevice_test.go new file mode 100644 index 00000000000..3be8cf8ded2 --- /dev/null +++ b/accountdexfleetstatusdevice_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexFleetStatusDeviceListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.FleetStatusDevices.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountDexFleetStatusDeviceListParams{ + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(10.000000), + TimeEnd: cloudflare.F("2023-10-11T00:00:00Z"), + TimeStart: cloudflare.F("2023-10-11T00:00:00Z"), + Colo: cloudflare.F("SJC"), + DeviceID: cloudflare.F("cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7"), + Mode: cloudflare.F("proxy"), + Platform: cloudflare.F("windows"), + SortBy: cloudflare.F(cloudflare.AccountDexFleetStatusDeviceListParamsSortByColo), + Status: cloudflare.F("connected"), + Version: cloudflare.F("1.0.0"), + }, + ) + 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/accountdexfleetstatuslive.go b/accountdexfleetstatuslive.go new file mode 100644 index 00000000000..e7f335cab29 --- /dev/null +++ b/accountdexfleetstatuslive.go @@ -0,0 +1,275 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexFleetStatusLiveService 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 +// [NewAccountDexFleetStatusLiveService] method instead. +type AccountDexFleetStatusLiveService struct { + Options []option.RequestOption +} + +// NewAccountDexFleetStatusLiveService 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 NewAccountDexFleetStatusLiveService(opts ...option.RequestOption) (r *AccountDexFleetStatusLiveService) { + r = &AccountDexFleetStatusLiveService{} + r.Options = opts + return +} + +// List details for live (up to 60 minutes) devices using WARP +func (r *AccountDexFleetStatusLiveService) List(ctx context.Context, accountIdentifier string, query AccountDexFleetStatusLiveListParams, opts ...option.RequestOption) (res *AccountDexFleetStatusLiveListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/fleet-status/live", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexFleetStatusLiveListResponse struct { + Errors []AccountDexFleetStatusLiveListResponseError `json:"errors"` + Messages []AccountDexFleetStatusLiveListResponseMessage `json:"messages"` + Result AccountDexFleetStatusLiveListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexFleetStatusLiveListResponseSuccess `json:"success"` + JSON accountDexFleetStatusLiveListResponseJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseJSON contains the JSON metadata for the +// struct [AccountDexFleetStatusLiveListResponse] +type accountDexFleetStatusLiveListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexFleetStatusLiveListResponseErrorJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseErrorJSON contains the JSON metadata for +// the struct [AccountDexFleetStatusLiveListResponseError] +type accountDexFleetStatusLiveListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexFleetStatusLiveListResponseMessageJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseMessageJSON contains the JSON metadata for +// the struct [AccountDexFleetStatusLiveListResponseMessage] +type accountDexFleetStatusLiveListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseResult struct { + DeviceStats AccountDexFleetStatusLiveListResponseResultDeviceStats `json:"deviceStats"` + JSON accountDexFleetStatusLiveListResponseResultJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseResultJSON contains the JSON metadata for +// the struct [AccountDexFleetStatusLiveListResponseResult] +type accountDexFleetStatusLiveListResponseResultJSON struct { + DeviceStats apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseResultDeviceStats struct { + ByColo []AccountDexFleetStatusLiveListResponseResultDeviceStatsByColo `json:"byColo,nullable"` + ByMode []AccountDexFleetStatusLiveListResponseResultDeviceStatsByMode `json:"byMode,nullable"` + ByPlatform []AccountDexFleetStatusLiveListResponseResultDeviceStatsByPlatform `json:"byPlatform,nullable"` + ByStatus []AccountDexFleetStatusLiveListResponseResultDeviceStatsByStatus `json:"byStatus,nullable"` + ByVersion []AccountDexFleetStatusLiveListResponseResultDeviceStatsByVersion `json:"byVersion,nullable"` + // Number of unique devices + UniqueDevicesTotal float64 `json:"uniqueDevicesTotal"` + JSON accountDexFleetStatusLiveListResponseResultDeviceStatsJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseResultDeviceStatsJSON contains the JSON +// metadata for the struct [AccountDexFleetStatusLiveListResponseResultDeviceStats] +type accountDexFleetStatusLiveListResponseResultDeviceStatsJSON struct { + ByColo apijson.Field + ByMode apijson.Field + ByPlatform apijson.Field + ByStatus apijson.Field + ByVersion apijson.Field + UniqueDevicesTotal apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseResultDeviceStats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseResultDeviceStatsByColo struct { + // Number of unique devices + UniqueDevicesTotal float64 `json:"uniqueDevicesTotal"` + Value string `json:"value"` + JSON accountDexFleetStatusLiveListResponseResultDeviceStatsByColoJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseResultDeviceStatsByColoJSON contains the +// JSON metadata for the struct +// [AccountDexFleetStatusLiveListResponseResultDeviceStatsByColo] +type accountDexFleetStatusLiveListResponseResultDeviceStatsByColoJSON struct { + UniqueDevicesTotal apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseResultDeviceStatsByColo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseResultDeviceStatsByMode struct { + // Number of unique devices + UniqueDevicesTotal float64 `json:"uniqueDevicesTotal"` + Value string `json:"value"` + JSON accountDexFleetStatusLiveListResponseResultDeviceStatsByModeJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseResultDeviceStatsByModeJSON contains the +// JSON metadata for the struct +// [AccountDexFleetStatusLiveListResponseResultDeviceStatsByMode] +type accountDexFleetStatusLiveListResponseResultDeviceStatsByModeJSON struct { + UniqueDevicesTotal apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseResultDeviceStatsByMode) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseResultDeviceStatsByPlatform struct { + // Number of unique devices + UniqueDevicesTotal float64 `json:"uniqueDevicesTotal"` + Value string `json:"value"` + JSON accountDexFleetStatusLiveListResponseResultDeviceStatsByPlatformJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseResultDeviceStatsByPlatformJSON contains +// the JSON metadata for the struct +// [AccountDexFleetStatusLiveListResponseResultDeviceStatsByPlatform] +type accountDexFleetStatusLiveListResponseResultDeviceStatsByPlatformJSON struct { + UniqueDevicesTotal apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseResultDeviceStatsByPlatform) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseResultDeviceStatsByStatus struct { + // Number of unique devices + UniqueDevicesTotal float64 `json:"uniqueDevicesTotal"` + Value string `json:"value"` + JSON accountDexFleetStatusLiveListResponseResultDeviceStatsByStatusJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseResultDeviceStatsByStatusJSON contains the +// JSON metadata for the struct +// [AccountDexFleetStatusLiveListResponseResultDeviceStatsByStatus] +type accountDexFleetStatusLiveListResponseResultDeviceStatsByStatusJSON struct { + UniqueDevicesTotal apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseResultDeviceStatsByStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexFleetStatusLiveListResponseResultDeviceStatsByVersion struct { + // Number of unique devices + UniqueDevicesTotal float64 `json:"uniqueDevicesTotal"` + Value string `json:"value"` + JSON accountDexFleetStatusLiveListResponseResultDeviceStatsByVersionJSON `json:"-"` +} + +// accountDexFleetStatusLiveListResponseResultDeviceStatsByVersionJSON contains the +// JSON metadata for the struct +// [AccountDexFleetStatusLiveListResponseResultDeviceStatsByVersion] +type accountDexFleetStatusLiveListResponseResultDeviceStatsByVersionJSON struct { + UniqueDevicesTotal apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexFleetStatusLiveListResponseResultDeviceStatsByVersion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDexFleetStatusLiveListResponseSuccess bool + +const ( + AccountDexFleetStatusLiveListResponseSuccessTrue AccountDexFleetStatusLiveListResponseSuccess = true +) + +type AccountDexFleetStatusLiveListParams struct { + // Number of minutes before current time + SinceMinutes param.Field[float64] `query:"since_minutes,required"` +} + +// URLQuery serializes [AccountDexFleetStatusLiveListParams]'s query parameters as +// `url.Values`. +func (r AccountDexFleetStatusLiveListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdexfleetstatuslive_test.go b/accountdexfleetstatuslive_test.go new file mode 100644 index 00000000000..191681ee62a --- /dev/null +++ b/accountdexfleetstatuslive_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexFleetStatusLiveList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.FleetStatusLive.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountDexFleetStatusLiveListParams{ + SinceMinutes: cloudflare.F(10.000000), + }, + ) + 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/accountdexfleetstatusovertime.go b/accountdexfleetstatusovertime.go new file mode 100644 index 00000000000..f006dccbcd0 --- /dev/null +++ b/accountdexfleetstatusovertime.go @@ -0,0 +1,62 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexFleetStatusOverTimeService 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 +// [NewAccountDexFleetStatusOverTimeService] method instead. +type AccountDexFleetStatusOverTimeService struct { + Options []option.RequestOption +} + +// NewAccountDexFleetStatusOverTimeService 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 NewAccountDexFleetStatusOverTimeService(opts ...option.RequestOption) (r *AccountDexFleetStatusOverTimeService) { + r = &AccountDexFleetStatusOverTimeService{} + r.Options = opts + return +} + +// List details for devices using WARP, up to 7 days +func (r *AccountDexFleetStatusOverTimeService) List(ctx context.Context, accountIdentifier string, query AccountDexFleetStatusOverTimeListParams, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/dex/fleet-status/over-time", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, nil, opts...) + return +} + +type AccountDexFleetStatusOverTimeListParams struct { + // Timestamp in ISO format + TimeEnd param.Field[string] `query:"time_end,required"` + // Timestamp in ISO format + TimeStart param.Field[string] `query:"time_start,required"` + // Cloudflare colo + Colo param.Field[string] `query:"colo"` + // Device-specific ID, given as UUID v4 + DeviceID param.Field[string] `query:"device_id"` +} + +// URLQuery serializes [AccountDexFleetStatusOverTimeListParams]'s query parameters +// as `url.Values`. +func (r AccountDexFleetStatusOverTimeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdexfleetstatusovertime_test.go b/accountdexfleetstatusovertime_test.go new file mode 100644 index 00000000000..fb503c48dd6 --- /dev/null +++ b/accountdexfleetstatusovertime_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexFleetStatusOverTimeListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Dex.FleetStatusOverTime.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountDexFleetStatusOverTimeListParams{ + TimeEnd: cloudflare.F("2023-10-11T00:00:00Z"), + TimeStart: cloudflare.F("2023-10-11T00:00:00Z"), + Colo: cloudflare.F("SJC"), + DeviceID: cloudflare.F("cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7"), + }, + ) + 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/accountdexhttptest.go b/accountdexhttptest.go new file mode 100644 index 00000000000..f278dcc33d0 --- /dev/null +++ b/accountdexhttptest.go @@ -0,0 +1,573 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexHTTPTestService 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 [NewAccountDexHTTPTestService] method +// instead. +type AccountDexHTTPTestService struct { + Options []option.RequestOption + Percentiles *AccountDexHTTPTestPercentileService +} + +// NewAccountDexHTTPTestService 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 NewAccountDexHTTPTestService(opts ...option.RequestOption) (r *AccountDexHTTPTestService) { + r = &AccountDexHTTPTestService{} + r.Options = opts + r.Percentiles = NewAccountDexHTTPTestPercentileService(opts...) + return +} + +// Get test details and aggregate performance metrics for an http test for a given +// time period between 1 hour and 7 days. +func (r *AccountDexHTTPTestService) Get(ctx context.Context, accountIdentifier string, testID string, query AccountDexHTTPTestGetParams, opts ...option.RequestOption) (res *AccountDexHTTPTestGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/http-tests/%s", accountIdentifier, testID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexHTTPTestGetResponse struct { + Errors []AccountDexHTTPTestGetResponseError `json:"errors"` + Messages []AccountDexHTTPTestGetResponseMessage `json:"messages"` + Result AccountDexHTTPTestGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexHTTPTestGetResponseSuccess `json:"success"` + JSON accountDexHTTPTestGetResponseJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseJSON contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponse] +type accountDexHTTPTestGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexHTTPTestGetResponseErrorJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseError] +type accountDexHTTPTestGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexHTTPTestGetResponseMessageJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDexHTTPTestGetResponseMessage] +type accountDexHTTPTestGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResult struct { + // The url of the HTTP synthetic application test + Host string `json:"host"` + HTTPStats AccountDexHTTPTestGetResponseResultHTTPStats `json:"httpStats,nullable"` + HTTPStatsByColo []AccountDexHTTPTestGetResponseResultHTTPStatsByColo `json:"httpStatsByColo"` + // The interval at which the HTTP synthetic application test is set to run. + Interval string `json:"interval"` + Kind AccountDexHTTPTestGetResponseResultKind `json:"kind"` + // The HTTP method to use when running the test + Method string `json:"method"` + // The name of the HTTP synthetic application test + Name string `json:"name"` + JSON accountDexHTTPTestGetResponseResultJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDexHTTPTestGetResponseResult] +type accountDexHTTPTestGetResponseResultJSON struct { + Host apijson.Field + HTTPStats apijson.Field + HTTPStatsByColo apijson.Field + Interval apijson.Field + Kind apijson.Field + Method apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStats struct { + DNSResponseTimeMs AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMs `json:"dnsResponseTimeMs,required"` + HTTPStatusCode []AccountDexHTTPTestGetResponseResultHTTPStatsHTTPStatusCode `json:"httpStatusCode,required"` + ResourceFetchTimeMs AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMs `json:"resourceFetchTimeMs,required"` + ServerResponseTimeMs AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMs `json:"serverResponseTimeMs,required"` + // Count of unique devices that have run this test in the given time period + UniqueDevicesTotal int64 `json:"uniqueDevicesTotal,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsJSON contains the JSON metadata for +// the struct [AccountDexHTTPTestGetResponseResultHTTPStats] +type accountDexHTTPTestGetResponseResultHTTPStatsJSON struct { + DNSResponseTimeMs apijson.Field + HTTPStatusCode apijson.Field + ResourceFetchTimeMs apijson.Field + ServerResponseTimeMs apijson.Field + UniqueDevicesTotal apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMs struct { + Slots []AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsJSON contains the +// JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMs] +type accountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsSlotJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsSlotJSON contains +// the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsSlot] +type accountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsDNSResponseTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsHTTPStatusCode struct { + Status200 int64 `json:"status200,required"` + Status300 int64 `json:"status300,required"` + Status400 int64 `json:"status400,required"` + Status500 int64 `json:"status500,required"` + Timestamp string `json:"timestamp,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsHTTPStatusCodeJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsHTTPStatusCodeJSON contains the JSON +// metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsHTTPStatusCode] +type accountDexHTTPTestGetResponseResultHTTPStatsHTTPStatusCodeJSON struct { + Status200 apijson.Field + Status300 apijson.Field + Status400 apijson.Field + Status500 apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsHTTPStatusCode) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMs struct { + Slots []AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsJSON contains the +// JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMs] +type accountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsSlotJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsSlotJSON contains +// the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsSlot] +type accountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsResourceFetchTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMs struct { + Slots []AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsJSON contains +// the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMs] +type accountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsSlotJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsSlotJSON +// contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsSlot] +type accountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsServerResponseTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColo struct { + Colo string `json:"colo,required"` + DNSResponseTimeMs AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMs `json:"dnsResponseTimeMs,required"` + HTTPStatusCode []AccountDexHTTPTestGetResponseResultHTTPStatsByColoHTTPStatusCode `json:"httpStatusCode,required"` + ResourceFetchTimeMs AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMs `json:"resourceFetchTimeMs,required"` + ServerResponseTimeMs AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMs `json:"serverResponseTimeMs,required"` + // Count of unique devices that have run this test in the given time period + UniqueDevicesTotal int64 `json:"uniqueDevicesTotal,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoJSON contains the JSON +// metadata for the struct [AccountDexHTTPTestGetResponseResultHTTPStatsByColo] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoJSON struct { + Colo apijson.Field + DNSResponseTimeMs apijson.Field + HTTPStatusCode apijson.Field + ResourceFetchTimeMs apijson.Field + ServerResponseTimeMs apijson.Field + UniqueDevicesTotal apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMs struct { + Slots []AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsJSON contains +// the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMs] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsSlotJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsSlotJSON +// contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsSlot] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColoDNSResponseTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColoHTTPStatusCode struct { + Status200 int64 `json:"status200,required"` + Status300 int64 `json:"status300,required"` + Status400 int64 `json:"status400,required"` + Status500 int64 `json:"status500,required"` + Timestamp string `json:"timestamp,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoHTTPStatusCodeJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoHTTPStatusCodeJSON contains +// the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsByColoHTTPStatusCode] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoHTTPStatusCodeJSON struct { + Status200 apijson.Field + Status300 apijson.Field + Status400 apijson.Field + Status500 apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColoHTTPStatusCode) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMs struct { + Slots []AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsJSON +// contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMs] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsSlotJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsSlotJSON +// contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsSlot] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColoResourceFetchTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMs struct { + Slots []AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsJSON +// contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMs] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsSlotJSON `json:"-"` +} + +// accountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsSlotJSON +// contains the JSON metadata for the struct +// [AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsSlot] +type accountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestGetResponseResultHTTPStatsByColoServerResponseTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestGetResponseResultKind string + +const ( + AccountDexHTTPTestGetResponseResultKindHTTP AccountDexHTTPTestGetResponseResultKind = "http" +) + +// Whether the API call was successful +type AccountDexHTTPTestGetResponseSuccess bool + +const ( + AccountDexHTTPTestGetResponseSuccessTrue AccountDexHTTPTestGetResponseSuccess = true +) + +type AccountDexHTTPTestGetParams struct { + // Time interval for aggregate time slots. + Interval param.Field[AccountDexHTTPTestGetParamsInterval] `query:"interval,required"` + // End time for aggregate metrics in ISO ms + TimeEnd param.Field[string] `query:"timeEnd,required"` + // Start time for aggregate metrics in ISO ms + TimeStart param.Field[string] `query:"timeStart,required"` + // Optionally filter result stats to a Cloudflare colo. Cannot be used in + // combination with deviceId param. + Colo param.Field[string] `query:"colo"` + // Optionally filter result stats to a specific device(s). Cannot be used in + // combination with colo param. + DeviceID param.Field[[]string] `query:"deviceId"` +} + +// URLQuery serializes [AccountDexHTTPTestGetParams]'s query parameters as +// `url.Values`. +func (r AccountDexHTTPTestGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Time interval for aggregate time slots. +type AccountDexHTTPTestGetParamsInterval string + +const ( + AccountDexHTTPTestGetParamsIntervalMinute AccountDexHTTPTestGetParamsInterval = "minute" + AccountDexHTTPTestGetParamsIntervalHour AccountDexHTTPTestGetParamsInterval = "hour" +) diff --git a/accountdexhttptest_test.go b/accountdexhttptest_test.go new file mode 100644 index 00000000000..3dbf2a69079 --- /dev/null +++ b/accountdexhttptest_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexHTTPTestGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.HTTPTests.Get( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDexHTTPTestGetParams{ + Interval: cloudflare.F(cloudflare.AccountDexHTTPTestGetParamsIntervalMinute), + TimeEnd: cloudflare.F("1689606812000"), + TimeStart: cloudflare.F("1689520412000"), + Colo: cloudflare.F("string"), + DeviceID: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/accountdexhttptestpercentile.go b/accountdexhttptestpercentile.go new file mode 100644 index 00000000000..5aad6149964 --- /dev/null +++ b/accountdexhttptestpercentile.go @@ -0,0 +1,239 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexHTTPTestPercentileService 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 +// [NewAccountDexHTTPTestPercentileService] method instead. +type AccountDexHTTPTestPercentileService struct { + Options []option.RequestOption +} + +// NewAccountDexHTTPTestPercentileService 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 NewAccountDexHTTPTestPercentileService(opts ...option.RequestOption) (r *AccountDexHTTPTestPercentileService) { + r = &AccountDexHTTPTestPercentileService{} + r.Options = opts + return +} + +// Get percentiles for an http test for a given time period between 1 hour and 7 +// days. +func (r *AccountDexHTTPTestPercentileService) List(ctx context.Context, accountIdentifier string, testID string, query AccountDexHTTPTestPercentileListParams, opts ...option.RequestOption) (res *AccountDexHTTPTestPercentileListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/http-tests/%s/percentiles", accountIdentifier, testID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexHTTPTestPercentileListResponse struct { + Errors []AccountDexHTTPTestPercentileListResponseError `json:"errors"` + Messages []AccountDexHTTPTestPercentileListResponseMessage `json:"messages"` + Result AccountDexHTTPTestPercentileListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexHTTPTestPercentileListResponseSuccess `json:"success"` + JSON accountDexHTTPTestPercentileListResponseJSON `json:"-"` +} + +// accountDexHTTPTestPercentileListResponseJSON contains the JSON metadata for the +// struct [AccountDexHTTPTestPercentileListResponse] +type accountDexHTTPTestPercentileListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestPercentileListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestPercentileListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexHTTPTestPercentileListResponseErrorJSON `json:"-"` +} + +// accountDexHTTPTestPercentileListResponseErrorJSON contains the JSON metadata for +// the struct [AccountDexHTTPTestPercentileListResponseError] +type accountDexHTTPTestPercentileListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestPercentileListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestPercentileListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexHTTPTestPercentileListResponseMessageJSON `json:"-"` +} + +// accountDexHTTPTestPercentileListResponseMessageJSON contains the JSON metadata +// for the struct [AccountDexHTTPTestPercentileListResponseMessage] +type accountDexHTTPTestPercentileListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestPercentileListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestPercentileListResponseResult struct { + DNSResponseTimeMs AccountDexHTTPTestPercentileListResponseResultDNSResponseTimeMs `json:"dnsResponseTimeMs"` + ResourceFetchTimeMs AccountDexHTTPTestPercentileListResponseResultResourceFetchTimeMs `json:"resourceFetchTimeMs"` + ServerResponseTimeMs AccountDexHTTPTestPercentileListResponseResultServerResponseTimeMs `json:"serverResponseTimeMs"` + JSON accountDexHTTPTestPercentileListResponseResultJSON `json:"-"` +} + +// accountDexHTTPTestPercentileListResponseResultJSON contains the JSON metadata +// for the struct [AccountDexHTTPTestPercentileListResponseResult] +type accountDexHTTPTestPercentileListResponseResultJSON struct { + DNSResponseTimeMs apijson.Field + ResourceFetchTimeMs apijson.Field + ServerResponseTimeMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestPercentileListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestPercentileListResponseResultDNSResponseTimeMs struct { + // p50 observed in the time period + P50 float64 `json:"p50,nullable"` + // p90 observed in the time period + P90 float64 `json:"p90,nullable"` + // p95 observed in the time period + P95 float64 `json:"p95,nullable"` + // p99 observed in the time period + P99 float64 `json:"p99,nullable"` + JSON accountDexHTTPTestPercentileListResponseResultDNSResponseTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestPercentileListResponseResultDNSResponseTimeMsJSON contains the +// JSON metadata for the struct +// [AccountDexHTTPTestPercentileListResponseResultDNSResponseTimeMs] +type accountDexHTTPTestPercentileListResponseResultDNSResponseTimeMsJSON struct { + P50 apijson.Field + P90 apijson.Field + P95 apijson.Field + P99 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestPercentileListResponseResultDNSResponseTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestPercentileListResponseResultResourceFetchTimeMs struct { + // p50 observed in the time period + P50 float64 `json:"p50,nullable"` + // p90 observed in the time period + P90 float64 `json:"p90,nullable"` + // p95 observed in the time period + P95 float64 `json:"p95,nullable"` + // p99 observed in the time period + P99 float64 `json:"p99,nullable"` + JSON accountDexHTTPTestPercentileListResponseResultResourceFetchTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestPercentileListResponseResultResourceFetchTimeMsJSON contains +// the JSON metadata for the struct +// [AccountDexHTTPTestPercentileListResponseResultResourceFetchTimeMs] +type accountDexHTTPTestPercentileListResponseResultResourceFetchTimeMsJSON struct { + P50 apijson.Field + P90 apijson.Field + P95 apijson.Field + P99 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestPercentileListResponseResultResourceFetchTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexHTTPTestPercentileListResponseResultServerResponseTimeMs struct { + // p50 observed in the time period + P50 float64 `json:"p50,nullable"` + // p90 observed in the time period + P90 float64 `json:"p90,nullable"` + // p95 observed in the time period + P95 float64 `json:"p95,nullable"` + // p99 observed in the time period + P99 float64 `json:"p99,nullable"` + JSON accountDexHTTPTestPercentileListResponseResultServerResponseTimeMsJSON `json:"-"` +} + +// accountDexHTTPTestPercentileListResponseResultServerResponseTimeMsJSON contains +// the JSON metadata for the struct +// [AccountDexHTTPTestPercentileListResponseResultServerResponseTimeMs] +type accountDexHTTPTestPercentileListResponseResultServerResponseTimeMsJSON struct { + P50 apijson.Field + P90 apijson.Field + P95 apijson.Field + P99 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexHTTPTestPercentileListResponseResultServerResponseTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDexHTTPTestPercentileListResponseSuccess bool + +const ( + AccountDexHTTPTestPercentileListResponseSuccessTrue AccountDexHTTPTestPercentileListResponseSuccess = true +) + +type AccountDexHTTPTestPercentileListParams struct { + // End time for aggregate metrics in ISO format + TimeEnd param.Field[string] `query:"timeEnd,required"` + // Start time for aggregate metrics in ISO format + TimeStart param.Field[string] `query:"timeStart,required"` + // Optionally filter result stats to a Cloudflare colo. Cannot be used in + // combination with deviceId param. + Colo param.Field[string] `query:"colo"` + // Optionally filter result stats to a specific device(s). Cannot be used in + // combination with colo param. + DeviceID param.Field[[]string] `query:"deviceId"` +} + +// URLQuery serializes [AccountDexHTTPTestPercentileListParams]'s query parameters +// as `url.Values`. +func (r AccountDexHTTPTestPercentileListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdexhttptestpercentile_test.go b/accountdexhttptestpercentile_test.go new file mode 100644 index 00000000000..569fba3b183 --- /dev/null +++ b/accountdexhttptestpercentile_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexHTTPTestPercentileListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.HTTPTests.Percentiles.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDexHTTPTestPercentileListParams{ + TimeEnd: cloudflare.F("2023-09-20T17:00:00Z"), + TimeStart: cloudflare.F("2023-09-20T17:00:00Z"), + Colo: cloudflare.F("string"), + DeviceID: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/accountdextest.go b/accountdextest.go new file mode 100644 index 00000000000..18de930a67f --- /dev/null +++ b/accountdextest.go @@ -0,0 +1,902 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexTestService 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 [NewAccountDexTestService] method +// instead. +type AccountDexTestService struct { + Options []option.RequestOption + UniqueDevices *AccountDexTestUniqueDeviceService +} + +// NewAccountDexTestService 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 NewAccountDexTestService(opts ...option.RequestOption) (r *AccountDexTestService) { + r = &AccountDexTestService{} + r.Options = opts + r.UniqueDevices = NewAccountDexTestUniqueDeviceService(opts...) + return +} + +// List DEX tests +func (r *AccountDexTestService) List(ctx context.Context, accountIdentifier string, query AccountDexTestListParams, opts ...option.RequestOption) (res *AccountDexTestListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/tests", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexTestListResponse struct { + Errors []AccountDexTestListResponseError `json:"errors"` + Messages []AccountDexTestListResponseMessage `json:"messages"` + Result AccountDexTestListResponseResult `json:"result"` + ResultInfo AccountDexTestListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountDexTestListResponseSuccess `json:"success"` + JSON accountDexTestListResponseJSON `json:"-"` +} + +// accountDexTestListResponseJSON contains the JSON metadata for the struct +// [AccountDexTestListResponse] +type accountDexTestListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTestListResponseErrorJSON `json:"-"` +} + +// accountDexTestListResponseErrorJSON contains the JSON metadata for the struct +// [AccountDexTestListResponseError] +type accountDexTestListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTestListResponseMessageJSON `json:"-"` +} + +// accountDexTestListResponseMessageJSON contains the JSON metadata for the struct +// [AccountDexTestListResponseMessage] +type accountDexTestListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResult struct { + OverviewMetrics AccountDexTestListResponseResultOverviewMetrics `json:"overviewMetrics,required"` + // array of test results objects. + Tests []AccountDexTestListResponseResultTest `json:"tests,required"` + JSON accountDexTestListResponseResultJSON `json:"-"` +} + +// accountDexTestListResponseResultJSON contains the JSON metadata for the struct +// [AccountDexTestListResponseResult] +type accountDexTestListResponseResultJSON struct { + OverviewMetrics apijson.Field + Tests apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultOverviewMetrics struct { + // number of tests. + TestsTotal int64 `json:"testsTotal,required"` + // percentage availability for all traceroutes results in response + AvgTracerouteAvailabilityPct float64 `json:"avgTracerouteAvailabilityPct,nullable"` + JSON accountDexTestListResponseResultOverviewMetricsJSON `json:"-"` +} + +// accountDexTestListResponseResultOverviewMetricsJSON contains the JSON metadata +// for the struct [AccountDexTestListResponseResultOverviewMetrics] +type accountDexTestListResponseResultOverviewMetricsJSON struct { + TestsTotal apijson.Field + AvgTracerouteAvailabilityPct apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultOverviewMetrics) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTest struct { + // API Resource UUID tag. + ID string `json:"id,required"` + // date the test was created. + Created string `json:"created,required"` + // the test description defined during configuration + Description string `json:"description,required"` + // if true, then the test will run on targeted devices. Else, the test will not + // run. + Enabled bool `json:"enabled,required"` + Host string `json:"host,required"` + // The interval at which the synthetic application test is set to run. + Interval string `json:"interval,required"` + // test type, http or traceroute + Kind AccountDexTestListResponseResultTestsKind `json:"kind,required"` + // name given to this test + Name string `json:"name,required"` + Updated string `json:"updated,required"` + HTTPResults AccountDexTestListResponseResultTestsHTTPResults `json:"httpResults,nullable"` + HTTPResultsByColo []AccountDexTestListResponseResultTestsHTTPResultsByColo `json:"httpResultsByColo"` + // for HTTP, the method to use when running the test + Method string `json:"method"` + TracerouteResults AccountDexTestListResponseResultTestsTracerouteResults `json:"tracerouteResults,nullable"` + TracerouteResultsByColo []AccountDexTestListResponseResultTestsTracerouteResultsByColo `json:"tracerouteResultsByColo"` + JSON accountDexTestListResponseResultTestJSON `json:"-"` +} + +// accountDexTestListResponseResultTestJSON contains the JSON metadata for the +// struct [AccountDexTestListResponseResultTest] +type accountDexTestListResponseResultTestJSON struct { + ID apijson.Field + Created apijson.Field + Description apijson.Field + Enabled apijson.Field + Host apijson.Field + Interval apijson.Field + Kind apijson.Field + Name apijson.Field + Updated apijson.Field + HTTPResults apijson.Field + HTTPResultsByColo apijson.Field + Method apijson.Field + TracerouteResults apijson.Field + TracerouteResultsByColo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// test type, http or traceroute +type AccountDexTestListResponseResultTestsKind string + +const ( + AccountDexTestListResponseResultTestsKindHTTP AccountDexTestListResponseResultTestsKind = "http" + AccountDexTestListResponseResultTestsKindTraceroute AccountDexTestListResponseResultTestsKind = "traceroute" +) + +type AccountDexTestListResponseResultTestsHTTPResults struct { + ResourceFetchTime AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTime `json:"resourceFetchTime,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsJSON contains the JSON metadata +// for the struct [AccountDexTestListResponseResultTestsHTTPResults] +type accountDexTestListResponseResultTestsHTTPResultsJSON struct { + ResourceFetchTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResults) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTime struct { + History []AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistory `json:"history,required"` + AvgMs int64 `json:"avgMs,nullable"` + OverTime AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTime `json:"overTime,nullable"` + JSON accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeJSON contains +// the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTime] +type accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeJSON struct { + History apijson.Field + AvgMs apijson.Field + OverTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistory struct { + TimePeriod AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriod `json:"timePeriod,required"` + AvgMs int64 `json:"avgMs,nullable"` + DeltaPct float64 `json:"deltaPct,nullable"` + JSON accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistory] +type accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryJSON struct { + TimePeriod apijson.Field + AvgMs apijson.Field + DeltaPct apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriod struct { + Units AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriod] +type accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnitsHours AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnitsDays AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeHistoryTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTime struct { + TimePeriod AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriod `json:"timePeriod,required"` + Values []AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeValue `json:"values,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTime] +type accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeJSON struct { + TimePeriod apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriod struct { + Units AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriod] +type accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnitsHours AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnitsDays AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeValue struct { + AvgMs int64 `json:"avgMs,required"` + Timestamp string `json:"timestamp,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeValueJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeValueJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeValue] +type accountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeValueJSON struct { + AvgMs apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsResourceFetchTimeOverTimeValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsByColo struct { + // Cloudflare colo + Colo string `json:"colo,required"` + ResourceFetchTime AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTime `json:"resourceFetchTime,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsByColoJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsByColoJSON contains the JSON +// metadata for the struct [AccountDexTestListResponseResultTestsHTTPResultsByColo] +type accountDexTestListResponseResultTestsHTTPResultsByColoJSON struct { + Colo apijson.Field + ResourceFetchTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsByColo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTime struct { + History []AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistory `json:"history,required"` + AvgMs int64 `json:"avgMs,nullable"` + OverTime AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTime `json:"overTime,nullable"` + JSON accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTime] +type accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeJSON struct { + History apijson.Field + AvgMs apijson.Field + OverTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistory struct { + TimePeriod AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriod `json:"timePeriod,required"` + AvgMs int64 `json:"avgMs,nullable"` + DeltaPct float64 `json:"deltaPct,nullable"` + JSON accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistory] +type accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryJSON struct { + TimePeriod apijson.Field + AvgMs apijson.Field + DeltaPct apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriod struct { + Units AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriod] +type accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnitsHours AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnitsDays AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeHistoryTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTime struct { + TimePeriod AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriod `json:"timePeriod,required"` + Values []AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeValue `json:"values,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTime] +type accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeJSON struct { + TimePeriod apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriod struct { + Units AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriod] +type accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnitsHours AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnitsDays AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeValue struct { + AvgMs int64 `json:"avgMs,required"` + Timestamp string `json:"timestamp,required"` + JSON accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeValueJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeValueJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeValue] +type accountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeValueJSON struct { + AvgMs apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsHTTPResultsByColoResourceFetchTimeOverTimeValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResults struct { + RoundTripTime AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTime `json:"roundTripTime,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsJSON contains the JSON +// metadata for the struct [AccountDexTestListResponseResultTestsTracerouteResults] +type accountDexTestListResponseResultTestsTracerouteResultsJSON struct { + RoundTripTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResults) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTime struct { + History []AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistory `json:"history,required"` + AvgMs int64 `json:"avgMs,nullable"` + OverTime AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTime `json:"overTime,nullable"` + JSON accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeJSON contains +// the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTime] +type accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeJSON struct { + History apijson.Field + AvgMs apijson.Field + OverTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistory struct { + TimePeriod AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriod `json:"timePeriod,required"` + AvgMs int64 `json:"avgMs,nullable"` + DeltaPct float64 `json:"deltaPct,nullable"` + JSON accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistory] +type accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryJSON struct { + TimePeriod apijson.Field + AvgMs apijson.Field + DeltaPct apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriod struct { + Units AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriod] +type accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnitsHours AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnitsDays AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeHistoryTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTime struct { + TimePeriod AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriod `json:"timePeriod,required"` + Values []AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeValue `json:"values,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTime] +type accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeJSON struct { + TimePeriod apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriod struct { + Units AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriod] +type accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnitsHours AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnitsDays AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeValue struct { + AvgMs int64 `json:"avgMs,required"` + Timestamp string `json:"timestamp,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeValueJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeValueJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeValue] +type accountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeValueJSON struct { + AvgMs apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsRoundTripTimeOverTimeValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsByColo struct { + // Cloudflare colo + Colo string `json:"colo,required"` + RoundTripTime AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTime `json:"roundTripTime,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsByColoJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsByColoJSON contains the +// JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsByColo] +type accountDexTestListResponseResultTestsTracerouteResultsByColoJSON struct { + Colo apijson.Field + RoundTripTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsByColo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTime struct { + History []AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistory `json:"history,required"` + AvgMs int64 `json:"avgMs,nullable"` + OverTime AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTime `json:"overTime,nullable"` + JSON accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTime] +type accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeJSON struct { + History apijson.Field + AvgMs apijson.Field + OverTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistory struct { + TimePeriod AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriod `json:"timePeriod,required"` + AvgMs int64 `json:"avgMs,nullable"` + DeltaPct float64 `json:"deltaPct,nullable"` + JSON accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistory] +type accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryJSON struct { + TimePeriod apijson.Field + AvgMs apijson.Field + DeltaPct apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriod struct { + Units AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriod] +type accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnitsHours AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnitsDays AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeHistoryTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTime struct { + TimePeriod AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriod `json:"timePeriod,required"` + Values []AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeValue `json:"values,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTime] +type accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeJSON struct { + TimePeriod apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTime) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriod struct { + Units AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnits `json:"units,required"` + Value int64 `json:"value,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriod] +type accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodJSON struct { + Units apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnits string + +const ( + AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnitsHours AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnits = "hours" + AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnitsDays AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnits = "days" + AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnitsTestRuns AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeTimePeriodUnits = "testRuns" +) + +type AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeValue struct { + AvgMs int64 `json:"avgMs,required"` + Timestamp string `json:"timestamp,required"` + JSON accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeValueJSON `json:"-"` +} + +// accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeValueJSON +// contains the JSON metadata for the struct +// [AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeValue] +type accountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeValueJSON struct { + AvgMs apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultTestsTracerouteResultsByColoRoundTripTimeOverTimeValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDexTestListResponseResultInfoJSON `json:"-"` +} + +// accountDexTestListResponseResultInfoJSON contains the JSON metadata for the +// struct [AccountDexTestListResponseResultInfo] +type accountDexTestListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDexTestListResponseSuccess bool + +const ( + AccountDexTestListResponseSuccessTrue AccountDexTestListResponseSuccess = true +) + +type AccountDexTestListParams struct { + // Optionally filter result stats to a Cloudflare colo. Cannot be used in + // combination with deviceId param. + Colo param.Field[string] `query:"colo"` + // Optionally filter result stats to a specific device(s). Cannot be used in + // combination with colo param. + DeviceID param.Field[[]string] `query:"deviceId"` + // Page number of paginated results + Page param.Field[float64] `query:"page"` + // Number of items per page + PerPage param.Field[float64] `query:"per_page"` + // Optionally filter results by test name + TestName param.Field[string] `query:"testName"` +} + +// URLQuery serializes [AccountDexTestListParams]'s query parameters as +// `url.Values`. +func (r AccountDexTestListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdextest_test.go b/accountdextest_test.go new file mode 100644 index 00000000000..0976ef90681 --- /dev/null +++ b/accountdextest_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexTestListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.Tests.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountDexTestListParams{ + Colo: cloudflare.F("string"), + DeviceID: cloudflare.F([]string{"string", "string", "string"}), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + TestName: cloudflare.F("string"), + }, + ) + 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/accountdextestuniquedevice.go b/accountdextestuniquedevice.go new file mode 100644 index 00000000000..677ce74082d --- /dev/null +++ b/accountdextestuniquedevice.go @@ -0,0 +1,147 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexTestUniqueDeviceService 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 +// [NewAccountDexTestUniqueDeviceService] method instead. +type AccountDexTestUniqueDeviceService struct { + Options []option.RequestOption +} + +// NewAccountDexTestUniqueDeviceService 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 NewAccountDexTestUniqueDeviceService(opts ...option.RequestOption) (r *AccountDexTestUniqueDeviceService) { + r = &AccountDexTestUniqueDeviceService{} + r.Options = opts + return +} + +// Returns unique count of devices that have run synthetic application monitoring +// tests in the past 7 days. +func (r *AccountDexTestUniqueDeviceService) List(ctx context.Context, accountIdentifier string, query AccountDexTestUniqueDeviceListParams, opts ...option.RequestOption) (res *AccountDexTestUniqueDeviceListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/tests/unique-devices", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexTestUniqueDeviceListResponse struct { + Errors []AccountDexTestUniqueDeviceListResponseError `json:"errors"` + Messages []AccountDexTestUniqueDeviceListResponseMessage `json:"messages"` + Result AccountDexTestUniqueDeviceListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexTestUniqueDeviceListResponseSuccess `json:"success"` + JSON accountDexTestUniqueDeviceListResponseJSON `json:"-"` +} + +// accountDexTestUniqueDeviceListResponseJSON contains the JSON metadata for the +// struct [AccountDexTestUniqueDeviceListResponse] +type accountDexTestUniqueDeviceListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestUniqueDeviceListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestUniqueDeviceListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTestUniqueDeviceListResponseErrorJSON `json:"-"` +} + +// accountDexTestUniqueDeviceListResponseErrorJSON contains the JSON metadata for +// the struct [AccountDexTestUniqueDeviceListResponseError] +type accountDexTestUniqueDeviceListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestUniqueDeviceListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestUniqueDeviceListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTestUniqueDeviceListResponseMessageJSON `json:"-"` +} + +// accountDexTestUniqueDeviceListResponseMessageJSON contains the JSON metadata for +// the struct [AccountDexTestUniqueDeviceListResponseMessage] +type accountDexTestUniqueDeviceListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestUniqueDeviceListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTestUniqueDeviceListResponseResult struct { + // total number of unique devices + UniqueDevicesTotal int64 `json:"uniqueDevicesTotal,required"` + JSON accountDexTestUniqueDeviceListResponseResultJSON `json:"-"` +} + +// accountDexTestUniqueDeviceListResponseResultJSON contains the JSON metadata for +// the struct [AccountDexTestUniqueDeviceListResponseResult] +type accountDexTestUniqueDeviceListResponseResultJSON struct { + UniqueDevicesTotal apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTestUniqueDeviceListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDexTestUniqueDeviceListResponseSuccess bool + +const ( + AccountDexTestUniqueDeviceListResponseSuccessTrue AccountDexTestUniqueDeviceListResponseSuccess = true +) + +type AccountDexTestUniqueDeviceListParams struct { + // Optionally filter result stats to a specific device(s). Cannot be used in + // combination with colo param. + DeviceID param.Field[[]string] `query:"deviceId"` + // Optionally filter results by test name + TestName param.Field[string] `query:"testName"` +} + +// URLQuery serializes [AccountDexTestUniqueDeviceListParams]'s query parameters as +// `url.Values`. +func (r AccountDexTestUniqueDeviceListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdextestuniquedevice_test.go b/accountdextestuniquedevice_test.go new file mode 100644 index 00000000000..26c229d5883 --- /dev/null +++ b/accountdextestuniquedevice_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexTestUniqueDeviceListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.Tests.UniqueDevices.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountDexTestUniqueDeviceListParams{ + DeviceID: cloudflare.F([]string{"string", "string", "string"}), + TestName: cloudflare.F("string"), + }, + ) + 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/accountdextraceroutetest.go b/accountdextraceroutetest.go new file mode 100644 index 00000000000..df31e4dc804 --- /dev/null +++ b/accountdextraceroutetest.go @@ -0,0 +1,819 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexTracerouteTestService 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 +// [NewAccountDexTracerouteTestService] method instead. +type AccountDexTracerouteTestService struct { + Options []option.RequestOption + NetworkPath *AccountDexTracerouteTestNetworkPathService +} + +// NewAccountDexTracerouteTestService 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 NewAccountDexTracerouteTestService(opts ...option.RequestOption) (r *AccountDexTracerouteTestService) { + r = &AccountDexTracerouteTestService{} + r.Options = opts + r.NetworkPath = NewAccountDexTracerouteTestNetworkPathService(opts...) + return +} + +// Get test details and aggregate performance metrics for an traceroute test for a +// given time period between 1 hour and 7 days. +func (r *AccountDexTracerouteTestService) Get(ctx context.Context, accountIdentifier string, testID string, query AccountDexTracerouteTestGetParams, opts ...option.RequestOption) (res *AccountDexTracerouteTestGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/traceroute-tests/%s", accountIdentifier, testID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Get percentiles for a traceroute test for a given time period between 1 hour and +// 7 days. +func (r *AccountDexTracerouteTestService) Percentiles(ctx context.Context, accountIdentifier string, testID string, query AccountDexTracerouteTestPercentilesParams, opts ...option.RequestOption) (res *AccountDexTracerouteTestPercentilesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/traceroute-tests/%s/percentiles", accountIdentifier, testID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexTracerouteTestGetResponse struct { + Errors []AccountDexTracerouteTestGetResponseError `json:"errors"` + Messages []AccountDexTracerouteTestGetResponseMessage `json:"messages"` + Result AccountDexTracerouteTestGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexTracerouteTestGetResponseSuccess `json:"success"` + JSON accountDexTracerouteTestGetResponseJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseJSON contains the JSON metadata for the +// struct [AccountDexTracerouteTestGetResponse] +type accountDexTracerouteTestGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestGetResponseErrorJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountDexTracerouteTestGetResponseError] +type accountDexTracerouteTestGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestGetResponseMessageJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountDexTracerouteTestGetResponseMessage] +type accountDexTracerouteTestGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResult struct { + // The host of the Traceroute synthetic application test + Host string `json:"host,required"` + // The interval at which the Traceroute synthetic application test is set to run. + Interval string `json:"interval,required"` + Kind AccountDexTracerouteTestGetResponseResultKind `json:"kind,required"` + // The name of the Traceroute synthetic application test + Name string `json:"name,required"` + TracerouteStats AccountDexTracerouteTestGetResponseResultTracerouteStats `json:"tracerouteStats,nullable"` + TracerouteStatsByColo []AccountDexTracerouteTestGetResponseResultTracerouteStatsByColo `json:"tracerouteStatsByColo"` + JSON accountDexTracerouteTestGetResponseResultJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDexTracerouteTestGetResponseResult] +type accountDexTracerouteTestGetResponseResultJSON struct { + Host apijson.Field + Interval apijson.Field + Kind apijson.Field + Name apijson.Field + TracerouteStats apijson.Field + TracerouteStatsByColo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultKind string + +const ( + AccountDexTracerouteTestGetResponseResultKindTraceroute AccountDexTracerouteTestGetResponseResultKind = "traceroute" +) + +type AccountDexTracerouteTestGetResponseResultTracerouteStats struct { + AvailabilityPct AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPct `json:"availabilityPct,required"` + HopsCount AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCount `json:"hopsCount,required"` + PacketLossPct AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPct `json:"packetLossPct,required"` + RoundTripTimeMs AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMs `json:"roundTripTimeMs,required"` + // Count of unique devices that have run this test in the given time period + UniqueDevicesTotal int64 `json:"uniqueDevicesTotal,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsJSON contains the JSON +// metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStats] +type accountDexTracerouteTestGetResponseResultTracerouteStatsJSON struct { + AvailabilityPct apijson.Field + HopsCount apijson.Field + PacketLossPct apijson.Field + RoundTripTimeMs apijson.Field + UniqueDevicesTotal apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPct struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctSlot `json:"slots,required"` + // average observed in the time period + Avg float64 `json:"avg,nullable"` + // highest observed in the time period + Max float64 `json:"max,nullable"` + // lowest observed in the time period + Min float64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPct] +type accountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPct) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctSlot struct { + Timestamp string `json:"timestamp,required"` + Value float64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsAvailabilityPctSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCount struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountJSON contains +// the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCount] +type accountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsHopsCountSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPct struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctSlot `json:"slots,required"` + // average observed in the time period + Avg float64 `json:"avg,nullable"` + // highest observed in the time period + Max float64 `json:"max,nullable"` + // lowest observed in the time period + Min float64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPct] +type accountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPct) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctSlot struct { + Timestamp string `json:"timestamp,required"` + Value float64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsPacketLossPctSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMs struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMs] +type accountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsRoundTripTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColo struct { + AvailabilityPct AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPct `json:"availabilityPct,required"` + Colo string `json:"colo,required"` + HopsCount AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCount `json:"hopsCount,required"` + PacketLossPct AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPct `json:"packetLossPct,required"` + RoundTripTimeMs AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMs `json:"roundTripTimeMs,required"` + // Count of unique devices that have run this test in the given time period + UniqueDevicesTotal int64 `json:"uniqueDevicesTotal,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoJSON contains the +// JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColo] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoJSON struct { + AvailabilityPct apijson.Field + Colo apijson.Field + HopsCount apijson.Field + PacketLossPct apijson.Field + RoundTripTimeMs apijson.Field + UniqueDevicesTotal apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPct struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctSlot `json:"slots,required"` + // average observed in the time period + Avg float64 `json:"avg,nullable"` + // highest observed in the time period + Max float64 `json:"max,nullable"` + // lowest observed in the time period + Min float64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPct] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPct) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctSlot struct { + Timestamp string `json:"timestamp,required"` + Value float64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoAvailabilityPctSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCount struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCount] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoHopsCountSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPct struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctSlot `json:"slots,required"` + // average observed in the time period + Avg float64 `json:"avg,nullable"` + // highest observed in the time period + Max float64 `json:"max,nullable"` + // lowest observed in the time period + Min float64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPct] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPct) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctSlot struct { + Timestamp string `json:"timestamp,required"` + Value float64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoPacketLossPctSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMs struct { + Slots []AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsSlot `json:"slots,required"` + // average observed in the time period + Avg int64 `json:"avg,nullable"` + // highest observed in the time period + Max int64 `json:"max,nullable"` + // lowest observed in the time period + Min int64 `json:"min,nullable"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMs] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsJSON struct { + Slots apijson.Field + Avg apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsSlot struct { + Timestamp string `json:"timestamp,required"` + Value int64 `json:"value,required"` + JSON accountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsSlotJSON `json:"-"` +} + +// accountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsSlot] +type accountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsSlotJSON struct { + Timestamp apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestGetResponseResultTracerouteStatsByColoRoundTripTimeMsSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDexTracerouteTestGetResponseSuccess bool + +const ( + AccountDexTracerouteTestGetResponseSuccessTrue AccountDexTracerouteTestGetResponseSuccess = true +) + +type AccountDexTracerouteTestPercentilesResponse struct { + Errors []AccountDexTracerouteTestPercentilesResponseError `json:"errors"` + Messages []AccountDexTracerouteTestPercentilesResponseMessage `json:"messages"` + Result AccountDexTracerouteTestPercentilesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexTracerouteTestPercentilesResponseSuccess `json:"success"` + JSON accountDexTracerouteTestPercentilesResponseJSON `json:"-"` +} + +// accountDexTracerouteTestPercentilesResponseJSON contains the JSON metadata for +// the struct [AccountDexTracerouteTestPercentilesResponse] +type accountDexTracerouteTestPercentilesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestPercentilesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestPercentilesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestPercentilesResponseErrorJSON `json:"-"` +} + +// accountDexTracerouteTestPercentilesResponseErrorJSON contains the JSON metadata +// for the struct [AccountDexTracerouteTestPercentilesResponseError] +type accountDexTracerouteTestPercentilesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestPercentilesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestPercentilesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestPercentilesResponseMessageJSON `json:"-"` +} + +// accountDexTracerouteTestPercentilesResponseMessageJSON contains the JSON +// metadata for the struct [AccountDexTracerouteTestPercentilesResponseMessage] +type accountDexTracerouteTestPercentilesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestPercentilesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestPercentilesResponseResult struct { + HopsCount AccountDexTracerouteTestPercentilesResponseResultHopsCount `json:"hopsCount"` + PacketLossPct AccountDexTracerouteTestPercentilesResponseResultPacketLossPct `json:"packetLossPct"` + RoundTripTimeMs AccountDexTracerouteTestPercentilesResponseResultRoundTripTimeMs `json:"roundTripTimeMs"` + JSON accountDexTracerouteTestPercentilesResponseResultJSON `json:"-"` +} + +// accountDexTracerouteTestPercentilesResponseResultJSON contains the JSON metadata +// for the struct [AccountDexTracerouteTestPercentilesResponseResult] +type accountDexTracerouteTestPercentilesResponseResultJSON struct { + HopsCount apijson.Field + PacketLossPct apijson.Field + RoundTripTimeMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestPercentilesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestPercentilesResponseResultHopsCount struct { + // p50 observed in the time period + P50 float64 `json:"p50,nullable"` + // p90 observed in the time period + P90 float64 `json:"p90,nullable"` + // p95 observed in the time period + P95 float64 `json:"p95,nullable"` + // p99 observed in the time period + P99 float64 `json:"p99,nullable"` + JSON accountDexTracerouteTestPercentilesResponseResultHopsCountJSON `json:"-"` +} + +// accountDexTracerouteTestPercentilesResponseResultHopsCountJSON contains the JSON +// metadata for the struct +// [AccountDexTracerouteTestPercentilesResponseResultHopsCount] +type accountDexTracerouteTestPercentilesResponseResultHopsCountJSON struct { + P50 apijson.Field + P90 apijson.Field + P95 apijson.Field + P99 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestPercentilesResponseResultHopsCount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestPercentilesResponseResultPacketLossPct struct { + // p50 observed in the time period + P50 float64 `json:"p50,nullable"` + // p90 observed in the time period + P90 float64 `json:"p90,nullable"` + // p95 observed in the time period + P95 float64 `json:"p95,nullable"` + // p99 observed in the time period + P99 float64 `json:"p99,nullable"` + JSON accountDexTracerouteTestPercentilesResponseResultPacketLossPctJSON `json:"-"` +} + +// accountDexTracerouteTestPercentilesResponseResultPacketLossPctJSON contains the +// JSON metadata for the struct +// [AccountDexTracerouteTestPercentilesResponseResultPacketLossPct] +type accountDexTracerouteTestPercentilesResponseResultPacketLossPctJSON struct { + P50 apijson.Field + P90 apijson.Field + P95 apijson.Field + P99 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestPercentilesResponseResultPacketLossPct) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestPercentilesResponseResultRoundTripTimeMs struct { + // p50 observed in the time period + P50 float64 `json:"p50,nullable"` + // p90 observed in the time period + P90 float64 `json:"p90,nullable"` + // p95 observed in the time period + P95 float64 `json:"p95,nullable"` + // p99 observed in the time period + P99 float64 `json:"p99,nullable"` + JSON accountDexTracerouteTestPercentilesResponseResultRoundTripTimeMsJSON `json:"-"` +} + +// accountDexTracerouteTestPercentilesResponseResultRoundTripTimeMsJSON contains +// the JSON metadata for the struct +// [AccountDexTracerouteTestPercentilesResponseResultRoundTripTimeMs] +type accountDexTracerouteTestPercentilesResponseResultRoundTripTimeMsJSON struct { + P50 apijson.Field + P90 apijson.Field + P95 apijson.Field + P99 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestPercentilesResponseResultRoundTripTimeMs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDexTracerouteTestPercentilesResponseSuccess bool + +const ( + AccountDexTracerouteTestPercentilesResponseSuccessTrue AccountDexTracerouteTestPercentilesResponseSuccess = true +) + +type AccountDexTracerouteTestGetParams struct { + // Time interval for aggregate time slots. + Interval param.Field[AccountDexTracerouteTestGetParamsInterval] `query:"interval,required"` + // End time for aggregate metrics in ISO ms + TimeEnd param.Field[string] `query:"timeEnd,required"` + // Start time for aggregate metrics in ISO ms + TimeStart param.Field[string] `query:"timeStart,required"` + // Optionally filter result stats to a Cloudflare colo. Cannot be used in + // combination with deviceId param. + Colo param.Field[string] `query:"colo"` + // Optionally filter result stats to a specific device(s). Cannot be used in + // combination with colo param. + DeviceID param.Field[[]string] `query:"deviceId"` +} + +// URLQuery serializes [AccountDexTracerouteTestGetParams]'s query parameters as +// `url.Values`. +func (r AccountDexTracerouteTestGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Time interval for aggregate time slots. +type AccountDexTracerouteTestGetParamsInterval string + +const ( + AccountDexTracerouteTestGetParamsIntervalMinute AccountDexTracerouteTestGetParamsInterval = "minute" + AccountDexTracerouteTestGetParamsIntervalHour AccountDexTracerouteTestGetParamsInterval = "hour" +) + +type AccountDexTracerouteTestPercentilesParams struct { + // End time for aggregate metrics in ISO format + TimeEnd param.Field[string] `query:"timeEnd,required"` + // Start time for aggregate metrics in ISO format + TimeStart param.Field[string] `query:"timeStart,required"` + // Optionally filter result stats to a Cloudflare colo. Cannot be used in + // combination with deviceId param. + Colo param.Field[string] `query:"colo"` + // Optionally filter result stats to a specific device(s). Cannot be used in + // combination with colo param. + DeviceID param.Field[[]string] `query:"deviceId"` +} + +// URLQuery serializes [AccountDexTracerouteTestPercentilesParams]'s query +// parameters as `url.Values`. +func (r AccountDexTracerouteTestPercentilesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdextraceroutetest_test.go b/accountdextraceroutetest_test.go new file mode 100644 index 00000000000..9eab557ab22 --- /dev/null +++ b/accountdextraceroutetest_test.go @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexTracerouteTestGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.TracerouteTests.Get( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDexTracerouteTestGetParams{ + Interval: cloudflare.F(cloudflare.AccountDexTracerouteTestGetParamsIntervalMinute), + TimeEnd: cloudflare.F("1689606812000"), + TimeStart: cloudflare.F("1689520412000"), + Colo: cloudflare.F("string"), + DeviceID: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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 TestAccountDexTracerouteTestPercentilesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.TracerouteTests.Percentiles( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDexTracerouteTestPercentilesParams{ + TimeEnd: cloudflare.F("2023-09-20T17:00:00Z"), + TimeStart: cloudflare.F("2023-09-20T17:00:00Z"), + Colo: cloudflare.F("string"), + DeviceID: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/accountdextraceroutetestnetworkpath.go b/accountdextraceroutetestnetworkpath.go new file mode 100644 index 00000000000..84fbafde929 --- /dev/null +++ b/accountdextraceroutetestnetworkpath.go @@ -0,0 +1,263 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexTracerouteTestNetworkPathService 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 +// [NewAccountDexTracerouteTestNetworkPathService] method instead. +type AccountDexTracerouteTestNetworkPathService struct { + Options []option.RequestOption +} + +// NewAccountDexTracerouteTestNetworkPathService 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 NewAccountDexTracerouteTestNetworkPathService(opts ...option.RequestOption) (r *AccountDexTracerouteTestNetworkPathService) { + r = &AccountDexTracerouteTestNetworkPathService{} + r.Options = opts + return +} + +// Get a breakdown of metrics by hop for individual traceroute test runs +func (r *AccountDexTracerouteTestNetworkPathService) List(ctx context.Context, accountIdentifier string, testID string, query AccountDexTracerouteTestNetworkPathListParams, opts ...option.RequestOption) (res *AccountDexTracerouteTestNetworkPathListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/traceroute-tests/%s/network-path", accountIdentifier, testID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDexTracerouteTestNetworkPathListResponse struct { + Errors []AccountDexTracerouteTestNetworkPathListResponseError `json:"errors"` + Messages []AccountDexTracerouteTestNetworkPathListResponseMessage `json:"messages"` + Result AccountDexTracerouteTestNetworkPathListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexTracerouteTestNetworkPathListResponseSuccess `json:"success"` + JSON accountDexTracerouteTestNetworkPathListResponseJSON `json:"-"` +} + +// accountDexTracerouteTestNetworkPathListResponseJSON contains the JSON metadata +// for the struct [AccountDexTracerouteTestNetworkPathListResponse] +type accountDexTracerouteTestNetworkPathListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestNetworkPathListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestNetworkPathListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestNetworkPathListResponseErrorJSON `json:"-"` +} + +// accountDexTracerouteTestNetworkPathListResponseErrorJSON contains the JSON +// metadata for the struct [AccountDexTracerouteTestNetworkPathListResponseError] +type accountDexTracerouteTestNetworkPathListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestNetworkPathListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestNetworkPathListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestNetworkPathListResponseMessageJSON `json:"-"` +} + +// accountDexTracerouteTestNetworkPathListResponseMessageJSON contains the JSON +// metadata for the struct [AccountDexTracerouteTestNetworkPathListResponseMessage] +type accountDexTracerouteTestNetworkPathListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestNetworkPathListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestNetworkPathListResponseResult struct { + // API Resource UUID tag. + ID string `json:"id,required"` + DeviceName string `json:"deviceName"` + // The interval at which the Traceroute synthetic application test is set to run. + Interval string `json:"interval"` + Kind AccountDexTracerouteTestNetworkPathListResponseResultKind `json:"kind"` + Name string `json:"name"` + NetworkPath AccountDexTracerouteTestNetworkPathListResponseResultNetworkPath `json:"networkPath,nullable"` + // The host of the Traceroute synthetic application test + URL string `json:"url"` + JSON accountDexTracerouteTestNetworkPathListResponseResultJSON `json:"-"` +} + +// accountDexTracerouteTestNetworkPathListResponseResultJSON contains the JSON +// metadata for the struct [AccountDexTracerouteTestNetworkPathListResponseResult] +type accountDexTracerouteTestNetworkPathListResponseResultJSON struct { + ID apijson.Field + DeviceName apijson.Field + Interval apijson.Field + Kind apijson.Field + Name apijson.Field + NetworkPath apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestNetworkPathListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestNetworkPathListResponseResultKind string + +const ( + AccountDexTracerouteTestNetworkPathListResponseResultKindTraceroute AccountDexTracerouteTestNetworkPathListResponseResultKind = "traceroute" +) + +type AccountDexTracerouteTestNetworkPathListResponseResultNetworkPath struct { + Slots []AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSlot `json:"slots,required"` + // Specifies the sampling applied, if any, to the slots response. When sampled, + // results shown represent the first test run to the start of each sampling + // interval. + Sampling AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSampling `json:"sampling,nullable"` + JSON accountDexTracerouteTestNetworkPathListResponseResultNetworkPathJSON `json:"-"` +} + +// accountDexTracerouteTestNetworkPathListResponseResultNetworkPathJSON contains +// the JSON metadata for the struct +// [AccountDexTracerouteTestNetworkPathListResponseResultNetworkPath] +type accountDexTracerouteTestNetworkPathListResponseResultNetworkPathJSON struct { + Slots apijson.Field + Sampling apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestNetworkPathListResponseResultNetworkPath) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSlot struct { + // API Resource UUID tag. + ID string `json:"id,required"` + // Round trip time in ms of the client to app mile + ClientToAppRttMs int64 `json:"clientToAppRttMs,required,nullable"` + // Round trip time in ms of the client to Cloudflare egress mile + ClientToCfEgressRttMs int64 `json:"clientToCfEgressRttMs,required,nullable"` + // Round trip time in ms of the client to Cloudflare ingress mile + ClientToCfIngressRttMs int64 `json:"clientToCfIngressRttMs,required,nullable"` + Timestamp string `json:"timestamp,required"` + // Round trip time in ms of the client to ISP mile + ClientToIspRttMs int64 `json:"clientToIspRttMs,nullable"` + JSON accountDexTracerouteTestNetworkPathListResponseResultNetworkPathSlotJSON `json:"-"` +} + +// accountDexTracerouteTestNetworkPathListResponseResultNetworkPathSlotJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSlot] +type accountDexTracerouteTestNetworkPathListResponseResultNetworkPathSlotJSON struct { + ID apijson.Field + ClientToAppRttMs apijson.Field + ClientToCfEgressRttMs apijson.Field + ClientToCfIngressRttMs apijson.Field + Timestamp apijson.Field + ClientToIspRttMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSlot) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the sampling applied, if any, to the slots response. When sampled, +// results shown represent the first test run to the start of each sampling +// interval. +type AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSampling struct { + Unit AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSamplingUnit `json:"unit,required"` + Value int64 `json:"value,required"` + JSON accountDexTracerouteTestNetworkPathListResponseResultNetworkPathSamplingJSON `json:"-"` +} + +// accountDexTracerouteTestNetworkPathListResponseResultNetworkPathSamplingJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSampling] +type accountDexTracerouteTestNetworkPathListResponseResultNetworkPathSamplingJSON struct { + Unit apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSampling) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSamplingUnit string + +const ( + AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSamplingUnitHours AccountDexTracerouteTestNetworkPathListResponseResultNetworkPathSamplingUnit = "hours" +) + +// Whether the API call was successful +type AccountDexTracerouteTestNetworkPathListResponseSuccess bool + +const ( + AccountDexTracerouteTestNetworkPathListResponseSuccessTrue AccountDexTracerouteTestNetworkPathListResponseSuccess = true +) + +type AccountDexTracerouteTestNetworkPathListParams struct { + // Device to filter tracroute result runs to + DeviceID param.Field[string] `query:"deviceId,required"` + // Time interval for aggregate time slots. + Interval param.Field[AccountDexTracerouteTestNetworkPathListParamsInterval] `query:"interval,required"` + // End time for aggregate metrics in ISO ms + TimeEnd param.Field[string] `query:"timeEnd,required"` + // Start time for aggregate metrics in ISO ms + TimeStart param.Field[string] `query:"timeStart,required"` +} + +// URLQuery serializes [AccountDexTracerouteTestNetworkPathListParams]'s query +// parameters as `url.Values`. +func (r AccountDexTracerouteTestNetworkPathListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Time interval for aggregate time slots. +type AccountDexTracerouteTestNetworkPathListParamsInterval string + +const ( + AccountDexTracerouteTestNetworkPathListParamsIntervalMinute AccountDexTracerouteTestNetworkPathListParamsInterval = "minute" + AccountDexTracerouteTestNetworkPathListParamsIntervalHour AccountDexTracerouteTestNetworkPathListParamsInterval = "hour" +) diff --git a/accountdextraceroutetestnetworkpath_test.go b/accountdextraceroutetestnetworkpath_test.go new file mode 100644 index 00000000000..374c48af5be --- /dev/null +++ b/accountdextraceroutetestnetworkpath_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexTracerouteTestNetworkPathList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.TracerouteTests.NetworkPath.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDexTracerouteTestNetworkPathListParams{ + DeviceID: cloudflare.F("string"), + Interval: cloudflare.F(cloudflare.AccountDexTracerouteTestNetworkPathListParamsIntervalMinute), + TimeEnd: cloudflare.F("1689606812000"), + TimeStart: cloudflare.F("1689520412000"), + }, + ) + 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/accountdextraceroutetestresult.go b/accountdextraceroutetestresult.go new file mode 100644 index 00000000000..6d398d6268e --- /dev/null +++ b/accountdextraceroutetestresult.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexTracerouteTestResultService 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 +// [NewAccountDexTracerouteTestResultService] method instead. +type AccountDexTracerouteTestResultService struct { + Options []option.RequestOption + NetworkPath *AccountDexTracerouteTestResultNetworkPathService +} + +// NewAccountDexTracerouteTestResultService 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 NewAccountDexTracerouteTestResultService(opts ...option.RequestOption) (r *AccountDexTracerouteTestResultService) { + r = &AccountDexTracerouteTestResultService{} + r.Options = opts + r.NetworkPath = NewAccountDexTracerouteTestResultNetworkPathService(opts...) + return +} diff --git a/accountdextraceroutetestresultnetworkpath.go b/accountdextraceroutetestresultnetworkpath.go new file mode 100644 index 00000000000..2520f2d23b3 --- /dev/null +++ b/accountdextraceroutetestresultnetworkpath.go @@ -0,0 +1,211 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDexTracerouteTestResultNetworkPathService 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 [NewAccountDexTracerouteTestResultNetworkPathService] method instead. +type AccountDexTracerouteTestResultNetworkPathService struct { + Options []option.RequestOption +} + +// NewAccountDexTracerouteTestResultNetworkPathService 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 NewAccountDexTracerouteTestResultNetworkPathService(opts ...option.RequestOption) (r *AccountDexTracerouteTestResultNetworkPathService) { + r = &AccountDexTracerouteTestResultNetworkPathService{} + r.Options = opts + return +} + +// Get a breakdown of hops and performance metrics for a specific traceroute test +// run +func (r *AccountDexTracerouteTestResultNetworkPathService) List(ctx context.Context, accountIdentifier string, testResultID string, opts ...option.RequestOption) (res *AccountDexTracerouteTestResultNetworkPathListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dex/traceroute-test-results/%s/network-path", accountIdentifier, testResultID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDexTracerouteTestResultNetworkPathListResponse struct { + Errors []AccountDexTracerouteTestResultNetworkPathListResponseError `json:"errors"` + Messages []AccountDexTracerouteTestResultNetworkPathListResponseMessage `json:"messages"` + Result AccountDexTracerouteTestResultNetworkPathListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDexTracerouteTestResultNetworkPathListResponseSuccess `json:"success"` + JSON accountDexTracerouteTestResultNetworkPathListResponseJSON `json:"-"` +} + +// accountDexTracerouteTestResultNetworkPathListResponseJSON contains the JSON +// metadata for the struct [AccountDexTracerouteTestResultNetworkPathListResponse] +type accountDexTracerouteTestResultNetworkPathListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestResultNetworkPathListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestResultNetworkPathListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestResultNetworkPathListResponseErrorJSON `json:"-"` +} + +// accountDexTracerouteTestResultNetworkPathListResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountDexTracerouteTestResultNetworkPathListResponseError] +type accountDexTracerouteTestResultNetworkPathListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestResultNetworkPathListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestResultNetworkPathListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDexTracerouteTestResultNetworkPathListResponseMessageJSON `json:"-"` +} + +// accountDexTracerouteTestResultNetworkPathListResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountDexTracerouteTestResultNetworkPathListResponseMessage] +type accountDexTracerouteTestResultNetworkPathListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestResultNetworkPathListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestResultNetworkPathListResponseResult struct { + // an array of the hops taken by the device to reach the end destination + Hops []AccountDexTracerouteTestResultNetworkPathListResponseResultHop `json:"hops,required"` + // API Resource UUID tag. + ResultID string `json:"resultId,required"` + // date time of this traceroute test + TimeStart string `json:"time_start,required"` + // name of the device associated with this network path response + DeviceName string `json:"deviceName"` + // API Resource UUID tag. + TestID string `json:"testId"` + // name of the tracroute test + TestName string `json:"testName"` + JSON accountDexTracerouteTestResultNetworkPathListResponseResultJSON `json:"-"` +} + +// accountDexTracerouteTestResultNetworkPathListResponseResultJSON contains the +// JSON metadata for the struct +// [AccountDexTracerouteTestResultNetworkPathListResponseResult] +type accountDexTracerouteTestResultNetworkPathListResponseResultJSON struct { + Hops apijson.Field + ResultID apijson.Field + TimeStart apijson.Field + DeviceName apijson.Field + TestID apijson.Field + TestName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestResultNetworkPathListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestResultNetworkPathListResponseResultHop struct { + Ttl int64 `json:"ttl,required"` + ASN int64 `json:"asn,nullable"` + Aso string `json:"aso,nullable"` + IPAddress string `json:"ipAddress,nullable"` + Location AccountDexTracerouteTestResultNetworkPathListResponseResultHopsLocation `json:"location,nullable"` + Mile AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMile `json:"mile,nullable"` + Name string `json:"name,nullable"` + PacketLossPct float64 `json:"packetLossPct,nullable"` + RttMs int64 `json:"rttMs,nullable"` + JSON accountDexTracerouteTestResultNetworkPathListResponseResultHopJSON `json:"-"` +} + +// accountDexTracerouteTestResultNetworkPathListResponseResultHopJSON contains the +// JSON metadata for the struct +// [AccountDexTracerouteTestResultNetworkPathListResponseResultHop] +type accountDexTracerouteTestResultNetworkPathListResponseResultHopJSON struct { + Ttl apijson.Field + ASN apijson.Field + Aso apijson.Field + IPAddress apijson.Field + Location apijson.Field + Mile apijson.Field + Name apijson.Field + PacketLossPct apijson.Field + RttMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestResultNetworkPathListResponseResultHop) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestResultNetworkPathListResponseResultHopsLocation struct { + City string `json:"city,nullable"` + State string `json:"state,nullable"` + Zip string `json:"zip,nullable"` + JSON accountDexTracerouteTestResultNetworkPathListResponseResultHopsLocationJSON `json:"-"` +} + +// accountDexTracerouteTestResultNetworkPathListResponseResultHopsLocationJSON +// contains the JSON metadata for the struct +// [AccountDexTracerouteTestResultNetworkPathListResponseResultHopsLocation] +type accountDexTracerouteTestResultNetworkPathListResponseResultHopsLocationJSON struct { + City apijson.Field + State apijson.Field + Zip apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDexTracerouteTestResultNetworkPathListResponseResultHopsLocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMile string + +const ( + AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMileClientToApp AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMile = "client-to-app" + AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMileClientToCfEgress AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMile = "client-to-cf-egress" + AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMileClientToCfIngress AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMile = "client-to-cf-ingress" + AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMileClientToIsp AccountDexTracerouteTestResultNetworkPathListResponseResultHopsMile = "client-to-isp" +) + +// Whether the API call was successful +type AccountDexTracerouteTestResultNetworkPathListResponseSuccess bool + +const ( + AccountDexTracerouteTestResultNetworkPathListResponseSuccessTrue AccountDexTracerouteTestResultNetworkPathListResponseSuccess = true +) diff --git a/accountdextraceroutetestresultnetworkpath_test.go b/accountdextraceroutetestresultnetworkpath_test.go new file mode 100644 index 00000000000..03b2e76b399 --- /dev/null +++ b/accountdextraceroutetestresultnetworkpath_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDexTracerouteTestResultNetworkPathList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dex.TracerouteTestResults.NetworkPath.List( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/accountdiagnostic.go b/accountdiagnostic.go new file mode 100644 index 00000000000..3dd05a62d94 --- /dev/null +++ b/accountdiagnostic.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDiagnosticService 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 [NewAccountDiagnosticService] method +// instead. +type AccountDiagnosticService struct { + Options []option.RequestOption + Traceroutes *AccountDiagnosticTracerouteService +} + +// NewAccountDiagnosticService 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 NewAccountDiagnosticService(opts ...option.RequestOption) (r *AccountDiagnosticService) { + r = &AccountDiagnosticService{} + r.Options = opts + r.Traceroutes = NewAccountDiagnosticTracerouteService(opts...) + return +} diff --git a/accountdiagnostictraceroute.go b/accountdiagnostictraceroute.go new file mode 100644 index 00000000000..86a62518d0e --- /dev/null +++ b/accountdiagnostictraceroute.go @@ -0,0 +1,340 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDiagnosticTracerouteService 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 +// [NewAccountDiagnosticTracerouteService] method instead. +type AccountDiagnosticTracerouteService struct { + Options []option.RequestOption +} + +// NewAccountDiagnosticTracerouteService 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 NewAccountDiagnosticTracerouteService(opts ...option.RequestOption) (r *AccountDiagnosticTracerouteService) { + r = &AccountDiagnosticTracerouteService{} + r.Options = opts + return +} + +// Run traceroutes from Cloudflare colos. +func (r *AccountDiagnosticTracerouteService) DiagnosticsTraceroute(ctx context.Context, accountIdentifier string, body AccountDiagnosticTracerouteDiagnosticsTracerouteParams, opts ...option.RequestOption) (res *AccountDiagnosticTracerouteDiagnosticsTracerouteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/diagnostics/traceroute", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponse struct { + Errors []AccountDiagnosticTracerouteDiagnosticsTracerouteResponseError `json:"errors"` + Messages []AccountDiagnosticTracerouteDiagnosticsTracerouteResponseMessage `json:"messages"` + Result []AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResult `json:"result"` + ResultInfo AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountDiagnosticTracerouteDiagnosticsTracerouteResponseSuccess `json:"success"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseJSON contains the JSON +// metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponse] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseErrorJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseError] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseMessageJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseMessage] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResult struct { + Colos []AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColo `json:"colos"` + // The target hostname, IPv6, or IPv6 address. + Target string `json:"target"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultJSON contains the +// JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResult] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultJSON struct { + Colos apijson.Field + Target apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColo struct { + Colo AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosColo `json:"colo"` + // Errors resulting from collecting traceroute from colo to target. + Error AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosError `json:"error"` + Hops []AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHop `json:"hops"` + // Aggregated statistics from all hops about the target. + TargetSummary interface{} `json:"target_summary"` + // Total time of traceroute in ms. + TracerouteTimeMs int64 `json:"traceroute_time_ms"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColoJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColoJSON contains +// the JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColo] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColoJSON struct { + Colo apijson.Field + Error apijson.Field + Hops apijson.Field + TargetSummary apijson.Field + TracerouteTimeMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosColo struct { + // Source colo city. + City string `json:"city"` + // Source colo name. + Name string `json:"name"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosColoJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosColoJSON +// contains the JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosColo] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosColoJSON struct { + City apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosColo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Errors resulting from collecting traceroute from colo to target. +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosError string + +const ( + AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosErrorEmpty AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosError = "" + AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosErrorCouldNotGatherTracerouteDataCode1 AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosError = "Could not gather traceroute data: Code 1" + AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosErrorCouldNotGatherTracerouteDataCode2 AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosError = "Could not gather traceroute data: Code 2" + AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosErrorCouldNotGatherTracerouteDataCode3 AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosError = "Could not gather traceroute data: Code 3" + AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosErrorCouldNotGatherTracerouteDataCode4 AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosError = "Could not gather traceroute data: Code 4" +) + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHop struct { + // An array of node objects. + Nodes []AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopsNode `json:"nodes"` + // Number of packets where no response was received. + PacketsLost int64 `json:"packets_lost"` + // Number of packets sent with specified TTL. + PacketsSent int64 `json:"packets_sent"` + // The time to live (TTL). + PacketsTtl int64 `json:"packets_ttl"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopJSON +// contains the JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHop] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopJSON struct { + Nodes apijson.Field + PacketsLost apijson.Field + PacketsSent apijson.Field + PacketsTtl apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHop) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopsNode struct { + // AS number associated with the node object. + ASN string `json:"asn"` + // IP address of the node. + IP string `json:"ip"` + // Field appears if there is an additional annotation printed when the probe + // returns. Field also appears when running a GRE+ICMP traceroute to denote which + // traceroute a node comes from. + Labels []string `json:"labels"` + // Maximum RTT in ms. + MaxRttMs float64 `json:"max_rtt_ms"` + // Mean RTT in ms. + MeanRttMs float64 `json:"mean_rtt_ms"` + // Minimum RTT in ms. + MinRttMs float64 `json:"min_rtt_ms"` + // Host name of the address, this may be the same as the IP address. + Name string `json:"name"` + // Number of packets with a response from this node. + PacketCount int64 `json:"packet_count"` + // Standard deviation of the RTTs in ms. + StdDevRttMs float64 `json:"std_dev_rtt_ms"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopsNodeJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopsNodeJSON +// contains the JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopsNode] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopsNodeJSON struct { + ASN apijson.Field + IP apijson.Field + Labels apijson.Field + MaxRttMs apijson.Field + MeanRttMs apijson.Field + MinRttMs apijson.Field + Name apijson.Field + PacketCount apijson.Field + StdDevRttMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultColosHopsNode) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultInfoJSON `json:"-"` +} + +// accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultInfo] +type accountDiagnosticTracerouteDiagnosticsTracerouteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDiagnosticTracerouteDiagnosticsTracerouteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDiagnosticTracerouteDiagnosticsTracerouteResponseSuccess bool + +const ( + AccountDiagnosticTracerouteDiagnosticsTracerouteResponseSuccessTrue AccountDiagnosticTracerouteDiagnosticsTracerouteResponseSuccess = true +) + +type AccountDiagnosticTracerouteDiagnosticsTracerouteParams struct { + Targets param.Field[[]string] `json:"targets,required"` + // If no source colo names specified, all colos will be used. China colos are + // unavailable for traceroutes. + Colos param.Field[[]string] `json:"colos"` + Options param.Field[AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptions] `json:"options"` +} + +func (r AccountDiagnosticTracerouteDiagnosticsTracerouteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptions struct { + // Max TTL. + MaxTtl param.Field[int64] `json:"max_ttl"` + // Type of packet sent. + PacketType param.Field[AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketType] `json:"packet_type"` + // Number of packets sent at each TTL. + PacketsPerTtl param.Field[int64] `json:"packets_per_ttl"` + // For UDP and TCP, specifies the destination port. For ICMP, specifies the initial + // ICMP sequence value. Default value 0 will choose the best value to use for each + // protocol. + Port param.Field[int64] `json:"port"` + // Set the time (in seconds) to wait for a response to a probe. + WaitTime param.Field[int64] `json:"wait_time"` +} + +func (r AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptions) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of packet sent. +type AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketType string + +const ( + AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketTypeIcmp AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketType = "icmp" + AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketTypeTcp AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketType = "tcp" + AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketTypeUdp AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketType = "udp" + AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketTypeGre AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketType = "gre" + AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketTypeGreIcmp AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketType = "gre+icmp" +) diff --git a/accountdiagnostictraceroute_test.go b/accountdiagnostictraceroute_test.go new file mode 100644 index 00000000000..64885eb0f58 --- /dev/null +++ b/accountdiagnostictraceroute_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDiagnosticTracerouteDiagnosticsTracerouteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Diagnostics.Traceroutes.DiagnosticsTraceroute( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDiagnosticTracerouteDiagnosticsTracerouteParams{ + Targets: cloudflare.F([]string{"203.0.113.1", "cloudflare.com"}), + Colos: cloudflare.F([]string{"den", "sin"}), + Options: cloudflare.F(cloudflare.AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptions{ + MaxTtl: cloudflare.F(int64(15)), + PacketType: cloudflare.F(cloudflare.AccountDiagnosticTracerouteDiagnosticsTracerouteParamsOptionsPacketTypeIcmp), + PacketsPerTtl: cloudflare.F(int64(0)), + Port: cloudflare.F(int64(0)), + WaitTime: cloudflare.F(int64(1)), + }), + }, + ) + 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/accountdlp.go b/accountdlp.go new file mode 100644 index 00000000000..39415f9531c --- /dev/null +++ b/accountdlp.go @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpService 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 [NewAccountDlpService] method instead. +type AccountDlpService struct { + Options []option.RequestOption + Datasets *AccountDlpDatasetService + Patterns *AccountDlpPatternService + PayloadLogs *AccountDlpPayloadLogService + Profiles *AccountDlpProfileService +} + +// NewAccountDlpService 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 NewAccountDlpService(opts ...option.RequestOption) (r *AccountDlpService) { + r = &AccountDlpService{} + r.Options = opts + r.Datasets = NewAccountDlpDatasetService(opts...) + r.Patterns = NewAccountDlpPatternService(opts...) + r.PayloadLogs = NewAccountDlpPayloadLogService(opts...) + r.Profiles = NewAccountDlpProfileService(opts...) + return +} diff --git a/accountdlpdataset.go b/accountdlpdataset.go new file mode 100644 index 00000000000..bb9e90f67f5 --- /dev/null +++ b/accountdlpdataset.go @@ -0,0 +1,724 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpDatasetService 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 [NewAccountDlpDatasetService] method +// instead. +type AccountDlpDatasetService struct { + Options []option.RequestOption + Upload *AccountDlpDatasetUploadService +} + +// NewAccountDlpDatasetService 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 NewAccountDlpDatasetService(opts ...option.RequestOption) (r *AccountDlpDatasetService) { + r = &AccountDlpDatasetService{} + r.Options = opts + r.Upload = NewAccountDlpDatasetUploadService(opts...) + return +} + +// Create a new dataset. +func (r *AccountDlpDatasetService) New(ctx context.Context, accountIdentifier string, body AccountDlpDatasetNewParams, opts ...option.RequestOption) (res *DlpDatasetCreationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/datasets", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetch a specific dataset with information about available versions. +func (r *AccountDlpDatasetService) Get(ctx context.Context, accountIdentifier string, datasetID string, opts ...option.RequestOption) (res *DlpDatasetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/datasets/%s", accountIdentifier, datasetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update details about a dataset. +func (r *AccountDlpDatasetService) Update(ctx context.Context, accountIdentifier string, datasetID string, body AccountDlpDatasetUpdateParams, opts ...option.RequestOption) (res *DlpDatasetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/datasets/%s", accountIdentifier, datasetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Fetch all datasets with information about available versions. +func (r *AccountDlpDatasetService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *DlpDatasetArrayResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/datasets", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a dataset. +// +// This deletes all versions of the dataset. +func (r *AccountDlpDatasetService) Delete(ctx context.Context, accountIdentifier string, datasetID string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/dlp/datasets/%s", accountIdentifier, datasetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +type DlpDatasetArrayResponse struct { + Errors []DlpDatasetArrayResponseError `json:"errors"` + Messages []DlpDatasetArrayResponseMessage `json:"messages"` + Result []DlpDatasetArrayResponseResult `json:"result"` + ResultInfo DlpDatasetArrayResponseResultInfo `json:"result_info"` + Success bool `json:"success"` + JSON dlpDatasetArrayResponseJSON `json:"-"` +} + +// dlpDatasetArrayResponseJSON contains the JSON metadata for the struct +// [DlpDatasetArrayResponse] +type dlpDatasetArrayResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetArrayResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetArrayResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetArrayResponseErrorJSON `json:"-"` +} + +// dlpDatasetArrayResponseErrorJSON contains the JSON metadata for the struct +// [DlpDatasetArrayResponseError] +type dlpDatasetArrayResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetArrayResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetArrayResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetArrayResponseMessageJSON `json:"-"` +} + +// dlpDatasetArrayResponseMessageJSON contains the JSON metadata for the struct +// [DlpDatasetArrayResponseMessage] +type dlpDatasetArrayResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetArrayResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetArrayResponseResult struct { + ID string `json:"id,required" format:"uuid"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + Name string `json:"name,required"` + NumCells int64 `json:"num_cells,required"` + Secret bool `json:"secret,required"` + Status DlpDatasetArrayResponseResultStatus `json:"status,required"` + UpdatedAt time.Time `json:"updated_at,required" format:"date-time"` + Uploads []DlpDatasetArrayResponseResultUpload `json:"uploads,required"` + Description string `json:"description,nullable"` + JSON dlpDatasetArrayResponseResultJSON `json:"-"` +} + +// dlpDatasetArrayResponseResultJSON contains the JSON metadata for the struct +// [DlpDatasetArrayResponseResult] +type dlpDatasetArrayResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Name apijson.Field + NumCells apijson.Field + Secret apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + Uploads apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetArrayResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetArrayResponseResultStatus string + +const ( + DlpDatasetArrayResponseResultStatusEmpty DlpDatasetArrayResponseResultStatus = "empty" + DlpDatasetArrayResponseResultStatusUploading DlpDatasetArrayResponseResultStatus = "uploading" + DlpDatasetArrayResponseResultStatusFailed DlpDatasetArrayResponseResultStatus = "failed" + DlpDatasetArrayResponseResultStatusComplete DlpDatasetArrayResponseResultStatus = "complete" +) + +type DlpDatasetArrayResponseResultUpload struct { + NumCells int64 `json:"num_cells,required"` + Status DlpDatasetArrayResponseResultUploadsStatus `json:"status,required"` + Version int64 `json:"version,required"` + JSON dlpDatasetArrayResponseResultUploadJSON `json:"-"` +} + +// dlpDatasetArrayResponseResultUploadJSON contains the JSON metadata for the +// struct [DlpDatasetArrayResponseResultUpload] +type dlpDatasetArrayResponseResultUploadJSON struct { + NumCells apijson.Field + Status apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetArrayResponseResultUpload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetArrayResponseResultUploadsStatus string + +const ( + DlpDatasetArrayResponseResultUploadsStatusEmpty DlpDatasetArrayResponseResultUploadsStatus = "empty" + DlpDatasetArrayResponseResultUploadsStatusUploading DlpDatasetArrayResponseResultUploadsStatus = "uploading" + DlpDatasetArrayResponseResultUploadsStatusFailed DlpDatasetArrayResponseResultUploadsStatus = "failed" + DlpDatasetArrayResponseResultUploadsStatusComplete DlpDatasetArrayResponseResultUploadsStatus = "complete" +) + +type DlpDatasetArrayResponseResultInfo struct { + // total number of pages + Count int64 `json:"count,required"` + // current page + Page int64 `json:"page,required"` + // number of items per page + PerPage int64 `json:"per_page,required"` + // total number of items + TotalCount int64 `json:"total_count,required"` + JSON dlpDatasetArrayResponseResultInfoJSON `json:"-"` +} + +// dlpDatasetArrayResponseResultInfoJSON contains the JSON metadata for the struct +// [DlpDatasetArrayResponseResultInfo] +type dlpDatasetArrayResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetArrayResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetCreationResponse struct { + Errors []DlpDatasetCreationResponseError `json:"errors"` + Messages []DlpDatasetCreationResponseMessage `json:"messages"` + Result DlpDatasetCreationResponseResult `json:"result"` + ResultInfo DlpDatasetCreationResponseResultInfo `json:"result_info"` + Success bool `json:"success"` + JSON dlpDatasetCreationResponseJSON `json:"-"` +} + +// dlpDatasetCreationResponseJSON contains the JSON metadata for the struct +// [DlpDatasetCreationResponse] +type dlpDatasetCreationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetCreationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetCreationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetCreationResponseErrorJSON `json:"-"` +} + +// dlpDatasetCreationResponseErrorJSON contains the JSON metadata for the struct +// [DlpDatasetCreationResponseError] +type dlpDatasetCreationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetCreationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetCreationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetCreationResponseMessageJSON `json:"-"` +} + +// dlpDatasetCreationResponseMessageJSON contains the JSON metadata for the struct +// [DlpDatasetCreationResponseMessage] +type dlpDatasetCreationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetCreationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetCreationResponseResult struct { + Dataset DlpDatasetCreationResponseResultDataset `json:"dataset,required"` + MaxCells int64 `json:"max_cells,required"` + // The version to use when uploading the dataset. + Version int64 `json:"version,required"` + // The secret to use for Exact Data Match datasets. This is not present in Custom + // Wordlists. + Secret string `json:"secret" format:"password"` + JSON dlpDatasetCreationResponseResultJSON `json:"-"` +} + +// dlpDatasetCreationResponseResultJSON contains the JSON metadata for the struct +// [DlpDatasetCreationResponseResult] +type dlpDatasetCreationResponseResultJSON struct { + Dataset apijson.Field + MaxCells apijson.Field + Version apijson.Field + Secret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetCreationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetCreationResponseResultDataset struct { + ID string `json:"id,required" format:"uuid"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + Name string `json:"name,required"` + NumCells int64 `json:"num_cells,required"` + Secret bool `json:"secret,required"` + Status DlpDatasetCreationResponseResultDatasetStatus `json:"status,required"` + UpdatedAt time.Time `json:"updated_at,required" format:"date-time"` + Uploads []DlpDatasetCreationResponseResultDatasetUpload `json:"uploads,required"` + Description string `json:"description,nullable"` + JSON dlpDatasetCreationResponseResultDatasetJSON `json:"-"` +} + +// dlpDatasetCreationResponseResultDatasetJSON contains the JSON metadata for the +// struct [DlpDatasetCreationResponseResultDataset] +type dlpDatasetCreationResponseResultDatasetJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Name apijson.Field + NumCells apijson.Field + Secret apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + Uploads apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetCreationResponseResultDataset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetCreationResponseResultDatasetStatus string + +const ( + DlpDatasetCreationResponseResultDatasetStatusEmpty DlpDatasetCreationResponseResultDatasetStatus = "empty" + DlpDatasetCreationResponseResultDatasetStatusUploading DlpDatasetCreationResponseResultDatasetStatus = "uploading" + DlpDatasetCreationResponseResultDatasetStatusFailed DlpDatasetCreationResponseResultDatasetStatus = "failed" + DlpDatasetCreationResponseResultDatasetStatusComplete DlpDatasetCreationResponseResultDatasetStatus = "complete" +) + +type DlpDatasetCreationResponseResultDatasetUpload struct { + NumCells int64 `json:"num_cells,required"` + Status DlpDatasetCreationResponseResultDatasetUploadsStatus `json:"status,required"` + Version int64 `json:"version,required"` + JSON dlpDatasetCreationResponseResultDatasetUploadJSON `json:"-"` +} + +// dlpDatasetCreationResponseResultDatasetUploadJSON contains the JSON metadata for +// the struct [DlpDatasetCreationResponseResultDatasetUpload] +type dlpDatasetCreationResponseResultDatasetUploadJSON struct { + NumCells apijson.Field + Status apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetCreationResponseResultDatasetUpload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetCreationResponseResultDatasetUploadsStatus string + +const ( + DlpDatasetCreationResponseResultDatasetUploadsStatusEmpty DlpDatasetCreationResponseResultDatasetUploadsStatus = "empty" + DlpDatasetCreationResponseResultDatasetUploadsStatusUploading DlpDatasetCreationResponseResultDatasetUploadsStatus = "uploading" + DlpDatasetCreationResponseResultDatasetUploadsStatusFailed DlpDatasetCreationResponseResultDatasetUploadsStatus = "failed" + DlpDatasetCreationResponseResultDatasetUploadsStatusComplete DlpDatasetCreationResponseResultDatasetUploadsStatus = "complete" +) + +type DlpDatasetCreationResponseResultInfo struct { + // total number of pages + Count int64 `json:"count,required"` + // current page + Page int64 `json:"page,required"` + // number of items per page + PerPage int64 `json:"per_page,required"` + // total number of items + TotalCount int64 `json:"total_count,required"` + JSON dlpDatasetCreationResponseResultInfoJSON `json:"-"` +} + +// dlpDatasetCreationResponseResultInfoJSON contains the JSON metadata for the +// struct [DlpDatasetCreationResponseResultInfo] +type dlpDatasetCreationResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetCreationResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetNewVersionResponse struct { + Errors []DlpDatasetNewVersionResponseError `json:"errors"` + Messages []DlpDatasetNewVersionResponseMessage `json:"messages"` + Result DlpDatasetNewVersionResponseResult `json:"result"` + ResultInfo DlpDatasetNewVersionResponseResultInfo `json:"result_info"` + Success bool `json:"success"` + JSON dlpDatasetNewVersionResponseJSON `json:"-"` +} + +// dlpDatasetNewVersionResponseJSON contains the JSON metadata for the struct +// [DlpDatasetNewVersionResponse] +type dlpDatasetNewVersionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetNewVersionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetNewVersionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetNewVersionResponseErrorJSON `json:"-"` +} + +// dlpDatasetNewVersionResponseErrorJSON contains the JSON metadata for the struct +// [DlpDatasetNewVersionResponseError] +type dlpDatasetNewVersionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetNewVersionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetNewVersionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetNewVersionResponseMessageJSON `json:"-"` +} + +// dlpDatasetNewVersionResponseMessageJSON contains the JSON metadata for the +// struct [DlpDatasetNewVersionResponseMessage] +type dlpDatasetNewVersionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetNewVersionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetNewVersionResponseResult struct { + MaxCells int64 `json:"max_cells,required"` + Version int64 `json:"version,required"` + Secret string `json:"secret" format:"password"` + JSON dlpDatasetNewVersionResponseResultJSON `json:"-"` +} + +// dlpDatasetNewVersionResponseResultJSON contains the JSON metadata for the struct +// [DlpDatasetNewVersionResponseResult] +type dlpDatasetNewVersionResponseResultJSON struct { + MaxCells apijson.Field + Version apijson.Field + Secret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetNewVersionResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetNewVersionResponseResultInfo struct { + // total number of pages + Count int64 `json:"count,required"` + // current page + Page int64 `json:"page,required"` + // number of items per page + PerPage int64 `json:"per_page,required"` + // total number of items + TotalCount int64 `json:"total_count,required"` + JSON dlpDatasetNewVersionResponseResultInfoJSON `json:"-"` +} + +// dlpDatasetNewVersionResponseResultInfoJSON contains the JSON metadata for the +// struct [DlpDatasetNewVersionResponseResultInfo] +type dlpDatasetNewVersionResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetNewVersionResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetResponse struct { + Errors []DlpDatasetResponseError `json:"errors"` + Messages []DlpDatasetResponseMessage `json:"messages"` + Result DlpDatasetResponseResult `json:"result"` + ResultInfo DlpDatasetResponseResultInfo `json:"result_info"` + Success bool `json:"success"` + JSON dlpDatasetResponseJSON `json:"-"` +} + +// dlpDatasetResponseJSON contains the JSON metadata for the struct +// [DlpDatasetResponse] +type dlpDatasetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetResponseErrorJSON `json:"-"` +} + +// dlpDatasetResponseErrorJSON contains the JSON metadata for the struct +// [DlpDatasetResponseError] +type dlpDatasetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dlpDatasetResponseMessageJSON `json:"-"` +} + +// dlpDatasetResponseMessageJSON contains the JSON metadata for the struct +// [DlpDatasetResponseMessage] +type dlpDatasetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetResponseResult struct { + ID string `json:"id,required" format:"uuid"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + Name string `json:"name,required"` + NumCells int64 `json:"num_cells,required"` + Secret bool `json:"secret,required"` + Status DlpDatasetResponseResultStatus `json:"status,required"` + UpdatedAt time.Time `json:"updated_at,required" format:"date-time"` + Uploads []DlpDatasetResponseResultUpload `json:"uploads,required"` + Description string `json:"description,nullable"` + JSON dlpDatasetResponseResultJSON `json:"-"` +} + +// dlpDatasetResponseResultJSON contains the JSON metadata for the struct +// [DlpDatasetResponseResult] +type dlpDatasetResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Name apijson.Field + NumCells apijson.Field + Secret apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + Uploads apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetResponseResultStatus string + +const ( + DlpDatasetResponseResultStatusEmpty DlpDatasetResponseResultStatus = "empty" + DlpDatasetResponseResultStatusUploading DlpDatasetResponseResultStatus = "uploading" + DlpDatasetResponseResultStatusFailed DlpDatasetResponseResultStatus = "failed" + DlpDatasetResponseResultStatusComplete DlpDatasetResponseResultStatus = "complete" +) + +type DlpDatasetResponseResultUpload struct { + NumCells int64 `json:"num_cells,required"` + Status DlpDatasetResponseResultUploadsStatus `json:"status,required"` + Version int64 `json:"version,required"` + JSON dlpDatasetResponseResultUploadJSON `json:"-"` +} + +// dlpDatasetResponseResultUploadJSON contains the JSON metadata for the struct +// [DlpDatasetResponseResultUpload] +type dlpDatasetResponseResultUploadJSON struct { + NumCells apijson.Field + Status apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetResponseResultUpload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DlpDatasetResponseResultUploadsStatus string + +const ( + DlpDatasetResponseResultUploadsStatusEmpty DlpDatasetResponseResultUploadsStatus = "empty" + DlpDatasetResponseResultUploadsStatusUploading DlpDatasetResponseResultUploadsStatus = "uploading" + DlpDatasetResponseResultUploadsStatusFailed DlpDatasetResponseResultUploadsStatus = "failed" + DlpDatasetResponseResultUploadsStatusComplete DlpDatasetResponseResultUploadsStatus = "complete" +) + +type DlpDatasetResponseResultInfo struct { + // total number of pages + Count int64 `json:"count,required"` + // current page + Page int64 `json:"page,required"` + // number of items per page + PerPage int64 `json:"per_page,required"` + // total number of items + TotalCount int64 `json:"total_count,required"` + JSON dlpDatasetResponseResultInfoJSON `json:"-"` +} + +// dlpDatasetResponseResultInfoJSON contains the JSON metadata for the struct +// [DlpDatasetResponseResultInfo] +type dlpDatasetResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DlpDatasetResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpDatasetNewParams struct { + Name param.Field[string] `json:"name,required"` + Description param.Field[string] `json:"description"` + // Generate a secret dataset. + // + // If true, the response will include a secret to use with the EDM encoder. If + // false, the response has no secret and the dataset is uploaded in plaintext. + Secret param.Field[bool] `json:"secret"` +} + +func (r AccountDlpDatasetNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDlpDatasetUpdateParams struct { + Description param.Field[string] `json:"description"` + Name param.Field[string] `json:"name"` +} + +func (r AccountDlpDatasetUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdlpdataset_test.go b/accountdlpdataset_test.go new file mode 100644 index 00000000000..42c863e485b --- /dev/null +++ b/accountdlpdataset_test.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDlpDatasetNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Datasets.New( + context.TODO(), + "string", + cloudflare.AccountDlpDatasetNewParams{ + Name: cloudflare.F("string"), + Description: cloudflare.F("string"), + Secret: cloudflare.F(true), + }, + ) + 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 TestAccountDlpDatasetGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Datasets.Get( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + 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 TestAccountDlpDatasetUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Datasets.Update( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + cloudflare.AccountDlpDatasetUpdateParams{ + Description: cloudflare.F("string"), + Name: cloudflare.F("string"), + }, + ) + 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 TestAccountDlpDatasetList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Datasets.List(context.TODO(), "string") + 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 TestAccountDlpDatasetDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Dlp.Datasets.Delete( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + 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/accountdlpdatasetupload.go b/accountdlpdatasetupload.go new file mode 100644 index 00000000000..d96ce79ab34 --- /dev/null +++ b/accountdlpdatasetupload.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpDatasetUploadService 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 +// [NewAccountDlpDatasetUploadService] method instead. +type AccountDlpDatasetUploadService struct { + Options []option.RequestOption +} + +// NewAccountDlpDatasetUploadService 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 NewAccountDlpDatasetUploadService(opts ...option.RequestOption) (r *AccountDlpDatasetUploadService) { + r = &AccountDlpDatasetUploadService{} + r.Options = opts + return +} + +// Prepare to upload a new version of a dataset. +func (r *AccountDlpDatasetUploadService) Prepare(ctx context.Context, accountIdentifier string, datasetID string, opts ...option.RequestOption) (res *DlpDatasetNewVersionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/datasets/%s/upload", accountIdentifier, datasetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Upload a new version of a dataset. +func (r *AccountDlpDatasetUploadService) Upload(ctx context.Context, accountIdentifier string, datasetID string, version int64, opts ...option.RequestOption) (res *DlpDatasetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/datasets/%s/upload/%v", accountIdentifier, datasetID, version) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} diff --git a/accountdlpdatasetupload_test.go b/accountdlpdatasetupload_test.go new file mode 100644 index 00000000000..6390d30f398 --- /dev/null +++ b/accountdlpdatasetupload_test.go @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDlpDatasetUploadPrepare(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Datasets.Upload.Prepare( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + 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 TestAccountDlpDatasetUploadUpload(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Datasets.Upload.Upload( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + int64(0), + ) + 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/accountdlppattern.go b/accountdlppattern.go new file mode 100644 index 00000000000..e2e51a6124a --- /dev/null +++ b/accountdlppattern.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpPatternService 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 [NewAccountDlpPatternService] method +// instead. +type AccountDlpPatternService struct { + Options []option.RequestOption + Validates *AccountDlpPatternValidateService +} + +// NewAccountDlpPatternService 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 NewAccountDlpPatternService(opts ...option.RequestOption) (r *AccountDlpPatternService) { + r = &AccountDlpPatternService{} + r.Options = opts + r.Validates = NewAccountDlpPatternValidateService(opts...) + return +} diff --git a/accountdlppatternvalidate.go b/accountdlppatternvalidate.go new file mode 100644 index 00000000000..539a2f841fd --- /dev/null +++ b/accountdlppatternvalidate.go @@ -0,0 +1,142 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpPatternValidateService 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 +// [NewAccountDlpPatternValidateService] method instead. +type AccountDlpPatternValidateService struct { + Options []option.RequestOption +} + +// NewAccountDlpPatternValidateService 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 NewAccountDlpPatternValidateService(opts ...option.RequestOption) (r *AccountDlpPatternValidateService) { + r = &AccountDlpPatternValidateService{} + r.Options = opts + return +} + +// Validates whether this pattern is a valid regular expression. Rejects it if the +// regular expression is too complex or can match an unbounded-length string. Your +// regex will be rejected if it uses the Kleene Star -- be sure to bound the +// maximum number of characters that can be matched. +func (r *AccountDlpPatternValidateService) DlpPatternValidationValidatePattern(ctx context.Context, accountIdentifier string, body AccountDlpPatternValidateDlpPatternValidationValidatePatternParams, opts ...option.RequestOption) (res *AccountDlpPatternValidateDlpPatternValidationValidatePatternResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/patterns/validate", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountDlpPatternValidateDlpPatternValidationValidatePatternResponse struct { + Errors []AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseError `json:"errors"` + Messages []AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseMessage `json:"messages"` + Result AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseSuccess `json:"success"` + JSON accountDlpPatternValidateDlpPatternValidationValidatePatternResponseJSON `json:"-"` +} + +// accountDlpPatternValidateDlpPatternValidationValidatePatternResponseJSON +// contains the JSON metadata for the struct +// [AccountDlpPatternValidateDlpPatternValidationValidatePatternResponse] +type accountDlpPatternValidateDlpPatternValidationValidatePatternResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPatternValidateDlpPatternValidationValidatePatternResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpPatternValidateDlpPatternValidationValidatePatternResponseErrorJSON `json:"-"` +} + +// accountDlpPatternValidateDlpPatternValidationValidatePatternResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseError] +type accountDlpPatternValidateDlpPatternValidationValidatePatternResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpPatternValidateDlpPatternValidationValidatePatternResponseMessageJSON `json:"-"` +} + +// accountDlpPatternValidateDlpPatternValidationValidatePatternResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseMessage] +type accountDlpPatternValidateDlpPatternValidationValidatePatternResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseResult struct { + Valid bool `json:"valid"` + JSON accountDlpPatternValidateDlpPatternValidationValidatePatternResponseResultJSON `json:"-"` +} + +// accountDlpPatternValidateDlpPatternValidationValidatePatternResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseResult] +type accountDlpPatternValidateDlpPatternValidationValidatePatternResponseResultJSON struct { + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseSuccess bool + +const ( + AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseSuccessTrue AccountDlpPatternValidateDlpPatternValidationValidatePatternResponseSuccess = true +) + +type AccountDlpPatternValidateDlpPatternValidationValidatePatternParams struct { + // The regex pattern. + Regex param.Field[string] `json:"regex,required"` +} + +func (r AccountDlpPatternValidateDlpPatternValidationValidatePatternParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdlppatternvalidate_test.go b/accountdlppatternvalidate_test.go new file mode 100644 index 00000000000..f27e91ef7e9 --- /dev/null +++ b/accountdlppatternvalidate_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDlpPatternValidateDlpPatternValidationValidatePattern(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Patterns.Validates.DlpPatternValidationValidatePattern( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDlpPatternValidateDlpPatternValidationValidatePatternParams{ + Regex: cloudflare.F("^4[0-9]{6,}$"), + }, + ) + 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/accountdlppayloadlog.go b/accountdlppayloadlog.go new file mode 100644 index 00000000000..2d04dbcd1c2 --- /dev/null +++ b/accountdlppayloadlog.go @@ -0,0 +1,237 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpPayloadLogService 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 [NewAccountDlpPayloadLogService] +// method instead. +type AccountDlpPayloadLogService struct { + Options []option.RequestOption +} + +// NewAccountDlpPayloadLogService 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 NewAccountDlpPayloadLogService(opts ...option.RequestOption) (r *AccountDlpPayloadLogService) { + r = &AccountDlpPayloadLogService{} + r.Options = opts + return +} + +// Gets the current DLP payload log settings for this account. +func (r *AccountDlpPayloadLogService) DlpPayloadLogSettingsGetSettings(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/payload_log", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the DLP payload log settings for this account. +func (r *AccountDlpPayloadLogService) DlpPayloadLogSettingsUpdateSettings(ctx context.Context, accountIdentifier string, body AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsParams, opts ...option.RequestOption) (res *AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/payload_log", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponse struct { + Errors []AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseError `json:"errors"` + Messages []AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseMessage `json:"messages"` + Result AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseSuccess `json:"success"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseJSON contains the +// JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponse] +type accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseErrorJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseError] +type accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseMessageJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseMessage] +type accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseResult struct { + PublicKey string `json:"public_key,required,nullable"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseResultJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseResultJSON contains +// the JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseResult] +type accountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseResultJSON struct { + PublicKey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseSuccess bool + +const ( + AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseSuccessTrue AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponseSuccess = true +) + +type AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponse struct { + Errors []AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseError `json:"errors"` + Messages []AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseMessage `json:"messages"` + Result AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseSuccess `json:"success"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseJSON contains the +// JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponse] +type accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseErrorJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseError] +type accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseMessageJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseMessage] +type accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseResult struct { + PublicKey string `json:"public_key,required,nullable"` + JSON accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseResultJSON `json:"-"` +} + +// accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseResult] +type accountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseResultJSON struct { + PublicKey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseSuccess bool + +const ( + AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseSuccessTrue AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponseSuccess = true +) + +type AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsParams struct { + // The public key to use when encrypting extracted payloads, as a base64 string + PublicKey param.Field[string] `json:"public_key,required"` +} + +func (r AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdlppayloadlog_test.go b/accountdlppayloadlog_test.go new file mode 100644 index 00000000000..f796e1c5a48 --- /dev/null +++ b/accountdlppayloadlog_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDlpPayloadLogDlpPayloadLogSettingsGetSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.PayloadLogs.DlpPayloadLogSettingsGetSettings(context.TODO(), "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()) + } +} + +func TestAccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.PayloadLogs.DlpPayloadLogSettingsUpdateSettings( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsParams{ + PublicKey: cloudflare.F("EmpOvSXw8BfbrGCi0fhGiD/3yXk2SiV1Nzg2lru3oj0="), + }, + ) + 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/accountdlpprofile.go b/accountdlpprofile.go new file mode 100644 index 00000000000..0c94826bd38 --- /dev/null +++ b/accountdlpprofile.go @@ -0,0 +1,767 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpProfileService 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 [NewAccountDlpProfileService] method +// instead. +type AccountDlpProfileService struct { + Options []option.RequestOption + Customs *AccountDlpProfileCustomService + Predefineds *AccountDlpProfilePredefinedService +} + +// NewAccountDlpProfileService 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 NewAccountDlpProfileService(opts ...option.RequestOption) (r *AccountDlpProfileService) { + r = &AccountDlpProfileService{} + r.Options = opts + r.Customs = NewAccountDlpProfileCustomService(opts...) + r.Predefineds = NewAccountDlpProfilePredefinedService(opts...) + return +} + +// Fetches a DLP profile by ID. Supports both predefined and custom profiles +func (r *AccountDlpProfileService) Get(ctx context.Context, accountIdentifier string, profileID string, opts ...option.RequestOption) (res *AccountDlpProfileGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles/%s", accountIdentifier, profileID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Lists all DLP profiles in an account. +func (r *AccountDlpProfileService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountDlpProfileListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountDlpProfileGetResponse struct { + Errors []AccountDlpProfileGetResponseError `json:"errors"` + Messages []AccountDlpProfileGetResponseMessage `json:"messages"` + Result AccountDlpProfileGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDlpProfileGetResponseSuccess `json:"success"` + JSON accountDlpProfileGetResponseJSON `json:"-"` +} + +// accountDlpProfileGetResponseJSON contains the JSON metadata for the struct +// [AccountDlpProfileGetResponse] +type accountDlpProfileGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileGetResponseErrorJSON `json:"-"` +} + +// accountDlpProfileGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountDlpProfileGetResponseError] +type accountDlpProfileGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileGetResponseMessageJSON `json:"-"` +} + +// accountDlpProfileGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDlpProfileGetResponseMessage] +type accountDlpProfileGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountDlpProfileGetResponseResultDlpPredefinedProfile], +// [AccountDlpProfileGetResponseResultDlpCustomProfile] or +// [AccountDlpProfileGetResponseResultDlpIntegrationProfile]. +type AccountDlpProfileGetResponseResult interface { + implementsAccountDlpProfileGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountDlpProfileGetResponseResult)(nil)).Elem(), "") +} + +type AccountDlpProfileGetResponseResultDlpPredefinedProfile struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + // The entries for this profile. + Entries []AccountDlpProfileGetResponseResultDlpPredefinedProfileEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileGetResponseResultDlpPredefinedProfileType `json:"type"` + JSON accountDlpProfileGetResponseResultDlpPredefinedProfileJSON `json:"-"` +} + +// accountDlpProfileGetResponseResultDlpPredefinedProfileJSON contains the JSON +// metadata for the struct [AccountDlpProfileGetResponseResultDlpPredefinedProfile] +type accountDlpProfileGetResponseResultDlpPredefinedProfileJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseResultDlpPredefinedProfile) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDlpProfileGetResponseResultDlpPredefinedProfile) implementsAccountDlpProfileGetResponseResult() { +} + +// A predefined entry that matches a profile +type AccountDlpProfileGetResponseResultDlpPredefinedProfileEntry struct { + // UUID + ID string `json:"id"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + JSON accountDlpProfileGetResponseResultDlpPredefinedProfileEntryJSON `json:"-"` +} + +// accountDlpProfileGetResponseResultDlpPredefinedProfileEntryJSON contains the +// JSON metadata for the struct +// [AccountDlpProfileGetResponseResultDlpPredefinedProfileEntry] +type accountDlpProfileGetResponseResultDlpPredefinedProfileEntryJSON struct { + ID apijson.Field + Enabled apijson.Field + Name apijson.Field + ProfileID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseResultDlpPredefinedProfileEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the profile. +type AccountDlpProfileGetResponseResultDlpPredefinedProfileType string + +const ( + AccountDlpProfileGetResponseResultDlpPredefinedProfileTypePredefined AccountDlpProfileGetResponseResultDlpPredefinedProfileType = "predefined" +) + +type AccountDlpProfileGetResponseResultDlpCustomProfile struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the profile. + Description string `json:"description"` + // The entries for this profile. + Entries []AccountDlpProfileGetResponseResultDlpCustomProfileEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileGetResponseResultDlpCustomProfileType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileGetResponseResultDlpCustomProfileJSON `json:"-"` +} + +// accountDlpProfileGetResponseResultDlpCustomProfileJSON contains the JSON +// metadata for the struct [AccountDlpProfileGetResponseResultDlpCustomProfile] +type accountDlpProfileGetResponseResultDlpCustomProfileJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseResultDlpCustomProfile) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDlpProfileGetResponseResultDlpCustomProfile) implementsAccountDlpProfileGetResponseResult() { +} + +// A custom entry that matches a profile +type AccountDlpProfileGetResponseResultDlpCustomProfileEntry struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // A pattern that matches an entry + Pattern AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPattern `json:"pattern"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileGetResponseResultDlpCustomProfileEntryJSON `json:"-"` +} + +// accountDlpProfileGetResponseResultDlpCustomProfileEntryJSON contains the JSON +// metadata for the struct +// [AccountDlpProfileGetResponseResultDlpCustomProfileEntry] +type accountDlpProfileGetResponseResultDlpCustomProfileEntryJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + Name apijson.Field + Pattern apijson.Field + ProfileID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseResultDlpCustomProfileEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A pattern that matches an entry +type AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPattern struct { + // The regex pattern. + Regex string `json:"regex,required"` + // Validation algorithm for the pattern. This algorithm will get run on potential + // matches, and if it returns false, the entry will not be matched. + Validation AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPatternValidation `json:"validation"` + JSON accountDlpProfileGetResponseResultDlpCustomProfileEntriesPatternJSON `json:"-"` +} + +// accountDlpProfileGetResponseResultDlpCustomProfileEntriesPatternJSON contains +// the JSON metadata for the struct +// [AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPattern] +type accountDlpProfileGetResponseResultDlpCustomProfileEntriesPatternJSON struct { + Regex apijson.Field + Validation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPattern) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Validation algorithm for the pattern. This algorithm will get run on potential +// matches, and if it returns false, the entry will not be matched. +type AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPatternValidation string + +const ( + AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPatternValidationLuhn AccountDlpProfileGetResponseResultDlpCustomProfileEntriesPatternValidation = "luhn" +) + +// The type of the profile. +type AccountDlpProfileGetResponseResultDlpCustomProfileType string + +const ( + AccountDlpProfileGetResponseResultDlpCustomProfileTypeCustom AccountDlpProfileGetResponseResultDlpCustomProfileType = "custom" +) + +type AccountDlpProfileGetResponseResultDlpIntegrationProfile struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the profile. + Description string `json:"description"` + // The entries for this profile. + Entries []AccountDlpProfileGetResponseResultDlpIntegrationProfileEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileGetResponseResultDlpIntegrationProfileType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileGetResponseResultDlpIntegrationProfileJSON `json:"-"` +} + +// accountDlpProfileGetResponseResultDlpIntegrationProfileJSON contains the JSON +// metadata for the struct +// [AccountDlpProfileGetResponseResultDlpIntegrationProfile] +type accountDlpProfileGetResponseResultDlpIntegrationProfileJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseResultDlpIntegrationProfile) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDlpProfileGetResponseResultDlpIntegrationProfile) implementsAccountDlpProfileGetResponseResult() { +} + +// An entry derived from an integration +type AccountDlpProfileGetResponseResultDlpIntegrationProfileEntry struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileGetResponseResultDlpIntegrationProfileEntryJSON `json:"-"` +} + +// accountDlpProfileGetResponseResultDlpIntegrationProfileEntryJSON contains the +// JSON metadata for the struct +// [AccountDlpProfileGetResponseResultDlpIntegrationProfileEntry] +type accountDlpProfileGetResponseResultDlpIntegrationProfileEntryJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + Name apijson.Field + ProfileID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileGetResponseResultDlpIntegrationProfileEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the profile. +type AccountDlpProfileGetResponseResultDlpIntegrationProfileType string + +const ( + AccountDlpProfileGetResponseResultDlpIntegrationProfileTypeIntegration AccountDlpProfileGetResponseResultDlpIntegrationProfileType = "integration" +) + +// Whether the API call was successful +type AccountDlpProfileGetResponseSuccess bool + +const ( + AccountDlpProfileGetResponseSuccessTrue AccountDlpProfileGetResponseSuccess = true +) + +type AccountDlpProfileListResponse struct { + Errors []AccountDlpProfileListResponseError `json:"errors"` + Messages []AccountDlpProfileListResponseMessage `json:"messages"` + Result []AccountDlpProfileListResponseResult `json:"result"` + ResultInfo AccountDlpProfileListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountDlpProfileListResponseSuccess `json:"success"` + JSON accountDlpProfileListResponseJSON `json:"-"` +} + +// accountDlpProfileListResponseJSON contains the JSON metadata for the struct +// [AccountDlpProfileListResponse] +type accountDlpProfileListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileListResponseErrorJSON `json:"-"` +} + +// accountDlpProfileListResponseErrorJSON contains the JSON metadata for the struct +// [AccountDlpProfileListResponseError] +type accountDlpProfileListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileListResponseMessageJSON `json:"-"` +} + +// accountDlpProfileListResponseMessageJSON contains the JSON metadata for the +// struct [AccountDlpProfileListResponseMessage] +type accountDlpProfileListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountDlpProfileListResponseResultDlpPredefinedProfile], +// [AccountDlpProfileListResponseResultDlpCustomProfile] or +// [AccountDlpProfileListResponseResultDlpIntegrationProfile]. +type AccountDlpProfileListResponseResult interface { + implementsAccountDlpProfileListResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountDlpProfileListResponseResult)(nil)).Elem(), "") +} + +type AccountDlpProfileListResponseResultDlpPredefinedProfile struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + // The entries for this profile. + Entries []AccountDlpProfileListResponseResultDlpPredefinedProfileEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileListResponseResultDlpPredefinedProfileType `json:"type"` + JSON accountDlpProfileListResponseResultDlpPredefinedProfileJSON `json:"-"` +} + +// accountDlpProfileListResponseResultDlpPredefinedProfileJSON contains the JSON +// metadata for the struct +// [AccountDlpProfileListResponseResultDlpPredefinedProfile] +type accountDlpProfileListResponseResultDlpPredefinedProfileJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultDlpPredefinedProfile) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDlpProfileListResponseResultDlpPredefinedProfile) implementsAccountDlpProfileListResponseResult() { +} + +// A predefined entry that matches a profile +type AccountDlpProfileListResponseResultDlpPredefinedProfileEntry struct { + // UUID + ID string `json:"id"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + JSON accountDlpProfileListResponseResultDlpPredefinedProfileEntryJSON `json:"-"` +} + +// accountDlpProfileListResponseResultDlpPredefinedProfileEntryJSON contains the +// JSON metadata for the struct +// [AccountDlpProfileListResponseResultDlpPredefinedProfileEntry] +type accountDlpProfileListResponseResultDlpPredefinedProfileEntryJSON struct { + ID apijson.Field + Enabled apijson.Field + Name apijson.Field + ProfileID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultDlpPredefinedProfileEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the profile. +type AccountDlpProfileListResponseResultDlpPredefinedProfileType string + +const ( + AccountDlpProfileListResponseResultDlpPredefinedProfileTypePredefined AccountDlpProfileListResponseResultDlpPredefinedProfileType = "predefined" +) + +type AccountDlpProfileListResponseResultDlpCustomProfile struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the profile. + Description string `json:"description"` + // The entries for this profile. + Entries []AccountDlpProfileListResponseResultDlpCustomProfileEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileListResponseResultDlpCustomProfileType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileListResponseResultDlpCustomProfileJSON `json:"-"` +} + +// accountDlpProfileListResponseResultDlpCustomProfileJSON contains the JSON +// metadata for the struct [AccountDlpProfileListResponseResultDlpCustomProfile] +type accountDlpProfileListResponseResultDlpCustomProfileJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultDlpCustomProfile) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDlpProfileListResponseResultDlpCustomProfile) implementsAccountDlpProfileListResponseResult() { +} + +// A custom entry that matches a profile +type AccountDlpProfileListResponseResultDlpCustomProfileEntry struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // A pattern that matches an entry + Pattern AccountDlpProfileListResponseResultDlpCustomProfileEntriesPattern `json:"pattern"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileListResponseResultDlpCustomProfileEntryJSON `json:"-"` +} + +// accountDlpProfileListResponseResultDlpCustomProfileEntryJSON contains the JSON +// metadata for the struct +// [AccountDlpProfileListResponseResultDlpCustomProfileEntry] +type accountDlpProfileListResponseResultDlpCustomProfileEntryJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + Name apijson.Field + Pattern apijson.Field + ProfileID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultDlpCustomProfileEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A pattern that matches an entry +type AccountDlpProfileListResponseResultDlpCustomProfileEntriesPattern struct { + // The regex pattern. + Regex string `json:"regex,required"` + // Validation algorithm for the pattern. This algorithm will get run on potential + // matches, and if it returns false, the entry will not be matched. + Validation AccountDlpProfileListResponseResultDlpCustomProfileEntriesPatternValidation `json:"validation"` + JSON accountDlpProfileListResponseResultDlpCustomProfileEntriesPatternJSON `json:"-"` +} + +// accountDlpProfileListResponseResultDlpCustomProfileEntriesPatternJSON contains +// the JSON metadata for the struct +// [AccountDlpProfileListResponseResultDlpCustomProfileEntriesPattern] +type accountDlpProfileListResponseResultDlpCustomProfileEntriesPatternJSON struct { + Regex apijson.Field + Validation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultDlpCustomProfileEntriesPattern) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Validation algorithm for the pattern. This algorithm will get run on potential +// matches, and if it returns false, the entry will not be matched. +type AccountDlpProfileListResponseResultDlpCustomProfileEntriesPatternValidation string + +const ( + AccountDlpProfileListResponseResultDlpCustomProfileEntriesPatternValidationLuhn AccountDlpProfileListResponseResultDlpCustomProfileEntriesPatternValidation = "luhn" +) + +// The type of the profile. +type AccountDlpProfileListResponseResultDlpCustomProfileType string + +const ( + AccountDlpProfileListResponseResultDlpCustomProfileTypeCustom AccountDlpProfileListResponseResultDlpCustomProfileType = "custom" +) + +type AccountDlpProfileListResponseResultDlpIntegrationProfile struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the profile. + Description string `json:"description"` + // The entries for this profile. + Entries []AccountDlpProfileListResponseResultDlpIntegrationProfileEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileListResponseResultDlpIntegrationProfileType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileListResponseResultDlpIntegrationProfileJSON `json:"-"` +} + +// accountDlpProfileListResponseResultDlpIntegrationProfileJSON contains the JSON +// metadata for the struct +// [AccountDlpProfileListResponseResultDlpIntegrationProfile] +type accountDlpProfileListResponseResultDlpIntegrationProfileJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultDlpIntegrationProfile) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountDlpProfileListResponseResultDlpIntegrationProfile) implementsAccountDlpProfileListResponseResult() { +} + +// An entry derived from an integration +type AccountDlpProfileListResponseResultDlpIntegrationProfileEntry struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileListResponseResultDlpIntegrationProfileEntryJSON `json:"-"` +} + +// accountDlpProfileListResponseResultDlpIntegrationProfileEntryJSON contains the +// JSON metadata for the struct +// [AccountDlpProfileListResponseResultDlpIntegrationProfileEntry] +type accountDlpProfileListResponseResultDlpIntegrationProfileEntryJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + Name apijson.Field + ProfileID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultDlpIntegrationProfileEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the profile. +type AccountDlpProfileListResponseResultDlpIntegrationProfileType string + +const ( + AccountDlpProfileListResponseResultDlpIntegrationProfileTypeIntegration AccountDlpProfileListResponseResultDlpIntegrationProfileType = "integration" +) + +type AccountDlpProfileListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDlpProfileListResponseResultInfoJSON `json:"-"` +} + +// accountDlpProfileListResponseResultInfoJSON contains the JSON metadata for the +// struct [AccountDlpProfileListResponseResultInfo] +type accountDlpProfileListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDlpProfileListResponseSuccess bool + +const ( + AccountDlpProfileListResponseSuccessTrue AccountDlpProfileListResponseSuccess = true +) diff --git a/accountdlpprofile_test.go b/accountdlpprofile_test.go new file mode 100644 index 00000000000..424921ffeb4 --- /dev/null +++ b/accountdlpprofile_test.go @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDlpProfileGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDlpProfileList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.List(context.TODO(), "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/accountdlpprofilecustom.go b/accountdlpprofilecustom.go new file mode 100644 index 00000000000..6a2a6036c47 --- /dev/null +++ b/accountdlpprofilecustom.go @@ -0,0 +1,809 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountDlpProfileCustomService 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 +// [NewAccountDlpProfileCustomService] method instead. +type AccountDlpProfileCustomService struct { + Options []option.RequestOption +} + +// NewAccountDlpProfileCustomService 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 NewAccountDlpProfileCustomService(opts ...option.RequestOption) (r *AccountDlpProfileCustomService) { + r = &AccountDlpProfileCustomService{} + r.Options = opts + return +} + +// Fetches a custom DLP profile. +func (r *AccountDlpProfileCustomService) Get(ctx context.Context, accountIdentifier string, profileID string, opts ...option.RequestOption) (res *AccountDlpProfileCustomGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles/custom/%s", accountIdentifier, profileID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a DLP custom profile. +func (r *AccountDlpProfileCustomService) Update(ctx context.Context, accountIdentifier string, profileID string, body AccountDlpProfileCustomUpdateParams, opts ...option.RequestOption) (res *AccountDlpProfileCustomUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles/custom/%s", accountIdentifier, profileID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a DLP custom profile. +func (r *AccountDlpProfileCustomService) Delete(ctx context.Context, accountIdentifier string, profileID string, opts ...option.RequestOption) (res *AccountDlpProfileCustomDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles/custom/%s", accountIdentifier, profileID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a set of DLP custom profiles. +func (r *AccountDlpProfileCustomService) DlpProfilesNewCustomProfiles(ctx context.Context, accountIdentifier string, body AccountDlpProfileCustomDlpProfilesNewCustomProfilesParams, opts ...option.RequestOption) (res *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles/custom", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountDlpProfileCustomGetResponse struct { + Errors []AccountDlpProfileCustomGetResponseError `json:"errors"` + Messages []AccountDlpProfileCustomGetResponseMessage `json:"messages"` + Result AccountDlpProfileCustomGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDlpProfileCustomGetResponseSuccess `json:"success"` + JSON accountDlpProfileCustomGetResponseJSON `json:"-"` +} + +// accountDlpProfileCustomGetResponseJSON contains the JSON metadata for the struct +// [AccountDlpProfileCustomGetResponse] +type accountDlpProfileCustomGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileCustomGetResponseErrorJSON `json:"-"` +} + +// accountDlpProfileCustomGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountDlpProfileCustomGetResponseError] +type accountDlpProfileCustomGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileCustomGetResponseMessageJSON `json:"-"` +} + +// accountDlpProfileCustomGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDlpProfileCustomGetResponseMessage] +type accountDlpProfileCustomGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomGetResponseResult struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the profile. + Description string `json:"description"` + // The entries for this profile. + Entries []AccountDlpProfileCustomGetResponseResultEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileCustomGetResponseResultType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileCustomGetResponseResultJSON `json:"-"` +} + +// accountDlpProfileCustomGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDlpProfileCustomGetResponseResult] +type accountDlpProfileCustomGetResponseResultJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A custom entry that matches a profile +type AccountDlpProfileCustomGetResponseResultEntry struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // A pattern that matches an entry + Pattern AccountDlpProfileCustomGetResponseResultEntriesPattern `json:"pattern"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileCustomGetResponseResultEntryJSON `json:"-"` +} + +// accountDlpProfileCustomGetResponseResultEntryJSON contains the JSON metadata for +// the struct [AccountDlpProfileCustomGetResponseResultEntry] +type accountDlpProfileCustomGetResponseResultEntryJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + Name apijson.Field + Pattern apijson.Field + ProfileID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomGetResponseResultEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A pattern that matches an entry +type AccountDlpProfileCustomGetResponseResultEntriesPattern struct { + // The regex pattern. + Regex string `json:"regex,required"` + // Validation algorithm for the pattern. This algorithm will get run on potential + // matches, and if it returns false, the entry will not be matched. + Validation AccountDlpProfileCustomGetResponseResultEntriesPatternValidation `json:"validation"` + JSON accountDlpProfileCustomGetResponseResultEntriesPatternJSON `json:"-"` +} + +// accountDlpProfileCustomGetResponseResultEntriesPatternJSON contains the JSON +// metadata for the struct [AccountDlpProfileCustomGetResponseResultEntriesPattern] +type accountDlpProfileCustomGetResponseResultEntriesPatternJSON struct { + Regex apijson.Field + Validation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomGetResponseResultEntriesPattern) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Validation algorithm for the pattern. This algorithm will get run on potential +// matches, and if it returns false, the entry will not be matched. +type AccountDlpProfileCustomGetResponseResultEntriesPatternValidation string + +const ( + AccountDlpProfileCustomGetResponseResultEntriesPatternValidationLuhn AccountDlpProfileCustomGetResponseResultEntriesPatternValidation = "luhn" +) + +// The type of the profile. +type AccountDlpProfileCustomGetResponseResultType string + +const ( + AccountDlpProfileCustomGetResponseResultTypeCustom AccountDlpProfileCustomGetResponseResultType = "custom" +) + +// Whether the API call was successful +type AccountDlpProfileCustomGetResponseSuccess bool + +const ( + AccountDlpProfileCustomGetResponseSuccessTrue AccountDlpProfileCustomGetResponseSuccess = true +) + +type AccountDlpProfileCustomUpdateResponse struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the profile. + Description string `json:"description"` + // The entries for this profile. + Entries []AccountDlpProfileCustomUpdateResponseEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileCustomUpdateResponseType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileCustomUpdateResponseJSON `json:"-"` +} + +// accountDlpProfileCustomUpdateResponseJSON contains the JSON metadata for the +// struct [AccountDlpProfileCustomUpdateResponse] +type accountDlpProfileCustomUpdateResponseJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A custom entry that matches a profile +type AccountDlpProfileCustomUpdateResponseEntry struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // A pattern that matches an entry + Pattern AccountDlpProfileCustomUpdateResponseEntriesPattern `json:"pattern"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileCustomUpdateResponseEntryJSON `json:"-"` +} + +// accountDlpProfileCustomUpdateResponseEntryJSON contains the JSON metadata for +// the struct [AccountDlpProfileCustomUpdateResponseEntry] +type accountDlpProfileCustomUpdateResponseEntryJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + Name apijson.Field + Pattern apijson.Field + ProfileID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomUpdateResponseEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A pattern that matches an entry +type AccountDlpProfileCustomUpdateResponseEntriesPattern struct { + // The regex pattern. + Regex string `json:"regex,required"` + // Validation algorithm for the pattern. This algorithm will get run on potential + // matches, and if it returns false, the entry will not be matched. + Validation AccountDlpProfileCustomUpdateResponseEntriesPatternValidation `json:"validation"` + JSON accountDlpProfileCustomUpdateResponseEntriesPatternJSON `json:"-"` +} + +// accountDlpProfileCustomUpdateResponseEntriesPatternJSON contains the JSON +// metadata for the struct [AccountDlpProfileCustomUpdateResponseEntriesPattern] +type accountDlpProfileCustomUpdateResponseEntriesPatternJSON struct { + Regex apijson.Field + Validation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomUpdateResponseEntriesPattern) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Validation algorithm for the pattern. This algorithm will get run on potential +// matches, and if it returns false, the entry will not be matched. +type AccountDlpProfileCustomUpdateResponseEntriesPatternValidation string + +const ( + AccountDlpProfileCustomUpdateResponseEntriesPatternValidationLuhn AccountDlpProfileCustomUpdateResponseEntriesPatternValidation = "luhn" +) + +// The type of the profile. +type AccountDlpProfileCustomUpdateResponseType string + +const ( + AccountDlpProfileCustomUpdateResponseTypeCustom AccountDlpProfileCustomUpdateResponseType = "custom" +) + +type AccountDlpProfileCustomDeleteResponse struct { + Errors []AccountDlpProfileCustomDeleteResponseError `json:"errors"` + Messages []AccountDlpProfileCustomDeleteResponseMessage `json:"messages"` + Result AccountDlpProfileCustomDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDlpProfileCustomDeleteResponseSuccess `json:"success"` + JSON accountDlpProfileCustomDeleteResponseJSON `json:"-"` +} + +// accountDlpProfileCustomDeleteResponseJSON contains the JSON metadata for the +// struct [AccountDlpProfileCustomDeleteResponse] +type accountDlpProfileCustomDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileCustomDeleteResponseErrorJSON `json:"-"` +} + +// accountDlpProfileCustomDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountDlpProfileCustomDeleteResponseError] +type accountDlpProfileCustomDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileCustomDeleteResponseMessageJSON `json:"-"` +} + +// accountDlpProfileCustomDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountDlpProfileCustomDeleteResponseMessage] +type accountDlpProfileCustomDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountDlpProfileCustomDeleteResponseResultUnknown] or +// [shared.UnionString]. +type AccountDlpProfileCustomDeleteResponseResult interface { + ImplementsAccountDlpProfileCustomDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDlpProfileCustomDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountDlpProfileCustomDeleteResponseSuccess bool + +const ( + AccountDlpProfileCustomDeleteResponseSuccessTrue AccountDlpProfileCustomDeleteResponseSuccess = true +) + +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponse struct { + Errors []AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseError `json:"errors"` + Messages []AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseMessage `json:"messages"` + Result []AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResult `json:"result"` + ResultInfo AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseSuccess `json:"success"` + JSON accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseJSON `json:"-"` +} + +// accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseJSON contains the +// JSON metadata for the struct +// [AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponse] +type accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseErrorJSON `json:"-"` +} + +// accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseError] +type accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseMessageJSON `json:"-"` +} + +// accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseMessage] +type accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResult struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the profile. + Description string `json:"description"` + // The entries for this profile. + Entries []AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultJSON `json:"-"` +} + +// accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultJSON contains +// the JSON metadata for the struct +// [AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResult] +type accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A custom entry that matches a profile +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntry struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // A pattern that matches an entry + Pattern AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPattern `json:"pattern"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntryJSON `json:"-"` +} + +// accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntryJSON +// contains the JSON metadata for the struct +// [AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntry] +type accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntryJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + Name apijson.Field + Pattern apijson.Field + ProfileID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A pattern that matches an entry +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPattern struct { + // The regex pattern. + Regex string `json:"regex,required"` + // Validation algorithm for the pattern. This algorithm will get run on potential + // matches, and if it returns false, the entry will not be matched. + Validation AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPatternValidation `json:"validation"` + JSON accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPatternJSON `json:"-"` +} + +// accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPatternJSON +// contains the JSON metadata for the struct +// [AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPattern] +type accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPatternJSON struct { + Regex apijson.Field + Validation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPattern) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Validation algorithm for the pattern. This algorithm will get run on potential +// matches, and if it returns false, the entry will not be matched. +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPatternValidation string + +const ( + AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPatternValidationLuhn AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultEntriesPatternValidation = "luhn" +) + +// The type of the profile. +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultType string + +const ( + AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultTypeCustom AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultType = "custom" +) + +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultInfoJSON `json:"-"` +} + +// accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultInfo] +type accountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseSuccess bool + +const ( + AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseSuccessTrue AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponseSuccess = true +) + +type AccountDlpProfileCustomUpdateParams struct { + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount param.Field[float64] `json:"allowed_match_count"` + // The description of the profile. + Description param.Field[string] `json:"description"` + // The custom entries for this profile. Array elements with IDs are modifying the + // existing entry with that ID. Elements without ID will create new entries. Any + // entry not in the list will be deleted. + Entries param.Field[[]AccountDlpProfileCustomUpdateParamsEntry] `json:"entries"` + // The name of the profile. + Name param.Field[string] `json:"name"` + // Entries from other profiles (e.g. pre-defined Cloudflare profiles, or your + // Microsoft Information Protection profiles). + SharedEntries param.Field[[]AccountDlpProfileCustomUpdateParamsSharedEntry] `json:"shared_entries"` +} + +func (r AccountDlpProfileCustomUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A custom entry that matches a profile +type AccountDlpProfileCustomUpdateParamsEntry struct { + // Whether the entry is enabled or not. + Enabled param.Field[bool] `json:"enabled"` + // The name of the entry. + Name param.Field[string] `json:"name"` + // A pattern that matches an entry + Pattern param.Field[AccountDlpProfileCustomUpdateParamsEntriesPattern] `json:"pattern"` + // ID of the parent profile + ProfileID param.Field[interface{}] `json:"profile_id"` +} + +func (r AccountDlpProfileCustomUpdateParamsEntry) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A pattern that matches an entry +type AccountDlpProfileCustomUpdateParamsEntriesPattern struct { + // The regex pattern. + Regex param.Field[string] `json:"regex,required"` + // Validation algorithm for the pattern. This algorithm will get run on potential + // matches, and if it returns false, the entry will not be matched. + Validation param.Field[AccountDlpProfileCustomUpdateParamsEntriesPatternValidation] `json:"validation"` +} + +func (r AccountDlpProfileCustomUpdateParamsEntriesPattern) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Validation algorithm for the pattern. This algorithm will get run on potential +// matches, and if it returns false, the entry will not be matched. +type AccountDlpProfileCustomUpdateParamsEntriesPatternValidation string + +const ( + AccountDlpProfileCustomUpdateParamsEntriesPatternValidationLuhn AccountDlpProfileCustomUpdateParamsEntriesPatternValidation = "luhn" +) + +// Properties of a predefined entry in a custom profile +// +// Satisfied by +// [AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined], +// [AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdateIntegration]. +type AccountDlpProfileCustomUpdateParamsSharedEntry interface { + implementsAccountDlpProfileCustomUpdateParamsSharedEntry() +} + +// Properties of a predefined entry in a custom profile +type AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined struct { + // Whether the entry is enabled or not. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined) implementsAccountDlpProfileCustomUpdateParamsSharedEntry() { +} + +// Properties of an integration entry in a custom profile +type AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdateIntegration struct { + // Whether the entry is enabled or not. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdateIntegration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdateIntegration) implementsAccountDlpProfileCustomUpdateParamsSharedEntry() { +} + +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesParams struct { + Profiles param.Field[[]AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfile] `json:"profiles,required"` +} + +func (r AccountDlpProfileCustomDlpProfilesNewCustomProfilesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfile struct { + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount param.Field[float64] `json:"allowed_match_count"` + // The description of the profile. + Description param.Field[string] `json:"description"` + // The entries for this profile. + Entries param.Field[[]AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntry] `json:"entries"` + // The name of the profile. + Name param.Field[string] `json:"name"` +} + +func (r AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfile) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A custom entry create payload +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntry struct { + // Whether the entry is enabled or not. + Enabled param.Field[bool] `json:"enabled,required"` + // The name of the entry. + Name param.Field[string] `json:"name,required"` + // A pattern that matches an entry + Pattern param.Field[AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern] `json:"pattern,required"` +} + +func (r AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntry) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A pattern that matches an entry +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern struct { + // The regex pattern. + Regex param.Field[string] `json:"regex,required"` + // Validation algorithm for the pattern. This algorithm will get run on potential + // matches, and if it returns false, the entry will not be matched. + Validation param.Field[AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidation] `json:"validation"` +} + +func (r AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Validation algorithm for the pattern. This algorithm will get run on potential +// matches, and if it returns false, the entry will not be matched. +type AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidation string + +const ( + AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidation = "luhn" +) diff --git a/accountdlpprofilecustom_test.go b/accountdlpprofilecustom_test.go new file mode 100644 index 00000000000..e9c5189891f --- /dev/null +++ b/accountdlpprofilecustom_test.go @@ -0,0 +1,251 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDlpProfileCustomGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.Customs.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDlpProfileCustomUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.Customs.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDlpProfileCustomUpdateParams{ + AllowedMatchCount: cloudflare.F(5.000000), + Description: cloudflare.F("A standard CVV card number"), + Entries: cloudflare.F([]cloudflare.AccountDlpProfileCustomUpdateParamsEntry{{ + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomUpdateParamsEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomUpdateParamsEntriesPatternValidationLuhn), + }), + ProfileID: cloudflare.F[any](map[string]interface{}{}), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomUpdateParamsEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomUpdateParamsEntriesPatternValidationLuhn), + }), + ProfileID: cloudflare.F[any](map[string]interface{}{}), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomUpdateParamsEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomUpdateParamsEntriesPatternValidationLuhn), + }), + ProfileID: cloudflare.F[any](map[string]interface{}{}), + }}), + Name: cloudflare.F("Generic CVV Card Number"), + SharedEntries: cloudflare.F([]cloudflare.AccountDlpProfileCustomUpdateParamsSharedEntry{cloudflare.AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined(cloudflare.AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined{ + Enabled: cloudflare.F(true), + }), cloudflare.AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined(cloudflare.AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined{ + Enabled: cloudflare.F(true), + }), cloudflare.AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined(cloudflare.AccountDlpProfileCustomUpdateParamsSharedEntriesDlpSharedEntryUpdatePredefined{ + Enabled: cloudflare.F(true), + })}), + }, + ) + 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 TestAccountDlpProfileCustomDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.Customs.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDlpProfileCustomDlpProfilesNewCustomProfiles(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.Customs.DlpProfilesNewCustomProfiles( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParams{ + Profiles: cloudflare.F([]cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfile{{ + AllowedMatchCount: cloudflare.F(5.000000), + Description: cloudflare.F("A standard CVV card number"), + Entries: cloudflare.F([]cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntry{{ + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }}), + Name: cloudflare.F("Generic CVV Card Number"), + }, { + AllowedMatchCount: cloudflare.F(5.000000), + Description: cloudflare.F("A standard CVV card number"), + Entries: cloudflare.F([]cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntry{{ + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }}), + Name: cloudflare.F("Generic CVV Card Number"), + }, { + AllowedMatchCount: cloudflare.F(5.000000), + Description: cloudflare.F("A standard CVV card number"), + Entries: cloudflare.F([]cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntry{{ + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }, { + Enabled: cloudflare.F(true), + Name: cloudflare.F("Credit card (Visa)"), + Pattern: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPattern{ + Regex: cloudflare.F("^4[0-9]{6,14}$"), + Validation: cloudflare.F(cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParamsProfilesEntriesPatternValidationLuhn), + }), + }}), + Name: cloudflare.F("Generic CVV Card Number"), + }}), + }, + ) + 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/accountdlpprofilepredefined.go b/accountdlpprofilepredefined.go new file mode 100644 index 00000000000..4b5675dab85 --- /dev/null +++ b/accountdlpprofilepredefined.go @@ -0,0 +1,267 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDlpProfilePredefinedService 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 +// [NewAccountDlpProfilePredefinedService] method instead. +type AccountDlpProfilePredefinedService struct { + Options []option.RequestOption +} + +// NewAccountDlpProfilePredefinedService 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 NewAccountDlpProfilePredefinedService(opts ...option.RequestOption) (r *AccountDlpProfilePredefinedService) { + r = &AccountDlpProfilePredefinedService{} + r.Options = opts + return +} + +// Fetches a predefined DLP profile. +func (r *AccountDlpProfilePredefinedService) Get(ctx context.Context, accountIdentifier string, profileID string, opts ...option.RequestOption) (res *AccountDlpProfilePredefinedGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles/predefined/%s", accountIdentifier, profileID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a DLP predefined profile. Only supports enabling/disabling entries. +func (r *AccountDlpProfilePredefinedService) Update(ctx context.Context, accountIdentifier string, profileID string, body AccountDlpProfilePredefinedUpdateParams, opts ...option.RequestOption) (res *AccountDlpProfilePredefinedUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dlp/profiles/predefined/%s", accountIdentifier, profileID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountDlpProfilePredefinedGetResponse struct { + Errors []AccountDlpProfilePredefinedGetResponseError `json:"errors"` + Messages []AccountDlpProfilePredefinedGetResponseMessage `json:"messages"` + Result AccountDlpProfilePredefinedGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDlpProfilePredefinedGetResponseSuccess `json:"success"` + JSON accountDlpProfilePredefinedGetResponseJSON `json:"-"` +} + +// accountDlpProfilePredefinedGetResponseJSON contains the JSON metadata for the +// struct [AccountDlpProfilePredefinedGetResponse] +type accountDlpProfilePredefinedGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfilePredefinedGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfilePredefinedGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfilePredefinedGetResponseErrorJSON `json:"-"` +} + +// accountDlpProfilePredefinedGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountDlpProfilePredefinedGetResponseError] +type accountDlpProfilePredefinedGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfilePredefinedGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfilePredefinedGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDlpProfilePredefinedGetResponseMessageJSON `json:"-"` +} + +// accountDlpProfilePredefinedGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountDlpProfilePredefinedGetResponseMessage] +type accountDlpProfilePredefinedGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfilePredefinedGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDlpProfilePredefinedGetResponseResult struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + // The entries for this profile. + Entries []AccountDlpProfilePredefinedGetResponseResultEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfilePredefinedGetResponseResultType `json:"type"` + JSON accountDlpProfilePredefinedGetResponseResultJSON `json:"-"` +} + +// accountDlpProfilePredefinedGetResponseResultJSON contains the JSON metadata for +// the struct [AccountDlpProfilePredefinedGetResponseResult] +type accountDlpProfilePredefinedGetResponseResultJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfilePredefinedGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A predefined entry that matches a profile +type AccountDlpProfilePredefinedGetResponseResultEntry struct { + // UUID + ID string `json:"id"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + JSON accountDlpProfilePredefinedGetResponseResultEntryJSON `json:"-"` +} + +// accountDlpProfilePredefinedGetResponseResultEntryJSON contains the JSON metadata +// for the struct [AccountDlpProfilePredefinedGetResponseResultEntry] +type accountDlpProfilePredefinedGetResponseResultEntryJSON struct { + ID apijson.Field + Enabled apijson.Field + Name apijson.Field + ProfileID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfilePredefinedGetResponseResultEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the profile. +type AccountDlpProfilePredefinedGetResponseResultType string + +const ( + AccountDlpProfilePredefinedGetResponseResultTypePredefined AccountDlpProfilePredefinedGetResponseResultType = "predefined" +) + +// Whether the API call was successful +type AccountDlpProfilePredefinedGetResponseSuccess bool + +const ( + AccountDlpProfilePredefinedGetResponseSuccessTrue AccountDlpProfilePredefinedGetResponseSuccess = true +) + +type AccountDlpProfilePredefinedUpdateResponse struct { + // UUID + ID string `json:"id"` + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount float64 `json:"allowed_match_count"` + // The entries for this profile. + Entries []AccountDlpProfilePredefinedUpdateResponseEntry `json:"entries"` + // The name of the profile. + Name string `json:"name"` + // The type of the profile. + Type AccountDlpProfilePredefinedUpdateResponseType `json:"type"` + JSON accountDlpProfilePredefinedUpdateResponseJSON `json:"-"` +} + +// accountDlpProfilePredefinedUpdateResponseJSON contains the JSON metadata for the +// struct [AccountDlpProfilePredefinedUpdateResponse] +type accountDlpProfilePredefinedUpdateResponseJSON struct { + ID apijson.Field + AllowedMatchCount apijson.Field + Entries apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfilePredefinedUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A predefined entry that matches a profile +type AccountDlpProfilePredefinedUpdateResponseEntry struct { + // UUID + ID string `json:"id"` + // Whether the entry is enabled or not. + Enabled bool `json:"enabled"` + // The name of the entry. + Name string `json:"name"` + // ID of the parent profile + ProfileID interface{} `json:"profile_id"` + JSON accountDlpProfilePredefinedUpdateResponseEntryJSON `json:"-"` +} + +// accountDlpProfilePredefinedUpdateResponseEntryJSON contains the JSON metadata +// for the struct [AccountDlpProfilePredefinedUpdateResponseEntry] +type accountDlpProfilePredefinedUpdateResponseEntryJSON struct { + ID apijson.Field + Enabled apijson.Field + Name apijson.Field + ProfileID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDlpProfilePredefinedUpdateResponseEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the profile. +type AccountDlpProfilePredefinedUpdateResponseType string + +const ( + AccountDlpProfilePredefinedUpdateResponseTypePredefined AccountDlpProfilePredefinedUpdateResponseType = "predefined" +) + +type AccountDlpProfilePredefinedUpdateParams struct { + // Related DLP policies will trigger when the match count exceeds the number set. + AllowedMatchCount param.Field[float64] `json:"allowed_match_count"` + // The entries for this profile. + Entries param.Field[[]AccountDlpProfilePredefinedUpdateParamsEntry] `json:"entries"` +} + +func (r AccountDlpProfilePredefinedUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDlpProfilePredefinedUpdateParamsEntry struct { + // Whether the entry is enabled or not. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountDlpProfilePredefinedUpdateParamsEntry) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountdlpprofilepredefined_test.go b/accountdlpprofilepredefined_test.go new file mode 100644 index 00000000000..6cc530e8879 --- /dev/null +++ b/accountdlpprofilepredefined_test.go @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDlpProfilePredefinedGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.Predefineds.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountDlpProfilePredefinedUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Dlp.Profiles.Predefineds.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountDlpProfilePredefinedUpdateParams{ + AllowedMatchCount: cloudflare.F(5.000000), + Entries: cloudflare.F([]cloudflare.AccountDlpProfilePredefinedUpdateParamsEntry{{ + Enabled: cloudflare.F(true), + }, { + Enabled: cloudflare.F(true), + }, { + Enabled: cloudflare.F(true), + }}), + }, + ) + 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/accountdnsfirewall.go b/accountdnsfirewall.go new file mode 100644 index 00000000000..5742237203b --- /dev/null +++ b/accountdnsfirewall.go @@ -0,0 +1,1044 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountDNSFirewallService 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 [NewAccountDNSFirewallService] method +// instead. +type AccountDNSFirewallService struct { + Options []option.RequestOption + DNSAnalytics *AccountDNSFirewallDNSAnalyticService +} + +// NewAccountDNSFirewallService 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 NewAccountDNSFirewallService(opts ...option.RequestOption) (r *AccountDNSFirewallService) { + r = &AccountDNSFirewallService{} + r.Options = opts + r.DNSAnalytics = NewAccountDNSFirewallDNSAnalyticService(opts...) + return +} + +// Show a single configured DNS Firewall cluster for an account. +func (r *AccountDNSFirewallService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountDNSFirewallGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dns_firewall/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify a DNS Firewall Cluster configuration. +func (r *AccountDNSFirewallService) Update(ctx context.Context, accountIdentifier string, identifier string, body AccountDNSFirewallUpdateParams, opts ...option.RequestOption) (res *AccountDNSFirewallUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dns_firewall/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete a configured DNS Firewall Cluster. +func (r *AccountDNSFirewallService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountDNSFirewallDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dns_firewall/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a configured DNS Firewall Cluster. +func (r *AccountDNSFirewallService) DNSFirewallNewDNSFirewallCluster(ctx context.Context, accountIdentifier string, body AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParams, opts ...option.RequestOption) (res *AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dns_firewall", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List configured DNS Firewall clusters for an account. +func (r *AccountDNSFirewallService) DNSFirewallListDNSFirewallClusters(ctx context.Context, accountIdentifier string, query AccountDNSFirewallDNSFirewallListDNSFirewallClustersParams, opts ...option.RequestOption) (res *shared.Page[AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/dns_firewall", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountDNSFirewallGetResponse struct { + Errors []AccountDNSFirewallGetResponseError `json:"errors"` + Messages []AccountDNSFirewallGetResponseMessage `json:"messages"` + Result AccountDNSFirewallGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDNSFirewallGetResponseSuccess `json:"success"` + JSON accountDNSFirewallGetResponseJSON `json:"-"` +} + +// accountDNSFirewallGetResponseJSON contains the JSON metadata for the struct +// [AccountDNSFirewallGetResponse] +type accountDNSFirewallGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallGetResponseErrorJSON `json:"-"` +} + +// accountDNSFirewallGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountDNSFirewallGetResponseError] +type accountDNSFirewallGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallGetResponseMessageJSON `json:"-"` +} + +// accountDNSFirewallGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountDNSFirewallGetResponseMessage] +type accountDNSFirewallGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallGetResponseResult struct { + // Identifier + ID string `json:"id,required"` + // Deprecate the response to ANY requests. + DeprecateAnyRequests bool `json:"deprecate_any_requests,required"` + DNSFirewallIPs []AccountDNSFirewallGetResponseResultDNSFirewallIP `json:"dns_firewall_ips,required" format:"ipv4"` + // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. + EcsFallback bool `json:"ecs_fallback,required"` + // Maximum DNS Cache TTL. + MaximumCacheTtl float64 `json:"maximum_cache_ttl,required"` + // Minimum DNS Cache TTL. + MinimumCacheTtl float64 `json:"minimum_cache_ttl,required"` + // Last modification of DNS Firewall cluster. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // DNS Firewall Cluster Name. + Name string `json:"name,required"` + UpstreamIPs []AccountDNSFirewallGetResponseResultUpstreamIP `json:"upstream_ips,required" format:"ipv4"` + // Attack mitigation settings. + AttackMitigation AccountDNSFirewallGetResponseResultAttackMitigation `json:"attack_mitigation,nullable"` + // Negative DNS Cache TTL. + NegativeCacheTtl float64 `json:"negative_cache_ttl,nullable"` + // Deprecated alias for "upstream_ips". + OriginIPs interface{} `json:"origin_ips"` + // Ratelimit in queries per second per datacenter (applies to DNS queries sent to + // the upstream nameservers configured on the cluster). + Ratelimit float64 `json:"ratelimit,nullable"` + // Number of retries for fetching DNS responses from upstream nameservers (not + // counting the initial attempt). + Retries float64 `json:"retries"` + JSON accountDNSFirewallGetResponseResultJSON `json:"-"` +} + +// accountDNSFirewallGetResponseResultJSON contains the JSON metadata for the +// struct [AccountDNSFirewallGetResponseResult] +type accountDNSFirewallGetResponseResultJSON struct { + ID apijson.Field + DeprecateAnyRequests apijson.Field + DNSFirewallIPs apijson.Field + EcsFallback apijson.Field + MaximumCacheTtl apijson.Field + MinimumCacheTtl apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + UpstreamIPs apijson.Field + AttackMitigation apijson.Field + NegativeCacheTtl apijson.Field + OriginIPs apijson.Field + Ratelimit apijson.Field + Retries apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Cloudflare-assigned DNS IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallGetResponseResultDNSFirewallIP interface { + ImplementsAccountDNSFirewallGetResponseResultDNSFirewallIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallGetResponseResultDNSFirewallIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Upstream DNS Server IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallGetResponseResultUpstreamIP interface { + ImplementsAccountDNSFirewallGetResponseResultUpstreamIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallGetResponseResultUpstreamIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Attack mitigation settings. +type AccountDNSFirewallGetResponseResultAttackMitigation struct { + // When enabled, random-prefix attacks are automatically mitigated and the upstream + // DNS servers protected. + Enabled bool `json:"enabled"` + // Deprecated alias for "only_when_upstream_unhealthy". + OnlyWhenOriginUnhealthy interface{} `json:"only_when_origin_unhealthy"` + // Only mitigate attacks when upstream servers seem unhealthy. + OnlyWhenUpstreamUnhealthy bool `json:"only_when_upstream_unhealthy"` + JSON accountDNSFirewallGetResponseResultAttackMitigationJSON `json:"-"` +} + +// accountDNSFirewallGetResponseResultAttackMitigationJSON contains the JSON +// metadata for the struct [AccountDNSFirewallGetResponseResultAttackMitigation] +type accountDNSFirewallGetResponseResultAttackMitigationJSON struct { + Enabled apijson.Field + OnlyWhenOriginUnhealthy apijson.Field + OnlyWhenUpstreamUnhealthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallGetResponseResultAttackMitigation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDNSFirewallGetResponseSuccess bool + +const ( + AccountDNSFirewallGetResponseSuccessTrue AccountDNSFirewallGetResponseSuccess = true +) + +type AccountDNSFirewallUpdateResponse struct { + Errors []AccountDNSFirewallUpdateResponseError `json:"errors"` + Messages []AccountDNSFirewallUpdateResponseMessage `json:"messages"` + Result AccountDNSFirewallUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDNSFirewallUpdateResponseSuccess `json:"success"` + JSON accountDNSFirewallUpdateResponseJSON `json:"-"` +} + +// accountDNSFirewallUpdateResponseJSON contains the JSON metadata for the struct +// [AccountDNSFirewallUpdateResponse] +type accountDNSFirewallUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallUpdateResponseErrorJSON `json:"-"` +} + +// accountDNSFirewallUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountDNSFirewallUpdateResponseError] +type accountDNSFirewallUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallUpdateResponseMessageJSON `json:"-"` +} + +// accountDNSFirewallUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountDNSFirewallUpdateResponseMessage] +type accountDNSFirewallUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallUpdateResponseResult struct { + // Identifier + ID string `json:"id,required"` + // Deprecate the response to ANY requests. + DeprecateAnyRequests bool `json:"deprecate_any_requests,required"` + DNSFirewallIPs []AccountDNSFirewallUpdateResponseResultDNSFirewallIP `json:"dns_firewall_ips,required" format:"ipv4"` + // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. + EcsFallback bool `json:"ecs_fallback,required"` + // Maximum DNS Cache TTL. + MaximumCacheTtl float64 `json:"maximum_cache_ttl,required"` + // Minimum DNS Cache TTL. + MinimumCacheTtl float64 `json:"minimum_cache_ttl,required"` + // Last modification of DNS Firewall cluster. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // DNS Firewall Cluster Name. + Name string `json:"name,required"` + UpstreamIPs []AccountDNSFirewallUpdateResponseResultUpstreamIP `json:"upstream_ips,required" format:"ipv4"` + // Attack mitigation settings. + AttackMitigation AccountDNSFirewallUpdateResponseResultAttackMitigation `json:"attack_mitigation,nullable"` + // Negative DNS Cache TTL. + NegativeCacheTtl float64 `json:"negative_cache_ttl,nullable"` + // Deprecated alias for "upstream_ips". + OriginIPs interface{} `json:"origin_ips"` + // Ratelimit in queries per second per datacenter (applies to DNS queries sent to + // the upstream nameservers configured on the cluster). + Ratelimit float64 `json:"ratelimit,nullable"` + // Number of retries for fetching DNS responses from upstream nameservers (not + // counting the initial attempt). + Retries float64 `json:"retries"` + JSON accountDNSFirewallUpdateResponseResultJSON `json:"-"` +} + +// accountDNSFirewallUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountDNSFirewallUpdateResponseResult] +type accountDNSFirewallUpdateResponseResultJSON struct { + ID apijson.Field + DeprecateAnyRequests apijson.Field + DNSFirewallIPs apijson.Field + EcsFallback apijson.Field + MaximumCacheTtl apijson.Field + MinimumCacheTtl apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + UpstreamIPs apijson.Field + AttackMitigation apijson.Field + NegativeCacheTtl apijson.Field + OriginIPs apijson.Field + Ratelimit apijson.Field + Retries apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Cloudflare-assigned DNS IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallUpdateResponseResultDNSFirewallIP interface { + ImplementsAccountDNSFirewallUpdateResponseResultDNSFirewallIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallUpdateResponseResultDNSFirewallIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Upstream DNS Server IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallUpdateResponseResultUpstreamIP interface { + ImplementsAccountDNSFirewallUpdateResponseResultUpstreamIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallUpdateResponseResultUpstreamIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Attack mitigation settings. +type AccountDNSFirewallUpdateResponseResultAttackMitigation struct { + // When enabled, random-prefix attacks are automatically mitigated and the upstream + // DNS servers protected. + Enabled bool `json:"enabled"` + // Deprecated alias for "only_when_upstream_unhealthy". + OnlyWhenOriginUnhealthy interface{} `json:"only_when_origin_unhealthy"` + // Only mitigate attacks when upstream servers seem unhealthy. + OnlyWhenUpstreamUnhealthy bool `json:"only_when_upstream_unhealthy"` + JSON accountDNSFirewallUpdateResponseResultAttackMitigationJSON `json:"-"` +} + +// accountDNSFirewallUpdateResponseResultAttackMitigationJSON contains the JSON +// metadata for the struct [AccountDNSFirewallUpdateResponseResultAttackMitigation] +type accountDNSFirewallUpdateResponseResultAttackMitigationJSON struct { + Enabled apijson.Field + OnlyWhenOriginUnhealthy apijson.Field + OnlyWhenUpstreamUnhealthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallUpdateResponseResultAttackMitigation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDNSFirewallUpdateResponseSuccess bool + +const ( + AccountDNSFirewallUpdateResponseSuccessTrue AccountDNSFirewallUpdateResponseSuccess = true +) + +type AccountDNSFirewallDeleteResponse struct { + Errors []AccountDNSFirewallDeleteResponseError `json:"errors"` + Messages []AccountDNSFirewallDeleteResponseMessage `json:"messages"` + Result AccountDNSFirewallDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDNSFirewallDeleteResponseSuccess `json:"success"` + JSON accountDNSFirewallDeleteResponseJSON `json:"-"` +} + +// accountDNSFirewallDeleteResponseJSON contains the JSON metadata for the struct +// [AccountDNSFirewallDeleteResponse] +type accountDNSFirewallDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDeleteResponseErrorJSON `json:"-"` +} + +// accountDNSFirewallDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountDNSFirewallDeleteResponseError] +type accountDNSFirewallDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDeleteResponseMessageJSON `json:"-"` +} + +// accountDNSFirewallDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountDNSFirewallDeleteResponseMessage] +type accountDNSFirewallDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON accountDNSFirewallDeleteResponseResultJSON `json:"-"` +} + +// accountDNSFirewallDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountDNSFirewallDeleteResponseResult] +type accountDNSFirewallDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDNSFirewallDeleteResponseSuccess bool + +const ( + AccountDNSFirewallDeleteResponseSuccessTrue AccountDNSFirewallDeleteResponseSuccess = true +) + +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponse struct { + Errors []AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseError `json:"errors"` + Messages []AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseMessage `json:"messages"` + Result AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseSuccess `json:"success"` + JSON accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseJSON `json:"-"` +} + +// accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseJSON contains the JSON +// metadata for the struct +// [AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponse] +type accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseErrorJSON `json:"-"` +} + +// accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseError] +type accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseMessageJSON `json:"-"` +} + +// accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseMessage] +type accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResult struct { + // Identifier + ID string `json:"id,required"` + // Deprecate the response to ANY requests. + DeprecateAnyRequests bool `json:"deprecate_any_requests,required"` + DNSFirewallIPs []AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultDNSFirewallIP `json:"dns_firewall_ips,required" format:"ipv4"` + // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. + EcsFallback bool `json:"ecs_fallback,required"` + // Maximum DNS Cache TTL. + MaximumCacheTtl float64 `json:"maximum_cache_ttl,required"` + // Minimum DNS Cache TTL. + MinimumCacheTtl float64 `json:"minimum_cache_ttl,required"` + // Last modification of DNS Firewall cluster. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // DNS Firewall Cluster Name. + Name string `json:"name,required"` + UpstreamIPs []AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultUpstreamIP `json:"upstream_ips,required" format:"ipv4"` + // Attack mitigation settings. + AttackMitigation AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultAttackMitigation `json:"attack_mitigation,nullable"` + // Negative DNS Cache TTL. + NegativeCacheTtl float64 `json:"negative_cache_ttl,nullable"` + // Deprecated alias for "upstream_ips". + OriginIPs interface{} `json:"origin_ips"` + // Ratelimit in queries per second per datacenter (applies to DNS queries sent to + // the upstream nameservers configured on the cluster). + Ratelimit float64 `json:"ratelimit,nullable"` + // Number of retries for fetching DNS responses from upstream nameservers (not + // counting the initial attempt). + Retries float64 `json:"retries"` + JSON accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultJSON `json:"-"` +} + +// accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultJSON contains +// the JSON metadata for the struct +// [AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResult] +type accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultJSON struct { + ID apijson.Field + DeprecateAnyRequests apijson.Field + DNSFirewallIPs apijson.Field + EcsFallback apijson.Field + MaximumCacheTtl apijson.Field + MinimumCacheTtl apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + UpstreamIPs apijson.Field + AttackMitigation apijson.Field + NegativeCacheTtl apijson.Field + OriginIPs apijson.Field + Ratelimit apijson.Field + Retries apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Cloudflare-assigned DNS IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultDNSFirewallIP interface { + ImplementsAccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultDNSFirewallIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultDNSFirewallIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Upstream DNS Server IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultUpstreamIP interface { + ImplementsAccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultUpstreamIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultUpstreamIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Attack mitigation settings. +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultAttackMitigation struct { + // When enabled, random-prefix attacks are automatically mitigated and the upstream + // DNS servers protected. + Enabled bool `json:"enabled"` + // Deprecated alias for "only_when_upstream_unhealthy". + OnlyWhenOriginUnhealthy interface{} `json:"only_when_origin_unhealthy"` + // Only mitigate attacks when upstream servers seem unhealthy. + OnlyWhenUpstreamUnhealthy bool `json:"only_when_upstream_unhealthy"` + JSON accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultAttackMitigationJSON `json:"-"` +} + +// accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultAttackMitigationJSON +// contains the JSON metadata for the struct +// [AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultAttackMitigation] +type accountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultAttackMitigationJSON struct { + Enabled apijson.Field + OnlyWhenOriginUnhealthy apijson.Field + OnlyWhenUpstreamUnhealthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultAttackMitigation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseSuccess bool + +const ( + AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseSuccessTrue AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseSuccess = true +) + +type AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponse struct { + // Identifier + ID string `json:"id,required"` + // Deprecate the response to ANY requests. + DeprecateAnyRequests bool `json:"deprecate_any_requests,required"` + DNSFirewallIPs []AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseDNSFirewallIP `json:"dns_firewall_ips,required" format:"ipv4"` + // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. + EcsFallback bool `json:"ecs_fallback,required"` + // Maximum DNS Cache TTL. + MaximumCacheTtl float64 `json:"maximum_cache_ttl,required"` + // Minimum DNS Cache TTL. + MinimumCacheTtl float64 `json:"minimum_cache_ttl,required"` + // Last modification of DNS Firewall cluster. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // DNS Firewall Cluster Name. + Name string `json:"name,required"` + UpstreamIPs []AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseUpstreamIP `json:"upstream_ips,required" format:"ipv4"` + // Attack mitigation settings. + AttackMitigation AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseAttackMitigation `json:"attack_mitigation,nullable"` + // Negative DNS Cache TTL. + NegativeCacheTtl float64 `json:"negative_cache_ttl,nullable"` + // Deprecated alias for "upstream_ips". + OriginIPs interface{} `json:"origin_ips"` + // Ratelimit in queries per second per datacenter (applies to DNS queries sent to + // the upstream nameservers configured on the cluster). + Ratelimit float64 `json:"ratelimit,nullable"` + // Number of retries for fetching DNS responses from upstream nameservers (not + // counting the initial attempt). + Retries float64 `json:"retries"` + JSON accountDNSFirewallDNSFirewallListDNSFirewallClustersResponseJSON `json:"-"` +} + +// accountDNSFirewallDNSFirewallListDNSFirewallClustersResponseJSON contains the +// JSON metadata for the struct +// [AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponse] +type accountDNSFirewallDNSFirewallListDNSFirewallClustersResponseJSON struct { + ID apijson.Field + DeprecateAnyRequests apijson.Field + DNSFirewallIPs apijson.Field + EcsFallback apijson.Field + MaximumCacheTtl apijson.Field + MinimumCacheTtl apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + UpstreamIPs apijson.Field + AttackMitigation apijson.Field + NegativeCacheTtl apijson.Field + OriginIPs apijson.Field + Ratelimit apijson.Field + Retries apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Cloudflare-assigned DNS IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseDNSFirewallIP interface { + ImplementsAccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseDNSFirewallIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseDNSFirewallIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Upstream DNS Server IPv4 Address. +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseUpstreamIP interface { + ImplementsAccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseUpstreamIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseUpstreamIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Attack mitigation settings. +type AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseAttackMitigation struct { + // When enabled, random-prefix attacks are automatically mitigated and the upstream + // DNS servers protected. + Enabled bool `json:"enabled"` + // Deprecated alias for "only_when_upstream_unhealthy". + OnlyWhenOriginUnhealthy interface{} `json:"only_when_origin_unhealthy"` + // Only mitigate attacks when upstream servers seem unhealthy. + OnlyWhenUpstreamUnhealthy bool `json:"only_when_upstream_unhealthy"` + JSON accountDNSFirewallDNSFirewallListDNSFirewallClustersResponseAttackMitigationJSON `json:"-"` +} + +// accountDNSFirewallDNSFirewallListDNSFirewallClustersResponseAttackMitigationJSON +// contains the JSON metadata for the struct +// [AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseAttackMitigation] +type accountDNSFirewallDNSFirewallListDNSFirewallClustersResponseAttackMitigationJSON struct { + Enabled apijson.Field + OnlyWhenOriginUnhealthy apijson.Field + OnlyWhenUpstreamUnhealthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseAttackMitigation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallUpdateParams struct { + // Deprecate the response to ANY requests. + DeprecateAnyRequests param.Field[bool] `json:"deprecate_any_requests,required"` + DNSFirewallIPs param.Field[[]AccountDNSFirewallUpdateParamsDNSFirewallIP] `json:"dns_firewall_ips,required" format:"ipv4"` + // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. + EcsFallback param.Field[bool] `json:"ecs_fallback,required"` + // Maximum DNS Cache TTL. + MaximumCacheTtl param.Field[float64] `json:"maximum_cache_ttl,required"` + // Minimum DNS Cache TTL. + MinimumCacheTtl param.Field[float64] `json:"minimum_cache_ttl,required"` + // DNS Firewall Cluster Name. + Name param.Field[string] `json:"name,required"` + UpstreamIPs param.Field[[]AccountDNSFirewallUpdateParamsUpstreamIP] `json:"upstream_ips,required" format:"ipv4"` + // Attack mitigation settings. + AttackMitigation param.Field[AccountDNSFirewallUpdateParamsAttackMitigation] `json:"attack_mitigation"` + // Negative DNS Cache TTL. + NegativeCacheTtl param.Field[float64] `json:"negative_cache_ttl"` + // Deprecated alias for "upstream_ips". + OriginIPs param.Field[interface{}] `json:"origin_ips"` + // Ratelimit in queries per second per datacenter (applies to DNS queries sent to + // the upstream nameservers configured on the cluster). + Ratelimit param.Field[float64] `json:"ratelimit"` + // Number of retries for fetching DNS responses from upstream nameservers (not + // counting the initial attempt). + Retries param.Field[float64] `json:"retries"` +} + +func (r AccountDNSFirewallUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Cloudflare-assigned DNS IPv4 Address. +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccountDNSFirewallUpdateParamsDNSFirewallIP interface { + ImplementsAccountDNSFirewallUpdateParamsDNSFirewallIP() +} + +// Upstream DNS Server IPv4 Address. +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccountDNSFirewallUpdateParamsUpstreamIP interface { + ImplementsAccountDNSFirewallUpdateParamsUpstreamIP() +} + +// Attack mitigation settings. +type AccountDNSFirewallUpdateParamsAttackMitigation struct { + // When enabled, random-prefix attacks are automatically mitigated and the upstream + // DNS servers protected. + Enabled param.Field[bool] `json:"enabled"` + // Deprecated alias for "only_when_upstream_unhealthy". + OnlyWhenOriginUnhealthy param.Field[interface{}] `json:"only_when_origin_unhealthy"` + // Only mitigate attacks when upstream servers seem unhealthy. + OnlyWhenUpstreamUnhealthy param.Field[bool] `json:"only_when_upstream_unhealthy"` +} + +func (r AccountDNSFirewallUpdateParamsAttackMitigation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParams struct { + // DNS Firewall Cluster Name. + Name param.Field[string] `json:"name,required"` + UpstreamIPs param.Field[[]AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsUpstreamIP] `json:"upstream_ips,required" format:"ipv4"` + // Attack mitigation settings. + AttackMitigation param.Field[AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsAttackMitigation] `json:"attack_mitigation"` + // Deprecate the response to ANY requests. + DeprecateAnyRequests param.Field[bool] `json:"deprecate_any_requests"` + // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. + EcsFallback param.Field[bool] `json:"ecs_fallback"` + // Maximum DNS Cache TTL. + MaximumCacheTtl param.Field[float64] `json:"maximum_cache_ttl"` + // Minimum DNS Cache TTL. + MinimumCacheTtl param.Field[float64] `json:"minimum_cache_ttl"` + // Negative DNS Cache TTL. + NegativeCacheTtl param.Field[float64] `json:"negative_cache_ttl"` + // Deprecated alias for "upstream_ips". + OriginIPs param.Field[interface{}] `json:"origin_ips"` + // Ratelimit in queries per second per datacenter (applies to DNS queries sent to + // the upstream nameservers configured on the cluster). + Ratelimit param.Field[float64] `json:"ratelimit"` + // Number of retries for fetching DNS responses from upstream nameservers (not + // counting the initial attempt). + Retries param.Field[float64] `json:"retries"` +} + +func (r AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Upstream DNS Server IPv4 Address. +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsUpstreamIP interface { + ImplementsAccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsUpstreamIP() +} + +// Attack mitigation settings. +type AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsAttackMitigation struct { + // When enabled, random-prefix attacks are automatically mitigated and the upstream + // DNS servers protected. + Enabled param.Field[bool] `json:"enabled"` + // Deprecated alias for "only_when_upstream_unhealthy". + OnlyWhenOriginUnhealthy param.Field[interface{}] `json:"only_when_origin_unhealthy"` + // Only mitigate attacks when upstream servers seem unhealthy. + OnlyWhenUpstreamUnhealthy param.Field[bool] `json:"only_when_upstream_unhealthy"` +} + +func (r AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsAttackMitigation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountDNSFirewallDNSFirewallListDNSFirewallClustersParams struct { + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of clusters per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [AccountDNSFirewallDNSFirewallListDNSFirewallClustersParams]'s query parameters +// as `url.Values`. +func (r AccountDNSFirewallDNSFirewallListDNSFirewallClustersParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdnsfirewall_test.go b/accountdnsfirewall_test.go new file mode 100644 index 00000000000..1ba28eed159 --- /dev/null +++ b/accountdnsfirewall_test.go @@ -0,0 +1,202 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDNSFirewallGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.DNSFirewalls.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountDNSFirewallUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.DNSFirewalls.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDNSFirewallUpdateParams{ + DeprecateAnyRequests: cloudflare.F(true), + DNSFirewallIPs: cloudflare.F([]cloudflare.AccountDNSFirewallUpdateParamsDNSFirewallIP{shared.UnionString("203.0.113.1"), shared.UnionString("203.0.113.254"), shared.UnionString("2001:DB8:AB::CF"), shared.UnionString("2001:DB8:CD::CF")}), + EcsFallback: cloudflare.F(false), + MaximumCacheTtl: cloudflare.F(900.000000), + MinimumCacheTtl: cloudflare.F(60.000000), + Name: cloudflare.F("My Awesome DNS Firewall cluster"), + UpstreamIPs: cloudflare.F([]cloudflare.AccountDNSFirewallUpdateParamsUpstreamIP{shared.UnionString("192.0.2.1"), shared.UnionString("198.51.100.1"), shared.UnionString("2001:DB8:100::CF")}), + AttackMitigation: cloudflare.F(cloudflare.AccountDNSFirewallUpdateParamsAttackMitigation{ + Enabled: cloudflare.F(true), + OnlyWhenOriginUnhealthy: cloudflare.F[any](map[string]interface{}{}), + OnlyWhenUpstreamUnhealthy: cloudflare.F(false), + }), + NegativeCacheTtl: cloudflare.F(900.000000), + OriginIPs: cloudflare.F[any](map[string]interface{}{}), + Ratelimit: cloudflare.F(600.000000), + Retries: cloudflare.F(2.000000), + }, + ) + 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 TestAccountDNSFirewallDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.DNSFirewalls.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountDNSFirewallDNSFirewallNewDNSFirewallClusterWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.DNSFirewalls.DNSFirewallNewDNSFirewallCluster( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParams{ + Name: cloudflare.F("My Awesome DNS Firewall cluster"), + UpstreamIPs: cloudflare.F([]cloudflare.AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsUpstreamIP{shared.UnionString("192.0.2.1"), shared.UnionString("198.51.100.1"), shared.UnionString("2001:DB8:100::CF")}), + AttackMitigation: cloudflare.F(cloudflare.AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsAttackMitigation{ + Enabled: cloudflare.F(true), + OnlyWhenOriginUnhealthy: cloudflare.F[any](map[string]interface{}{}), + OnlyWhenUpstreamUnhealthy: cloudflare.F(false), + }), + DeprecateAnyRequests: cloudflare.F(true), + EcsFallback: cloudflare.F(false), + MaximumCacheTtl: cloudflare.F(900.000000), + MinimumCacheTtl: cloudflare.F(60.000000), + NegativeCacheTtl: cloudflare.F(900.000000), + OriginIPs: cloudflare.F[any](map[string]interface{}{}), + Ratelimit: cloudflare.F(600.000000), + Retries: cloudflare.F(2.000000), + }, + ) + 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 TestAccountDNSFirewallDNSFirewallListDNSFirewallClustersWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.DNSFirewalls.DNSFirewallListDNSFirewallClusters( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDNSFirewallDNSFirewallListDNSFirewallClustersParams{ + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + }, + ) + 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/accountdnsfirewalldnsanalytic.go b/accountdnsfirewalldnsanalytic.go new file mode 100644 index 00000000000..f3ef3b9fefd --- /dev/null +++ b/accountdnsfirewalldnsanalytic.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDNSFirewallDNSAnalyticService 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 +// [NewAccountDNSFirewallDNSAnalyticService] method instead. +type AccountDNSFirewallDNSAnalyticService struct { + Options []option.RequestOption + Reports *AccountDNSFirewallDNSAnalyticReportService +} + +// NewAccountDNSFirewallDNSAnalyticService 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 NewAccountDNSFirewallDNSAnalyticService(opts ...option.RequestOption) (r *AccountDNSFirewallDNSAnalyticService) { + r = &AccountDNSFirewallDNSAnalyticService{} + r.Options = opts + r.Reports = NewAccountDNSFirewallDNSAnalyticReportService(opts...) + return +} diff --git a/accountdnsfirewalldnsanalyticreport.go b/accountdnsfirewalldnsanalyticreport.go new file mode 100644 index 00000000000..887f3d803b6 --- /dev/null +++ b/accountdnsfirewalldnsanalyticreport.go @@ -0,0 +1,241 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDNSFirewallDNSAnalyticReportService 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 +// [NewAccountDNSFirewallDNSAnalyticReportService] method instead. +type AccountDNSFirewallDNSAnalyticReportService struct { + Options []option.RequestOption + Bytimes *AccountDNSFirewallDNSAnalyticReportBytimeService +} + +// NewAccountDNSFirewallDNSAnalyticReportService 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 NewAccountDNSFirewallDNSAnalyticReportService(opts ...option.RequestOption) (r *AccountDNSFirewallDNSAnalyticReportService) { + r = &AccountDNSFirewallDNSAnalyticReportService{} + r.Options = opts + r.Bytimes = NewAccountDNSFirewallDNSAnalyticReportBytimeService(opts...) + return +} + +// Retrieves a list of summarised aggregate metrics over a given time period. +// +// See +// [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) +// for detailed information about the available query parameters. +func (r *AccountDNSFirewallDNSAnalyticReportService) List(ctx context.Context, accountIdentifier string, identifier string, query AccountDNSFirewallDNSAnalyticReportListParams, opts ...option.RequestOption) (res *AccountDNSFirewallDNSAnalyticReportListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dns_firewall/%s/dns_analytics/report", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDNSFirewallDNSAnalyticReportListResponse struct { + Errors []AccountDNSFirewallDNSAnalyticReportListResponseError `json:"errors"` + Messages []AccountDNSFirewallDNSAnalyticReportListResponseMessage `json:"messages"` + Result AccountDNSFirewallDNSAnalyticReportListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDNSFirewallDNSAnalyticReportListResponseSuccess `json:"success"` + JSON accountDNSFirewallDNSAnalyticReportListResponseJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportListResponseJSON contains the JSON metadata +// for the struct [AccountDNSFirewallDNSAnalyticReportListResponse] +type accountDNSFirewallDNSAnalyticReportListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDNSAnalyticReportListResponseErrorJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportListResponseErrorJSON contains the JSON +// metadata for the struct [AccountDNSFirewallDNSAnalyticReportListResponseError] +type accountDNSFirewallDNSAnalyticReportListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDNSAnalyticReportListResponseMessageJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportListResponseMessageJSON contains the JSON +// metadata for the struct [AccountDNSFirewallDNSAnalyticReportListResponseMessage] +type accountDNSFirewallDNSAnalyticReportListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportListResponseResult struct { + Data []AccountDNSFirewallDNSAnalyticReportListResponseResultData `json:"data"` + // Number of seconds between current time and last processed event, in another + // words how many seconds of data could be missing. + DataLag float64 `json:"data_lag"` + // Maximum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Max interface{} `json:"max"` + // Minimum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Min interface{} `json:"min"` + Query AccountDNSFirewallDNSAnalyticReportListResponseResultQuery `json:"query"` + // Total number of rows in the result. + Rows float64 `json:"rows"` + // Total results for metrics across all data (object mapping metric names to + // values). + Totals interface{} `json:"totals"` + JSON accountDNSFirewallDNSAnalyticReportListResponseResultJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportListResponseResultJSON contains the JSON +// metadata for the struct [AccountDNSFirewallDNSAnalyticReportListResponseResult] +type accountDNSFirewallDNSAnalyticReportListResponseResultJSON struct { + Data apijson.Field + DataLag apijson.Field + Max apijson.Field + Min apijson.Field + Query apijson.Field + Rows apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportListResponseResultData struct { + // Array with one item per requested metric. Each item is a single value. + Metrics []float64 `json:"metrics,required"` + JSON accountDNSFirewallDNSAnalyticReportListResponseResultDataJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportListResponseResultDataJSON contains the JSON +// metadata for the struct +// [AccountDNSFirewallDNSAnalyticReportListResponseResultData] +type accountDNSFirewallDNSAnalyticReportListResponseResultDataJSON struct { + Metrics apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportListResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportListResponseResultQuery struct { + // Array of dimension names. + Dimensions []string `json:"dimensions,required"` + // Limit number of returned metrics. + Limit int64 `json:"limit,required"` + // Array of metric names. + Metrics []string `json:"metrics,required"` + // Start date and time of requesting data period in ISO 8601 format. + Since time.Time `json:"since,required" format:"date-time"` + // End date and time of requesting data period in ISO 8601 format. + Until time.Time `json:"until,required" format:"date-time"` + // Segmentation filter in 'attribute operator value' format. + Filters string `json:"filters"` + // Array of dimensions to sort by, where each dimension may be prefixed by - + // (descending) or + (ascending). + Sort []string `json:"sort"` + JSON accountDNSFirewallDNSAnalyticReportListResponseResultQueryJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportListResponseResultQueryJSON contains the JSON +// metadata for the struct +// [AccountDNSFirewallDNSAnalyticReportListResponseResultQuery] +type accountDNSFirewallDNSAnalyticReportListResponseResultQueryJSON struct { + Dimensions apijson.Field + Limit apijson.Field + Metrics apijson.Field + Since apijson.Field + Until apijson.Field + Filters apijson.Field + Sort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportListResponseResultQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountDNSFirewallDNSAnalyticReportListResponseSuccess bool + +const ( + AccountDNSFirewallDNSAnalyticReportListResponseSuccessTrue AccountDNSFirewallDNSAnalyticReportListResponseSuccess = true +) + +type AccountDNSFirewallDNSAnalyticReportListParams struct { + // A comma-separated list of dimensions to group results by. + Dimensions param.Field[string] `query:"dimensions"` + // Segmentation filter in 'attribute operator value' format. + Filters param.Field[string] `query:"filters"` + // Limit number of returned metrics. + Limit param.Field[int64] `query:"limit"` + // A comma-separated list of metrics to query. + Metrics param.Field[string] `query:"metrics"` + // Start date and time of requesting data period in ISO 8601 format. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // A comma-separated list of dimensions to sort by, where each dimension may be + // prefixed by - (descending) or + (ascending). + Sort param.Field[string] `query:"sort"` + // End date and time of requesting data period in ISO 8601 format. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes [AccountDNSFirewallDNSAnalyticReportListParams]'s query +// parameters as `url.Values`. +func (r AccountDNSFirewallDNSAnalyticReportListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountdnsfirewalldnsanalyticreport_test.go b/accountdnsfirewalldnsanalyticreport_test.go new file mode 100644 index 00000000000..0a2717dc19a --- /dev/null +++ b/accountdnsfirewalldnsanalyticreport_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDNSFirewallDNSAnalyticReportListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.DNSFirewalls.DNSAnalytics.Reports.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDNSFirewallDNSAnalyticReportListParams{ + Dimensions: cloudflare.F("queryType"), + Filters: cloudflare.F("responseCode==NOERROR,queryType==A"), + Limit: cloudflare.F(int64(100)), + Metrics: cloudflare.F("queryCount,uncachedCount"), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F("+responseCode,-queryName"), + Until: cloudflare.F(time.Now()), + }, + ) + 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/accountdnsfirewalldnsanalyticreportbytime.go b/accountdnsfirewalldnsanalyticreportbytime.go new file mode 100644 index 00000000000..6c141ff11e5 --- /dev/null +++ b/accountdnsfirewalldnsanalyticreportbytime.go @@ -0,0 +1,262 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountDNSFirewallDNSAnalyticReportBytimeService 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 [NewAccountDNSFirewallDNSAnalyticReportBytimeService] method instead. +type AccountDNSFirewallDNSAnalyticReportBytimeService struct { + Options []option.RequestOption +} + +// NewAccountDNSFirewallDNSAnalyticReportBytimeService 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 NewAccountDNSFirewallDNSAnalyticReportBytimeService(opts ...option.RequestOption) (r *AccountDNSFirewallDNSAnalyticReportBytimeService) { + r = &AccountDNSFirewallDNSAnalyticReportBytimeService{} + r.Options = opts + return +} + +// Retrieves a list of aggregate metrics grouped by time interval. +// +// See +// [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) +// for detailed information about the available query parameters. +func (r *AccountDNSFirewallDNSAnalyticReportBytimeService) List(ctx context.Context, accountIdentifier string, identifier string, query AccountDNSFirewallDNSAnalyticReportBytimeListParams, opts ...option.RequestOption) (res *AccountDNSFirewallDNSAnalyticReportBytimeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/dns_firewall/%s/dns_analytics/report/bytime", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountDNSFirewallDNSAnalyticReportBytimeListResponse struct { + Errors []AccountDNSFirewallDNSAnalyticReportBytimeListResponseError `json:"errors"` + Messages []AccountDNSFirewallDNSAnalyticReportBytimeListResponseMessage `json:"messages"` + Result AccountDNSFirewallDNSAnalyticReportBytimeListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountDNSFirewallDNSAnalyticReportBytimeListResponseSuccess `json:"success"` + JSON accountDNSFirewallDNSAnalyticReportBytimeListResponseJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportBytimeListResponseJSON contains the JSON +// metadata for the struct [AccountDNSFirewallDNSAnalyticReportBytimeListResponse] +type accountDNSFirewallDNSAnalyticReportBytimeListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportBytimeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportBytimeListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDNSAnalyticReportBytimeListResponseErrorJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportBytimeListResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountDNSFirewallDNSAnalyticReportBytimeListResponseError] +type accountDNSFirewallDNSAnalyticReportBytimeListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportBytimeListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportBytimeListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountDNSFirewallDNSAnalyticReportBytimeListResponseMessageJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportBytimeListResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountDNSFirewallDNSAnalyticReportBytimeListResponseMessage] +type accountDNSFirewallDNSAnalyticReportBytimeListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportBytimeListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportBytimeListResponseResult struct { + Data []AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultData `json:"data"` + // Number of seconds between current time and last processed event, in another + // words how many seconds of data could be missing. + DataLag float64 `json:"data_lag"` + // Maximum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Max interface{} `json:"max"` + // Minimum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Min interface{} `json:"min"` + Query AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQuery `json:"query"` + // Total number of rows in the result. + Rows float64 `json:"rows"` + // Array of time intervals in the response data. Each interval is represented as an + // array containing two values: the start time, and the end time. + TimeIntervals [][]time.Time `json:"time_intervals" format:"date-time"` + // Total results for metrics across all data (object mapping metric names to + // values). + Totals interface{} `json:"totals"` + JSON accountDNSFirewallDNSAnalyticReportBytimeListResponseResultJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportBytimeListResponseResultJSON contains the +// JSON metadata for the struct +// [AccountDNSFirewallDNSAnalyticReportBytimeListResponseResult] +type accountDNSFirewallDNSAnalyticReportBytimeListResponseResultJSON struct { + Data apijson.Field + DataLag apijson.Field + Max apijson.Field + Min apijson.Field + Query apijson.Field + Rows apijson.Field + TimeIntervals apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportBytimeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultData struct { + // Array with one item per requested metric. Each item is an array of values, + // broken down by time interval. + Metrics [][]interface{} `json:"metrics,required"` + JSON accountDNSFirewallDNSAnalyticReportBytimeListResponseResultDataJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportBytimeListResponseResultDataJSON contains the +// JSON metadata for the struct +// [AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultData] +type accountDNSFirewallDNSAnalyticReportBytimeListResponseResultDataJSON struct { + Metrics apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQuery struct { + // Unit of time to group data by. + TimeDelta AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta `json:"time_delta,required"` + JSON accountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryJSON `json:"-"` +} + +// accountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryJSON contains +// the JSON metadata for the struct +// [AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQuery] +type accountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryJSON struct { + TimeDelta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Unit of time to group data by. +type AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta string + +const ( + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaAll AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "all" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaAuto AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "auto" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaYear AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "year" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaQuarter AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "quarter" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaMonth AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "month" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaWeek AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "week" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaDay AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "day" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaHour AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "hour" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaDekaminute AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "dekaminute" + AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaMinute AccountDNSFirewallDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "minute" +) + +// Whether the API call was successful +type AccountDNSFirewallDNSAnalyticReportBytimeListResponseSuccess bool + +const ( + AccountDNSFirewallDNSAnalyticReportBytimeListResponseSuccessTrue AccountDNSFirewallDNSAnalyticReportBytimeListResponseSuccess = true +) + +type AccountDNSFirewallDNSAnalyticReportBytimeListParams struct { + // A comma-separated list of dimensions to group results by. + Dimensions param.Field[string] `query:"dimensions"` + // Segmentation filter in 'attribute operator value' format. + Filters param.Field[string] `query:"filters"` + // Limit number of returned metrics. + Limit param.Field[int64] `query:"limit"` + // A comma-separated list of metrics to query. + Metrics param.Field[string] `query:"metrics"` + // Start date and time of requesting data period in ISO 8601 format. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // A comma-separated list of dimensions to sort by, where each dimension may be + // prefixed by - (descending) or + (ascending). + Sort param.Field[string] `query:"sort"` + // Unit of time to group data by. + TimeDelta param.Field[AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta] `query:"time_delta"` + // End date and time of requesting data period in ISO 8601 format. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes [AccountDNSFirewallDNSAnalyticReportBytimeListParams]'s +// query parameters as `url.Values`. +func (r AccountDNSFirewallDNSAnalyticReportBytimeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Unit of time to group data by. +type AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta string + +const ( + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaAll AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "all" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaAuto AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "auto" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaYear AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "year" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaQuarter AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "quarter" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaMonth AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "month" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaWeek AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "week" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaDay AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "day" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaHour AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "hour" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaDekaminute AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "dekaminute" + AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaMinute AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDelta = "minute" +) diff --git a/accountdnsfirewalldnsanalyticreportbytime_test.go b/accountdnsfirewalldnsanalyticreportbytime_test.go new file mode 100644 index 00000000000..f08dc1153b6 --- /dev/null +++ b/accountdnsfirewalldnsanalyticreportbytime_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountDNSFirewallDNSAnalyticReportBytimeListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.DNSFirewalls.DNSAnalytics.Reports.Bytimes.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountDNSFirewallDNSAnalyticReportBytimeListParams{ + Dimensions: cloudflare.F("queryType"), + Filters: cloudflare.F("responseCode==NOERROR,queryType==A"), + Limit: cloudflare.F(int64(100)), + Metrics: cloudflare.F("queryCount,uncachedCount"), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F("+responseCode,-queryName"), + TimeDelta: cloudflare.F(cloudflare.AccountDNSFirewallDNSAnalyticReportBytimeListParamsTimeDeltaHour), + Until: cloudflare.F(time.Now()), + }, + ) + 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/accountemail.go b/accountemail.go new file mode 100644 index 00000000000..8a387cdf7d3 --- /dev/null +++ b/accountemail.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountEmailService 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 [NewAccountEmailService] method +// instead. +type AccountEmailService struct { + Options []option.RequestOption + Routings *AccountEmailRoutingService +} + +// NewAccountEmailService 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 NewAccountEmailService(opts ...option.RequestOption) (r *AccountEmailService) { + r = &AccountEmailService{} + r.Options = opts + r.Routings = NewAccountEmailRoutingService(opts...) + return +} diff --git a/accountemailrouting.go b/accountemailrouting.go new file mode 100644 index 00000000000..66d04053761 --- /dev/null +++ b/accountemailrouting.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountEmailRoutingService 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 [NewAccountEmailRoutingService] +// method instead. +type AccountEmailRoutingService struct { + Options []option.RequestOption + Addresses *AccountEmailRoutingAddressService +} + +// NewAccountEmailRoutingService 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 NewAccountEmailRoutingService(opts ...option.RequestOption) (r *AccountEmailRoutingService) { + r = &AccountEmailRoutingService{} + r.Options = opts + r.Addresses = NewAccountEmailRoutingAddressService(opts...) + return +} diff --git a/accountemailroutingaddress.go b/accountemailroutingaddress.go new file mode 100644 index 00000000000..fbd5a947245 --- /dev/null +++ b/accountemailroutingaddress.go @@ -0,0 +1,461 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountEmailRoutingAddressService 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 +// [NewAccountEmailRoutingAddressService] method instead. +type AccountEmailRoutingAddressService struct { + Options []option.RequestOption +} + +// NewAccountEmailRoutingAddressService 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 NewAccountEmailRoutingAddressService(opts ...option.RequestOption) (r *AccountEmailRoutingAddressService) { + r = &AccountEmailRoutingAddressService{} + r.Options = opts + return +} + +// Gets information for a specific destination email already created. +func (r *AccountEmailRoutingAddressService) Get(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string, opts ...option.RequestOption) (res *AccountEmailRoutingAddressGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/email/routing/addresses/%s", accountIdentifier, destinationAddressIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes a specific destination address. +func (r *AccountEmailRoutingAddressService) Delete(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string, opts ...option.RequestOption) (res *AccountEmailRoutingAddressDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/email/routing/addresses/%s", accountIdentifier, destinationAddressIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a destination address to forward your emails to. Destination addresses +// need to be verified before they can be used. +func (r *AccountEmailRoutingAddressService) EmailRoutingDestinationAddressesNewADestinationAddress(ctx context.Context, accountIdentifier string, body AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressParams, opts ...option.RequestOption) (res *AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/email/routing/addresses", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists existing destination addresses. +func (r *AccountEmailRoutingAddressService) EmailRoutingDestinationAddressesListDestinationAddresses(ctx context.Context, accountIdentifier string, query AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams, opts ...option.RequestOption) (res *shared.Page[AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/email/routing/addresses", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountEmailRoutingAddressGetResponse struct { + Errors []AccountEmailRoutingAddressGetResponseError `json:"errors"` + Messages []AccountEmailRoutingAddressGetResponseMessage `json:"messages"` + Result AccountEmailRoutingAddressGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountEmailRoutingAddressGetResponseSuccess `json:"success"` + JSON accountEmailRoutingAddressGetResponseJSON `json:"-"` +} + +// accountEmailRoutingAddressGetResponseJSON contains the JSON metadata for the +// struct [AccountEmailRoutingAddressGetResponse] +type accountEmailRoutingAddressGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountEmailRoutingAddressGetResponseErrorJSON `json:"-"` +} + +// accountEmailRoutingAddressGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountEmailRoutingAddressGetResponseError] +type accountEmailRoutingAddressGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountEmailRoutingAddressGetResponseMessageJSON `json:"-"` +} + +// accountEmailRoutingAddressGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountEmailRoutingAddressGetResponseMessage] +type accountEmailRoutingAddressGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressGetResponseResult struct { + // The date and time the destination address has been created. + Created time.Time `json:"created" format:"date-time"` + // The contact email address of the user. + Email string `json:"email"` + // The date and time the destination address was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // Destination address identifier. + Tag string `json:"tag"` + // The date and time the destination address has been verified. Null means not + // verified yet. + Verified time.Time `json:"verified" format:"date-time"` + JSON accountEmailRoutingAddressGetResponseResultJSON `json:"-"` +} + +// accountEmailRoutingAddressGetResponseResultJSON contains the JSON metadata for +// the struct [AccountEmailRoutingAddressGetResponseResult] +type accountEmailRoutingAddressGetResponseResultJSON struct { + Created apijson.Field + Email apijson.Field + Modified apijson.Field + Tag apijson.Field + Verified apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountEmailRoutingAddressGetResponseSuccess bool + +const ( + AccountEmailRoutingAddressGetResponseSuccessTrue AccountEmailRoutingAddressGetResponseSuccess = true +) + +type AccountEmailRoutingAddressDeleteResponse struct { + Errors []AccountEmailRoutingAddressDeleteResponseError `json:"errors"` + Messages []AccountEmailRoutingAddressDeleteResponseMessage `json:"messages"` + Result AccountEmailRoutingAddressDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountEmailRoutingAddressDeleteResponseSuccess `json:"success"` + JSON accountEmailRoutingAddressDeleteResponseJSON `json:"-"` +} + +// accountEmailRoutingAddressDeleteResponseJSON contains the JSON metadata for the +// struct [AccountEmailRoutingAddressDeleteResponse] +type accountEmailRoutingAddressDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountEmailRoutingAddressDeleteResponseErrorJSON `json:"-"` +} + +// accountEmailRoutingAddressDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountEmailRoutingAddressDeleteResponseError] +type accountEmailRoutingAddressDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountEmailRoutingAddressDeleteResponseMessageJSON `json:"-"` +} + +// accountEmailRoutingAddressDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountEmailRoutingAddressDeleteResponseMessage] +type accountEmailRoutingAddressDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressDeleteResponseResult struct { + // The date and time the destination address has been created. + Created time.Time `json:"created" format:"date-time"` + // The contact email address of the user. + Email string `json:"email"` + // The date and time the destination address was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // Destination address identifier. + Tag string `json:"tag"` + // The date and time the destination address has been verified. Null means not + // verified yet. + Verified time.Time `json:"verified" format:"date-time"` + JSON accountEmailRoutingAddressDeleteResponseResultJSON `json:"-"` +} + +// accountEmailRoutingAddressDeleteResponseResultJSON contains the JSON metadata +// for the struct [AccountEmailRoutingAddressDeleteResponseResult] +type accountEmailRoutingAddressDeleteResponseResultJSON struct { + Created apijson.Field + Email apijson.Field + Modified apijson.Field + Tag apijson.Field + Verified apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountEmailRoutingAddressDeleteResponseSuccess bool + +const ( + AccountEmailRoutingAddressDeleteResponseSuccessTrue AccountEmailRoutingAddressDeleteResponseSuccess = true +) + +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponse struct { + Errors []AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseError `json:"errors"` + Messages []AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseMessage `json:"messages"` + Result AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseResult `json:"result"` + // Whether the API call was successful + Success AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseSuccess `json:"success"` + JSON accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseJSON `json:"-"` +} + +// accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseJSON +// contains the JSON metadata for the struct +// [AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponse] +type accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseErrorJSON `json:"-"` +} + +// accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseError] +type accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseMessageJSON `json:"-"` +} + +// accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseMessage] +type accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseResult struct { + // The date and time the destination address has been created. + Created time.Time `json:"created" format:"date-time"` + // The contact email address of the user. + Email string `json:"email"` + // The date and time the destination address was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // Destination address identifier. + Tag string `json:"tag"` + // The date and time the destination address has been verified. Null means not + // verified yet. + Verified time.Time `json:"verified" format:"date-time"` + JSON accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseResultJSON `json:"-"` +} + +// accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseResultJSON +// contains the JSON metadata for the struct +// [AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseResult] +type accountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseResultJSON struct { + Created apijson.Field + Email apijson.Field + Modified apijson.Field + Tag apijson.Field + Verified apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseSuccess bool + +const ( + AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseSuccessTrue AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponseSuccess = true +) + +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse struct { + // The date and time the destination address has been created. + Created time.Time `json:"created" format:"date-time"` + // The contact email address of the user. + Email string `json:"email"` + // The date and time the destination address was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // Destination address identifier. + Tag string `json:"tag"` + // The date and time the destination address has been verified. Null means not + // verified yet. + Verified time.Time `json:"verified" format:"date-time"` + JSON accountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponseJSON `json:"-"` +} + +// accountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponseJSON +// contains the JSON metadata for the struct +// [AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse] +type accountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponseJSON struct { + Created apijson.Field + Email apijson.Field + Modified apijson.Field + Tag apijson.Field + Verified apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressParams struct { + // The contact email address of the user. + Email param.Field[string] `json:"email,required"` +} + +func (r AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams struct { + // Sorts results in an ascending or descending order. + Direction param.Field[AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsDirection] `query:"direction"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[float64] `query:"per_page"` + // Filter by verified destination addresses. + Verified param.Field[AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsVerified] `query:"verified"` +} + +// URLQuery serializes +// [AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams]'s +// query parameters as `url.Values`. +func (r AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Sorts results in an ascending or descending order. +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsDirection string + +const ( + AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsDirectionAsc AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsDirection = "asc" + AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsDirectionDesc AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsDirection = "desc" +) + +// Filter by verified destination addresses. +type AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsVerified bool + +const ( + AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsVerifiedTrue AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsVerified = true + AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsVerifiedFalse AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsVerified = false +) diff --git a/accountemailroutingaddress_test.go b/accountemailroutingaddress_test.go new file mode 100644 index 00000000000..1b00d0d8ade --- /dev/null +++ b/accountemailroutingaddress_test.go @@ -0,0 +1,141 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountEmailRoutingAddressGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Emails.Routings.Addresses.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountEmailRoutingAddressDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Emails.Routings.Addresses.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddress(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Emails.Routings.Addresses.EmailRoutingDestinationAddressesNewADestinationAddress( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressParams{ + Email: cloudflare.F("user@example.com"), + }, + ) + 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 TestAccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Emails.Routings.Addresses.EmailRoutingDestinationAddressesListDestinationAddresses( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams{ + Direction: cloudflare.F(cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsDirectionAsc), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Verified: cloudflare.F(cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParamsVerifiedTrue), + }, + ) + 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/accountfirewall.go b/accountfirewall.go new file mode 100644 index 00000000000..d22d42d5c19 --- /dev/null +++ b/accountfirewall.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountFirewallService 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 [NewAccountFirewallService] method +// instead. +type AccountFirewallService struct { + Options []option.RequestOption + AccessRules *AccountFirewallAccessRuleService +} + +// NewAccountFirewallService 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 NewAccountFirewallService(opts ...option.RequestOption) (r *AccountFirewallService) { + r = &AccountFirewallService{} + r.Options = opts + r.AccessRules = NewAccountFirewallAccessRuleService(opts...) + return +} diff --git a/accountfirewallaccessrule.go b/accountfirewallaccessrule.go new file mode 100644 index 00000000000..ebbe869b921 --- /dev/null +++ b/accountfirewallaccessrule.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountFirewallAccessRuleService 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 +// [NewAccountFirewallAccessRuleService] method instead. +type AccountFirewallAccessRuleService struct { + Options []option.RequestOption + Rules *AccountFirewallAccessRuleRuleService +} + +// NewAccountFirewallAccessRuleService 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 NewAccountFirewallAccessRuleService(opts ...option.RequestOption) (r *AccountFirewallAccessRuleService) { + r = &AccountFirewallAccessRuleService{} + r.Options = opts + r.Rules = NewAccountFirewallAccessRuleRuleService(opts...) + return +} diff --git a/accountfirewallaccessrulerule.go b/accountfirewallaccessrulerule.go new file mode 100644 index 00000000000..f1776a9c657 --- /dev/null +++ b/accountfirewallaccessrulerule.go @@ -0,0 +1,832 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountFirewallAccessRuleRuleService 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 +// [NewAccountFirewallAccessRuleRuleService] method instead. +type AccountFirewallAccessRuleRuleService struct { + Options []option.RequestOption +} + +// NewAccountFirewallAccessRuleRuleService 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 NewAccountFirewallAccessRuleRuleService(opts ...option.RequestOption) (r *AccountFirewallAccessRuleRuleService) { + r = &AccountFirewallAccessRuleRuleService{} + r.Options = opts + return +} + +// Fetches the details of an IP Access rule defined at the account level. +func (r *AccountFirewallAccessRuleRuleService) Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountFirewallAccessRuleRuleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/firewall/access_rules/rules/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an IP Access rule defined at the account level. +// +// Note: This operation will affect all zones in the account. +func (r *AccountFirewallAccessRuleRuleService) Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body AccountFirewallAccessRuleRuleUpdateParams, opts ...option.RequestOption) (res *AccountFirewallAccessRuleRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/firewall/access_rules/rules/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes an existing IP Access rule defined at the account level. +// +// Note: This operation will affect all zones in the account. +func (r *AccountFirewallAccessRuleRuleService) Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountFirewallAccessRuleRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/firewall/access_rules/rules/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new IP Access rule for an account. The rule will apply to all zones in +// the account. +// +// Note: To create an IP Access rule that applies to a single zone, refer to the +// [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints. +func (r *AccountFirewallAccessRuleRuleService) IPAccessRulesForAnAccountNewAnIPAccessRule(ctx context.Context, accountIdentifier interface{}, body AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParams, opts ...option.RequestOption) (res *AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/firewall/access_rules/rules", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches IP Access rules of an account. These rules apply to all the zones in the +// account. You can filter the results using several optional parameters. +func (r *AccountFirewallAccessRuleRuleService) IPAccessRulesForAnAccountListIPAccessRules(ctx context.Context, accountIdentifier interface{}, query AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParams, opts ...option.RequestOption) (res *shared.Page[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%v/firewall/access_rules/rules", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountFirewallAccessRuleRuleGetResponse struct { + Errors []AccountFirewallAccessRuleRuleGetResponseError `json:"errors"` + Messages []AccountFirewallAccessRuleRuleGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountFirewallAccessRuleRuleGetResponseSuccess `json:"success"` + JSON accountFirewallAccessRuleRuleGetResponseJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleGetResponseJSON contains the JSON metadata for the +// struct [AccountFirewallAccessRuleRuleGetResponse] +type accountFirewallAccessRuleRuleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleGetResponseErrorJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountFirewallAccessRuleRuleGetResponseError] +type accountFirewallAccessRuleRuleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleGetResponseMessageJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleGetResponseMessageJSON contains the JSON metadata +// for the struct [AccountFirewallAccessRuleRuleGetResponseMessage] +type accountFirewallAccessRuleRuleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountFirewallAccessRuleRuleGetResponseSuccess bool + +const ( + AccountFirewallAccessRuleRuleGetResponseSuccessTrue AccountFirewallAccessRuleRuleGetResponseSuccess = true +) + +type AccountFirewallAccessRuleRuleUpdateResponse struct { + Errors []AccountFirewallAccessRuleRuleUpdateResponseError `json:"errors"` + Messages []AccountFirewallAccessRuleRuleUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountFirewallAccessRuleRuleUpdateResponseSuccess `json:"success"` + JSON accountFirewallAccessRuleRuleUpdateResponseJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleUpdateResponseJSON contains the JSON metadata for +// the struct [AccountFirewallAccessRuleRuleUpdateResponse] +type accountFirewallAccessRuleRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleUpdateResponseErrorJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountFirewallAccessRuleRuleUpdateResponseError] +type accountFirewallAccessRuleRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleUpdateResponseMessageJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleUpdateResponseMessageJSON contains the JSON +// metadata for the struct [AccountFirewallAccessRuleRuleUpdateResponseMessage] +type accountFirewallAccessRuleRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountFirewallAccessRuleRuleUpdateResponseSuccess bool + +const ( + AccountFirewallAccessRuleRuleUpdateResponseSuccessTrue AccountFirewallAccessRuleRuleUpdateResponseSuccess = true +) + +type AccountFirewallAccessRuleRuleDeleteResponse struct { + Errors []AccountFirewallAccessRuleRuleDeleteResponseError `json:"errors"` + Messages []AccountFirewallAccessRuleRuleDeleteResponseMessage `json:"messages"` + Result AccountFirewallAccessRuleRuleDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountFirewallAccessRuleRuleDeleteResponseSuccess `json:"success"` + JSON accountFirewallAccessRuleRuleDeleteResponseJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleDeleteResponseJSON contains the JSON metadata for +// the struct [AccountFirewallAccessRuleRuleDeleteResponse] +type accountFirewallAccessRuleRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleDeleteResponseErrorJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountFirewallAccessRuleRuleDeleteResponseError] +type accountFirewallAccessRuleRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleDeleteResponseMessageJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountFirewallAccessRuleRuleDeleteResponseMessage] +type accountFirewallAccessRuleRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON accountFirewallAccessRuleRuleDeleteResponseResultJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleDeleteResponseResultJSON contains the JSON metadata +// for the struct [AccountFirewallAccessRuleRuleDeleteResponseResult] +type accountFirewallAccessRuleRuleDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountFirewallAccessRuleRuleDeleteResponseSuccess bool + +const ( + AccountFirewallAccessRuleRuleDeleteResponseSuccessTrue AccountFirewallAccessRuleRuleDeleteResponseSuccess = true +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponse struct { + Errors []AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseError `json:"errors"` + Messages []AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseSuccess `json:"success"` + JSON accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseJSON +// contains the JSON metadata for the struct +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponse] +type accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseErrorJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseError] +type accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseMessageJSON `json:"-"` +} + +// accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseMessage] +type accountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseSuccess bool + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseSuccessTrue AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponseSuccess = true +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesResponse = interface{} + +type AccountFirewallAccessRuleRuleUpdateParams struct { + // The rule configuration. + Configuration param.Field[AccountFirewallAccessRuleRuleUpdateParamsConfiguration] `json:"configuration,required"` + // The action to apply to a matched request. + Mode param.Field[AccountFirewallAccessRuleRuleUpdateParamsMode] `json:"mode,required"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes"` +} + +func (r AccountFirewallAccessRuleRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The rule configuration. +// +// Satisfied by +// [AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfiguration], +// [AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6Configuration], +// [AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfiguration], +// [AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfiguration], +// [AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfiguration]. +type AccountFirewallAccessRuleRuleUpdateParamsConfiguration interface { + implementsAccountFirewallAccessRuleRuleUpdateParamsConfiguration() +} + +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target param.Field[AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfigurationTarget] `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfiguration) implementsAccountFirewallAccessRuleRuleUpdateParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfigurationTargetIP AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target param.Field[AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6ConfigurationTarget] `json:"target"` + // The IPv6 address to match. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6Configuration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6Configuration) implementsAccountFirewallAccessRuleRuleUpdateParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6ConfigurationTargetIp6 AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target param.Field[AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfigurationTarget] `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfiguration) implementsAccountFirewallAccessRuleRuleUpdateParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfigurationTargetIPRange AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target param.Field[AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfigurationTarget] `json:"target"` + // The AS number to match. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfiguration) implementsAccountFirewallAccessRuleRuleUpdateParamsConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfigurationTargetASN AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target param.Field[AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfigurationTarget] `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfiguration) implementsAccountFirewallAccessRuleRuleUpdateParamsConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfigurationTargetCountry AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type AccountFirewallAccessRuleRuleUpdateParamsMode string + +const ( + AccountFirewallAccessRuleRuleUpdateParamsModeBlock AccountFirewallAccessRuleRuleUpdateParamsMode = "block" + AccountFirewallAccessRuleRuleUpdateParamsModeChallenge AccountFirewallAccessRuleRuleUpdateParamsMode = "challenge" + AccountFirewallAccessRuleRuleUpdateParamsModeWhitelist AccountFirewallAccessRuleRuleUpdateParamsMode = "whitelist" + AccountFirewallAccessRuleRuleUpdateParamsModeJsChallenge AccountFirewallAccessRuleRuleUpdateParamsMode = "js_challenge" + AccountFirewallAccessRuleRuleUpdateParamsModeManagedChallenge AccountFirewallAccessRuleRuleUpdateParamsMode = "managed_challenge" +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParams struct { + // The rule configuration. + Configuration param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration] `json:"configuration,required"` + // The action to apply to a matched request. + Mode param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsMode] `json:"mode,required"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes"` +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The rule configuration. +// +// Satisfied by +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration], +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration], +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration], +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration], +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration]. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration interface { + implementsAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration() +} + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget] `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration) implementsAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTargetIP AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget] `json:"target"` + // The IPv6 address to match. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration) implementsAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTargetIp6 AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget] `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration) implementsAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTargetIPRange AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget] `json:"target"` + // The AS number to match. + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration) implementsAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTargetASN AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget] `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value param.Field[string] `json:"value"` +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration) implementsAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTargetCountry AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsMode string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsModeBlock AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsMode = "block" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsModeChallenge AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsMode = "challenge" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsModeWhitelist AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsMode = "whitelist" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsModeJsChallenge AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsMode = "js_challenge" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsModeManagedChallenge AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsMode = "managed_challenge" +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParams struct { + // The direction used to sort returned rules. + Direction param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsDirection] `query:"direction"` + EgsPagination param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPagination] `query:"egs-pagination"` + Filters param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFilters] `query:"filters"` + // The field used to sort returned rules. + Order param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrder] `query:"order"` + // Requested page within paginated list of results. + Page param.Field[float64] `query:"page"` + // Maximum number of results requested. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParams]'s +// query parameters as `url.Values`. +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned rules. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsDirection string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsDirectionAsc AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsDirection = "asc" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsDirectionDesc AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsDirection = "desc" +) + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPagination struct { + Json param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPaginationJson] `query:"json"` +} + +// URLQuery serializes +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPagination]'s +// query parameters as `url.Values`. +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPagination) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPaginationJson struct { + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The maximum number of results per page. You can only set the value to `1` or to + // a multiple of 5 such as `5`, `10`, `15`, or `20`. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPaginationJson]'s +// query parameters as `url.Values`. +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPaginationJson) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFilters struct { + // The target to search in existing rules. + ConfigurationTarget param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTarget] `query:"configuration.target"` + // The target value to search for in existing rules: an IP address, an IP address + // range, or a country code, depending on the provided `configuration.target`. + // Notes: You can search for a single IPv4 address, an IP address range with a + // subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code. + ConfigurationValue param.Field[string] `query:"configuration.value"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMatch] `query:"match"` + // The action to apply to a matched request. + Mode param.Field[AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMode] `query:"mode"` + // The string to search for in the notes of existing IP Access rules. Notes: For + // example, the string 'attack' would match IP Access rules with notes 'Attack + // 26/02' and 'Attack 27/02'. The search is case insensitive. + Notes param.Field[string] `query:"notes"` +} + +// URLQuery serializes +// [AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFilters]'s +// query parameters as `url.Values`. +func (r AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFilters) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The target to search in existing rules. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTarget string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTargetIP AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTarget = "ip" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTargetIPRange AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTarget = "ip_range" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTargetASN AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTarget = "asn" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTargetCountry AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTarget = "country" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMatch string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMatchAny AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMatch = "any" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMatchAll AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMatch = "all" +) + +// The action to apply to a matched request. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMode string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersModeBlock AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMode = "block" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersModeChallenge AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMode = "challenge" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersModeWhitelist AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMode = "whitelist" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersModeJsChallenge AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMode = "js_challenge" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersModeManagedChallenge AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMode = "managed_challenge" +) + +// The field used to sort returned rules. +type AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrder string + +const ( + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrderConfigurationTarget AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrder = "configuration.target" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrderConfigurationValue AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrder = "configuration.value" + AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrderMode AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrder = "mode" +) diff --git a/accountfirewallaccessrulerule_test.go b/accountfirewallaccessrulerule_test.go new file mode 100644 index 00000000000..3400dbb1574 --- /dev/null +++ b/accountfirewallaccessrulerule_test.go @@ -0,0 +1,197 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountFirewallAccessRuleRuleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Firewalls.AccessRules.Rules.Get( + context.TODO(), + map[string]interface{}{}, + map[string]interface{}{}, + ) + 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 TestAccountFirewallAccessRuleRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Firewalls.AccessRules.Rules.Update( + context.TODO(), + map[string]interface{}{}, + map[string]interface{}{}, + cloudflare.AccountFirewallAccessRuleRuleUpdateParams{ + Configuration: cloudflare.F[cloudflare.AccountFirewallAccessRuleRuleUpdateParamsConfiguration](cloudflare.AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfiguration(cloudflare.AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfiguration{ + Target: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleUpdateParamsConfigurationDZw70ubTIPConfigurationTargetIP), + Value: cloudflare.F("198.51.100.4"), + })), + Mode: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleUpdateParamsModeChallenge), + Notes: cloudflare.F("This rule is enabled because of an event that occurred on date 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()) + } +} + +func TestAccountFirewallAccessRuleRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Firewalls.AccessRules.Rules.Delete( + context.TODO(), + map[string]interface{}{}, + map[string]interface{}{}, + ) + 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 TestAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Firewalls.AccessRules.Rules.IPAccessRulesForAnAccountNewAnIPAccessRule( + context.TODO(), + map[string]interface{}{}, + cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParams{ + Configuration: cloudflare.F[cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfiguration](cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration{ + Target: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTargetIP), + Value: cloudflare.F("198.51.100.4"), + })), + Mode: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParamsModeChallenge), + Notes: cloudflare.F("This rule is enabled because of an event that occurred on date 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()) + } +} + +func TestAccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Firewalls.AccessRules.Rules.IPAccessRulesForAnAccountListIPAccessRules( + context.TODO(), + map[string]interface{}{}, + cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParams{ + Direction: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsDirectionDesc), + EgsPagination: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPagination{ + Json: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsEgsPaginationJson{ + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + }), + }), + Filters: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFilters{ + ConfigurationTarget: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersConfigurationTargetIP), + ConfigurationValue: cloudflare.F("198.51.100.4"), + Match: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersMatchAny), + Mode: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsFiltersModeChallenge), + Notes: cloudflare.F("my note"), + }), + Order: cloudflare.F(cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParamsOrderMode), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(20.000000), + }, + ) + 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/accountgateway.go b/accountgateway.go new file mode 100644 index 00000000000..4e362fb0555 --- /dev/null +++ b/accountgateway.go @@ -0,0 +1,269 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayService 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 [NewAccountGatewayService] method +// instead. +type AccountGatewayService struct { + Options []option.RequestOption + AuditSSHSettings *AccountGatewayAuditSSHSettingService + Categories *AccountGatewayCategoryService + AppTypes *AccountGatewayAppTypeService + Configurations *AccountGatewayConfigurationService + Lists *AccountGatewayListService + Locations *AccountGatewayLocationService + Loggings *AccountGatewayLoggingService + ProxyEndpoints *AccountGatewayProxyEndpointService + Rules *AccountGatewayRuleService +} + +// NewAccountGatewayService 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 NewAccountGatewayService(opts ...option.RequestOption) (r *AccountGatewayService) { + r = &AccountGatewayService{} + r.Options = opts + r.AuditSSHSettings = NewAccountGatewayAuditSSHSettingService(opts...) + r.Categories = NewAccountGatewayCategoryService(opts...) + r.AppTypes = NewAccountGatewayAppTypeService(opts...) + r.Configurations = NewAccountGatewayConfigurationService(opts...) + r.Lists = NewAccountGatewayListService(opts...) + r.Locations = NewAccountGatewayLocationService(opts...) + r.Loggings = NewAccountGatewayLoggingService(opts...) + r.ProxyEndpoints = NewAccountGatewayProxyEndpointService(opts...) + r.Rules = NewAccountGatewayRuleService(opts...) + return +} + +// Creates a Zero Trust account with an existing Cloudflare account. +func (r *AccountGatewayService) ZeroTrustAccountsNewZeroTrustAccount(ctx context.Context, identifier interface{}, body AccountGatewayZeroTrustAccountsNewZeroTrustAccountParams, opts ...option.RequestOption) (res *AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Gets information about the current Zero Trust account. +func (r *AccountGatewayService) ZeroTrustAccountsGetZeroTrustAccountInformation(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponse struct { + Errors []AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseError `json:"errors"` + Messages []AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseMessage `json:"messages"` + Result AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseSuccess `json:"success"` + JSON accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseJSON contains the JSON +// metadata for the struct +// [AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponse] +type accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseErrorJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseError] +type accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseMessageJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseMessage] +type accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseResult struct { + // Cloudflare account ID. + ID string `json:"id"` + // Gateway internal ID. + GatewayTag string `json:"gateway_tag"` + // The name of the provider. Usually Cloudflare. + ProviderName string `json:"provider_name"` + JSON accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseResultJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseResultJSON contains +// the JSON metadata for the struct +// [AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseResult] +type accountGatewayZeroTrustAccountsNewZeroTrustAccountResponseResultJSON struct { + ID apijson.Field + GatewayTag apijson.Field + ProviderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseSuccess bool + +const ( + AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseSuccessTrue AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponseSuccess = true +) + +type AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponse struct { + Errors []AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseError `json:"errors"` + Messages []AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseMessage `json:"messages"` + Result AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseSuccess `json:"success"` + JSON accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponse] +type accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseErrorJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseError] +type accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseMessageJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseMessage] +type accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseResult struct { + // Cloudflare account ID. + ID string `json:"id"` + // Gateway internal ID. + GatewayTag string `json:"gateway_tag"` + // The name of the provider. Usually Cloudflare. + ProviderName string `json:"provider_name"` + JSON accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseResultJSON `json:"-"` +} + +// accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseResult] +type accountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseResultJSON struct { + ID apijson.Field + GatewayTag apijson.Field + ProviderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseSuccess bool + +const ( + AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseSuccessTrue AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponseSuccess = true +) + +type AccountGatewayZeroTrustAccountsNewZeroTrustAccountParams struct { + // Cloudflare account ID. + AccountID param.Field[string] `json:"account_id,required"` +} + +func (r AccountGatewayZeroTrustAccountsNewZeroTrustAccountParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgateway_test.go b/accountgateway_test.go new file mode 100644 index 00000000000..904dd72a61b --- /dev/null +++ b/accountgateway_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayZeroTrustAccountsNewZeroTrustAccount(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.ZeroTrustAccountsNewZeroTrustAccount( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayZeroTrustAccountsNewZeroTrustAccountParams{ + AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), + }, + ) + 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 TestAccountGatewayZeroTrustAccountsGetZeroTrustAccountInformation(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.ZeroTrustAccountsGetZeroTrustAccountInformation(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountgatewayapptype.go b/accountgatewayapptype.go new file mode 100644 index 00000000000..92e75edfefa --- /dev/null +++ b/accountgatewayapptype.go @@ -0,0 +1,217 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayAppTypeService 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 [NewAccountGatewayAppTypeService] +// method instead. +type AccountGatewayAppTypeService struct { + Options []option.RequestOption +} + +// NewAccountGatewayAppTypeService 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 NewAccountGatewayAppTypeService(opts ...option.RequestOption) (r *AccountGatewayAppTypeService) { + r = &AccountGatewayAppTypeService{} + r.Options = opts + return +} + +// Fetches all application and application type mappings. +func (r *AccountGatewayAppTypeService) ZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappings(ctx context.Context, identifier string, opts ...option.RequestOption) (res *AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/gateway/app_types", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponse struct { + Errors []AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseError `json:"errors"` + Messages []AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseMessage `json:"messages"` + Result []AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResult `json:"result"` + ResultInfo AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseSuccess `json:"success"` + JSON accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseJSON `json:"-"` +} + +// accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponse] +type accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseErrorJSON `json:"-"` +} + +// accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseError] +type accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseMessageJSON `json:"-"` +} + +// accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseMessage] +type accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplication] +// or +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplicationType]. +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResult interface { + implementsAccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResult)(nil)).Elem(), "") +} + +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplication struct { + // The identifier for this application. There is only one application per ID. + ID int64 `json:"id"` + // The identifier for the type of this application. There can be many applications + // with the same type. This refers to the `id` of a returned application type. + ApplicationTypeID int64 `json:"application_type_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The name of the application or application type. + Name string `json:"name"` + JSON accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFe7OxcxuApplicationJSON `json:"-"` +} + +// accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFe7OxcxuApplicationJSON +// contains the JSON metadata for the struct +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplication] +type accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFe7OxcxuApplicationJSON struct { + ID apijson.Field + ApplicationTypeID apijson.Field + CreatedAt apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplication) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplication) implementsAccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResult() { +} + +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplicationType struct { + // The identifier for the type of this application. There can be many applications + // with the same type. This refers to the `id` of a returned application type. + ID int64 `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // A short summary of applications with this type. + Description string `json:"description"` + // The name of the application or application type. + Name string `json:"name"` + JSON accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFe7OxcxuApplicationTypeJSON `json:"-"` +} + +// accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFe7OxcxuApplicationTypeJSON +// contains the JSON metadata for the struct +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplicationType] +type accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFe7OxcxuApplicationTypeJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplicationType) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultFE7OxcxuApplicationType) implementsAccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResult() { +} + +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultInfoJSON `json:"-"` +} + +// accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultInfo] +type accountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseSuccess bool + +const ( + AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseSuccessTrue AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponseSuccess = true +) diff --git a/accountgatewayapptype_test.go b/accountgatewayapptype_test.go new file mode 100644 index 00000000000..c9170e3ce24 --- /dev/null +++ b/accountgatewayapptype_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.AppTypes.ZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappings(context.TODO(), "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/accountgatewayauditsshsetting.go b/accountgatewayauditsshsetting.go new file mode 100644 index 00000000000..dbb6c98b6f0 --- /dev/null +++ b/accountgatewayauditsshsetting.go @@ -0,0 +1,248 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayAuditSSHSettingService 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 +// [NewAccountGatewayAuditSSHSettingService] method instead. +type AccountGatewayAuditSSHSettingService struct { + Options []option.RequestOption +} + +// NewAccountGatewayAuditSSHSettingService 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 NewAccountGatewayAuditSSHSettingService(opts ...option.RequestOption) (r *AccountGatewayAuditSSHSettingService) { + r = &AccountGatewayAuditSSHSettingService{} + r.Options = opts + return +} + +// Get all Zero Trust Audit SSH settings for an account. +func (r *AccountGatewayAuditSSHSettingService) Get(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayAuditSSHSettingGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/audit_ssh_settings", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates Zero Trust Audit SSH settings. +func (r *AccountGatewayAuditSSHSettingService) Update(ctx context.Context, identifier interface{}, body AccountGatewayAuditSSHSettingUpdateParams, opts ...option.RequestOption) (res *AccountGatewayAuditSSHSettingUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/audit_ssh_settings", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountGatewayAuditSSHSettingGetResponse struct { + Errors []AccountGatewayAuditSSHSettingGetResponseError `json:"errors"` + Messages []AccountGatewayAuditSSHSettingGetResponseMessage `json:"messages"` + Result AccountGatewayAuditSSHSettingGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayAuditSSHSettingGetResponseSuccess `json:"success"` + JSON accountGatewayAuditSSHSettingGetResponseJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingGetResponseJSON contains the JSON metadata for the +// struct [AccountGatewayAuditSSHSettingGetResponse] +type accountGatewayAuditSSHSettingGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAuditSSHSettingGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayAuditSSHSettingGetResponseErrorJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountGatewayAuditSSHSettingGetResponseError] +type accountGatewayAuditSSHSettingGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAuditSSHSettingGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayAuditSSHSettingGetResponseMessageJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingGetResponseMessageJSON contains the JSON metadata +// for the struct [AccountGatewayAuditSSHSettingGetResponseMessage] +type accountGatewayAuditSSHSettingGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAuditSSHSettingGetResponseResult struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // SSH encryption public key + PublicKey string `json:"public_key"` + // Seed ID + SeedID string `json:"seed_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayAuditSSHSettingGetResponseResultJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingGetResponseResultJSON contains the JSON metadata +// for the struct [AccountGatewayAuditSSHSettingGetResponseResult] +type accountGatewayAuditSSHSettingGetResponseResultJSON struct { + CreatedAt apijson.Field + PublicKey apijson.Field + SeedID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayAuditSSHSettingGetResponseSuccess bool + +const ( + AccountGatewayAuditSSHSettingGetResponseSuccessTrue AccountGatewayAuditSSHSettingGetResponseSuccess = true +) + +type AccountGatewayAuditSSHSettingUpdateResponse struct { + Errors []AccountGatewayAuditSSHSettingUpdateResponseError `json:"errors"` + Messages []AccountGatewayAuditSSHSettingUpdateResponseMessage `json:"messages"` + Result AccountGatewayAuditSSHSettingUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayAuditSSHSettingUpdateResponseSuccess `json:"success"` + JSON accountGatewayAuditSSHSettingUpdateResponseJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingUpdateResponseJSON contains the JSON metadata for +// the struct [AccountGatewayAuditSSHSettingUpdateResponse] +type accountGatewayAuditSSHSettingUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAuditSSHSettingUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayAuditSSHSettingUpdateResponseErrorJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountGatewayAuditSSHSettingUpdateResponseError] +type accountGatewayAuditSSHSettingUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAuditSSHSettingUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayAuditSSHSettingUpdateResponseMessageJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingUpdateResponseMessageJSON contains the JSON +// metadata for the struct [AccountGatewayAuditSSHSettingUpdateResponseMessage] +type accountGatewayAuditSSHSettingUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayAuditSSHSettingUpdateResponseResult struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // SSH encryption public key + PublicKey string `json:"public_key"` + // Seed ID + SeedID string `json:"seed_id"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayAuditSSHSettingUpdateResponseResultJSON `json:"-"` +} + +// accountGatewayAuditSSHSettingUpdateResponseResultJSON contains the JSON metadata +// for the struct [AccountGatewayAuditSSHSettingUpdateResponseResult] +type accountGatewayAuditSSHSettingUpdateResponseResultJSON struct { + CreatedAt apijson.Field + PublicKey apijson.Field + SeedID apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayAuditSSHSettingUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayAuditSSHSettingUpdateResponseSuccess bool + +const ( + AccountGatewayAuditSSHSettingUpdateResponseSuccessTrue AccountGatewayAuditSSHSettingUpdateResponseSuccess = true +) + +type AccountGatewayAuditSSHSettingUpdateParams struct { + // SSH encryption public key + PublicKey param.Field[string] `json:"public_key,required"` + // Seed ID + SeedID param.Field[string] `json:"seed_id"` +} + +func (r AccountGatewayAuditSSHSettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgatewayauditsshsetting_test.go b/accountgatewayauditsshsetting_test.go new file mode 100644 index 00000000000..b7162dd8d7e --- /dev/null +++ b/accountgatewayauditsshsetting_test.go @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayAuditSSHSettingGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.AuditSSHSettings.Get(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountGatewayAuditSSHSettingUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.AuditSSHSettings.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayAuditSSHSettingUpdateParams{ + PublicKey: cloudflare.F("1pyl6I1tL7xfJuFYVzXlUW8uXXlpxegHXBzGCBKaSFA="), + SeedID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, + ) + 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/accountgatewaycategory.go b/accountgatewaycategory.go new file mode 100644 index 00000000000..18d8b9cee9f --- /dev/null +++ b/accountgatewaycategory.go @@ -0,0 +1,240 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayCategoryService 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 [NewAccountGatewayCategoryService] +// method instead. +type AccountGatewayCategoryService struct { + Options []option.RequestOption +} + +// NewAccountGatewayCategoryService 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 NewAccountGatewayCategoryService(opts ...option.RequestOption) (r *AccountGatewayCategoryService) { + r = &AccountGatewayCategoryService{} + r.Options = opts + return +} + +// Fetches a list of all categories. +func (r *AccountGatewayCategoryService) ZeroTrustGatewayCategoriesListCategories(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/gateway/categories", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponse struct { + Errors []AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseError `json:"errors"` + Messages []AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseMessage `json:"messages"` + Result []AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResult `json:"result"` + ResultInfo AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseSuccess `json:"success"` + JSON accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseJSON `json:"-"` +} + +// accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponse] +type accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseErrorJSON `json:"-"` +} + +// accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseError] +type accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseMessageJSON `json:"-"` +} + +// accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseMessage] +type accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResult struct { + // The identifier for this category. There is only one category per ID. + ID int64 `json:"id"` + // True if the category is in beta and subject to change. + Beta bool `json:"beta"` + // Which account types are allowed to create policies based on this category. + // `blocked` categories are blocked unconditionally for all accounts. + // `removalPending` categories can be removed from policies but not added. + // `noBlock` categories cannot be blocked. + Class AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClass `json:"class"` + // A short summary of domains in the category. + Description string `json:"description"` + // The name of the category. + Name string `json:"name"` + // All subcategories for this category. + Subcategories []AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategory `json:"subcategories"` + JSON accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultJSON `json:"-"` +} + +// accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResult] +type accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultJSON struct { + ID apijson.Field + Beta apijson.Field + Class apijson.Field + Description apijson.Field + Name apijson.Field + Subcategories apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Which account types are allowed to create policies based on this category. +// `blocked` categories are blocked unconditionally for all accounts. +// `removalPending` categories can be removed from policies but not added. +// `noBlock` categories cannot be blocked. +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClass string + +const ( + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClassFree AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClass = "free" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClassPremium AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClass = "premium" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClassBlocked AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClass = "blocked" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClassRemovalPending AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClass = "removalPending" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClassNoBlock AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultClass = "noBlock" +) + +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategory struct { + // The identifier for this category. There is only one category per ID. + ID int64 `json:"id"` + // True if the category is in beta and subject to change. + Beta bool `json:"beta"` + // Which account types are allowed to create policies based on this category. + // `blocked` categories are blocked unconditionally for all accounts. + // `removalPending` categories can be removed from policies but not added. + // `noBlock` categories cannot be blocked. + Class AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClass `json:"class"` + // A short summary of domains in the category. + Description string `json:"description"` + // The name of the category. + Name string `json:"name"` + JSON accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoryJSON `json:"-"` +} + +// accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoryJSON +// contains the JSON metadata for the struct +// [AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategory] +type accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoryJSON struct { + ID apijson.Field + Beta apijson.Field + Class apijson.Field + Description apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Which account types are allowed to create policies based on this category. +// `blocked` categories are blocked unconditionally for all accounts. +// `removalPending` categories can be removed from policies but not added. +// `noBlock` categories cannot be blocked. +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClass string + +const ( + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClassFree AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClass = "free" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClassPremium AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClass = "premium" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClassBlocked AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClass = "blocked" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClassRemovalPending AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClass = "removalPending" + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClassNoBlock AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultSubcategoriesClass = "noBlock" +) + +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultInfoJSON `json:"-"` +} + +// accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultInfo] +type accountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseSuccess bool + +const ( + AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseSuccessTrue AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponseSuccess = true +) diff --git a/accountgatewaycategory_test.go b/accountgatewaycategory_test.go new file mode 100644 index 00000000000..3215fa8e7e6 --- /dev/null +++ b/accountgatewaycategory_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayCategoryZeroTrustGatewayCategoriesListCategories(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Categories.ZeroTrustGatewayCategoriesListCategories(context.TODO(), "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/accountgatewayconfiguration.go b/accountgatewayconfiguration.go new file mode 100644 index 00000000000..00c9be44bbf --- /dev/null +++ b/accountgatewayconfiguration.go @@ -0,0 +1,1439 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayConfigurationService 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 +// [NewAccountGatewayConfigurationService] method instead. +type AccountGatewayConfigurationService struct { + Options []option.RequestOption +} + +// NewAccountGatewayConfigurationService 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 NewAccountGatewayConfigurationService(opts ...option.RequestOption) (r *AccountGatewayConfigurationService) { + r = &AccountGatewayConfigurationService{} + r.Options = opts + return +} + +// Fetches the current Zero Trust account configuration. +func (r *AccountGatewayConfigurationService) ZeroTrustAccountsGetZeroTrustAccountConfiguration(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/configuration", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Patches the current Zero Trust account configuration. This endpoint can update a +// single subcollection of settings such as `antivirus`, `tls_decrypt`, +// `activity_log`, `block_page`, `browser_isolation`, `fips`, `body_scanning`, or +// `custom_certificate`, without updating the entire configuration object. Returns +// an error if any collection of settings is not properly configured. +func (r *AccountGatewayConfigurationService) ZeroTrustAccountsPatchZeroTrustAccountConfiguration(ctx context.Context, identifier interface{}, body AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParams, opts ...option.RequestOption) (res *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/configuration", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Updates the current Zero Trust account configuration. +func (r *AccountGatewayConfigurationService) ZeroTrustAccountsUpdateZeroTrustAccountConfiguration(ctx context.Context, identifier interface{}, body AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParams, opts ...option.RequestOption) (res *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/configuration", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponse struct { + Errors []AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseError `json:"errors"` + Messages []AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseMessage `json:"messages"` + Result AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseSuccess `json:"success"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponse] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseErrorJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseError] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseMessageJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseMessage] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResult struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // account settings. + Settings AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettings `json:"settings"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResult] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultJSON struct { + CreatedAt apijson.Field + Settings apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// account settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettings struct { + // Activity log settings. + ActivityLog AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsActivityLog `json:"activity_log"` + // Anti-virus settings. + Antivirus AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsAntivirus `json:"antivirus"` + // Block page layout settings. + BlockPage AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBlockPage `json:"block_page"` + // DLP body scanning settings. + BodyScanning AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBodyScanning `json:"body_scanning"` + // Browser isolation settings. + BrowserIsolation AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation `json:"browser_isolation"` + // Custom certificate settings for BYO-PKI. + CustomCertificate AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate `json:"custom_certificate"` + // FIPS settings. + Fips AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsFips `json:"fips"` + // Protocol Detection settings. + ProtocolDetection AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection `json:"protocol_detection"` + // TLS interception settings. + TlsDecrypt AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt `json:"tls_decrypt"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettings] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsJSON struct { + ActivityLog apijson.Field + Antivirus apijson.Field + BlockPage apijson.Field + BodyScanning apijson.Field + BrowserIsolation apijson.Field + CustomCertificate apijson.Field + Fips apijson.Field + ProtocolDetection apijson.Field + TlsDecrypt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Activity log settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsActivityLog struct { + // Enable activity logging. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsActivityLog] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsActivityLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Anti-virus settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsAntivirus struct { + // Enable anti-virus scanning on downloads. + EnabledDownloadPhase bool `json:"enabled_download_phase"` + // Enable anti-virus scanning on uploads. + EnabledUploadPhase bool `json:"enabled_upload_phase"` + // Block requests for files that cannot be scanned. + FailClosed bool `json:"fail_closed"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsAntivirus] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON struct { + EnabledDownloadPhase apijson.Field + EnabledUploadPhase apijson.Field + FailClosed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsAntivirus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Block page layout settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBlockPage struct { + // Block page background color in #rrggbb format. + BackgroundColor string `json:"background_color"` + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Enabled bool `json:"enabled"` + // Block page footer text. + FooterText string `json:"footer_text"` + // Block page header text. + HeaderText string `json:"header_text"` + // Full URL to the logo file. + LogoPath string `json:"logo_path"` + // Admin email for users to contact. + MailtoAddress string `json:"mailto_address"` + // Subject line for emails created from block page. + MailtoSubject string `json:"mailto_subject"` + // Block page title. + Name string `json:"name"` + // Suppress detailed info at the bottom of the block page. + SuppressFooter bool `json:"suppress_footer"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBlockPage] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON struct { + BackgroundColor apijson.Field + Enabled apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + MailtoAddress apijson.Field + MailtoSubject apijson.Field + Name apijson.Field + SuppressFooter apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBlockPage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DLP body scanning settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBodyScanning struct { + // Set the inspection mode to either `deep` or `shallow`. + InspectionMode string `json:"inspection_mode"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBodyScanning] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON struct { + InspectionMode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBodyScanning) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Browser isolation settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation struct { + // Enable non-identity onramp support for Browser Isolation. + NonIdentityEnabled bool `json:"non_identity_enabled"` + // Enable Clientless Browser Isolation. + URLBrowserIsolationEnabled bool `json:"url_browser_isolation_enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON struct { + NonIdentityEnabled apijson.Field + URLBrowserIsolationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Custom certificate settings for BYO-PKI. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate struct { + // Enable use of custom certificate authority for signing Gateway traffic. + Enabled bool `json:"enabled,required"` + // UUID of certificate (ID from MTLS certificate store). + ID string `json:"id"` + // Certificate status (internal). + BindingStatus string `json:"binding_status"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON struct { + Enabled apijson.Field + ID apijson.Field + BindingStatus apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// FIPS settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsFips struct { + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Tls bool `json:"tls"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsFipsJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsFipsJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsFips] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsFipsJSON struct { + Tls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsFips) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Protocol Detection settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection struct { + // Enable detecting protocol on initial bytes of client traffic. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// TLS interception settings. +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt struct { + // Enable inspecting encrypted HTTP traffic. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt] +type accountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseSuccess bool + +const ( + AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseSuccessTrue AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponseSuccess = true +) + +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponse struct { + Errors []AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseError `json:"errors"` + Messages []AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseMessage `json:"messages"` + Result AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseSuccess `json:"success"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponse] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseErrorJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseError] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseMessageJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseMessage] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResult struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // account settings. + Settings AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettings `json:"settings"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResult] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultJSON struct { + CreatedAt apijson.Field + Settings apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// account settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettings struct { + // Activity log settings. + ActivityLog AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsActivityLog `json:"activity_log"` + // Anti-virus settings. + Antivirus AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsAntivirus `json:"antivirus"` + // Block page layout settings. + BlockPage AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBlockPage `json:"block_page"` + // DLP body scanning settings. + BodyScanning AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBodyScanning `json:"body_scanning"` + // Browser isolation settings. + BrowserIsolation AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation `json:"browser_isolation"` + // Custom certificate settings for BYO-PKI. + CustomCertificate AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate `json:"custom_certificate"` + // FIPS settings. + Fips AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsFips `json:"fips"` + // Protocol Detection settings. + ProtocolDetection AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection `json:"protocol_detection"` + // TLS interception settings. + TlsDecrypt AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt `json:"tls_decrypt"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettings] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsJSON struct { + ActivityLog apijson.Field + Antivirus apijson.Field + BlockPage apijson.Field + BodyScanning apijson.Field + BrowserIsolation apijson.Field + CustomCertificate apijson.Field + Fips apijson.Field + ProtocolDetection apijson.Field + TlsDecrypt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Activity log settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsActivityLog struct { + // Enable activity logging. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsActivityLog] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsActivityLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Anti-virus settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsAntivirus struct { + // Enable anti-virus scanning on downloads. + EnabledDownloadPhase bool `json:"enabled_download_phase"` + // Enable anti-virus scanning on uploads. + EnabledUploadPhase bool `json:"enabled_upload_phase"` + // Block requests for files that cannot be scanned. + FailClosed bool `json:"fail_closed"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsAntivirus] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON struct { + EnabledDownloadPhase apijson.Field + EnabledUploadPhase apijson.Field + FailClosed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsAntivirus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Block page layout settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBlockPage struct { + // Block page background color in #rrggbb format. + BackgroundColor string `json:"background_color"` + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Enabled bool `json:"enabled"` + // Block page footer text. + FooterText string `json:"footer_text"` + // Block page header text. + HeaderText string `json:"header_text"` + // Full URL to the logo file. + LogoPath string `json:"logo_path"` + // Admin email for users to contact. + MailtoAddress string `json:"mailto_address"` + // Subject line for emails created from block page. + MailtoSubject string `json:"mailto_subject"` + // Block page title. + Name string `json:"name"` + // Suppress detailed info at the bottom of the block page. + SuppressFooter bool `json:"suppress_footer"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBlockPage] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON struct { + BackgroundColor apijson.Field + Enabled apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + MailtoAddress apijson.Field + MailtoSubject apijson.Field + Name apijson.Field + SuppressFooter apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBlockPage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DLP body scanning settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBodyScanning struct { + // Set the inspection mode to either `deep` or `shallow`. + InspectionMode string `json:"inspection_mode"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBodyScanning] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON struct { + InspectionMode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBodyScanning) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Browser isolation settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation struct { + // Enable non-identity onramp support for Browser Isolation. + NonIdentityEnabled bool `json:"non_identity_enabled"` + // Enable Clientless Browser Isolation. + URLBrowserIsolationEnabled bool `json:"url_browser_isolation_enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON struct { + NonIdentityEnabled apijson.Field + URLBrowserIsolationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Custom certificate settings for BYO-PKI. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate struct { + // Enable use of custom certificate authority for signing Gateway traffic. + Enabled bool `json:"enabled,required"` + // UUID of certificate (ID from MTLS certificate store). + ID string `json:"id"` + // Certificate status (internal). + BindingStatus string `json:"binding_status"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON struct { + Enabled apijson.Field + ID apijson.Field + BindingStatus apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// FIPS settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsFips struct { + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Tls bool `json:"tls"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsFipsJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsFipsJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsFips] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsFipsJSON struct { + Tls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsFips) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Protocol Detection settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection struct { + // Enable detecting protocol on initial bytes of client traffic. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// TLS interception settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt struct { + // Enable inspecting encrypted HTTP traffic. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt] +type accountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseSuccess bool + +const ( + AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseSuccessTrue AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponseSuccess = true +) + +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponse struct { + Errors []AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseError `json:"errors"` + Messages []AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseMessage `json:"messages"` + Result AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseSuccess `json:"success"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponse] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseErrorJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseError] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseMessageJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseMessage] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResult struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // account settings. + Settings AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettings `json:"settings"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResult] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultJSON struct { + CreatedAt apijson.Field + Settings apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// account settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettings struct { + // Activity log settings. + ActivityLog AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsActivityLog `json:"activity_log"` + // Anti-virus settings. + Antivirus AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsAntivirus `json:"antivirus"` + // Block page layout settings. + BlockPage AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBlockPage `json:"block_page"` + // DLP body scanning settings. + BodyScanning AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBodyScanning `json:"body_scanning"` + // Browser isolation settings. + BrowserIsolation AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation `json:"browser_isolation"` + // Custom certificate settings for BYO-PKI. + CustomCertificate AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate `json:"custom_certificate"` + // FIPS settings. + Fips AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsFips `json:"fips"` + // Protocol Detection settings. + ProtocolDetection AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection `json:"protocol_detection"` + // TLS interception settings. + TlsDecrypt AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt `json:"tls_decrypt"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettings] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsJSON struct { + ActivityLog apijson.Field + Antivirus apijson.Field + BlockPage apijson.Field + BodyScanning apijson.Field + BrowserIsolation apijson.Field + CustomCertificate apijson.Field + Fips apijson.Field + ProtocolDetection apijson.Field + TlsDecrypt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Activity log settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsActivityLog struct { + // Enable activity logging. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsActivityLog] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsActivityLogJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsActivityLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Anti-virus settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsAntivirus struct { + // Enable anti-virus scanning on downloads. + EnabledDownloadPhase bool `json:"enabled_download_phase"` + // Enable anti-virus scanning on uploads. + EnabledUploadPhase bool `json:"enabled_upload_phase"` + // Block requests for files that cannot be scanned. + FailClosed bool `json:"fail_closed"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsAntivirus] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsAntivirusJSON struct { + EnabledDownloadPhase apijson.Field + EnabledUploadPhase apijson.Field + FailClosed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsAntivirus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Block page layout settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBlockPage struct { + // Block page background color in #rrggbb format. + BackgroundColor string `json:"background_color"` + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Enabled bool `json:"enabled"` + // Block page footer text. + FooterText string `json:"footer_text"` + // Block page header text. + HeaderText string `json:"header_text"` + // Full URL to the logo file. + LogoPath string `json:"logo_path"` + // Admin email for users to contact. + MailtoAddress string `json:"mailto_address"` + // Subject line for emails created from block page. + MailtoSubject string `json:"mailto_subject"` + // Block page title. + Name string `json:"name"` + // Suppress detailed info at the bottom of the block page. + SuppressFooter bool `json:"suppress_footer"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBlockPage] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBlockPageJSON struct { + BackgroundColor apijson.Field + Enabled apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + MailtoAddress apijson.Field + MailtoSubject apijson.Field + Name apijson.Field + SuppressFooter apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBlockPage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DLP body scanning settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBodyScanning struct { + // Set the inspection mode to either `deep` or `shallow`. + InspectionMode string `json:"inspection_mode"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBodyScanning] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBodyScanningJSON struct { + InspectionMode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBodyScanning) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Browser isolation settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation struct { + // Enable non-identity onramp support for Browser Isolation. + NonIdentityEnabled bool `json:"non_identity_enabled"` + // Enable Clientless Browser Isolation. + URLBrowserIsolationEnabled bool `json:"url_browser_isolation_enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolationJSON struct { + NonIdentityEnabled apijson.Field + URLBrowserIsolationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsBrowserIsolation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Custom certificate settings for BYO-PKI. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate struct { + // Enable use of custom certificate authority for signing Gateway traffic. + Enabled bool `json:"enabled,required"` + // UUID of certificate (ID from MTLS certificate store). + ID string `json:"id"` + // Certificate status (internal). + BindingStatus string `json:"binding_status"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsCustomCertificateJSON struct { + Enabled apijson.Field + ID apijson.Field + BindingStatus apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsCustomCertificate) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// FIPS settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsFips struct { + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Tls bool `json:"tls"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsFipsJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsFipsJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsFips] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsFipsJSON struct { + Tls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsFips) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Protocol Detection settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection struct { + // Enable detecting protocol on initial bytes of client traffic. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsProtocolDetectionJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsProtocolDetection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// TLS interception settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt struct { + // Enable inspecting encrypted HTTP traffic. + Enabled bool `json:"enabled"` + JSON accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON `json:"-"` +} + +// accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON +// contains the JSON metadata for the struct +// [AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt] +type accountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsTlsDecryptJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseResultSettingsTlsDecrypt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseSuccess bool + +const ( + AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseSuccessTrue AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponseSuccess = true +) + +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParams struct { + // account settings. + Settings param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettings] `json:"settings"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// account settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettings struct { + // Activity log settings. + ActivityLog param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsActivityLog] `json:"activity_log"` + // Anti-virus settings. + Antivirus param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsAntivirus] `json:"antivirus"` + // Block page layout settings. + BlockPage param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBlockPage] `json:"block_page"` + // DLP body scanning settings. + BodyScanning param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBodyScanning] `json:"body_scanning"` + // Browser isolation settings. + BrowserIsolation param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBrowserIsolation] `json:"browser_isolation"` + // Custom certificate settings for BYO-PKI. + CustomCertificate param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsCustomCertificate] `json:"custom_certificate"` + // FIPS settings. + Fips param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsFips] `json:"fips"` + // Protocol Detection settings. + ProtocolDetection param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsProtocolDetection] `json:"protocol_detection"` + // TLS interception settings. + TlsDecrypt param.Field[AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsTlsDecrypt] `json:"tls_decrypt"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Activity log settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsActivityLog struct { + // Enable activity logging. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsActivityLog) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Anti-virus settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsAntivirus struct { + // Enable anti-virus scanning on downloads. + EnabledDownloadPhase param.Field[bool] `json:"enabled_download_phase"` + // Enable anti-virus scanning on uploads. + EnabledUploadPhase param.Field[bool] `json:"enabled_upload_phase"` + // Block requests for files that cannot be scanned. + FailClosed param.Field[bool] `json:"fail_closed"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsAntivirus) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Block page layout settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBlockPage struct { + // Block page background color in #rrggbb format. + BackgroundColor param.Field[string] `json:"background_color"` + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Enabled param.Field[bool] `json:"enabled"` + // Block page footer text. + FooterText param.Field[string] `json:"footer_text"` + // Block page header text. + HeaderText param.Field[string] `json:"header_text"` + // Full URL to the logo file. + LogoPath param.Field[string] `json:"logo_path"` + // Admin email for users to contact. + MailtoAddress param.Field[string] `json:"mailto_address"` + // Subject line for emails created from block page. + MailtoSubject param.Field[string] `json:"mailto_subject"` + // Block page title. + Name param.Field[string] `json:"name"` + // Suppress detailed info at the bottom of the block page. + SuppressFooter param.Field[bool] `json:"suppress_footer"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBlockPage) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// DLP body scanning settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBodyScanning struct { + // Set the inspection mode to either `deep` or `shallow`. + InspectionMode param.Field[string] `json:"inspection_mode"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBodyScanning) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Browser isolation settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBrowserIsolation struct { + // Enable non-identity onramp support for Browser Isolation. + NonIdentityEnabled param.Field[bool] `json:"non_identity_enabled"` + // Enable Clientless Browser Isolation. + URLBrowserIsolationEnabled param.Field[bool] `json:"url_browser_isolation_enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBrowserIsolation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Custom certificate settings for BYO-PKI. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsCustomCertificate struct { + // Enable use of custom certificate authority for signing Gateway traffic. + Enabled param.Field[bool] `json:"enabled,required"` + // UUID of certificate (ID from MTLS certificate store). + ID param.Field[string] `json:"id"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsCustomCertificate) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// FIPS settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsFips struct { + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Tls param.Field[bool] `json:"tls"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsFips) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Protocol Detection settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsProtocolDetection struct { + // Enable detecting protocol on initial bytes of client traffic. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsProtocolDetection) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// TLS interception settings. +type AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsTlsDecrypt struct { + // Enable inspecting encrypted HTTP traffic. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsTlsDecrypt) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParams struct { + // account settings. + Settings param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettings] `json:"settings"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// account settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettings struct { + // Activity log settings. + ActivityLog param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsActivityLog] `json:"activity_log"` + // Anti-virus settings. + Antivirus param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsAntivirus] `json:"antivirus"` + // Block page layout settings. + BlockPage param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBlockPage] `json:"block_page"` + // DLP body scanning settings. + BodyScanning param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBodyScanning] `json:"body_scanning"` + // Browser isolation settings. + BrowserIsolation param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBrowserIsolation] `json:"browser_isolation"` + // Custom certificate settings for BYO-PKI. + CustomCertificate param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsCustomCertificate] `json:"custom_certificate"` + // FIPS settings. + Fips param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsFips] `json:"fips"` + // Protocol Detection settings. + ProtocolDetection param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsProtocolDetection] `json:"protocol_detection"` + // TLS interception settings. + TlsDecrypt param.Field[AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsTlsDecrypt] `json:"tls_decrypt"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Activity log settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsActivityLog struct { + // Enable activity logging. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsActivityLog) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Anti-virus settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsAntivirus struct { + // Enable anti-virus scanning on downloads. + EnabledDownloadPhase param.Field[bool] `json:"enabled_download_phase"` + // Enable anti-virus scanning on uploads. + EnabledUploadPhase param.Field[bool] `json:"enabled_upload_phase"` + // Block requests for files that cannot be scanned. + FailClosed param.Field[bool] `json:"fail_closed"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsAntivirus) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Block page layout settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBlockPage struct { + // Block page background color in #rrggbb format. + BackgroundColor param.Field[string] `json:"background_color"` + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Enabled param.Field[bool] `json:"enabled"` + // Block page footer text. + FooterText param.Field[string] `json:"footer_text"` + // Block page header text. + HeaderText param.Field[string] `json:"header_text"` + // Full URL to the logo file. + LogoPath param.Field[string] `json:"logo_path"` + // Admin email for users to contact. + MailtoAddress param.Field[string] `json:"mailto_address"` + // Subject line for emails created from block page. + MailtoSubject param.Field[string] `json:"mailto_subject"` + // Block page title. + Name param.Field[string] `json:"name"` + // Suppress detailed info at the bottom of the block page. + SuppressFooter param.Field[bool] `json:"suppress_footer"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBlockPage) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// DLP body scanning settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBodyScanning struct { + // Set the inspection mode to either `deep` or `shallow`. + InspectionMode param.Field[string] `json:"inspection_mode"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBodyScanning) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Browser isolation settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBrowserIsolation struct { + // Enable non-identity onramp support for Browser Isolation. + NonIdentityEnabled param.Field[bool] `json:"non_identity_enabled"` + // Enable Clientless Browser Isolation. + URLBrowserIsolationEnabled param.Field[bool] `json:"url_browser_isolation_enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBrowserIsolation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Custom certificate settings for BYO-PKI. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsCustomCertificate struct { + // Enable use of custom certificate authority for signing Gateway traffic. + Enabled param.Field[bool] `json:"enabled,required"` + // UUID of certificate (ID from MTLS certificate store). + ID param.Field[string] `json:"id"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsCustomCertificate) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// FIPS settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsFips struct { + // Enable only cipher suites and TLS versions compliant with FIPS 140-2. + Tls param.Field[bool] `json:"tls"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsFips) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Protocol Detection settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsProtocolDetection struct { + // Enable detecting protocol on initial bytes of client traffic. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsProtocolDetection) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// TLS interception settings. +type AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsTlsDecrypt struct { + // Enable inspecting encrypted HTTP traffic. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsTlsDecrypt) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgatewayconfiguration_test.go b/accountgatewayconfiguration_test.go new file mode 100644 index 00000000000..c39029071b4 --- /dev/null +++ b/accountgatewayconfiguration_test.go @@ -0,0 +1,184 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Configurations.ZeroTrustAccountsGetZeroTrustAccountConfiguration(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Configurations.ZeroTrustAccountsPatchZeroTrustAccountConfiguration( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParams{ + Settings: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettings{ + ActivityLog: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsActivityLog{ + Enabled: cloudflare.F(true), + }), + Antivirus: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsAntivirus{ + EnabledDownloadPhase: cloudflare.F(false), + EnabledUploadPhase: cloudflare.F(false), + FailClosed: cloudflare.F(false), + }), + BlockPage: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBlockPage{ + BackgroundColor: cloudflare.F("string"), + Enabled: cloudflare.F(true), + FooterText: cloudflare.F("--footer--"), + HeaderText: cloudflare.F("--header--"), + LogoPath: cloudflare.F("https://logos.com/a.png"), + MailtoAddress: cloudflare.F("admin@example.com"), + MailtoSubject: cloudflare.F("Blocked User Inquiry"), + Name: cloudflare.F("Cloudflare"), + SuppressFooter: cloudflare.F(false), + }), + BodyScanning: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBodyScanning{ + InspectionMode: cloudflare.F("deep"), + }), + BrowserIsolation: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsBrowserIsolation{ + NonIdentityEnabled: cloudflare.F(true), + URLBrowserIsolationEnabled: cloudflare.F(true), + }), + CustomCertificate: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsCustomCertificate{ + Enabled: cloudflare.F(true), + ID: cloudflare.F("d1b364c5-1311-466e-a194-f0e943e0799f"), + }), + Fips: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsFips{ + Tls: cloudflare.F(true), + }), + ProtocolDetection: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsProtocolDetection{ + Enabled: cloudflare.F(true), + }), + TlsDecrypt: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParamsSettingsTlsDecrypt{ + Enabled: cloudflare.F(true), + }), + }), + }, + ) + 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 TestAccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Configurations.ZeroTrustAccountsUpdateZeroTrustAccountConfiguration( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParams{ + Settings: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettings{ + ActivityLog: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsActivityLog{ + Enabled: cloudflare.F(true), + }), + Antivirus: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsAntivirus{ + EnabledDownloadPhase: cloudflare.F(false), + EnabledUploadPhase: cloudflare.F(false), + FailClosed: cloudflare.F(false), + }), + BlockPage: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBlockPage{ + BackgroundColor: cloudflare.F("string"), + Enabled: cloudflare.F(true), + FooterText: cloudflare.F("--footer--"), + HeaderText: cloudflare.F("--header--"), + LogoPath: cloudflare.F("https://logos.com/a.png"), + MailtoAddress: cloudflare.F("admin@example.com"), + MailtoSubject: cloudflare.F("Blocked User Inquiry"), + Name: cloudflare.F("Cloudflare"), + SuppressFooter: cloudflare.F(false), + }), + BodyScanning: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBodyScanning{ + InspectionMode: cloudflare.F("deep"), + }), + BrowserIsolation: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsBrowserIsolation{ + NonIdentityEnabled: cloudflare.F(true), + URLBrowserIsolationEnabled: cloudflare.F(true), + }), + CustomCertificate: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsCustomCertificate{ + Enabled: cloudflare.F(true), + ID: cloudflare.F("d1b364c5-1311-466e-a194-f0e943e0799f"), + }), + Fips: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsFips{ + Tls: cloudflare.F(true), + }), + ProtocolDetection: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsProtocolDetection{ + Enabled: cloudflare.F(true), + }), + TlsDecrypt: cloudflare.F(cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParamsSettingsTlsDecrypt{ + Enabled: cloudflare.F(true), + }), + }), + }, + ) + 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/accountgatewaylist.go b/accountgatewaylist.go new file mode 100644 index 00000000000..a8935a63f0e --- /dev/null +++ b/accountgatewaylist.go @@ -0,0 +1,847 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayListService 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 [NewAccountGatewayListService] method +// instead. +type AccountGatewayListService struct { + Options []option.RequestOption + Items *AccountGatewayListItemService +} + +// NewAccountGatewayListService 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 NewAccountGatewayListService(opts ...option.RequestOption) (r *AccountGatewayListService) { + r = &AccountGatewayListService{} + r.Options = opts + r.Items = NewAccountGatewayListItemService(opts...) + return +} + +// Fetches a single Zero Trust list. +func (r *AccountGatewayListService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountGatewayListGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/lists/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured Zero Trust list. +func (r *AccountGatewayListService) Update(ctx context.Context, identifier interface{}, uuid string, body AccountGatewayListUpdateParams, opts ...option.RequestOption) (res *AccountGatewayListUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/lists/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a Zero Trust list. +func (r *AccountGatewayListService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountGatewayListDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/lists/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Appends or removes an item from a configured Zero Trust list. +func (r *AccountGatewayListService) Patch(ctx context.Context, identifier interface{}, uuid string, body AccountGatewayListPatchParams, opts ...option.RequestOption) (res *AccountGatewayListPatchResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/lists/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Creates a new Zero Trust list. +func (r *AccountGatewayListService) ZeroTrustListsNewZeroTrustList(ctx context.Context, identifier interface{}, body AccountGatewayListZeroTrustListsNewZeroTrustListParams, opts ...option.RequestOption) (res *AccountGatewayListZeroTrustListsNewZeroTrustListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/lists", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches all Zero Trust lists for an account. +func (r *AccountGatewayListService) ZeroTrustListsListZeroTrustLists(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayListZeroTrustListsListZeroTrustListsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/lists", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayListGetResponse struct { + Errors []AccountGatewayListGetResponseError `json:"errors"` + Messages []AccountGatewayListGetResponseMessage `json:"messages"` + Result AccountGatewayListGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayListGetResponseSuccess `json:"success"` + JSON accountGatewayListGetResponseJSON `json:"-"` +} + +// accountGatewayListGetResponseJSON contains the JSON metadata for the struct +// [AccountGatewayListGetResponse] +type accountGatewayListGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListGetResponseErrorJSON `json:"-"` +} + +// accountGatewayListGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountGatewayListGetResponseError] +type accountGatewayListGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListGetResponseMessageJSON `json:"-"` +} + +// accountGatewayListGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayListGetResponseMessage] +type accountGatewayListGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListGetResponseResult struct { + // API Resource UUID tag. + ID string `json:"id"` + // The number of items in the list. + Count float64 `json:"count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the list. + Description string `json:"description"` + // The name of the list. + Name string `json:"name"` + // The type of list. + Type AccountGatewayListGetResponseResultType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayListGetResponseResultJSON `json:"-"` +} + +// accountGatewayListGetResponseResultJSON contains the JSON metadata for the +// struct [AccountGatewayListGetResponseResult] +type accountGatewayListGetResponseResultJSON struct { + ID apijson.Field + Count apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of list. +type AccountGatewayListGetResponseResultType string + +const ( + AccountGatewayListGetResponseResultTypeSerial AccountGatewayListGetResponseResultType = "SERIAL" + AccountGatewayListGetResponseResultTypeURL AccountGatewayListGetResponseResultType = "URL" + AccountGatewayListGetResponseResultTypeDomain AccountGatewayListGetResponseResultType = "DOMAIN" + AccountGatewayListGetResponseResultTypeEmail AccountGatewayListGetResponseResultType = "EMAIL" + AccountGatewayListGetResponseResultTypeIP AccountGatewayListGetResponseResultType = "IP" +) + +// Whether the API call was successful +type AccountGatewayListGetResponseSuccess bool + +const ( + AccountGatewayListGetResponseSuccessTrue AccountGatewayListGetResponseSuccess = true +) + +type AccountGatewayListUpdateResponse struct { + Errors []AccountGatewayListUpdateResponseError `json:"errors"` + Messages []AccountGatewayListUpdateResponseMessage `json:"messages"` + Result AccountGatewayListUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayListUpdateResponseSuccess `json:"success"` + JSON accountGatewayListUpdateResponseJSON `json:"-"` +} + +// accountGatewayListUpdateResponseJSON contains the JSON metadata for the struct +// [AccountGatewayListUpdateResponse] +type accountGatewayListUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListUpdateResponseErrorJSON `json:"-"` +} + +// accountGatewayListUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayListUpdateResponseError] +type accountGatewayListUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListUpdateResponseMessageJSON `json:"-"` +} + +// accountGatewayListUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayListUpdateResponseMessage] +type accountGatewayListUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListUpdateResponseResult struct { + // API Resource UUID tag. + ID string `json:"id"` + // The number of items in the list. + Count float64 `json:"count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the list. + Description string `json:"description"` + // The name of the list. + Name string `json:"name"` + // The type of list. + Type AccountGatewayListUpdateResponseResultType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayListUpdateResponseResultJSON `json:"-"` +} + +// accountGatewayListUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountGatewayListUpdateResponseResult] +type accountGatewayListUpdateResponseResultJSON struct { + ID apijson.Field + Count apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of list. +type AccountGatewayListUpdateResponseResultType string + +const ( + AccountGatewayListUpdateResponseResultTypeSerial AccountGatewayListUpdateResponseResultType = "SERIAL" + AccountGatewayListUpdateResponseResultTypeURL AccountGatewayListUpdateResponseResultType = "URL" + AccountGatewayListUpdateResponseResultTypeDomain AccountGatewayListUpdateResponseResultType = "DOMAIN" + AccountGatewayListUpdateResponseResultTypeEmail AccountGatewayListUpdateResponseResultType = "EMAIL" + AccountGatewayListUpdateResponseResultTypeIP AccountGatewayListUpdateResponseResultType = "IP" +) + +// Whether the API call was successful +type AccountGatewayListUpdateResponseSuccess bool + +const ( + AccountGatewayListUpdateResponseSuccessTrue AccountGatewayListUpdateResponseSuccess = true +) + +type AccountGatewayListDeleteResponse struct { + Errors []AccountGatewayListDeleteResponseError `json:"errors"` + Messages []AccountGatewayListDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountGatewayListDeleteResponseSuccess `json:"success"` + JSON accountGatewayListDeleteResponseJSON `json:"-"` +} + +// accountGatewayListDeleteResponseJSON contains the JSON metadata for the struct +// [AccountGatewayListDeleteResponse] +type accountGatewayListDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListDeleteResponseErrorJSON `json:"-"` +} + +// accountGatewayListDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayListDeleteResponseError] +type accountGatewayListDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListDeleteResponseMessageJSON `json:"-"` +} + +// accountGatewayListDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayListDeleteResponseMessage] +type accountGatewayListDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayListDeleteResponseSuccess bool + +const ( + AccountGatewayListDeleteResponseSuccessTrue AccountGatewayListDeleteResponseSuccess = true +) + +type AccountGatewayListPatchResponse struct { + Errors []AccountGatewayListPatchResponseError `json:"errors"` + Messages []AccountGatewayListPatchResponseMessage `json:"messages"` + Result AccountGatewayListPatchResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayListPatchResponseSuccess `json:"success"` + JSON accountGatewayListPatchResponseJSON `json:"-"` +} + +// accountGatewayListPatchResponseJSON contains the JSON metadata for the struct +// [AccountGatewayListPatchResponse] +type accountGatewayListPatchResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListPatchResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListPatchResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListPatchResponseErrorJSON `json:"-"` +} + +// accountGatewayListPatchResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayListPatchResponseError] +type accountGatewayListPatchResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListPatchResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListPatchResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListPatchResponseMessageJSON `json:"-"` +} + +// accountGatewayListPatchResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayListPatchResponseMessage] +type accountGatewayListPatchResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListPatchResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListPatchResponseResult struct { + // API Resource UUID tag. + ID string `json:"id"` + // The number of items in the list. + Count float64 `json:"count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the list. + Description string `json:"description"` + // The name of the list. + Name string `json:"name"` + // The type of list. + Type AccountGatewayListPatchResponseResultType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayListPatchResponseResultJSON `json:"-"` +} + +// accountGatewayListPatchResponseResultJSON contains the JSON metadata for the +// struct [AccountGatewayListPatchResponseResult] +type accountGatewayListPatchResponseResultJSON struct { + ID apijson.Field + Count apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListPatchResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of list. +type AccountGatewayListPatchResponseResultType string + +const ( + AccountGatewayListPatchResponseResultTypeSerial AccountGatewayListPatchResponseResultType = "SERIAL" + AccountGatewayListPatchResponseResultTypeURL AccountGatewayListPatchResponseResultType = "URL" + AccountGatewayListPatchResponseResultTypeDomain AccountGatewayListPatchResponseResultType = "DOMAIN" + AccountGatewayListPatchResponseResultTypeEmail AccountGatewayListPatchResponseResultType = "EMAIL" + AccountGatewayListPatchResponseResultTypeIP AccountGatewayListPatchResponseResultType = "IP" +) + +// Whether the API call was successful +type AccountGatewayListPatchResponseSuccess bool + +const ( + AccountGatewayListPatchResponseSuccessTrue AccountGatewayListPatchResponseSuccess = true +) + +type AccountGatewayListZeroTrustListsNewZeroTrustListResponse struct { + Errors []AccountGatewayListZeroTrustListsNewZeroTrustListResponseError `json:"errors"` + Messages []AccountGatewayListZeroTrustListsNewZeroTrustListResponseMessage `json:"messages"` + Result AccountGatewayListZeroTrustListsNewZeroTrustListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayListZeroTrustListsNewZeroTrustListResponseSuccess `json:"success"` + JSON accountGatewayListZeroTrustListsNewZeroTrustListResponseJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsNewZeroTrustListResponseJSON contains the JSON +// metadata for the struct +// [AccountGatewayListZeroTrustListsNewZeroTrustListResponse] +type accountGatewayListZeroTrustListsNewZeroTrustListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsNewZeroTrustListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListZeroTrustListsNewZeroTrustListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListZeroTrustListsNewZeroTrustListResponseErrorJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsNewZeroTrustListResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountGatewayListZeroTrustListsNewZeroTrustListResponseError] +type accountGatewayListZeroTrustListsNewZeroTrustListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsNewZeroTrustListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListZeroTrustListsNewZeroTrustListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListZeroTrustListsNewZeroTrustListResponseMessageJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsNewZeroTrustListResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountGatewayListZeroTrustListsNewZeroTrustListResponseMessage] +type accountGatewayListZeroTrustListsNewZeroTrustListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsNewZeroTrustListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListZeroTrustListsNewZeroTrustListResponseResult struct { + // API Resource UUID tag. + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the list. + Description string `json:"description"` + // The items in the list. + Items []AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultItem `json:"items"` + // The name of the list. + Name string `json:"name"` + // The type of list. + Type AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayListZeroTrustListsNewZeroTrustListResponseResultJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsNewZeroTrustListResponseResultJSON contains the +// JSON metadata for the struct +// [AccountGatewayListZeroTrustListsNewZeroTrustListResponseResult] +type accountGatewayListZeroTrustListsNewZeroTrustListResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Items apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsNewZeroTrustListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultItem struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The value of the item in a list. + Value string `json:"value"` + JSON accountGatewayListZeroTrustListsNewZeroTrustListResponseResultItemJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsNewZeroTrustListResponseResultItemJSON contains +// the JSON metadata for the struct +// [AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultItem] +type accountGatewayListZeroTrustListsNewZeroTrustListResponseResultItemJSON struct { + CreatedAt apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultItem) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of list. +type AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultType string + +const ( + AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultTypeSerial AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultType = "SERIAL" + AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultTypeURL AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultType = "URL" + AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultTypeDomain AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultType = "DOMAIN" + AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultTypeEmail AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultType = "EMAIL" + AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultTypeIP AccountGatewayListZeroTrustListsNewZeroTrustListResponseResultType = "IP" +) + +// Whether the API call was successful +type AccountGatewayListZeroTrustListsNewZeroTrustListResponseSuccess bool + +const ( + AccountGatewayListZeroTrustListsNewZeroTrustListResponseSuccessTrue AccountGatewayListZeroTrustListsNewZeroTrustListResponseSuccess = true +) + +type AccountGatewayListZeroTrustListsListZeroTrustListsResponse struct { + Errors []AccountGatewayListZeroTrustListsListZeroTrustListsResponseError `json:"errors"` + Messages []AccountGatewayListZeroTrustListsListZeroTrustListsResponseMessage `json:"messages"` + Result []AccountGatewayListZeroTrustListsListZeroTrustListsResponseResult `json:"result"` + ResultInfo AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountGatewayListZeroTrustListsListZeroTrustListsResponseSuccess `json:"success"` + JSON accountGatewayListZeroTrustListsListZeroTrustListsResponseJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsListZeroTrustListsResponseJSON contains the JSON +// metadata for the struct +// [AccountGatewayListZeroTrustListsListZeroTrustListsResponse] +type accountGatewayListZeroTrustListsListZeroTrustListsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsListZeroTrustListsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListZeroTrustListsListZeroTrustListsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListZeroTrustListsListZeroTrustListsResponseErrorJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsListZeroTrustListsResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountGatewayListZeroTrustListsListZeroTrustListsResponseError] +type accountGatewayListZeroTrustListsListZeroTrustListsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsListZeroTrustListsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListZeroTrustListsListZeroTrustListsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListZeroTrustListsListZeroTrustListsResponseMessageJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsListZeroTrustListsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountGatewayListZeroTrustListsListZeroTrustListsResponseMessage] +type accountGatewayListZeroTrustListsListZeroTrustListsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsListZeroTrustListsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListZeroTrustListsListZeroTrustListsResponseResult struct { + // API Resource UUID tag. + ID string `json:"id"` + // The number of items in the list. + Count float64 `json:"count"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The description of the list. + Description string `json:"description"` + // The name of the list. + Name string `json:"name"` + // The type of list. + Type AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultType `json:"type"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayListZeroTrustListsListZeroTrustListsResponseResultJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsListZeroTrustListsResponseResultJSON contains +// the JSON metadata for the struct +// [AccountGatewayListZeroTrustListsListZeroTrustListsResponseResult] +type accountGatewayListZeroTrustListsListZeroTrustListsResponseResultJSON struct { + ID apijson.Field + Count apijson.Field + CreatedAt apijson.Field + Description apijson.Field + Name apijson.Field + Type apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsListZeroTrustListsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of list. +type AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultType string + +const ( + AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultTypeSerial AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultType = "SERIAL" + AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultTypeURL AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultType = "URL" + AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultTypeDomain AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultType = "DOMAIN" + AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultTypeEmail AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultType = "EMAIL" + AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultTypeIP AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultType = "IP" +) + +type AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountGatewayListZeroTrustListsListZeroTrustListsResponseResultInfoJSON `json:"-"` +} + +// accountGatewayListZeroTrustListsListZeroTrustListsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultInfo] +type accountGatewayListZeroTrustListsListZeroTrustListsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListZeroTrustListsListZeroTrustListsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayListZeroTrustListsListZeroTrustListsResponseSuccess bool + +const ( + AccountGatewayListZeroTrustListsListZeroTrustListsResponseSuccessTrue AccountGatewayListZeroTrustListsListZeroTrustListsResponseSuccess = true +) + +type AccountGatewayListUpdateParams struct { + // The name of the list. + Name param.Field[string] `json:"name,required"` + // The description of the list. + Description param.Field[string] `json:"description"` +} + +func (r AccountGatewayListUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayListPatchParams struct { + // The items in the list. + Append param.Field[[]AccountGatewayListPatchParamsAppend] `json:"append"` + // A list of the item values you want to remove. + Remove param.Field[[]string] `json:"remove"` +} + +func (r AccountGatewayListPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayListPatchParamsAppend struct { + // The value of the item in a list. + Value param.Field[string] `json:"value"` +} + +func (r AccountGatewayListPatchParamsAppend) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayListZeroTrustListsNewZeroTrustListParams struct { + // The name of the list. + Name param.Field[string] `json:"name,required"` + // The type of list. + Type param.Field[AccountGatewayListZeroTrustListsNewZeroTrustListParamsType] `json:"type,required"` + // The description of the list. + Description param.Field[string] `json:"description"` + // The items in the list. + Items param.Field[[]AccountGatewayListZeroTrustListsNewZeroTrustListParamsItem] `json:"items"` +} + +func (r AccountGatewayListZeroTrustListsNewZeroTrustListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of list. +type AccountGatewayListZeroTrustListsNewZeroTrustListParamsType string + +const ( + AccountGatewayListZeroTrustListsNewZeroTrustListParamsTypeSerial AccountGatewayListZeroTrustListsNewZeroTrustListParamsType = "SERIAL" + AccountGatewayListZeroTrustListsNewZeroTrustListParamsTypeURL AccountGatewayListZeroTrustListsNewZeroTrustListParamsType = "URL" + AccountGatewayListZeroTrustListsNewZeroTrustListParamsTypeDomain AccountGatewayListZeroTrustListsNewZeroTrustListParamsType = "DOMAIN" + AccountGatewayListZeroTrustListsNewZeroTrustListParamsTypeEmail AccountGatewayListZeroTrustListsNewZeroTrustListParamsType = "EMAIL" + AccountGatewayListZeroTrustListsNewZeroTrustListParamsTypeIP AccountGatewayListZeroTrustListsNewZeroTrustListParamsType = "IP" +) + +type AccountGatewayListZeroTrustListsNewZeroTrustListParamsItem struct { + // The value of the item in a list. + Value param.Field[string] `json:"value"` +} + +func (r AccountGatewayListZeroTrustListsNewZeroTrustListParamsItem) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgatewaylist_test.go b/accountgatewaylist_test.go new file mode 100644 index 00000000000..b63e06d2e17 --- /dev/null +++ b/accountgatewaylist_test.go @@ -0,0 +1,215 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayListGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Lists.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountGatewayListUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Lists.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountGatewayListUpdateParams{ + Name: cloudflare.F("Admin Serial Numbers"), + Description: cloudflare.F("The serial numbers for administrators"), + }, + ) + 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 TestAccountGatewayListDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Lists.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountGatewayListPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Lists.Patch( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountGatewayListPatchParams{ + Append: cloudflare.F([]cloudflare.AccountGatewayListPatchParamsAppend{{ + Value: cloudflare.F("8GE8721REF"), + }, { + Value: cloudflare.F("8GE8721REF"), + }, { + Value: cloudflare.F("8GE8721REF"), + }}), + Remove: cloudflare.F([]string{"8GE8721REF", "8GE8721REF", "8GE8721REF"}), + }, + ) + 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 TestAccountGatewayListZeroTrustListsNewZeroTrustListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Lists.ZeroTrustListsNewZeroTrustList( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayListZeroTrustListsNewZeroTrustListParams{ + Name: cloudflare.F("Admin Serial Numbers"), + Type: cloudflare.F(cloudflare.AccountGatewayListZeroTrustListsNewZeroTrustListParamsTypeSerial), + Description: cloudflare.F("The serial numbers for administrators"), + Items: cloudflare.F([]cloudflare.AccountGatewayListZeroTrustListsNewZeroTrustListParamsItem{{ + Value: cloudflare.F("8GE8721REF"), + }, { + Value: cloudflare.F("8GE8721REF"), + }, { + Value: cloudflare.F("8GE8721REF"), + }}), + }, + ) + 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 TestAccountGatewayListZeroTrustListsListZeroTrustLists(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Lists.ZeroTrustListsListZeroTrustLists(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountgatewaylistitem.go b/accountgatewaylistitem.go new file mode 100644 index 00000000000..84df6ecfb63 --- /dev/null +++ b/accountgatewaylistitem.go @@ -0,0 +1,163 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayListItemService 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 [NewAccountGatewayListItemService] +// method instead. +type AccountGatewayListItemService struct { + Options []option.RequestOption +} + +// NewAccountGatewayListItemService 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 NewAccountGatewayListItemService(opts ...option.RequestOption) (r *AccountGatewayListItemService) { + r = &AccountGatewayListItemService{} + r.Options = opts + return +} + +// Fetches all items in a single Zero Trust list. +func (r *AccountGatewayListItemService) ZeroTrustListsZeroTrustListItems(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/lists/%s/items", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponse struct { + Errors []AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseError `json:"errors"` + Messages []AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseMessage `json:"messages"` + Result [][]AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResult `json:"result"` + ResultInfo AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseSuccess `json:"success"` + JSON accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseJSON `json:"-"` +} + +// accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseJSON contains the +// JSON metadata for the struct +// [AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponse] +type accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseErrorJSON `json:"-"` +} + +// accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseError] +type accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseMessageJSON `json:"-"` +} + +// accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseMessage] +type accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResult struct { + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The value of the item in a list. + Value string `json:"value"` + JSON accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultJSON `json:"-"` +} + +// accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResult] +type accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultJSON struct { + CreatedAt apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultInfo struct { + // Total results returned based on your search parameters. + Count float64 `json:"count"` + // Current page within paginated list of results. + Page float64 `json:"page"` + // Number of results per page of results. + PerPage float64 `json:"per_page"` + // Total results available without any search parameters. + TotalCount float64 `json:"total_count"` + JSON accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultInfoJSON `json:"-"` +} + +// accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultInfo] +type accountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseSuccess bool + +const ( + AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseSuccessTrue AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponseSuccess = true +) diff --git a/accountgatewaylistitem_test.go b/accountgatewaylistitem_test.go new file mode 100644 index 00000000000..0fcbfc1aa2f --- /dev/null +++ b/accountgatewaylistitem_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayListItemZeroTrustListsZeroTrustListItems(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Lists.Items.ZeroTrustListsZeroTrustListItems( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/accountgatewaylocation.go b/accountgatewaylocation.go new file mode 100644 index 00000000000..9a5cfe87be8 --- /dev/null +++ b/accountgatewaylocation.go @@ -0,0 +1,746 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayLocationService 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 [NewAccountGatewayLocationService] +// method instead. +type AccountGatewayLocationService struct { + Options []option.RequestOption +} + +// NewAccountGatewayLocationService 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 NewAccountGatewayLocationService(opts ...option.RequestOption) (r *AccountGatewayLocationService) { + r = &AccountGatewayLocationService{} + r.Options = opts + return +} + +// Fetches a single Zero Trust Gateway location. +func (r *AccountGatewayLocationService) Get(ctx context.Context, identifier interface{}, uuid interface{}, opts ...option.RequestOption) (res *AccountGatewayLocationGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/locations/%v", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured Zero Trust Gateway location. +func (r *AccountGatewayLocationService) Update(ctx context.Context, identifier interface{}, uuid interface{}, body AccountGatewayLocationUpdateParams, opts ...option.RequestOption) (res *AccountGatewayLocationUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/locations/%v", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a configured Zero Trust Gateway location. +func (r *AccountGatewayLocationService) Delete(ctx context.Context, identifier interface{}, uuid interface{}, opts ...option.RequestOption) (res *AccountGatewayLocationDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/locations/%v", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new Zero Trust Gateway location. +func (r *AccountGatewayLocationService) ZeroTrustGatewayLocationsNewZeroTrustGatewayLocation(ctx context.Context, identifier interface{}, body AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParams, opts ...option.RequestOption) (res *AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/locations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches Zero Trust Gateway locations for an account. +func (r *AccountGatewayLocationService) ZeroTrustGatewayLocationsListZeroTrustGatewayLocations(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/locations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayLocationGetResponse struct { + Errors []AccountGatewayLocationGetResponseError `json:"errors"` + Messages []AccountGatewayLocationGetResponseMessage `json:"messages"` + Result AccountGatewayLocationGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayLocationGetResponseSuccess `json:"success"` + JSON accountGatewayLocationGetResponseJSON `json:"-"` +} + +// accountGatewayLocationGetResponseJSON contains the JSON metadata for the struct +// [AccountGatewayLocationGetResponse] +type accountGatewayLocationGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationGetResponseErrorJSON `json:"-"` +} + +// accountGatewayLocationGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayLocationGetResponseError] +type accountGatewayLocationGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationGetResponseMessageJSON `json:"-"` +} + +// accountGatewayLocationGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayLocationGetResponseMessage] +type accountGatewayLocationGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationGetResponseResult struct { + ID interface{} `json:"id"` + // True if the location is the default location. + ClientDefault bool `json:"client_default"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The DNS over HTTPS domain to send DNS requests to. This field is auto-generated + // by Gateway. + DohSubdomain string `json:"doh_subdomain"` + // True if the location needs to resolve EDNS queries. + EcsSupport bool `json:"ecs_support"` + // IPV6 destination ip assigned to this location. DNS requests sent to this IP will + // counted as the request under this location. This field is auto-generated by + // Gateway. + IP string `json:"ip"` + // The name of the location. + Name string `json:"name"` + // A list of network ranges that requests from this location would originate from. + Networks []AccountGatewayLocationGetResponseResultNetwork `json:"networks"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayLocationGetResponseResultJSON `json:"-"` +} + +// accountGatewayLocationGetResponseResultJSON contains the JSON metadata for the +// struct [AccountGatewayLocationGetResponseResult] +type accountGatewayLocationGetResponseResultJSON struct { + ID apijson.Field + ClientDefault apijson.Field + CreatedAt apijson.Field + DohSubdomain apijson.Field + EcsSupport apijson.Field + IP apijson.Field + Name apijson.Field + Networks apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationGetResponseResultNetwork struct { + // The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24. + Network string `json:"network,required"` + JSON accountGatewayLocationGetResponseResultNetworkJSON `json:"-"` +} + +// accountGatewayLocationGetResponseResultNetworkJSON contains the JSON metadata +// for the struct [AccountGatewayLocationGetResponseResultNetwork] +type accountGatewayLocationGetResponseResultNetworkJSON struct { + Network apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationGetResponseResultNetwork) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayLocationGetResponseSuccess bool + +const ( + AccountGatewayLocationGetResponseSuccessTrue AccountGatewayLocationGetResponseSuccess = true +) + +type AccountGatewayLocationUpdateResponse struct { + Errors []AccountGatewayLocationUpdateResponseError `json:"errors"` + Messages []AccountGatewayLocationUpdateResponseMessage `json:"messages"` + Result AccountGatewayLocationUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayLocationUpdateResponseSuccess `json:"success"` + JSON accountGatewayLocationUpdateResponseJSON `json:"-"` +} + +// accountGatewayLocationUpdateResponseJSON contains the JSON metadata for the +// struct [AccountGatewayLocationUpdateResponse] +type accountGatewayLocationUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationUpdateResponseErrorJSON `json:"-"` +} + +// accountGatewayLocationUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayLocationUpdateResponseError] +type accountGatewayLocationUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationUpdateResponseMessageJSON `json:"-"` +} + +// accountGatewayLocationUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountGatewayLocationUpdateResponseMessage] +type accountGatewayLocationUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationUpdateResponseResult struct { + ID interface{} `json:"id"` + // True if the location is the default location. + ClientDefault bool `json:"client_default"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The DNS over HTTPS domain to send DNS requests to. This field is auto-generated + // by Gateway. + DohSubdomain string `json:"doh_subdomain"` + // True if the location needs to resolve EDNS queries. + EcsSupport bool `json:"ecs_support"` + // IPV6 destination ip assigned to this location. DNS requests sent to this IP will + // counted as the request under this location. This field is auto-generated by + // Gateway. + IP string `json:"ip"` + // The name of the location. + Name string `json:"name"` + // A list of network ranges that requests from this location would originate from. + Networks []AccountGatewayLocationUpdateResponseResultNetwork `json:"networks"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayLocationUpdateResponseResultJSON `json:"-"` +} + +// accountGatewayLocationUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountGatewayLocationUpdateResponseResult] +type accountGatewayLocationUpdateResponseResultJSON struct { + ID apijson.Field + ClientDefault apijson.Field + CreatedAt apijson.Field + DohSubdomain apijson.Field + EcsSupport apijson.Field + IP apijson.Field + Name apijson.Field + Networks apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationUpdateResponseResultNetwork struct { + // The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24. + Network string `json:"network,required"` + JSON accountGatewayLocationUpdateResponseResultNetworkJSON `json:"-"` +} + +// accountGatewayLocationUpdateResponseResultNetworkJSON contains the JSON metadata +// for the struct [AccountGatewayLocationUpdateResponseResultNetwork] +type accountGatewayLocationUpdateResponseResultNetworkJSON struct { + Network apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationUpdateResponseResultNetwork) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayLocationUpdateResponseSuccess bool + +const ( + AccountGatewayLocationUpdateResponseSuccessTrue AccountGatewayLocationUpdateResponseSuccess = true +) + +type AccountGatewayLocationDeleteResponse struct { + Errors []AccountGatewayLocationDeleteResponseError `json:"errors"` + Messages []AccountGatewayLocationDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountGatewayLocationDeleteResponseSuccess `json:"success"` + JSON accountGatewayLocationDeleteResponseJSON `json:"-"` +} + +// accountGatewayLocationDeleteResponseJSON contains the JSON metadata for the +// struct [AccountGatewayLocationDeleteResponse] +type accountGatewayLocationDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationDeleteResponseErrorJSON `json:"-"` +} + +// accountGatewayLocationDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayLocationDeleteResponseError] +type accountGatewayLocationDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationDeleteResponseMessageJSON `json:"-"` +} + +// accountGatewayLocationDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountGatewayLocationDeleteResponseMessage] +type accountGatewayLocationDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayLocationDeleteResponseSuccess bool + +const ( + AccountGatewayLocationDeleteResponseSuccessTrue AccountGatewayLocationDeleteResponseSuccess = true +) + +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponse struct { + Errors []AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseError `json:"errors"` + Messages []AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseMessage `json:"messages"` + Result AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseSuccess `json:"success"` + JSON accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponse] +type accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseErrorJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseError] +type accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseMessageJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseMessage] +type accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResult struct { + ID interface{} `json:"id"` + // True if the location is the default location. + ClientDefault bool `json:"client_default"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The DNS over HTTPS domain to send DNS requests to. This field is auto-generated + // by Gateway. + DohSubdomain string `json:"doh_subdomain"` + // True if the location needs to resolve EDNS queries. + EcsSupport bool `json:"ecs_support"` + // IPV6 destination ip assigned to this location. DNS requests sent to this IP will + // counted as the request under this location. This field is auto-generated by + // Gateway. + IP string `json:"ip"` + // The name of the location. + Name string `json:"name"` + // A list of network ranges that requests from this location would originate from. + Networks []AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultNetwork `json:"networks"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResult] +type accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultJSON struct { + ID apijson.Field + ClientDefault apijson.Field + CreatedAt apijson.Field + DohSubdomain apijson.Field + EcsSupport apijson.Field + IP apijson.Field + Name apijson.Field + Networks apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultNetwork struct { + // The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24. + Network string `json:"network,required"` + JSON accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultNetworkJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultNetworkJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultNetwork] +type accountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultNetworkJSON struct { + Network apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseResultNetwork) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseSuccess bool + +const ( + AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseSuccessTrue AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponseSuccess = true +) + +type AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponse struct { + Errors []AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseError `json:"errors"` + Messages []AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseMessage `json:"messages"` + Result []AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResult `json:"result"` + ResultInfo AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseSuccess `json:"success"` + JSON accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponse] +type accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseErrorJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseError] +type accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseMessageJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseMessage] +type accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResult struct { + ID interface{} `json:"id"` + // True if the location is the default location. + ClientDefault bool `json:"client_default"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The DNS over HTTPS domain to send DNS requests to. This field is auto-generated + // by Gateway. + DohSubdomain string `json:"doh_subdomain"` + // True if the location needs to resolve EDNS queries. + EcsSupport bool `json:"ecs_support"` + // IPV6 destination ip assigned to this location. DNS requests sent to this IP will + // counted as the request under this location. This field is auto-generated by + // Gateway. + IP string `json:"ip"` + // The name of the location. + Name string `json:"name"` + // A list of network ranges that requests from this location would originate from. + Networks []AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultNetwork `json:"networks"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResult] +type accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultJSON struct { + ID apijson.Field + ClientDefault apijson.Field + CreatedAt apijson.Field + DohSubdomain apijson.Field + EcsSupport apijson.Field + IP apijson.Field + Name apijson.Field + Networks apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultNetwork struct { + // The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24. + Network string `json:"network,required"` + JSON accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultNetworkJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultNetworkJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultNetwork] +type accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultNetworkJSON struct { + Network apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultNetwork) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultInfoJSON `json:"-"` +} + +// accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultInfo] +type accountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseSuccess bool + +const ( + AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseSuccessTrue AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponseSuccess = true +) + +type AccountGatewayLocationUpdateParams struct { + // The name of the location. + Name param.Field[string] `json:"name,required"` + // True if the location is the default location. + ClientDefault param.Field[bool] `json:"client_default"` + // True if the location needs to resolve EDNS queries. + EcsSupport param.Field[bool] `json:"ecs_support"` + // A list of network ranges that requests from this location would originate from. + Networks param.Field[[]AccountGatewayLocationUpdateParamsNetwork] `json:"networks"` +} + +func (r AccountGatewayLocationUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayLocationUpdateParamsNetwork struct { + // The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24. + Network param.Field[string] `json:"network,required"` +} + +func (r AccountGatewayLocationUpdateParamsNetwork) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParams struct { + // The name of the location. + Name param.Field[string] `json:"name,required"` + // True if the location is the default location. + ClientDefault param.Field[bool] `json:"client_default"` + // True if the location needs to resolve EDNS queries. + EcsSupport param.Field[bool] `json:"ecs_support"` + // A list of network ranges that requests from this location would originate from. + Networks param.Field[[]AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParamsNetwork] `json:"networks"` +} + +func (r AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParamsNetwork struct { + // The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24. + Network param.Field[string] `json:"network,required"` +} + +func (r AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParamsNetwork) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgatewaylocation_test.go b/accountgatewaylocation_test.go new file mode 100644 index 00000000000..5899b37a1e2 --- /dev/null +++ b/accountgatewaylocation_test.go @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayLocationGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Locations.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "ed35569b41ce4d1facfe683550f54086", + ) + 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 TestAccountGatewayLocationUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Locations.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "ed35569b41ce4d1facfe683550f54086", + cloudflare.AccountGatewayLocationUpdateParams{ + Name: cloudflare.F("Austin Office Location"), + ClientDefault: cloudflare.F(false), + EcsSupport: cloudflare.F(false), + Networks: cloudflare.F([]cloudflare.AccountGatewayLocationUpdateParamsNetwork{{ + Network: cloudflare.F("192.0.2.1/32"), + }, { + Network: cloudflare.F("192.0.2.1/32"), + }, { + Network: cloudflare.F("192.0.2.1/32"), + }}), + }, + ) + 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 TestAccountGatewayLocationDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Locations.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "ed35569b41ce4d1facfe683550f54086", + ) + 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 TestAccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Locations.ZeroTrustGatewayLocationsNewZeroTrustGatewayLocation( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParams{ + Name: cloudflare.F("Austin Office Location"), + ClientDefault: cloudflare.F(false), + EcsSupport: cloudflare.F(false), + Networks: cloudflare.F([]cloudflare.AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParamsNetwork{{ + Network: cloudflare.F("192.0.2.1/32"), + }, { + Network: cloudflare.F("192.0.2.1/32"), + }, { + Network: cloudflare.F("192.0.2.1/32"), + }}), + }, + ) + 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 TestAccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocations(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Locations.ZeroTrustGatewayLocationsListZeroTrustGatewayLocations(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountgatewaylogging.go b/accountgatewaylogging.go new file mode 100644 index 00000000000..01a1169133e --- /dev/null +++ b/accountgatewaylogging.go @@ -0,0 +1,316 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayLoggingService 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 [NewAccountGatewayLoggingService] +// method instead. +type AccountGatewayLoggingService struct { + Options []option.RequestOption +} + +// NewAccountGatewayLoggingService 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 NewAccountGatewayLoggingService(opts ...option.RequestOption) (r *AccountGatewayLoggingService) { + r = &AccountGatewayLoggingService{} + r.Options = opts + return +} + +// Fetches the current logging settings for Zero Trust account. +func (r *AccountGatewayLoggingService) ZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccount(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/logging", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates logging settings for the current Zero Trust account. +func (r *AccountGatewayLoggingService) ZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccount(ctx context.Context, identifier interface{}, body AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParams, opts ...option.RequestOption) (res *AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/logging", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponse struct { + Errors []AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseError `json:"errors"` + Messages []AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseMessage `json:"messages"` + Result AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseSuccess `json:"success"` + JSON accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponse] +type accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseErrorJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseError] +type accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseMessageJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseMessage] +type accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResult struct { + // Redact personally identifiable information from activity logging (PII fields + // are: source IP, user email, user ID, device ID, URL, referrer, user agent). + RedactPii bool `json:"redact_pii"` + // Logging settings by rule type. + SettingsByRuleType AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType `json:"settings_by_rule_type"` + JSON accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResult] +type accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultJSON struct { + RedactPii apijson.Field + SettingsByRuleType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Logging settings by rule type. +type AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType struct { + // Logging settings for DNS firewall. + DNS interface{} `json:"dns"` + // Logging settings for HTTP/HTTPS firewall. + HTTP interface{} `json:"http"` + // Logging settings for Network firewall. + L4 interface{} `json:"l4"` + JSON accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleTypeJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleTypeJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType] +type accountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleTypeJSON struct { + DNS apijson.Field + HTTP apijson.Field + L4 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseSuccess bool + +const ( + AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseSuccessTrue AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponseSuccess = true +) + +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponse struct { + Errors []AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseError `json:"errors"` + Messages []AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseMessage `json:"messages"` + Result AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseSuccess `json:"success"` + JSON accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponse] +type accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseErrorJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseError] +type accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseMessageJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseMessage] +type accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResult struct { + // Redact personally identifiable information from activity logging (PII fields + // are: source IP, user email, user ID, device ID, URL, referrer, user agent). + RedactPii bool `json:"redact_pii"` + // Logging settings by rule type. + SettingsByRuleType AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType `json:"settings_by_rule_type"` + JSON accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResult] +type accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultJSON struct { + RedactPii apijson.Field + SettingsByRuleType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Logging settings by rule type. +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType struct { + // Logging settings for DNS firewall. + DNS interface{} `json:"dns"` + // Logging settings for HTTP/HTTPS firewall. + HTTP interface{} `json:"http"` + // Logging settings for Network firewall. + L4 interface{} `json:"l4"` + JSON accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleTypeJSON `json:"-"` +} + +// accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleTypeJSON +// contains the JSON metadata for the struct +// [AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType] +type accountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleTypeJSON struct { + DNS apijson.Field + HTTP apijson.Field + L4 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseResultSettingsByRuleType) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseSuccess bool + +const ( + AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseSuccessTrue AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponseSuccess = true +) + +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParams struct { + // Redact personally identifiable information from activity logging (PII fields + // are: source IP, user email, user ID, device ID, URL, referrer, user agent). + RedactPii param.Field[bool] `json:"redact_pii"` + // Logging settings by rule type. + SettingsByRuleType param.Field[AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParamsSettingsByRuleType] `json:"settings_by_rule_type"` +} + +func (r AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Logging settings by rule type. +type AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParamsSettingsByRuleType struct { + // Logging settings for DNS firewall. + DNS param.Field[interface{}] `json:"dns"` + // Logging settings for HTTP/HTTPS firewall. + HTTP param.Field[interface{}] `json:"http"` + // Logging settings for Network firewall. + L4 param.Field[interface{}] `json:"l4"` +} + +func (r AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParamsSettingsByRuleType) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgatewaylogging_test.go b/accountgatewaylogging_test.go new file mode 100644 index 00000000000..a58127b9342 --- /dev/null +++ b/accountgatewaylogging_test.go @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccount(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Loggings.ZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccount(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestAccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Loggings.ZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccount( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParams{ + RedactPii: cloudflare.F(true), + SettingsByRuleType: cloudflare.F(cloudflare.AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParamsSettingsByRuleType{ + DNS: cloudflare.F[any](map[string]interface{}{}), + HTTP: cloudflare.F[any](map[string]interface{}{}), + L4: cloudflare.F[any](map[string]interface{}{}), + }), + }, + ) + 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/accountgatewayproxyendpoint.go b/accountgatewayproxyendpoint.go new file mode 100644 index 00000000000..8573710a235 --- /dev/null +++ b/accountgatewayproxyendpoint.go @@ -0,0 +1,602 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayProxyEndpointService 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 +// [NewAccountGatewayProxyEndpointService] method instead. +type AccountGatewayProxyEndpointService struct { + Options []option.RequestOption +} + +// NewAccountGatewayProxyEndpointService 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 NewAccountGatewayProxyEndpointService(opts ...option.RequestOption) (r *AccountGatewayProxyEndpointService) { + r = &AccountGatewayProxyEndpointService{} + r.Options = opts + return +} + +// Fetches all Zero Trust Gateway proxy endpoints for an account. +func (r *AccountGatewayProxyEndpointService) Get(ctx context.Context, identifier interface{}, uuid interface{}, opts ...option.RequestOption) (res *AccountGatewayProxyEndpointGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/proxy_endpoints/%v", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured Zero Trust Gateway proxy endpoint. +func (r *AccountGatewayProxyEndpointService) Update(ctx context.Context, identifier interface{}, uuid interface{}, body AccountGatewayProxyEndpointUpdateParams, opts ...option.RequestOption) (res *AccountGatewayProxyEndpointUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/proxy_endpoints/%v", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes a configured Zero Trust Gateway proxy endpoint. +func (r *AccountGatewayProxyEndpointService) Delete(ctx context.Context, identifier interface{}, uuid interface{}, opts ...option.RequestOption) (res *AccountGatewayProxyEndpointDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/proxy_endpoints/%v", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new Zero Trust Gateway proxy endpoint. +func (r *AccountGatewayProxyEndpointService) ZeroTrustGatewayProxyEndpointsNewProxyEndpoint(ctx context.Context, identifier interface{}, body AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointParams, opts ...option.RequestOption) (res *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/proxy_endpoints", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches a single Zero Trust Gateway proxy endpoint. +func (r *AccountGatewayProxyEndpointService) ZeroTrustGatewayProxyEndpointsListProxyEndpoints(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/proxy_endpoints", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayProxyEndpointGetResponse struct { + Errors []AccountGatewayProxyEndpointGetResponseError `json:"errors"` + Messages []AccountGatewayProxyEndpointGetResponseMessage `json:"messages"` + Result AccountGatewayProxyEndpointGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayProxyEndpointGetResponseSuccess `json:"success"` + JSON accountGatewayProxyEndpointGetResponseJSON `json:"-"` +} + +// accountGatewayProxyEndpointGetResponseJSON contains the JSON metadata for the +// struct [AccountGatewayProxyEndpointGetResponse] +type accountGatewayProxyEndpointGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointGetResponseErrorJSON `json:"-"` +} + +// accountGatewayProxyEndpointGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountGatewayProxyEndpointGetResponseError] +type accountGatewayProxyEndpointGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointGetResponseMessageJSON `json:"-"` +} + +// accountGatewayProxyEndpointGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountGatewayProxyEndpointGetResponseMessage] +type accountGatewayProxyEndpointGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointGetResponseResult struct { + ID interface{} `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // A list of CIDRs to restrict ingress connections. + IPs []string `json:"ips"` + // The name of the proxy endpoint. + Name string `json:"name"` + // The subdomain to be used as the destination in the proxy client. + Subdomain string `json:"subdomain"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayProxyEndpointGetResponseResultJSON `json:"-"` +} + +// accountGatewayProxyEndpointGetResponseResultJSON contains the JSON metadata for +// the struct [AccountGatewayProxyEndpointGetResponseResult] +type accountGatewayProxyEndpointGetResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + IPs apijson.Field + Name apijson.Field + Subdomain apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayProxyEndpointGetResponseSuccess bool + +const ( + AccountGatewayProxyEndpointGetResponseSuccessTrue AccountGatewayProxyEndpointGetResponseSuccess = true +) + +type AccountGatewayProxyEndpointUpdateResponse struct { + Errors []AccountGatewayProxyEndpointUpdateResponseError `json:"errors"` + Messages []AccountGatewayProxyEndpointUpdateResponseMessage `json:"messages"` + Result AccountGatewayProxyEndpointUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayProxyEndpointUpdateResponseSuccess `json:"success"` + JSON accountGatewayProxyEndpointUpdateResponseJSON `json:"-"` +} + +// accountGatewayProxyEndpointUpdateResponseJSON contains the JSON metadata for the +// struct [AccountGatewayProxyEndpointUpdateResponse] +type accountGatewayProxyEndpointUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointUpdateResponseErrorJSON `json:"-"` +} + +// accountGatewayProxyEndpointUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountGatewayProxyEndpointUpdateResponseError] +type accountGatewayProxyEndpointUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointUpdateResponseMessageJSON `json:"-"` +} + +// accountGatewayProxyEndpointUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountGatewayProxyEndpointUpdateResponseMessage] +type accountGatewayProxyEndpointUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointUpdateResponseResult struct { + ID interface{} `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // A list of CIDRs to restrict ingress connections. + IPs []string `json:"ips"` + // The name of the proxy endpoint. + Name string `json:"name"` + // The subdomain to be used as the destination in the proxy client. + Subdomain string `json:"subdomain"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayProxyEndpointUpdateResponseResultJSON `json:"-"` +} + +// accountGatewayProxyEndpointUpdateResponseResultJSON contains the JSON metadata +// for the struct [AccountGatewayProxyEndpointUpdateResponseResult] +type accountGatewayProxyEndpointUpdateResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + IPs apijson.Field + Name apijson.Field + Subdomain apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayProxyEndpointUpdateResponseSuccess bool + +const ( + AccountGatewayProxyEndpointUpdateResponseSuccessTrue AccountGatewayProxyEndpointUpdateResponseSuccess = true +) + +type AccountGatewayProxyEndpointDeleteResponse struct { + Errors []AccountGatewayProxyEndpointDeleteResponseError `json:"errors"` + Messages []AccountGatewayProxyEndpointDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountGatewayProxyEndpointDeleteResponseSuccess `json:"success"` + JSON accountGatewayProxyEndpointDeleteResponseJSON `json:"-"` +} + +// accountGatewayProxyEndpointDeleteResponseJSON contains the JSON metadata for the +// struct [AccountGatewayProxyEndpointDeleteResponse] +type accountGatewayProxyEndpointDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointDeleteResponseErrorJSON `json:"-"` +} + +// accountGatewayProxyEndpointDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountGatewayProxyEndpointDeleteResponseError] +type accountGatewayProxyEndpointDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointDeleteResponseMessageJSON `json:"-"` +} + +// accountGatewayProxyEndpointDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountGatewayProxyEndpointDeleteResponseMessage] +type accountGatewayProxyEndpointDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayProxyEndpointDeleteResponseSuccess bool + +const ( + AccountGatewayProxyEndpointDeleteResponseSuccessTrue AccountGatewayProxyEndpointDeleteResponseSuccess = true +) + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponse struct { + Errors []AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseError `json:"errors"` + Messages []AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseMessage `json:"messages"` + Result AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseSuccess `json:"success"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponse] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseErrorJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseError] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseMessageJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseMessage] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseResult struct { + ID interface{} `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // A list of CIDRs to restrict ingress connections. + IPs []string `json:"ips"` + // The name of the proxy endpoint. + Name string `json:"name"` + // The subdomain to be used as the destination in the proxy client. + Subdomain string `json:"subdomain"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseResultJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseResult] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + IPs apijson.Field + Name apijson.Field + Subdomain apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseSuccess bool + +const ( + AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseSuccessTrue AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponseSuccess = true +) + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponse struct { + Errors []AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseError `json:"errors"` + Messages []AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseMessage `json:"messages"` + Result []AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResult `json:"result"` + ResultInfo AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseSuccess `json:"success"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponse] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseErrorJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseError] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseMessageJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseMessage] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResult struct { + ID interface{} `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // A list of CIDRs to restrict ingress connections. + IPs []string `json:"ips"` + // The name of the proxy endpoint. + Name string `json:"name"` + // The subdomain to be used as the destination in the proxy client. + Subdomain string `json:"subdomain"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResult] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + IPs apijson.Field + Name apijson.Field + Subdomain apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultInfoJSON `json:"-"` +} + +// accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultInfo] +type accountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseSuccess bool + +const ( + AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseSuccessTrue AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponseSuccess = true +) + +type AccountGatewayProxyEndpointUpdateParams struct { + // A list of CIDRs to restrict ingress connections. + IPs param.Field[[]string] `json:"ips"` + // The name of the proxy endpoint. + Name param.Field[string] `json:"name"` + // The subdomain to be used as the destination in the proxy client. + Subdomain param.Field[string] `json:"subdomain"` +} + +func (r AccountGatewayProxyEndpointUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointParams struct { + // A list of CIDRs to restrict ingress connections. + IPs param.Field[[]string] `json:"ips,required"` + // The name of the proxy endpoint. + Name param.Field[string] `json:"name,required"` + // The subdomain to be used as the destination in the proxy client. + Subdomain param.Field[string] `json:"subdomain"` +} + +func (r AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgatewayproxyendpoint_test.go b/accountgatewayproxyendpoint_test.go new file mode 100644 index 00000000000..fe5db2d4219 --- /dev/null +++ b/accountgatewayproxyendpoint_test.go @@ -0,0 +1,169 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayProxyEndpointGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.ProxyEndpoints.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "ed35569b41ce4d1facfe683550f54086", + ) + 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 TestAccountGatewayProxyEndpointUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.ProxyEndpoints.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "ed35569b41ce4d1facfe683550f54086", + cloudflare.AccountGatewayProxyEndpointUpdateParams{ + IPs: cloudflare.F([]string{"192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"}), + Name: cloudflare.F("Devops team"), + Subdomain: cloudflare.F("oli3n9zkz5.proxy.cloudflare-gateway.com"), + }, + ) + 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 TestAccountGatewayProxyEndpointDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.ProxyEndpoints.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "ed35569b41ce4d1facfe683550f54086", + ) + 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 TestAccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.ProxyEndpoints.ZeroTrustGatewayProxyEndpointsNewProxyEndpoint( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointParams{ + IPs: cloudflare.F([]string{"192.0.2.1/32", "192.0.2.1/32", "192.0.2.1/32"}), + Name: cloudflare.F("Devops team"), + Subdomain: cloudflare.F("oli3n9zkz5.proxy.cloudflare-gateway.com"), + }, + ) + 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 TestAccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpoints(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.ProxyEndpoints.ZeroTrustGatewayProxyEndpointsListProxyEndpoints(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accountgatewayrule.go b/accountgatewayrule.go new file mode 100644 index 00000000000..5d4934677e2 --- /dev/null +++ b/accountgatewayrule.go @@ -0,0 +1,3245 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountGatewayRuleService 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 [NewAccountGatewayRuleService] method +// instead. +type AccountGatewayRuleService struct { + Options []option.RequestOption +} + +// NewAccountGatewayRuleService 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 NewAccountGatewayRuleService(opts ...option.RequestOption) (r *AccountGatewayRuleService) { + r = &AccountGatewayRuleService{} + r.Options = opts + return +} + +// Fetches a single Zero Trust Gateway rule. +func (r *AccountGatewayRuleService) Get(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountGatewayRuleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/rules/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured Zero Trust Gateway rule. +func (r *AccountGatewayRuleService) Update(ctx context.Context, identifier interface{}, uuid string, body AccountGatewayRuleUpdateParams, opts ...option.RequestOption) (res *AccountGatewayRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/rules/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a Zero Trust Gateway rule. +func (r *AccountGatewayRuleService) Delete(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccountGatewayRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/rules/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new Zero Trust Gateway rule. +func (r *AccountGatewayRuleService) ZeroTrustGatewayRulesNewZeroTrustGatewayRule(ctx context.Context, identifier interface{}, body AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParams, opts ...option.RequestOption) (res *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/rules", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches the Zero Trust Gateway rules for an account. +func (r *AccountGatewayRuleService) ZeroTrustGatewayRulesListZeroTrustGatewayRules(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/gateway/rules", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountGatewayRuleGetResponse struct { + Errors []AccountGatewayRuleGetResponseError `json:"errors"` + Messages []AccountGatewayRuleGetResponseMessage `json:"messages"` + Result AccountGatewayRuleGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayRuleGetResponseSuccess `json:"success"` + JSON accountGatewayRuleGetResponseJSON `json:"-"` +} + +// accountGatewayRuleGetResponseJSON contains the JSON metadata for the struct +// [AccountGatewayRuleGetResponse] +type accountGatewayRuleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleGetResponseErrorJSON `json:"-"` +} + +// accountGatewayRuleGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountGatewayRuleGetResponseError] +type accountGatewayRuleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleGetResponseMessageJSON `json:"-"` +} + +// accountGatewayRuleGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayRuleGetResponseMessage] +type accountGatewayRuleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleGetResponseResult struct { + // The API resource UUID. + ID string `json:"id"` + // The action to preform when the associated traffic, identity, and device posture + // expressions are either absent or evaluate to `true`. + Action AccountGatewayRuleGetResponseResultAction `json:"action"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Date of deletion, if any. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The description of the rule. + Description string `json:"description"` + // The wirefilter expression used for device posture check matching. + DevicePosture string `json:"device_posture"` + // True if the rule is enabled. + Enabled bool `json:"enabled"` + // The protocol or layer to evaluate the traffic, identity, and device posture + // expressions. + Filters []AccountGatewayRuleGetResponseResultFilter `json:"filters"` + // The wirefilter expression used for identity matching. + Identity string `json:"identity"` + // The name of the rule. + Name string `json:"name"` + // Precedence sets the order of your rules. Lower values indicate higher + // precedence. At each processing phase, applicable rules are evaluated in + // ascending order of this value. + Precedence int64 `json:"precedence"` + // Additional settings that modify the rule's action. + RuleSettings AccountGatewayRuleGetResponseResultRuleSettings `json:"rule_settings"` + // The schedule for activating DNS policies. This does not apply to HTTP or network + // policies. + Schedule AccountGatewayRuleGetResponseResultSchedule `json:"schedule"` + // The wirefilter expression used for traffic matching. + Traffic string `json:"traffic"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayRuleGetResponseResultJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultJSON contains the JSON metadata for the +// struct [AccountGatewayRuleGetResponseResult] +type accountGatewayRuleGetResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Description apijson.Field + DevicePosture apijson.Field + Enabled apijson.Field + Filters apijson.Field + Identity apijson.Field + Name apijson.Field + Precedence apijson.Field + RuleSettings apijson.Field + Schedule apijson.Field + Traffic apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to preform when the associated traffic, identity, and device posture +// expressions are either absent or evaluate to `true`. +type AccountGatewayRuleGetResponseResultAction string + +const ( + AccountGatewayRuleGetResponseResultActionOn AccountGatewayRuleGetResponseResultAction = "on" + AccountGatewayRuleGetResponseResultActionOff AccountGatewayRuleGetResponseResultAction = "off" + AccountGatewayRuleGetResponseResultActionAllow AccountGatewayRuleGetResponseResultAction = "allow" + AccountGatewayRuleGetResponseResultActionBlock AccountGatewayRuleGetResponseResultAction = "block" + AccountGatewayRuleGetResponseResultActionScan AccountGatewayRuleGetResponseResultAction = "scan" + AccountGatewayRuleGetResponseResultActionNoscan AccountGatewayRuleGetResponseResultAction = "noscan" + AccountGatewayRuleGetResponseResultActionSafesearch AccountGatewayRuleGetResponseResultAction = "safesearch" + AccountGatewayRuleGetResponseResultActionYtrestricted AccountGatewayRuleGetResponseResultAction = "ytrestricted" + AccountGatewayRuleGetResponseResultActionIsolate AccountGatewayRuleGetResponseResultAction = "isolate" + AccountGatewayRuleGetResponseResultActionNoisolate AccountGatewayRuleGetResponseResultAction = "noisolate" + AccountGatewayRuleGetResponseResultActionOverride AccountGatewayRuleGetResponseResultAction = "override" + AccountGatewayRuleGetResponseResultActionL4Override AccountGatewayRuleGetResponseResultAction = "l4_override" + AccountGatewayRuleGetResponseResultActionEgress AccountGatewayRuleGetResponseResultAction = "egress" + AccountGatewayRuleGetResponseResultActionAuditSSH AccountGatewayRuleGetResponseResultAction = "audit_ssh" +) + +// The protocol or layer to use. +type AccountGatewayRuleGetResponseResultFilter string + +const ( + AccountGatewayRuleGetResponseResultFilterHTTP AccountGatewayRuleGetResponseResultFilter = "http" + AccountGatewayRuleGetResponseResultFilterDNS AccountGatewayRuleGetResponseResultFilter = "dns" + AccountGatewayRuleGetResponseResultFilterL4 AccountGatewayRuleGetResponseResultFilter = "l4" + AccountGatewayRuleGetResponseResultFilterEgress AccountGatewayRuleGetResponseResultFilter = "egress" +) + +// Additional settings that modify the rule's action. +type AccountGatewayRuleGetResponseResultRuleSettings struct { + // Add custom headers to allowed requests, in the form of key-value pairs. Keys are + // header names, pointing to an array with its header value(s). + AddHeaders interface{} `json:"add_headers"` + // Set by parent MSP accounts to enable their children to bypass this rule. + AllowChildBypass bool `json:"allow_child_bypass"` + // Settings for the Audit SSH action. + AuditSSH AccountGatewayRuleGetResponseResultRuleSettingsAuditSSH `json:"audit_ssh"` + // Configure how browser isolation behaves. + BisoAdminControls AccountGatewayRuleGetResponseResultRuleSettingsBisoAdminControls `json:"biso_admin_controls"` + // Enable the custom block page. + BlockPageEnabled bool `json:"block_page_enabled"` + // The text describing why this block occurred, displayed on the custom block page + // (if enabled). + BlockReason string `json:"block_reason"` + // Set by children MSP accounts to bypass their parent's rules. + BypassParentRule bool `json:"bypass_parent_rule"` + // Configure how session check behaves. + CheckSession AccountGatewayRuleGetResponseResultRuleSettingsCheckSession `json:"check_session"` + // Add your own custom resolvers to route queries that match the resolver policy. + // Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will + // route to the address closest to their origin. + DNSResolvers AccountGatewayRuleGetResponseResultRuleSettingsDNSResolvers `json:"dns_resolvers"` + // Configure how Gateway Proxy traffic egresses. You can enable this setting for + // rules with Egress actions and filters, or omit it to indicate local egress via + // WARP IPs. + Egress AccountGatewayRuleGetResponseResultRuleSettingsEgress `json:"egress"` + // INSECURE - disable DNSSEC validation (for Allow actions). + InsecureDisableDnssecValidation bool `json:"insecure_disable_dnssec_validation"` + // Set to true to enable IPs in DNS resolver category blocks. By default categories + // only block based on domain names. + IPCategories bool `json:"ip_categories"` + // Set to true to include IPs in DNS resolver indicator feed blocks. By default + // indicator feeds only block based on domain names. + IPIndicatorFeeds bool `json:"ip_indicator_feeds"` + // Send matching traffic to the supplied destination IP address and port. + L4override AccountGatewayRuleGetResponseResultRuleSettingsL4override `json:"l4override"` + // Configure a notification to display on the user's device when this rule is + // matched. + NotificationSettings AccountGatewayRuleGetResponseResultRuleSettingsNotificationSettings `json:"notification_settings"` + // Override matching DNS queries with a hostname. + OverrideHost string `json:"override_host"` + // Override matching DNS queries with an IP or set of IPs. + OverrideIPs []string `json:"override_ips"` + // Configure DLP payload logging. + PayloadLog AccountGatewayRuleGetResponseResultRuleSettingsPayloadLog `json:"payload_log"` + // Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS + // resolver. Cannot be set when dns_resolvers are specified. + ResolveDNSThroughCloudflare bool `json:"resolve_dns_through_cloudflare"` + // Configure behavior when an upstream cert is invalid or an SSL error occurs. + UntrustedCert AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCert `json:"untrusted_cert"` + JSON accountGatewayRuleGetResponseResultRuleSettingsJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsJSON contains the JSON metadata +// for the struct [AccountGatewayRuleGetResponseResultRuleSettings] +type accountGatewayRuleGetResponseResultRuleSettingsJSON struct { + AddHeaders apijson.Field + AllowChildBypass apijson.Field + AuditSSH apijson.Field + BisoAdminControls apijson.Field + BlockPageEnabled apijson.Field + BlockReason apijson.Field + BypassParentRule apijson.Field + CheckSession apijson.Field + DNSResolvers apijson.Field + Egress apijson.Field + InsecureDisableDnssecValidation apijson.Field + IPCategories apijson.Field + IPIndicatorFeeds apijson.Field + L4override apijson.Field + NotificationSettings apijson.Field + OverrideHost apijson.Field + OverrideIPs apijson.Field + PayloadLog apijson.Field + ResolveDNSThroughCloudflare apijson.Field + UntrustedCert apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Settings for the Audit SSH action. +type AccountGatewayRuleGetResponseResultRuleSettingsAuditSSH struct { + // Enable to turn on SSH command logging. + CommandLogging bool `json:"command_logging"` + JSON accountGatewayRuleGetResponseResultRuleSettingsAuditSSHJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsAuditSSHJSON contains the JSON +// metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsAuditSSH] +type accountGatewayRuleGetResponseResultRuleSettingsAuditSSHJSON struct { + CommandLogging apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsAuditSSH) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how browser isolation behaves. +type AccountGatewayRuleGetResponseResultRuleSettingsBisoAdminControls struct { + // Set to true to enable copy-pasting. + Dcp bool `json:"dcp"` + // Set to true to enable downloading. + Dd bool `json:"dd"` + // Set to true to enable keyboard usage. + Dk bool `json:"dk"` + // Set to true to enable printing. + Dp bool `json:"dp"` + // Set to true to enable uploading. + Du bool `json:"du"` + JSON accountGatewayRuleGetResponseResultRuleSettingsBisoAdminControlsJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsBisoAdminControlsJSON contains +// the JSON metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsBisoAdminControls] +type accountGatewayRuleGetResponseResultRuleSettingsBisoAdminControlsJSON struct { + Dcp apijson.Field + Dd apijson.Field + Dk apijson.Field + Dp apijson.Field + Du apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsBisoAdminControls) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how session check behaves. +type AccountGatewayRuleGetResponseResultRuleSettingsCheckSession struct { + // Configure how fresh the session needs to be to be considered valid. + Duration string `json:"duration"` + // Set to true to enable session enforcement. + Enforce bool `json:"enforce"` + JSON accountGatewayRuleGetResponseResultRuleSettingsCheckSessionJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsCheckSessionJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsCheckSession] +type accountGatewayRuleGetResponseResultRuleSettingsCheckSessionJSON struct { + Duration apijson.Field + Enforce apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsCheckSession) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Add your own custom resolvers to route queries that match the resolver policy. +// Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will +// route to the address closest to their origin. +type AccountGatewayRuleGetResponseResultRuleSettingsDNSResolvers struct { + Ipv4 []AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv4 `json:"ipv4"` + Ipv6 []AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv6 `json:"ipv6"` + JSON accountGatewayRuleGetResponseResultRuleSettingsDNSResolversJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsDNSResolversJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsDNSResolvers] +type accountGatewayRuleGetResponseResultRuleSettingsDNSResolversJSON struct { + Ipv4 apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsDNSResolvers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv4 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv4JSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv4JSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv4] +type accountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv4JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv4) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv6 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv6JSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv6JSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv6] +type accountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv6JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsDNSResolversIpv6) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how Gateway Proxy traffic egresses. You can enable this setting for +// rules with Egress actions and filters, or omit it to indicate local egress via +// WARP IPs. +type AccountGatewayRuleGetResponseResultRuleSettingsEgress struct { + // The IPv4 address to be used for egress. + Ipv4 string `json:"ipv4"` + // The fallback IPv4 address to be used for egress in the event of an error + // egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + // WARP IPs. + Ipv4Fallback string `json:"ipv4_fallback"` + // The IPv6 range to be used for egress. + Ipv6 string `json:"ipv6"` + JSON accountGatewayRuleGetResponseResultRuleSettingsEgressJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsEgressJSON contains the JSON +// metadata for the struct [AccountGatewayRuleGetResponseResultRuleSettingsEgress] +type accountGatewayRuleGetResponseResultRuleSettingsEgressJSON struct { + Ipv4 apijson.Field + Ipv4Fallback apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsEgress) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Send matching traffic to the supplied destination IP address and port. +type AccountGatewayRuleGetResponseResultRuleSettingsL4override struct { + // IPv4 or IPv6 address. + IP string `json:"ip"` + // A port number to use for TCP/UDP overrides. + Port int64 `json:"port"` + JSON accountGatewayRuleGetResponseResultRuleSettingsL4overrideJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsL4overrideJSON contains the JSON +// metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsL4override] +type accountGatewayRuleGetResponseResultRuleSettingsL4overrideJSON struct { + IP apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsL4override) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure a notification to display on the user's device when this rule is +// matched. +type AccountGatewayRuleGetResponseResultRuleSettingsNotificationSettings struct { + // set notification on + Enabled bool `json:"enabled"` + // Customize the message shown in the notification. + Msg string `json:"msg"` + // Optional URL to direct users to additional information. If not set, the + // notification will open a block page. + SupportURL string `json:"support_url"` + JSON accountGatewayRuleGetResponseResultRuleSettingsNotificationSettingsJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsNotificationSettingsJSON contains +// the JSON metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsNotificationSettings] +type accountGatewayRuleGetResponseResultRuleSettingsNotificationSettingsJSON struct { + Enabled apijson.Field + Msg apijson.Field + SupportURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsNotificationSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure DLP payload logging. +type AccountGatewayRuleGetResponseResultRuleSettingsPayloadLog struct { + // Set to true to enable DLP payload logging for this rule. + Enabled bool `json:"enabled"` + JSON accountGatewayRuleGetResponseResultRuleSettingsPayloadLogJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsPayloadLogJSON contains the JSON +// metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsPayloadLog] +type accountGatewayRuleGetResponseResultRuleSettingsPayloadLogJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsPayloadLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure behavior when an upstream cert is invalid or an SSL error occurs. +type AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCert struct { + // The action performed when an untrusted certificate is seen. The default action + // is an error with HTTP code 526. + Action AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertAction `json:"action"` + JSON accountGatewayRuleGetResponseResultRuleSettingsUntrustedCertJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultRuleSettingsUntrustedCertJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCert] +type accountGatewayRuleGetResponseResultRuleSettingsUntrustedCertJSON struct { + Action apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCert) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action performed when an untrusted certificate is seen. The default action +// is an error with HTTP code 526. +type AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertAction string + +const ( + AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertActionPassThrough AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertAction = "pass_through" + AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertActionBlock AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertAction = "block" + AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertActionError AccountGatewayRuleGetResponseResultRuleSettingsUntrustedCertAction = "error" +) + +// The schedule for activating DNS policies. This does not apply to HTTP or network +// policies. +type AccountGatewayRuleGetResponseResultSchedule struct { + // The time intervals when the rule will be active on Fridays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Fridays. + Fri string `json:"fri"` + // The time intervals when the rule will be active on Mondays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Mondays. + Mon string `json:"mon"` + // The time intervals when the rule will be active on Saturdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Saturdays. + Sat string `json:"sat"` + // The time intervals when the rule will be active on Sundays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Sundays. + Sun string `json:"sun"` + // The time intervals when the rule will be active on Thursdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Thursdays. + Thu string `json:"thu"` + // The time zone the rule will be evaluated against. If a + // [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + // is provided, Gateway will always use the current time at that time zone. If this + // parameter is omitted, then Gateway will use the time zone inferred from the + // user's source IP to evaluate the rule. If Gateway cannot determine the time zone + // from the IP, we will fall back to the time zone of the user's connected data + // center. + TimeZone string `json:"time_zone"` + // The time intervals when the rule will be active on Tuesdays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Tuesdays. + Tue string `json:"tue"` + // The time intervals when the rule will be active on Wednesdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Wednesdays. + Wed string `json:"wed"` + JSON accountGatewayRuleGetResponseResultScheduleJSON `json:"-"` +} + +// accountGatewayRuleGetResponseResultScheduleJSON contains the JSON metadata for +// the struct [AccountGatewayRuleGetResponseResultSchedule] +type accountGatewayRuleGetResponseResultScheduleJSON struct { + Fri apijson.Field + Mon apijson.Field + Sat apijson.Field + Sun apijson.Field + Thu apijson.Field + TimeZone apijson.Field + Tue apijson.Field + Wed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleGetResponseResultSchedule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayRuleGetResponseSuccess bool + +const ( + AccountGatewayRuleGetResponseSuccessTrue AccountGatewayRuleGetResponseSuccess = true +) + +type AccountGatewayRuleUpdateResponse struct { + Errors []AccountGatewayRuleUpdateResponseError `json:"errors"` + Messages []AccountGatewayRuleUpdateResponseMessage `json:"messages"` + Result AccountGatewayRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayRuleUpdateResponseSuccess `json:"success"` + JSON accountGatewayRuleUpdateResponseJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseJSON contains the JSON metadata for the struct +// [AccountGatewayRuleUpdateResponse] +type accountGatewayRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleUpdateResponseErrorJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayRuleUpdateResponseError] +type accountGatewayRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleUpdateResponseMessageJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayRuleUpdateResponseMessage] +type accountGatewayRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleUpdateResponseResult struct { + // The API resource UUID. + ID string `json:"id"` + // The action to preform when the associated traffic, identity, and device posture + // expressions are either absent or evaluate to `true`. + Action AccountGatewayRuleUpdateResponseResultAction `json:"action"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Date of deletion, if any. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The description of the rule. + Description string `json:"description"` + // The wirefilter expression used for device posture check matching. + DevicePosture string `json:"device_posture"` + // True if the rule is enabled. + Enabled bool `json:"enabled"` + // The protocol or layer to evaluate the traffic, identity, and device posture + // expressions. + Filters []AccountGatewayRuleUpdateResponseResultFilter `json:"filters"` + // The wirefilter expression used for identity matching. + Identity string `json:"identity"` + // The name of the rule. + Name string `json:"name"` + // Precedence sets the order of your rules. Lower values indicate higher + // precedence. At each processing phase, applicable rules are evaluated in + // ascending order of this value. + Precedence int64 `json:"precedence"` + // Additional settings that modify the rule's action. + RuleSettings AccountGatewayRuleUpdateResponseResultRuleSettings `json:"rule_settings"` + // The schedule for activating DNS policies. This does not apply to HTTP or network + // policies. + Schedule AccountGatewayRuleUpdateResponseResultSchedule `json:"schedule"` + // The wirefilter expression used for traffic matching. + Traffic string `json:"traffic"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayRuleUpdateResponseResultJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountGatewayRuleUpdateResponseResult] +type accountGatewayRuleUpdateResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Description apijson.Field + DevicePosture apijson.Field + Enabled apijson.Field + Filters apijson.Field + Identity apijson.Field + Name apijson.Field + Precedence apijson.Field + RuleSettings apijson.Field + Schedule apijson.Field + Traffic apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to preform when the associated traffic, identity, and device posture +// expressions are either absent or evaluate to `true`. +type AccountGatewayRuleUpdateResponseResultAction string + +const ( + AccountGatewayRuleUpdateResponseResultActionOn AccountGatewayRuleUpdateResponseResultAction = "on" + AccountGatewayRuleUpdateResponseResultActionOff AccountGatewayRuleUpdateResponseResultAction = "off" + AccountGatewayRuleUpdateResponseResultActionAllow AccountGatewayRuleUpdateResponseResultAction = "allow" + AccountGatewayRuleUpdateResponseResultActionBlock AccountGatewayRuleUpdateResponseResultAction = "block" + AccountGatewayRuleUpdateResponseResultActionScan AccountGatewayRuleUpdateResponseResultAction = "scan" + AccountGatewayRuleUpdateResponseResultActionNoscan AccountGatewayRuleUpdateResponseResultAction = "noscan" + AccountGatewayRuleUpdateResponseResultActionSafesearch AccountGatewayRuleUpdateResponseResultAction = "safesearch" + AccountGatewayRuleUpdateResponseResultActionYtrestricted AccountGatewayRuleUpdateResponseResultAction = "ytrestricted" + AccountGatewayRuleUpdateResponseResultActionIsolate AccountGatewayRuleUpdateResponseResultAction = "isolate" + AccountGatewayRuleUpdateResponseResultActionNoisolate AccountGatewayRuleUpdateResponseResultAction = "noisolate" + AccountGatewayRuleUpdateResponseResultActionOverride AccountGatewayRuleUpdateResponseResultAction = "override" + AccountGatewayRuleUpdateResponseResultActionL4Override AccountGatewayRuleUpdateResponseResultAction = "l4_override" + AccountGatewayRuleUpdateResponseResultActionEgress AccountGatewayRuleUpdateResponseResultAction = "egress" + AccountGatewayRuleUpdateResponseResultActionAuditSSH AccountGatewayRuleUpdateResponseResultAction = "audit_ssh" +) + +// The protocol or layer to use. +type AccountGatewayRuleUpdateResponseResultFilter string + +const ( + AccountGatewayRuleUpdateResponseResultFilterHTTP AccountGatewayRuleUpdateResponseResultFilter = "http" + AccountGatewayRuleUpdateResponseResultFilterDNS AccountGatewayRuleUpdateResponseResultFilter = "dns" + AccountGatewayRuleUpdateResponseResultFilterL4 AccountGatewayRuleUpdateResponseResultFilter = "l4" + AccountGatewayRuleUpdateResponseResultFilterEgress AccountGatewayRuleUpdateResponseResultFilter = "egress" +) + +// Additional settings that modify the rule's action. +type AccountGatewayRuleUpdateResponseResultRuleSettings struct { + // Add custom headers to allowed requests, in the form of key-value pairs. Keys are + // header names, pointing to an array with its header value(s). + AddHeaders interface{} `json:"add_headers"` + // Set by parent MSP accounts to enable their children to bypass this rule. + AllowChildBypass bool `json:"allow_child_bypass"` + // Settings for the Audit SSH action. + AuditSSH AccountGatewayRuleUpdateResponseResultRuleSettingsAuditSSH `json:"audit_ssh"` + // Configure how browser isolation behaves. + BisoAdminControls AccountGatewayRuleUpdateResponseResultRuleSettingsBisoAdminControls `json:"biso_admin_controls"` + // Enable the custom block page. + BlockPageEnabled bool `json:"block_page_enabled"` + // The text describing why this block occurred, displayed on the custom block page + // (if enabled). + BlockReason string `json:"block_reason"` + // Set by children MSP accounts to bypass their parent's rules. + BypassParentRule bool `json:"bypass_parent_rule"` + // Configure how session check behaves. + CheckSession AccountGatewayRuleUpdateResponseResultRuleSettingsCheckSession `json:"check_session"` + // Add your own custom resolvers to route queries that match the resolver policy. + // Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will + // route to the address closest to their origin. + DNSResolvers AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolvers `json:"dns_resolvers"` + // Configure how Gateway Proxy traffic egresses. You can enable this setting for + // rules with Egress actions and filters, or omit it to indicate local egress via + // WARP IPs. + Egress AccountGatewayRuleUpdateResponseResultRuleSettingsEgress `json:"egress"` + // INSECURE - disable DNSSEC validation (for Allow actions). + InsecureDisableDnssecValidation bool `json:"insecure_disable_dnssec_validation"` + // Set to true to enable IPs in DNS resolver category blocks. By default categories + // only block based on domain names. + IPCategories bool `json:"ip_categories"` + // Set to true to include IPs in DNS resolver indicator feed blocks. By default + // indicator feeds only block based on domain names. + IPIndicatorFeeds bool `json:"ip_indicator_feeds"` + // Send matching traffic to the supplied destination IP address and port. + L4override AccountGatewayRuleUpdateResponseResultRuleSettingsL4override `json:"l4override"` + // Configure a notification to display on the user's device when this rule is + // matched. + NotificationSettings AccountGatewayRuleUpdateResponseResultRuleSettingsNotificationSettings `json:"notification_settings"` + // Override matching DNS queries with a hostname. + OverrideHost string `json:"override_host"` + // Override matching DNS queries with an IP or set of IPs. + OverrideIPs []string `json:"override_ips"` + // Configure DLP payload logging. + PayloadLog AccountGatewayRuleUpdateResponseResultRuleSettingsPayloadLog `json:"payload_log"` + // Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS + // resolver. Cannot be set when dns_resolvers are specified. + ResolveDNSThroughCloudflare bool `json:"resolve_dns_through_cloudflare"` + // Configure behavior when an upstream cert is invalid or an SSL error occurs. + UntrustedCert AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCert `json:"untrusted_cert"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsJSON contains the JSON +// metadata for the struct [AccountGatewayRuleUpdateResponseResultRuleSettings] +type accountGatewayRuleUpdateResponseResultRuleSettingsJSON struct { + AddHeaders apijson.Field + AllowChildBypass apijson.Field + AuditSSH apijson.Field + BisoAdminControls apijson.Field + BlockPageEnabled apijson.Field + BlockReason apijson.Field + BypassParentRule apijson.Field + CheckSession apijson.Field + DNSResolvers apijson.Field + Egress apijson.Field + InsecureDisableDnssecValidation apijson.Field + IPCategories apijson.Field + IPIndicatorFeeds apijson.Field + L4override apijson.Field + NotificationSettings apijson.Field + OverrideHost apijson.Field + OverrideIPs apijson.Field + PayloadLog apijson.Field + ResolveDNSThroughCloudflare apijson.Field + UntrustedCert apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Settings for the Audit SSH action. +type AccountGatewayRuleUpdateResponseResultRuleSettingsAuditSSH struct { + // Enable to turn on SSH command logging. + CommandLogging bool `json:"command_logging"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsAuditSSHJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsAuditSSHJSON contains the JSON +// metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsAuditSSH] +type accountGatewayRuleUpdateResponseResultRuleSettingsAuditSSHJSON struct { + CommandLogging apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsAuditSSH) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how browser isolation behaves. +type AccountGatewayRuleUpdateResponseResultRuleSettingsBisoAdminControls struct { + // Set to true to enable copy-pasting. + Dcp bool `json:"dcp"` + // Set to true to enable downloading. + Dd bool `json:"dd"` + // Set to true to enable keyboard usage. + Dk bool `json:"dk"` + // Set to true to enable printing. + Dp bool `json:"dp"` + // Set to true to enable uploading. + Du bool `json:"du"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsBisoAdminControlsJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsBisoAdminControlsJSON contains +// the JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsBisoAdminControls] +type accountGatewayRuleUpdateResponseResultRuleSettingsBisoAdminControlsJSON struct { + Dcp apijson.Field + Dd apijson.Field + Dk apijson.Field + Dp apijson.Field + Du apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsBisoAdminControls) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how session check behaves. +type AccountGatewayRuleUpdateResponseResultRuleSettingsCheckSession struct { + // Configure how fresh the session needs to be to be considered valid. + Duration string `json:"duration"` + // Set to true to enable session enforcement. + Enforce bool `json:"enforce"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsCheckSessionJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsCheckSessionJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsCheckSession] +type accountGatewayRuleUpdateResponseResultRuleSettingsCheckSessionJSON struct { + Duration apijson.Field + Enforce apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsCheckSession) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Add your own custom resolvers to route queries that match the resolver policy. +// Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will +// route to the address closest to their origin. +type AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolvers struct { + Ipv4 []AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv4 `json:"ipv4"` + Ipv6 []AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv6 `json:"ipv6"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolvers] +type accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversJSON struct { + Ipv4 apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolvers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv4 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv4JSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv4JSON contains +// the JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv4] +type accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv4JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv4) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv6 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv6JSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv6JSON contains +// the JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv6] +type accountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv6JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsDNSResolversIpv6) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how Gateway Proxy traffic egresses. You can enable this setting for +// rules with Egress actions and filters, or omit it to indicate local egress via +// WARP IPs. +type AccountGatewayRuleUpdateResponseResultRuleSettingsEgress struct { + // The IPv4 address to be used for egress. + Ipv4 string `json:"ipv4"` + // The fallback IPv4 address to be used for egress in the event of an error + // egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + // WARP IPs. + Ipv4Fallback string `json:"ipv4_fallback"` + // The IPv6 range to be used for egress. + Ipv6 string `json:"ipv6"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsEgressJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsEgressJSON contains the JSON +// metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsEgress] +type accountGatewayRuleUpdateResponseResultRuleSettingsEgressJSON struct { + Ipv4 apijson.Field + Ipv4Fallback apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsEgress) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Send matching traffic to the supplied destination IP address and port. +type AccountGatewayRuleUpdateResponseResultRuleSettingsL4override struct { + // IPv4 or IPv6 address. + IP string `json:"ip"` + // A port number to use for TCP/UDP overrides. + Port int64 `json:"port"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsL4overrideJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsL4overrideJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsL4override] +type accountGatewayRuleUpdateResponseResultRuleSettingsL4overrideJSON struct { + IP apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsL4override) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure a notification to display on the user's device when this rule is +// matched. +type AccountGatewayRuleUpdateResponseResultRuleSettingsNotificationSettings struct { + // set notification on + Enabled bool `json:"enabled"` + // Customize the message shown in the notification. + Msg string `json:"msg"` + // Optional URL to direct users to additional information. If not set, the + // notification will open a block page. + SupportURL string `json:"support_url"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsNotificationSettingsJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsNotificationSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsNotificationSettings] +type accountGatewayRuleUpdateResponseResultRuleSettingsNotificationSettingsJSON struct { + Enabled apijson.Field + Msg apijson.Field + SupportURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsNotificationSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure DLP payload logging. +type AccountGatewayRuleUpdateResponseResultRuleSettingsPayloadLog struct { + // Set to true to enable DLP payload logging for this rule. + Enabled bool `json:"enabled"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsPayloadLogJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsPayloadLogJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsPayloadLog] +type accountGatewayRuleUpdateResponseResultRuleSettingsPayloadLogJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsPayloadLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure behavior when an upstream cert is invalid or an SSL error occurs. +type AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCert struct { + // The action performed when an untrusted certificate is seen. The default action + // is an error with HTTP code 526. + Action AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertAction `json:"action"` + JSON accountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertJSON contains the +// JSON metadata for the struct +// [AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCert] +type accountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertJSON struct { + Action apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCert) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action performed when an untrusted certificate is seen. The default action +// is an error with HTTP code 526. +type AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertAction string + +const ( + AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertActionPassThrough AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertAction = "pass_through" + AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertActionBlock AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertAction = "block" + AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertActionError AccountGatewayRuleUpdateResponseResultRuleSettingsUntrustedCertAction = "error" +) + +// The schedule for activating DNS policies. This does not apply to HTTP or network +// policies. +type AccountGatewayRuleUpdateResponseResultSchedule struct { + // The time intervals when the rule will be active on Fridays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Fridays. + Fri string `json:"fri"` + // The time intervals when the rule will be active on Mondays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Mondays. + Mon string `json:"mon"` + // The time intervals when the rule will be active on Saturdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Saturdays. + Sat string `json:"sat"` + // The time intervals when the rule will be active on Sundays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Sundays. + Sun string `json:"sun"` + // The time intervals when the rule will be active on Thursdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Thursdays. + Thu string `json:"thu"` + // The time zone the rule will be evaluated against. If a + // [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + // is provided, Gateway will always use the current time at that time zone. If this + // parameter is omitted, then Gateway will use the time zone inferred from the + // user's source IP to evaluate the rule. If Gateway cannot determine the time zone + // from the IP, we will fall back to the time zone of the user's connected data + // center. + TimeZone string `json:"time_zone"` + // The time intervals when the rule will be active on Tuesdays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Tuesdays. + Tue string `json:"tue"` + // The time intervals when the rule will be active on Wednesdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Wednesdays. + Wed string `json:"wed"` + JSON accountGatewayRuleUpdateResponseResultScheduleJSON `json:"-"` +} + +// accountGatewayRuleUpdateResponseResultScheduleJSON contains the JSON metadata +// for the struct [AccountGatewayRuleUpdateResponseResultSchedule] +type accountGatewayRuleUpdateResponseResultScheduleJSON struct { + Fri apijson.Field + Mon apijson.Field + Sat apijson.Field + Sun apijson.Field + Thu apijson.Field + TimeZone apijson.Field + Tue apijson.Field + Wed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleUpdateResponseResultSchedule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayRuleUpdateResponseSuccess bool + +const ( + AccountGatewayRuleUpdateResponseSuccessTrue AccountGatewayRuleUpdateResponseSuccess = true +) + +type AccountGatewayRuleDeleteResponse struct { + Errors []AccountGatewayRuleDeleteResponseError `json:"errors"` + Messages []AccountGatewayRuleDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountGatewayRuleDeleteResponseSuccess `json:"success"` + JSON accountGatewayRuleDeleteResponseJSON `json:"-"` +} + +// accountGatewayRuleDeleteResponseJSON contains the JSON metadata for the struct +// [AccountGatewayRuleDeleteResponse] +type accountGatewayRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleDeleteResponseErrorJSON `json:"-"` +} + +// accountGatewayRuleDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountGatewayRuleDeleteResponseError] +type accountGatewayRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleDeleteResponseMessageJSON `json:"-"` +} + +// accountGatewayRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountGatewayRuleDeleteResponseMessage] +type accountGatewayRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayRuleDeleteResponseSuccess bool + +const ( + AccountGatewayRuleDeleteResponseSuccessTrue AccountGatewayRuleDeleteResponseSuccess = true +) + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponse struct { + Errors []AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseError `json:"errors"` + Messages []AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseMessage `json:"messages"` + Result AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResult `json:"result"` + // Whether the API call was successful + Success AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseSuccess `json:"success"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponse] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseErrorJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseError] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseMessageJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseMessage] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResult struct { + // The API resource UUID. + ID string `json:"id"` + // The action to preform when the associated traffic, identity, and device posture + // expressions are either absent or evaluate to `true`. + Action AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction `json:"action"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Date of deletion, if any. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The description of the rule. + Description string `json:"description"` + // The wirefilter expression used for device posture check matching. + DevicePosture string `json:"device_posture"` + // True if the rule is enabled. + Enabled bool `json:"enabled"` + // The protocol or layer to evaluate the traffic, identity, and device posture + // expressions. + Filters []AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilter `json:"filters"` + // The wirefilter expression used for identity matching. + Identity string `json:"identity"` + // The name of the rule. + Name string `json:"name"` + // Precedence sets the order of your rules. Lower values indicate higher + // precedence. At each processing phase, applicable rules are evaluated in + // ascending order of this value. + Precedence int64 `json:"precedence"` + // Additional settings that modify the rule's action. + RuleSettings AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettings `json:"rule_settings"` + // The schedule for activating DNS policies. This does not apply to HTTP or network + // policies. + Schedule AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultSchedule `json:"schedule"` + // The wirefilter expression used for traffic matching. + Traffic string `json:"traffic"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResult] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Description apijson.Field + DevicePosture apijson.Field + Enabled apijson.Field + Filters apijson.Field + Identity apijson.Field + Name apijson.Field + Precedence apijson.Field + RuleSettings apijson.Field + Schedule apijson.Field + Traffic apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to preform when the associated traffic, identity, and device posture +// expressions are either absent or evaluate to `true`. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionOn AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "on" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionOff AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "off" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionAllow AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "allow" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionBlock AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "block" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionScan AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "scan" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionNoscan AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "noscan" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionSafesearch AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "safesearch" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionYtrestricted AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "ytrestricted" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionIsolate AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "isolate" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionNoisolate AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "noisolate" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionOverride AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "override" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionL4Override AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "l4_override" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionEgress AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "egress" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultActionAuditSSH AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultAction = "audit_ssh" +) + +// The protocol or layer to use. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilter string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilterHTTP AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilter = "http" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilterDNS AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilter = "dns" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilterL4 AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilter = "l4" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilterEgress AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultFilter = "egress" +) + +// Additional settings that modify the rule's action. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettings struct { + // Add custom headers to allowed requests, in the form of key-value pairs. Keys are + // header names, pointing to an array with its header value(s). + AddHeaders interface{} `json:"add_headers"` + // Set by parent MSP accounts to enable their children to bypass this rule. + AllowChildBypass bool `json:"allow_child_bypass"` + // Settings for the Audit SSH action. + AuditSSH AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsAuditSSH `json:"audit_ssh"` + // Configure how browser isolation behaves. + BisoAdminControls AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsBisoAdminControls `json:"biso_admin_controls"` + // Enable the custom block page. + BlockPageEnabled bool `json:"block_page_enabled"` + // The text describing why this block occurred, displayed on the custom block page + // (if enabled). + BlockReason string `json:"block_reason"` + // Set by children MSP accounts to bypass their parent's rules. + BypassParentRule bool `json:"bypass_parent_rule"` + // Configure how session check behaves. + CheckSession AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsCheckSession `json:"check_session"` + // Add your own custom resolvers to route queries that match the resolver policy. + // Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will + // route to the address closest to their origin. + DNSResolvers AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolvers `json:"dns_resolvers"` + // Configure how Gateway Proxy traffic egresses. You can enable this setting for + // rules with Egress actions and filters, or omit it to indicate local egress via + // WARP IPs. + Egress AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsEgress `json:"egress"` + // INSECURE - disable DNSSEC validation (for Allow actions). + InsecureDisableDnssecValidation bool `json:"insecure_disable_dnssec_validation"` + // Set to true to enable IPs in DNS resolver category blocks. By default categories + // only block based on domain names. + IPCategories bool `json:"ip_categories"` + // Set to true to include IPs in DNS resolver indicator feed blocks. By default + // indicator feeds only block based on domain names. + IPIndicatorFeeds bool `json:"ip_indicator_feeds"` + // Send matching traffic to the supplied destination IP address and port. + L4override AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsL4override `json:"l4override"` + // Configure a notification to display on the user's device when this rule is + // matched. + NotificationSettings AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsNotificationSettings `json:"notification_settings"` + // Override matching DNS queries with a hostname. + OverrideHost string `json:"override_host"` + // Override matching DNS queries with an IP or set of IPs. + OverrideIPs []string `json:"override_ips"` + // Configure DLP payload logging. + PayloadLog AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsPayloadLog `json:"payload_log"` + // Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS + // resolver. Cannot be set when dns_resolvers are specified. + ResolveDNSThroughCloudflare bool `json:"resolve_dns_through_cloudflare"` + // Configure behavior when an upstream cert is invalid or an SSL error occurs. + UntrustedCert AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCert `json:"untrusted_cert"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettings] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsJSON struct { + AddHeaders apijson.Field + AllowChildBypass apijson.Field + AuditSSH apijson.Field + BisoAdminControls apijson.Field + BlockPageEnabled apijson.Field + BlockReason apijson.Field + BypassParentRule apijson.Field + CheckSession apijson.Field + DNSResolvers apijson.Field + Egress apijson.Field + InsecureDisableDnssecValidation apijson.Field + IPCategories apijson.Field + IPIndicatorFeeds apijson.Field + L4override apijson.Field + NotificationSettings apijson.Field + OverrideHost apijson.Field + OverrideIPs apijson.Field + PayloadLog apijson.Field + ResolveDNSThroughCloudflare apijson.Field + UntrustedCert apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Settings for the Audit SSH action. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsAuditSSH struct { + // Enable to turn on SSH command logging. + CommandLogging bool `json:"command_logging"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsAuditSSHJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsAuditSSHJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsAuditSSH] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsAuditSSHJSON struct { + CommandLogging apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsAuditSSH) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how browser isolation behaves. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsBisoAdminControls struct { + // Set to true to enable copy-pasting. + Dcp bool `json:"dcp"` + // Set to true to enable downloading. + Dd bool `json:"dd"` + // Set to true to enable keyboard usage. + Dk bool `json:"dk"` + // Set to true to enable printing. + Dp bool `json:"dp"` + // Set to true to enable uploading. + Du bool `json:"du"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsBisoAdminControlsJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsBisoAdminControlsJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsBisoAdminControls] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsBisoAdminControlsJSON struct { + Dcp apijson.Field + Dd apijson.Field + Dk apijson.Field + Dp apijson.Field + Du apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsBisoAdminControls) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how session check behaves. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsCheckSession struct { + // Configure how fresh the session needs to be to be considered valid. + Duration string `json:"duration"` + // Set to true to enable session enforcement. + Enforce bool `json:"enforce"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsCheckSessionJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsCheckSessionJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsCheckSession] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsCheckSessionJSON struct { + Duration apijson.Field + Enforce apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsCheckSession) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Add your own custom resolvers to route queries that match the resolver policy. +// Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will +// route to the address closest to their origin. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolvers struct { + Ipv4 []AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv4 `json:"ipv4"` + Ipv6 []AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv6 `json:"ipv6"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolvers] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversJSON struct { + Ipv4 apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolvers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv4 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv4JSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv4JSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv4] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv4JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv4) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv6 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv6JSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv6JSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv6] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv6JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsDNSResolversIpv6) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how Gateway Proxy traffic egresses. You can enable this setting for +// rules with Egress actions and filters, or omit it to indicate local egress via +// WARP IPs. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsEgress struct { + // The IPv4 address to be used for egress. + Ipv4 string `json:"ipv4"` + // The fallback IPv4 address to be used for egress in the event of an error + // egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + // WARP IPs. + Ipv4Fallback string `json:"ipv4_fallback"` + // The IPv6 range to be used for egress. + Ipv6 string `json:"ipv6"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsEgressJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsEgressJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsEgress] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsEgressJSON struct { + Ipv4 apijson.Field + Ipv4Fallback apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsEgress) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Send matching traffic to the supplied destination IP address and port. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsL4override struct { + // IPv4 or IPv6 address. + IP string `json:"ip"` + // A port number to use for TCP/UDP overrides. + Port int64 `json:"port"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsL4overrideJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsL4overrideJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsL4override] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsL4overrideJSON struct { + IP apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsL4override) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure a notification to display on the user's device when this rule is +// matched. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsNotificationSettings struct { + // set notification on + Enabled bool `json:"enabled"` + // Customize the message shown in the notification. + Msg string `json:"msg"` + // Optional URL to direct users to additional information. If not set, the + // notification will open a block page. + SupportURL string `json:"support_url"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsNotificationSettingsJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsNotificationSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsNotificationSettings] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsNotificationSettingsJSON struct { + Enabled apijson.Field + Msg apijson.Field + SupportURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsNotificationSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure DLP payload logging. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsPayloadLog struct { + // Set to true to enable DLP payload logging for this rule. + Enabled bool `json:"enabled"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsPayloadLogJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsPayloadLogJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsPayloadLog] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsPayloadLogJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsPayloadLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure behavior when an upstream cert is invalid or an SSL error occurs. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCert struct { + // The action performed when an untrusted certificate is seen. The default action + // is an error with HTTP code 526. + Action AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertAction `json:"action"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCert] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertJSON struct { + Action apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCert) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action performed when an untrusted certificate is seen. The default action +// is an error with HTTP code 526. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertAction string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertActionPassThrough AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertAction = "pass_through" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertActionBlock AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertAction = "block" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertActionError AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultRuleSettingsUntrustedCertAction = "error" +) + +// The schedule for activating DNS policies. This does not apply to HTTP or network +// policies. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultSchedule struct { + // The time intervals when the rule will be active on Fridays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Fridays. + Fri string `json:"fri"` + // The time intervals when the rule will be active on Mondays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Mondays. + Mon string `json:"mon"` + // The time intervals when the rule will be active on Saturdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Saturdays. + Sat string `json:"sat"` + // The time intervals when the rule will be active on Sundays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Sundays. + Sun string `json:"sun"` + // The time intervals when the rule will be active on Thursdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Thursdays. + Thu string `json:"thu"` + // The time zone the rule will be evaluated against. If a + // [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + // is provided, Gateway will always use the current time at that time zone. If this + // parameter is omitted, then Gateway will use the time zone inferred from the + // user's source IP to evaluate the rule. If Gateway cannot determine the time zone + // from the IP, we will fall back to the time zone of the user's connected data + // center. + TimeZone string `json:"time_zone"` + // The time intervals when the rule will be active on Tuesdays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Tuesdays. + Tue string `json:"tue"` + // The time intervals when the rule will be active on Wednesdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Wednesdays. + Wed string `json:"wed"` + JSON accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultScheduleJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultScheduleJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultSchedule] +type accountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultScheduleJSON struct { + Fri apijson.Field + Mon apijson.Field + Sat apijson.Field + Sun apijson.Field + Thu apijson.Field + TimeZone apijson.Field + Tue apijson.Field + Wed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseResultSchedule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseSuccess bool + +const ( + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseSuccessTrue AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponseSuccess = true +) + +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponse struct { + Errors []AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseError `json:"errors"` + Messages []AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseMessage `json:"messages"` + Result []AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResult `json:"result"` + ResultInfo AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseSuccess `json:"success"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponse] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseErrorJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseError] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseMessageJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseMessage] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResult struct { + // The API resource UUID. + ID string `json:"id"` + // The action to preform when the associated traffic, identity, and device posture + // expressions are either absent or evaluate to `true`. + Action AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction `json:"action"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Date of deletion, if any. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The description of the rule. + Description string `json:"description"` + // The wirefilter expression used for device posture check matching. + DevicePosture string `json:"device_posture"` + // True if the rule is enabled. + Enabled bool `json:"enabled"` + // The protocol or layer to evaluate the traffic, identity, and device posture + // expressions. + Filters []AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilter `json:"filters"` + // The wirefilter expression used for identity matching. + Identity string `json:"identity"` + // The name of the rule. + Name string `json:"name"` + // Precedence sets the order of your rules. Lower values indicate higher + // precedence. At each processing phase, applicable rules are evaluated in + // ascending order of this value. + Precedence int64 `json:"precedence"` + // Additional settings that modify the rule's action. + RuleSettings AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettings `json:"rule_settings"` + // The schedule for activating DNS policies. This does not apply to HTTP or network + // policies. + Schedule AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultSchedule `json:"schedule"` + // The wirefilter expression used for traffic matching. + Traffic string `json:"traffic"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResult] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Description apijson.Field + DevicePosture apijson.Field + Enabled apijson.Field + Filters apijson.Field + Identity apijson.Field + Name apijson.Field + Precedence apijson.Field + RuleSettings apijson.Field + Schedule apijson.Field + Traffic apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to preform when the associated traffic, identity, and device posture +// expressions are either absent or evaluate to `true`. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionOn AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "on" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionOff AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "off" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionAllow AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "allow" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionBlock AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "block" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionScan AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "scan" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionNoscan AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "noscan" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionSafesearch AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "safesearch" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionYtrestricted AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "ytrestricted" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionIsolate AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "isolate" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionNoisolate AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "noisolate" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionOverride AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "override" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionL4Override AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "l4_override" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionEgress AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "egress" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultActionAuditSSH AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultAction = "audit_ssh" +) + +// The protocol or layer to use. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilter string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilterHTTP AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilter = "http" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilterDNS AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilter = "dns" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilterL4 AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilter = "l4" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilterEgress AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultFilter = "egress" +) + +// Additional settings that modify the rule's action. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettings struct { + // Add custom headers to allowed requests, in the form of key-value pairs. Keys are + // header names, pointing to an array with its header value(s). + AddHeaders interface{} `json:"add_headers"` + // Set by parent MSP accounts to enable their children to bypass this rule. + AllowChildBypass bool `json:"allow_child_bypass"` + // Settings for the Audit SSH action. + AuditSSH AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsAuditSSH `json:"audit_ssh"` + // Configure how browser isolation behaves. + BisoAdminControls AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsBisoAdminControls `json:"biso_admin_controls"` + // Enable the custom block page. + BlockPageEnabled bool `json:"block_page_enabled"` + // The text describing why this block occurred, displayed on the custom block page + // (if enabled). + BlockReason string `json:"block_reason"` + // Set by children MSP accounts to bypass their parent's rules. + BypassParentRule bool `json:"bypass_parent_rule"` + // Configure how session check behaves. + CheckSession AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsCheckSession `json:"check_session"` + // Add your own custom resolvers to route queries that match the resolver policy. + // Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will + // route to the address closest to their origin. + DNSResolvers AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolvers `json:"dns_resolvers"` + // Configure how Gateway Proxy traffic egresses. You can enable this setting for + // rules with Egress actions and filters, or omit it to indicate local egress via + // WARP IPs. + Egress AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsEgress `json:"egress"` + // INSECURE - disable DNSSEC validation (for Allow actions). + InsecureDisableDnssecValidation bool `json:"insecure_disable_dnssec_validation"` + // Set to true to enable IPs in DNS resolver category blocks. By default categories + // only block based on domain names. + IPCategories bool `json:"ip_categories"` + // Set to true to include IPs in DNS resolver indicator feed blocks. By default + // indicator feeds only block based on domain names. + IPIndicatorFeeds bool `json:"ip_indicator_feeds"` + // Send matching traffic to the supplied destination IP address and port. + L4override AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsL4override `json:"l4override"` + // Configure a notification to display on the user's device when this rule is + // matched. + NotificationSettings AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsNotificationSettings `json:"notification_settings"` + // Override matching DNS queries with a hostname. + OverrideHost string `json:"override_host"` + // Override matching DNS queries with an IP or set of IPs. + OverrideIPs []string `json:"override_ips"` + // Configure DLP payload logging. + PayloadLog AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsPayloadLog `json:"payload_log"` + // Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS + // resolver. Cannot be set when dns_resolvers are specified. + ResolveDNSThroughCloudflare bool `json:"resolve_dns_through_cloudflare"` + // Configure behavior when an upstream cert is invalid or an SSL error occurs. + UntrustedCert AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCert `json:"untrusted_cert"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettings] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsJSON struct { + AddHeaders apijson.Field + AllowChildBypass apijson.Field + AuditSSH apijson.Field + BisoAdminControls apijson.Field + BlockPageEnabled apijson.Field + BlockReason apijson.Field + BypassParentRule apijson.Field + CheckSession apijson.Field + DNSResolvers apijson.Field + Egress apijson.Field + InsecureDisableDnssecValidation apijson.Field + IPCategories apijson.Field + IPIndicatorFeeds apijson.Field + L4override apijson.Field + NotificationSettings apijson.Field + OverrideHost apijson.Field + OverrideIPs apijson.Field + PayloadLog apijson.Field + ResolveDNSThroughCloudflare apijson.Field + UntrustedCert apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Settings for the Audit SSH action. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsAuditSSH struct { + // Enable to turn on SSH command logging. + CommandLogging bool `json:"command_logging"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsAuditSSHJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsAuditSSHJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsAuditSSH] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsAuditSSHJSON struct { + CommandLogging apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsAuditSSH) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how browser isolation behaves. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsBisoAdminControls struct { + // Set to true to enable copy-pasting. + Dcp bool `json:"dcp"` + // Set to true to enable downloading. + Dd bool `json:"dd"` + // Set to true to enable keyboard usage. + Dk bool `json:"dk"` + // Set to true to enable printing. + Dp bool `json:"dp"` + // Set to true to enable uploading. + Du bool `json:"du"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsBisoAdminControlsJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsBisoAdminControlsJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsBisoAdminControls] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsBisoAdminControlsJSON struct { + Dcp apijson.Field + Dd apijson.Field + Dk apijson.Field + Dp apijson.Field + Du apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsBisoAdminControls) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how session check behaves. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsCheckSession struct { + // Configure how fresh the session needs to be to be considered valid. + Duration string `json:"duration"` + // Set to true to enable session enforcement. + Enforce bool `json:"enforce"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsCheckSessionJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsCheckSessionJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsCheckSession] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsCheckSessionJSON struct { + Duration apijson.Field + Enforce apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsCheckSession) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Add your own custom resolvers to route queries that match the resolver policy. +// Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will +// route to the address closest to their origin. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolvers struct { + Ipv4 []AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv4 `json:"ipv4"` + Ipv6 []AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv6 `json:"ipv6"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolvers] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversJSON struct { + Ipv4 apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolvers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv4 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv4JSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv4JSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv4] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv4JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv4) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv6 struct { + // IP address of upstream resolver. + IP string `json:"ip,required"` + // A port number to use for upstream resolver. + Port int64 `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork bool `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID string `json:"vnet_id"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv6JSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv6JSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv6] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv6JSON struct { + IP apijson.Field + Port apijson.Field + RouteThroughPrivateNetwork apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsDNSResolversIpv6) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure how Gateway Proxy traffic egresses. You can enable this setting for +// rules with Egress actions and filters, or omit it to indicate local egress via +// WARP IPs. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsEgress struct { + // The IPv4 address to be used for egress. + Ipv4 string `json:"ipv4"` + // The fallback IPv4 address to be used for egress in the event of an error + // egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + // WARP IPs. + Ipv4Fallback string `json:"ipv4_fallback"` + // The IPv6 range to be used for egress. + Ipv6 string `json:"ipv6"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsEgressJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsEgressJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsEgress] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsEgressJSON struct { + Ipv4 apijson.Field + Ipv4Fallback apijson.Field + Ipv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsEgress) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Send matching traffic to the supplied destination IP address and port. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsL4override struct { + // IPv4 or IPv6 address. + IP string `json:"ip"` + // A port number to use for TCP/UDP overrides. + Port int64 `json:"port"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsL4overrideJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsL4overrideJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsL4override] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsL4overrideJSON struct { + IP apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsL4override) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure a notification to display on the user's device when this rule is +// matched. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsNotificationSettings struct { + // set notification on + Enabled bool `json:"enabled"` + // Customize the message shown in the notification. + Msg string `json:"msg"` + // Optional URL to direct users to additional information. If not set, the + // notification will open a block page. + SupportURL string `json:"support_url"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsNotificationSettingsJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsNotificationSettingsJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsNotificationSettings] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsNotificationSettingsJSON struct { + Enabled apijson.Field + Msg apijson.Field + SupportURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsNotificationSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure DLP payload logging. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsPayloadLog struct { + // Set to true to enable DLP payload logging for this rule. + Enabled bool `json:"enabled"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsPayloadLogJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsPayloadLogJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsPayloadLog] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsPayloadLogJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsPayloadLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configure behavior when an upstream cert is invalid or an SSL error occurs. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCert struct { + // The action performed when an untrusted certificate is seen. The default action + // is an error with HTTP code 526. + Action AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertAction `json:"action"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCert] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertJSON struct { + Action apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCert) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action performed when an untrusted certificate is seen. The default action +// is an error with HTTP code 526. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertAction string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertActionPassThrough AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertAction = "pass_through" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertActionBlock AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertAction = "block" + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertActionError AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultRuleSettingsUntrustedCertAction = "error" +) + +// The schedule for activating DNS policies. This does not apply to HTTP or network +// policies. +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultSchedule struct { + // The time intervals when the rule will be active on Fridays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Fridays. + Fri string `json:"fri"` + // The time intervals when the rule will be active on Mondays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Mondays. + Mon string `json:"mon"` + // The time intervals when the rule will be active on Saturdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Saturdays. + Sat string `json:"sat"` + // The time intervals when the rule will be active on Sundays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Sundays. + Sun string `json:"sun"` + // The time intervals when the rule will be active on Thursdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Thursdays. + Thu string `json:"thu"` + // The time zone the rule will be evaluated against. If a + // [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + // is provided, Gateway will always use the current time at that time zone. If this + // parameter is omitted, then Gateway will use the time zone inferred from the + // user's source IP to evaluate the rule. If Gateway cannot determine the time zone + // from the IP, we will fall back to the time zone of the user's connected data + // center. + TimeZone string `json:"time_zone"` + // The time intervals when the rule will be active on Tuesdays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Tuesdays. + Tue string `json:"tue"` + // The time intervals when the rule will be active on Wednesdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Wednesdays. + Wed string `json:"wed"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultScheduleJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultScheduleJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultSchedule] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultScheduleJSON struct { + Fri apijson.Field + Mon apijson.Field + Sat apijson.Field + Sun apijson.Field + Thu apijson.Field + TimeZone apijson.Field + Tue apijson.Field + Wed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultSchedule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultInfoJSON `json:"-"` +} + +// accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultInfo] +type accountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseSuccess bool + +const ( + AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseSuccessTrue AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponseSuccess = true +) + +type AccountGatewayRuleUpdateParams struct { + // The action to preform when the associated traffic, identity, and device posture + // expressions are either absent or evaluate to `true`. + Action param.Field[AccountGatewayRuleUpdateParamsAction] `json:"action,required"` + // The name of the rule. + Name param.Field[string] `json:"name,required"` + // The description of the rule. + Description param.Field[string] `json:"description"` + // The wirefilter expression used for device posture check matching. + DevicePosture param.Field[string] `json:"device_posture"` + // True if the rule is enabled. + Enabled param.Field[bool] `json:"enabled"` + // The protocol or layer to evaluate the traffic, identity, and device posture + // expressions. + Filters param.Field[[]AccountGatewayRuleUpdateParamsFilter] `json:"filters"` + // The wirefilter expression used for identity matching. + Identity param.Field[string] `json:"identity"` + // Precedence sets the order of your rules. Lower values indicate higher + // precedence. At each processing phase, applicable rules are evaluated in + // ascending order of this value. + Precedence param.Field[int64] `json:"precedence"` + // Additional settings that modify the rule's action. + RuleSettings param.Field[AccountGatewayRuleUpdateParamsRuleSettings] `json:"rule_settings"` + // The schedule for activating DNS policies. This does not apply to HTTP or network + // policies. + Schedule param.Field[AccountGatewayRuleUpdateParamsSchedule] `json:"schedule"` + // The wirefilter expression used for traffic matching. + Traffic param.Field[string] `json:"traffic"` +} + +func (r AccountGatewayRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to preform when the associated traffic, identity, and device posture +// expressions are either absent or evaluate to `true`. +type AccountGatewayRuleUpdateParamsAction string + +const ( + AccountGatewayRuleUpdateParamsActionOn AccountGatewayRuleUpdateParamsAction = "on" + AccountGatewayRuleUpdateParamsActionOff AccountGatewayRuleUpdateParamsAction = "off" + AccountGatewayRuleUpdateParamsActionAllow AccountGatewayRuleUpdateParamsAction = "allow" + AccountGatewayRuleUpdateParamsActionBlock AccountGatewayRuleUpdateParamsAction = "block" + AccountGatewayRuleUpdateParamsActionScan AccountGatewayRuleUpdateParamsAction = "scan" + AccountGatewayRuleUpdateParamsActionNoscan AccountGatewayRuleUpdateParamsAction = "noscan" + AccountGatewayRuleUpdateParamsActionSafesearch AccountGatewayRuleUpdateParamsAction = "safesearch" + AccountGatewayRuleUpdateParamsActionYtrestricted AccountGatewayRuleUpdateParamsAction = "ytrestricted" + AccountGatewayRuleUpdateParamsActionIsolate AccountGatewayRuleUpdateParamsAction = "isolate" + AccountGatewayRuleUpdateParamsActionNoisolate AccountGatewayRuleUpdateParamsAction = "noisolate" + AccountGatewayRuleUpdateParamsActionOverride AccountGatewayRuleUpdateParamsAction = "override" + AccountGatewayRuleUpdateParamsActionL4Override AccountGatewayRuleUpdateParamsAction = "l4_override" + AccountGatewayRuleUpdateParamsActionEgress AccountGatewayRuleUpdateParamsAction = "egress" + AccountGatewayRuleUpdateParamsActionAuditSSH AccountGatewayRuleUpdateParamsAction = "audit_ssh" +) + +// The protocol or layer to use. +type AccountGatewayRuleUpdateParamsFilter string + +const ( + AccountGatewayRuleUpdateParamsFilterHTTP AccountGatewayRuleUpdateParamsFilter = "http" + AccountGatewayRuleUpdateParamsFilterDNS AccountGatewayRuleUpdateParamsFilter = "dns" + AccountGatewayRuleUpdateParamsFilterL4 AccountGatewayRuleUpdateParamsFilter = "l4" + AccountGatewayRuleUpdateParamsFilterEgress AccountGatewayRuleUpdateParamsFilter = "egress" +) + +// Additional settings that modify the rule's action. +type AccountGatewayRuleUpdateParamsRuleSettings struct { + // Add custom headers to allowed requests, in the form of key-value pairs. Keys are + // header names, pointing to an array with its header value(s). + AddHeaders param.Field[interface{}] `json:"add_headers"` + // Set by parent MSP accounts to enable their children to bypass this rule. + AllowChildBypass param.Field[bool] `json:"allow_child_bypass"` + // Settings for the Audit SSH action. + AuditSSH param.Field[AccountGatewayRuleUpdateParamsRuleSettingsAuditSSH] `json:"audit_ssh"` + // Configure how browser isolation behaves. + BisoAdminControls param.Field[AccountGatewayRuleUpdateParamsRuleSettingsBisoAdminControls] `json:"biso_admin_controls"` + // Enable the custom block page. + BlockPageEnabled param.Field[bool] `json:"block_page_enabled"` + // The text describing why this block occurred, displayed on the custom block page + // (if enabled). + BlockReason param.Field[string] `json:"block_reason"` + // Set by children MSP accounts to bypass their parent's rules. + BypassParentRule param.Field[bool] `json:"bypass_parent_rule"` + // Configure how session check behaves. + CheckSession param.Field[AccountGatewayRuleUpdateParamsRuleSettingsCheckSession] `json:"check_session"` + // Add your own custom resolvers to route queries that match the resolver policy. + // Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will + // route to the address closest to their origin. + DNSResolvers param.Field[AccountGatewayRuleUpdateParamsRuleSettingsDNSResolvers] `json:"dns_resolvers"` + // Configure how Gateway Proxy traffic egresses. You can enable this setting for + // rules with Egress actions and filters, or omit it to indicate local egress via + // WARP IPs. + Egress param.Field[AccountGatewayRuleUpdateParamsRuleSettingsEgress] `json:"egress"` + // INSECURE - disable DNSSEC validation (for Allow actions). + InsecureDisableDnssecValidation param.Field[bool] `json:"insecure_disable_dnssec_validation"` + // Set to true to enable IPs in DNS resolver category blocks. By default categories + // only block based on domain names. + IPCategories param.Field[bool] `json:"ip_categories"` + // Set to true to include IPs in DNS resolver indicator feed blocks. By default + // indicator feeds only block based on domain names. + IPIndicatorFeeds param.Field[bool] `json:"ip_indicator_feeds"` + // Send matching traffic to the supplied destination IP address and port. + L4override param.Field[AccountGatewayRuleUpdateParamsRuleSettingsL4override] `json:"l4override"` + // Configure a notification to display on the user's device when this rule is + // matched. + NotificationSettings param.Field[AccountGatewayRuleUpdateParamsRuleSettingsNotificationSettings] `json:"notification_settings"` + // Override matching DNS queries with a hostname. + OverrideHost param.Field[string] `json:"override_host"` + // Override matching DNS queries with an IP or set of IPs. + OverrideIPs param.Field[[]string] `json:"override_ips"` + // Configure DLP payload logging. + PayloadLog param.Field[AccountGatewayRuleUpdateParamsRuleSettingsPayloadLog] `json:"payload_log"` + // Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS + // resolver. Cannot be set when dns_resolvers are specified. + ResolveDNSThroughCloudflare param.Field[bool] `json:"resolve_dns_through_cloudflare"` + // Configure behavior when an upstream cert is invalid or an SSL error occurs. + UntrustedCert param.Field[AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCert] `json:"untrusted_cert"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Settings for the Audit SSH action. +type AccountGatewayRuleUpdateParamsRuleSettingsAuditSSH struct { + // Enable to turn on SSH command logging. + CommandLogging param.Field[bool] `json:"command_logging"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsAuditSSH) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure how browser isolation behaves. +type AccountGatewayRuleUpdateParamsRuleSettingsBisoAdminControls struct { + // Set to true to enable copy-pasting. + Dcp param.Field[bool] `json:"dcp"` + // Set to true to enable downloading. + Dd param.Field[bool] `json:"dd"` + // Set to true to enable keyboard usage. + Dk param.Field[bool] `json:"dk"` + // Set to true to enable printing. + Dp param.Field[bool] `json:"dp"` + // Set to true to enable uploading. + Du param.Field[bool] `json:"du"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsBisoAdminControls) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure how session check behaves. +type AccountGatewayRuleUpdateParamsRuleSettingsCheckSession struct { + // Configure how fresh the session needs to be to be considered valid. + Duration param.Field[string] `json:"duration"` + // Set to true to enable session enforcement. + Enforce param.Field[bool] `json:"enforce"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsCheckSession) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Add your own custom resolvers to route queries that match the resolver policy. +// Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will +// route to the address closest to their origin. +type AccountGatewayRuleUpdateParamsRuleSettingsDNSResolvers struct { + Ipv4 param.Field[[]AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv4] `json:"ipv4"` + Ipv6 param.Field[[]AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv6] `json:"ipv6"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsDNSResolvers) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv4 struct { + // IP address of upstream resolver. + IP param.Field[string] `json:"ip,required"` + // A port number to use for upstream resolver. + Port param.Field[int64] `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork param.Field[bool] `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID param.Field[string] `json:"vnet_id"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv4) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv6 struct { + // IP address of upstream resolver. + IP param.Field[string] `json:"ip,required"` + // A port number to use for upstream resolver. + Port param.Field[int64] `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork param.Field[bool] `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID param.Field[string] `json:"vnet_id"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv6) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure how Gateway Proxy traffic egresses. You can enable this setting for +// rules with Egress actions and filters, or omit it to indicate local egress via +// WARP IPs. +type AccountGatewayRuleUpdateParamsRuleSettingsEgress struct { + // The IPv4 address to be used for egress. + Ipv4 param.Field[string] `json:"ipv4"` + // The fallback IPv4 address to be used for egress in the event of an error + // egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + // WARP IPs. + Ipv4Fallback param.Field[string] `json:"ipv4_fallback"` + // The IPv6 range to be used for egress. + Ipv6 param.Field[string] `json:"ipv6"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsEgress) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Send matching traffic to the supplied destination IP address and port. +type AccountGatewayRuleUpdateParamsRuleSettingsL4override struct { + // IPv4 or IPv6 address. + IP param.Field[string] `json:"ip"` + // A port number to use for TCP/UDP overrides. + Port param.Field[int64] `json:"port"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsL4override) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure a notification to display on the user's device when this rule is +// matched. +type AccountGatewayRuleUpdateParamsRuleSettingsNotificationSettings struct { + // set notification on + Enabled param.Field[bool] `json:"enabled"` + // Customize the message shown in the notification. + Msg param.Field[string] `json:"msg"` + // Optional URL to direct users to additional information. If not set, the + // notification will open a block page. + SupportURL param.Field[string] `json:"support_url"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsNotificationSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure DLP payload logging. +type AccountGatewayRuleUpdateParamsRuleSettingsPayloadLog struct { + // Set to true to enable DLP payload logging for this rule. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsPayloadLog) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure behavior when an upstream cert is invalid or an SSL error occurs. +type AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCert struct { + // The action performed when an untrusted certificate is seen. The default action + // is an error with HTTP code 526. + Action param.Field[AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertAction] `json:"action"` +} + +func (r AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCert) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action performed when an untrusted certificate is seen. The default action +// is an error with HTTP code 526. +type AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertAction string + +const ( + AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertActionPassThrough AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertAction = "pass_through" + AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertActionBlock AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertAction = "block" + AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertActionError AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertAction = "error" +) + +// The schedule for activating DNS policies. This does not apply to HTTP or network +// policies. +type AccountGatewayRuleUpdateParamsSchedule struct { + // The time intervals when the rule will be active on Fridays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Fridays. + Fri param.Field[string] `json:"fri"` + // The time intervals when the rule will be active on Mondays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Mondays. + Mon param.Field[string] `json:"mon"` + // The time intervals when the rule will be active on Saturdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Saturdays. + Sat param.Field[string] `json:"sat"` + // The time intervals when the rule will be active on Sundays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Sundays. + Sun param.Field[string] `json:"sun"` + // The time intervals when the rule will be active on Thursdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Thursdays. + Thu param.Field[string] `json:"thu"` + // The time zone the rule will be evaluated against. If a + // [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + // is provided, Gateway will always use the current time at that time zone. If this + // parameter is omitted, then Gateway will use the time zone inferred from the + // user's source IP to evaluate the rule. If Gateway cannot determine the time zone + // from the IP, we will fall back to the time zone of the user's connected data + // center. + TimeZone param.Field[string] `json:"time_zone"` + // The time intervals when the rule will be active on Tuesdays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Tuesdays. + Tue param.Field[string] `json:"tue"` + // The time intervals when the rule will be active on Wednesdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Wednesdays. + Wed param.Field[string] `json:"wed"` +} + +func (r AccountGatewayRuleUpdateParamsSchedule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParams struct { + // The action to preform when the associated traffic, identity, and device posture + // expressions are either absent or evaluate to `true`. + Action param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction] `json:"action,required"` + // The name of the rule. + Name param.Field[string] `json:"name,required"` + // The description of the rule. + Description param.Field[string] `json:"description"` + // The wirefilter expression used for device posture check matching. + DevicePosture param.Field[string] `json:"device_posture"` + // True if the rule is enabled. + Enabled param.Field[bool] `json:"enabled"` + // The protocol or layer to evaluate the traffic, identity, and device posture + // expressions. + Filters param.Field[[]AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilter] `json:"filters"` + // The wirefilter expression used for identity matching. + Identity param.Field[string] `json:"identity"` + // Precedence sets the order of your rules. Lower values indicate higher + // precedence. At each processing phase, applicable rules are evaluated in + // ascending order of this value. + Precedence param.Field[int64] `json:"precedence"` + // Additional settings that modify the rule's action. + RuleSettings param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettings] `json:"rule_settings"` + // The schedule for activating DNS policies. This does not apply to HTTP or network + // policies. + Schedule param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsSchedule] `json:"schedule"` + // The wirefilter expression used for traffic matching. + Traffic param.Field[string] `json:"traffic"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to preform when the associated traffic, identity, and device posture +// expressions are either absent or evaluate to `true`. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionOn AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "on" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionOff AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "off" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionAllow AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "allow" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionBlock AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "block" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionScan AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "scan" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionNoscan AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "noscan" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionSafesearch AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "safesearch" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionYtrestricted AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "ytrestricted" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionIsolate AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "isolate" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionNoisolate AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "noisolate" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionOverride AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "override" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionL4Override AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "l4_override" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionEgress AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "egress" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionAuditSSH AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsAction = "audit_ssh" +) + +// The protocol or layer to use. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilter string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilterHTTP AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilter = "http" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilterDNS AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilter = "dns" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilterL4 AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilter = "l4" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilterEgress AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilter = "egress" +) + +// Additional settings that modify the rule's action. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettings struct { + // Add custom headers to allowed requests, in the form of key-value pairs. Keys are + // header names, pointing to an array with its header value(s). + AddHeaders param.Field[interface{}] `json:"add_headers"` + // Set by parent MSP accounts to enable their children to bypass this rule. + AllowChildBypass param.Field[bool] `json:"allow_child_bypass"` + // Settings for the Audit SSH action. + AuditSSH param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsAuditSSH] `json:"audit_ssh"` + // Configure how browser isolation behaves. + BisoAdminControls param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsBisoAdminControls] `json:"biso_admin_controls"` + // Enable the custom block page. + BlockPageEnabled param.Field[bool] `json:"block_page_enabled"` + // The text describing why this block occurred, displayed on the custom block page + // (if enabled). + BlockReason param.Field[string] `json:"block_reason"` + // Set by children MSP accounts to bypass their parent's rules. + BypassParentRule param.Field[bool] `json:"bypass_parent_rule"` + // Configure how session check behaves. + CheckSession param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsCheckSession] `json:"check_session"` + // Add your own custom resolvers to route queries that match the resolver policy. + // Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will + // route to the address closest to their origin. + DNSResolvers param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolvers] `json:"dns_resolvers"` + // Configure how Gateway Proxy traffic egresses. You can enable this setting for + // rules with Egress actions and filters, or omit it to indicate local egress via + // WARP IPs. + Egress param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsEgress] `json:"egress"` + // INSECURE - disable DNSSEC validation (for Allow actions). + InsecureDisableDnssecValidation param.Field[bool] `json:"insecure_disable_dnssec_validation"` + // Set to true to enable IPs in DNS resolver category blocks. By default categories + // only block based on domain names. + IPCategories param.Field[bool] `json:"ip_categories"` + // Set to true to include IPs in DNS resolver indicator feed blocks. By default + // indicator feeds only block based on domain names. + IPIndicatorFeeds param.Field[bool] `json:"ip_indicator_feeds"` + // Send matching traffic to the supplied destination IP address and port. + L4override param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsL4override] `json:"l4override"` + // Configure a notification to display on the user's device when this rule is + // matched. + NotificationSettings param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsNotificationSettings] `json:"notification_settings"` + // Override matching DNS queries with a hostname. + OverrideHost param.Field[string] `json:"override_host"` + // Override matching DNS queries with an IP or set of IPs. + OverrideIPs param.Field[[]string] `json:"override_ips"` + // Configure DLP payload logging. + PayloadLog param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsPayloadLog] `json:"payload_log"` + // Enable to send queries that match the policy to Cloudflare's default 1.1.1.1 DNS + // resolver. Cannot be set when dns_resolvers are specified. + ResolveDNSThroughCloudflare param.Field[bool] `json:"resolve_dns_through_cloudflare"` + // Configure behavior when an upstream cert is invalid or an SSL error occurs. + UntrustedCert param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCert] `json:"untrusted_cert"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Settings for the Audit SSH action. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsAuditSSH struct { + // Enable to turn on SSH command logging. + CommandLogging param.Field[bool] `json:"command_logging"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsAuditSSH) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure how browser isolation behaves. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsBisoAdminControls struct { + // Set to true to enable copy-pasting. + Dcp param.Field[bool] `json:"dcp"` + // Set to true to enable downloading. + Dd param.Field[bool] `json:"dd"` + // Set to true to enable keyboard usage. + Dk param.Field[bool] `json:"dk"` + // Set to true to enable printing. + Dp param.Field[bool] `json:"dp"` + // Set to true to enable uploading. + Du param.Field[bool] `json:"du"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsBisoAdminControls) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure how session check behaves. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsCheckSession struct { + // Configure how fresh the session needs to be to be considered valid. + Duration param.Field[string] `json:"duration"` + // Set to true to enable session enforcement. + Enforce param.Field[bool] `json:"enforce"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsCheckSession) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Add your own custom resolvers to route queries that match the resolver policy. +// Cannot be used when resolve_dns_through_cloudflare is set. DNS queries will +// route to the address closest to their origin. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolvers struct { + Ipv4 param.Field[[]AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv4] `json:"ipv4"` + Ipv6 param.Field[[]AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv6] `json:"ipv6"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolvers) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv4 struct { + // IP address of upstream resolver. + IP param.Field[string] `json:"ip,required"` + // A port number to use for upstream resolver. + Port param.Field[int64] `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork param.Field[bool] `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID param.Field[string] `json:"vnet_id"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv4) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv6 struct { + // IP address of upstream resolver. + IP param.Field[string] `json:"ip,required"` + // A port number to use for upstream resolver. + Port param.Field[int64] `json:"port"` + // Whether to connect to this resolver over a private network. Must be set when + // vnet_id is set. + RouteThroughPrivateNetwork param.Field[bool] `json:"route_through_private_network"` + // Optionally specify a virtual network for this resolver. Uses default virtual + // network id if omitted. + VnetID param.Field[string] `json:"vnet_id"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv6) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure how Gateway Proxy traffic egresses. You can enable this setting for +// rules with Egress actions and filters, or omit it to indicate local egress via +// WARP IPs. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsEgress struct { + // The IPv4 address to be used for egress. + Ipv4 param.Field[string] `json:"ipv4"` + // The fallback IPv4 address to be used for egress in the event of an error + // egressing with the primary IPv4. Can be '0.0.0.0' to indicate local egress via + // WARP IPs. + Ipv4Fallback param.Field[string] `json:"ipv4_fallback"` + // The IPv6 range to be used for egress. + Ipv6 param.Field[string] `json:"ipv6"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsEgress) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Send matching traffic to the supplied destination IP address and port. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsL4override struct { + // IPv4 or IPv6 address. + IP param.Field[string] `json:"ip"` + // A port number to use for TCP/UDP overrides. + Port param.Field[int64] `json:"port"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsL4override) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure a notification to display on the user's device when this rule is +// matched. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsNotificationSettings struct { + // set notification on + Enabled param.Field[bool] `json:"enabled"` + // Customize the message shown in the notification. + Msg param.Field[string] `json:"msg"` + // Optional URL to direct users to additional information. If not set, the + // notification will open a block page. + SupportURL param.Field[string] `json:"support_url"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsNotificationSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure DLP payload logging. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsPayloadLog struct { + // Set to true to enable DLP payload logging for this rule. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsPayloadLog) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configure behavior when an upstream cert is invalid or an SSL error occurs. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCert struct { + // The action performed when an untrusted certificate is seen. The default action + // is an error with HTTP code 526. + Action param.Field[AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertAction] `json:"action"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCert) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action performed when an untrusted certificate is seen. The default action +// is an error with HTTP code 526. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertAction string + +const ( + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertActionPassThrough AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertAction = "pass_through" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertActionBlock AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertAction = "block" + AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertActionError AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertAction = "error" +) + +// The schedule for activating DNS policies. This does not apply to HTTP or network +// policies. +type AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsSchedule struct { + // The time intervals when the rule will be active on Fridays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Fridays. + Fri param.Field[string] `json:"fri"` + // The time intervals when the rule will be active on Mondays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Mondays. + Mon param.Field[string] `json:"mon"` + // The time intervals when the rule will be active on Saturdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Saturdays. + Sat param.Field[string] `json:"sat"` + // The time intervals when the rule will be active on Sundays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Sundays. + Sun param.Field[string] `json:"sun"` + // The time intervals when the rule will be active on Thursdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Thursdays. + Thu param.Field[string] `json:"thu"` + // The time zone the rule will be evaluated against. If a + // [valid time zone city name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) + // is provided, Gateway will always use the current time at that time zone. If this + // parameter is omitted, then Gateway will use the time zone inferred from the + // user's source IP to evaluate the rule. If Gateway cannot determine the time zone + // from the IP, we will fall back to the time zone of the user's connected data + // center. + TimeZone param.Field[string] `json:"time_zone"` + // The time intervals when the rule will be active on Tuesdays, in increasing order + // from 00:00-24:00. If this parameter is omitted, the rule will be deactivated on + // Tuesdays. + Tue param.Field[string] `json:"tue"` + // The time intervals when the rule will be active on Wednesdays, in increasing + // order from 00:00-24:00. If this parameter is omitted, the rule will be + // deactivated on Wednesdays. + Wed param.Field[string] `json:"wed"` +} + +func (r AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsSchedule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountgatewayrule_test.go b/accountgatewayrule_test.go new file mode 100644 index 00000000000..ae5f0f9cd8d --- /dev/null +++ b/accountgatewayrule_test.go @@ -0,0 +1,379 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountGatewayRuleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Rules.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountGatewayRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Rules.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountGatewayRuleUpdateParams{ + Action: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsActionAllow), + Name: cloudflare.F("block bad websites"), + Description: cloudflare.F("Block bad websites based on their host name."), + DevicePosture: cloudflare.F("any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})"), + Enabled: cloudflare.F(true), + Filters: cloudflare.F([]cloudflare.AccountGatewayRuleUpdateParamsFilter{cloudflare.AccountGatewayRuleUpdateParamsFilterHTTP}), + Identity: cloudflare.F("any(identity.groups.name[*] in {\"finance\"})"), + Precedence: cloudflare.F(int64(0)), + RuleSettings: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettings{ + AddHeaders: cloudflare.F[any](map[string]interface{}{ + "My-Next-Header": map[string]interface{}{ + "0": "foo", + "1": "bar", + }, + "X-Custom-Header-Name": map[string]interface{}{ + "0": "somecustomvalue", + }, + }), + AllowChildBypass: cloudflare.F(false), + AuditSSH: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsAuditSSH{ + CommandLogging: cloudflare.F(false), + }), + BisoAdminControls: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsBisoAdminControls{ + Dcp: cloudflare.F(false), + Dd: cloudflare.F(false), + Dk: cloudflare.F(false), + Dp: cloudflare.F(false), + Du: cloudflare.F(false), + }), + BlockPageEnabled: cloudflare.F(true), + BlockReason: cloudflare.F("This website is a security risk"), + BypassParentRule: cloudflare.F(false), + CheckSession: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsCheckSession{ + Duration: cloudflare.F("300s"), + Enforce: cloudflare.F(true), + }), + DNSResolvers: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsDNSResolvers{ + Ipv4: cloudflare.F([]cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv4{{ + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }}), + Ipv6: cloudflare.F([]cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsDNSResolversIpv6{{ + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }}), + }), + Egress: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsEgress{ + Ipv4: cloudflare.F("192.0.2.2"), + Ipv4Fallback: cloudflare.F("192.0.2.3"), + Ipv6: cloudflare.F("2001:DB8::/64"), + }), + InsecureDisableDnssecValidation: cloudflare.F(false), + IPCategories: cloudflare.F(true), + IPIndicatorFeeds: cloudflare.F(true), + L4override: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsL4override{ + IP: cloudflare.F("1.1.1.1"), + Port: cloudflare.F(int64(0)), + }), + NotificationSettings: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsNotificationSettings{ + Enabled: cloudflare.F(true), + Msg: cloudflare.F("string"), + SupportURL: cloudflare.F("string"), + }), + OverrideHost: cloudflare.F("example.com"), + OverrideIPs: cloudflare.F([]string{"1.1.1.1", "2.2.2.2"}), + PayloadLog: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsPayloadLog{ + Enabled: cloudflare.F(true), + }), + ResolveDNSThroughCloudflare: cloudflare.F(true), + UntrustedCert: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCert{ + Action: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsRuleSettingsUntrustedCertActionError), + }), + }), + Schedule: cloudflare.F(cloudflare.AccountGatewayRuleUpdateParamsSchedule{ + Fri: cloudflare.F("08:00-12:30,13:30-17:00"), + Mon: cloudflare.F("08:00-12:30,13:30-17:00"), + Sat: cloudflare.F("08:00-12:30,13:30-17:00"), + Sun: cloudflare.F("08:00-12:30,13:30-17:00"), + Thu: cloudflare.F("08:00-12:30,13:30-17:00"), + TimeZone: cloudflare.F("America/New York"), + Tue: cloudflare.F("08:00-12:30,13:30-17:00"), + Wed: cloudflare.F("08:00-12:30,13:30-17:00"), + }), + Traffic: cloudflare.F("http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10"), + }, + ) + 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 TestAccountGatewayRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Rules.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Rules.ZeroTrustGatewayRulesNewZeroTrustGatewayRule( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParams{ + Action: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsActionAllow), + Name: cloudflare.F("block bad websites"), + Description: cloudflare.F("Block bad websites based on their host name."), + DevicePosture: cloudflare.F("any(device_posture.checks.passed[*] in {\"1308749e-fcfb-4ebc-b051-fe022b632644\"})"), + Enabled: cloudflare.F(true), + Filters: cloudflare.F([]cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilter{cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsFilterHTTP}), + Identity: cloudflare.F("any(identity.groups.name[*] in {\"finance\"})"), + Precedence: cloudflare.F(int64(0)), + RuleSettings: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettings{ + AddHeaders: cloudflare.F[any](map[string]interface{}{ + "My-Next-Header": map[string]interface{}{ + "0": "foo", + "1": "bar", + }, + "X-Custom-Header-Name": map[string]interface{}{ + "0": "somecustomvalue", + }, + }), + AllowChildBypass: cloudflare.F(false), + AuditSSH: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsAuditSSH{ + CommandLogging: cloudflare.F(false), + }), + BisoAdminControls: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsBisoAdminControls{ + Dcp: cloudflare.F(false), + Dd: cloudflare.F(false), + Dk: cloudflare.F(false), + Dp: cloudflare.F(false), + Du: cloudflare.F(false), + }), + BlockPageEnabled: cloudflare.F(true), + BlockReason: cloudflare.F("This website is a security risk"), + BypassParentRule: cloudflare.F(false), + CheckSession: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsCheckSession{ + Duration: cloudflare.F("300s"), + Enforce: cloudflare.F(true), + }), + DNSResolvers: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolvers{ + Ipv4: cloudflare.F([]cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv4{{ + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }}), + Ipv6: cloudflare.F([]cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsDNSResolversIpv6{{ + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }, { + IP: cloudflare.F("2001:DB8::/64"), + Port: cloudflare.F(int64(5053)), + RouteThroughPrivateNetwork: cloudflare.F(true), + VnetID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + }}), + }), + Egress: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsEgress{ + Ipv4: cloudflare.F("192.0.2.2"), + Ipv4Fallback: cloudflare.F("192.0.2.3"), + Ipv6: cloudflare.F("2001:DB8::/64"), + }), + InsecureDisableDnssecValidation: cloudflare.F(false), + IPCategories: cloudflare.F(true), + IPIndicatorFeeds: cloudflare.F(true), + L4override: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsL4override{ + IP: cloudflare.F("1.1.1.1"), + Port: cloudflare.F(int64(0)), + }), + NotificationSettings: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsNotificationSettings{ + Enabled: cloudflare.F(true), + Msg: cloudflare.F("string"), + SupportURL: cloudflare.F("string"), + }), + OverrideHost: cloudflare.F("example.com"), + OverrideIPs: cloudflare.F([]string{"1.1.1.1", "2.2.2.2"}), + PayloadLog: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsPayloadLog{ + Enabled: cloudflare.F(true), + }), + ResolveDNSThroughCloudflare: cloudflare.F(true), + UntrustedCert: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCert{ + Action: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsRuleSettingsUntrustedCertActionError), + }), + }), + Schedule: cloudflare.F(cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParamsSchedule{ + Fri: cloudflare.F("08:00-12:30,13:30-17:00"), + Mon: cloudflare.F("08:00-12:30,13:30-17:00"), + Sat: cloudflare.F("08:00-12:30,13:30-17:00"), + Sun: cloudflare.F("08:00-12:30,13:30-17:00"), + Thu: cloudflare.F("08:00-12:30,13:30-17:00"), + TimeZone: cloudflare.F("America/New York"), + Tue: cloudflare.F("08:00-12:30,13:30-17:00"), + Wed: cloudflare.F("08:00-12:30,13:30-17:00"), + }), + Traffic: cloudflare.F("http.request.uri matches \".*a/partial/uri.*\" and http.request.host in $01302951-49f9-47c9-a400-0297e60b6a10"), + }, + ) + 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 TestAccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Gateway.Rules.ZeroTrustGatewayRulesListZeroTrustGatewayRules(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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/accounthyperdrive.go b/accounthyperdrive.go new file mode 100644 index 00000000000..907e5d77c6d --- /dev/null +++ b/accounthyperdrive.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountHyperdriveService 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 [NewAccountHyperdriveService] method +// instead. +type AccountHyperdriveService struct { + Options []option.RequestOption + Configs *AccountHyperdriveConfigService +} + +// NewAccountHyperdriveService 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 NewAccountHyperdriveService(opts ...option.RequestOption) (r *AccountHyperdriveService) { + r = &AccountHyperdriveService{} + r.Options = opts + r.Configs = NewAccountHyperdriveConfigService(opts...) + return +} diff --git a/accounthyperdriveconfig.go b/accounthyperdriveconfig.go new file mode 100644 index 00000000000..afc75e159fc --- /dev/null +++ b/accounthyperdriveconfig.go @@ -0,0 +1,406 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountHyperdriveConfigService 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 +// [NewAccountHyperdriveConfigService] method instead. +type AccountHyperdriveConfigService struct { + Options []option.RequestOption +} + +// NewAccountHyperdriveConfigService 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 NewAccountHyperdriveConfigService(opts ...option.RequestOption) (r *AccountHyperdriveConfigService) { + r = &AccountHyperdriveConfigService{} + r.Options = opts + return +} + +// Creates and returns a new Hyperdrive configuration. +func (r *AccountHyperdriveConfigService) New(ctx context.Context, accountIdentifier string, body AccountHyperdriveConfigNewParams, opts ...option.RequestOption) (res *AccountHyperdriveConfigNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/hyperdrive/configs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Returns a list of Hyperdrives +func (r *AccountHyperdriveConfigService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountHyperdriveConfigListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/hyperdrive/configs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountHyperdriveConfigNewResponse struct { + Errors []AccountHyperdriveConfigNewResponseError `json:"errors"` + Messages []AccountHyperdriveConfigNewResponseMessage `json:"messages"` + Result AccountHyperdriveConfigNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountHyperdriveConfigNewResponseSuccess `json:"success"` + JSON accountHyperdriveConfigNewResponseJSON `json:"-"` +} + +// accountHyperdriveConfigNewResponseJSON contains the JSON metadata for the struct +// [AccountHyperdriveConfigNewResponse] +type accountHyperdriveConfigNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountHyperdriveConfigNewResponseErrorJSON `json:"-"` +} + +// accountHyperdriveConfigNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountHyperdriveConfigNewResponseError] +type accountHyperdriveConfigNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountHyperdriveConfigNewResponseMessageJSON `json:"-"` +} + +// accountHyperdriveConfigNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountHyperdriveConfigNewResponseMessage] +type accountHyperdriveConfigNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigNewResponseResult struct { + Name string `json:"name,required"` + Origin AccountHyperdriveConfigNewResponseResultOrigin `json:"origin,required"` + Caching AccountHyperdriveConfigNewResponseResultCaching `json:"caching"` + JSON accountHyperdriveConfigNewResponseResultJSON `json:"-"` +} + +// accountHyperdriveConfigNewResponseResultJSON contains the JSON metadata for the +// struct [AccountHyperdriveConfigNewResponseResult] +type accountHyperdriveConfigNewResponseResultJSON struct { + Name apijson.Field + Origin apijson.Field + Caching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigNewResponseResultOrigin struct { + // The name of your origin database. + Database string `json:"database"` + // The host (hostname or IP) of your origin database. + Host string `json:"host"` + // The port (default: 5432 for Postgres) of your origin database. + Port int64 `json:"port"` + // Specifies the URL scheme used to connect to your origin database. + Scheme AccountHyperdriveConfigNewResponseResultOriginScheme `json:"scheme"` + // The user of your origin database. + User string `json:"user"` + JSON accountHyperdriveConfigNewResponseResultOriginJSON `json:"-"` +} + +// accountHyperdriveConfigNewResponseResultOriginJSON contains the JSON metadata +// for the struct [AccountHyperdriveConfigNewResponseResultOrigin] +type accountHyperdriveConfigNewResponseResultOriginJSON struct { + Database apijson.Field + Host apijson.Field + Port apijson.Field + Scheme apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigNewResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the URL scheme used to connect to your origin database. +type AccountHyperdriveConfigNewResponseResultOriginScheme string + +const ( + AccountHyperdriveConfigNewResponseResultOriginSchemePostgres AccountHyperdriveConfigNewResponseResultOriginScheme = "postgres" + AccountHyperdriveConfigNewResponseResultOriginSchemePostgresql AccountHyperdriveConfigNewResponseResultOriginScheme = "postgresql" +) + +type AccountHyperdriveConfigNewResponseResultCaching struct { + // When set to true, disables the caching of SQL responses. (Default: false) + Disabled bool `json:"disabled"` + // When present, specifies max duration for which items should persist in the + // cache. (Default: 60) + MaxAge int64 `json:"max_age"` + // When present, indicates the number of seconds cache may serve the response after + // it becomes stale. (Default: 15) + StaleWhileRevalidate int64 `json:"stale_while_revalidate"` + JSON accountHyperdriveConfigNewResponseResultCachingJSON `json:"-"` +} + +// accountHyperdriveConfigNewResponseResultCachingJSON contains the JSON metadata +// for the struct [AccountHyperdriveConfigNewResponseResultCaching] +type accountHyperdriveConfigNewResponseResultCachingJSON struct { + Disabled apijson.Field + MaxAge apijson.Field + StaleWhileRevalidate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigNewResponseResultCaching) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountHyperdriveConfigNewResponseSuccess bool + +const ( + AccountHyperdriveConfigNewResponseSuccessTrue AccountHyperdriveConfigNewResponseSuccess = true +) + +type AccountHyperdriveConfigListResponse struct { + Errors []AccountHyperdriveConfigListResponseError `json:"errors"` + Messages []AccountHyperdriveConfigListResponseMessage `json:"messages"` + Result []AccountHyperdriveConfigListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountHyperdriveConfigListResponseSuccess `json:"success"` + JSON accountHyperdriveConfigListResponseJSON `json:"-"` +} + +// accountHyperdriveConfigListResponseJSON contains the JSON metadata for the +// struct [AccountHyperdriveConfigListResponse] +type accountHyperdriveConfigListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountHyperdriveConfigListResponseErrorJSON `json:"-"` +} + +// accountHyperdriveConfigListResponseErrorJSON contains the JSON metadata for the +// struct [AccountHyperdriveConfigListResponseError] +type accountHyperdriveConfigListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountHyperdriveConfigListResponseMessageJSON `json:"-"` +} + +// accountHyperdriveConfigListResponseMessageJSON contains the JSON metadata for +// the struct [AccountHyperdriveConfigListResponseMessage] +type accountHyperdriveConfigListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigListResponseResult struct { + Name string `json:"name,required"` + Origin AccountHyperdriveConfigListResponseResultOrigin `json:"origin,required"` + Caching AccountHyperdriveConfigListResponseResultCaching `json:"caching"` + JSON accountHyperdriveConfigListResponseResultJSON `json:"-"` +} + +// accountHyperdriveConfigListResponseResultJSON contains the JSON metadata for the +// struct [AccountHyperdriveConfigListResponseResult] +type accountHyperdriveConfigListResponseResultJSON struct { + Name apijson.Field + Origin apijson.Field + Caching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountHyperdriveConfigListResponseResultOrigin struct { + // The name of your origin database. + Database string `json:"database"` + // The host (hostname or IP) of your origin database. + Host string `json:"host"` + // The port (default: 5432 for Postgres) of your origin database. + Port int64 `json:"port"` + // Specifies the URL scheme used to connect to your origin database. + Scheme AccountHyperdriveConfigListResponseResultOriginScheme `json:"scheme"` + // The user of your origin database. + User string `json:"user"` + JSON accountHyperdriveConfigListResponseResultOriginJSON `json:"-"` +} + +// accountHyperdriveConfigListResponseResultOriginJSON contains the JSON metadata +// for the struct [AccountHyperdriveConfigListResponseResultOrigin] +type accountHyperdriveConfigListResponseResultOriginJSON struct { + Database apijson.Field + Host apijson.Field + Port apijson.Field + Scheme apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigListResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the URL scheme used to connect to your origin database. +type AccountHyperdriveConfigListResponseResultOriginScheme string + +const ( + AccountHyperdriveConfigListResponseResultOriginSchemePostgres AccountHyperdriveConfigListResponseResultOriginScheme = "postgres" + AccountHyperdriveConfigListResponseResultOriginSchemePostgresql AccountHyperdriveConfigListResponseResultOriginScheme = "postgresql" +) + +type AccountHyperdriveConfigListResponseResultCaching struct { + // When set to true, disables the caching of SQL responses. (Default: false) + Disabled bool `json:"disabled"` + // When present, specifies max duration for which items should persist in the + // cache. (Default: 60) + MaxAge int64 `json:"max_age"` + // When present, indicates the number of seconds cache may serve the response after + // it becomes stale. (Default: 15) + StaleWhileRevalidate int64 `json:"stale_while_revalidate"` + JSON accountHyperdriveConfigListResponseResultCachingJSON `json:"-"` +} + +// accountHyperdriveConfigListResponseResultCachingJSON contains the JSON metadata +// for the struct [AccountHyperdriveConfigListResponseResultCaching] +type accountHyperdriveConfigListResponseResultCachingJSON struct { + Disabled apijson.Field + MaxAge apijson.Field + StaleWhileRevalidate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountHyperdriveConfigListResponseResultCaching) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountHyperdriveConfigListResponseSuccess bool + +const ( + AccountHyperdriveConfigListResponseSuccessTrue AccountHyperdriveConfigListResponseSuccess = true +) + +type AccountHyperdriveConfigNewParams struct { + Name param.Field[string] `json:"name,required"` + Origin param.Field[AccountHyperdriveConfigNewParamsOrigin] `json:"origin,required"` + Caching param.Field[AccountHyperdriveConfigNewParamsCaching] `json:"caching"` +} + +func (r AccountHyperdriveConfigNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountHyperdriveConfigNewParamsOrigin struct { + // The name of your origin database. + Database param.Field[string] `json:"database"` + // The host (hostname or IP) of your origin database. + Host param.Field[string] `json:"host"` + // The port (default: 5432 for Postgres) of your origin database. + Port param.Field[int64] `json:"port"` + // Specifies the URL scheme used to connect to your origin database. + Scheme param.Field[AccountHyperdriveConfigNewParamsOriginScheme] `json:"scheme"` + // The user of your origin database. + User param.Field[string] `json:"user"` +} + +func (r AccountHyperdriveConfigNewParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Specifies the URL scheme used to connect to your origin database. +type AccountHyperdriveConfigNewParamsOriginScheme string + +const ( + AccountHyperdriveConfigNewParamsOriginSchemePostgres AccountHyperdriveConfigNewParamsOriginScheme = "postgres" + AccountHyperdriveConfigNewParamsOriginSchemePostgresql AccountHyperdriveConfigNewParamsOriginScheme = "postgresql" +) + +type AccountHyperdriveConfigNewParamsCaching struct { + // When set to true, disables the caching of SQL responses. (Default: false) + Disabled param.Field[bool] `json:"disabled"` + // When present, specifies max duration for which items should persist in the + // cache. (Default: 60) + MaxAge param.Field[int64] `json:"max_age"` + // When present, indicates the number of seconds cache may serve the response after + // it becomes stale. (Default: 15) + StaleWhileRevalidate param.Field[int64] `json:"stale_while_revalidate"` +} + +func (r AccountHyperdriveConfigNewParamsCaching) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accounthyperdriveconfig_test.go b/accounthyperdriveconfig_test.go new file mode 100644 index 00000000000..d868ee83b38 --- /dev/null +++ b/accounthyperdriveconfig_test.go @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountHyperdriveConfigNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Hyperdrive.Configs.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountHyperdriveConfigNewParams{ + Name: cloudflare.F("example-hyperdrive"), + Origin: cloudflare.F(cloudflare.AccountHyperdriveConfigNewParamsOrigin{ + Database: cloudflare.F("postgres"), + Host: cloudflare.F("database.example.com"), + Port: cloudflare.F(int64(5432)), + Scheme: cloudflare.F(cloudflare.AccountHyperdriveConfigNewParamsOriginSchemePostgres), + User: cloudflare.F("postgres"), + }), + Caching: cloudflare.F(cloudflare.AccountHyperdriveConfigNewParamsCaching{ + Disabled: cloudflare.F(false), + MaxAge: cloudflare.F(int64(30)), + StaleWhileRevalidate: cloudflare.F(int64(15)), + }), + }, + ) + 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 TestAccountHyperdriveConfigList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Hyperdrive.Configs.List(context.TODO(), "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/accountimage.go b/accountimage.go new file mode 100644 index 00000000000..3676154a6de --- /dev/null +++ b/accountimage.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountImageService 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 [NewAccountImageService] method +// instead. +type AccountImageService struct { + Options []option.RequestOption + V1s *AccountImageV1Service + V2s *AccountImageV2Service +} + +// NewAccountImageService 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 NewAccountImageService(opts ...option.RequestOption) (r *AccountImageService) { + r = &AccountImageService{} + r.Options = opts + r.V1s = NewAccountImageV1Service(opts...) + r.V2s = NewAccountImageV2Service(opts...) + return +} diff --git a/accountimagev1.go b/accountimagev1.go new file mode 100644 index 00000000000..3b06cf12c2f --- /dev/null +++ b/accountimagev1.go @@ -0,0 +1,782 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountImageV1Service 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 [NewAccountImageV1Service] method +// instead. +type AccountImageV1Service struct { + Options []option.RequestOption + Keys *AccountImageV1KeyService + Stats *AccountImageV1StatService + Variants *AccountImageV1VariantService + Blobs *AccountImageV1BlobService +} + +// NewAccountImageV1Service 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 NewAccountImageV1Service(opts ...option.RequestOption) (r *AccountImageV1Service) { + r = &AccountImageV1Service{} + r.Options = opts + r.Keys = NewAccountImageV1KeyService(opts...) + r.Stats = NewAccountImageV1StatService(opts...) + r.Variants = NewAccountImageV1VariantService(opts...) + r.Blobs = NewAccountImageV1BlobService(opts...) + return +} + +// Fetch details for a single image. +func (r *AccountImageV1Service) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountImageV1GetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update image access control. On access control change, all copies of the image +// are purged from cache. +func (r *AccountImageV1Service) Update(ctx context.Context, accountIdentifier string, identifier string, body AccountImageV1UpdateParams, opts ...option.RequestOption) (res *AccountImageV1UpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete an image on Cloudflare Images. On success, all copies of the image are +// deleted and purged from cache. +func (r *AccountImageV1Service) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountImageV1DeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// List up to 100 images with one request. Use the optional parameters below to get +// a specific range of images. +func (r *AccountImageV1Service) CloudflareImagesListImages(ctx context.Context, accountIdentifier string, query AccountImageV1CloudflareImagesListImagesParams, opts ...option.RequestOption) (res *AccountImageV1CloudflareImagesListImagesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Upload an image with up to 10 Megabytes using a single HTTP POST +// (multipart/form-data) request. An image can be uploaded by sending an image file +// or passing an accessible to an API url. +func (r *AccountImageV1Service) CloudflareImagesUploadAnImageViaURL(ctx context.Context, accountIdentifier string, body AccountImageV1CloudflareImagesUploadAnImageViaURLParams, opts ...option.RequestOption) (res *AccountImageV1CloudflareImagesUploadAnImageViaURLResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountImageV1GetResponse struct { + Errors []AccountImageV1GetResponseError `json:"errors"` + Messages []AccountImageV1GetResponseMessage `json:"messages"` + Result AccountImageV1GetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1GetResponseSuccess `json:"success"` + JSON accountImageV1GetResponseJSON `json:"-"` +} + +// accountImageV1GetResponseJSON contains the JSON metadata for the struct +// [AccountImageV1GetResponse] +type accountImageV1GetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1GetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1GetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1GetResponseErrorJSON `json:"-"` +} + +// accountImageV1GetResponseErrorJSON contains the JSON metadata for the struct +// [AccountImageV1GetResponseError] +type accountImageV1GetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1GetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1GetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1GetResponseMessageJSON `json:"-"` +} + +// accountImageV1GetResponseMessageJSON contains the JSON metadata for the struct +// [AccountImageV1GetResponseMessage] +type accountImageV1GetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1GetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1GetResponseResult struct { + // Image unique identifier. + ID string `json:"id"` + // Image file name. + Filename string `json:"filename"` + // User modifiable key-value store. Can be used for keeping references to another + // system of record for managing images. Metadata must not exceed 1024 bytes. + Meta interface{} `json:"meta"` + // Indicates whether the image can be a accessed only using it's UID. If set to + // true, a signed token needs to be generated with a signing key to view the image. + RequireSignedURLs bool `json:"requireSignedURLs"` + // When the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // Object specifying available variants for an image. + Variants []AccountImageV1GetResponseResultVariant `json:"variants" format:"uri"` + JSON accountImageV1GetResponseResultJSON `json:"-"` +} + +// accountImageV1GetResponseResultJSON contains the JSON metadata for the struct +// [AccountImageV1GetResponseResult] +type accountImageV1GetResponseResultJSON struct { + ID apijson.Field + Filename apijson.Field + Meta apijson.Field + RequireSignedURLs apijson.Field + Uploaded apijson.Field + Variants apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1GetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// URI to thumbnail variant for an image. +// +// Union satisfied by [shared.UnionString], [shared.UnionString] or +// [shared.UnionString]. +type AccountImageV1GetResponseResultVariant interface { + ImplementsAccountImageV1GetResponseResultVariant() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountImageV1GetResponseResultVariant)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountImageV1GetResponseSuccess bool + +const ( + AccountImageV1GetResponseSuccessTrue AccountImageV1GetResponseSuccess = true +) + +type AccountImageV1UpdateResponse struct { + Errors []AccountImageV1UpdateResponseError `json:"errors"` + Messages []AccountImageV1UpdateResponseMessage `json:"messages"` + Result AccountImageV1UpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1UpdateResponseSuccess `json:"success"` + JSON accountImageV1UpdateResponseJSON `json:"-"` +} + +// accountImageV1UpdateResponseJSON contains the JSON metadata for the struct +// [AccountImageV1UpdateResponse] +type accountImageV1UpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1UpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1UpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1UpdateResponseErrorJSON `json:"-"` +} + +// accountImageV1UpdateResponseErrorJSON contains the JSON metadata for the struct +// [AccountImageV1UpdateResponseError] +type accountImageV1UpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1UpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1UpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1UpdateResponseMessageJSON `json:"-"` +} + +// accountImageV1UpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountImageV1UpdateResponseMessage] +type accountImageV1UpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1UpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1UpdateResponseResult struct { + // Image unique identifier. + ID string `json:"id"` + // Image file name. + Filename string `json:"filename"` + // User modifiable key-value store. Can be used for keeping references to another + // system of record for managing images. Metadata must not exceed 1024 bytes. + Meta interface{} `json:"meta"` + // Indicates whether the image can be a accessed only using it's UID. If set to + // true, a signed token needs to be generated with a signing key to view the image. + RequireSignedURLs bool `json:"requireSignedURLs"` + // When the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // Object specifying available variants for an image. + Variants []AccountImageV1UpdateResponseResultVariant `json:"variants" format:"uri"` + JSON accountImageV1UpdateResponseResultJSON `json:"-"` +} + +// accountImageV1UpdateResponseResultJSON contains the JSON metadata for the struct +// [AccountImageV1UpdateResponseResult] +type accountImageV1UpdateResponseResultJSON struct { + ID apijson.Field + Filename apijson.Field + Meta apijson.Field + RequireSignedURLs apijson.Field + Uploaded apijson.Field + Variants apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1UpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// URI to thumbnail variant for an image. +// +// Union satisfied by [shared.UnionString], [shared.UnionString] or +// [shared.UnionString]. +type AccountImageV1UpdateResponseResultVariant interface { + ImplementsAccountImageV1UpdateResponseResultVariant() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountImageV1UpdateResponseResultVariant)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountImageV1UpdateResponseSuccess bool + +const ( + AccountImageV1UpdateResponseSuccessTrue AccountImageV1UpdateResponseSuccess = true +) + +type AccountImageV1DeleteResponse struct { + Errors []AccountImageV1DeleteResponseError `json:"errors"` + Messages []AccountImageV1DeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountImageV1DeleteResponseSuccess `json:"success"` + JSON accountImageV1DeleteResponseJSON `json:"-"` +} + +// accountImageV1DeleteResponseJSON contains the JSON metadata for the struct +// [AccountImageV1DeleteResponse] +type accountImageV1DeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1DeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1DeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1DeleteResponseErrorJSON `json:"-"` +} + +// accountImageV1DeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountImageV1DeleteResponseError] +type accountImageV1DeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1DeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1DeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1DeleteResponseMessageJSON `json:"-"` +} + +// accountImageV1DeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountImageV1DeleteResponseMessage] +type accountImageV1DeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1DeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountImageV1DeleteResponseSuccess bool + +const ( + AccountImageV1DeleteResponseSuccessTrue AccountImageV1DeleteResponseSuccess = true +) + +type AccountImageV1CloudflareImagesListImagesResponse struct { + Errors []AccountImageV1CloudflareImagesListImagesResponseError `json:"errors"` + Messages []AccountImageV1CloudflareImagesListImagesResponseMessage `json:"messages"` + Result AccountImageV1CloudflareImagesListImagesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1CloudflareImagesListImagesResponseSuccess `json:"success"` + JSON accountImageV1CloudflareImagesListImagesResponseJSON `json:"-"` +} + +// accountImageV1CloudflareImagesListImagesResponseJSON contains the JSON metadata +// for the struct [AccountImageV1CloudflareImagesListImagesResponse] +type accountImageV1CloudflareImagesListImagesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesListImagesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1CloudflareImagesListImagesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1CloudflareImagesListImagesResponseErrorJSON `json:"-"` +} + +// accountImageV1CloudflareImagesListImagesResponseErrorJSON contains the JSON +// metadata for the struct [AccountImageV1CloudflareImagesListImagesResponseError] +type accountImageV1CloudflareImagesListImagesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesListImagesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1CloudflareImagesListImagesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1CloudflareImagesListImagesResponseMessageJSON `json:"-"` +} + +// accountImageV1CloudflareImagesListImagesResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountImageV1CloudflareImagesListImagesResponseMessage] +type accountImageV1CloudflareImagesListImagesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesListImagesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1CloudflareImagesListImagesResponseResult struct { + Images []AccountImageV1CloudflareImagesListImagesResponseResultImage `json:"images"` + JSON accountImageV1CloudflareImagesListImagesResponseResultJSON `json:"-"` +} + +// accountImageV1CloudflareImagesListImagesResponseResultJSON contains the JSON +// metadata for the struct [AccountImageV1CloudflareImagesListImagesResponseResult] +type accountImageV1CloudflareImagesListImagesResponseResultJSON struct { + Images apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesListImagesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1CloudflareImagesListImagesResponseResultImage struct { + // Image unique identifier. + ID string `json:"id"` + // Image file name. + Filename string `json:"filename"` + // User modifiable key-value store. Can be used for keeping references to another + // system of record for managing images. Metadata must not exceed 1024 bytes. + Meta interface{} `json:"meta"` + // Indicates whether the image can be a accessed only using it's UID. If set to + // true, a signed token needs to be generated with a signing key to view the image. + RequireSignedURLs bool `json:"requireSignedURLs"` + // When the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // Object specifying available variants for an image. + Variants []AccountImageV1CloudflareImagesListImagesResponseResultImagesVariant `json:"variants" format:"uri"` + JSON accountImageV1CloudflareImagesListImagesResponseResultImageJSON `json:"-"` +} + +// accountImageV1CloudflareImagesListImagesResponseResultImageJSON contains the +// JSON metadata for the struct +// [AccountImageV1CloudflareImagesListImagesResponseResultImage] +type accountImageV1CloudflareImagesListImagesResponseResultImageJSON struct { + ID apijson.Field + Filename apijson.Field + Meta apijson.Field + RequireSignedURLs apijson.Field + Uploaded apijson.Field + Variants apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesListImagesResponseResultImage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// URI to thumbnail variant for an image. +// +// Union satisfied by [shared.UnionString], [shared.UnionString] or +// [shared.UnionString]. +type AccountImageV1CloudflareImagesListImagesResponseResultImagesVariant interface { + ImplementsAccountImageV1CloudflareImagesListImagesResponseResultImagesVariant() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountImageV1CloudflareImagesListImagesResponseResultImagesVariant)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountImageV1CloudflareImagesListImagesResponseSuccess bool + +const ( + AccountImageV1CloudflareImagesListImagesResponseSuccessTrue AccountImageV1CloudflareImagesListImagesResponseSuccess = true +) + +type AccountImageV1CloudflareImagesUploadAnImageViaURLResponse struct { + Errors []AccountImageV1CloudflareImagesUploadAnImageViaURLResponseError `json:"errors"` + Messages []AccountImageV1CloudflareImagesUploadAnImageViaURLResponseMessage `json:"messages"` + Result AccountImageV1CloudflareImagesUploadAnImageViaURLResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1CloudflareImagesUploadAnImageViaURLResponseSuccess `json:"success"` + JSON accountImageV1CloudflareImagesUploadAnImageViaURLResponseJSON `json:"-"` +} + +// accountImageV1CloudflareImagesUploadAnImageViaURLResponseJSON contains the JSON +// metadata for the struct +// [AccountImageV1CloudflareImagesUploadAnImageViaURLResponse] +type accountImageV1CloudflareImagesUploadAnImageViaURLResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesUploadAnImageViaURLResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1CloudflareImagesUploadAnImageViaURLResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1CloudflareImagesUploadAnImageViaURLResponseErrorJSON `json:"-"` +} + +// accountImageV1CloudflareImagesUploadAnImageViaURLResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountImageV1CloudflareImagesUploadAnImageViaURLResponseError] +type accountImageV1CloudflareImagesUploadAnImageViaURLResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesUploadAnImageViaURLResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1CloudflareImagesUploadAnImageViaURLResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1CloudflareImagesUploadAnImageViaURLResponseMessageJSON `json:"-"` +} + +// accountImageV1CloudflareImagesUploadAnImageViaURLResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountImageV1CloudflareImagesUploadAnImageViaURLResponseMessage] +type accountImageV1CloudflareImagesUploadAnImageViaURLResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesUploadAnImageViaURLResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1CloudflareImagesUploadAnImageViaURLResponseResult struct { + // Image unique identifier. + ID string `json:"id"` + // Image file name. + Filename string `json:"filename"` + // User modifiable key-value store. Can be used for keeping references to another + // system of record for managing images. Metadata must not exceed 1024 bytes. + Meta interface{} `json:"meta"` + // Indicates whether the image can be a accessed only using it's UID. If set to + // true, a signed token needs to be generated with a signing key to view the image. + RequireSignedURLs bool `json:"requireSignedURLs"` + // When the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // Object specifying available variants for an image. + Variants []AccountImageV1CloudflareImagesUploadAnImageViaURLResponseResultVariant `json:"variants" format:"uri"` + JSON accountImageV1CloudflareImagesUploadAnImageViaURLResponseResultJSON `json:"-"` +} + +// accountImageV1CloudflareImagesUploadAnImageViaURLResponseResultJSON contains the +// JSON metadata for the struct +// [AccountImageV1CloudflareImagesUploadAnImageViaURLResponseResult] +type accountImageV1CloudflareImagesUploadAnImageViaURLResponseResultJSON struct { + ID apijson.Field + Filename apijson.Field + Meta apijson.Field + RequireSignedURLs apijson.Field + Uploaded apijson.Field + Variants apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1CloudflareImagesUploadAnImageViaURLResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// URI to thumbnail variant for an image. +// +// Union satisfied by [shared.UnionString], [shared.UnionString] or +// [shared.UnionString]. +type AccountImageV1CloudflareImagesUploadAnImageViaURLResponseResultVariant interface { + ImplementsAccountImageV1CloudflareImagesUploadAnImageViaURLResponseResultVariant() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountImageV1CloudflareImagesUploadAnImageViaURLResponseResultVariant)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountImageV1CloudflareImagesUploadAnImageViaURLResponseSuccess bool + +const ( + AccountImageV1CloudflareImagesUploadAnImageViaURLResponseSuccessTrue AccountImageV1CloudflareImagesUploadAnImageViaURLResponseSuccess = true +) + +type AccountImageV1UpdateParams struct { + // User modifiable key-value store. Can be used for keeping references to another + // system of record for managing images. No change if not specified. + Metadata param.Field[interface{}] `json:"metadata"` + // Indicates whether the image can be accessed using only its UID. If set to + // `true`, a signed token needs to be generated with a signing key to view the + // image. Returns a new UID on a change. No change if not specified. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` +} + +func (r AccountImageV1UpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountImageV1CloudflareImagesListImagesParams struct { + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [AccountImageV1CloudflareImagesListImagesParams]'s query +// parameters as `url.Values`. +func (r AccountImageV1CloudflareImagesListImagesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// This interface is a union satisfied by one of the following: +// [AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaFile], +// [AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaURL]. +type AccountImageV1CloudflareImagesUploadAnImageViaURLParams interface { + ImplementsAccountImageV1CloudflareImagesUploadAnImageViaURLParams() +} + +type AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaFile struct { + // An image binary data. + File param.Field[interface{}] `json:"file,required"` +} + +func (r AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaFile) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaFile) ImplementsAccountImageV1CloudflareImagesUploadAnImageViaURLParams() { + +} + +type AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaURL struct { + // A URL to fetch an image from origin. + URL param.Field[string] `json:"url,required"` +} + +func (r AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaURL) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaURL) ImplementsAccountImageV1CloudflareImagesUploadAnImageViaURLParams() { + +} diff --git a/accountimagev1_test.go b/accountimagev1_test.go new file mode 100644 index 00000000000..81ec94f0bb0 --- /dev/null +++ b/accountimagev1_test.go @@ -0,0 +1,173 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountImageV1Get(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "string", + ) + 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 TestAccountImageV1UpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "string", + cloudflare.AccountImageV1UpdateParams{ + Metadata: cloudflare.F[any](map[string]interface{}{}), + RequireSignedURLs: cloudflare.F(true), + }, + ) + 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 TestAccountImageV1Delete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "string", + ) + 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 TestAccountImageV1CloudflareImagesListImagesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.CloudflareImagesListImages( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountImageV1CloudflareImagesListImagesParams{ + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(10.000000), + }, + ) + 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 TestAccountImageV1CloudflareImagesUploadAnImageViaURL(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.CloudflareImagesUploadAnImageViaURL( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountImageV1CloudflareImagesUploadAnImageViaURLParamsImagesImageUploadViaFile{ + File: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountimagev1blob.go b/accountimagev1blob.go new file mode 100644 index 00000000000..5d26a92ccbd --- /dev/null +++ b/accountimagev1blob.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountImageV1BlobService 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 [NewAccountImageV1BlobService] method +// instead. +type AccountImageV1BlobService struct { + Options []option.RequestOption +} + +// NewAccountImageV1BlobService 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 NewAccountImageV1BlobService(opts ...option.RequestOption) (r *AccountImageV1BlobService) { + r = &AccountImageV1BlobService{} + r.Options = opts + return +} + +// Fetch base image. For most images this will be the originally uploaded file. For +// larger images it can be a near-lossless version of the original. +func (r *AccountImageV1BlobService) CloudflareImagesBaseImage(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "image/*")}, opts...) + path := fmt.Sprintf("accounts/%s/images/v1/%s/blob", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} diff --git a/accountimagev1blob_test.go b/accountimagev1blob_test.go new file mode 100644 index 00000000000..38b495186d3 --- /dev/null +++ b/accountimagev1blob_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountImageV1BlobCloudflareImagesBaseImage(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Accounts.Images.V1s.Blobs.CloudflareImagesBaseImage( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "string", + ) + 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/accountimagev1key.go b/accountimagev1key.go new file mode 100644 index 00000000000..8fa4a92b561 --- /dev/null +++ b/accountimagev1key.go @@ -0,0 +1,151 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountImageV1KeyService 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 [NewAccountImageV1KeyService] method +// instead. +type AccountImageV1KeyService struct { + Options []option.RequestOption +} + +// NewAccountImageV1KeyService 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 NewAccountImageV1KeyService(opts ...option.RequestOption) (r *AccountImageV1KeyService) { + r = &AccountImageV1KeyService{} + r.Options = opts + return +} + +// Lists your signing keys. These can be found on your Cloudflare Images dashboard. +func (r *AccountImageV1KeyService) CloudflareImagesKeysListSigningKeys(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/keys", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponse struct { + Errors []AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseError `json:"errors"` + Messages []AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseMessage `json:"messages"` + Result AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseSuccess `json:"success"` + JSON accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseJSON `json:"-"` +} + +// accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseJSON contains the +// JSON metadata for the struct +// [AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponse] +type accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseErrorJSON `json:"-"` +} + +// accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseError] +type accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseMessageJSON `json:"-"` +} + +// accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseMessage] +type accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResult struct { + Keys []AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultKey `json:"keys"` + JSON accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultJSON `json:"-"` +} + +// accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultJSON contains +// the JSON metadata for the struct +// [AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResult] +type accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultJSON struct { + Keys apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultKey struct { + // Key name. + Name string `json:"name"` + // Key value. + Value string `json:"value"` + JSON accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultKeyJSON `json:"-"` +} + +// accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultKeyJSON +// contains the JSON metadata for the struct +// [AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultKey] +type accountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultKeyJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseResultKey) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseSuccess bool + +const ( + AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseSuccessTrue AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponseSuccess = true +) diff --git a/accountimagev1key_test.go b/accountimagev1key_test.go new file mode 100644 index 00000000000..d2adfe1acdb --- /dev/null +++ b/accountimagev1key_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountImageV1KeyCloudflareImagesKeysListSigningKeys(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Keys.CloudflareImagesKeysListSigningKeys(context.TODO(), "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/accountimagev1stat.go b/accountimagev1stat.go new file mode 100644 index 00000000000..9c0b5ae27a3 --- /dev/null +++ b/accountimagev1stat.go @@ -0,0 +1,151 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountImageV1StatService 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 [NewAccountImageV1StatService] method +// instead. +type AccountImageV1StatService struct { + Options []option.RequestOption +} + +// NewAccountImageV1StatService 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 NewAccountImageV1StatService(opts ...option.RequestOption) (r *AccountImageV1StatService) { + r = &AccountImageV1StatService{} + r.Options = opts + return +} + +// Fetch usage statistics details for Cloudflare Images. +func (r *AccountImageV1StatService) CloudflareImagesImagesUsageStatistics(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/stats", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponse struct { + Errors []AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseError `json:"errors"` + Messages []AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseMessage `json:"messages"` + Result AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseSuccess `json:"success"` + JSON accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseJSON `json:"-"` +} + +// accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseJSON contains the +// JSON metadata for the struct +// [AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponse] +type accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseErrorJSON `json:"-"` +} + +// accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseError] +type accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseMessageJSON `json:"-"` +} + +// accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseMessage] +type accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResult struct { + Count AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultCount `json:"count"` + JSON accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultJSON `json:"-"` +} + +// accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResult] +type accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultJSON struct { + Count apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultCount struct { + // Cloudflare Images allowed usage. + Allowed float64 `json:"allowed"` + // Cloudflare Images current usage. + Current float64 `json:"current"` + JSON accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultCountJSON `json:"-"` +} + +// accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultCountJSON +// contains the JSON metadata for the struct +// [AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultCount] +type accountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultCountJSON struct { + Allowed apijson.Field + Current apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseResultCount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseSuccess bool + +const ( + AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseSuccessTrue AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponseSuccess = true +) diff --git a/accountimagev1stat_test.go b/accountimagev1stat_test.go new file mode 100644 index 00000000000..a011034765a --- /dev/null +++ b/accountimagev1stat_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountImageV1StatCloudflareImagesImagesUsageStatistics(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Stats.CloudflareImagesImagesUsageStatistics(context.TODO(), "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/accountimagev1variant.go b/accountimagev1variant.go new file mode 100644 index 00000000000..e4942d53f97 --- /dev/null +++ b/accountimagev1variant.go @@ -0,0 +1,913 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountImageV1VariantService 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 [NewAccountImageV1VariantService] +// method instead. +type AccountImageV1VariantService struct { + Options []option.RequestOption +} + +// NewAccountImageV1VariantService 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 NewAccountImageV1VariantService(opts ...option.RequestOption) (r *AccountImageV1VariantService) { + r = &AccountImageV1VariantService{} + r.Options = opts + return +} + +// Fetch details for a single variant. +func (r *AccountImageV1VariantService) Get(ctx context.Context, accountIdentifier string, identifier interface{}, opts ...option.RequestOption) (res *AccountImageV1VariantGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/variants/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updating a variant purges the cache for all images associated with the variant. +func (r *AccountImageV1VariantService) Update(ctx context.Context, accountIdentifier string, identifier interface{}, body AccountImageV1VariantUpdateParams, opts ...option.RequestOption) (res *AccountImageV1VariantUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/variants/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deleting a variant purges the cache for all images associated with the variant. +func (r *AccountImageV1VariantService) Delete(ctx context.Context, accountIdentifier string, identifier interface{}, opts ...option.RequestOption) (res *AccountImageV1VariantDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/variants/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Specify variants that allow you to resize images for different use cases. +func (r *AccountImageV1VariantService) CloudflareImagesVariantsNewAVariant(ctx context.Context, accountIdentifier string, body AccountImageV1VariantCloudflareImagesVariantsNewAVariantParams, opts ...option.RequestOption) (res *AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/variants", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists existing variants. +func (r *AccountImageV1VariantService) CloudflareImagesVariantsListVariants(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v1/variants", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountImageV1VariantGetResponse struct { + Errors []AccountImageV1VariantGetResponseError `json:"errors"` + Messages []AccountImageV1VariantGetResponseMessage `json:"messages"` + Result AccountImageV1VariantGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1VariantGetResponseSuccess `json:"success"` + JSON accountImageV1VariantGetResponseJSON `json:"-"` +} + +// accountImageV1VariantGetResponseJSON contains the JSON metadata for the struct +// [AccountImageV1VariantGetResponse] +type accountImageV1VariantGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantGetResponseErrorJSON `json:"-"` +} + +// accountImageV1VariantGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountImageV1VariantGetResponseError] +type accountImageV1VariantGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantGetResponseMessageJSON `json:"-"` +} + +// accountImageV1VariantGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountImageV1VariantGetResponseMessage] +type accountImageV1VariantGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantGetResponseResult struct { + Variant AccountImageV1VariantGetResponseResultVariant `json:"variant"` + JSON accountImageV1VariantGetResponseResultJSON `json:"-"` +} + +// accountImageV1VariantGetResponseResultJSON contains the JSON metadata for the +// struct [AccountImageV1VariantGetResponseResult] +type accountImageV1VariantGetResponseResultJSON struct { + Variant apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantGetResponseResultVariant struct { + ID interface{} `json:"id,required"` + // Allows you to define image resizing sizes for different use cases. + Options AccountImageV1VariantGetResponseResultVariantOptions `json:"options,required"` + // Indicates whether the variant can access an image without a signature, + // regardless of image access control. + NeverRequireSignedURLs bool `json:"neverRequireSignedURLs"` + JSON accountImageV1VariantGetResponseResultVariantJSON `json:"-"` +} + +// accountImageV1VariantGetResponseResultVariantJSON contains the JSON metadata for +// the struct [AccountImageV1VariantGetResponseResultVariant] +type accountImageV1VariantGetResponseResultVariantJSON struct { + ID apijson.Field + Options apijson.Field + NeverRequireSignedURLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantGetResponseResultVariant) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Allows you to define image resizing sizes for different use cases. +type AccountImageV1VariantGetResponseResultVariantOptions struct { + // The fit property describes how the width and height dimensions should be + // interpreted. + Fit AccountImageV1VariantGetResponseResultVariantOptionsFit `json:"fit,required"` + // Maximum height in image pixels. + Height float64 `json:"height,required"` + // What EXIF data should be preserved in the output image. + Metadata AccountImageV1VariantGetResponseResultVariantOptionsMetadata `json:"metadata,required"` + // Maximum width in image pixels. + Width float64 `json:"width,required"` + JSON accountImageV1VariantGetResponseResultVariantOptionsJSON `json:"-"` +} + +// accountImageV1VariantGetResponseResultVariantOptionsJSON contains the JSON +// metadata for the struct [AccountImageV1VariantGetResponseResultVariantOptions] +type accountImageV1VariantGetResponseResultVariantOptionsJSON struct { + Fit apijson.Field + Height apijson.Field + Metadata apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantGetResponseResultVariantOptions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The fit property describes how the width and height dimensions should be +// interpreted. +type AccountImageV1VariantGetResponseResultVariantOptionsFit string + +const ( + AccountImageV1VariantGetResponseResultVariantOptionsFitScaleDown AccountImageV1VariantGetResponseResultVariantOptionsFit = "scale-down" + AccountImageV1VariantGetResponseResultVariantOptionsFitContain AccountImageV1VariantGetResponseResultVariantOptionsFit = "contain" + AccountImageV1VariantGetResponseResultVariantOptionsFitCover AccountImageV1VariantGetResponseResultVariantOptionsFit = "cover" + AccountImageV1VariantGetResponseResultVariantOptionsFitCrop AccountImageV1VariantGetResponseResultVariantOptionsFit = "crop" + AccountImageV1VariantGetResponseResultVariantOptionsFitPad AccountImageV1VariantGetResponseResultVariantOptionsFit = "pad" +) + +// What EXIF data should be preserved in the output image. +type AccountImageV1VariantGetResponseResultVariantOptionsMetadata string + +const ( + AccountImageV1VariantGetResponseResultVariantOptionsMetadataKeep AccountImageV1VariantGetResponseResultVariantOptionsMetadata = "keep" + AccountImageV1VariantGetResponseResultVariantOptionsMetadataCopyright AccountImageV1VariantGetResponseResultVariantOptionsMetadata = "copyright" + AccountImageV1VariantGetResponseResultVariantOptionsMetadataNone AccountImageV1VariantGetResponseResultVariantOptionsMetadata = "none" +) + +// Whether the API call was successful +type AccountImageV1VariantGetResponseSuccess bool + +const ( + AccountImageV1VariantGetResponseSuccessTrue AccountImageV1VariantGetResponseSuccess = true +) + +type AccountImageV1VariantUpdateResponse struct { + Errors []AccountImageV1VariantUpdateResponseError `json:"errors"` + Messages []AccountImageV1VariantUpdateResponseMessage `json:"messages"` + Result AccountImageV1VariantUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1VariantUpdateResponseSuccess `json:"success"` + JSON accountImageV1VariantUpdateResponseJSON `json:"-"` +} + +// accountImageV1VariantUpdateResponseJSON contains the JSON metadata for the +// struct [AccountImageV1VariantUpdateResponse] +type accountImageV1VariantUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantUpdateResponseErrorJSON `json:"-"` +} + +// accountImageV1VariantUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountImageV1VariantUpdateResponseError] +type accountImageV1VariantUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantUpdateResponseMessageJSON `json:"-"` +} + +// accountImageV1VariantUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountImageV1VariantUpdateResponseMessage] +type accountImageV1VariantUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantUpdateResponseResult struct { + Variant AccountImageV1VariantUpdateResponseResultVariant `json:"variant"` + JSON accountImageV1VariantUpdateResponseResultJSON `json:"-"` +} + +// accountImageV1VariantUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountImageV1VariantUpdateResponseResult] +type accountImageV1VariantUpdateResponseResultJSON struct { + Variant apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantUpdateResponseResultVariant struct { + ID interface{} `json:"id,required"` + // Allows you to define image resizing sizes for different use cases. + Options AccountImageV1VariantUpdateResponseResultVariantOptions `json:"options,required"` + // Indicates whether the variant can access an image without a signature, + // regardless of image access control. + NeverRequireSignedURLs bool `json:"neverRequireSignedURLs"` + JSON accountImageV1VariantUpdateResponseResultVariantJSON `json:"-"` +} + +// accountImageV1VariantUpdateResponseResultVariantJSON contains the JSON metadata +// for the struct [AccountImageV1VariantUpdateResponseResultVariant] +type accountImageV1VariantUpdateResponseResultVariantJSON struct { + ID apijson.Field + Options apijson.Field + NeverRequireSignedURLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantUpdateResponseResultVariant) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Allows you to define image resizing sizes for different use cases. +type AccountImageV1VariantUpdateResponseResultVariantOptions struct { + // The fit property describes how the width and height dimensions should be + // interpreted. + Fit AccountImageV1VariantUpdateResponseResultVariantOptionsFit `json:"fit,required"` + // Maximum height in image pixels. + Height float64 `json:"height,required"` + // What EXIF data should be preserved in the output image. + Metadata AccountImageV1VariantUpdateResponseResultVariantOptionsMetadata `json:"metadata,required"` + // Maximum width in image pixels. + Width float64 `json:"width,required"` + JSON accountImageV1VariantUpdateResponseResultVariantOptionsJSON `json:"-"` +} + +// accountImageV1VariantUpdateResponseResultVariantOptionsJSON contains the JSON +// metadata for the struct +// [AccountImageV1VariantUpdateResponseResultVariantOptions] +type accountImageV1VariantUpdateResponseResultVariantOptionsJSON struct { + Fit apijson.Field + Height apijson.Field + Metadata apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantUpdateResponseResultVariantOptions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The fit property describes how the width and height dimensions should be +// interpreted. +type AccountImageV1VariantUpdateResponseResultVariantOptionsFit string + +const ( + AccountImageV1VariantUpdateResponseResultVariantOptionsFitScaleDown AccountImageV1VariantUpdateResponseResultVariantOptionsFit = "scale-down" + AccountImageV1VariantUpdateResponseResultVariantOptionsFitContain AccountImageV1VariantUpdateResponseResultVariantOptionsFit = "contain" + AccountImageV1VariantUpdateResponseResultVariantOptionsFitCover AccountImageV1VariantUpdateResponseResultVariantOptionsFit = "cover" + AccountImageV1VariantUpdateResponseResultVariantOptionsFitCrop AccountImageV1VariantUpdateResponseResultVariantOptionsFit = "crop" + AccountImageV1VariantUpdateResponseResultVariantOptionsFitPad AccountImageV1VariantUpdateResponseResultVariantOptionsFit = "pad" +) + +// What EXIF data should be preserved in the output image. +type AccountImageV1VariantUpdateResponseResultVariantOptionsMetadata string + +const ( + AccountImageV1VariantUpdateResponseResultVariantOptionsMetadataKeep AccountImageV1VariantUpdateResponseResultVariantOptionsMetadata = "keep" + AccountImageV1VariantUpdateResponseResultVariantOptionsMetadataCopyright AccountImageV1VariantUpdateResponseResultVariantOptionsMetadata = "copyright" + AccountImageV1VariantUpdateResponseResultVariantOptionsMetadataNone AccountImageV1VariantUpdateResponseResultVariantOptionsMetadata = "none" +) + +// Whether the API call was successful +type AccountImageV1VariantUpdateResponseSuccess bool + +const ( + AccountImageV1VariantUpdateResponseSuccessTrue AccountImageV1VariantUpdateResponseSuccess = true +) + +type AccountImageV1VariantDeleteResponse struct { + Errors []AccountImageV1VariantDeleteResponseError `json:"errors"` + Messages []AccountImageV1VariantDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountImageV1VariantDeleteResponseSuccess `json:"success"` + JSON accountImageV1VariantDeleteResponseJSON `json:"-"` +} + +// accountImageV1VariantDeleteResponseJSON contains the JSON metadata for the +// struct [AccountImageV1VariantDeleteResponse] +type accountImageV1VariantDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantDeleteResponseErrorJSON `json:"-"` +} + +// accountImageV1VariantDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountImageV1VariantDeleteResponseError] +type accountImageV1VariantDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantDeleteResponseMessageJSON `json:"-"` +} + +// accountImageV1VariantDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountImageV1VariantDeleteResponseMessage] +type accountImageV1VariantDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountImageV1VariantDeleteResponseSuccess bool + +const ( + AccountImageV1VariantDeleteResponseSuccessTrue AccountImageV1VariantDeleteResponseSuccess = true +) + +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponse struct { + Errors []AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseError `json:"errors"` + Messages []AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseMessage `json:"messages"` + Result AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseSuccess `json:"success"` + JSON accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseJSON contains +// the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponse] +type accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseErrorJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseError] +type accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseMessageJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseMessage] +type accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResult struct { + Variant AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariant `json:"variant"` + JSON accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResult] +type accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultJSON struct { + Variant apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariant struct { + ID interface{} `json:"id,required"` + // Allows you to define image resizing sizes for different use cases. + Options AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptions `json:"options,required"` + // Indicates whether the variant can access an image without a signature, + // regardless of image access control. + NeverRequireSignedURLs bool `json:"neverRequireSignedURLs"` + JSON accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariant] +type accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantJSON struct { + ID apijson.Field + Options apijson.Field + NeverRequireSignedURLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariant) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Allows you to define image resizing sizes for different use cases. +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptions struct { + // The fit property describes how the width and height dimensions should be + // interpreted. + Fit AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFit `json:"fit,required"` + // Maximum height in image pixels. + Height float64 `json:"height,required"` + // What EXIF data should be preserved in the output image. + Metadata AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadata `json:"metadata,required"` + // Maximum width in image pixels. + Width float64 `json:"width,required"` + JSON accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptions] +type accountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsJSON struct { + Fit apijson.Field + Height apijson.Field + Metadata apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The fit property describes how the width and height dimensions should be +// interpreted. +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFit string + +const ( + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFitScaleDown AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFit = "scale-down" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFitContain AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFit = "contain" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFitCover AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFit = "cover" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFitCrop AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFit = "crop" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFitPad AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsFit = "pad" +) + +// What EXIF data should be preserved in the output image. +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadata string + +const ( + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadataKeep AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadata = "keep" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadataCopyright AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadata = "copyright" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadataNone AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseResultVariantOptionsMetadata = "none" +) + +// Whether the API call was successful +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseSuccess bool + +const ( + AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseSuccessTrue AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponseSuccess = true +) + +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponse struct { + Errors []AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseError `json:"errors"` + Messages []AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseMessage `json:"messages"` + Result AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseSuccess `json:"success"` + JSON accountImageV1VariantCloudflareImagesVariantsListVariantsResponseJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsListVariantsResponseJSON contains +// the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsListVariantsResponse] +type accountImageV1VariantCloudflareImagesVariantsListVariantsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantCloudflareImagesVariantsListVariantsResponseErrorJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsListVariantsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseError] +type accountImageV1VariantCloudflareImagesVariantsListVariantsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV1VariantCloudflareImagesVariantsListVariantsResponseMessageJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsListVariantsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseMessage] +type accountImageV1VariantCloudflareImagesVariantsListVariantsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResult struct { + Variants AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariants `json:"variants"` + JSON accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResult] +type accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultJSON struct { + Variants apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariants struct { + Hero AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHero `json:"hero"` + JSON accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariants] +type accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsJSON struct { + Hero apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariants) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHero struct { + ID interface{} `json:"id,required"` + // Allows you to define image resizing sizes for different use cases. + Options AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptions `json:"options,required"` + // Indicates whether the variant can access an image without a signature, + // regardless of image access control. + NeverRequireSignedURLs bool `json:"neverRequireSignedURLs"` + JSON accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHero] +type accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroJSON struct { + ID apijson.Field + Options apijson.Field + NeverRequireSignedURLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHero) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Allows you to define image resizing sizes for different use cases. +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptions struct { + // The fit property describes how the width and height dimensions should be + // interpreted. + Fit AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFit `json:"fit,required"` + // Maximum height in image pixels. + Height float64 `json:"height,required"` + // What EXIF data should be preserved in the output image. + Metadata AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadata `json:"metadata,required"` + // Maximum width in image pixels. + Width float64 `json:"width,required"` + JSON accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsJSON `json:"-"` +} + +// accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsJSON +// contains the JSON metadata for the struct +// [AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptions] +type accountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsJSON struct { + Fit apijson.Field + Height apijson.Field + Metadata apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The fit property describes how the width and height dimensions should be +// interpreted. +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFit string + +const ( + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFitScaleDown AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFit = "scale-down" + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFitContain AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFit = "contain" + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFitCover AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFit = "cover" + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFitCrop AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFit = "crop" + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFitPad AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsFit = "pad" +) + +// What EXIF data should be preserved in the output image. +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadata string + +const ( + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadataKeep AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadata = "keep" + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadataCopyright AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadata = "copyright" + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadataNone AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseResultVariantsHeroOptionsMetadata = "none" +) + +// Whether the API call was successful +type AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseSuccess bool + +const ( + AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseSuccessTrue AccountImageV1VariantCloudflareImagesVariantsListVariantsResponseSuccess = true +) + +type AccountImageV1VariantUpdateParams struct { + // Allows you to define image resizing sizes for different use cases. + Options param.Field[AccountImageV1VariantUpdateParamsOptions] `json:"options,required"` + // Indicates whether the variant can access an image without a signature, + // regardless of image access control. + NeverRequireSignedURLs param.Field[bool] `json:"neverRequireSignedURLs"` +} + +func (r AccountImageV1VariantUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Allows you to define image resizing sizes for different use cases. +type AccountImageV1VariantUpdateParamsOptions struct { + // The fit property describes how the width and height dimensions should be + // interpreted. + Fit param.Field[AccountImageV1VariantUpdateParamsOptionsFit] `json:"fit,required"` + // Maximum height in image pixels. + Height param.Field[float64] `json:"height,required"` + // What EXIF data should be preserved in the output image. + Metadata param.Field[AccountImageV1VariantUpdateParamsOptionsMetadata] `json:"metadata,required"` + // Maximum width in image pixels. + Width param.Field[float64] `json:"width,required"` +} + +func (r AccountImageV1VariantUpdateParamsOptions) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The fit property describes how the width and height dimensions should be +// interpreted. +type AccountImageV1VariantUpdateParamsOptionsFit string + +const ( + AccountImageV1VariantUpdateParamsOptionsFitScaleDown AccountImageV1VariantUpdateParamsOptionsFit = "scale-down" + AccountImageV1VariantUpdateParamsOptionsFitContain AccountImageV1VariantUpdateParamsOptionsFit = "contain" + AccountImageV1VariantUpdateParamsOptionsFitCover AccountImageV1VariantUpdateParamsOptionsFit = "cover" + AccountImageV1VariantUpdateParamsOptionsFitCrop AccountImageV1VariantUpdateParamsOptionsFit = "crop" + AccountImageV1VariantUpdateParamsOptionsFitPad AccountImageV1VariantUpdateParamsOptionsFit = "pad" +) + +// What EXIF data should be preserved in the output image. +type AccountImageV1VariantUpdateParamsOptionsMetadata string + +const ( + AccountImageV1VariantUpdateParamsOptionsMetadataKeep AccountImageV1VariantUpdateParamsOptionsMetadata = "keep" + AccountImageV1VariantUpdateParamsOptionsMetadataCopyright AccountImageV1VariantUpdateParamsOptionsMetadata = "copyright" + AccountImageV1VariantUpdateParamsOptionsMetadataNone AccountImageV1VariantUpdateParamsOptionsMetadata = "none" +) + +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantParams struct { + ID param.Field[interface{}] `json:"id,required"` + // Allows you to define image resizing sizes for different use cases. + Options param.Field[AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptions] `json:"options,required"` + // Indicates whether the variant can access an image without a signature, + // regardless of image access control. + NeverRequireSignedURLs param.Field[bool] `json:"neverRequireSignedURLs"` +} + +func (r AccountImageV1VariantCloudflareImagesVariantsNewAVariantParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Allows you to define image resizing sizes for different use cases. +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptions struct { + // The fit property describes how the width and height dimensions should be + // interpreted. + Fit param.Field[AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFit] `json:"fit,required"` + // Maximum height in image pixels. + Height param.Field[float64] `json:"height,required"` + // What EXIF data should be preserved in the output image. + Metadata param.Field[AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadata] `json:"metadata,required"` + // Maximum width in image pixels. + Width param.Field[float64] `json:"width,required"` +} + +func (r AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptions) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The fit property describes how the width and height dimensions should be +// interpreted. +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFit string + +const ( + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFitScaleDown AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFit = "scale-down" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFitContain AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFit = "contain" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFitCover AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFit = "cover" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFitCrop AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFit = "crop" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFitPad AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFit = "pad" +) + +// What EXIF data should be preserved in the output image. +type AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadata string + +const ( + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadataKeep AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadata = "keep" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadataCopyright AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadata = "copyright" + AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadataNone AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadata = "none" +) diff --git a/accountimagev1variant_test.go b/accountimagev1variant_test.go new file mode 100644 index 00000000000..47aeedd31ec --- /dev/null +++ b/accountimagev1variant_test.go @@ -0,0 +1,178 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountImageV1VariantGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Variants.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + map[string]interface{}{}, + ) + 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 TestAccountImageV1VariantUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Variants.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + map[string]interface{}{}, + cloudflare.AccountImageV1VariantUpdateParams{ + Options: cloudflare.F(cloudflare.AccountImageV1VariantUpdateParamsOptions{ + Fit: cloudflare.F(cloudflare.AccountImageV1VariantUpdateParamsOptionsFitScaleDown), + Height: cloudflare.F(768.000000), + Metadata: cloudflare.F(cloudflare.AccountImageV1VariantUpdateParamsOptionsMetadataNone), + Width: cloudflare.F(1366.000000), + }), + NeverRequireSignedURLs: cloudflare.F(true), + }, + ) + 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 TestAccountImageV1VariantDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Variants.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + map[string]interface{}{}, + ) + 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 TestAccountImageV1VariantCloudflareImagesVariantsNewAVariantWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Variants.CloudflareImagesVariantsNewAVariant( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountImageV1VariantCloudflareImagesVariantsNewAVariantParams{ + ID: cloudflare.F[any](map[string]interface{}{}), + Options: cloudflare.F(cloudflare.AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptions{ + Fit: cloudflare.F(cloudflare.AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsFitScaleDown), + Height: cloudflare.F(768.000000), + Metadata: cloudflare.F(cloudflare.AccountImageV1VariantCloudflareImagesVariantsNewAVariantParamsOptionsMetadataNone), + Width: cloudflare.F(1366.000000), + }), + NeverRequireSignedURLs: cloudflare.F(true), + }, + ) + 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 TestAccountImageV1VariantCloudflareImagesVariantsListVariants(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V1s.Variants.CloudflareImagesVariantsListVariants(context.TODO(), "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/accountimagev2.go b/accountimagev2.go new file mode 100644 index 00000000000..df2f0308e2f --- /dev/null +++ b/accountimagev2.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountImageV2Service 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 [NewAccountImageV2Service] method +// instead. +type AccountImageV2Service struct { + Options []option.RequestOption + DirectUploads *AccountImageV2DirectUploadService +} + +// NewAccountImageV2Service 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 NewAccountImageV2Service(opts ...option.RequestOption) (r *AccountImageV2Service) { + r = &AccountImageV2Service{} + r.Options = opts + r.DirectUploads = NewAccountImageV2DirectUploadService(opts...) + return +} diff --git a/accountimagev2directupload.go b/accountimagev2directupload.go new file mode 100644 index 00000000000..166a9a61e60 --- /dev/null +++ b/accountimagev2directupload.go @@ -0,0 +1,157 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountImageV2DirectUploadService 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 +// [NewAccountImageV2DirectUploadService] method instead. +type AccountImageV2DirectUploadService struct { + Options []option.RequestOption +} + +// NewAccountImageV2DirectUploadService 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 NewAccountImageV2DirectUploadService(opts ...option.RequestOption) (r *AccountImageV2DirectUploadService) { + r = &AccountImageV2DirectUploadService{} + r.Options = opts + return +} + +// Direct uploads allow users to upload images without API keys. A common use case +// are web apps, client-side applications, or mobile devices where users upload +// content directly to Cloudflare Images. This method creates a draft record for a +// future image. It returns an upload URL and an image identifier. To verify if the +// image itself has been uploaded, send an image details request +// (accounts/:account_identifier/images/v1/:identifier), and check that the +// `draft: true` property is not present. +func (r *AccountImageV2DirectUploadService) CloudflareImagesNewAuthenticatedDirectUploadURLV2(ctx context.Context, accountIdentifier string, body AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadURLV2Params, opts ...option.RequestOption) (res *AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2Response, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v2/direct_upload", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2Response struct { + Errors []AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseError `json:"errors"` + Messages []AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseMessage `json:"messages"` + Result AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseResult `json:"result"` + // Whether the API call was successful + Success AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseSuccess `json:"success"` + JSON accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseJSON `json:"-"` +} + +// accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseJSON +// contains the JSON metadata for the struct +// [AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2Response] +type accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2Response) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseErrorJSON `json:"-"` +} + +// accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseError] +type accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseMessageJSON `json:"-"` +} + +// accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseMessage] +type accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseResult struct { + // Image unique identifier. + ID string `json:"id"` + // The URL the unauthenticated upload can be performed to using a single HTTP POST + // (multipart/form-data) request. + UploadURL string `json:"uploadURL"` + JSON accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseResultJSON `json:"-"` +} + +// accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseResultJSON +// contains the JSON metadata for the struct +// [AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseResult] +type accountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseResultJSON struct { + ID apijson.Field + UploadURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseSuccess bool + +const ( + AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseSuccessTrue AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2ResponseSuccess = true +) + +type AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadURLV2Params struct { + // The date after which the upload will not be accepted. Minimum: Now + 2 minutes. + // Maximum: Now + 6 hours. + Expiry param.Field[time.Time] `json:"expiry" format:"date-time"` + // User modifiable key-value store. Can be used for keeping references to another + // system of record, for managing images. + Metadata param.Field[interface{}] `json:"metadata"` + // Indicates whether the image requires a signature token to be accessed. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` +} + +func (r AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadURLV2Params) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountimagev2directupload_test.go b/accountimagev2directupload_test.go new file mode 100644 index 00000000000..44dd463a483 --- /dev/null +++ b/accountimagev2directupload_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadURLV2WithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Images.V2s.DirectUploads.CloudflareImagesNewAuthenticatedDirectUploadURLV2( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadURLV2Params{ + Expiry: cloudflare.F(time.Now()), + Metadata: cloudflare.F[any](map[string]interface{}{}), + RequireSignedURLs: cloudflare.F(true), + }, + ) + 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/accountintel.go b/accountintel.go new file mode 100644 index 00000000000..9b8e5b067c9 --- /dev/null +++ b/accountintel.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelService 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 [NewAccountIntelService] method +// instead. +type AccountIntelService struct { + Options []option.RequestOption + ASNs *AccountIntelASNService + DNS *AccountIntelDNSService + Domains *AccountIntelDomainService + DomainHistories *AccountIntelDomainHistoryService + IndicatorFeeds *AccountIntelIndicatorFeedService + IPs *AccountIntelIPService + IPLists *AccountIntelIPListService + Miscategorizations *AccountIntelMiscategorizationService + Sinkholes *AccountIntelSinkholeService + Whois *AccountIntelWhoisService +} + +// NewAccountIntelService 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 NewAccountIntelService(opts ...option.RequestOption) (r *AccountIntelService) { + r = &AccountIntelService{} + r.Options = opts + r.ASNs = NewAccountIntelASNService(opts...) + r.DNS = NewAccountIntelDNSService(opts...) + r.Domains = NewAccountIntelDomainService(opts...) + r.DomainHistories = NewAccountIntelDomainHistoryService(opts...) + r.IndicatorFeeds = NewAccountIntelIndicatorFeedService(opts...) + r.IPs = NewAccountIntelIPService(opts...) + r.IPLists = NewAccountIntelIPListService(opts...) + r.Miscategorizations = NewAccountIntelMiscategorizationService(opts...) + r.Sinkholes = NewAccountIntelSinkholeService(opts...) + r.Whois = NewAccountIntelWhoisService(opts...) + return +} diff --git a/accountintelasn.go b/accountintelasn.go new file mode 100644 index 00000000000..8f55d609be5 --- /dev/null +++ b/accountintelasn.go @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelASNService 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 [NewAccountIntelASNService] method +// instead. +type AccountIntelASNService struct { + Options []option.RequestOption + Subnets *AccountIntelASNSubnetService +} + +// NewAccountIntelASNService 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 NewAccountIntelASNService(opts ...option.RequestOption) (r *AccountIntelASNService) { + r = &AccountIntelASNService{} + r.Options = opts + r.Subnets = NewAccountIntelASNSubnetService(opts...) + return +} + +// Get ASN Overview +func (r *AccountIntelASNService) Get(ctx context.Context, accountIdentifier string, asn interface{}, opts ...option.RequestOption) (res *AccountIntelASNGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/asn/%v", accountIdentifier, asn) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountIntelASNGetResponse struct { + Errors []AccountIntelASNGetResponseError `json:"errors"` + Messages []AccountIntelASNGetResponseMessage `json:"messages"` + Result int64 `json:"result"` + // Whether the API call was successful + Success AccountIntelASNGetResponseSuccess `json:"success"` + JSON accountIntelASNGetResponseJSON `json:"-"` +} + +// accountIntelASNGetResponseJSON contains the JSON metadata for the struct +// [AccountIntelASNGetResponse] +type accountIntelASNGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelASNGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelASNGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelASNGetResponseErrorJSON `json:"-"` +} + +// accountIntelASNGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountIntelASNGetResponseError] +type accountIntelASNGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelASNGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelASNGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelASNGetResponseMessageJSON `json:"-"` +} + +// accountIntelASNGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountIntelASNGetResponseMessage] +type accountIntelASNGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelASNGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelASNGetResponseSuccess bool + +const ( + AccountIntelASNGetResponseSuccessTrue AccountIntelASNGetResponseSuccess = true +) diff --git a/aihuggingface_test.go b/accountintelasn_test.go similarity index 70% rename from aihuggingface_test.go rename to accountintelasn_test.go index 3cf1c88e704..53377c4cbb9 100644 --- a/aihuggingface_test.go +++ b/accountintelasn_test.go @@ -13,7 +13,8 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAIHuggingfaceDistilbertSst2Int8(t *testing.T) { +func TestAccountIntelASNGet(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 @@ -23,15 +24,15 @@ func TestAIHuggingfaceDistilbertSst2Int8(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Huggingface.DistilbertSst2Int8( + _, err := client.Accounts.Intel.ASNs.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIHuggingfaceDistilbertSst2Int8Params{ - Text: cloudflare.F("string"), - }, + map[string]interface{}{}, ) if err != nil { var apierr *cloudflare.Error diff --git a/accountintelasnsubnet.go b/accountintelasnsubnet.go new file mode 100644 index 00000000000..ddab8aa6f42 --- /dev/null +++ b/accountintelasnsubnet.go @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelASNSubnetService 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 [NewAccountIntelASNSubnetService] +// method instead. +type AccountIntelASNSubnetService struct { + Options []option.RequestOption +} + +// NewAccountIntelASNSubnetService 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 NewAccountIntelASNSubnetService(opts ...option.RequestOption) (r *AccountIntelASNSubnetService) { + r = &AccountIntelASNSubnetService{} + r.Options = opts + return +} + +// Get ASN Subnets +func (r *AccountIntelASNSubnetService) List(ctx context.Context, accountIdentifier string, asn int64, opts ...option.RequestOption) (res *AccountIntelASNSubnetListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/asn/%v/subnets", accountIdentifier, asn) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountIntelASNSubnetListResponse struct { + ASN int64 `json:"asn"` + // Total results returned based on your search parameters. + Count float64 `json:"count"` + IPCountTotal int64 `json:"ip_count_total"` + // Current page within paginated list of results. + Page float64 `json:"page"` + // Number of results per page of results. + PerPage float64 `json:"per_page"` + Subnets []string `json:"subnets"` + JSON accountIntelASNSubnetListResponseJSON `json:"-"` +} + +// accountIntelASNSubnetListResponseJSON contains the JSON metadata for the struct +// [AccountIntelASNSubnetListResponse] +type accountIntelASNSubnetListResponseJSON struct { + ASN apijson.Field + Count apijson.Field + IPCountTotal apijson.Field + Page apijson.Field + PerPage apijson.Field + Subnets apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelASNSubnetListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/accountintelasnsubnet_test.go b/accountintelasnsubnet_test.go new file mode 100644 index 00000000000..66efaec8229 --- /dev/null +++ b/accountintelasnsubnet_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelASNSubnetList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.ASNs.Subnets.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(0), + ) + 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/accountinteldns.go b/accountinteldns.go new file mode 100644 index 00000000000..3b49120fdc8 --- /dev/null +++ b/accountinteldns.go @@ -0,0 +1,202 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelDNSService 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 [NewAccountIntelDNSService] method +// instead. +type AccountIntelDNSService struct { + Options []option.RequestOption +} + +// NewAccountIntelDNSService 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 NewAccountIntelDNSService(opts ...option.RequestOption) (r *AccountIntelDNSService) { + r = &AccountIntelDNSService{} + r.Options = opts + return +} + +// Get Passive DNS by IP +func (r *AccountIntelDNSService) PassiveDNSByIPGetPassiveDNSByIP(ctx context.Context, accountIdentifier string, query AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParams, opts ...option.RequestOption) (res *AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/dns", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponse struct { + Errors []AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseError `json:"errors"` + Messages []AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseMessage `json:"messages"` + Result AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResult `json:"result"` + // Whether the API call was successful + Success AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseSuccess `json:"success"` + JSON accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseJSON `json:"-"` +} + +// accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseJSON contains the JSON +// metadata for the struct [AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponse] +type accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseErrorJSON `json:"-"` +} + +// accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseError] +type accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseMessageJSON `json:"-"` +} + +// accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseMessage] +type accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResult struct { + // Total results returned based on your search parameters. + Count float64 `json:"count"` + // Current page within paginated list of results. + Page float64 `json:"page"` + // Number of results per page of results. + PerPage float64 `json:"per_page"` + // Reverse DNS look-ups observed during the time period. + ReverseRecords []AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultReverseRecord `json:"reverse_records"` + JSON accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultJSON `json:"-"` +} + +// accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultJSON contains the +// JSON metadata for the struct +// [AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResult] +type accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + ReverseRecords apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultReverseRecord struct { + // First seen date of the DNS record during the time period. + FirstSeen time.Time `json:"first_seen" format:"date"` + // Hostname that the IP was observed resolving to. + Hostname interface{} `json:"hostname"` + // Last seen date of the DNS record during the time period. + LastSeen time.Time `json:"last_seen" format:"date"` + JSON accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultReverseRecordJSON `json:"-"` +} + +// accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultReverseRecordJSON +// contains the JSON metadata for the struct +// [AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultReverseRecord] +type accountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultReverseRecordJSON struct { + FirstSeen apijson.Field + Hostname apijson.Field + LastSeen apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseResultReverseRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseSuccess bool + +const ( + AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseSuccessTrue AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponseSuccess = true +) + +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParams struct { + Ipv4 param.Field[string] `query:"ipv4"` + // Requested page within paginated list of results. + Page param.Field[float64] `query:"page"` + // Maximum number of results requested. + PerPage param.Field[float64] `query:"per_page"` + StartEndParams param.Field[AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParamsStartEndParams] `query:"start_end_params"` +} + +// URLQuery serializes [AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParams]'s +// query parameters as `url.Values`. +func (r AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParamsStartEndParams struct { + // Defaults to the current date. + End param.Field[time.Time] `query:"end" format:"date"` + // Defaults to 30 days before the end parameter value. + Start param.Field[time.Time] `query:"start" format:"date"` +} + +// URLQuery serializes +// [AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParamsStartEndParams]'s query +// parameters as `url.Values`. +func (r AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParamsStartEndParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountinteldns_test.go b/accountinteldns_test.go new file mode 100644 index 00000000000..94bdf63e330 --- /dev/null +++ b/accountinteldns_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.DNS.PassiveDNSByIPGetPassiveDNSByIP( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParams{ + Ipv4: cloudflare.F("string"), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(20.000000), + StartEndParams: cloudflare.F(cloudflare.AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParamsStartEndParams{ + End: cloudflare.F(time.Now()), + Start: cloudflare.F(time.Now()), + }), + }, + ) + 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/accountinteldomain.go b/accountinteldomain.go new file mode 100644 index 00000000000..1b94fcf80fe --- /dev/null +++ b/accountinteldomain.go @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelDomainService 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 [NewAccountIntelDomainService] method +// instead. +type AccountIntelDomainService struct { + Options []option.RequestOption + Bulks *AccountIntelDomainBulkService +} + +// NewAccountIntelDomainService 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 NewAccountIntelDomainService(opts ...option.RequestOption) (r *AccountIntelDomainService) { + r = &AccountIntelDomainService{} + r.Options = opts + r.Bulks = NewAccountIntelDomainBulkService(opts...) + return +} + +// Get Domain Details +func (r *AccountIntelDomainService) DomainIntelligenceGetDomainDetails(ctx context.Context, accountIdentifier string, query AccountIntelDomainDomainIntelligenceGetDomainDetailsParams, opts ...option.RequestOption) (res *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/domain", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponse struct { + Errors []AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseError `json:"errors"` + Messages []AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseMessage `json:"messages"` + Result AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseSuccess `json:"success"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseJSON contains the +// JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponse] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseErrorJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseError] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseMessageJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseMessage] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResult struct { + // Additional information related to the host name. + AdditionalInformation AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultAdditionalInformation `json:"additional_information"` + // Application that the hostname belongs to. + Application AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultApplication `json:"application"` + // Current content categories. + ContentCategories interface{} `json:"content_categories"` + Domain string `json:"domain"` + InheritedContentCategories []AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedContentCategory `json:"inherited_content_categories"` + // Domain from which `inherited_content_categories` and `inherited_risk_types` are + // inherited, if applicable. + InheritedFrom string `json:"inherited_from"` + InheritedRiskTypes []AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedRiskType `json:"inherited_risk_types"` + // Global Cloudflare 100k ranking for the last 30 days, if available for the + // hostname. The top ranked domain is 1, the lowest ranked domain is 100,000. + PopularityRank int64 `json:"popularity_rank"` + // Specifies a list of references to one or more IP addresses or domain names that + // the domain name currently resolves to. + ResolvesToRefs []AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultResolvesToRef `json:"resolves_to_refs"` + // Hostname risk score, which is a value between 0 (lowest risk) to 1 (highest + // risk). + RiskScore float64 `json:"risk_score"` + RiskTypes interface{} `json:"risk_types"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultJSON contains +// the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResult] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultJSON struct { + AdditionalInformation apijson.Field + Application apijson.Field + ContentCategories apijson.Field + Domain apijson.Field + InheritedContentCategories apijson.Field + InheritedFrom apijson.Field + InheritedRiskTypes apijson.Field + PopularityRank apijson.Field + ResolvesToRefs apijson.Field + RiskScore apijson.Field + RiskTypes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional information related to the host name. +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultAdditionalInformation struct { + // Suspected DGA malware family. + SuspectedMalwareFamily string `json:"suspected_malware_family"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultAdditionalInformationJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultAdditionalInformationJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultAdditionalInformation] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultAdditionalInformationJSON struct { + SuspectedMalwareFamily apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultAdditionalInformation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Application that the hostname belongs to. +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultApplication struct { + ID int64 `json:"id"` + Name string `json:"name"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultApplicationJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultApplicationJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultApplication] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultApplicationJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultApplication) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedContentCategory struct { + ID int64 `json:"id"` + Name string `json:"name"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedContentCategoryJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedContentCategoryJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedContentCategory] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedContentCategoryJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedContentCategory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedRiskType struct { + ID int64 `json:"id"` + Name string `json:"name"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedRiskTypeJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedRiskTypeJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedRiskType] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedRiskTypeJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultInheritedRiskType) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultResolvesToRef struct { + // STIX 2.1 identifier: + // https://docs.oasis-open.org/cti/stix/v2.1/cs02/stix-v2.1-cs02.html#_64yvzeku5a5c + ID string `json:"id"` + // IP address or domain name. + Value string `json:"value"` + JSON accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultResolvesToRefJSON `json:"-"` +} + +// accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultResolvesToRefJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultResolvesToRef] +type accountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultResolvesToRefJSON struct { + ID apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseResultResolvesToRef) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseSuccess bool + +const ( + AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseSuccessTrue AccountIntelDomainDomainIntelligenceGetDomainDetailsResponseSuccess = true +) + +type AccountIntelDomainDomainIntelligenceGetDomainDetailsParams struct { + Domain param.Field[string] `query:"domain"` +} + +// URLQuery serializes +// [AccountIntelDomainDomainIntelligenceGetDomainDetailsParams]'s query parameters +// as `url.Values`. +func (r AccountIntelDomainDomainIntelligenceGetDomainDetailsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountinteldomain_test.go b/accountinteldomain_test.go new file mode 100644 index 00000000000..a3d1e975282 --- /dev/null +++ b/accountinteldomain_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelDomainDomainIntelligenceGetDomainDetailsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.Domains.DomainIntelligenceGetDomainDetails( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelDomainDomainIntelligenceGetDomainDetailsParams{ + Domain: cloudflare.F("string"), + }, + ) + 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/accountinteldomainbulk.go b/accountinteldomainbulk.go new file mode 100644 index 00000000000..677bd3216ad --- /dev/null +++ b/accountinteldomainbulk.go @@ -0,0 +1,289 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelDomainBulkService 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 [NewAccountIntelDomainBulkService] +// method instead. +type AccountIntelDomainBulkService struct { + Options []option.RequestOption +} + +// NewAccountIntelDomainBulkService 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 NewAccountIntelDomainBulkService(opts ...option.RequestOption) (r *AccountIntelDomainBulkService) { + r = &AccountIntelDomainBulkService{} + r.Options = opts + return +} + +// Get Multiple Domain Details +func (r *AccountIntelDomainBulkService) DomainIntelligenceGetMultipleDomainDetails(ctx context.Context, accountIdentifier string, query AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsParams, opts ...option.RequestOption) (res *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/domain/bulk", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponse struct { + Errors []AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseError `json:"errors"` + Messages []AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseMessage `json:"messages"` + Result []AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResult `json:"result"` + ResultInfo AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseSuccess `json:"success"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponse] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseErrorJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseError] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseMessageJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseMessage] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResult struct { + // Additional information related to the host name. + AdditionalInformation AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultAdditionalInformation `json:"additional_information"` + // Application that the hostname belongs to. + Application AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultApplication `json:"application"` + // Current content categories. + ContentCategories interface{} `json:"content_categories"` + Domain string `json:"domain"` + InheritedContentCategories []AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedContentCategory `json:"inherited_content_categories"` + // Domain from which `inherited_content_categories` and `inherited_risk_types` are + // inherited, if applicable. + InheritedFrom string `json:"inherited_from"` + InheritedRiskTypes []AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedRiskType `json:"inherited_risk_types"` + // Global Cloudflare 100k ranking for the last 30 days, if available for the + // hostname. The top ranked domain is 1, the lowest ranked domain is 100,000. + PopularityRank int64 `json:"popularity_rank"` + // Hostname risk score, which is a value between 0 (lowest risk) to 1 (highest + // risk). + RiskScore float64 `json:"risk_score"` + RiskTypes interface{} `json:"risk_types"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResult] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultJSON struct { + AdditionalInformation apijson.Field + Application apijson.Field + ContentCategories apijson.Field + Domain apijson.Field + InheritedContentCategories apijson.Field + InheritedFrom apijson.Field + InheritedRiskTypes apijson.Field + PopularityRank apijson.Field + RiskScore apijson.Field + RiskTypes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional information related to the host name. +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultAdditionalInformation struct { + // Suspected DGA malware family. + SuspectedMalwareFamily string `json:"suspected_malware_family"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultAdditionalInformationJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultAdditionalInformationJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultAdditionalInformation] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultAdditionalInformationJSON struct { + SuspectedMalwareFamily apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultAdditionalInformation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Application that the hostname belongs to. +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultApplication struct { + ID int64 `json:"id"` + Name string `json:"name"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultApplicationJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultApplicationJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultApplication] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultApplicationJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultApplication) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedContentCategory struct { + ID int64 `json:"id"` + Name string `json:"name"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedContentCategoryJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedContentCategoryJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedContentCategory] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedContentCategoryJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedContentCategory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedRiskType struct { + ID int64 `json:"id"` + Name string `json:"name"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedRiskTypeJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedRiskTypeJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedRiskType] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedRiskTypeJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInheritedRiskType) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInfoJSON `json:"-"` +} + +// accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInfo] +type accountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseSuccess bool + +const ( + AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseSuccessTrue AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponseSuccess = true +) + +type AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsParams struct { + // Accepts multiple values, i.e. `?domain=cloudflare.com&domain=example.com`. + Domain param.Field[interface{}] `query:"domain"` +} + +// URLQuery serializes +// [AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsParams]'s query +// parameters as `url.Values`. +func (r AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountinteldomainbulk_test.go b/accountinteldomainbulk_test.go new file mode 100644 index 00000000000..3c7922bae78 --- /dev/null +++ b/accountinteldomainbulk_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.Domains.Bulks.DomainIntelligenceGetMultipleDomainDetails( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsParams{ + Domain: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountinteldomainhistory.go b/accountinteldomainhistory.go new file mode 100644 index 00000000000..e491c4577f4 --- /dev/null +++ b/accountinteldomainhistory.go @@ -0,0 +1,195 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelDomainHistoryService 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 +// [NewAccountIntelDomainHistoryService] method instead. +type AccountIntelDomainHistoryService struct { + Options []option.RequestOption +} + +// NewAccountIntelDomainHistoryService 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 NewAccountIntelDomainHistoryService(opts ...option.RequestOption) (r *AccountIntelDomainHistoryService) { + r = &AccountIntelDomainHistoryService{} + r.Options = opts + return +} + +// Get Domain History +func (r *AccountIntelDomainHistoryService) List(ctx context.Context, accountIdentifier string, query AccountIntelDomainHistoryListParams, opts ...option.RequestOption) (res *AccountIntelDomainHistoryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/domain-history", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountIntelDomainHistoryListResponse struct { + Errors []AccountIntelDomainHistoryListResponseError `json:"errors"` + Messages []AccountIntelDomainHistoryListResponseMessage `json:"messages"` + Result []AccountIntelDomainHistoryListResponseResult `json:"result"` + ResultInfo AccountIntelDomainHistoryListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountIntelDomainHistoryListResponseSuccess `json:"success"` + JSON accountIntelDomainHistoryListResponseJSON `json:"-"` +} + +// accountIntelDomainHistoryListResponseJSON contains the JSON metadata for the +// struct [AccountIntelDomainHistoryListResponse] +type accountIntelDomainHistoryListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainHistoryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainHistoryListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDomainHistoryListResponseErrorJSON `json:"-"` +} + +// accountIntelDomainHistoryListResponseErrorJSON contains the JSON metadata for +// the struct [AccountIntelDomainHistoryListResponseError] +type accountIntelDomainHistoryListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainHistoryListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainHistoryListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelDomainHistoryListResponseMessageJSON `json:"-"` +} + +// accountIntelDomainHistoryListResponseMessageJSON contains the JSON metadata for +// the struct [AccountIntelDomainHistoryListResponseMessage] +type accountIntelDomainHistoryListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainHistoryListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainHistoryListResponseResult struct { + Categorizations []AccountIntelDomainHistoryListResponseResultCategorization `json:"categorizations"` + Domain string `json:"domain"` + JSON accountIntelDomainHistoryListResponseResultJSON `json:"-"` +} + +// accountIntelDomainHistoryListResponseResultJSON contains the JSON metadata for +// the struct [AccountIntelDomainHistoryListResponseResult] +type accountIntelDomainHistoryListResponseResultJSON struct { + Categorizations apijson.Field + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainHistoryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainHistoryListResponseResultCategorization struct { + Categories interface{} `json:"categories"` + End time.Time `json:"end" format:"date"` + Start time.Time `json:"start" format:"date"` + JSON accountIntelDomainHistoryListResponseResultCategorizationJSON `json:"-"` +} + +// accountIntelDomainHistoryListResponseResultCategorizationJSON contains the JSON +// metadata for the struct +// [AccountIntelDomainHistoryListResponseResultCategorization] +type accountIntelDomainHistoryListResponseResultCategorizationJSON struct { + Categories apijson.Field + End apijson.Field + Start apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainHistoryListResponseResultCategorization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelDomainHistoryListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountIntelDomainHistoryListResponseResultInfoJSON `json:"-"` +} + +// accountIntelDomainHistoryListResponseResultInfoJSON contains the JSON metadata +// for the struct [AccountIntelDomainHistoryListResponseResultInfo] +type accountIntelDomainHistoryListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelDomainHistoryListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelDomainHistoryListResponseSuccess bool + +const ( + AccountIntelDomainHistoryListResponseSuccessTrue AccountIntelDomainHistoryListResponseSuccess = true +) + +type AccountIntelDomainHistoryListParams struct { + Domain param.Field[interface{}] `query:"domain"` +} + +// URLQuery serializes [AccountIntelDomainHistoryListParams]'s query parameters as +// `url.Values`. +func (r AccountIntelDomainHistoryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountinteldomainhistory_test.go b/accountinteldomainhistory_test.go new file mode 100644 index 00000000000..49637afcaac --- /dev/null +++ b/accountinteldomainhistory_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelDomainHistoryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.DomainHistories.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelDomainHistoryListParams{ + Domain: cloudflare.F[any]("example.com"), + }, + ) + 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/accountintelindicatorfeed.go b/accountintelindicatorfeed.go new file mode 100644 index 00000000000..4203d4f0b07 --- /dev/null +++ b/accountintelindicatorfeed.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelIndicatorFeedService 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 +// [NewAccountIntelIndicatorFeedService] method instead. +type AccountIntelIndicatorFeedService struct { + Options []option.RequestOption + Permissions *AccountIntelIndicatorFeedPermissionService +} + +// NewAccountIntelIndicatorFeedService 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 NewAccountIntelIndicatorFeedService(opts ...option.RequestOption) (r *AccountIntelIndicatorFeedService) { + r = &AccountIntelIndicatorFeedService{} + r.Options = opts + r.Permissions = NewAccountIntelIndicatorFeedPermissionService(opts...) + return +} diff --git a/accountintelindicatorfeedpermission.go b/accountintelindicatorfeedpermission.go new file mode 100644 index 00000000000..578d624f5de --- /dev/null +++ b/accountintelindicatorfeedpermission.go @@ -0,0 +1,242 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelIndicatorFeedPermissionService 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 +// [NewAccountIntelIndicatorFeedPermissionService] method instead. +type AccountIntelIndicatorFeedPermissionService struct { + Options []option.RequestOption +} + +// NewAccountIntelIndicatorFeedPermissionService 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 NewAccountIntelIndicatorFeedPermissionService(opts ...option.RequestOption) (r *AccountIntelIndicatorFeedPermissionService) { + r = &AccountIntelIndicatorFeedPermissionService{} + r.Options = opts + return +} + +// Revoke permission to indicator feed +func (r *AccountIntelIndicatorFeedPermissionService) Remove(ctx context.Context, accountIdentifier string, body AccountIntelIndicatorFeedPermissionRemoveParams, opts ...option.RequestOption) (res *AccountIntelIndicatorFeedPermissionRemoveResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/permissions/remove", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// List indicator feed permissions +func (r *AccountIntelIndicatorFeedPermissionService) View(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountIntelIndicatorFeedPermissionViewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/permissions/view", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountIntelIndicatorFeedPermissionRemoveResponse struct { + Errors []AccountIntelIndicatorFeedPermissionRemoveResponseError `json:"errors"` + Messages []AccountIntelIndicatorFeedPermissionRemoveResponseMessage `json:"messages"` + Result AccountIntelIndicatorFeedPermissionRemoveResponseResult `json:"result"` + // Whether the API call was successful + Success AccountIntelIndicatorFeedPermissionRemoveResponseSuccess `json:"success"` + JSON accountIntelIndicatorFeedPermissionRemoveResponseJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionRemoveResponseJSON contains the JSON metadata +// for the struct [AccountIntelIndicatorFeedPermissionRemoveResponse] +type accountIntelIndicatorFeedPermissionRemoveResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionRemoveResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIndicatorFeedPermissionRemoveResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIndicatorFeedPermissionRemoveResponseErrorJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionRemoveResponseErrorJSON contains the JSON +// metadata for the struct [AccountIntelIndicatorFeedPermissionRemoveResponseError] +type accountIntelIndicatorFeedPermissionRemoveResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionRemoveResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIndicatorFeedPermissionRemoveResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIndicatorFeedPermissionRemoveResponseMessageJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionRemoveResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountIntelIndicatorFeedPermissionRemoveResponseMessage] +type accountIntelIndicatorFeedPermissionRemoveResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionRemoveResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIndicatorFeedPermissionRemoveResponseResult struct { + // Whether the update succeeded or not + Success bool `json:"success"` + JSON accountIntelIndicatorFeedPermissionRemoveResponseResultJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionRemoveResponseResultJSON contains the JSON +// metadata for the struct +// [AccountIntelIndicatorFeedPermissionRemoveResponseResult] +type accountIntelIndicatorFeedPermissionRemoveResponseResultJSON struct { + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionRemoveResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelIndicatorFeedPermissionRemoveResponseSuccess bool + +const ( + AccountIntelIndicatorFeedPermissionRemoveResponseSuccessTrue AccountIntelIndicatorFeedPermissionRemoveResponseSuccess = true +) + +type AccountIntelIndicatorFeedPermissionViewResponse struct { + Errors []AccountIntelIndicatorFeedPermissionViewResponseError `json:"errors"` + Messages []AccountIntelIndicatorFeedPermissionViewResponseMessage `json:"messages"` + Result []AccountIntelIndicatorFeedPermissionViewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountIntelIndicatorFeedPermissionViewResponseSuccess `json:"success"` + JSON accountIntelIndicatorFeedPermissionViewResponseJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionViewResponseJSON contains the JSON metadata +// for the struct [AccountIntelIndicatorFeedPermissionViewResponse] +type accountIntelIndicatorFeedPermissionViewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionViewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIndicatorFeedPermissionViewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIndicatorFeedPermissionViewResponseErrorJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionViewResponseErrorJSON contains the JSON +// metadata for the struct [AccountIntelIndicatorFeedPermissionViewResponseError] +type accountIntelIndicatorFeedPermissionViewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionViewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIndicatorFeedPermissionViewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIndicatorFeedPermissionViewResponseMessageJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionViewResponseMessageJSON contains the JSON +// metadata for the struct [AccountIntelIndicatorFeedPermissionViewResponseMessage] +type accountIntelIndicatorFeedPermissionViewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionViewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIndicatorFeedPermissionViewResponseResult struct { + // The unique identifier for the indicator feed + ID int64 `json:"id"` + // The description of the example test + Description string `json:"description"` + // The name of the indicator feed + Name string `json:"name"` + JSON accountIntelIndicatorFeedPermissionViewResponseResultJSON `json:"-"` +} + +// accountIntelIndicatorFeedPermissionViewResponseResultJSON contains the JSON +// metadata for the struct [AccountIntelIndicatorFeedPermissionViewResponseResult] +type accountIntelIndicatorFeedPermissionViewResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIndicatorFeedPermissionViewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelIndicatorFeedPermissionViewResponseSuccess bool + +const ( + AccountIntelIndicatorFeedPermissionViewResponseSuccessTrue AccountIntelIndicatorFeedPermissionViewResponseSuccess = true +) + +type AccountIntelIndicatorFeedPermissionRemoveParams struct { + // The Cloudflare account tag of the account to change permissions on + AccountTag param.Field[string] `json:"account_tag"` + // The ID of the feed to add/remove permissions on + FeedID param.Field[int64] `json:"feed_id"` +} + +func (r AccountIntelIndicatorFeedPermissionRemoveParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountintelindicatorfeedpermission_test.go b/accountintelindicatorfeedpermission_test.go new file mode 100644 index 00000000000..7f50161aa39 --- /dev/null +++ b/accountintelindicatorfeedpermission_test.go @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelIndicatorFeedPermissionRemoveWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.IndicatorFeeds.Permissions.Remove( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelIndicatorFeedPermissionRemoveParams{ + AccountTag: cloudflare.F("823f45f16fd2f7e21e1e054aga4d2859"), + FeedID: cloudflare.F(int64(1)), + }, + ) + 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 TestAccountIntelIndicatorFeedPermissionView(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.IndicatorFeeds.Permissions.View(context.TODO(), "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/accountintelip.go b/accountintelip.go new file mode 100644 index 00000000000..c04fcaec0a3 --- /dev/null +++ b/accountintelip.go @@ -0,0 +1,243 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountIntelIPService 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 [NewAccountIntelIPService] method +// instead. +type AccountIntelIPService struct { + Options []option.RequestOption +} + +// NewAccountIntelIPService 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 NewAccountIntelIPService(opts ...option.RequestOption) (r *AccountIntelIPService) { + r = &AccountIntelIPService{} + r.Options = opts + return +} + +// Get IP Overview +func (r *AccountIntelIPService) IPIntelligenceGetIPOverview(ctx context.Context, accountIdentifier string, query AccountIntelIPIPIntelligenceGetIPOverviewParams, opts ...option.RequestOption) (res *AccountIntelIpipIntelligenceGetIPOverviewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/ip", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountIntelIpipIntelligenceGetIPOverviewResponse struct { + Errors []AccountIntelIpipIntelligenceGetIPOverviewResponseError `json:"errors"` + Messages []AccountIntelIpipIntelligenceGetIPOverviewResponseMessage `json:"messages"` + Result []AccountIntelIpipIntelligenceGetIPOverviewResponseResult `json:"result"` + ResultInfo AccountIntelIpipIntelligenceGetIPOverviewResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountIntelIpipIntelligenceGetIPOverviewResponseSuccess `json:"success"` + JSON accountIntelIpipIntelligenceGetIPOverviewResponseJSON `json:"-"` +} + +// accountIntelIpipIntelligenceGetIPOverviewResponseJSON contains the JSON metadata +// for the struct [AccountIntelIpipIntelligenceGetIPOverviewResponse] +type accountIntelIpipIntelligenceGetIPOverviewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIpipIntelligenceGetIPOverviewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIpipIntelligenceGetIPOverviewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIpipIntelligenceGetIPOverviewResponseErrorJSON `json:"-"` +} + +// accountIntelIpipIntelligenceGetIPOverviewResponseErrorJSON contains the JSON +// metadata for the struct [AccountIntelIpipIntelligenceGetIPOverviewResponseError] +type accountIntelIpipIntelligenceGetIPOverviewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIpipIntelligenceGetIPOverviewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIpipIntelligenceGetIPOverviewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIpipIntelligenceGetIPOverviewResponseMessageJSON `json:"-"` +} + +// accountIntelIpipIntelligenceGetIPOverviewResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountIntelIpipIntelligenceGetIPOverviewResponseMessage] +type accountIntelIpipIntelligenceGetIPOverviewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIpipIntelligenceGetIPOverviewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIpipIntelligenceGetIPOverviewResponseResult struct { + // Specifies a reference to the autonomous systems (AS) that the IP address belongs + // to. + BelongsToRef AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRef `json:"belongs_to_ref"` + IP AccountIntelIpipIntelligenceGetIPOverviewResponseResultIP `json:"ip" format:"ipv4"` + RiskTypes interface{} `json:"risk_types"` + JSON accountIntelIpipIntelligenceGetIPOverviewResponseResultJSON `json:"-"` +} + +// accountIntelIpipIntelligenceGetIPOverviewResponseResultJSON contains the JSON +// metadata for the struct +// [AccountIntelIpipIntelligenceGetIPOverviewResponseResult] +type accountIntelIpipIntelligenceGetIPOverviewResponseResultJSON struct { + BelongsToRef apijson.Field + IP apijson.Field + RiskTypes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIpipIntelligenceGetIPOverviewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies a reference to the autonomous systems (AS) that the IP address belongs +// to. +type AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRef struct { + ID interface{} `json:"id"` + Country string `json:"country"` + Description string `json:"description"` + // Infrastructure type of this ASN. + Type AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefType `json:"type"` + Value string `json:"value"` + JSON accountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefJSON `json:"-"` +} + +// accountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefJSON contains +// the JSON metadata for the struct +// [AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRef] +type accountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefJSON struct { + ID apijson.Field + Country apijson.Field + Description apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRef) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Infrastructure type of this ASN. +type AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefType string + +const ( + AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefTypeHostingProvider AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefType = "hosting_provider" + AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefTypeIsp AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefType = "isp" + AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefTypeOrganization AccountIntelIpipIntelligenceGetIPOverviewResponseResultBelongsToRefType = "organization" +) + +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type AccountIntelIpipIntelligenceGetIPOverviewResponseResultIP interface { + ImplementsAccountIntelIpipIntelligenceGetIPOverviewResponseResultIP() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountIntelIpipIntelligenceGetIPOverviewResponseResultIP)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AccountIntelIpipIntelligenceGetIPOverviewResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountIntelIpipIntelligenceGetIPOverviewResponseResultInfoJSON `json:"-"` +} + +// accountIntelIpipIntelligenceGetIPOverviewResponseResultInfoJSON contains the +// JSON metadata for the struct +// [AccountIntelIpipIntelligenceGetIPOverviewResponseResultInfo] +type accountIntelIpipIntelligenceGetIPOverviewResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIpipIntelligenceGetIPOverviewResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelIpipIntelligenceGetIPOverviewResponseSuccess bool + +const ( + AccountIntelIpipIntelligenceGetIPOverviewResponseSuccessTrue AccountIntelIpipIntelligenceGetIPOverviewResponseSuccess = true +) + +type AccountIntelIPIPIntelligenceGetIPOverviewParams struct { + Ipv4 param.Field[string] `query:"ipv4"` + Ipv6 param.Field[string] `query:"ipv6"` +} + +// URLQuery serializes [AccountIntelIPIPIntelligenceGetIPOverviewParams]'s query +// parameters as `url.Values`. +func (r AccountIntelIPIPIntelligenceGetIPOverviewParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountintelip_test.go b/accountintelip_test.go new file mode 100644 index 00000000000..f40939b163a --- /dev/null +++ b/accountintelip_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelIPIPIntelligenceGetIPOverviewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.IPs.IPIntelligenceGetIPOverview( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelIPIPIntelligenceGetIPOverviewParams{ + Ipv4: cloudflare.F("string"), + Ipv6: cloudflare.F("string"), + }, + ) + 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/accountinteliplist.go b/accountinteliplist.go new file mode 100644 index 00000000000..eeb1589571f --- /dev/null +++ b/accountinteliplist.go @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelIPListService 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 [NewAccountIntelIPListService] method +// instead. +type AccountIntelIPListService struct { + Options []option.RequestOption +} + +// NewAccountIntelIPListService 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 NewAccountIntelIPListService(opts ...option.RequestOption) (r *AccountIntelIPListService) { + r = &AccountIntelIPListService{} + r.Options = opts + return +} + +// Get IP Lists +func (r *AccountIntelIPListService) IPListGetIPLists(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountIntelIPListIPListGetIPListsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/ip-list", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountIntelIPListIPListGetIPListsResponse struct { + Errors []AccountIntelIPListIPListGetIPListsResponseError `json:"errors"` + Messages []AccountIntelIPListIPListGetIPListsResponseMessage `json:"messages"` + Result []AccountIntelIPListIPListGetIPListsResponseResult `json:"result"` + ResultInfo AccountIntelIPListIPListGetIPListsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountIntelIPListIPListGetIPListsResponseSuccess `json:"success"` + JSON accountIntelIPListIPListGetIPListsResponseJSON `json:"-"` +} + +// accountIntelIPListIPListGetIPListsResponseJSON contains the JSON metadata for +// the struct [AccountIntelIPListIPListGetIPListsResponse] +type accountIntelIPListIPListGetIPListsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIPListIPListGetIPListsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIPListIPListGetIPListsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIPListIPListGetIPListsResponseErrorJSON `json:"-"` +} + +// accountIntelIPListIPListGetIPListsResponseErrorJSON contains the JSON metadata +// for the struct [AccountIntelIPListIPListGetIPListsResponseError] +type accountIntelIPListIPListGetIPListsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIPListIPListGetIPListsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIPListIPListGetIPListsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelIPListIPListGetIPListsResponseMessageJSON `json:"-"` +} + +// accountIntelIPListIPListGetIPListsResponseMessageJSON contains the JSON metadata +// for the struct [AccountIntelIPListIPListGetIPListsResponseMessage] +type accountIntelIPListIPListGetIPListsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIPListIPListGetIPListsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIPListIPListGetIPListsResponseResult struct { + ID int64 `json:"id"` + Description string `json:"description"` + Name string `json:"name"` + JSON accountIntelIPListIPListGetIPListsResponseResultJSON `json:"-"` +} + +// accountIntelIPListIPListGetIPListsResponseResultJSON contains the JSON metadata +// for the struct [AccountIntelIPListIPListGetIPListsResponseResult] +type accountIntelIPListIPListGetIPListsResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIPListIPListGetIPListsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelIPListIPListGetIPListsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountIntelIPListIPListGetIPListsResponseResultInfoJSON `json:"-"` +} + +// accountIntelIPListIPListGetIPListsResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountIntelIPListIPListGetIPListsResponseResultInfo] +type accountIntelIPListIPListGetIPListsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelIPListIPListGetIPListsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelIPListIPListGetIPListsResponseSuccess bool + +const ( + AccountIntelIPListIPListGetIPListsResponseSuccessTrue AccountIntelIPListIPListGetIPListsResponseSuccess = true +) diff --git a/accountinteliplist_test.go b/accountinteliplist_test.go new file mode 100644 index 00000000000..a7a9ed59c95 --- /dev/null +++ b/accountinteliplist_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelIPListIPListGetIPLists(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.IPLists.IPListGetIPLists(context.TODO(), "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/accountintelmiscategorization.go b/accountintelmiscategorization.go new file mode 100644 index 00000000000..6f58242b00a --- /dev/null +++ b/accountintelmiscategorization.go @@ -0,0 +1,165 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountIntelMiscategorizationService 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 +// [NewAccountIntelMiscategorizationService] method instead. +type AccountIntelMiscategorizationService struct { + Options []option.RequestOption +} + +// NewAccountIntelMiscategorizationService 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 NewAccountIntelMiscategorizationService(opts ...option.RequestOption) (r *AccountIntelMiscategorizationService) { + r = &AccountIntelMiscategorizationService{} + r.Options = opts + return +} + +// Create Miscategorization +func (r *AccountIntelMiscategorizationService) MiscategorizationNewMiscategorization(ctx context.Context, accountIdentifier string, body AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParams, opts ...option.RequestOption) (res *AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/miscategorization", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponse struct { + Errors []AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseError `json:"errors"` + Messages []AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseMessage `json:"messages"` + Result AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseSuccess `json:"success"` + JSON accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseJSON `json:"-"` +} + +// accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseJSON +// contains the JSON metadata for the struct +// [AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponse] +type accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseErrorJSON `json:"-"` +} + +// accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseError] +type accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseMessageJSON `json:"-"` +} + +// accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseMessage] +type accountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseResultUnknown] +// or [shared.UnionString]. +type AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseResult interface { + ImplementsAccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseSuccess bool + +const ( + AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseSuccessTrue AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseSuccess = true +) + +type AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParams struct { + // Content category IDs to add. + ContentAdds param.Field[interface{}] `json:"content_adds"` + // Content category IDs to remove. + ContentRemoves param.Field[interface{}] `json:"content_removes"` + IndicatorType param.Field[AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorType] `json:"indicator_type"` + // Provide only if indicator_type is `ipv4` or `ipv6`. + IP param.Field[interface{}] `json:"ip"` + // Security category IDs to add. + SecurityAdds param.Field[interface{}] `json:"security_adds"` + // Security category IDs to remove. + SecurityRemoves param.Field[interface{}] `json:"security_removes"` + // Provide only if indicator_type is `domain` or `url`. Example if indicator_type + // is `domain`: `example.com`. Example if indicator_type is `url`: + // `https://example.com/news/`. + URL param.Field[string] `json:"url"` +} + +func (r AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorType string + +const ( + AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorTypeDomain AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorType = "domain" + AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorTypeIpv4 AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorType = "ipv4" + AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorTypeIpv6 AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorType = "ipv6" + AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorTypeURL AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorType = "url" +) diff --git a/accountintelmiscategorization_test.go b/accountintelmiscategorization_test.go new file mode 100644 index 00000000000..85549aa40fb --- /dev/null +++ b/accountintelmiscategorization_test.go @@ -0,0 +1,61 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelMiscategorizationMiscategorizationNewMiscategorizationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.Miscategorizations.MiscategorizationNewMiscategorization( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParams{ + ContentAdds: cloudflare.F[any](map[string]interface{}{ + "0": int64(82), + }), + ContentRemoves: cloudflare.F[any](map[string]interface{}{ + "0": int64(155), + }), + IndicatorType: cloudflare.F(cloudflare.AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParamsIndicatorTypeDomain), + IP: cloudflare.F[any](map[string]interface{}{}), + SecurityAdds: cloudflare.F[any](map[string]interface{}{ + "0": int64(117), + "1": int64(131), + }), + SecurityRemoves: cloudflare.F[any](map[string]interface{}{ + "0": int64(83), + }), + URL: cloudflare.F("string"), + }, + ) + 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/accountintelsinkhole.go b/accountintelsinkhole.go new file mode 100644 index 00000000000..57dd4525fb0 --- /dev/null +++ b/accountintelsinkhole.go @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelSinkholeService 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 [NewAccountIntelSinkholeService] +// method instead. +type AccountIntelSinkholeService struct { + Options []option.RequestOption +} + +// NewAccountIntelSinkholeService 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 NewAccountIntelSinkholeService(opts ...option.RequestOption) (r *AccountIntelSinkholeService) { + r = &AccountIntelSinkholeService{} + r.Options = opts + return +} + +// List sinkholes owned by this account +func (r *AccountIntelSinkholeService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountIntelSinkholeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/sinkholes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountIntelSinkholeListResponse struct { + Errors []AccountIntelSinkholeListResponseError `json:"errors"` + Messages []AccountIntelSinkholeListResponseMessage `json:"messages"` + Result []AccountIntelSinkholeListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountIntelSinkholeListResponseSuccess `json:"success"` + JSON accountIntelSinkholeListResponseJSON `json:"-"` +} + +// accountIntelSinkholeListResponseJSON contains the JSON metadata for the struct +// [AccountIntelSinkholeListResponse] +type accountIntelSinkholeListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelSinkholeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelSinkholeListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelSinkholeListResponseErrorJSON `json:"-"` +} + +// accountIntelSinkholeListResponseErrorJSON contains the JSON metadata for the +// struct [AccountIntelSinkholeListResponseError] +type accountIntelSinkholeListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelSinkholeListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelSinkholeListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelSinkholeListResponseMessageJSON `json:"-"` +} + +// accountIntelSinkholeListResponseMessageJSON contains the JSON metadata for the +// struct [AccountIntelSinkholeListResponseMessage] +type accountIntelSinkholeListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelSinkholeListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelSinkholeListResponseResult struct { + // The unique identifier for the sinkhole + ID int64 `json:"id"` + // The account tag that owns this sinkhole + AccountTag string `json:"account_tag"` + // The date and time when the sinkhole was created + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The date and time when the sinkhole was last modified + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The name of the sinkhole + Name string `json:"name"` + // The name of the R2 bucket to store results + R2Bucket string `json:"r2_bucket"` + // The id of the R2 instance + R2ID string `json:"r2_id"` + JSON accountIntelSinkholeListResponseResultJSON `json:"-"` +} + +// accountIntelSinkholeListResponseResultJSON contains the JSON metadata for the +// struct [AccountIntelSinkholeListResponseResult] +type accountIntelSinkholeListResponseResultJSON struct { + ID apijson.Field + AccountTag apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + R2Bucket apijson.Field + R2ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelSinkholeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelSinkholeListResponseSuccess bool + +const ( + AccountIntelSinkholeListResponseSuccessTrue AccountIntelSinkholeListResponseSuccess = true +) diff --git a/accountintelsinkhole_test.go b/accountintelsinkhole_test.go new file mode 100644 index 00000000000..1875673c565 --- /dev/null +++ b/accountintelsinkhole_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelSinkholeList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.Sinkholes.List(context.TODO(), "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/accountintelwhois.go b/accountintelwhois.go new file mode 100644 index 00000000000..0d7b1ffa952 --- /dev/null +++ b/accountintelwhois.go @@ -0,0 +1,161 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountIntelWhoisService 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 [NewAccountIntelWhoisService] method +// instead. +type AccountIntelWhoisService struct { + Options []option.RequestOption +} + +// NewAccountIntelWhoisService 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 NewAccountIntelWhoisService(opts ...option.RequestOption) (r *AccountIntelWhoisService) { + r = &AccountIntelWhoisService{} + r.Options = opts + return +} + +// Get WHOIS Record +func (r *AccountIntelWhoisService) WhoisRecordGetWhoisRecord(ctx context.Context, accountIdentifier string, query AccountIntelWhoisWhoisRecordGetWhoisRecordParams, opts ...option.RequestOption) (res *AccountIntelWhoisWhoisRecordGetWhoisRecordResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/whois", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountIntelWhoisWhoisRecordGetWhoisRecordResponse struct { + Errors []AccountIntelWhoisWhoisRecordGetWhoisRecordResponseError `json:"errors"` + Messages []AccountIntelWhoisWhoisRecordGetWhoisRecordResponseMessage `json:"messages"` + Result AccountIntelWhoisWhoisRecordGetWhoisRecordResponseResult `json:"result"` + // Whether the API call was successful + Success AccountIntelWhoisWhoisRecordGetWhoisRecordResponseSuccess `json:"success"` + JSON accountIntelWhoisWhoisRecordGetWhoisRecordResponseJSON `json:"-"` +} + +// accountIntelWhoisWhoisRecordGetWhoisRecordResponseJSON contains the JSON +// metadata for the struct [AccountIntelWhoisWhoisRecordGetWhoisRecordResponse] +type accountIntelWhoisWhoisRecordGetWhoisRecordResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelWhoisWhoisRecordGetWhoisRecordResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelWhoisWhoisRecordGetWhoisRecordResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelWhoisWhoisRecordGetWhoisRecordResponseErrorJSON `json:"-"` +} + +// accountIntelWhoisWhoisRecordGetWhoisRecordResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountIntelWhoisWhoisRecordGetWhoisRecordResponseError] +type accountIntelWhoisWhoisRecordGetWhoisRecordResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelWhoisWhoisRecordGetWhoisRecordResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelWhoisWhoisRecordGetWhoisRecordResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountIntelWhoisWhoisRecordGetWhoisRecordResponseMessageJSON `json:"-"` +} + +// accountIntelWhoisWhoisRecordGetWhoisRecordResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountIntelWhoisWhoisRecordGetWhoisRecordResponseMessage] +type accountIntelWhoisWhoisRecordGetWhoisRecordResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelWhoisWhoisRecordGetWhoisRecordResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountIntelWhoisWhoisRecordGetWhoisRecordResponseResult struct { + CreatedDate time.Time `json:"created_date" format:"date"` + Domain string `json:"domain"` + Nameservers []string `json:"nameservers"` + Registrant string `json:"registrant"` + RegistrantCountry string `json:"registrant_country"` + RegistrantEmail string `json:"registrant_email"` + RegistrantOrg string `json:"registrant_org"` + Registrar string `json:"registrar"` + UpdatedDate time.Time `json:"updated_date" format:"date"` + JSON accountIntelWhoisWhoisRecordGetWhoisRecordResponseResultJSON `json:"-"` +} + +// accountIntelWhoisWhoisRecordGetWhoisRecordResponseResultJSON contains the JSON +// metadata for the struct +// [AccountIntelWhoisWhoisRecordGetWhoisRecordResponseResult] +type accountIntelWhoisWhoisRecordGetWhoisRecordResponseResultJSON struct { + CreatedDate apijson.Field + Domain apijson.Field + Nameservers apijson.Field + Registrant apijson.Field + RegistrantCountry apijson.Field + RegistrantEmail apijson.Field + RegistrantOrg apijson.Field + Registrar apijson.Field + UpdatedDate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountIntelWhoisWhoisRecordGetWhoisRecordResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountIntelWhoisWhoisRecordGetWhoisRecordResponseSuccess bool + +const ( + AccountIntelWhoisWhoisRecordGetWhoisRecordResponseSuccessTrue AccountIntelWhoisWhoisRecordGetWhoisRecordResponseSuccess = true +) + +type AccountIntelWhoisWhoisRecordGetWhoisRecordParams struct { + Domain param.Field[string] `query:"domain"` +} + +// URLQuery serializes [AccountIntelWhoisWhoisRecordGetWhoisRecordParams]'s query +// parameters as `url.Values`. +func (r AccountIntelWhoisWhoisRecordGetWhoisRecordParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountintelwhois_test.go b/accountintelwhois_test.go new file mode 100644 index 00000000000..f7a0095a094 --- /dev/null +++ b/accountintelwhois_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountIntelWhoisWhoisRecordGetWhoisRecordWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Intel.Whois.WhoisRecordGetWhoisRecord( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountIntelWhoisWhoisRecordGetWhoisRecordParams{ + Domain: cloudflare.F("string"), + }, + ) + 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/accountloadbalancer.go b/accountloadbalancer.go new file mode 100644 index 00000000000..9f97da664b6 --- /dev/null +++ b/accountloadbalancer.go @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerService 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 [NewAccountLoadBalancerService] +// method instead. +type AccountLoadBalancerService struct { + Options []option.RequestOption + Monitors *AccountLoadBalancerMonitorService + Pools *AccountLoadBalancerPoolService + Previews *AccountLoadBalancerPreviewService + Regions *AccountLoadBalancerRegionService + Searches *AccountLoadBalancerSearchService +} + +// NewAccountLoadBalancerService 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 NewAccountLoadBalancerService(opts ...option.RequestOption) (r *AccountLoadBalancerService) { + r = &AccountLoadBalancerService{} + r.Options = opts + r.Monitors = NewAccountLoadBalancerMonitorService(opts...) + r.Pools = NewAccountLoadBalancerPoolService(opts...) + r.Previews = NewAccountLoadBalancerPreviewService(opts...) + r.Regions = NewAccountLoadBalancerRegionService(opts...) + r.Searches = NewAccountLoadBalancerSearchService(opts...) + return +} diff --git a/accountloadbalancermonitor.go b/accountloadbalancermonitor.go new file mode 100644 index 00000000000..d2d2ea72892 --- /dev/null +++ b/accountloadbalancermonitor.go @@ -0,0 +1,744 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerMonitorService 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 +// [NewAccountLoadBalancerMonitorService] method instead. +type AccountLoadBalancerMonitorService struct { + Options []option.RequestOption + Previews *AccountLoadBalancerMonitorPreviewService + References *AccountLoadBalancerMonitorReferenceService +} + +// NewAccountLoadBalancerMonitorService 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 NewAccountLoadBalancerMonitorService(opts ...option.RequestOption) (r *AccountLoadBalancerMonitorService) { + r = &AccountLoadBalancerMonitorService{} + r.Options = opts + r.Previews = NewAccountLoadBalancerMonitorPreviewService(opts...) + r.References = NewAccountLoadBalancerMonitorReferenceService(opts...) + return +} + +// List a single configured monitor for an account. +func (r *AccountLoadBalancerMonitorService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify a configured monitor. +func (r *AccountLoadBalancerMonitorService) Update(ctx context.Context, accountIdentifier string, identifier string, body AccountLoadBalancerMonitorUpdateParams, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete a configured monitor. +func (r *AccountLoadBalancerMonitorService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountLoadBalancerMonitorDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a configured monitor. +func (r *AccountLoadBalancerMonitorService) AccountLoadBalancerMonitorsNewMonitor(ctx context.Context, accountIdentifier string, body AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParams, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List configured monitors for an account. +func (r *AccountLoadBalancerMonitorService) AccountLoadBalancerMonitorsListMonitors(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Apply changes to an existing monitor, overwriting the supplied properties. +func (r *AccountLoadBalancerMonitorService) Patch(ctx context.Context, accountIdentifier string, identifier string, body AccountLoadBalancerMonitorPatchParams, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type Monitor struct { + Errors []MonitorError `json:"errors"` + Messages []MonitorMessage `json:"messages"` + Result MonitorResult `json:"result"` + // Whether the API call was successful + Success MonitorSuccess `json:"success"` + JSON monitorJSON `json:"-"` +} + +// monitorJSON contains the JSON metadata for the struct [Monitor] +type monitorJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Monitor) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MonitorError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON monitorErrorJSON `json:"-"` +} + +// monitorErrorJSON contains the JSON metadata for the struct [MonitorError] +type monitorErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MonitorError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MonitorMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON monitorMessageJSON `json:"-"` +} + +// monitorMessageJSON contains the JSON metadata for the struct [MonitorMessage] +type monitorMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MonitorMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MonitorResult struct { + ID string `json:"id"` + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure bool `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown int64 `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp int64 `json:"consecutive_up"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Object description. + Description string `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody string `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes string `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects bool `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header interface{} `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval int64 `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method string `json:"method"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path string `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port int64 `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone string `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries int64 `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout int64 `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type MonitorResultType `json:"type"` + JSON monitorResultJSON `json:"-"` +} + +// monitorResultJSON contains the JSON metadata for the struct [MonitorResult] +type monitorResultJSON struct { + ID apijson.Field + AllowInsecure apijson.Field + ConsecutiveDown apijson.Field + ConsecutiveUp apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ExpectedBody apijson.Field + ExpectedCodes apijson.Field + FollowRedirects apijson.Field + Header apijson.Field + Interval apijson.Field + Method apijson.Field + ModifiedOn apijson.Field + Path apijson.Field + Port apijson.Field + ProbeZone apijson.Field + Retries apijson.Field + Timeout apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MonitorResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type MonitorResultType string + +const ( + MonitorResultTypeHTTP MonitorResultType = "http" + MonitorResultTypeHTTPs MonitorResultType = "https" + MonitorResultTypeTcp MonitorResultType = "tcp" + MonitorResultTypeUdpIcmp MonitorResultType = "udp_icmp" + MonitorResultTypeIcmpPing MonitorResultType = "icmp_ping" + MonitorResultTypeSmtp MonitorResultType = "smtp" +) + +// Whether the API call was successful +type MonitorSuccess bool + +const ( + MonitorSuccessTrue MonitorSuccess = true +) + +type AccountLoadBalancerMonitorDeleteResponse struct { + Errors []AccountLoadBalancerMonitorDeleteResponseError `json:"errors"` + Messages []AccountLoadBalancerMonitorDeleteResponseMessage `json:"messages"` + Result AccountLoadBalancerMonitorDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerMonitorDeleteResponseSuccess `json:"success"` + JSON accountLoadBalancerMonitorDeleteResponseJSON `json:"-"` +} + +// accountLoadBalancerMonitorDeleteResponseJSON contains the JSON metadata for the +// struct [AccountLoadBalancerMonitorDeleteResponse] +type accountLoadBalancerMonitorDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorDeleteResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerMonitorDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountLoadBalancerMonitorDeleteResponseError] +type accountLoadBalancerMonitorDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorDeleteResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerMonitorDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountLoadBalancerMonitorDeleteResponseMessage] +type accountLoadBalancerMonitorDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorDeleteResponseResult struct { + ID string `json:"id"` + JSON accountLoadBalancerMonitorDeleteResponseResultJSON `json:"-"` +} + +// accountLoadBalancerMonitorDeleteResponseResultJSON contains the JSON metadata +// for the struct [AccountLoadBalancerMonitorDeleteResponseResult] +type accountLoadBalancerMonitorDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerMonitorDeleteResponseSuccess bool + +const ( + AccountLoadBalancerMonitorDeleteResponseSuccessTrue AccountLoadBalancerMonitorDeleteResponseSuccess = true +) + +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponse struct { + Errors []AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseError `json:"errors"` + Messages []AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseMessage `json:"messages"` + Result []AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResult `json:"result"` + ResultInfo AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseSuccess `json:"success"` + JSON accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseJSON `json:"-"` +} + +// accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponse] +type accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseError] +type accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseMessage] +type accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResult struct { + ID string `json:"id"` + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure bool `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown int64 `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp int64 `json:"consecutive_up"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Object description. + Description string `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody string `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes string `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects bool `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header interface{} `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval int64 `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method string `json:"method"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path string `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port int64 `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone string `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries int64 `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout int64 `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType `json:"type"` + JSON accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultJSON `json:"-"` +} + +// accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResult] +type accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultJSON struct { + ID apijson.Field + AllowInsecure apijson.Field + ConsecutiveDown apijson.Field + ConsecutiveUp apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ExpectedBody apijson.Field + ExpectedCodes apijson.Field + FollowRedirects apijson.Field + Header apijson.Field + Interval apijson.Field + Method apijson.Field + ModifiedOn apijson.Field + Path apijson.Field + Port apijson.Field + ProbeZone apijson.Field + Retries apijson.Field + Timeout apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType string + +const ( + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultTypeHTTP AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType = "http" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultTypeHTTPs AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType = "https" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultTypeTcp AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType = "tcp" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultTypeUdpIcmp AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType = "udp_icmp" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultTypeIcmpPing AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType = "icmp_ping" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultTypeSmtp AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultType = "smtp" +) + +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultInfoJSON `json:"-"` +} + +// accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultInfo] +type accountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseSuccess bool + +const ( + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseSuccessTrue AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponseSuccess = true +) + +type AccountLoadBalancerMonitorUpdateParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[AccountLoadBalancerMonitorUpdateParamsType] `json:"type"` +} + +func (r AccountLoadBalancerMonitorUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type AccountLoadBalancerMonitorUpdateParamsType string + +const ( + AccountLoadBalancerMonitorUpdateParamsTypeHTTP AccountLoadBalancerMonitorUpdateParamsType = "http" + AccountLoadBalancerMonitorUpdateParamsTypeHTTPs AccountLoadBalancerMonitorUpdateParamsType = "https" + AccountLoadBalancerMonitorUpdateParamsTypeTcp AccountLoadBalancerMonitorUpdateParamsType = "tcp" + AccountLoadBalancerMonitorUpdateParamsTypeUdpIcmp AccountLoadBalancerMonitorUpdateParamsType = "udp_icmp" + AccountLoadBalancerMonitorUpdateParamsTypeIcmpPing AccountLoadBalancerMonitorUpdateParamsType = "icmp_ping" + AccountLoadBalancerMonitorUpdateParamsTypeSmtp AccountLoadBalancerMonitorUpdateParamsType = "smtp" +) + +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType] `json:"type"` +} + +func (r AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType string + +const ( + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsTypeHTTP AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType = "http" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsTypeHTTPs AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType = "https" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsTypeTcp AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType = "tcp" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsTypeUdpIcmp AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType = "udp_icmp" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsTypeIcmpPing AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType = "icmp_ping" + AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsTypeSmtp AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsType = "smtp" +) + +type AccountLoadBalancerMonitorPatchParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[AccountLoadBalancerMonitorPatchParamsType] `json:"type"` +} + +func (r AccountLoadBalancerMonitorPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type AccountLoadBalancerMonitorPatchParamsType string + +const ( + AccountLoadBalancerMonitorPatchParamsTypeHTTP AccountLoadBalancerMonitorPatchParamsType = "http" + AccountLoadBalancerMonitorPatchParamsTypeHTTPs AccountLoadBalancerMonitorPatchParamsType = "https" + AccountLoadBalancerMonitorPatchParamsTypeTcp AccountLoadBalancerMonitorPatchParamsType = "tcp" + AccountLoadBalancerMonitorPatchParamsTypeUdpIcmp AccountLoadBalancerMonitorPatchParamsType = "udp_icmp" + AccountLoadBalancerMonitorPatchParamsTypeIcmpPing AccountLoadBalancerMonitorPatchParamsType = "icmp_ping" + AccountLoadBalancerMonitorPatchParamsTypeSmtp AccountLoadBalancerMonitorPatchParamsType = "smtp" +) diff --git a/accountloadbalancermonitor_test.go b/accountloadbalancermonitor_test.go new file mode 100644 index 00000000000..ad134abee32 --- /dev/null +++ b/accountloadbalancermonitor_test.go @@ -0,0 +1,264 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerMonitorGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f1aba936b94213e5b8dca0c0dbf1f9cc", + ) + 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 TestAccountLoadBalancerMonitorUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f1aba936b94213e5b8dca0c0dbf1f9cc", + cloudflare.AccountLoadBalancerMonitorUpdateParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.AccountLoadBalancerMonitorUpdateParamsTypeHTTPs), + }, + ) + 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 TestAccountLoadBalancerMonitorDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f1aba936b94213e5b8dca0c0dbf1f9cc", + ) + 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 TestAccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.AccountLoadBalancerMonitorsNewMonitor( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParamsTypeHTTPs), + }, + ) + 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 TestAccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitors(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.AccountLoadBalancerMonitorsListMonitors(context.TODO(), "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()) + } +} + +func TestAccountLoadBalancerMonitorPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.Patch( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f1aba936b94213e5b8dca0c0dbf1f9cc", + cloudflare.AccountLoadBalancerMonitorPatchParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.AccountLoadBalancerMonitorPatchParamsTypeHTTPs), + }, + ) + 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/accountloadbalancermonitorpreview.go b/accountloadbalancermonitorpreview.go new file mode 100644 index 00000000000..a302242d728 --- /dev/null +++ b/accountloadbalancermonitorpreview.go @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerMonitorPreviewService 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 +// [NewAccountLoadBalancerMonitorPreviewService] method instead. +type AccountLoadBalancerMonitorPreviewService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerMonitorPreviewService 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 NewAccountLoadBalancerMonitorPreviewService(opts ...option.RequestOption) (r *AccountLoadBalancerMonitorPreviewService) { + r = &AccountLoadBalancerMonitorPreviewService{} + r.Options = opts + return +} + +// Preview pools using the specified monitor with provided monitor details. The +// returned preview_id can be used in the preview endpoint to retrieve the results. +func (r *AccountLoadBalancerMonitorPreviewService) AccountLoadBalancerMonitorsPreviewMonitor(ctx context.Context, accountIdentifier string, identifier string, body AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParams, opts ...option.RequestOption) (res *AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s/preview", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponse struct { + Errors []AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseError `json:"errors"` + Messages []AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseMessage `json:"messages"` + Result AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseResult `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseSuccess `json:"success"` + JSON accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseJSON `json:"-"` +} + +// accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponse] +type accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseError] +type accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseMessage] +type accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseResult struct { + // Monitored pool IDs mapped to their respective names. + Pools interface{} `json:"pools"` + PreviewID string `json:"preview_id"` + JSON accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseResultJSON `json:"-"` +} + +// accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseResult] +type accountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseResultJSON struct { + Pools apijson.Field + PreviewID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseSuccess bool + +const ( + AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseSuccessTrue AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponseSuccess = true +) + +type AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType] `json:"type"` +} + +func (r AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType string + +const ( + AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsTypeHTTP AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType = "http" + AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsTypeHTTPs AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType = "https" + AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsTypeTcp AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType = "tcp" + AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsTypeUdpIcmp AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType = "udp_icmp" + AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsTypeIcmpPing AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType = "icmp_ping" + AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsTypeSmtp AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsType = "smtp" +) diff --git a/accountloadbalancermonitorpreview_test.go b/accountloadbalancermonitorpreview_test.go new file mode 100644 index 00000000000..3b693a73aa5 --- /dev/null +++ b/accountloadbalancermonitorpreview_test.go @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.Previews.AccountLoadBalancerMonitorsPreviewMonitor( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f1aba936b94213e5b8dca0c0dbf1f9cc", + cloudflare.AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParamsTypeHTTPs), + }, + ) + 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/accountloadbalancermonitorreference.go b/accountloadbalancermonitorreference.go new file mode 100644 index 00000000000..00b5a3e5824 --- /dev/null +++ b/accountloadbalancermonitorreference.go @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerMonitorReferenceService 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 +// [NewAccountLoadBalancerMonitorReferenceService] method instead. +type AccountLoadBalancerMonitorReferenceService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerMonitorReferenceService 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 NewAccountLoadBalancerMonitorReferenceService(opts ...option.RequestOption) (r *AccountLoadBalancerMonitorReferenceService) { + r = &AccountLoadBalancerMonitorReferenceService{} + r.Options = opts + return +} + +// Get the list of resources that reference the provided monitor. +func (r *AccountLoadBalancerMonitorReferenceService) AccountLoadBalancerMonitorsListMonitorReferences(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s/references", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponse struct { + Errors []AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseError `json:"errors"` + Messages []AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseMessage `json:"messages"` + // List of resources that reference a given monitor. + Result []AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResult `json:"result"` + ResultInfo AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseSuccess `json:"success"` + JSON accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseJSON `json:"-"` +} + +// accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponse] +type accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseError] +type accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseMessage] +type accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResult struct { + ReferenceType AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType `json:"reference_type"` + ResourceID string `json:"resource_id"` + ResourceName string `json:"resource_name"` + ResourceType string `json:"resource_type"` + JSON accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultJSON `json:"-"` +} + +// accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResult] +type accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultJSON struct { + ReferenceType apijson.Field + ResourceID apijson.Field + ResourceName apijson.Field + ResourceType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType string + +const ( + AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceTypeStar AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType = "*" + AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceTypeReferral AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType = "referral" + AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceTypeReferrer AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType = "referrer" +) + +type AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultInfoJSON `json:"-"` +} + +// accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultInfo] +type accountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseSuccess bool + +const ( + AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseSuccessTrue AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponseSuccess = true +) diff --git a/accountloadbalancermonitorreference_test.go b/accountloadbalancermonitorreference_test.go new file mode 100644 index 00000000000..dbcd3f2afe6 --- /dev/null +++ b/accountloadbalancermonitorreference_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferences(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Monitors.References.AccountLoadBalancerMonitorsListMonitorReferences( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f1aba936b94213e5b8dca0c0dbf1f9cc", + ) + 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/accountloadbalancerpool.go b/accountloadbalancerpool.go new file mode 100644 index 00000000000..2356ccab69d --- /dev/null +++ b/accountloadbalancerpool.go @@ -0,0 +1,2289 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerPoolService 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 +// [NewAccountLoadBalancerPoolService] method instead. +type AccountLoadBalancerPoolService struct { + Options []option.RequestOption + Health *AccountLoadBalancerPoolHealthService + Previews *AccountLoadBalancerPoolPreviewService + References *AccountLoadBalancerPoolReferenceService +} + +// NewAccountLoadBalancerPoolService 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 NewAccountLoadBalancerPoolService(opts ...option.RequestOption) (r *AccountLoadBalancerPoolService) { + r = &AccountLoadBalancerPoolService{} + r.Options = opts + r.Health = NewAccountLoadBalancerPoolHealthService(opts...) + r.Previews = NewAccountLoadBalancerPoolPreviewService(opts...) + r.References = NewAccountLoadBalancerPoolReferenceService(opts...) + return +} + +// Fetch a single configured pool. +func (r *AccountLoadBalancerPoolService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify a configured pool. +func (r *AccountLoadBalancerPoolService) Update(ctx context.Context, accountIdentifier string, identifier string, body AccountLoadBalancerPoolUpdateParams, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete a configured pool. +func (r *AccountLoadBalancerPoolService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountLoadBalancerPoolDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new pool. +func (r *AccountLoadBalancerPoolService) AccountLoadBalancerPoolsNewPool(ctx context.Context, accountIdentifier string, body AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParams, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List configured pools. +func (r *AccountLoadBalancerPoolService) AccountLoadBalancerPoolsListPools(ctx context.Context, accountIdentifier string, query AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsParams, opts ...option.RequestOption) (res *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Apply changes to a number of existing pools, overwriting the supplied +// properties. Pools are ordered by ascending `name`. Returns the list of affected +// pools. Supports the standard pagination query parameters, either +// `limit`/`offset` or `per_page`/`page`. +func (r *AccountLoadBalancerPoolService) AccountLoadBalancerPoolsPatchPools(ctx context.Context, accountIdentifier string, body AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParams, opts ...option.RequestOption) (res *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Apply changes to an existing pool, overwriting the supplied properties. +func (r *AccountLoadBalancerPoolService) Patch(ctx context.Context, accountIdentifier string, identifier string, body AccountLoadBalancerPoolPatchParams, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type Pool struct { + Errors []PoolError `json:"errors"` + Messages []PoolMessage `json:"messages"` + Result PoolResult `json:"result"` + // Whether the API call was successful + Success PoolSuccess `json:"success"` + JSON poolJSON `json:"-"` +} + +// poolJSON contains the JSON metadata for the struct [Pool] +type poolJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Pool) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type PoolError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON poolErrorJSON `json:"-"` +} + +// poolErrorJSON contains the JSON metadata for the struct [PoolError] +type poolErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type PoolMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON poolMessageJSON `json:"-"` +} + +// poolMessageJSON contains the JSON metadata for the struct [PoolMessage] +type poolMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type PoolResult struct { + ID string `json:"id"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions []PoolResultCheckRegion `json:"check_regions,nullable"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // A human-readable description of the pool. + Description string `json:"description"` + // This field shows up only if the pool is disabled. This field is set with the + // time the pool was disabled at. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled bool `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude float64 `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding PoolResultLoadShedding `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude float64 `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins int64 `json:"minimum_origins"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor interface{} `json:"monitor"` + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name string `json:"name"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail string `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter PoolResultNotificationFilter `json:"notification_filter,nullable"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering PoolResultOriginSteering `json:"origin_steering"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins []PoolResultOrigin `json:"origins"` + JSON poolResultJSON `json:"-"` +} + +// poolResultJSON contains the JSON metadata for the struct [PoolResult] +type poolResultJSON struct { + ID apijson.Field + CheckRegions apijson.Field + CreatedOn apijson.Field + Description apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Latitude apijson.Field + LoadShedding apijson.Field + Longitude apijson.Field + MinimumOrigins apijson.Field + ModifiedOn apijson.Field + Monitor apijson.Field + Name apijson.Field + NotificationEmail apijson.Field + NotificationFilter apijson.Field + OriginSteering apijson.Field + Origins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type PoolResultCheckRegion string + +const ( + PoolResultCheckRegionWnam PoolResultCheckRegion = "WNAM" + PoolResultCheckRegionEnam PoolResultCheckRegion = "ENAM" + PoolResultCheckRegionWeu PoolResultCheckRegion = "WEU" + PoolResultCheckRegionEeu PoolResultCheckRegion = "EEU" + PoolResultCheckRegionNsam PoolResultCheckRegion = "NSAM" + PoolResultCheckRegionSsam PoolResultCheckRegion = "SSAM" + PoolResultCheckRegionOc PoolResultCheckRegion = "OC" + PoolResultCheckRegionMe PoolResultCheckRegion = "ME" + PoolResultCheckRegionNaf PoolResultCheckRegion = "NAF" + PoolResultCheckRegionSaf PoolResultCheckRegion = "SAF" + PoolResultCheckRegionSas PoolResultCheckRegion = "SAS" + PoolResultCheckRegionSeas PoolResultCheckRegion = "SEAS" + PoolResultCheckRegionNeas PoolResultCheckRegion = "NEAS" + PoolResultCheckRegionAllRegions PoolResultCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type PoolResultLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent float64 `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy PoolResultLoadSheddingDefaultPolicy `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent float64 `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy PoolResultLoadSheddingSessionPolicy `json:"session_policy"` + JSON poolResultLoadSheddingJSON `json:"-"` +} + +// poolResultLoadSheddingJSON contains the JSON metadata for the struct +// [PoolResultLoadShedding] +type poolResultLoadSheddingJSON struct { + DefaultPercent apijson.Field + DefaultPolicy apijson.Field + SessionPercent apijson.Field + SessionPolicy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResultLoadShedding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type PoolResultLoadSheddingDefaultPolicy string + +const ( + PoolResultLoadSheddingDefaultPolicyRandom PoolResultLoadSheddingDefaultPolicy = "random" + PoolResultLoadSheddingDefaultPolicyHash PoolResultLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type PoolResultLoadSheddingSessionPolicy string + +const ( + PoolResultLoadSheddingSessionPolicyHash PoolResultLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type PoolResultNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin PoolResultNotificationFilterOrigin `json:"origin,nullable"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool PoolResultNotificationFilterPool `json:"pool,nullable"` + JSON poolResultNotificationFilterJSON `json:"-"` +} + +// poolResultNotificationFilterJSON contains the JSON metadata for the struct +// [PoolResultNotificationFilter] +type poolResultNotificationFilterJSON struct { + Origin apijson.Field + Pool apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResultNotificationFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type PoolResultNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON poolResultNotificationFilterOriginJSON `json:"-"` +} + +// poolResultNotificationFilterOriginJSON contains the JSON metadata for the struct +// [PoolResultNotificationFilterOrigin] +type poolResultNotificationFilterOriginJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResultNotificationFilterOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type PoolResultNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON poolResultNotificationFilterPoolJSON `json:"-"` +} + +// poolResultNotificationFilterPoolJSON contains the JSON metadata for the struct +// [PoolResultNotificationFilterPool] +type poolResultNotificationFilterPoolJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResultNotificationFilterPool) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type PoolResultOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy PoolResultOriginSteeringPolicy `json:"policy"` + JSON poolResultOriginSteeringJSON `json:"-"` +} + +// poolResultOriginSteeringJSON contains the JSON metadata for the struct +// [PoolResultOriginSteering] +type poolResultOriginSteeringJSON struct { + Policy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResultOriginSteering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type PoolResultOriginSteeringPolicy string + +const ( + PoolResultOriginSteeringPolicyRandom PoolResultOriginSteeringPolicy = "random" + PoolResultOriginSteeringPolicyHash PoolResultOriginSteeringPolicy = "hash" + PoolResultOriginSteeringPolicyLeastOutstandingRequests PoolResultOriginSteeringPolicy = "least_outstanding_requests" + PoolResultOriginSteeringPolicyLeastConnections PoolResultOriginSteeringPolicy = "least_connections" +) + +type PoolResultOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address string `json:"address"` + // This field shows up only if the origin is disabled. This field is set with the + // time the origin was disabled. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled bool `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header PoolResultOriginsHeader `json:"header"` + // A human-identifiable name for the origin. + Name string `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID string `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight float64 `json:"weight"` + JSON poolResultOriginJSON `json:"-"` +} + +// poolResultOriginJSON contains the JSON metadata for the struct +// [PoolResultOrigin] +type poolResultOriginJSON struct { + Address apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Header apijson.Field + Name apijson.Field + VirtualNetworkID apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type PoolResultOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host []string `json:"Host"` + JSON poolResultOriginsHeaderJSON `json:"-"` +} + +// poolResultOriginsHeaderJSON contains the JSON metadata for the struct +// [PoolResultOriginsHeader] +type poolResultOriginsHeaderJSON struct { + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PoolResultOriginsHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type PoolSuccess bool + +const ( + PoolSuccessTrue PoolSuccess = true +) + +type AccountLoadBalancerPoolDeleteResponse struct { + Errors []AccountLoadBalancerPoolDeleteResponseError `json:"errors"` + Messages []AccountLoadBalancerPoolDeleteResponseMessage `json:"messages"` + Result AccountLoadBalancerPoolDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerPoolDeleteResponseSuccess `json:"success"` + JSON accountLoadBalancerPoolDeleteResponseJSON `json:"-"` +} + +// accountLoadBalancerPoolDeleteResponseJSON contains the JSON metadata for the +// struct [AccountLoadBalancerPoolDeleteResponse] +type accountLoadBalancerPoolDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolDeleteResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerPoolDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountLoadBalancerPoolDeleteResponseError] +type accountLoadBalancerPoolDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolDeleteResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerPoolDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountLoadBalancerPoolDeleteResponseMessage] +type accountLoadBalancerPoolDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolDeleteResponseResult struct { + ID string `json:"id"` + JSON accountLoadBalancerPoolDeleteResponseResultJSON `json:"-"` +} + +// accountLoadBalancerPoolDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountLoadBalancerPoolDeleteResponseResult] +type accountLoadBalancerPoolDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerPoolDeleteResponseSuccess bool + +const ( + AccountLoadBalancerPoolDeleteResponseSuccessTrue AccountLoadBalancerPoolDeleteResponseSuccess = true +) + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponse struct { + Errors []AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseError `json:"errors"` + Messages []AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseMessage `json:"messages"` + Result []AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResult `json:"result"` + ResultInfo AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseSuccess `json:"success"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseJSON contains +// the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponse] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseError] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseMessage] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResult struct { + ID string `json:"id"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions []AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion `json:"check_regions,nullable"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // A human-readable description of the pool. + Description string `json:"description"` + // This field shows up only if the pool is disabled. This field is set with the + // time the pool was disabled at. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled bool `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude float64 `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadShedding `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude float64 `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins int64 `json:"minimum_origins"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor interface{} `json:"monitor"` + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name string `json:"name"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail string `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilter `json:"notification_filter,nullable"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteering `json:"origin_steering"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins []AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOrigin `json:"origins"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResult] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultJSON struct { + ID apijson.Field + CheckRegions apijson.Field + CreatedOn apijson.Field + Description apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Latitude apijson.Field + LoadShedding apijson.Field + Longitude apijson.Field + MinimumOrigins apijson.Field + ModifiedOn apijson.Field + Monitor apijson.Field + Name apijson.Field + NotificationEmail apijson.Field + NotificationFilter apijson.Field + OriginSteering apijson.Field + Origins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionWnam AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "WNAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionEnam AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "ENAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionWeu AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "WEU" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionEeu AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "EEU" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionNsam AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "NSAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionSsam AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SSAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionOc AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "OC" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionMe AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "ME" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionNaf AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "NAF" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionSaf AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SAF" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionSas AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SAS" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionSeas AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SEAS" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionNeas AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "NEAS" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegionAllRegions AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent float64 `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent float64 `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicy `json:"session_policy"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadShedding] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingJSON struct { + DefaultPercent apijson.Field + DefaultPolicy apijson.Field + SessionPercent apijson.Field + SessionPolicy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadShedding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicyRandom AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy = "random" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin `json:"origin,nullable"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool `json:"pool,nullable"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilter] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterJSON struct { + Origin apijson.Field + Pool apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterOriginJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterOriginJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterOriginJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterPoolJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterPoolJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterPoolJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy `json:"policy"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteering] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringJSON struct { + Policy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyRandom AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "random" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "hash" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyLeastOutstandingRequests AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "least_outstanding_requests" + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyLeastConnections AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "least_connections" +) + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address string `json:"address"` + // This field shows up only if the origin is disabled. This field is set with the + // time the origin was disabled. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled bool `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginsHeader `json:"header"` + // A human-identifiable name for the origin. + Name string `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID string `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight float64 `json:"weight"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOrigin] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginJSON struct { + Address apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Header apijson.Field + Name apijson.Field + VirtualNetworkID apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host []string `json:"Host"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginsHeaderJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginsHeaderJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginsHeader] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginsHeaderJSON struct { + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultOriginsHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultInfoJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultInfo] +type accountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseSuccess bool + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseSuccessTrue AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponseSuccess = true +) + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponse struct { + Errors []AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseError `json:"errors"` + Messages []AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseMessage `json:"messages"` + Result []AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResult `json:"result"` + ResultInfo AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseSuccess `json:"success"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseJSON contains +// the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponse] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseError] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseMessage] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResult struct { + ID string `json:"id"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions []AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion `json:"check_regions,nullable"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // A human-readable description of the pool. + Description string `json:"description"` + // This field shows up only if the pool is disabled. This field is set with the + // time the pool was disabled at. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled bool `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude float64 `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadShedding `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude float64 `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins int64 `json:"minimum_origins"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor interface{} `json:"monitor"` + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name string `json:"name"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail string `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter `json:"notification_filter,nullable"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteering `json:"origin_steering"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins []AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOrigin `json:"origins"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResult] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultJSON struct { + ID apijson.Field + CheckRegions apijson.Field + CreatedOn apijson.Field + Description apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Latitude apijson.Field + LoadShedding apijson.Field + Longitude apijson.Field + MinimumOrigins apijson.Field + ModifiedOn apijson.Field + Monitor apijson.Field + Name apijson.Field + NotificationEmail apijson.Field + NotificationFilter apijson.Field + OriginSteering apijson.Field + Origins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionWnam AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "WNAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionEnam AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "ENAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionWeu AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "WEU" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionEeu AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "EEU" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionNsam AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "NSAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSsam AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SSAM" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionOc AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "OC" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionMe AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "ME" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionNaf AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "NAF" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSaf AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SAF" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSas AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SAS" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSeas AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SEAS" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionNeas AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "NEAS" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegionAllRegions AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent float64 `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent float64 `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicy `json:"session_policy"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadShedding] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingJSON struct { + DefaultPercent apijson.Field + DefaultPolicy apijson.Field + SessionPercent apijson.Field + SessionPolicy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadShedding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicyRandom AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy = "random" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin `json:"origin,nullable"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool `json:"pool,nullable"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterJSON struct { + Origin apijson.Field + Pool apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOriginJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOriginJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOriginJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPoolJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPoolJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPoolJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy `json:"policy"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteering] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringJSON struct { + Policy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyRandom AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "random" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "hash" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyLeastOutstandingRequests AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "least_outstanding_requests" + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyLeastConnections AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "least_connections" +) + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address string `json:"address"` + // This field shows up only if the origin is disabled. This field is set with the + // time the origin was disabled. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled bool `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader `json:"header"` + // A human-identifiable name for the origin. + Name string `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID string `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight float64 `json:"weight"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOrigin] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginJSON struct { + Address apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Header apijson.Field + Name apijson.Field + VirtualNetworkID apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host []string `json:"Host"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginsHeaderJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginsHeaderJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginsHeaderJSON struct { + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultInfoJSON `json:"-"` +} + +// accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultInfo] +type accountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseSuccess bool + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseSuccessTrue AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponseSuccess = true +) + +type AccountLoadBalancerPoolUpdateParams struct { + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins param.Field[[]AccountLoadBalancerPoolUpdateParamsOrigin] `json:"origins,required"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions param.Field[[]AccountLoadBalancerPoolUpdateParamsCheckRegion] `json:"check_regions"` + // A human-readable description of the pool. + Description param.Field[string] `json:"description"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled param.Field[bool] `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude param.Field[float64] `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding param.Field[AccountLoadBalancerPoolUpdateParamsLoadShedding] `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude param.Field[float64] `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins param.Field[int64] `json:"minimum_origins"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `json:"monitor"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail param.Field[string] `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter param.Field[AccountLoadBalancerPoolUpdateParamsNotificationFilter] `json:"notification_filter"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering param.Field[AccountLoadBalancerPoolUpdateParamsOriginSteering] `json:"origin_steering"` +} + +func (r AccountLoadBalancerPoolUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountLoadBalancerPoolUpdateParamsOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address param.Field[string] `json:"address"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled param.Field[bool] `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header param.Field[AccountLoadBalancerPoolUpdateParamsOriginsHeader] `json:"header"` + // A human-identifiable name for the origin. + Name param.Field[string] `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID param.Field[string] `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight param.Field[float64] `json:"weight"` +} + +func (r AccountLoadBalancerPoolUpdateParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type AccountLoadBalancerPoolUpdateParamsOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host param.Field[[]string] `json:"Host"` +} + +func (r AccountLoadBalancerPoolUpdateParamsOriginsHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type AccountLoadBalancerPoolUpdateParamsCheckRegion string + +const ( + AccountLoadBalancerPoolUpdateParamsCheckRegionWnam AccountLoadBalancerPoolUpdateParamsCheckRegion = "WNAM" + AccountLoadBalancerPoolUpdateParamsCheckRegionEnam AccountLoadBalancerPoolUpdateParamsCheckRegion = "ENAM" + AccountLoadBalancerPoolUpdateParamsCheckRegionWeu AccountLoadBalancerPoolUpdateParamsCheckRegion = "WEU" + AccountLoadBalancerPoolUpdateParamsCheckRegionEeu AccountLoadBalancerPoolUpdateParamsCheckRegion = "EEU" + AccountLoadBalancerPoolUpdateParamsCheckRegionNsam AccountLoadBalancerPoolUpdateParamsCheckRegion = "NSAM" + AccountLoadBalancerPoolUpdateParamsCheckRegionSsam AccountLoadBalancerPoolUpdateParamsCheckRegion = "SSAM" + AccountLoadBalancerPoolUpdateParamsCheckRegionOc AccountLoadBalancerPoolUpdateParamsCheckRegion = "OC" + AccountLoadBalancerPoolUpdateParamsCheckRegionMe AccountLoadBalancerPoolUpdateParamsCheckRegion = "ME" + AccountLoadBalancerPoolUpdateParamsCheckRegionNaf AccountLoadBalancerPoolUpdateParamsCheckRegion = "NAF" + AccountLoadBalancerPoolUpdateParamsCheckRegionSaf AccountLoadBalancerPoolUpdateParamsCheckRegion = "SAF" + AccountLoadBalancerPoolUpdateParamsCheckRegionSas AccountLoadBalancerPoolUpdateParamsCheckRegion = "SAS" + AccountLoadBalancerPoolUpdateParamsCheckRegionSeas AccountLoadBalancerPoolUpdateParamsCheckRegion = "SEAS" + AccountLoadBalancerPoolUpdateParamsCheckRegionNeas AccountLoadBalancerPoolUpdateParamsCheckRegion = "NEAS" + AccountLoadBalancerPoolUpdateParamsCheckRegionAllRegions AccountLoadBalancerPoolUpdateParamsCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type AccountLoadBalancerPoolUpdateParamsLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent param.Field[float64] `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy param.Field[AccountLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy] `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent param.Field[float64] `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy param.Field[AccountLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicy] `json:"session_policy"` +} + +func (r AccountLoadBalancerPoolUpdateParamsLoadShedding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type AccountLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy string + +const ( + AccountLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicyRandom AccountLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy = "random" + AccountLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicyHash AccountLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type AccountLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicy string + +const ( + AccountLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicyHash AccountLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type AccountLoadBalancerPoolUpdateParamsNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin param.Field[AccountLoadBalancerPoolUpdateParamsNotificationFilterOrigin] `json:"origin"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool param.Field[AccountLoadBalancerPoolUpdateParamsNotificationFilterPool] `json:"pool"` +} + +func (r AccountLoadBalancerPoolUpdateParamsNotificationFilter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolUpdateParamsNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r AccountLoadBalancerPoolUpdateParamsNotificationFilterOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolUpdateParamsNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r AccountLoadBalancerPoolUpdateParamsNotificationFilterPool) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type AccountLoadBalancerPoolUpdateParamsOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy param.Field[AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicy] `json:"policy"` +} + +func (r AccountLoadBalancerPoolUpdateParamsOriginSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicy string + +const ( + AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicyRandom AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "random" + AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicyHash AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "hash" + AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicyLeastOutstandingRequests AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "least_outstanding_requests" + AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicyLeastConnections AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "least_connections" +) + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParams struct { + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins param.Field[[]AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOrigin] `json:"origins,required"` + // A human-readable description of the pool. + Description param.Field[string] `json:"description"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled param.Field[bool] `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude param.Field[float64] `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadShedding] `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude param.Field[float64] `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins param.Field[int64] `json:"minimum_origins"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `json:"monitor"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail param.Field[string] `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilter] `json:"notification_filter"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteering] `json:"origin_steering"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address param.Field[string] `json:"address"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled param.Field[bool] `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginsHeader] `json:"header"` + // A human-identifiable name for the origin. + Name param.Field[string] `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID param.Field[string] `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight param.Field[float64] `json:"weight"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host param.Field[[]string] `json:"Host"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginsHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures load shedding policies and percentages for the pool. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent param.Field[float64] `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy] `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent param.Field[float64] `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicy] `json:"session_policy"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadShedding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicyRandom AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy = "random" + AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin] `json:"origin"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterPool] `json:"pool"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterPool) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy] `json:"policy"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyRandom AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "random" + AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyHash AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "hash" + AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyLeastOutstandingRequests AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "least_outstanding_requests" + AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyLeastConnections AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "least_connections" +) + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsParams struct { + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `query:"monitor"` +} + +// URLQuery serializes +// [AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsParams]'s query +// parameters as `url.Values`. +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParams struct { + // The email address to send health status notifications to. This field is now + // deprecated in favor of Cloudflare Notifications for Load Balancing, so only + // resetting this field with an empty string `""` is accepted. + NotificationEmail param.Field[AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParamsNotificationEmail] `json:"notification_email"` +} + +func (r AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The email address to send health status notifications to. This field is now +// deprecated in favor of Cloudflare Notifications for Load Balancing, so only +// resetting this field with an empty string `""` is accepted. +type AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParamsNotificationEmail string + +const ( + AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParamsNotificationEmailEmpty AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParamsNotificationEmail = "\"\"" +) + +type AccountLoadBalancerPoolPatchParams struct { + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions param.Field[[]AccountLoadBalancerPoolPatchParamsCheckRegion] `json:"check_regions"` + // A human-readable description of the pool. + Description param.Field[string] `json:"description"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled param.Field[bool] `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude param.Field[float64] `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding param.Field[AccountLoadBalancerPoolPatchParamsLoadShedding] `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude param.Field[float64] `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins param.Field[int64] `json:"minimum_origins"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `json:"monitor"` + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name param.Field[string] `json:"name"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail param.Field[string] `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter param.Field[AccountLoadBalancerPoolPatchParamsNotificationFilter] `json:"notification_filter"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering param.Field[AccountLoadBalancerPoolPatchParamsOriginSteering] `json:"origin_steering"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins param.Field[[]AccountLoadBalancerPoolPatchParamsOrigin] `json:"origins"` +} + +func (r AccountLoadBalancerPoolPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type AccountLoadBalancerPoolPatchParamsCheckRegion string + +const ( + AccountLoadBalancerPoolPatchParamsCheckRegionWnam AccountLoadBalancerPoolPatchParamsCheckRegion = "WNAM" + AccountLoadBalancerPoolPatchParamsCheckRegionEnam AccountLoadBalancerPoolPatchParamsCheckRegion = "ENAM" + AccountLoadBalancerPoolPatchParamsCheckRegionWeu AccountLoadBalancerPoolPatchParamsCheckRegion = "WEU" + AccountLoadBalancerPoolPatchParamsCheckRegionEeu AccountLoadBalancerPoolPatchParamsCheckRegion = "EEU" + AccountLoadBalancerPoolPatchParamsCheckRegionNsam AccountLoadBalancerPoolPatchParamsCheckRegion = "NSAM" + AccountLoadBalancerPoolPatchParamsCheckRegionSsam AccountLoadBalancerPoolPatchParamsCheckRegion = "SSAM" + AccountLoadBalancerPoolPatchParamsCheckRegionOc AccountLoadBalancerPoolPatchParamsCheckRegion = "OC" + AccountLoadBalancerPoolPatchParamsCheckRegionMe AccountLoadBalancerPoolPatchParamsCheckRegion = "ME" + AccountLoadBalancerPoolPatchParamsCheckRegionNaf AccountLoadBalancerPoolPatchParamsCheckRegion = "NAF" + AccountLoadBalancerPoolPatchParamsCheckRegionSaf AccountLoadBalancerPoolPatchParamsCheckRegion = "SAF" + AccountLoadBalancerPoolPatchParamsCheckRegionSas AccountLoadBalancerPoolPatchParamsCheckRegion = "SAS" + AccountLoadBalancerPoolPatchParamsCheckRegionSeas AccountLoadBalancerPoolPatchParamsCheckRegion = "SEAS" + AccountLoadBalancerPoolPatchParamsCheckRegionNeas AccountLoadBalancerPoolPatchParamsCheckRegion = "NEAS" + AccountLoadBalancerPoolPatchParamsCheckRegionAllRegions AccountLoadBalancerPoolPatchParamsCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type AccountLoadBalancerPoolPatchParamsLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent param.Field[float64] `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy param.Field[AccountLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy] `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent param.Field[float64] `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy param.Field[AccountLoadBalancerPoolPatchParamsLoadSheddingSessionPolicy] `json:"session_policy"` +} + +func (r AccountLoadBalancerPoolPatchParamsLoadShedding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type AccountLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy string + +const ( + AccountLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicyRandom AccountLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy = "random" + AccountLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicyHash AccountLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type AccountLoadBalancerPoolPatchParamsLoadSheddingSessionPolicy string + +const ( + AccountLoadBalancerPoolPatchParamsLoadSheddingSessionPolicyHash AccountLoadBalancerPoolPatchParamsLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type AccountLoadBalancerPoolPatchParamsNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin param.Field[AccountLoadBalancerPoolPatchParamsNotificationFilterOrigin] `json:"origin"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool param.Field[AccountLoadBalancerPoolPatchParamsNotificationFilterPool] `json:"pool"` +} + +func (r AccountLoadBalancerPoolPatchParamsNotificationFilter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolPatchParamsNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r AccountLoadBalancerPoolPatchParamsNotificationFilterOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type AccountLoadBalancerPoolPatchParamsNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r AccountLoadBalancerPoolPatchParamsNotificationFilterPool) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type AccountLoadBalancerPoolPatchParamsOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy param.Field[AccountLoadBalancerPoolPatchParamsOriginSteeringPolicy] `json:"policy"` +} + +func (r AccountLoadBalancerPoolPatchParamsOriginSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type AccountLoadBalancerPoolPatchParamsOriginSteeringPolicy string + +const ( + AccountLoadBalancerPoolPatchParamsOriginSteeringPolicyRandom AccountLoadBalancerPoolPatchParamsOriginSteeringPolicy = "random" + AccountLoadBalancerPoolPatchParamsOriginSteeringPolicyHash AccountLoadBalancerPoolPatchParamsOriginSteeringPolicy = "hash" + AccountLoadBalancerPoolPatchParamsOriginSteeringPolicyLeastOutstandingRequests AccountLoadBalancerPoolPatchParamsOriginSteeringPolicy = "least_outstanding_requests" + AccountLoadBalancerPoolPatchParamsOriginSteeringPolicyLeastConnections AccountLoadBalancerPoolPatchParamsOriginSteeringPolicy = "least_connections" +) + +type AccountLoadBalancerPoolPatchParamsOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address param.Field[string] `json:"address"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled param.Field[bool] `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header param.Field[AccountLoadBalancerPoolPatchParamsOriginsHeader] `json:"header"` + // A human-identifiable name for the origin. + Name param.Field[string] `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID param.Field[string] `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight param.Field[float64] `json:"weight"` +} + +func (r AccountLoadBalancerPoolPatchParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type AccountLoadBalancerPoolPatchParamsOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host param.Field[[]string] `json:"Host"` +} + +func (r AccountLoadBalancerPoolPatchParamsOriginsHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountloadbalancerpool_test.go b/accountloadbalancerpool_test.go new file mode 100644 index 00000000000..f8b21e4956b --- /dev/null +++ b/accountloadbalancerpool_test.go @@ -0,0 +1,400 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerPoolGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "17b5962d775c646f3f9725cbc7a53df4", + ) + 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 TestAccountLoadBalancerPoolUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "17b5962d775c646f3f9725cbc7a53df4", + cloudflare.AccountLoadBalancerPoolUpdateParams{ + Name: cloudflare.F("primary-dc-1"), + Origins: cloudflare.F([]cloudflare.AccountLoadBalancerPoolUpdateParamsOrigin{{ + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }}), + CheckRegions: cloudflare.F([]cloudflare.AccountLoadBalancerPoolUpdateParamsCheckRegion{cloudflare.AccountLoadBalancerPoolUpdateParamsCheckRegionWeu, cloudflare.AccountLoadBalancerPoolUpdateParamsCheckRegionEnam}), + Description: cloudflare.F("Primary data center - Provider XYZ"), + Enabled: cloudflare.F(false), + Latitude: cloudflare.F(0.000000), + LoadShedding: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsLoadShedding{ + DefaultPercent: cloudflare.F(0.000000), + DefaultPolicy: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicyRandom), + SessionPercent: cloudflare.F(0.000000), + SessionPolicy: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicyHash), + }), + Longitude: cloudflare.F(0.000000), + MinimumOrigins: cloudflare.F(int64(0)), + Monitor: cloudflare.F[any](map[string]interface{}{}), + NotificationEmail: cloudflare.F("someone@example.com,sometwo@example.com"), + NotificationFilter: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsNotificationFilter{ + Origin: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsNotificationFilterOrigin{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(true), + }), + Pool: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsNotificationFilterPool{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(false), + }), + }), + OriginSteering: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsOriginSteering{ + Policy: cloudflare.F(cloudflare.AccountLoadBalancerPoolUpdateParamsOriginSteeringPolicyRandom), + }), + }, + ) + 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 TestAccountLoadBalancerPoolDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "17b5962d775c646f3f9725cbc7a53df4", + ) + 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 TestAccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.AccountLoadBalancerPoolsNewPool( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParams{ + Name: cloudflare.F("primary-dc-1"), + Origins: cloudflare.F([]cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOrigin{{ + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }}), + Description: cloudflare.F("Primary data center - Provider XYZ"), + Enabled: cloudflare.F(false), + Latitude: cloudflare.F(0.000000), + LoadShedding: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadShedding{ + DefaultPercent: cloudflare.F(0.000000), + DefaultPolicy: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicyRandom), + SessionPercent: cloudflare.F(0.000000), + SessionPolicy: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicyHash), + }), + Longitude: cloudflare.F(0.000000), + MinimumOrigins: cloudflare.F(int64(0)), + Monitor: cloudflare.F[any](map[string]interface{}{}), + NotificationEmail: cloudflare.F("someone@example.com,sometwo@example.com"), + NotificationFilter: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilter{ + Origin: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(true), + }), + Pool: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsNotificationFilterPool{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(false), + }), + }), + OriginSteering: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteering{ + Policy: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyRandom), + }), + }, + ) + 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 TestAccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.AccountLoadBalancerPoolsListPools( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsParams{ + Monitor: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.AccountLoadBalancerPoolsPatchPools( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParams{ + NotificationEmail: cloudflare.F(cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParamsNotificationEmailEmpty), + }, + ) + 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 TestAccountLoadBalancerPoolPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.Patch( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "17b5962d775c646f3f9725cbc7a53df4", + cloudflare.AccountLoadBalancerPoolPatchParams{ + CheckRegions: cloudflare.F([]cloudflare.AccountLoadBalancerPoolPatchParamsCheckRegion{cloudflare.AccountLoadBalancerPoolPatchParamsCheckRegionWeu, cloudflare.AccountLoadBalancerPoolPatchParamsCheckRegionEnam}), + Description: cloudflare.F("Primary data center - Provider XYZ"), + Enabled: cloudflare.F(false), + Latitude: cloudflare.F(0.000000), + LoadShedding: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsLoadShedding{ + DefaultPercent: cloudflare.F(0.000000), + DefaultPolicy: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicyRandom), + SessionPercent: cloudflare.F(0.000000), + SessionPolicy: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsLoadSheddingSessionPolicyHash), + }), + Longitude: cloudflare.F(0.000000), + MinimumOrigins: cloudflare.F(int64(0)), + Monitor: cloudflare.F[any](map[string]interface{}{}), + Name: cloudflare.F("primary-dc-1"), + NotificationEmail: cloudflare.F("someone@example.com,sometwo@example.com"), + NotificationFilter: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsNotificationFilter{ + Origin: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsNotificationFilterOrigin{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(true), + }), + Pool: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsNotificationFilterPool{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(false), + }), + }), + OriginSteering: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsOriginSteering{ + Policy: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsOriginSteeringPolicyRandom), + }), + Origins: cloudflare.F([]cloudflare.AccountLoadBalancerPoolPatchParamsOrigin{{ + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.AccountLoadBalancerPoolPatchParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }}), + }, + ) + 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/accountloadbalancerpoolhealth.go b/accountloadbalancerpoolhealth.go new file mode 100644 index 00000000000..5a5e84a3136 --- /dev/null +++ b/accountloadbalancerpoolhealth.go @@ -0,0 +1,113 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerPoolHealthService 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 +// [NewAccountLoadBalancerPoolHealthService] method instead. +type AccountLoadBalancerPoolHealthService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerPoolHealthService 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 NewAccountLoadBalancerPoolHealthService(opts ...option.RequestOption) (r *AccountLoadBalancerPoolHealthService) { + r = &AccountLoadBalancerPoolHealthService{} + r.Options = opts + return +} + +// Fetch the latest pool health status for a single pool. +func (r *AccountLoadBalancerPoolHealthService) AccountLoadBalancerPoolsPoolHealthDetails(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s/health", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponse struct { + Errors []AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseError `json:"errors"` + Messages []AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseMessage `json:"messages"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseSuccess `json:"success"` + JSON accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseJSON `json:"-"` +} + +// accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponse] +type accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseError] +type accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseMessage] +type accountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseSuccess bool + +const ( + AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseSuccessTrue AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponseSuccess = true +) diff --git a/accountloadbalancerpoolhealth_test.go b/accountloadbalancerpoolhealth_test.go new file mode 100644 index 00000000000..38128daed25 --- /dev/null +++ b/accountloadbalancerpoolhealth_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.Health.AccountLoadBalancerPoolsPoolHealthDetails( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "17b5962d775c646f3f9725cbc7a53df4", + ) + 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/accountloadbalancerpoolpreview.go b/accountloadbalancerpoolpreview.go new file mode 100644 index 00000000000..c9770a66b83 --- /dev/null +++ b/accountloadbalancerpoolpreview.go @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerPoolPreviewService 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 +// [NewAccountLoadBalancerPoolPreviewService] method instead. +type AccountLoadBalancerPoolPreviewService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerPoolPreviewService 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 NewAccountLoadBalancerPoolPreviewService(opts ...option.RequestOption) (r *AccountLoadBalancerPoolPreviewService) { + r = &AccountLoadBalancerPoolPreviewService{} + r.Options = opts + return +} + +// Preview pool health using provided monitor details. The returned preview_id can +// be used in the preview endpoint to retrieve the results. +func (r *AccountLoadBalancerPoolPreviewService) AccountLoadBalancerPoolsPreviewPool(ctx context.Context, accountIdentifier string, identifier string, body AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParams, opts ...option.RequestOption) (res *AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s/preview", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponse struct { + Errors []AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseError `json:"errors"` + Messages []AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseMessage `json:"messages"` + Result AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseResult `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseSuccess `json:"success"` + JSON accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseJSON `json:"-"` +} + +// accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponse] +type accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseError] +type accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseMessage] +type accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseResult struct { + // Monitored pool IDs mapped to their respective names. + Pools interface{} `json:"pools"` + PreviewID string `json:"preview_id"` + JSON accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseResultJSON `json:"-"` +} + +// accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseResult] +type accountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseResultJSON struct { + Pools apijson.Field + PreviewID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseSuccess bool + +const ( + AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseSuccessTrue AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponseSuccess = true +) + +type AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType] `json:"type"` +} + +func (r AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType string + +const ( + AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsTypeHTTP AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType = "http" + AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsTypeHTTPs AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType = "https" + AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsTypeTcp AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType = "tcp" + AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsTypeUdpIcmp AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType = "udp_icmp" + AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsTypeIcmpPing AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType = "icmp_ping" + AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsTypeSmtp AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsType = "smtp" +) diff --git a/accountloadbalancerpoolpreview_test.go b/accountloadbalancerpoolpreview_test.go new file mode 100644 index 00000000000..46d1ac2a8aa --- /dev/null +++ b/accountloadbalancerpoolpreview_test.go @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.Previews.AccountLoadBalancerPoolsPreviewPool( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "17b5962d775c646f3f9725cbc7a53df4", + cloudflare.AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParamsTypeHTTPs), + }, + ) + 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/accountloadbalancerpoolreference.go b/accountloadbalancerpoolreference.go new file mode 100644 index 00000000000..9e4e2a31e62 --- /dev/null +++ b/accountloadbalancerpoolreference.go @@ -0,0 +1,174 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerPoolReferenceService 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 +// [NewAccountLoadBalancerPoolReferenceService] method instead. +type AccountLoadBalancerPoolReferenceService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerPoolReferenceService 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 NewAccountLoadBalancerPoolReferenceService(opts ...option.RequestOption) (r *AccountLoadBalancerPoolReferenceService) { + r = &AccountLoadBalancerPoolReferenceService{} + r.Options = opts + return +} + +// Get the list of resources that reference the provided pool. +func (r *AccountLoadBalancerPoolReferenceService) AccountLoadBalancerPoolsListPoolReferences(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s/references", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponse struct { + Errors []AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseError `json:"errors"` + Messages []AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseMessage `json:"messages"` + // List of resources that reference a given pool. + Result []AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResult `json:"result"` + ResultInfo AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseSuccess `json:"success"` + JSON accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseJSON `json:"-"` +} + +// accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponse] +type accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseError] +type accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseMessage] +type accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResult struct { + ReferenceType AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceType `json:"reference_type"` + ResourceID string `json:"resource_id"` + ResourceName string `json:"resource_name"` + ResourceType string `json:"resource_type"` + JSON accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultJSON `json:"-"` +} + +// accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResult] +type accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultJSON struct { + ReferenceType apijson.Field + ResourceID apijson.Field + ResourceName apijson.Field + ResourceType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceType string + +const ( + AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceTypeStar AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceType = "*" + AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceTypeReferral AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceType = "referral" + AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceTypeReferrer AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultReferenceType = "referrer" +) + +type AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultInfoJSON `json:"-"` +} + +// accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultInfo] +type accountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseSuccess bool + +const ( + AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseSuccessTrue AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponseSuccess = true +) diff --git a/accountloadbalancerpoolreference_test.go b/accountloadbalancerpoolreference_test.go new file mode 100644 index 00000000000..046f3b2c99d --- /dev/null +++ b/accountloadbalancerpoolreference_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferences(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Pools.References.AccountLoadBalancerPoolsListPoolReferences( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "17b5962d775c646f3f9725cbc7a53df4", + ) + 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/accountloadbalancerpreview.go b/accountloadbalancerpreview.go new file mode 100644 index 00000000000..929194625ab --- /dev/null +++ b/accountloadbalancerpreview.go @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerPreviewService 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 +// [NewAccountLoadBalancerPreviewService] method instead. +type AccountLoadBalancerPreviewService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerPreviewService 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 NewAccountLoadBalancerPreviewService(opts ...option.RequestOption) (r *AccountLoadBalancerPreviewService) { + r = &AccountLoadBalancerPreviewService{} + r.Options = opts + return +} + +// Get the result of a previous preview operation using the provided preview_id. +func (r *AccountLoadBalancerPreviewService) Get(ctx context.Context, accountIdentifier string, previewID interface{}, opts ...option.RequestOption) (res *AccountLoadBalancerPreviewGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/preview/%v", accountIdentifier, previewID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountLoadBalancerPreviewGetResponse struct { + Errors []AccountLoadBalancerPreviewGetResponseError `json:"errors"` + Messages []AccountLoadBalancerPreviewGetResponseMessage `json:"messages"` + // Resulting health data from a preview operation. + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerPreviewGetResponseSuccess `json:"success"` + JSON accountLoadBalancerPreviewGetResponseJSON `json:"-"` +} + +// accountLoadBalancerPreviewGetResponseJSON contains the JSON metadata for the +// struct [AccountLoadBalancerPreviewGetResponse] +type accountLoadBalancerPreviewGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPreviewGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPreviewGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPreviewGetResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerPreviewGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountLoadBalancerPreviewGetResponseError] +type accountLoadBalancerPreviewGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPreviewGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerPreviewGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerPreviewGetResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerPreviewGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountLoadBalancerPreviewGetResponseMessage] +type accountLoadBalancerPreviewGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerPreviewGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerPreviewGetResponseSuccess bool + +const ( + AccountLoadBalancerPreviewGetResponseSuccessTrue AccountLoadBalancerPreviewGetResponseSuccess = true +) diff --git a/accountloadbalancerpreview_test.go b/accountloadbalancerpreview_test.go new file mode 100644 index 00000000000..e8e4b375c7b --- /dev/null +++ b/accountloadbalancerpreview_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerPreviewGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Previews.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "p1aba936b94213e5b8dca0c0dbf1f9cc", + ) + 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/accountloadbalancerregion.go b/accountloadbalancerregion.go new file mode 100644 index 00000000000..f5a8a24545d --- /dev/null +++ b/accountloadbalancerregion.go @@ -0,0 +1,234 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerRegionService 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 +// [NewAccountLoadBalancerRegionService] method instead. +type AccountLoadBalancerRegionService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerRegionService 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 NewAccountLoadBalancerRegionService(opts ...option.RequestOption) (r *AccountLoadBalancerRegionService) { + r = &AccountLoadBalancerRegionService{} + r.Options = opts + return +} + +// Get a single region mapping. +func (r *AccountLoadBalancerRegionService) Get(ctx context.Context, accountIdentifier string, regionCode AccountLoadBalancerRegionGetParamsRegionCode, opts ...option.RequestOption) (res *AccountLoadBalancerRegionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/regions/%v", accountIdentifier, regionCode) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// List all region mappings. +func (r *AccountLoadBalancerRegionService) LoadBalancerRegionsListRegions(ctx context.Context, accountIdentifier string, query AccountLoadBalancerRegionLoadBalancerRegionsListRegionsParams, opts ...option.RequestOption) (res *AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/regions", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountLoadBalancerRegionGetResponse struct { + Errors []AccountLoadBalancerRegionGetResponseError `json:"errors"` + Messages []AccountLoadBalancerRegionGetResponseMessage `json:"messages"` + // A list of countries and subdivisions mapped to a region. + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerRegionGetResponseSuccess `json:"success"` + JSON accountLoadBalancerRegionGetResponseJSON `json:"-"` +} + +// accountLoadBalancerRegionGetResponseJSON contains the JSON metadata for the +// struct [AccountLoadBalancerRegionGetResponse] +type accountLoadBalancerRegionGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerRegionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerRegionGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerRegionGetResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerRegionGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountLoadBalancerRegionGetResponseError] +type accountLoadBalancerRegionGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerRegionGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerRegionGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerRegionGetResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerRegionGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountLoadBalancerRegionGetResponseMessage] +type accountLoadBalancerRegionGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerRegionGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerRegionGetResponseSuccess bool + +const ( + AccountLoadBalancerRegionGetResponseSuccessTrue AccountLoadBalancerRegionGetResponseSuccess = true +) + +type AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponse struct { + Errors []AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseError `json:"errors"` + Messages []AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseSuccess `json:"success"` + JSON accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseJSON `json:"-"` +} + +// accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseJSON contains the +// JSON metadata for the struct +// [AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponse] +type accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseError] +type accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseMessage] +type accountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseSuccess bool + +const ( + AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseSuccessTrue AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponseSuccess = true +) + +// A list of Cloudflare regions. WNAM: Western North America, ENAM: Eastern North +// America, WEU: Western Europe, EEU: Eastern Europe, NSAM: Northern South America, +// SSAM: Southern South America, OC: Oceania, ME: Middle East, NAF: North Africa, +// SAF: South Africa, SAS: Southern Asia, SEAS: South East Asia, NEAS: North East +// Asia). +type AccountLoadBalancerRegionGetParamsRegionCode string + +const ( + AccountLoadBalancerRegionGetParamsRegionCodeWnam AccountLoadBalancerRegionGetParamsRegionCode = "WNAM" + AccountLoadBalancerRegionGetParamsRegionCodeEnam AccountLoadBalancerRegionGetParamsRegionCode = "ENAM" + AccountLoadBalancerRegionGetParamsRegionCodeWeu AccountLoadBalancerRegionGetParamsRegionCode = "WEU" + AccountLoadBalancerRegionGetParamsRegionCodeEeu AccountLoadBalancerRegionGetParamsRegionCode = "EEU" + AccountLoadBalancerRegionGetParamsRegionCodeNsam AccountLoadBalancerRegionGetParamsRegionCode = "NSAM" + AccountLoadBalancerRegionGetParamsRegionCodeSsam AccountLoadBalancerRegionGetParamsRegionCode = "SSAM" + AccountLoadBalancerRegionGetParamsRegionCodeOc AccountLoadBalancerRegionGetParamsRegionCode = "OC" + AccountLoadBalancerRegionGetParamsRegionCodeMe AccountLoadBalancerRegionGetParamsRegionCode = "ME" + AccountLoadBalancerRegionGetParamsRegionCodeNaf AccountLoadBalancerRegionGetParamsRegionCode = "NAF" + AccountLoadBalancerRegionGetParamsRegionCodeSaf AccountLoadBalancerRegionGetParamsRegionCode = "SAF" + AccountLoadBalancerRegionGetParamsRegionCodeSas AccountLoadBalancerRegionGetParamsRegionCode = "SAS" + AccountLoadBalancerRegionGetParamsRegionCodeSeas AccountLoadBalancerRegionGetParamsRegionCode = "SEAS" + AccountLoadBalancerRegionGetParamsRegionCodeNeas AccountLoadBalancerRegionGetParamsRegionCode = "NEAS" +) + +type AccountLoadBalancerRegionLoadBalancerRegionsListRegionsParams struct { + // Two-letter alpha-2 country code followed in ISO 3166-1. + CountryCodeA2 param.Field[string] `query:"country_code_a2"` + // Two-letter subdivision code followed in ISO 3166-2. + SubdivisionCode param.Field[string] `query:"subdivision_code"` + // Two-letter subdivision code followed in ISO 3166-2. + SubdivisionCodeA2 param.Field[string] `query:"subdivision_code_a2"` +} + +// URLQuery serializes +// [AccountLoadBalancerRegionLoadBalancerRegionsListRegionsParams]'s query +// parameters as `url.Values`. +func (r AccountLoadBalancerRegionLoadBalancerRegionsListRegionsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountloadbalancerregion_test.go b/accountloadbalancerregion_test.go new file mode 100644 index 00000000000..d94464dbad4 --- /dev/null +++ b/accountloadbalancerregion_test.go @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerRegionGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Regions.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLoadBalancerRegionGetParamsRegionCodeWnam, + ) + 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 TestAccountLoadBalancerRegionLoadBalancerRegionsListRegionsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Regions.LoadBalancerRegionsListRegions( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLoadBalancerRegionLoadBalancerRegionsListRegionsParams{ + CountryCodeA2: cloudflare.F("US"), + SubdivisionCode: cloudflare.F("CA"), + SubdivisionCodeA2: cloudflare.F("CA"), + }, + ) + 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/accountloadbalancersearch.go b/accountloadbalancersearch.go new file mode 100644 index 00000000000..408ab4ec18c --- /dev/null +++ b/accountloadbalancersearch.go @@ -0,0 +1,246 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLoadBalancerSearchService 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 +// [NewAccountLoadBalancerSearchService] method instead. +type AccountLoadBalancerSearchService struct { + Options []option.RequestOption +} + +// NewAccountLoadBalancerSearchService 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 NewAccountLoadBalancerSearchService(opts ...option.RequestOption) (r *AccountLoadBalancerSearchService) { + r = &AccountLoadBalancerSearchService{} + r.Options = opts + return +} + +// Search for Load Balancing resources. +func (r *AccountLoadBalancerSearchService) List(ctx context.Context, accountIdentifier string, query AccountLoadBalancerSearchListParams, opts ...option.RequestOption) (res *AccountLoadBalancerSearchListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/load_balancers/search", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountLoadBalancerSearchListResponse struct { + Errors []AccountLoadBalancerSearchListResponseError `json:"errors"` + Messages []AccountLoadBalancerSearchListResponseMessage `json:"messages"` + Result AccountLoadBalancerSearchListResponseResult `json:"result"` + ResultInfo AccountLoadBalancerSearchListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountLoadBalancerSearchListResponseSuccess `json:"success"` + JSON accountLoadBalancerSearchListResponseJSON `json:"-"` +} + +// accountLoadBalancerSearchListResponseJSON contains the JSON metadata for the +// struct [AccountLoadBalancerSearchListResponse] +type accountLoadBalancerSearchListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerSearchListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerSearchListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerSearchListResponseErrorJSON `json:"-"` +} + +// accountLoadBalancerSearchListResponseErrorJSON contains the JSON metadata for +// the struct [AccountLoadBalancerSearchListResponseError] +type accountLoadBalancerSearchListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerSearchListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerSearchListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLoadBalancerSearchListResponseMessageJSON `json:"-"` +} + +// accountLoadBalancerSearchListResponseMessageJSON contains the JSON metadata for +// the struct [AccountLoadBalancerSearchListResponseMessage] +type accountLoadBalancerSearchListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerSearchListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLoadBalancerSearchListResponseResult struct { + // A list of resources matching the search query. + Resources []AccountLoadBalancerSearchListResponseResultResource `json:"resources"` + JSON accountLoadBalancerSearchListResponseResultJSON `json:"-"` +} + +// accountLoadBalancerSearchListResponseResultJSON contains the JSON metadata for +// the struct [AccountLoadBalancerSearchListResponseResult] +type accountLoadBalancerSearchListResponseResultJSON struct { + Resources apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerSearchListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a load balancer resource. +type AccountLoadBalancerSearchListResponseResultResource struct { + // When listed as a reference, the type (direction) of the reference. + ReferenceType AccountLoadBalancerSearchListResponseResultResourcesReferenceType `json:"reference_type"` + // A list of references to (referrer) or from (referral) this resource. + References []interface{} `json:"references"` + ResourceID interface{} `json:"resource_id"` + // The human-identifiable name of the resource. + ResourceName string `json:"resource_name"` + // The type of the resource. + ResourceType AccountLoadBalancerSearchListResponseResultResourcesResourceType `json:"resource_type"` + JSON accountLoadBalancerSearchListResponseResultResourceJSON `json:"-"` +} + +// accountLoadBalancerSearchListResponseResultResourceJSON contains the JSON +// metadata for the struct [AccountLoadBalancerSearchListResponseResultResource] +type accountLoadBalancerSearchListResponseResultResourceJSON struct { + ReferenceType apijson.Field + References apijson.Field + ResourceID apijson.Field + ResourceName apijson.Field + ResourceType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerSearchListResponseResultResource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// When listed as a reference, the type (direction) of the reference. +type AccountLoadBalancerSearchListResponseResultResourcesReferenceType string + +const ( + AccountLoadBalancerSearchListResponseResultResourcesReferenceTypeReferral AccountLoadBalancerSearchListResponseResultResourcesReferenceType = "referral" + AccountLoadBalancerSearchListResponseResultResourcesReferenceTypeReferrer AccountLoadBalancerSearchListResponseResultResourcesReferenceType = "referrer" +) + +// The type of the resource. +type AccountLoadBalancerSearchListResponseResultResourcesResourceType string + +const ( + AccountLoadBalancerSearchListResponseResultResourcesResourceTypeLoadBalancer AccountLoadBalancerSearchListResponseResultResourcesResourceType = "load_balancer" + AccountLoadBalancerSearchListResponseResultResourcesResourceTypeMonitor AccountLoadBalancerSearchListResponseResultResourcesResourceType = "monitor" + AccountLoadBalancerSearchListResponseResultResourcesResourceTypePool AccountLoadBalancerSearchListResponseResultResourcesResourceType = "pool" +) + +type AccountLoadBalancerSearchListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountLoadBalancerSearchListResponseResultInfoJSON `json:"-"` +} + +// accountLoadBalancerSearchListResponseResultInfoJSON contains the JSON metadata +// for the struct [AccountLoadBalancerSearchListResponseResultInfo] +type accountLoadBalancerSearchListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLoadBalancerSearchListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLoadBalancerSearchListResponseSuccess bool + +const ( + AccountLoadBalancerSearchListResponseSuccessTrue AccountLoadBalancerSearchListResponseSuccess = true +) + +type AccountLoadBalancerSearchListParams struct { + Page param.Field[interface{}] `query:"page"` + PerPage param.Field[interface{}] `query:"per_page"` + SearchParams param.Field[AccountLoadBalancerSearchListParamsSearchParams] `query:"search_params"` +} + +// URLQuery serializes [AccountLoadBalancerSearchListParams]'s query parameters as +// `url.Values`. +func (r AccountLoadBalancerSearchListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountLoadBalancerSearchListParamsSearchParams struct { + // Search query term. + Query param.Field[string] `query:"query"` + // The type of references to include ("\*" for all). + References param.Field[AccountLoadBalancerSearchListParamsSearchParamsReferences] `query:"references"` +} + +// URLQuery serializes [AccountLoadBalancerSearchListParamsSearchParams]'s query +// parameters as `url.Values`. +func (r AccountLoadBalancerSearchListParamsSearchParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The type of references to include ("\*" for all). +type AccountLoadBalancerSearchListParamsSearchParamsReferences string + +const ( + AccountLoadBalancerSearchListParamsSearchParamsReferencesEmpty AccountLoadBalancerSearchListParamsSearchParamsReferences = "" + AccountLoadBalancerSearchListParamsSearchParamsReferencesStar AccountLoadBalancerSearchListParamsSearchParamsReferences = "*" + AccountLoadBalancerSearchListParamsSearchParamsReferencesReferral AccountLoadBalancerSearchListParamsSearchParamsReferences = "referral" + AccountLoadBalancerSearchListParamsSearchParamsReferencesReferrer AccountLoadBalancerSearchListParamsSearchParamsReferences = "referrer" +) diff --git a/accountloadbalancersearch_test.go b/accountloadbalancersearch_test.go new file mode 100644 index 00000000000..7177b655f36 --- /dev/null +++ b/accountloadbalancersearch_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLoadBalancerSearchListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.LoadBalancers.Searches.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLoadBalancerSearchListParams{ + Page: cloudflare.F[any](map[string]interface{}{}), + PerPage: cloudflare.F[any](map[string]interface{}{}), + SearchParams: cloudflare.F(cloudflare.AccountLoadBalancerSearchListParamsSearchParams{ + Query: cloudflare.F("primary"), + References: cloudflare.F(cloudflare.AccountLoadBalancerSearchListParamsSearchParamsReferencesStar), + }), + }, + ) + 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/accountlog.go b/accountlog.go new file mode 100644 index 00000000000..d22e61421ba --- /dev/null +++ b/accountlog.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogService 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 [NewAccountLogService] method instead. +type AccountLogService struct { + Options []option.RequestOption + Controls *AccountLogControlService +} + +// NewAccountLogService 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 NewAccountLogService(opts ...option.RequestOption) (r *AccountLogService) { + r = &AccountLogService{} + r.Options = opts + r.Controls = NewAccountLogControlService(opts...) + return +} diff --git a/accountlogcontrol.go b/accountlogcontrol.go new file mode 100644 index 00000000000..5b6ed297a75 --- /dev/null +++ b/accountlogcontrol.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogControlService 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 [NewAccountLogControlService] method +// instead. +type AccountLogControlService struct { + Options []option.RequestOption + Cmb *AccountLogControlCmbService +} + +// NewAccountLogControlService 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 NewAccountLogControlService(opts ...option.RequestOption) (r *AccountLogControlService) { + r = &AccountLogControlService{} + r.Options = opts + r.Cmb = NewAccountLogControlCmbService(opts...) + return +} diff --git a/accountlogcontrolcmb.go b/accountlogcontrolcmb.go new file mode 100644 index 00000000000..176f2f25d2a --- /dev/null +++ b/accountlogcontrolcmb.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogControlCmbService 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 [NewAccountLogControlCmbService] +// method instead. +type AccountLogControlCmbService struct { + Options []option.RequestOption + Configs *AccountLogControlCmbConfigService +} + +// NewAccountLogControlCmbService 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 NewAccountLogControlCmbService(opts ...option.RequestOption) (r *AccountLogControlCmbService) { + r = &AccountLogControlCmbService{} + r.Options = opts + r.Configs = NewAccountLogControlCmbConfigService(opts...) + return +} diff --git a/accountlogcontrolcmbconfig.go b/accountlogcontrolcmbconfig.go new file mode 100644 index 00000000000..bea74956777 --- /dev/null +++ b/accountlogcontrolcmbconfig.go @@ -0,0 +1,316 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogControlCmbConfigService 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 +// [NewAccountLogControlCmbConfigService] method instead. +type AccountLogControlCmbConfigService struct { + Options []option.RequestOption +} + +// NewAccountLogControlCmbConfigService 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 NewAccountLogControlCmbConfigService(opts ...option.RequestOption) (r *AccountLogControlCmbConfigService) { + r = &AccountLogControlCmbConfigService{} + r.Options = opts + return +} + +// Deletes CMB config. +func (r *AccountLogControlCmbConfigService) Delete(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountLogControlCmbConfigDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logs/control/cmb/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Gets CMB config. +func (r *AccountLogControlCmbConfigService) GetAccountsAccountIdentifierLogsControlCmbConfig(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logs/control/cmb/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates CMB config. +func (r *AccountLogControlCmbConfigService) PutAccountsAccountIdentifierLogsControlCmbConfig(ctx context.Context, accountIdentifier string, body AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigParams, opts ...option.RequestOption) (res *AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logs/control/cmb/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLogControlCmbConfigDeleteResponse struct { + Errors []AccountLogControlCmbConfigDeleteResponseError `json:"errors"` + Messages []AccountLogControlCmbConfigDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogControlCmbConfigDeleteResponseSuccess `json:"success"` + JSON accountLogControlCmbConfigDeleteResponseJSON `json:"-"` +} + +// accountLogControlCmbConfigDeleteResponseJSON contains the JSON metadata for the +// struct [AccountLogControlCmbConfigDeleteResponse] +type accountLogControlCmbConfigDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogControlCmbConfigDeleteResponseErrorJSON `json:"-"` +} + +// accountLogControlCmbConfigDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountLogControlCmbConfigDeleteResponseError] +type accountLogControlCmbConfigDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogControlCmbConfigDeleteResponseMessageJSON `json:"-"` +} + +// accountLogControlCmbConfigDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountLogControlCmbConfigDeleteResponseMessage] +type accountLogControlCmbConfigDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogControlCmbConfigDeleteResponseSuccess bool + +const ( + AccountLogControlCmbConfigDeleteResponseSuccessTrue AccountLogControlCmbConfigDeleteResponseSuccess = true +) + +type AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponse struct { + Errors []AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseError `json:"errors"` + Messages []AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseMessage `json:"messages"` + Result AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseSuccess `json:"success"` + JSON accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseJSON `json:"-"` +} + +// accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponse] +type accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseErrorJSON `json:"-"` +} + +// accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseError] +type accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseMessageJSON `json:"-"` +} + +// accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseMessage] +type accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseResult struct { + // Comma-separated list of regions. + Regions string `json:"regions"` + JSON accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseResultJSON `json:"-"` +} + +// accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseResult] +type accountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseResultJSON struct { + Regions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseSuccess bool + +const ( + AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseSuccessTrue AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponseSuccess = true +) + +type AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponse struct { + Errors []AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseError `json:"errors"` + Messages []AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseMessage `json:"messages"` + Result AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseSuccess `json:"success"` + JSON accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseJSON `json:"-"` +} + +// accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponse] +type accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseErrorJSON `json:"-"` +} + +// accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseError] +type accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseMessageJSON `json:"-"` +} + +// accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseMessage] +type accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseResult struct { + // Comma-separated list of regions. + Regions string `json:"regions"` + JSON accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseResultJSON `json:"-"` +} + +// accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseResult] +type accountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseResultJSON struct { + Regions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseSuccess bool + +const ( + AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseSuccessTrue AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponseSuccess = true +) + +type AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigParams struct { + // Comma-separated list of regions. + Regions param.Field[string] `json:"regions"` +} + +func (r AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountlogcontrolcmbconfig_test.go b/accountlogcontrolcmbconfig_test.go new file mode 100644 index 00000000000..e0f4a7151e3 --- /dev/null +++ b/accountlogcontrolcmbconfig_test.go @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogControlCmbConfigDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logs.Controls.Cmb.Configs.Delete(context.TODO(), "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()) + } +} + +func TestAccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfig(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logs.Controls.Cmb.Configs.GetAccountsAccountIdentifierLogsControlCmbConfig(context.TODO(), "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()) + } +} + +func TestAccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logs.Controls.Cmb.Configs.PutAccountsAccountIdentifierLogsControlCmbConfig( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigParams{ + Regions: cloudflare.F("eu"), + }, + ) + 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/accountlogpush.go b/accountlogpush.go new file mode 100644 index 00000000000..b0e7261546a --- /dev/null +++ b/accountlogpush.go @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushService 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 [NewAccountLogpushService] method +// instead. +type AccountLogpushService struct { + Options []option.RequestOption + Datasets *AccountLogpushDatasetService + Jobs *AccountLogpushJobService + Ownerships *AccountLogpushOwnershipService + Validates *AccountLogpushValidateService +} + +// NewAccountLogpushService 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 NewAccountLogpushService(opts ...option.RequestOption) (r *AccountLogpushService) { + r = &AccountLogpushService{} + r.Options = opts + r.Datasets = NewAccountLogpushDatasetService(opts...) + r.Jobs = NewAccountLogpushJobService(opts...) + r.Ownerships = NewAccountLogpushOwnershipService(opts...) + r.Validates = NewAccountLogpushValidateService(opts...) + return +} diff --git a/accountlogpushdataset.go b/accountlogpushdataset.go new file mode 100644 index 00000000000..4f9d501acb8 --- /dev/null +++ b/accountlogpushdataset.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushDatasetService 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 [NewAccountLogpushDatasetService] +// method instead. +type AccountLogpushDatasetService struct { + Options []option.RequestOption + Fields *AccountLogpushDatasetFieldService + Jobs *AccountLogpushDatasetJobService +} + +// NewAccountLogpushDatasetService 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 NewAccountLogpushDatasetService(opts ...option.RequestOption) (r *AccountLogpushDatasetService) { + r = &AccountLogpushDatasetService{} + r.Options = opts + r.Fields = NewAccountLogpushDatasetFieldService(opts...) + r.Jobs = NewAccountLogpushDatasetJobService(opts...) + return +} diff --git a/accountlogpushdatasetfield.go b/accountlogpushdatasetfield.go new file mode 100644 index 00000000000..33b2707fb80 --- /dev/null +++ b/accountlogpushdatasetfield.go @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushDatasetFieldService 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 +// [NewAccountLogpushDatasetFieldService] method instead. +type AccountLogpushDatasetFieldService struct { + Options []option.RequestOption +} + +// NewAccountLogpushDatasetFieldService 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 NewAccountLogpushDatasetFieldService(opts ...option.RequestOption) (r *AccountLogpushDatasetFieldService) { + r = &AccountLogpushDatasetFieldService{} + r.Options = opts + return +} + +// Lists all fields available for a dataset. The response result is an object with +// key-value pairs, where keys are field names, and values are descriptions. +func (r *AccountLogpushDatasetFieldService) GetAccountsAccountIdentifierLogpushDatasetsDatasetFields(ctx context.Context, accountIdentifier string, dataset string, opts ...option.RequestOption) (res *AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/datasets/%s/fields", accountIdentifier, dataset) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponse struct { + Errors []AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseError `json:"errors"` + Messages []AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseSuccess `json:"success"` + JSON accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseJSON `json:"-"` +} + +// accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseJSON +// contains the JSON metadata for the struct +// [AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponse] +type accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseErrorJSON `json:"-"` +} + +// accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseError] +type accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseMessageJSON `json:"-"` +} + +// accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseMessage] +type accountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseSuccess bool + +const ( + AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseSuccessTrue AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponseSuccess = true +) diff --git a/accountlogpushdatasetfield_test.go b/accountlogpushdatasetfield_test.go new file mode 100644 index 00000000000..12399319391 --- /dev/null +++ b/accountlogpushdatasetfield_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFields(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Datasets.Fields.GetAccountsAccountIdentifierLogpushDatasetsDatasetFields( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "http_requests", + ) + 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/accountlogpushdatasetjob.go b/accountlogpushdatasetjob.go new file mode 100644 index 00000000000..d1e09767660 --- /dev/null +++ b/accountlogpushdatasetjob.go @@ -0,0 +1,185 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushDatasetJobService 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 +// [NewAccountLogpushDatasetJobService] method instead. +type AccountLogpushDatasetJobService struct { + Options []option.RequestOption +} + +// NewAccountLogpushDatasetJobService 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 NewAccountLogpushDatasetJobService(opts ...option.RequestOption) (r *AccountLogpushDatasetJobService) { + r = &AccountLogpushDatasetJobService{} + r.Options = opts + return +} + +// Lists Logpush jobs for an account for a dataset. +func (r *AccountLogpushDatasetJobService) GetAccountsAccountIdentifierLogpushDatasetsDatasetJobs(ctx context.Context, accountIdentifier string, dataset string, opts ...option.RequestOption) (res *AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/datasets/%s/jobs", accountIdentifier, dataset) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponse struct { + Errors []AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseError `json:"errors"` + Messages []AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseMessage `json:"messages"` + Result []AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseSuccess `json:"success"` + JSON accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseJSON `json:"-"` +} + +// accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseJSON +// contains the JSON metadata for the struct +// [AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponse] +type accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseErrorJSON `json:"-"` +} + +// accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseError] +type accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseMessageJSON `json:"-"` +} + +// accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseMessage] +type accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultJSON `json:"-"` +} + +// accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResult] +type accountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency string + +const ( + AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultFrequencyHigh AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency = "high" + AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultFrequencyLow AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency = "low" +) + +// Whether the API call was successful +type AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseSuccess bool + +const ( + AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseSuccessTrue AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponseSuccess = true +) diff --git a/accountlogpushdatasetjob_test.go b/accountlogpushdatasetjob_test.go new file mode 100644 index 00000000000..f61176ddfb0 --- /dev/null +++ b/accountlogpushdatasetjob_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Datasets.Jobs.GetAccountsAccountIdentifierLogpushDatasetsDatasetJobs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "http_requests", + ) + 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/accountlogpushjob.go b/accountlogpushjob.go new file mode 100644 index 00000000000..add1cd2c85e --- /dev/null +++ b/accountlogpushjob.go @@ -0,0 +1,788 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushJobService 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 [NewAccountLogpushJobService] method +// instead. +type AccountLogpushJobService struct { + Options []option.RequestOption +} + +// NewAccountLogpushJobService 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 NewAccountLogpushJobService(opts ...option.RequestOption) (r *AccountLogpushJobService) { + r = &AccountLogpushJobService{} + r.Options = opts + return +} + +// Gets the details of a Logpush job. +func (r *AccountLogpushJobService) Get(ctx context.Context, accountIdentifier string, jobIdentifier int64, opts ...option.RequestOption) (res *AccountLogpushJobGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/jobs/%v", accountIdentifier, jobIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a Logpush job. +func (r *AccountLogpushJobService) Update(ctx context.Context, accountIdentifier string, jobIdentifier int64, body AccountLogpushJobUpdateParams, opts ...option.RequestOption) (res *AccountLogpushJobUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/jobs/%v", accountIdentifier, jobIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a Logpush job. +func (r *AccountLogpushJobService) Delete(ctx context.Context, accountIdentifier string, jobIdentifier int64, opts ...option.RequestOption) (res *AccountLogpushJobDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/jobs/%v", accountIdentifier, jobIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists Logpush jobs for an account. +func (r *AccountLogpushJobService) GetAccountsAccountIdentifierLogpushJobs(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/jobs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Creates a new Logpush job for an account. +func (r *AccountLogpushJobService) PostAccountsAccountIdentifierLogpushJobs(ctx context.Context, accountIdentifier string, body AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParams, opts ...option.RequestOption) (res *AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/jobs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLogpushJobGetResponse struct { + Errors []AccountLogpushJobGetResponseError `json:"errors"` + Messages []AccountLogpushJobGetResponseMessage `json:"messages"` + Result AccountLogpushJobGetResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushJobGetResponseSuccess `json:"success"` + JSON accountLogpushJobGetResponseJSON `json:"-"` +} + +// accountLogpushJobGetResponseJSON contains the JSON metadata for the struct +// [AccountLogpushJobGetResponse] +type accountLogpushJobGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobGetResponseErrorJSON `json:"-"` +} + +// accountLogpushJobGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountLogpushJobGetResponseError] +type accountLogpushJobGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobGetResponseMessageJSON `json:"-"` +} + +// accountLogpushJobGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountLogpushJobGetResponseMessage] +type accountLogpushJobGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobGetResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency AccountLogpushJobGetResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON accountLogpushJobGetResponseResultJSON `json:"-"` +} + +// accountLogpushJobGetResponseResultJSON contains the JSON metadata for the struct +// [AccountLogpushJobGetResponseResult] +type accountLogpushJobGetResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type AccountLogpushJobGetResponseResultFrequency string + +const ( + AccountLogpushJobGetResponseResultFrequencyHigh AccountLogpushJobGetResponseResultFrequency = "high" + AccountLogpushJobGetResponseResultFrequencyLow AccountLogpushJobGetResponseResultFrequency = "low" +) + +// Whether the API call was successful +type AccountLogpushJobGetResponseSuccess bool + +const ( + AccountLogpushJobGetResponseSuccessTrue AccountLogpushJobGetResponseSuccess = true +) + +type AccountLogpushJobUpdateResponse struct { + Errors []AccountLogpushJobUpdateResponseError `json:"errors"` + Messages []AccountLogpushJobUpdateResponseMessage `json:"messages"` + Result AccountLogpushJobUpdateResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushJobUpdateResponseSuccess `json:"success"` + JSON accountLogpushJobUpdateResponseJSON `json:"-"` +} + +// accountLogpushJobUpdateResponseJSON contains the JSON metadata for the struct +// [AccountLogpushJobUpdateResponse] +type accountLogpushJobUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobUpdateResponseErrorJSON `json:"-"` +} + +// accountLogpushJobUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountLogpushJobUpdateResponseError] +type accountLogpushJobUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobUpdateResponseMessageJSON `json:"-"` +} + +// accountLogpushJobUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountLogpushJobUpdateResponseMessage] +type accountLogpushJobUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobUpdateResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency AccountLogpushJobUpdateResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON accountLogpushJobUpdateResponseResultJSON `json:"-"` +} + +// accountLogpushJobUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountLogpushJobUpdateResponseResult] +type accountLogpushJobUpdateResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type AccountLogpushJobUpdateResponseResultFrequency string + +const ( + AccountLogpushJobUpdateResponseResultFrequencyHigh AccountLogpushJobUpdateResponseResultFrequency = "high" + AccountLogpushJobUpdateResponseResultFrequencyLow AccountLogpushJobUpdateResponseResultFrequency = "low" +) + +// Whether the API call was successful +type AccountLogpushJobUpdateResponseSuccess bool + +const ( + AccountLogpushJobUpdateResponseSuccessTrue AccountLogpushJobUpdateResponseSuccess = true +) + +type AccountLogpushJobDeleteResponse struct { + Errors []AccountLogpushJobDeleteResponseError `json:"errors"` + Messages []AccountLogpushJobDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushJobDeleteResponseSuccess `json:"success"` + JSON accountLogpushJobDeleteResponseJSON `json:"-"` +} + +// accountLogpushJobDeleteResponseJSON contains the JSON metadata for the struct +// [AccountLogpushJobDeleteResponse] +type accountLogpushJobDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobDeleteResponseErrorJSON `json:"-"` +} + +// accountLogpushJobDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountLogpushJobDeleteResponseError] +type accountLogpushJobDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobDeleteResponseMessageJSON `json:"-"` +} + +// accountLogpushJobDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountLogpushJobDeleteResponseMessage] +type accountLogpushJobDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogpushJobDeleteResponseSuccess bool + +const ( + AccountLogpushJobDeleteResponseSuccessTrue AccountLogpushJobDeleteResponseSuccess = true +) + +type AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponse struct { + Errors []AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseError `json:"errors"` + Messages []AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseMessage `json:"messages"` + Result []AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseSuccess `json:"success"` + JSON accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseJSON `json:"-"` +} + +// accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseJSON contains +// the JSON metadata for the struct +// [AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponse] +type accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseErrorJSON `json:"-"` +} + +// accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseError] +type accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseMessageJSON `json:"-"` +} + +// accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseMessage] +type accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultJSON `json:"-"` +} + +// accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResult] +type accountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultFrequency string + +const ( + AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultFrequencyHigh AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultFrequency = "high" + AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultFrequencyLow AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseResultFrequency = "low" +) + +// Whether the API call was successful +type AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseSuccess bool + +const ( + AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseSuccessTrue AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponseSuccess = true +) + +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponse struct { + Errors []AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseError `json:"errors"` + Messages []AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseMessage `json:"messages"` + Result AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseSuccess `json:"success"` + JSON accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseJSON `json:"-"` +} + +// accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseJSON contains +// the JSON metadata for the struct +// [AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponse] +type accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseErrorJSON `json:"-"` +} + +// accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseError] +type accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseMessageJSON `json:"-"` +} + +// accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseMessage] +type accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultJSON `json:"-"` +} + +// accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResult] +type accountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultFrequency string + +const ( + AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultFrequencyHigh AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultFrequency = "high" + AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultFrequencyLow AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseResultFrequency = "low" +) + +// Whether the API call was successful +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseSuccess bool + +const ( + AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseSuccessTrue AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponseSuccess = true +) + +type AccountLogpushJobUpdateParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled param.Field[bool] `json:"enabled"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency param.Field[AccountLogpushJobUpdateParamsFrequency] `json:"frequency"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions param.Field[string] `json:"logpull_options" format:"uri-reference"` + // Ownership challenge token to prove destination ownership. + OwnershipChallenge param.Field[string] `json:"ownership_challenge"` +} + +func (r AccountLogpushJobUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type AccountLogpushJobUpdateParamsFrequency string + +const ( + AccountLogpushJobUpdateParamsFrequencyHigh AccountLogpushJobUpdateParamsFrequency = "high" + AccountLogpushJobUpdateParamsFrequencyLow AccountLogpushJobUpdateParamsFrequency = "low" +) + +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` + // Name of the dataset. + Dataset param.Field[string] `json:"dataset"` + // Flag that indicates if the job is enabled. + Enabled param.Field[bool] `json:"enabled"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency param.Field[AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParamsFrequency] `json:"frequency"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions param.Field[string] `json:"logpull_options" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name param.Field[string] `json:"name"` + // Ownership challenge token to prove destination ownership. + OwnershipChallenge param.Field[string] `json:"ownership_challenge"` +} + +func (r AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParamsFrequency string + +const ( + AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParamsFrequencyHigh AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParamsFrequency = "high" + AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParamsFrequencyLow AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParamsFrequency = "low" +) diff --git a/accountlogpushjob_test.go b/accountlogpushjob_test.go new file mode 100644 index 00000000000..1d4a49808cf --- /dev/null +++ b/accountlogpushjob_test.go @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogpushJobGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Jobs.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(1), + ) + 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 TestAccountLogpushJobUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Jobs.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(1), + cloudflare.AccountLogpushJobUpdateParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + Enabled: cloudflare.F(false), + Frequency: cloudflare.F(cloudflare.AccountLogpushJobUpdateParamsFrequencyHigh), + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + OwnershipChallenge: cloudflare.F("00000000000000000000"), + }, + ) + 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 TestAccountLogpushJobDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Jobs.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(1), + ) + 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 TestAccountLogpushJobGetAccountsAccountIdentifierLogpushJobs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Jobs.GetAccountsAccountIdentifierLogpushJobs(context.TODO(), "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()) + } +} + +func TestAccountLogpushJobPostAccountsAccountIdentifierLogpushJobsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Jobs.PostAccountsAccountIdentifierLogpushJobs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + Dataset: cloudflare.F("http_requests"), + Enabled: cloudflare.F(false), + Frequency: cloudflare.F(cloudflare.AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParamsFrequencyHigh), + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + Name: cloudflare.F("example.com"), + OwnershipChallenge: cloudflare.F("00000000000000000000"), + }, + ) + 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/accountlogpushownership.go b/accountlogpushownership.go new file mode 100644 index 00000000000..7cea7381869 --- /dev/null +++ b/accountlogpushownership.go @@ -0,0 +1,147 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushOwnershipService 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 +// [NewAccountLogpushOwnershipService] method instead. +type AccountLogpushOwnershipService struct { + Options []option.RequestOption + Validates *AccountLogpushOwnershipValidateService +} + +// NewAccountLogpushOwnershipService 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 NewAccountLogpushOwnershipService(opts ...option.RequestOption) (r *AccountLogpushOwnershipService) { + r = &AccountLogpushOwnershipService{} + r.Options = opts + r.Validates = NewAccountLogpushOwnershipValidateService(opts...) + return +} + +// Gets a new ownership challenge sent to your destination. +func (r *AccountLogpushOwnershipService) PostAccountsAccountIdentifierLogpushOwnership(ctx context.Context, accountIdentifier string, body AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipParams, opts ...option.RequestOption) (res *AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/ownership", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponse struct { + Errors []AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseError `json:"errors"` + Messages []AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseMessage `json:"messages"` + Result AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseSuccess `json:"success"` + JSON accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseJSON `json:"-"` +} + +// accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponse] +type accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseErrorJSON `json:"-"` +} + +// accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseError] +type accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseMessageJSON `json:"-"` +} + +// accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseMessage] +type accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseResult struct { + Filename string `json:"filename"` + Message string `json:"message"` + Valid bool `json:"valid"` + JSON accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseResultJSON `json:"-"` +} + +// accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseResult] +type accountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseResultJSON struct { + Filename apijson.Field + Message apijson.Field + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseSuccess bool + +const ( + AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseSuccessTrue AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponseSuccess = true +) + +type AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` +} + +func (r AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountlogpushownership_test.go b/accountlogpushownership_test.go new file mode 100644 index 00000000000..4aeb3ff1e04 --- /dev/null +++ b/accountlogpushownership_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnership(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Ownerships.PostAccountsAccountIdentifierLogpushOwnership( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + }, + ) + 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/accountlogpushownershipvalidate.go b/accountlogpushownershipvalidate.go new file mode 100644 index 00000000000..3b436d36fd6 --- /dev/null +++ b/accountlogpushownershipvalidate.go @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushOwnershipValidateService 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 +// [NewAccountLogpushOwnershipValidateService] method instead. +type AccountLogpushOwnershipValidateService struct { + Options []option.RequestOption +} + +// NewAccountLogpushOwnershipValidateService 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 NewAccountLogpushOwnershipValidateService(opts ...option.RequestOption) (r *AccountLogpushOwnershipValidateService) { + r = &AccountLogpushOwnershipValidateService{} + r.Options = opts + return +} + +// Validates ownership challenge of the destination. +func (r *AccountLogpushOwnershipValidateService) PostAccountsAccountIdentifierLogpushOwnershipValidate(ctx context.Context, accountIdentifier string, body AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateParams, opts ...option.RequestOption) (res *AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/ownership/validate", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponse struct { + Errors []AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseError `json:"errors"` + Messages []AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseMessage `json:"messages"` + Result AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseSuccess `json:"success"` + JSON accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseJSON `json:"-"` +} + +// accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponse] +type accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseErrorJSON `json:"-"` +} + +// accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseError] +type accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseMessageJSON `json:"-"` +} + +// accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseMessage] +type accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseResult struct { + Valid bool `json:"valid"` + JSON accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseResultJSON `json:"-"` +} + +// accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseResult] +type accountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseResultJSON struct { + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseSuccess bool + +const ( + AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseSuccessTrue AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponseSuccess = true +) + +type AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` + // Ownership challenge token to prove destination ownership. + OwnershipChallenge param.Field[string] `json:"ownership_challenge,required"` +} + +func (r AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountlogpushownershipvalidate_test.go b/accountlogpushownershipvalidate_test.go new file mode 100644 index 00000000000..fa6490c657e --- /dev/null +++ b/accountlogpushownershipvalidate_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Ownerships.Validates.PostAccountsAccountIdentifierLogpushOwnershipValidate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + OwnershipChallenge: cloudflare.F("00000000000000000000"), + }, + ) + 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/accountlogpushvalidate.go b/accountlogpushvalidate.go new file mode 100644 index 00000000000..f8eb0f1f2af --- /dev/null +++ b/accountlogpushvalidate.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushValidateService 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 [NewAccountLogpushValidateService] +// method instead. +type AccountLogpushValidateService struct { + Options []option.RequestOption + Destinations *AccountLogpushValidateDestinationService + Origins *AccountLogpushValidateOriginService +} + +// NewAccountLogpushValidateService 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 NewAccountLogpushValidateService(opts ...option.RequestOption) (r *AccountLogpushValidateService) { + r = &AccountLogpushValidateService{} + r.Options = opts + r.Destinations = NewAccountLogpushValidateDestinationService(opts...) + r.Origins = NewAccountLogpushValidateOriginService(opts...) + return +} diff --git a/accountlogpushvalidatedestination.go b/accountlogpushvalidatedestination.go new file mode 100644 index 00000000000..fa8a4a1b2e3 --- /dev/null +++ b/accountlogpushvalidatedestination.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushValidateDestinationService 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 +// [NewAccountLogpushValidateDestinationService] method instead. +type AccountLogpushValidateDestinationService struct { + Options []option.RequestOption + Exists *AccountLogpushValidateDestinationExistService +} + +// NewAccountLogpushValidateDestinationService 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 NewAccountLogpushValidateDestinationService(opts ...option.RequestOption) (r *AccountLogpushValidateDestinationService) { + r = &AccountLogpushValidateDestinationService{} + r.Options = opts + r.Exists = NewAccountLogpushValidateDestinationExistService(opts...) + return +} diff --git a/accountlogpushvalidatedestinationexist.go b/accountlogpushvalidatedestinationexist.go new file mode 100644 index 00000000000..36d1b935bed --- /dev/null +++ b/accountlogpushvalidatedestinationexist.go @@ -0,0 +1,142 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushValidateDestinationExistService 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 [NewAccountLogpushValidateDestinationExistService] method instead. +type AccountLogpushValidateDestinationExistService struct { + Options []option.RequestOption +} + +// NewAccountLogpushValidateDestinationExistService 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 NewAccountLogpushValidateDestinationExistService(opts ...option.RequestOption) (r *AccountLogpushValidateDestinationExistService) { + r = &AccountLogpushValidateDestinationExistService{} + r.Options = opts + return +} + +// Checks if there is an existing job with a destination. +func (r *AccountLogpushValidateDestinationExistService) DeleteAccountsAccountIdentifierLogpushValidateDestinationExists(ctx context.Context, accountIdentifier string, body AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsParams, opts ...option.RequestOption) (res *AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/validate/destination/exists", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponse struct { + Errors []AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseError `json:"errors"` + Messages []AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseMessage `json:"messages"` + Result AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseSuccess `json:"success"` + JSON accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseJSON `json:"-"` +} + +// accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponse] +type accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseErrorJSON `json:"-"` +} + +// accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseError] +type accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseMessageJSON `json:"-"` +} + +// accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseMessage] +type accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseResult struct { + Exists bool `json:"exists"` + JSON accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseResultJSON `json:"-"` +} + +// accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseResult] +type accountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseResultJSON struct { + Exists apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseSuccess bool + +const ( + AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseSuccessTrue AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponseSuccess = true +) + +type AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` +} + +func (r AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountlogpushvalidatedestinationexist_test.go b/accountlogpushvalidatedestinationexist_test.go new file mode 100644 index 00000000000..8f37cedd513 --- /dev/null +++ b/accountlogpushvalidatedestinationexist_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExists(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Validates.Destinations.Exists.DeleteAccountsAccountIdentifierLogpushValidateDestinationExists( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + }, + ) + 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/accountlogpushvalidateorigin.go b/accountlogpushvalidateorigin.go new file mode 100644 index 00000000000..a52ab8bb936 --- /dev/null +++ b/accountlogpushvalidateorigin.go @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountLogpushValidateOriginService 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 +// [NewAccountLogpushValidateOriginService] method instead. +type AccountLogpushValidateOriginService struct { + Options []option.RequestOption +} + +// NewAccountLogpushValidateOriginService 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 NewAccountLogpushValidateOriginService(opts ...option.RequestOption) (r *AccountLogpushValidateOriginService) { + r = &AccountLogpushValidateOriginService{} + r.Options = opts + return +} + +// Validates logpull origin with logpull_options. +func (r *AccountLogpushValidateOriginService) PostAccountsAccountIdentifierLogpushValidateOrigin(ctx context.Context, accountIdentifier string, body AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginParams, opts ...option.RequestOption) (res *AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/logpush/validate/origin", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponse struct { + Errors []AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseError `json:"errors"` + Messages []AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseMessage `json:"messages"` + Result AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseSuccess `json:"success"` + JSON accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseJSON `json:"-"` +} + +// accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponse] +type accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseErrorJSON `json:"-"` +} + +// accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseError] +type accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseMessageJSON `json:"-"` +} + +// accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseMessage] +type accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseResult struct { + Message string `json:"message"` + Valid bool `json:"valid"` + JSON accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseResultJSON `json:"-"` +} + +// accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseResultJSON +// contains the JSON metadata for the struct +// [AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseResult] +type accountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseResultJSON struct { + Message apijson.Field + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseSuccess bool + +const ( + AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseSuccessTrue AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponseSuccess = true +) + +type AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginParams struct { + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions param.Field[string] `json:"logpull_options,required" format:"uri-reference"` +} + +func (r AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountlogpushvalidateorigin_test.go b/accountlogpushvalidateorigin_test.go new file mode 100644 index 00000000000..c4300f23277 --- /dev/null +++ b/accountlogpushvalidateorigin_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOrigin(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Logpushes.Validates.Origins.PostAccountsAccountIdentifierLogpushValidateOrigin( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginParams{ + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + }, + ) + 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/accountmagic.go b/accountmagic.go new file mode 100644 index 00000000000..0d7ece1093d --- /dev/null +++ b/accountmagic.go @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMagicService 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 [NewAccountMagicService] method +// instead. +type AccountMagicService struct { + Options []option.RequestOption + CfInterconnects *AccountMagicCfInterconnectService + GreTunnels *AccountMagicGreTunnelService + IpsecTunnels *AccountMagicIpsecTunnelService + Routes *AccountMagicRouteService +} + +// NewAccountMagicService 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 NewAccountMagicService(opts ...option.RequestOption) (r *AccountMagicService) { + r = &AccountMagicService{} + r.Options = opts + r.CfInterconnects = NewAccountMagicCfInterconnectService(opts...) + r.GreTunnels = NewAccountMagicGreTunnelService(opts...) + r.IpsecTunnels = NewAccountMagicIpsecTunnelService(opts...) + r.Routes = NewAccountMagicRouteService(opts...) + return +} diff --git a/accountmagiccfinterconnect.go b/accountmagiccfinterconnect.go new file mode 100644 index 00000000000..1c05d87dfd2 --- /dev/null +++ b/accountmagiccfinterconnect.go @@ -0,0 +1,729 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMagicCfInterconnectService 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 +// [NewAccountMagicCfInterconnectService] method instead. +type AccountMagicCfInterconnectService struct { + Options []option.RequestOption +} + +// NewAccountMagicCfInterconnectService 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 NewAccountMagicCfInterconnectService(opts ...option.RequestOption) (r *AccountMagicCfInterconnectService) { + r = &AccountMagicCfInterconnectService{} + r.Options = opts + return +} + +// Lists details for a specific interconnect. +func (r *AccountMagicCfInterconnectService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *AccountMagicCfInterconnectGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/cf_interconnects/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a specific interconnect associated with an account. Use +// `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *AccountMagicCfInterconnectService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body AccountMagicCfInterconnectUpdateParams, opts ...option.RequestOption) (res *AccountMagicCfInterconnectUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/cf_interconnects/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists interconnects associated with an account. +func (r *AccountMagicCfInterconnectService) MagicInterconnectsListInterconnects(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/cf_interconnects", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates multiple interconnects associated with an account. Use +// `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *AccountMagicCfInterconnectService) MagicInterconnectsUpdateMultipleInterconnects(ctx context.Context, accountIdentifier string, body AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsParams, opts ...option.RequestOption) (res *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/cf_interconnects", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountMagicCfInterconnectGetResponse struct { + Errors []AccountMagicCfInterconnectGetResponseError `json:"errors"` + Messages []AccountMagicCfInterconnectGetResponseMessage `json:"messages"` + Result AccountMagicCfInterconnectGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicCfInterconnectGetResponseSuccess `json:"success"` + JSON accountMagicCfInterconnectGetResponseJSON `json:"-"` +} + +// accountMagicCfInterconnectGetResponseJSON contains the JSON metadata for the +// struct [AccountMagicCfInterconnectGetResponse] +type accountMagicCfInterconnectGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectGetResponseErrorJSON `json:"-"` +} + +// accountMagicCfInterconnectGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountMagicCfInterconnectGetResponseError] +type accountMagicCfInterconnectGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectGetResponseMessageJSON `json:"-"` +} + +// accountMagicCfInterconnectGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountMagicCfInterconnectGetResponseMessage] +type accountMagicCfInterconnectGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectGetResponseResult struct { + Interconnect interface{} `json:"interconnect"` + JSON accountMagicCfInterconnectGetResponseResultJSON `json:"-"` +} + +// accountMagicCfInterconnectGetResponseResultJSON contains the JSON metadata for +// the struct [AccountMagicCfInterconnectGetResponseResult] +type accountMagicCfInterconnectGetResponseResultJSON struct { + Interconnect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicCfInterconnectGetResponseSuccess bool + +const ( + AccountMagicCfInterconnectGetResponseSuccessTrue AccountMagicCfInterconnectGetResponseSuccess = true +) + +type AccountMagicCfInterconnectUpdateResponse struct { + Errors []AccountMagicCfInterconnectUpdateResponseError `json:"errors"` + Messages []AccountMagicCfInterconnectUpdateResponseMessage `json:"messages"` + Result AccountMagicCfInterconnectUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicCfInterconnectUpdateResponseSuccess `json:"success"` + JSON accountMagicCfInterconnectUpdateResponseJSON `json:"-"` +} + +// accountMagicCfInterconnectUpdateResponseJSON contains the JSON metadata for the +// struct [AccountMagicCfInterconnectUpdateResponse] +type accountMagicCfInterconnectUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectUpdateResponseErrorJSON `json:"-"` +} + +// accountMagicCfInterconnectUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountMagicCfInterconnectUpdateResponseError] +type accountMagicCfInterconnectUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectUpdateResponseMessageJSON `json:"-"` +} + +// accountMagicCfInterconnectUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountMagicCfInterconnectUpdateResponseMessage] +type accountMagicCfInterconnectUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectUpdateResponseResult struct { + Modified bool `json:"modified"` + ModifiedInterconnect interface{} `json:"modified_interconnect"` + JSON accountMagicCfInterconnectUpdateResponseResultJSON `json:"-"` +} + +// accountMagicCfInterconnectUpdateResponseResultJSON contains the JSON metadata +// for the struct [AccountMagicCfInterconnectUpdateResponseResult] +type accountMagicCfInterconnectUpdateResponseResultJSON struct { + Modified apijson.Field + ModifiedInterconnect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicCfInterconnectUpdateResponseSuccess bool + +const ( + AccountMagicCfInterconnectUpdateResponseSuccessTrue AccountMagicCfInterconnectUpdateResponseSuccess = true +) + +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponse struct { + Errors []AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseError `json:"errors"` + Messages []AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseMessage `json:"messages"` + Result AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseSuccess `json:"success"` + JSON accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponse] +type accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseErrorJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseError] +type accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseMessageJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseMessage] +type accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResult struct { + Interconnects []AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnect `json:"interconnects"` + JSON accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResult] +type accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultJSON struct { + Interconnects apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnect struct { + // Tunnel identifier tag. + ID string `json:"id"` + // The name of the interconnect. The name cannot share a name with other tunnels. + ColoName string `json:"colo_name"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the interconnect. + Description string `json:"description"` + // The configuration specific to GRE interconnects. + Gre AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsGre `json:"gre"` + HealthCheck AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheck `json:"health_check"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + // value is 576. + Mtu int64 `json:"mtu"` + // The name of the interconnect. The name cannot share a name with other tunnels. + Name string `json:"name"` + JSON accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnect] +type accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectJSON struct { + ID apijson.Field + ColoName apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Gre apijson.Field + HealthCheck apijson.Field + InterfaceAddress apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration specific to GRE interconnects. +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsGre struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel created as part + // of the Interconnect. + CloudflareEndpoint string `json:"cloudflare_endpoint"` + JSON accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsGreJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsGreJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsGre] +type accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsGreJSON struct { + CloudflareEndpoint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsGre) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckType `json:"type"` + JSON accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheck] +type accountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRate string + +const ( + AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRateLow AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRate = "low" + AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRateMid AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRate = "mid" + AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRateHigh AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckType string + +const ( + AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckTypeReply AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckType = "reply" + AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckTypeRequest AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseResultInterconnectsHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseSuccess bool + +const ( + AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseSuccessTrue AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponseSuccess = true +) + +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponse struct { + Errors []AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseError `json:"errors"` + Messages []AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseMessage `json:"messages"` + Result AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseSuccess `json:"success"` + JSON accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponse] +type accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseErrorJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseError] +type accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseMessageJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseMessage] +type accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResult struct { + Modified bool `json:"modified"` + ModifiedInterconnects []AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnect `json:"modified_interconnects"` + JSON accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResult] +type accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultJSON struct { + Modified apijson.Field + ModifiedInterconnects apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnect struct { + // Tunnel identifier tag. + ID string `json:"id"` + // The name of the interconnect. The name cannot share a name with other tunnels. + ColoName string `json:"colo_name"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the interconnect. + Description string `json:"description"` + // The configuration specific to GRE interconnects. + Gre AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsGre `json:"gre"` + HealthCheck AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheck `json:"health_check"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + // value is 576. + Mtu int64 `json:"mtu"` + // The name of the interconnect. The name cannot share a name with other tunnels. + Name string `json:"name"` + JSON accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnect] +type accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectJSON struct { + ID apijson.Field + ColoName apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Gre apijson.Field + HealthCheck apijson.Field + InterfaceAddress apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration specific to GRE interconnects. +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsGre struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel created as part + // of the Interconnect. + CloudflareEndpoint string `json:"cloudflare_endpoint"` + JSON accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsGreJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsGreJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsGre] +type accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsGreJSON struct { + CloudflareEndpoint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsGre) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckType `json:"type"` + JSON accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckJSON `json:"-"` +} + +// accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheck] +type accountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRate string + +const ( + AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRateLow AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRate = "low" + AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRateMid AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRate = "mid" + AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRateHigh AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckType string + +const ( + AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckTypeReply AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckType = "reply" + AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckTypeRequest AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseResultModifiedInterconnectsHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseSuccess bool + +const ( + AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseSuccessTrue AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponseSuccess = true +) + +type AccountMagicCfInterconnectUpdateParams struct { + // An optional description of the interconnect. + Description param.Field[string] `json:"description"` + // The configuration specific to GRE interconnects. + Gre param.Field[AccountMagicCfInterconnectUpdateParamsGre] `json:"gre"` + HealthCheck param.Field[AccountMagicCfInterconnectUpdateParamsHealthCheck] `json:"health_check"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address"` + // The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + // value is 576. + Mtu param.Field[int64] `json:"mtu"` +} + +func (r AccountMagicCfInterconnectUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration specific to GRE interconnects. +type AccountMagicCfInterconnectUpdateParamsGre struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel created as part + // of the Interconnect. + CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint"` +} + +func (r AccountMagicCfInterconnectUpdateParamsGre) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicCfInterconnectUpdateParamsHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled param.Field[bool] `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate param.Field[AccountMagicCfInterconnectUpdateParamsHealthCheckRate] `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target param.Field[string] `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type param.Field[AccountMagicCfInterconnectUpdateParamsHealthCheckType] `json:"type"` +} + +func (r AccountMagicCfInterconnectUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicCfInterconnectUpdateParamsHealthCheckRate string + +const ( + AccountMagicCfInterconnectUpdateParamsHealthCheckRateLow AccountMagicCfInterconnectUpdateParamsHealthCheckRate = "low" + AccountMagicCfInterconnectUpdateParamsHealthCheckRateMid AccountMagicCfInterconnectUpdateParamsHealthCheckRate = "mid" + AccountMagicCfInterconnectUpdateParamsHealthCheckRateHigh AccountMagicCfInterconnectUpdateParamsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicCfInterconnectUpdateParamsHealthCheckType string + +const ( + AccountMagicCfInterconnectUpdateParamsHealthCheckTypeReply AccountMagicCfInterconnectUpdateParamsHealthCheckType = "reply" + AccountMagicCfInterconnectUpdateParamsHealthCheckTypeRequest AccountMagicCfInterconnectUpdateParamsHealthCheckType = "request" +) + +type AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountmagiccfinterconnect_test.go b/accountmagiccfinterconnect_test.go new file mode 100644 index 00000000000..3b5ea2291e3 --- /dev/null +++ b/accountmagiccfinterconnect_test.go @@ -0,0 +1,146 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMagicCfInterconnectGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.CfInterconnects.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMagicCfInterconnectUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.CfInterconnects.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicCfInterconnectUpdateParams{ + Description: cloudflare.F("Tunnel for Interconnect to ORD"), + Gre: cloudflare.F(cloudflare.AccountMagicCfInterconnectUpdateParamsGre{ + CloudflareEndpoint: cloudflare.F("203.0.113.1"), + }), + HealthCheck: cloudflare.F(cloudflare.AccountMagicCfInterconnectUpdateParamsHealthCheck{ + Enabled: cloudflare.F(true), + Rate: cloudflare.F(cloudflare.AccountMagicCfInterconnectUpdateParamsHealthCheckRateLow), + Target: cloudflare.F("203.0.113.1"), + Type: cloudflare.F(cloudflare.AccountMagicCfInterconnectUpdateParamsHealthCheckTypeRequest), + }), + InterfaceAddress: cloudflare.F("192.0.2.0/31"), + Mtu: cloudflare.F(int64(0)), + }, + ) + 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 TestAccountMagicCfInterconnectMagicInterconnectsListInterconnects(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.CfInterconnects.MagicInterconnectsListInterconnects(context.TODO(), "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()) + } +} + +func TestAccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnects(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.CfInterconnects.MagicInterconnectsUpdateMultipleInterconnects( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountmagicgretunnel.go b/accountmagicgretunnel.go new file mode 100644 index 00000000000..4a2852db4d3 --- /dev/null +++ b/accountmagicgretunnel.go @@ -0,0 +1,1059 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMagicGreTunnelService 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 [NewAccountMagicGreTunnelService] +// method instead. +type AccountMagicGreTunnelService struct { + Options []option.RequestOption +} + +// NewAccountMagicGreTunnelService 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 NewAccountMagicGreTunnelService(opts ...option.RequestOption) (r *AccountMagicGreTunnelService) { + r = &AccountMagicGreTunnelService{} + r.Options = opts + return +} + +// Lists informtion for a specific GRE tunnel. +func (r *AccountMagicGreTunnelService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *AccountMagicGreTunnelGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a specific GRE tunnel. Use `?validate_only=true` as an optional query +// parameter to only run validation without persisting changes. +func (r *AccountMagicGreTunnelService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body AccountMagicGreTunnelUpdateParams, opts ...option.RequestOption) (res *AccountMagicGreTunnelUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Disables and removes a specific static GRE tunnel. Use `?validate_only=true` as +// an optional query parameter to only run validation without persisting changes. +func (r *AccountMagicGreTunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *AccountMagicGreTunnelDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates new GRE tunnels. Use `?validate_only=true` as an optional query +// parameter to only run validation without persisting changes. +func (r *AccountMagicGreTunnelService) MagicGreTunnelsNewGreTunnels(ctx context.Context, accountIdentifier string, body AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsParams, opts ...option.RequestOption) (res *AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists GRE tunnels associated with an account. +func (r *AccountMagicGreTunnelService) MagicGreTunnelsListGreTunnels(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates multiple GRE tunnels. Use `?validate_only=true` as an optional query +// parameter to only run validation without persisting changes. +func (r *AccountMagicGreTunnelService) MagicGreTunnelsUpdateMultipleGreTunnels(ctx context.Context, accountIdentifier string, body AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsParams, opts ...option.RequestOption) (res *AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountMagicGreTunnelGetResponse struct { + Errors []AccountMagicGreTunnelGetResponseError `json:"errors"` + Messages []AccountMagicGreTunnelGetResponseMessage `json:"messages"` + Result AccountMagicGreTunnelGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicGreTunnelGetResponseSuccess `json:"success"` + JSON accountMagicGreTunnelGetResponseJSON `json:"-"` +} + +// accountMagicGreTunnelGetResponseJSON contains the JSON metadata for the struct +// [AccountMagicGreTunnelGetResponse] +type accountMagicGreTunnelGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelGetResponseErrorJSON `json:"-"` +} + +// accountMagicGreTunnelGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelGetResponseError] +type accountMagicGreTunnelGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelGetResponseMessageJSON `json:"-"` +} + +// accountMagicGreTunnelGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelGetResponseMessage] +type accountMagicGreTunnelGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelGetResponseResult struct { + GreTunnel interface{} `json:"gre_tunnel"` + JSON accountMagicGreTunnelGetResponseResultJSON `json:"-"` +} + +// accountMagicGreTunnelGetResponseResultJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelGetResponseResult] +type accountMagicGreTunnelGetResponseResultJSON struct { + GreTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicGreTunnelGetResponseSuccess bool + +const ( + AccountMagicGreTunnelGetResponseSuccessTrue AccountMagicGreTunnelGetResponseSuccess = true +) + +type AccountMagicGreTunnelUpdateResponse struct { + Errors []AccountMagicGreTunnelUpdateResponseError `json:"errors"` + Messages []AccountMagicGreTunnelUpdateResponseMessage `json:"messages"` + Result AccountMagicGreTunnelUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicGreTunnelUpdateResponseSuccess `json:"success"` + JSON accountMagicGreTunnelUpdateResponseJSON `json:"-"` +} + +// accountMagicGreTunnelUpdateResponseJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelUpdateResponse] +type accountMagicGreTunnelUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelUpdateResponseErrorJSON `json:"-"` +} + +// accountMagicGreTunnelUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelUpdateResponseError] +type accountMagicGreTunnelUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelUpdateResponseMessageJSON `json:"-"` +} + +// accountMagicGreTunnelUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountMagicGreTunnelUpdateResponseMessage] +type accountMagicGreTunnelUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelUpdateResponseResult struct { + Modified bool `json:"modified"` + ModifiedGreTunnel interface{} `json:"modified_gre_tunnel"` + JSON accountMagicGreTunnelUpdateResponseResultJSON `json:"-"` +} + +// accountMagicGreTunnelUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelUpdateResponseResult] +type accountMagicGreTunnelUpdateResponseResultJSON struct { + Modified apijson.Field + ModifiedGreTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicGreTunnelUpdateResponseSuccess bool + +const ( + AccountMagicGreTunnelUpdateResponseSuccessTrue AccountMagicGreTunnelUpdateResponseSuccess = true +) + +type AccountMagicGreTunnelDeleteResponse struct { + Errors []AccountMagicGreTunnelDeleteResponseError `json:"errors"` + Messages []AccountMagicGreTunnelDeleteResponseMessage `json:"messages"` + Result AccountMagicGreTunnelDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicGreTunnelDeleteResponseSuccess `json:"success"` + JSON accountMagicGreTunnelDeleteResponseJSON `json:"-"` +} + +// accountMagicGreTunnelDeleteResponseJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelDeleteResponse] +type accountMagicGreTunnelDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelDeleteResponseErrorJSON `json:"-"` +} + +// accountMagicGreTunnelDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelDeleteResponseError] +type accountMagicGreTunnelDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelDeleteResponseMessageJSON `json:"-"` +} + +// accountMagicGreTunnelDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountMagicGreTunnelDeleteResponseMessage] +type accountMagicGreTunnelDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelDeleteResponseResult struct { + Deleted bool `json:"deleted"` + DeletedGreTunnel interface{} `json:"deleted_gre_tunnel"` + JSON accountMagicGreTunnelDeleteResponseResultJSON `json:"-"` +} + +// accountMagicGreTunnelDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountMagicGreTunnelDeleteResponseResult] +type accountMagicGreTunnelDeleteResponseResultJSON struct { + Deleted apijson.Field + DeletedGreTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicGreTunnelDeleteResponseSuccess bool + +const ( + AccountMagicGreTunnelDeleteResponseSuccessTrue AccountMagicGreTunnelDeleteResponseSuccess = true +) + +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponse struct { + Errors []AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseError `json:"errors"` + Messages []AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseMessage `json:"messages"` + Result AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseSuccess `json:"success"` + JSON accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseJSON contains the JSON +// metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponse] +type accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseErrorJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseError] +type accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseMessageJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseMessage] +type accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResult struct { + GreTunnels []AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnel `json:"gre_tunnels"` + JSON accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultJSON contains the +// JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResult] +type accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultJSON struct { + GreTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnel struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel. + CloudflareGreEndpoint string `json:"cloudflare_gre_endpoint,required"` + // The IP address assigned to the customer side of the GRE tunnel. + CustomerGreEndpoint string `json:"customer_gre_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the tunnel. The name cannot contain spaces or special characters, + // must be 15 characters or less, and cannot share a name with another GRE tunnel. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the GRE tunnel. + Description string `json:"description"` + HealthCheck AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheck `json:"health_check"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + // is 576. + Mtu int64 `json:"mtu"` + // Time To Live (TTL) in number of hops of the GRE tunnel. + Ttl int64 `json:"ttl"` + JSON accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnel] +type accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelJSON struct { + CloudflareGreEndpoint apijson.Field + CustomerGreEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + HealthCheck apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + Ttl apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. + Direction AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckDirection `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckType `json:"type"` + JSON accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheck] +type accountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckJSON struct { + Direction apijson.Field + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckDirection string + +const ( + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckDirectionUnidirectional AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckDirection = "unidirectional" + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckDirectionBidirectional AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRate string + +const ( + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRateLow AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRate = "low" + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRateMid AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRate = "mid" + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRateHigh AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckType string + +const ( + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckTypeReply AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckType = "reply" + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckTypeRequest AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseResultGreTunnelsHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseSuccess bool + +const ( + AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseSuccessTrue AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponseSuccess = true +) + +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponse struct { + Errors []AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseError `json:"errors"` + Messages []AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseMessage `json:"messages"` + Result AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseSuccess `json:"success"` + JSON accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseJSON contains the JSON +// metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponse] +type accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseErrorJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseError] +type accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseMessageJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseMessage] +type accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResult struct { + GreTunnels []AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnel `json:"gre_tunnels"` + JSON accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultJSON contains +// the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResult] +type accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultJSON struct { + GreTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnel struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel. + CloudflareGreEndpoint string `json:"cloudflare_gre_endpoint,required"` + // The IP address assigned to the customer side of the GRE tunnel. + CustomerGreEndpoint string `json:"customer_gre_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the tunnel. The name cannot contain spaces or special characters, + // must be 15 characters or less, and cannot share a name with another GRE tunnel. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the GRE tunnel. + Description string `json:"description"` + HealthCheck AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheck `json:"health_check"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + // is 576. + Mtu int64 `json:"mtu"` + // Time To Live (TTL) in number of hops of the GRE tunnel. + Ttl int64 `json:"ttl"` + JSON accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnel] +type accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelJSON struct { + CloudflareGreEndpoint apijson.Field + CustomerGreEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + HealthCheck apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + Ttl apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. + Direction AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckDirection `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckType `json:"type"` + JSON accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheck] +type accountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckJSON struct { + Direction apijson.Field + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckDirection string + +const ( + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckDirectionUnidirectional AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckDirection = "unidirectional" + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckDirectionBidirectional AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRate string + +const ( + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRateLow AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRate = "low" + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRateMid AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRate = "mid" + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRateHigh AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckType string + +const ( + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckTypeReply AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckType = "reply" + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckTypeRequest AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseResultGreTunnelsHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseSuccess bool + +const ( + AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseSuccessTrue AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponseSuccess = true +) + +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponse struct { + Errors []AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseError `json:"errors"` + Messages []AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseMessage `json:"messages"` + Result AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseSuccess `json:"success"` + JSON accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponse] +type accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseErrorJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseError] +type accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseMessageJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseMessage] +type accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResult struct { + Modified bool `json:"modified"` + ModifiedGreTunnels []AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnel `json:"modified_gre_tunnels"` + JSON accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResult] +type accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultJSON struct { + Modified apijson.Field + ModifiedGreTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnel struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel. + CloudflareGreEndpoint string `json:"cloudflare_gre_endpoint,required"` + // The IP address assigned to the customer side of the GRE tunnel. + CustomerGreEndpoint string `json:"customer_gre_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the tunnel. The name cannot contain spaces or special characters, + // must be 15 characters or less, and cannot share a name with another GRE tunnel. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the GRE tunnel. + Description string `json:"description"` + HealthCheck AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheck `json:"health_check"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + // is 576. + Mtu int64 `json:"mtu"` + // Time To Live (TTL) in number of hops of the GRE tunnel. + Ttl int64 `json:"ttl"` + JSON accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnel] +type accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelJSON struct { + CloudflareGreEndpoint apijson.Field + CustomerGreEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + HealthCheck apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + Ttl apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. + Direction AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckDirection `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckType `json:"type"` + JSON accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckJSON `json:"-"` +} + +// accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheck] +type accountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckJSON struct { + Direction apijson.Field + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckDirection string + +const ( + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckDirectionUnidirectional AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckDirection = "unidirectional" + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckDirectionBidirectional AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRate string + +const ( + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRateLow AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRate = "low" + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRateMid AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRate = "mid" + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRateHigh AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckType string + +const ( + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckTypeReply AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckType = "reply" + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckTypeRequest AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseResultModifiedGreTunnelsHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseSuccess bool + +const ( + AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseSuccessTrue AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponseSuccess = true +) + +type AccountMagicGreTunnelUpdateParams struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel. + CloudflareGreEndpoint param.Field[string] `json:"cloudflare_gre_endpoint,required"` + // The IP address assigned to the customer side of the GRE tunnel. + CustomerGreEndpoint param.Field[string] `json:"customer_gre_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address,required"` + // The name of the tunnel. The name cannot contain spaces or special characters, + // must be 15 characters or less, and cannot share a name with another GRE tunnel. + Name param.Field[string] `json:"name,required"` + // An optional description of the GRE tunnel. + Description param.Field[string] `json:"description"` + HealthCheck param.Field[AccountMagicGreTunnelUpdateParamsHealthCheck] `json:"health_check"` + // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + // is 576. + Mtu param.Field[int64] `json:"mtu"` + // Time To Live (TTL) in number of hops of the GRE tunnel. + Ttl param.Field[int64] `json:"ttl"` +} + +func (r AccountMagicGreTunnelUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicGreTunnelUpdateParamsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. + Direction param.Field[AccountMagicGreTunnelUpdateParamsHealthCheckDirection] `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled param.Field[bool] `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate param.Field[AccountMagicGreTunnelUpdateParamsHealthCheckRate] `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target param.Field[string] `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type param.Field[AccountMagicGreTunnelUpdateParamsHealthCheckType] `json:"type"` +} + +func (r AccountMagicGreTunnelUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. +type AccountMagicGreTunnelUpdateParamsHealthCheckDirection string + +const ( + AccountMagicGreTunnelUpdateParamsHealthCheckDirectionUnidirectional AccountMagicGreTunnelUpdateParamsHealthCheckDirection = "unidirectional" + AccountMagicGreTunnelUpdateParamsHealthCheckDirectionBidirectional AccountMagicGreTunnelUpdateParamsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicGreTunnelUpdateParamsHealthCheckRate string + +const ( + AccountMagicGreTunnelUpdateParamsHealthCheckRateLow AccountMagicGreTunnelUpdateParamsHealthCheckRate = "low" + AccountMagicGreTunnelUpdateParamsHealthCheckRateMid AccountMagicGreTunnelUpdateParamsHealthCheckRate = "mid" + AccountMagicGreTunnelUpdateParamsHealthCheckRateHigh AccountMagicGreTunnelUpdateParamsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicGreTunnelUpdateParamsHealthCheckType string + +const ( + AccountMagicGreTunnelUpdateParamsHealthCheckTypeReply AccountMagicGreTunnelUpdateParamsHealthCheckType = "reply" + AccountMagicGreTunnelUpdateParamsHealthCheckTypeRequest AccountMagicGreTunnelUpdateParamsHealthCheckType = "request" +) + +type AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountmagicgretunnel_test.go b/accountmagicgretunnel_test.go new file mode 100644 index 00000000000..150c34d3efd --- /dev/null +++ b/accountmagicgretunnel_test.go @@ -0,0 +1,210 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMagicGreTunnelGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.GreTunnels.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMagicGreTunnelUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.GreTunnels.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicGreTunnelUpdateParams{ + CloudflareGreEndpoint: cloudflare.F("203.0.113.1"), + CustomerGreEndpoint: cloudflare.F("203.0.113.1"), + InterfaceAddress: cloudflare.F("192.0.2.0/31"), + Name: cloudflare.F("GRE_1"), + Description: cloudflare.F("Tunnel for ISP X"), + HealthCheck: cloudflare.F(cloudflare.AccountMagicGreTunnelUpdateParamsHealthCheck{ + Direction: cloudflare.F(cloudflare.AccountMagicGreTunnelUpdateParamsHealthCheckDirectionBidirectional), + Enabled: cloudflare.F(true), + Rate: cloudflare.F(cloudflare.AccountMagicGreTunnelUpdateParamsHealthCheckRateLow), + Target: cloudflare.F("203.0.113.1"), + Type: cloudflare.F(cloudflare.AccountMagicGreTunnelUpdateParamsHealthCheckTypeRequest), + }), + Mtu: cloudflare.F(int64(0)), + Ttl: cloudflare.F(int64(0)), + }, + ) + 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 TestAccountMagicGreTunnelDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.GreTunnels.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMagicGreTunnelMagicGreTunnelsNewGreTunnels(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.GreTunnels.MagicGreTunnelsNewGreTunnels( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountMagicGreTunnelMagicGreTunnelsListGreTunnels(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.GreTunnels.MagicGreTunnelsListGreTunnels(context.TODO(), "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()) + } +} + +func TestAccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnels(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.GreTunnels.MagicGreTunnelsUpdateMultipleGreTunnels( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountmagicipsectunnel.go b/accountmagicipsectunnel.go new file mode 100644 index 00000000000..350dfee8aea --- /dev/null +++ b/accountmagicipsectunnel.go @@ -0,0 +1,1047 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMagicIpsecTunnelService 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 +// [NewAccountMagicIpsecTunnelService] method instead. +type AccountMagicIpsecTunnelService struct { + Options []option.RequestOption + PskGenerates *AccountMagicIpsecTunnelPskGenerateService +} + +// NewAccountMagicIpsecTunnelService 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 NewAccountMagicIpsecTunnelService(opts ...option.RequestOption) (r *AccountMagicIpsecTunnelService) { + r = &AccountMagicIpsecTunnelService{} + r.Options = opts + r.PskGenerates = NewAccountMagicIpsecTunnelPskGenerateService(opts...) + return +} + +// Lists details for a specific IPsec tunnel. +func (r *AccountMagicIpsecTunnelService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *AccountMagicIpsecTunnelGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a specific IPsec tunnel associated with an account. Use +// `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *AccountMagicIpsecTunnelService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body AccountMagicIpsecTunnelUpdateParams, opts ...option.RequestOption) (res *AccountMagicIpsecTunnelUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Disables and removes a specific static IPsec Tunnel associated with an account. +// Use `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *AccountMagicIpsecTunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *AccountMagicIpsecTunnelDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates new IPsec tunnels associated with an account. Use `?validate_only=true` +// as an optional query parameter to only run validation without persisting +// changes. +func (r *AccountMagicIpsecTunnelService) MagicIPsecTunnelsNewIPsecTunnels(ctx context.Context, accountIdentifier string, body AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsParams, opts ...option.RequestOption) (res *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists IPsec tunnels associated with an account. +func (r *AccountMagicIpsecTunnelService) MagicIPsecTunnelsListIPsecTunnels(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update multiple IPsec tunnels associated with an account. Use +// `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *AccountMagicIpsecTunnelService) MagicIPsecTunnelsUpdateMultipleIPsecTunnels(ctx context.Context, accountIdentifier string, body AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsParams, opts ...option.RequestOption) (res *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountMagicIpsecTunnelGetResponse struct { + Errors []AccountMagicIpsecTunnelGetResponseError `json:"errors"` + Messages []AccountMagicIpsecTunnelGetResponseMessage `json:"messages"` + Result AccountMagicIpsecTunnelGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicIpsecTunnelGetResponseSuccess `json:"success"` + JSON accountMagicIpsecTunnelGetResponseJSON `json:"-"` +} + +// accountMagicIpsecTunnelGetResponseJSON contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelGetResponse] +type accountMagicIpsecTunnelGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelGetResponseErrorJSON `json:"-"` +} + +// accountMagicIpsecTunnelGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountMagicIpsecTunnelGetResponseError] +type accountMagicIpsecTunnelGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelGetResponseMessageJSON `json:"-"` +} + +// accountMagicIpsecTunnelGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountMagicIpsecTunnelGetResponseMessage] +type accountMagicIpsecTunnelGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelGetResponseResult struct { + IpsecTunnel interface{} `json:"ipsec_tunnel"` + JSON accountMagicIpsecTunnelGetResponseResultJSON `json:"-"` +} + +// accountMagicIpsecTunnelGetResponseResultJSON contains the JSON metadata for the +// struct [AccountMagicIpsecTunnelGetResponseResult] +type accountMagicIpsecTunnelGetResponseResultJSON struct { + IpsecTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicIpsecTunnelGetResponseSuccess bool + +const ( + AccountMagicIpsecTunnelGetResponseSuccessTrue AccountMagicIpsecTunnelGetResponseSuccess = true +) + +type AccountMagicIpsecTunnelUpdateResponse struct { + Errors []AccountMagicIpsecTunnelUpdateResponseError `json:"errors"` + Messages []AccountMagicIpsecTunnelUpdateResponseMessage `json:"messages"` + Result AccountMagicIpsecTunnelUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicIpsecTunnelUpdateResponseSuccess `json:"success"` + JSON accountMagicIpsecTunnelUpdateResponseJSON `json:"-"` +} + +// accountMagicIpsecTunnelUpdateResponseJSON contains the JSON metadata for the +// struct [AccountMagicIpsecTunnelUpdateResponse] +type accountMagicIpsecTunnelUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelUpdateResponseErrorJSON `json:"-"` +} + +// accountMagicIpsecTunnelUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountMagicIpsecTunnelUpdateResponseError] +type accountMagicIpsecTunnelUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelUpdateResponseMessageJSON `json:"-"` +} + +// accountMagicIpsecTunnelUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountMagicIpsecTunnelUpdateResponseMessage] +type accountMagicIpsecTunnelUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelUpdateResponseResult struct { + Modified bool `json:"modified"` + ModifiedIpsecTunnel interface{} `json:"modified_ipsec_tunnel"` + JSON accountMagicIpsecTunnelUpdateResponseResultJSON `json:"-"` +} + +// accountMagicIpsecTunnelUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountMagicIpsecTunnelUpdateResponseResult] +type accountMagicIpsecTunnelUpdateResponseResultJSON struct { + Modified apijson.Field + ModifiedIpsecTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicIpsecTunnelUpdateResponseSuccess bool + +const ( + AccountMagicIpsecTunnelUpdateResponseSuccessTrue AccountMagicIpsecTunnelUpdateResponseSuccess = true +) + +type AccountMagicIpsecTunnelDeleteResponse struct { + Errors []AccountMagicIpsecTunnelDeleteResponseError `json:"errors"` + Messages []AccountMagicIpsecTunnelDeleteResponseMessage `json:"messages"` + Result AccountMagicIpsecTunnelDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicIpsecTunnelDeleteResponseSuccess `json:"success"` + JSON accountMagicIpsecTunnelDeleteResponseJSON `json:"-"` +} + +// accountMagicIpsecTunnelDeleteResponseJSON contains the JSON metadata for the +// struct [AccountMagicIpsecTunnelDeleteResponse] +type accountMagicIpsecTunnelDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelDeleteResponseErrorJSON `json:"-"` +} + +// accountMagicIpsecTunnelDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountMagicIpsecTunnelDeleteResponseError] +type accountMagicIpsecTunnelDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelDeleteResponseMessageJSON `json:"-"` +} + +// accountMagicIpsecTunnelDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountMagicIpsecTunnelDeleteResponseMessage] +type accountMagicIpsecTunnelDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelDeleteResponseResult struct { + Deleted bool `json:"deleted"` + DeletedIpsecTunnel interface{} `json:"deleted_ipsec_tunnel"` + JSON accountMagicIpsecTunnelDeleteResponseResultJSON `json:"-"` +} + +// accountMagicIpsecTunnelDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountMagicIpsecTunnelDeleteResponseResult] +type accountMagicIpsecTunnelDeleteResponseResultJSON struct { + Deleted apijson.Field + DeletedIpsecTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicIpsecTunnelDeleteResponseSuccess bool + +const ( + AccountMagicIpsecTunnelDeleteResponseSuccessTrue AccountMagicIpsecTunnelDeleteResponseSuccess = true +) + +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponse struct { + Errors []AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseError `json:"errors"` + Messages []AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseMessage `json:"messages"` + Result AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseSuccess `json:"success"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseJSON contains the +// JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponse] +type accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseErrorJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseError] +type accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseMessageJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseMessage] +type accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResult struct { + IpsecTunnels []AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnel `json:"ipsec_tunnels"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResult] +type accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultJSON struct { + IpsecTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnel struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint string `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + // (Phase 2). + AllowNullCipher bool `json:"allow_null_cipher"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint string `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description string `json:"description"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The PSK metadata that includes when the PSK was generated. + PskMetadata AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsPskMetadata `json:"psk_metadata"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection bool `json:"replay_protection"` + TunnelHealthCheck AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck `json:"tunnel_health_check"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnel] +type accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelJSON struct { + CloudflareEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + AllowNullCipher apijson.Field + CreatedOn apijson.Field + CustomerEndpoint apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + PskMetadata apijson.Field + ReplayProtection apijson.Field + TunnelHealthCheck apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The PSK metadata that includes when the PSK was generated. +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsPskMetadata struct { + // The date and time the tunnel was last modified. + LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsPskMetadataJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsPskMetadataJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsPskMetadata] +type accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsPskMetadataJSON struct { + LastGeneratedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsPskMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType `json:"type"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck] +type accountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate string + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRateLow AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate = "low" + AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRateMid AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate = "mid" + AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRateHigh AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType string + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckTypeReply AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType = "reply" + AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckTypeRequest AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseSuccess bool + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseSuccessTrue AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponseSuccess = true +) + +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponse struct { + Errors []AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseError `json:"errors"` + Messages []AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseMessage `json:"messages"` + Result AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseSuccess `json:"success"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseJSON contains +// the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponse] +type accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseErrorJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseError] +type accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseMessageJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseMessage] +type accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResult struct { + IpsecTunnels []AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnel `json:"ipsec_tunnels"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResult] +type accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultJSON struct { + IpsecTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnel struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint string `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + // (Phase 2). + AllowNullCipher bool `json:"allow_null_cipher"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint string `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description string `json:"description"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The PSK metadata that includes when the PSK was generated. + PskMetadata AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsPskMetadata `json:"psk_metadata"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection bool `json:"replay_protection"` + TunnelHealthCheck AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck `json:"tunnel_health_check"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnel] +type accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelJSON struct { + CloudflareEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + AllowNullCipher apijson.Field + CreatedOn apijson.Field + CustomerEndpoint apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + PskMetadata apijson.Field + ReplayProtection apijson.Field + TunnelHealthCheck apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The PSK metadata that includes when the PSK was generated. +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsPskMetadata struct { + // The date and time the tunnel was last modified. + LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsPskMetadataJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsPskMetadataJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsPskMetadata] +type accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsPskMetadataJSON struct { + LastGeneratedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsPskMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType `json:"type"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck] +type accountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate string + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRateLow AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate = "low" + AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRateMid AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate = "mid" + AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRateHigh AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType string + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckTypeReply AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType = "reply" + AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckTypeRequest AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseResultIpsecTunnelsTunnelHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseSuccess bool + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseSuccessTrue AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponseSuccess = true +) + +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponse struct { + Errors []AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseError `json:"errors"` + Messages []AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseMessage `json:"messages"` + Result AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseSuccess `json:"success"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponse] +type accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseErrorJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseError] +type accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseMessageJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseMessage] +type accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResult struct { + Modified bool `json:"modified"` + ModifiedIpsecTunnels []AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnel `json:"modified_ipsec_tunnels"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResult] +type accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultJSON struct { + Modified apijson.Field + ModifiedIpsecTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnel struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint string `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + // (Phase 2). + AllowNullCipher bool `json:"allow_null_cipher"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint string `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description string `json:"description"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The PSK metadata that includes when the PSK was generated. + PskMetadata AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsPskMetadata `json:"psk_metadata"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection bool `json:"replay_protection"` + TunnelHealthCheck AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheck `json:"tunnel_health_check"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnel] +type accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelJSON struct { + CloudflareEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + AllowNullCipher apijson.Field + CreatedOn apijson.Field + CustomerEndpoint apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + PskMetadata apijson.Field + ReplayProtection apijson.Field + TunnelHealthCheck apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The PSK metadata that includes when the PSK was generated. +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsPskMetadata struct { + // The date and time the tunnel was last modified. + LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsPskMetadataJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsPskMetadataJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsPskMetadata] +type accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsPskMetadataJSON struct { + LastGeneratedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsPskMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckType `json:"type"` + JSON accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckJSON `json:"-"` +} + +// accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheck] +type accountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRate string + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRateLow AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRate = "low" + AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRateMid AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRate = "mid" + AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRateHigh AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckType string + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckTypeReply AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckType = "reply" + AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckTypeRequest AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseResultModifiedIpsecTunnelsTunnelHealthCheckType = "request" +) + +// Whether the API call was successful +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseSuccess bool + +const ( + AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseSuccessTrue AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponseSuccess = true +) + +type AccountMagicIpsecTunnelUpdateParams struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name param.Field[string] `json:"name,required"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint param.Field[string] `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description param.Field[string] `json:"description"` + // A randomly generated or provided string for use in the IPsec tunnel. + Psk param.Field[string] `json:"psk"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection param.Field[bool] `json:"replay_protection"` +} + +func (r AccountMagicIpsecTunnelUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsParams struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name param.Field[string] `json:"name,required"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint param.Field[string] `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description param.Field[string] `json:"description"` + // A randomly generated or provided string for use in the IPsec tunnel. + Psk param.Field[string] `json:"psk"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection param.Field[bool] `json:"replay_protection"` +} + +func (r AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountmagicipsectunnel_test.go b/accountmagicipsectunnel_test.go new file mode 100644 index 00000000000..7a8b6b6a9a0 --- /dev/null +++ b/accountmagicipsectunnel_test.go @@ -0,0 +1,209 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMagicIpsecTunnelGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.IpsecTunnels.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMagicIpsecTunnelUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.IpsecTunnels.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicIpsecTunnelUpdateParams{ + CloudflareEndpoint: cloudflare.F("203.0.113.1"), + InterfaceAddress: cloudflare.F("192.0.2.0/31"), + Name: cloudflare.F("IPsec_1"), + CustomerEndpoint: cloudflare.F("203.0.113.1"), + Description: cloudflare.F("Tunnel for ISP X"), + Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"), + ReplayProtection: cloudflare.F(false), + }, + ) + 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 TestAccountMagicIpsecTunnelDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.IpsecTunnels.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.IpsecTunnels.MagicIPsecTunnelsNewIPsecTunnels( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsParams{ + CloudflareEndpoint: cloudflare.F("203.0.113.1"), + InterfaceAddress: cloudflare.F("192.0.2.0/31"), + Name: cloudflare.F("IPsec_1"), + CustomerEndpoint: cloudflare.F("203.0.113.1"), + Description: cloudflare.F("Tunnel for ISP X"), + Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"), + ReplayProtection: cloudflare.F(false), + }, + ) + 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 TestAccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnels(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.IpsecTunnels.MagicIPsecTunnelsListIPsecTunnels(context.TODO(), "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()) + } +} + +func TestAccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnels(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.IpsecTunnels.MagicIPsecTunnelsUpdateMultipleIPsecTunnels( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountmagicipsectunnelpskgenerate.go b/accountmagicipsectunnelpskgenerate.go new file mode 100644 index 00000000000..0f0b6e5c602 --- /dev/null +++ b/accountmagicipsectunnelpskgenerate.go @@ -0,0 +1,162 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMagicIpsecTunnelPskGenerateService 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 +// [NewAccountMagicIpsecTunnelPskGenerateService] method instead. +type AccountMagicIpsecTunnelPskGenerateService struct { + Options []option.RequestOption +} + +// NewAccountMagicIpsecTunnelPskGenerateService 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 NewAccountMagicIpsecTunnelPskGenerateService(opts ...option.RequestOption) (r *AccountMagicIpsecTunnelPskGenerateService) { + r = &AccountMagicIpsecTunnelPskGenerateService{} + r.Options = opts + return +} + +// Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session. +// Use `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. After a PSK is generated, the PSK is immediately +// persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a +// safe place. +func (r *AccountMagicIpsecTunnelPskGenerateService) MagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnels(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s/psk_generate", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponse struct { + Errors []AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseError `json:"errors"` + Messages []AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseMessage `json:"messages"` + Result AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseSuccess `json:"success"` + JSON accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseJSON `json:"-"` +} + +// accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponse] +type accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseErrorJSON `json:"-"` +} + +// accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseError] +type accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseMessageJSON `json:"-"` +} + +// accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseMessage] +type accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResult struct { + // Identifier + IpsecTunnelID string `json:"ipsec_tunnel_id"` + // A randomly generated or provided string for use in the IPsec tunnel. + Psk string `json:"psk"` + // The PSK metadata that includes when the PSK was generated. + PskMetadata AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultPskMetadata `json:"psk_metadata"` + JSON accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultJSON `json:"-"` +} + +// accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResult] +type accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultJSON struct { + IpsecTunnelID apijson.Field + Psk apijson.Field + PskMetadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The PSK metadata that includes when the PSK was generated. +type AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultPskMetadata struct { + // The date and time the tunnel was last modified. + LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` + JSON accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultPskMetadataJSON `json:"-"` +} + +// accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultPskMetadataJSON +// contains the JSON metadata for the struct +// [AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultPskMetadata] +type accountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultPskMetadataJSON struct { + LastGeneratedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseResultPskMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseSuccess bool + +const ( + AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseSuccessTrue AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponseSuccess = true +) diff --git a/accountmagicipsectunnelpskgenerate_test.go b/accountmagicipsectunnelpskgenerate_test.go new file mode 100644 index 00000000000..7bce0741ec2 --- /dev/null +++ b/accountmagicipsectunnelpskgenerate_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnels(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.IpsecTunnels.PskGenerates.MagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnels( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountmagicroute.go b/accountmagicroute.go new file mode 100644 index 00000000000..270cee81e01 --- /dev/null +++ b/accountmagicroute.go @@ -0,0 +1,1004 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMagicRouteService 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 [NewAccountMagicRouteService] method +// instead. +type AccountMagicRouteService struct { + Options []option.RequestOption +} + +// NewAccountMagicRouteService 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 NewAccountMagicRouteService(opts ...option.RequestOption) (r *AccountMagicRouteService) { + r = &AccountMagicRouteService{} + r.Options = opts + return +} + +// Get a specific Magic static route. +func (r *AccountMagicRouteService) Get(ctx context.Context, accountIdentifier string, routeIdentifier string, opts ...option.RequestOption) (res *AccountMagicRouteGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a specific Magic static route. Use `?validate_only=true` as an optional +// query parameter to run validation only without persisting changes. +func (r *AccountMagicRouteService) Update(ctx context.Context, accountIdentifier string, routeIdentifier string, body AccountMagicRouteUpdateParams, opts ...option.RequestOption) (res *AccountMagicRouteUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete multiple Magic static routes. +func (r *AccountMagicRouteService) Delete(ctx context.Context, accountIdentifier string, body AccountMagicRouteDeleteParams, opts ...option.RequestOption) (res *AccountMagicRouteDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Disable and remove a specific Magic static route. +func (r *AccountMagicRouteService) DeleteMany(ctx context.Context, accountIdentifier string, routeIdentifier string, opts ...option.RequestOption) (res *AccountMagicRouteDeleteManyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new Magic static route. Use `?validate_only=true` as an optional query +// parameter to run validation only without persisting changes. +func (r *AccountMagicRouteService) MagicStaticRoutesNewRoutes(ctx context.Context, accountIdentifier string, body AccountMagicRouteMagicStaticRoutesNewRoutesParams, opts ...option.RequestOption) (res *AccountMagicRouteMagicStaticRoutesNewRoutesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all Magic static routes. +func (r *AccountMagicRouteService) MagicStaticRoutesListRoutes(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountMagicRouteMagicStaticRoutesListRoutesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update multiple Magic static routes. Use `?validate_only=true` as an optional +// query parameter to run validation only without persisting changes. Only fields +// for a route that need to be changed need be provided. +func (r *AccountMagicRouteService) MagicStaticRoutesUpdateManyRoutes(ctx context.Context, accountIdentifier string, body AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParams, opts ...option.RequestOption) (res *AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountMagicRouteGetResponse struct { + Errors []AccountMagicRouteGetResponseError `json:"errors"` + Messages []AccountMagicRouteGetResponseMessage `json:"messages"` + Result AccountMagicRouteGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicRouteGetResponseSuccess `json:"success"` + JSON accountMagicRouteGetResponseJSON `json:"-"` +} + +// accountMagicRouteGetResponseJSON contains the JSON metadata for the struct +// [AccountMagicRouteGetResponse] +type accountMagicRouteGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteGetResponseErrorJSON `json:"-"` +} + +// accountMagicRouteGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountMagicRouteGetResponseError] +type accountMagicRouteGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteGetResponseMessageJSON `json:"-"` +} + +// accountMagicRouteGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountMagicRouteGetResponseMessage] +type accountMagicRouteGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteGetResponseResult struct { + Route interface{} `json:"route"` + JSON accountMagicRouteGetResponseResultJSON `json:"-"` +} + +// accountMagicRouteGetResponseResultJSON contains the JSON metadata for the struct +// [AccountMagicRouteGetResponseResult] +type accountMagicRouteGetResponseResultJSON struct { + Route apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicRouteGetResponseSuccess bool + +const ( + AccountMagicRouteGetResponseSuccessTrue AccountMagicRouteGetResponseSuccess = true +) + +type AccountMagicRouteUpdateResponse struct { + Errors []AccountMagicRouteUpdateResponseError `json:"errors"` + Messages []AccountMagicRouteUpdateResponseMessage `json:"messages"` + Result AccountMagicRouteUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicRouteUpdateResponseSuccess `json:"success"` + JSON accountMagicRouteUpdateResponseJSON `json:"-"` +} + +// accountMagicRouteUpdateResponseJSON contains the JSON metadata for the struct +// [AccountMagicRouteUpdateResponse] +type accountMagicRouteUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteUpdateResponseErrorJSON `json:"-"` +} + +// accountMagicRouteUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountMagicRouteUpdateResponseError] +type accountMagicRouteUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteUpdateResponseMessageJSON `json:"-"` +} + +// accountMagicRouteUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountMagicRouteUpdateResponseMessage] +type accountMagicRouteUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteUpdateResponseResult struct { + Modified bool `json:"modified"` + ModifiedRoute interface{} `json:"modified_route"` + JSON accountMagicRouteUpdateResponseResultJSON `json:"-"` +} + +// accountMagicRouteUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountMagicRouteUpdateResponseResult] +type accountMagicRouteUpdateResponseResultJSON struct { + Modified apijson.Field + ModifiedRoute apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicRouteUpdateResponseSuccess bool + +const ( + AccountMagicRouteUpdateResponseSuccessTrue AccountMagicRouteUpdateResponseSuccess = true +) + +type AccountMagicRouteDeleteResponse struct { + Errors []AccountMagicRouteDeleteResponseError `json:"errors"` + Messages []AccountMagicRouteDeleteResponseMessage `json:"messages"` + Result AccountMagicRouteDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicRouteDeleteResponseSuccess `json:"success"` + JSON accountMagicRouteDeleteResponseJSON `json:"-"` +} + +// accountMagicRouteDeleteResponseJSON contains the JSON metadata for the struct +// [AccountMagicRouteDeleteResponse] +type accountMagicRouteDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteDeleteResponseErrorJSON `json:"-"` +} + +// accountMagicRouteDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountMagicRouteDeleteResponseError] +type accountMagicRouteDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteDeleteResponseMessageJSON `json:"-"` +} + +// accountMagicRouteDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountMagicRouteDeleteResponseMessage] +type accountMagicRouteDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteDeleteResponseResult struct { + Deleted bool `json:"deleted"` + DeletedRoutes interface{} `json:"deleted_routes"` + JSON accountMagicRouteDeleteResponseResultJSON `json:"-"` +} + +// accountMagicRouteDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountMagicRouteDeleteResponseResult] +type accountMagicRouteDeleteResponseResultJSON struct { + Deleted apijson.Field + DeletedRoutes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicRouteDeleteResponseSuccess bool + +const ( + AccountMagicRouteDeleteResponseSuccessTrue AccountMagicRouteDeleteResponseSuccess = true +) + +type AccountMagicRouteDeleteManyResponse struct { + Errors []AccountMagicRouteDeleteManyResponseError `json:"errors"` + Messages []AccountMagicRouteDeleteManyResponseMessage `json:"messages"` + Result AccountMagicRouteDeleteManyResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicRouteDeleteManyResponseSuccess `json:"success"` + JSON accountMagicRouteDeleteManyResponseJSON `json:"-"` +} + +// accountMagicRouteDeleteManyResponseJSON contains the JSON metadata for the +// struct [AccountMagicRouteDeleteManyResponse] +type accountMagicRouteDeleteManyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteManyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteDeleteManyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteDeleteManyResponseErrorJSON `json:"-"` +} + +// accountMagicRouteDeleteManyResponseErrorJSON contains the JSON metadata for the +// struct [AccountMagicRouteDeleteManyResponseError] +type accountMagicRouteDeleteManyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteManyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteDeleteManyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteDeleteManyResponseMessageJSON `json:"-"` +} + +// accountMagicRouteDeleteManyResponseMessageJSON contains the JSON metadata for +// the struct [AccountMagicRouteDeleteManyResponseMessage] +type accountMagicRouteDeleteManyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteManyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteDeleteManyResponseResult struct { + Deleted bool `json:"deleted"` + DeletedRoute interface{} `json:"deleted_route"` + JSON accountMagicRouteDeleteManyResponseResultJSON `json:"-"` +} + +// accountMagicRouteDeleteManyResponseResultJSON contains the JSON metadata for the +// struct [AccountMagicRouteDeleteManyResponseResult] +type accountMagicRouteDeleteManyResponseResultJSON struct { + Deleted apijson.Field + DeletedRoute apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteDeleteManyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicRouteDeleteManyResponseSuccess bool + +const ( + AccountMagicRouteDeleteManyResponseSuccessTrue AccountMagicRouteDeleteManyResponseSuccess = true +) + +type AccountMagicRouteMagicStaticRoutesNewRoutesResponse struct { + Errors []AccountMagicRouteMagicStaticRoutesNewRoutesResponseError `json:"errors"` + Messages []AccountMagicRouteMagicStaticRoutesNewRoutesResponseMessage `json:"messages"` + Result AccountMagicRouteMagicStaticRoutesNewRoutesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicRouteMagicStaticRoutesNewRoutesResponseSuccess `json:"success"` + JSON accountMagicRouteMagicStaticRoutesNewRoutesResponseJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesNewRoutesResponseJSON contains the JSON +// metadata for the struct [AccountMagicRouteMagicStaticRoutesNewRoutesResponse] +type accountMagicRouteMagicStaticRoutesNewRoutesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesNewRoutesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesNewRoutesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteMagicStaticRoutesNewRoutesResponseErrorJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesNewRoutesResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountMagicRouteMagicStaticRoutesNewRoutesResponseError] +type accountMagicRouteMagicStaticRoutesNewRoutesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesNewRoutesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesNewRoutesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteMagicStaticRoutesNewRoutesResponseMessageJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesNewRoutesResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountMagicRouteMagicStaticRoutesNewRoutesResponseMessage] +type accountMagicRouteMagicStaticRoutesNewRoutesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesNewRoutesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesNewRoutesResponseResult struct { + Routes []AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoute `json:"routes"` + JSON accountMagicRouteMagicStaticRoutesNewRoutesResponseResultJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesNewRoutesResponseResultJSON contains the JSON +// metadata for the struct +// [AccountMagicRouteMagicStaticRoutesNewRoutesResponseResult] +type accountMagicRouteMagicStaticRoutesNewRoutesResponseResultJSON struct { + Routes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesNewRoutesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoute struct { + // The next-hop IP Address for the static route. + Nexthop string `json:"nexthop,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix string `json:"prefix,required"` + // Priority of the static route. + Priority int64 `json:"priority,required"` + // Identifier + ID string `json:"id"` + // When the route was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional human provided description of the static route. + Description string `json:"description"` + // When the route was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Used only for ECMP routes. + Scope AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoutesScope `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight int64 `json:"weight"` + JSON accountMagicRouteMagicStaticRoutesNewRoutesResponseResultRouteJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesNewRoutesResponseResultRouteJSON contains the +// JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoute] +type accountMagicRouteMagicStaticRoutesNewRoutesResponseResultRouteJSON struct { + Nexthop apijson.Field + Prefix apijson.Field + Priority apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Scope apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Used only for ECMP routes. +type AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoutesScope struct { + // List of colo names for the ECMP scope. + ColoNames []string `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions []string `json:"colo_regions"` + JSON accountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoutesScopeJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoutesScopeJSON +// contains the JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoutesScope] +type accountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoutesScopeJSON struct { + ColoNames apijson.Field + ColoRegions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesNewRoutesResponseResultRoutesScope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicRouteMagicStaticRoutesNewRoutesResponseSuccess bool + +const ( + AccountMagicRouteMagicStaticRoutesNewRoutesResponseSuccessTrue AccountMagicRouteMagicStaticRoutesNewRoutesResponseSuccess = true +) + +type AccountMagicRouteMagicStaticRoutesListRoutesResponse struct { + Errors []AccountMagicRouteMagicStaticRoutesListRoutesResponseError `json:"errors"` + Messages []AccountMagicRouteMagicStaticRoutesListRoutesResponseMessage `json:"messages"` + Result AccountMagicRouteMagicStaticRoutesListRoutesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicRouteMagicStaticRoutesListRoutesResponseSuccess `json:"success"` + JSON accountMagicRouteMagicStaticRoutesListRoutesResponseJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesListRoutesResponseJSON contains the JSON +// metadata for the struct [AccountMagicRouteMagicStaticRoutesListRoutesResponse] +type accountMagicRouteMagicStaticRoutesListRoutesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesListRoutesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesListRoutesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteMagicStaticRoutesListRoutesResponseErrorJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesListRoutesResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountMagicRouteMagicStaticRoutesListRoutesResponseError] +type accountMagicRouteMagicStaticRoutesListRoutesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesListRoutesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesListRoutesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteMagicStaticRoutesListRoutesResponseMessageJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesListRoutesResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesListRoutesResponseMessage] +type accountMagicRouteMagicStaticRoutesListRoutesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesListRoutesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesListRoutesResponseResult struct { + Routes []AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoute `json:"routes"` + JSON accountMagicRouteMagicStaticRoutesListRoutesResponseResultJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesListRoutesResponseResultJSON contains the JSON +// metadata for the struct +// [AccountMagicRouteMagicStaticRoutesListRoutesResponseResult] +type accountMagicRouteMagicStaticRoutesListRoutesResponseResultJSON struct { + Routes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesListRoutesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoute struct { + // The next-hop IP Address for the static route. + Nexthop string `json:"nexthop,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix string `json:"prefix,required"` + // Priority of the static route. + Priority int64 `json:"priority,required"` + // Identifier + ID string `json:"id"` + // When the route was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional human provided description of the static route. + Description string `json:"description"` + // When the route was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Used only for ECMP routes. + Scope AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoutesScope `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight int64 `json:"weight"` + JSON accountMagicRouteMagicStaticRoutesListRoutesResponseResultRouteJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesListRoutesResponseResultRouteJSON contains the +// JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoute] +type accountMagicRouteMagicStaticRoutesListRoutesResponseResultRouteJSON struct { + Nexthop apijson.Field + Prefix apijson.Field + Priority apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Scope apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Used only for ECMP routes. +type AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoutesScope struct { + // List of colo names for the ECMP scope. + ColoNames []string `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions []string `json:"colo_regions"` + JSON accountMagicRouteMagicStaticRoutesListRoutesResponseResultRoutesScopeJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesListRoutesResponseResultRoutesScopeJSON +// contains the JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoutesScope] +type accountMagicRouteMagicStaticRoutesListRoutesResponseResultRoutesScopeJSON struct { + ColoNames apijson.Field + ColoRegions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesListRoutesResponseResultRoutesScope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicRouteMagicStaticRoutesListRoutesResponseSuccess bool + +const ( + AccountMagicRouteMagicStaticRoutesListRoutesResponseSuccessTrue AccountMagicRouteMagicStaticRoutesListRoutesResponseSuccess = true +) + +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponse struct { + Errors []AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseError `json:"errors"` + Messages []AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseMessage `json:"messages"` + Result AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseSuccess `json:"success"` + JSON accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseJSON contains the JSON +// metadata for the struct +// [AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponse] +type accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseErrorJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseError] +type accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseMessageJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseMessage] +type accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResult struct { + Modified bool `json:"modified"` + ModifiedRoutes []AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoute `json:"modified_routes"` + JSON accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultJSON contains +// the JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResult] +type accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultJSON struct { + Modified apijson.Field + ModifiedRoutes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoute struct { + // The next-hop IP Address for the static route. + Nexthop string `json:"nexthop,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix string `json:"prefix,required"` + // Priority of the static route. + Priority int64 `json:"priority,required"` + // Identifier + ID string `json:"id"` + // When the route was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional human provided description of the static route. + Description string `json:"description"` + // When the route was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Used only for ECMP routes. + Scope AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoutesScope `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight int64 `json:"weight"` + JSON accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRouteJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRouteJSON +// contains the JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoute] +type accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRouteJSON struct { + Nexthop apijson.Field + Prefix apijson.Field + Priority apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Scope apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Used only for ECMP routes. +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoutesScope struct { + // List of colo names for the ECMP scope. + ColoNames []string `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions []string `json:"colo_regions"` + JSON accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoutesScopeJSON `json:"-"` +} + +// accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoutesScopeJSON +// contains the JSON metadata for the struct +// [AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoutesScope] +type accountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoutesScopeJSON struct { + ColoNames apijson.Field + ColoRegions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseResultModifiedRoutesScope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseSuccess bool + +const ( + AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseSuccessTrue AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponseSuccess = true +) + +type AccountMagicRouteUpdateParams struct { + // The next-hop IP Address for the static route. + Nexthop param.Field[string] `json:"nexthop,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix param.Field[string] `json:"prefix,required"` + // Priority of the static route. + Priority param.Field[int64] `json:"priority,required"` + // An optional human provided description of the static route. + Description param.Field[string] `json:"description"` + // Used only for ECMP routes. + Scope param.Field[AccountMagicRouteUpdateParamsScope] `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight param.Field[int64] `json:"weight"` +} + +func (r AccountMagicRouteUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Used only for ECMP routes. +type AccountMagicRouteUpdateParamsScope struct { + // List of colo names for the ECMP scope. + ColoNames param.Field[[]string] `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions param.Field[[]string] `json:"colo_regions"` +} + +func (r AccountMagicRouteUpdateParamsScope) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicRouteDeleteParams struct { + Routes param.Field[[]AccountMagicRouteDeleteParamsRoute] `json:"routes,required"` +} + +func (r AccountMagicRouteDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicRouteDeleteParamsRoute struct { +} + +func (r AccountMagicRouteDeleteParamsRoute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicRouteMagicStaticRoutesNewRoutesParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountMagicRouteMagicStaticRoutesNewRoutesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParams struct { + Routes param.Field[[]AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoute] `json:"routes,required"` +} + +func (r AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoute struct { + // An optional human provided description of the static route. + Description param.Field[string] `json:"description"` + // The next-hop IP Address for the static route. + Nexthop param.Field[string] `json:"nexthop"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix param.Field[string] `json:"prefix"` + // Priority of the static route. + Priority param.Field[int64] `json:"priority"` + // Used only for ECMP routes. + Scope param.Field[AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoutesScope] `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight param.Field[int64] `json:"weight"` +} + +func (r AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Used only for ECMP routes. +type AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoutesScope struct { + // List of colo names for the ECMP scope. + ColoNames param.Field[[]string] `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions param.Field[[]string] `json:"colo_regions"` +} + +func (r AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoutesScope) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountmagicroute_test.go b/accountmagicroute_test.go new file mode 100644 index 00000000000..592bffa4a2d --- /dev/null +++ b/accountmagicroute_test.go @@ -0,0 +1,267 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMagicRouteGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.Routes.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMagicRouteUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.Routes.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicRouteUpdateParams{ + Nexthop: cloudflare.F("203.0.113.1"), + Prefix: cloudflare.F("192.0.2.0/24"), + Priority: cloudflare.F(int64(0)), + Description: cloudflare.F("New route for new prefix 203.0.113.1"), + Scope: cloudflare.F(cloudflare.AccountMagicRouteUpdateParamsScope{ + ColoNames: cloudflare.F([]string{"den01", "den01", "den01"}), + ColoRegions: cloudflare.F([]string{"APAC", "APAC", "APAC"}), + }), + Weight: cloudflare.F(int64(0)), + }, + ) + 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 TestAccountMagicRouteDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.Routes.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicRouteDeleteParams{ + Routes: cloudflare.F([]cloudflare.AccountMagicRouteDeleteParamsRoute{{}, {}, {}}), + }, + ) + 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 TestAccountMagicRouteDeleteMany(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.Routes.DeleteMany( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMagicRouteMagicStaticRoutesNewRoutes(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.Routes.MagicStaticRoutesNewRoutes( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicRouteMagicStaticRoutesNewRoutesParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountMagicRouteMagicStaticRoutesListRoutes(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.Routes.MagicStaticRoutesListRoutes(context.TODO(), "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()) + } +} + +func TestAccountMagicRouteMagicStaticRoutesUpdateManyRoutes(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Magic.Routes.MagicStaticRoutesUpdateManyRoutes( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParams{ + Routes: cloudflare.F([]cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoute{{ + Description: cloudflare.F("New route for new prefix 203.0.113.1"), + Nexthop: cloudflare.F("203.0.113.1"), + Prefix: cloudflare.F("192.0.2.0/24"), + Priority: cloudflare.F(int64(0)), + Scope: cloudflare.F(cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoutesScope{ + ColoNames: cloudflare.F([]string{"den01", "den01", "den01"}), + ColoRegions: cloudflare.F([]string{"APAC", "APAC", "APAC"}), + }), + Weight: cloudflare.F(int64(0)), + }, { + Description: cloudflare.F("New route for new prefix 203.0.113.1"), + Nexthop: cloudflare.F("203.0.113.1"), + Prefix: cloudflare.F("192.0.2.0/24"), + Priority: cloudflare.F(int64(0)), + Scope: cloudflare.F(cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoutesScope{ + ColoNames: cloudflare.F([]string{"den01", "den01", "den01"}), + ColoRegions: cloudflare.F([]string{"APAC", "APAC", "APAC"}), + }), + Weight: cloudflare.F(int64(0)), + }, { + Description: cloudflare.F("New route for new prefix 203.0.113.1"), + Nexthop: cloudflare.F("203.0.113.1"), + Prefix: cloudflare.F("192.0.2.0/24"), + Priority: cloudflare.F(int64(0)), + Scope: cloudflare.F(cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParamsRoutesScope{ + ColoNames: cloudflare.F([]string{"den01", "den01", "den01"}), + ColoRegions: cloudflare.F([]string{"APAC", "APAC", "APAC"}), + }), + Weight: cloudflare.F(int64(0)), + }}), + }, + ) + 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/accountmember.go b/accountmember.go new file mode 100644 index 00000000000..c58a37392b3 --- /dev/null +++ b/accountmember.go @@ -0,0 +1,1732 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMemberService 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 [NewAccountMemberService] method +// instead. +type AccountMemberService struct { + Options []option.RequestOption +} + +// NewAccountMemberService 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 NewAccountMemberService(opts ...option.RequestOption) (r *AccountMemberService) { + r = &AccountMemberService{} + r.Options = opts + return +} + +// Get information about a specific member of an account. +func (r *AccountMemberService) Get(ctx context.Context, accountIdentifier interface{}, identifier string, opts ...option.RequestOption) (res *AccountMemberGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/members/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify an account member. +func (r *AccountMemberService) Update(ctx context.Context, accountIdentifier interface{}, identifier string, body AccountMemberUpdateParams, opts ...option.RequestOption) (res *AccountMemberUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/members/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Remove a member from an account. +func (r *AccountMemberService) Delete(ctx context.Context, accountIdentifier interface{}, identifier string, opts ...option.RequestOption) (res *AccountMemberDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/members/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Add a user to the list of members for this account. +func (r *AccountMemberService) AccountMembersAddMember(ctx context.Context, accountIdentifier interface{}, body AccountMemberAccountMembersAddMemberParams, opts ...option.RequestOption) (res *AccountMemberAccountMembersAddMemberResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/members", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all members of an account. +func (r *AccountMemberService) AccountMembersListMembers(ctx context.Context, accountIdentifier interface{}, query AccountMemberAccountMembersListMembersParams, opts ...option.RequestOption) (res *shared.Page[AccountMemberAccountMembersListMembersResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%v/members", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountMemberGetResponse struct { + Errors []AccountMemberGetResponseError `json:"errors"` + Messages []AccountMemberGetResponseMessage `json:"messages"` + Result AccountMemberGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMemberGetResponseSuccess `json:"success"` + JSON accountMemberGetResponseJSON `json:"-"` +} + +// accountMemberGetResponseJSON contains the JSON metadata for the struct +// [AccountMemberGetResponse] +type accountMemberGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberGetResponseErrorJSON `json:"-"` +} + +// accountMemberGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountMemberGetResponseError] +type accountMemberGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberGetResponseMessageJSON `json:"-"` +} + +// accountMemberGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountMemberGetResponseMessage] +type accountMemberGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResult struct { + // Membership identifier tag. + ID string `json:"id,required"` + // Roles assigned to this member. + Roles []AccountMemberGetResponseResultRole `json:"roles,required"` + Status interface{} `json:"status,required"` + User AccountMemberGetResponseResultUser `json:"user,required"` + JSON accountMemberGetResponseResultJSON `json:"-"` +} + +// accountMemberGetResponseResultJSON contains the JSON metadata for the struct +// [AccountMemberGetResponseResult] +type accountMemberGetResponseResultJSON struct { + ID apijson.Field + Roles apijson.Field + Status apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role name. + Name string `json:"name,required"` + Permissions AccountMemberGetResponseResultRolesPermissions `json:"permissions,required"` + JSON accountMemberGetResponseResultRoleJSON `json:"-"` +} + +// accountMemberGetResponseResultRoleJSON contains the JSON metadata for the struct +// [AccountMemberGetResponseResultRole] +type accountMemberGetResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissions struct { + Analytics AccountMemberGetResponseResultRolesPermissionsAnalytics `json:"analytics"` + Billing AccountMemberGetResponseResultRolesPermissionsBilling `json:"billing"` + CachePurge AccountMemberGetResponseResultRolesPermissionsCachePurge `json:"cache_purge"` + DNS AccountMemberGetResponseResultRolesPermissionsDNS `json:"dns"` + DNSRecords AccountMemberGetResponseResultRolesPermissionsDNSRecords `json:"dns_records"` + Lb AccountMemberGetResponseResultRolesPermissionsLb `json:"lb"` + Logs AccountMemberGetResponseResultRolesPermissionsLogs `json:"logs"` + Organization AccountMemberGetResponseResultRolesPermissionsOrganization `json:"organization"` + Ssl AccountMemberGetResponseResultRolesPermissionsSsl `json:"ssl"` + Waf AccountMemberGetResponseResultRolesPermissionsWaf `json:"waf"` + ZoneSettings AccountMemberGetResponseResultRolesPermissionsZoneSettings `json:"zone_settings"` + Zones AccountMemberGetResponseResultRolesPermissionsZones `json:"zones"` + JSON accountMemberGetResponseResultRolesPermissionsJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsJSON contains the JSON metadata +// for the struct [AccountMemberGetResponseResultRolesPermissions] +type accountMemberGetResponseResultRolesPermissionsJSON struct { + Analytics apijson.Field + Billing apijson.Field + CachePurge apijson.Field + DNS apijson.Field + DNSRecords apijson.Field + Lb apijson.Field + Logs apijson.Field + Organization apijson.Field + Ssl apijson.Field + Waf apijson.Field + ZoneSettings apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsAnalytics struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsAnalyticsJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsAnalyticsJSON contains the JSON +// metadata for the struct +// [AccountMemberGetResponseResultRolesPermissionsAnalytics] +type accountMemberGetResponseResultRolesPermissionsAnalyticsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsAnalytics) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsBilling struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsBillingJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsBillingJSON contains the JSON +// metadata for the struct [AccountMemberGetResponseResultRolesPermissionsBilling] +type accountMemberGetResponseResultRolesPermissionsBillingJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsBilling) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsCachePurge struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsCachePurgeJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsCachePurgeJSON contains the JSON +// metadata for the struct +// [AccountMemberGetResponseResultRolesPermissionsCachePurge] +type accountMemberGetResponseResultRolesPermissionsCachePurgeJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsCachePurge) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsDNS struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsDNSJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsDNSJSON contains the JSON metadata +// for the struct [AccountMemberGetResponseResultRolesPermissionsDNS] +type accountMemberGetResponseResultRolesPermissionsDNSJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsDNS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsDNSRecords struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsDNSRecordsJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsDNSRecordsJSON contains the JSON +// metadata for the struct +// [AccountMemberGetResponseResultRolesPermissionsDNSRecords] +type accountMemberGetResponseResultRolesPermissionsDNSRecordsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsDNSRecords) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsLb struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsLbJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsLbJSON contains the JSON metadata +// for the struct [AccountMemberGetResponseResultRolesPermissionsLb] +type accountMemberGetResponseResultRolesPermissionsLbJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsLb) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsLogs struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsLogsJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsLogsJSON contains the JSON +// metadata for the struct [AccountMemberGetResponseResultRolesPermissionsLogs] +type accountMemberGetResponseResultRolesPermissionsLogsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsLogs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsOrganization struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsOrganizationJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsOrganizationJSON contains the JSON +// metadata for the struct +// [AccountMemberGetResponseResultRolesPermissionsOrganization] +type accountMemberGetResponseResultRolesPermissionsOrganizationJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsSsl struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsSslJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsSslJSON contains the JSON metadata +// for the struct [AccountMemberGetResponseResultRolesPermissionsSsl] +type accountMemberGetResponseResultRolesPermissionsSslJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsWaf struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsWafJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsWafJSON contains the JSON metadata +// for the struct [AccountMemberGetResponseResultRolesPermissionsWaf] +type accountMemberGetResponseResultRolesPermissionsWafJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsWaf) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsZoneSettings struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsZoneSettingsJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsZoneSettingsJSON contains the JSON +// metadata for the struct +// [AccountMemberGetResponseResultRolesPermissionsZoneSettings] +type accountMemberGetResponseResultRolesPermissionsZoneSettingsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsZoneSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultRolesPermissionsZones struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberGetResponseResultRolesPermissionsZonesJSON `json:"-"` +} + +// accountMemberGetResponseResultRolesPermissionsZonesJSON contains the JSON +// metadata for the struct [AccountMemberGetResponseResultRolesPermissionsZones] +type accountMemberGetResponseResultRolesPermissionsZonesJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultRolesPermissionsZones) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberGetResponseResultUser struct { + // The contact email address of the user. + Email string `json:"email,required"` + // Identifier + ID string `json:"id"` + // User's first name + FirstName string `json:"first_name,nullable"` + // User's last name + LastName string `json:"last_name,nullable"` + // Indicates whether two-factor authentication is enabled for the user account. + // Does not apply to API authentication. + TwoFactorAuthenticationEnabled bool `json:"two_factor_authentication_enabled"` + JSON accountMemberGetResponseResultUserJSON `json:"-"` +} + +// accountMemberGetResponseResultUserJSON contains the JSON metadata for the struct +// [AccountMemberGetResponseResultUser] +type accountMemberGetResponseResultUserJSON struct { + Email apijson.Field + ID apijson.Field + FirstName apijson.Field + LastName apijson.Field + TwoFactorAuthenticationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberGetResponseResultUser) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMemberGetResponseSuccess bool + +const ( + AccountMemberGetResponseSuccessTrue AccountMemberGetResponseSuccess = true +) + +type AccountMemberUpdateResponse struct { + Errors []AccountMemberUpdateResponseError `json:"errors"` + Messages []AccountMemberUpdateResponseMessage `json:"messages"` + Result AccountMemberUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMemberUpdateResponseSuccess `json:"success"` + JSON accountMemberUpdateResponseJSON `json:"-"` +} + +// accountMemberUpdateResponseJSON contains the JSON metadata for the struct +// [AccountMemberUpdateResponse] +type accountMemberUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberUpdateResponseErrorJSON `json:"-"` +} + +// accountMemberUpdateResponseErrorJSON contains the JSON metadata for the struct +// [AccountMemberUpdateResponseError] +type accountMemberUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberUpdateResponseMessageJSON `json:"-"` +} + +// accountMemberUpdateResponseMessageJSON contains the JSON metadata for the struct +// [AccountMemberUpdateResponseMessage] +type accountMemberUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResult struct { + // Membership identifier tag. + ID string `json:"id,required"` + // Roles assigned to this member. + Roles []AccountMemberUpdateResponseResultRole `json:"roles,required"` + Status interface{} `json:"status,required"` + User AccountMemberUpdateResponseResultUser `json:"user,required"` + JSON accountMemberUpdateResponseResultJSON `json:"-"` +} + +// accountMemberUpdateResponseResultJSON contains the JSON metadata for the struct +// [AccountMemberUpdateResponseResult] +type accountMemberUpdateResponseResultJSON struct { + ID apijson.Field + Roles apijson.Field + Status apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role name. + Name string `json:"name,required"` + Permissions AccountMemberUpdateResponseResultRolesPermissions `json:"permissions,required"` + JSON accountMemberUpdateResponseResultRoleJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRoleJSON contains the JSON metadata for the +// struct [AccountMemberUpdateResponseResultRole] +type accountMemberUpdateResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissions struct { + Analytics AccountMemberUpdateResponseResultRolesPermissionsAnalytics `json:"analytics"` + Billing AccountMemberUpdateResponseResultRolesPermissionsBilling `json:"billing"` + CachePurge AccountMemberUpdateResponseResultRolesPermissionsCachePurge `json:"cache_purge"` + DNS AccountMemberUpdateResponseResultRolesPermissionsDNS `json:"dns"` + DNSRecords AccountMemberUpdateResponseResultRolesPermissionsDNSRecords `json:"dns_records"` + Lb AccountMemberUpdateResponseResultRolesPermissionsLb `json:"lb"` + Logs AccountMemberUpdateResponseResultRolesPermissionsLogs `json:"logs"` + Organization AccountMemberUpdateResponseResultRolesPermissionsOrganization `json:"organization"` + Ssl AccountMemberUpdateResponseResultRolesPermissionsSsl `json:"ssl"` + Waf AccountMemberUpdateResponseResultRolesPermissionsWaf `json:"waf"` + ZoneSettings AccountMemberUpdateResponseResultRolesPermissionsZoneSettings `json:"zone_settings"` + Zones AccountMemberUpdateResponseResultRolesPermissionsZones `json:"zones"` + JSON accountMemberUpdateResponseResultRolesPermissionsJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsJSON contains the JSON metadata +// for the struct [AccountMemberUpdateResponseResultRolesPermissions] +type accountMemberUpdateResponseResultRolesPermissionsJSON struct { + Analytics apijson.Field + Billing apijson.Field + CachePurge apijson.Field + DNS apijson.Field + DNSRecords apijson.Field + Lb apijson.Field + Logs apijson.Field + Organization apijson.Field + Ssl apijson.Field + Waf apijson.Field + ZoneSettings apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsAnalytics struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsAnalyticsJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsAnalyticsJSON contains the JSON +// metadata for the struct +// [AccountMemberUpdateResponseResultRolesPermissionsAnalytics] +type accountMemberUpdateResponseResultRolesPermissionsAnalyticsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsAnalytics) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsBilling struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsBillingJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsBillingJSON contains the JSON +// metadata for the struct +// [AccountMemberUpdateResponseResultRolesPermissionsBilling] +type accountMemberUpdateResponseResultRolesPermissionsBillingJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsBilling) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsCachePurge struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsCachePurgeJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsCachePurgeJSON contains the +// JSON metadata for the struct +// [AccountMemberUpdateResponseResultRolesPermissionsCachePurge] +type accountMemberUpdateResponseResultRolesPermissionsCachePurgeJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsCachePurge) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsDNS struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsDNSJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsDNSJSON contains the JSON +// metadata for the struct [AccountMemberUpdateResponseResultRolesPermissionsDNS] +type accountMemberUpdateResponseResultRolesPermissionsDNSJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsDNS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsDNSRecords struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsDNSRecordsJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsDNSRecordsJSON contains the +// JSON metadata for the struct +// [AccountMemberUpdateResponseResultRolesPermissionsDNSRecords] +type accountMemberUpdateResponseResultRolesPermissionsDNSRecordsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsDNSRecords) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsLb struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsLbJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsLbJSON contains the JSON +// metadata for the struct [AccountMemberUpdateResponseResultRolesPermissionsLb] +type accountMemberUpdateResponseResultRolesPermissionsLbJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsLb) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsLogs struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsLogsJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsLogsJSON contains the JSON +// metadata for the struct [AccountMemberUpdateResponseResultRolesPermissionsLogs] +type accountMemberUpdateResponseResultRolesPermissionsLogsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsLogs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsOrganization struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsOrganizationJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsOrganizationJSON contains the +// JSON metadata for the struct +// [AccountMemberUpdateResponseResultRolesPermissionsOrganization] +type accountMemberUpdateResponseResultRolesPermissionsOrganizationJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsSsl struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsSslJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsSslJSON contains the JSON +// metadata for the struct [AccountMemberUpdateResponseResultRolesPermissionsSsl] +type accountMemberUpdateResponseResultRolesPermissionsSslJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsWaf struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsWafJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsWafJSON contains the JSON +// metadata for the struct [AccountMemberUpdateResponseResultRolesPermissionsWaf] +type accountMemberUpdateResponseResultRolesPermissionsWafJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsWaf) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsZoneSettings struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsZoneSettingsJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsZoneSettingsJSON contains the +// JSON metadata for the struct +// [AccountMemberUpdateResponseResultRolesPermissionsZoneSettings] +type accountMemberUpdateResponseResultRolesPermissionsZoneSettingsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsZoneSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultRolesPermissionsZones struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberUpdateResponseResultRolesPermissionsZonesJSON `json:"-"` +} + +// accountMemberUpdateResponseResultRolesPermissionsZonesJSON contains the JSON +// metadata for the struct [AccountMemberUpdateResponseResultRolesPermissionsZones] +type accountMemberUpdateResponseResultRolesPermissionsZonesJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultRolesPermissionsZones) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberUpdateResponseResultUser struct { + // The contact email address of the user. + Email string `json:"email,required"` + // Identifier + ID string `json:"id"` + // User's first name + FirstName string `json:"first_name,nullable"` + // User's last name + LastName string `json:"last_name,nullable"` + // Indicates whether two-factor authentication is enabled for the user account. + // Does not apply to API authentication. + TwoFactorAuthenticationEnabled bool `json:"two_factor_authentication_enabled"` + JSON accountMemberUpdateResponseResultUserJSON `json:"-"` +} + +// accountMemberUpdateResponseResultUserJSON contains the JSON metadata for the +// struct [AccountMemberUpdateResponseResultUser] +type accountMemberUpdateResponseResultUserJSON struct { + Email apijson.Field + ID apijson.Field + FirstName apijson.Field + LastName apijson.Field + TwoFactorAuthenticationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberUpdateResponseResultUser) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMemberUpdateResponseSuccess bool + +const ( + AccountMemberUpdateResponseSuccessTrue AccountMemberUpdateResponseSuccess = true +) + +type AccountMemberDeleteResponse struct { + Errors []AccountMemberDeleteResponseError `json:"errors"` + Messages []AccountMemberDeleteResponseMessage `json:"messages"` + Result AccountMemberDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountMemberDeleteResponseSuccess `json:"success"` + JSON accountMemberDeleteResponseJSON `json:"-"` +} + +// accountMemberDeleteResponseJSON contains the JSON metadata for the struct +// [AccountMemberDeleteResponse] +type accountMemberDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberDeleteResponseErrorJSON `json:"-"` +} + +// accountMemberDeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountMemberDeleteResponseError] +type accountMemberDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberDeleteResponseMessageJSON `json:"-"` +} + +// accountMemberDeleteResponseMessageJSON contains the JSON metadata for the struct +// [AccountMemberDeleteResponseMessage] +type accountMemberDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON accountMemberDeleteResponseResultJSON `json:"-"` +} + +// accountMemberDeleteResponseResultJSON contains the JSON metadata for the struct +// [AccountMemberDeleteResponseResult] +type accountMemberDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMemberDeleteResponseSuccess bool + +const ( + AccountMemberDeleteResponseSuccessTrue AccountMemberDeleteResponseSuccess = true +) + +type AccountMemberAccountMembersAddMemberResponse struct { + Errors []AccountMemberAccountMembersAddMemberResponseError `json:"errors"` + Messages []AccountMemberAccountMembersAddMemberResponseMessage `json:"messages"` + Result AccountMemberAccountMembersAddMemberResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMemberAccountMembersAddMemberResponseSuccess `json:"success"` + JSON accountMemberAccountMembersAddMemberResponseJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseJSON contains the JSON metadata for +// the struct [AccountMemberAccountMembersAddMemberResponse] +type accountMemberAccountMembersAddMemberResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberAccountMembersAddMemberResponseErrorJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseErrorJSON contains the JSON metadata +// for the struct [AccountMemberAccountMembersAddMemberResponseError] +type accountMemberAccountMembersAddMemberResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMemberAccountMembersAddMemberResponseMessageJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseMessageJSON contains the JSON +// metadata for the struct [AccountMemberAccountMembersAddMemberResponseMessage] +type accountMemberAccountMembersAddMemberResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResult struct { + // Membership identifier tag. + ID string `json:"id"` + // The unique activation code for the account membership. + Code string `json:"code"` + // Roles assigned to this member. + Roles []AccountMemberAccountMembersAddMemberResponseResultRole `json:"roles"` + Status interface{} `json:"status"` + User AccountMemberAccountMembersAddMemberResponseResultUser `json:"user"` + JSON accountMemberAccountMembersAddMemberResponseResultJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultJSON contains the JSON +// metadata for the struct [AccountMemberAccountMembersAddMemberResponseResult] +type accountMemberAccountMembersAddMemberResponseResultJSON struct { + ID apijson.Field + Code apijson.Field + Roles apijson.Field + Status apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role name. + Name string `json:"name,required"` + Permissions AccountMemberAccountMembersAddMemberResponseResultRolesPermissions `json:"permissions,required"` + JSON accountMemberAccountMembersAddMemberResponseResultRoleJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRoleJSON contains the JSON +// metadata for the struct [AccountMemberAccountMembersAddMemberResponseResultRole] +type accountMemberAccountMembersAddMemberResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissions struct { + Analytics AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsAnalytics `json:"analytics"` + Billing AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsBilling `json:"billing"` + CachePurge AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsCachePurge `json:"cache_purge"` + DNS AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNS `json:"dns"` + DNSRecords AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSRecords `json:"dns_records"` + Lb AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLb `json:"lb"` + Logs AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLogs `json:"logs"` + Organization AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsOrganization `json:"organization"` + Ssl AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsSsl `json:"ssl"` + Waf AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsWaf `json:"waf"` + ZoneSettings AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZoneSettings `json:"zone_settings"` + Zones AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZones `json:"zones"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsJSON contains +// the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissions] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsJSON struct { + Analytics apijson.Field + Billing apijson.Field + CachePurge apijson.Field + DNS apijson.Field + DNSRecords apijson.Field + Lb apijson.Field + Logs apijson.Field + Organization apijson.Field + Ssl apijson.Field + Waf apijson.Field + ZoneSettings apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsAnalytics struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsAnalyticsJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsAnalyticsJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsAnalytics] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsAnalyticsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsAnalytics) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsBilling struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsBillingJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsBillingJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsBilling] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsBillingJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsBilling) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsCachePurge struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsCachePurgeJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsCachePurgeJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsCachePurge] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsCachePurgeJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsCachePurge) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNS struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNS] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSRecords struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSRecordsJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSRecordsJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSRecords] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSRecordsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsDNSRecords) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLb struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsLbJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsLbJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLb] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsLbJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLb) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLogs struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsLogsJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsLogsJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLogs] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsLogsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsLogs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsOrganization struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsOrganizationJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsOrganizationJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsOrganization] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsOrganizationJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsSsl struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsSslJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsSslJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsSsl] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsSslJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsWaf struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsWafJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsWafJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsWaf] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsWafJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsWaf) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZoneSettings struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsZoneSettingsJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsZoneSettingsJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZoneSettings] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsZoneSettingsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZoneSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZones struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON accountMemberAccountMembersAddMemberResponseResultRolesPermissionsZonesJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultRolesPermissionsZonesJSON +// contains the JSON metadata for the struct +// [AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZones] +type accountMemberAccountMembersAddMemberResponseResultRolesPermissionsZonesJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultRolesPermissionsZones) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersAddMemberResponseResultUser struct { + // The contact email address of the user. + Email string `json:"email,required"` + // Identifier + ID string `json:"id"` + // User's first name + FirstName string `json:"first_name,nullable"` + // User's last name + LastName string `json:"last_name,nullable"` + // Indicates whether two-factor authentication is enabled for the user account. + // Does not apply to API authentication. + TwoFactorAuthenticationEnabled bool `json:"two_factor_authentication_enabled"` + JSON accountMemberAccountMembersAddMemberResponseResultUserJSON `json:"-"` +} + +// accountMemberAccountMembersAddMemberResponseResultUserJSON contains the JSON +// metadata for the struct [AccountMemberAccountMembersAddMemberResponseResultUser] +type accountMemberAccountMembersAddMemberResponseResultUserJSON struct { + Email apijson.Field + ID apijson.Field + FirstName apijson.Field + LastName apijson.Field + TwoFactorAuthenticationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersAddMemberResponseResultUser) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMemberAccountMembersAddMemberResponseSuccess bool + +const ( + AccountMemberAccountMembersAddMemberResponseSuccessTrue AccountMemberAccountMembersAddMemberResponseSuccess = true +) + +type AccountMemberAccountMembersListMembersResponse struct { + // Identifier + ID string `json:"id,required"` + // The contact email address of the user. + Email string `json:"email,required"` + // Member Name. + Name string `json:"name,required,nullable"` + // Roles assigned to this Member. + Roles []AccountMemberAccountMembersListMembersResponseRole `json:"roles,required"` + // A member's status in the organization. + Status AccountMemberAccountMembersListMembersResponseStatus `json:"status,required"` + JSON accountMemberAccountMembersListMembersResponseJSON `json:"-"` +} + +// accountMemberAccountMembersListMembersResponseJSON contains the JSON metadata +// for the struct [AccountMemberAccountMembersListMembersResponse] +type accountMemberAccountMembersListMembersResponseJSON struct { + ID apijson.Field + Email apijson.Field + Name apijson.Field + Roles apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersListMembersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMemberAccountMembersListMembersResponseRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role Name. + Name string `json:"name,required"` + // Access permissions for this User. + Permissions []string `json:"permissions,required"` + JSON accountMemberAccountMembersListMembersResponseRoleJSON `json:"-"` +} + +// accountMemberAccountMembersListMembersResponseRoleJSON contains the JSON +// metadata for the struct [AccountMemberAccountMembersListMembersResponseRole] +type accountMemberAccountMembersListMembersResponseRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMemberAccountMembersListMembersResponseRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A member's status in the organization. +type AccountMemberAccountMembersListMembersResponseStatus string + +const ( + AccountMemberAccountMembersListMembersResponseStatusAccepted AccountMemberAccountMembersListMembersResponseStatus = "accepted" + AccountMemberAccountMembersListMembersResponseStatusInvited AccountMemberAccountMembersListMembersResponseStatus = "invited" +) + +type AccountMemberUpdateParams struct { + // Roles assigned to this member. + Roles param.Field[[]AccountMemberUpdateParamsRole] `json:"roles,required"` +} + +func (r AccountMemberUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRole struct { + // Role identifier tag. + ID param.Field[string] `json:"id,required"` + Permissions param.Field[AccountMemberUpdateParamsRolesPermissions] `json:"permissions,required"` +} + +func (r AccountMemberUpdateParamsRole) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissions struct { + Analytics param.Field[AccountMemberUpdateParamsRolesPermissionsAnalytics] `json:"analytics"` + Billing param.Field[AccountMemberUpdateParamsRolesPermissionsBilling] `json:"billing"` + CachePurge param.Field[AccountMemberUpdateParamsRolesPermissionsCachePurge] `json:"cache_purge"` + DNS param.Field[AccountMemberUpdateParamsRolesPermissionsDNS] `json:"dns"` + DNSRecords param.Field[AccountMemberUpdateParamsRolesPermissionsDNSRecords] `json:"dns_records"` + Lb param.Field[AccountMemberUpdateParamsRolesPermissionsLb] `json:"lb"` + Logs param.Field[AccountMemberUpdateParamsRolesPermissionsLogs] `json:"logs"` + Organization param.Field[AccountMemberUpdateParamsRolesPermissionsOrganization] `json:"organization"` + Ssl param.Field[AccountMemberUpdateParamsRolesPermissionsSsl] `json:"ssl"` + Waf param.Field[AccountMemberUpdateParamsRolesPermissionsWaf] `json:"waf"` + ZoneSettings param.Field[AccountMemberUpdateParamsRolesPermissionsZoneSettings] `json:"zone_settings"` + Zones param.Field[AccountMemberUpdateParamsRolesPermissionsZones] `json:"zones"` +} + +func (r AccountMemberUpdateParamsRolesPermissions) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsAnalytics struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsAnalytics) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsBilling struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsBilling) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsCachePurge struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsCachePurge) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsDNS struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsDNS) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsDNSRecords struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsDNSRecords) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsLb struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsLb) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsLogs struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsLogs) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsOrganization struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsSsl struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsSsl) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsWaf struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsWaf) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsZoneSettings struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsZoneSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberUpdateParamsRolesPermissionsZones struct { + Read param.Field[bool] `json:"read"` + Write param.Field[bool] `json:"write"` +} + +func (r AccountMemberUpdateParamsRolesPermissionsZones) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberAccountMembersAddMemberParams struct { + // The contact email address of the user. + Email param.Field[string] `json:"email,required"` + // Array of roles associated with this member. + Roles param.Field[[]string] `json:"roles,required"` + Status param.Field[AccountMemberAccountMembersAddMemberParamsStatus] `json:"status"` +} + +func (r AccountMemberAccountMembersAddMemberParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountMemberAccountMembersAddMemberParamsStatus string + +const ( + AccountMemberAccountMembersAddMemberParamsStatusAccepted AccountMemberAccountMembersAddMemberParamsStatus = "accepted" + AccountMemberAccountMembersAddMemberParamsStatusPending AccountMemberAccountMembersAddMemberParamsStatus = "pending" +) + +type AccountMemberAccountMembersListMembersParams struct { + // Direction to order results. + Direction param.Field[AccountMemberAccountMembersListMembersParamsDirection] `query:"direction"` + // Field to order results by. + Order param.Field[AccountMemberAccountMembersListMembersParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[float64] `query:"per_page"` + // A member's status in the account. + Status param.Field[AccountMemberAccountMembersListMembersParamsStatus] `query:"status"` +} + +// URLQuery serializes [AccountMemberAccountMembersListMembersParams]'s query +// parameters as `url.Values`. +func (r AccountMemberAccountMembersListMembersParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order results. +type AccountMemberAccountMembersListMembersParamsDirection string + +const ( + AccountMemberAccountMembersListMembersParamsDirectionAsc AccountMemberAccountMembersListMembersParamsDirection = "asc" + AccountMemberAccountMembersListMembersParamsDirectionDesc AccountMemberAccountMembersListMembersParamsDirection = "desc" +) + +// Field to order results by. +type AccountMemberAccountMembersListMembersParamsOrder string + +const ( + AccountMemberAccountMembersListMembersParamsOrderUserFirstName AccountMemberAccountMembersListMembersParamsOrder = "user.first_name" + AccountMemberAccountMembersListMembersParamsOrderUserLastName AccountMemberAccountMembersListMembersParamsOrder = "user.last_name" + AccountMemberAccountMembersListMembersParamsOrderUserEmail AccountMemberAccountMembersListMembersParamsOrder = "user.email" + AccountMemberAccountMembersListMembersParamsOrderStatus AccountMemberAccountMembersListMembersParamsOrder = "status" +) + +// A member's status in the account. +type AccountMemberAccountMembersListMembersParamsStatus string + +const ( + AccountMemberAccountMembersListMembersParamsStatusAccepted AccountMemberAccountMembersListMembersParamsStatus = "accepted" + AccountMemberAccountMembersListMembersParamsStatusPending AccountMemberAccountMembersListMembersParamsStatus = "pending" + AccountMemberAccountMembersListMembersParamsStatusRejected AccountMemberAccountMembersListMembersParamsStatus = "rejected" +) diff --git a/accountmember_test.go b/accountmember_test.go new file mode 100644 index 00000000000..e0a54ff1fe8 --- /dev/null +++ b/accountmember_test.go @@ -0,0 +1,333 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMemberGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Members.Get( + context.TODO(), + map[string]interface{}{}, + "4536bcfad5faccb111b47003c79917fa", + ) + 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 TestAccountMemberUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Members.Update( + context.TODO(), + map[string]interface{}{}, + "4536bcfad5faccb111b47003c79917fa", + cloudflare.AccountMemberUpdateParams{ + Roles: cloudflare.F([]cloudflare.AccountMemberUpdateParamsRole{{ + ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), + Permissions: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissions{ + Analytics: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsAnalytics{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Billing: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsBilling{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + CachePurge: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsCachePurge{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + DNS: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsDNS{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + DNSRecords: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsDNSRecords{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Lb: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsLb{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Logs: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsLogs{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Organization: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsOrganization{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Ssl: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsSsl{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Waf: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsWaf{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + ZoneSettings: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsZoneSettings{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Zones: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsZones{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + }), + }, { + ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), + Permissions: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissions{ + Analytics: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsAnalytics{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Billing: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsBilling{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + CachePurge: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsCachePurge{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + DNS: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsDNS{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + DNSRecords: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsDNSRecords{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Lb: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsLb{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Logs: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsLogs{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Organization: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsOrganization{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Ssl: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsSsl{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Waf: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsWaf{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + ZoneSettings: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsZoneSettings{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Zones: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsZones{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + }), + }, { + ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), + Permissions: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissions{ + Analytics: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsAnalytics{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Billing: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsBilling{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + CachePurge: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsCachePurge{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + DNS: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsDNS{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + DNSRecords: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsDNSRecords{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Lb: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsLb{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Logs: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsLogs{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Organization: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsOrganization{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Ssl: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsSsl{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Waf: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsWaf{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + ZoneSettings: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsZoneSettings{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + Zones: cloudflare.F(cloudflare.AccountMemberUpdateParamsRolesPermissionsZones{ + Read: cloudflare.F(true), + Write: cloudflare.F(false), + }), + }), + }}), + }, + ) + 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 TestAccountMemberDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Members.Delete( + context.TODO(), + map[string]interface{}{}, + "4536bcfad5faccb111b47003c79917fa", + ) + 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 TestAccountMemberAccountMembersAddMemberWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Members.AccountMembersAddMember( + context.TODO(), + map[string]interface{}{}, + cloudflare.AccountMemberAccountMembersAddMemberParams{ + Email: cloudflare.F("user@example.com"), + Roles: cloudflare.F([]string{"3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb"}), + Status: cloudflare.F(cloudflare.AccountMemberAccountMembersAddMemberParamsStatusAccepted), + }, + ) + 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 TestAccountMemberAccountMembersListMembersWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Members.AccountMembersListMembers( + context.TODO(), + map[string]interface{}{}, + cloudflare.AccountMemberAccountMembersListMembersParams{ + Direction: cloudflare.F(cloudflare.AccountMemberAccountMembersListMembersParamsDirectionDesc), + Order: cloudflare.F(cloudflare.AccountMemberAccountMembersListMembersParamsOrderStatus), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Status: cloudflare.F(cloudflare.AccountMemberAccountMembersListMembersParamsStatusAccepted), + }, + ) + 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/accountmnm.go b/accountmnm.go new file mode 100644 index 00000000000..e89887ba98d --- /dev/null +++ b/accountmnm.go @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMnmService 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 [NewAccountMnmService] method instead. +type AccountMnmService struct { + Options []option.RequestOption + Configs *AccountMnmConfigService + Rules *AccountMnmRuleService +} + +// NewAccountMnmService 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 NewAccountMnmService(opts ...option.RequestOption) (r *AccountMnmService) { + r = &AccountMnmService{} + r.Options = opts + r.Configs = NewAccountMnmConfigService(opts...) + r.Rules = NewAccountMnmRuleService(opts...) + return +} diff --git a/accountmnmconfig.go b/accountmnmconfig.go new file mode 100644 index 00000000000..645842e4b20 --- /dev/null +++ b/accountmnmconfig.go @@ -0,0 +1,555 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMnmConfigService 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 [NewAccountMnmConfigService] method +// instead. +type AccountMnmConfigService struct { + Options []option.RequestOption + Fulls *AccountMnmConfigFullService +} + +// NewAccountMnmConfigService 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 NewAccountMnmConfigService(opts ...option.RequestOption) (r *AccountMnmConfigService) { + r = &AccountMnmConfigService{} + r.Options = opts + r.Fulls = NewAccountMnmConfigFullService(opts...) + return +} + +// Delete an existing network monitoring configuration. +func (r *AccountMnmConfigService) Delete(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmConfigDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new network monitoring configuration. +func (r *AccountMnmConfigService) MagicNetworkMonitoringConfigurationNewAccountConfiguration(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Lists default sampling and router IPs for account. +func (r *AccountMnmConfigService) MagicNetworkMonitoringConfigurationListAccountConfiguration(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update fields in an existing network monitoring configuration. +func (r *AccountMnmConfigService) MagicNetworkMonitoringConfigurationUpdateAccountConfigurationFields(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &res, opts...) + return +} + +// Update an existing network monitoring configuration, requires the entire +// configuration to be updated at once. +func (r *AccountMnmConfigService) MagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfiguration(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/config", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +type AccountMnmConfigDeleteResponse struct { + Errors []AccountMnmConfigDeleteResponseError `json:"errors"` + Messages []AccountMnmConfigDeleteResponseMessage `json:"messages"` + Result AccountMnmConfigDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMnmConfigDeleteResponseSuccess `json:"success"` + JSON accountMnmConfigDeleteResponseJSON `json:"-"` +} + +// accountMnmConfigDeleteResponseJSON contains the JSON metadata for the struct +// [AccountMnmConfigDeleteResponse] +type accountMnmConfigDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigDeleteResponseErrorJSON `json:"-"` +} + +// accountMnmConfigDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountMnmConfigDeleteResponseError] +type accountMnmConfigDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigDeleteResponseMessageJSON `json:"-"` +} + +// accountMnmConfigDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountMnmConfigDeleteResponseMessage] +type accountMnmConfigDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigDeleteResponseResult struct { + // Fallback sampling rate of flow messages being sent in packets per second. This + // should match the packet sampling rate configured on the router. + DefaultSampling float64 `json:"default_sampling,required"` + // The account name. + Name string `json:"name,required"` + RouterIPs []string `json:"router_ips,required"` + JSON accountMnmConfigDeleteResponseResultJSON `json:"-"` +} + +// accountMnmConfigDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountMnmConfigDeleteResponseResult] +type accountMnmConfigDeleteResponseResultJSON struct { + DefaultSampling apijson.Field + Name apijson.Field + RouterIPs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmConfigDeleteResponseSuccess bool + +const ( + AccountMnmConfigDeleteResponseSuccessTrue AccountMnmConfigDeleteResponseSuccess = true +) + +type AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponse struct { + Errors []AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseError `json:"errors"` + Messages []AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseMessage `json:"messages"` + Result AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseSuccess `json:"success"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponse] +type accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseErrorJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseError] +type accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseMessageJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseMessage] +type accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseResult struct { + // Fallback sampling rate of flow messages being sent in packets per second. This + // should match the packet sampling rate configured on the router. + DefaultSampling float64 `json:"default_sampling,required"` + // The account name. + Name string `json:"name,required"` + RouterIPs []string `json:"router_ips,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseResultJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseResult] +type accountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseResultJSON struct { + DefaultSampling apijson.Field + Name apijson.Field + RouterIPs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseSuccess bool + +const ( + AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseSuccessTrue AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponseSuccess = true +) + +type AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponse struct { + Errors []AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseError `json:"errors"` + Messages []AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseMessage `json:"messages"` + Result AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseSuccess `json:"success"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponse] +type accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseErrorJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseError] +type accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseMessageJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseMessage] +type accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseResult struct { + // Fallback sampling rate of flow messages being sent in packets per second. This + // should match the packet sampling rate configured on the router. + DefaultSampling float64 `json:"default_sampling,required"` + // The account name. + Name string `json:"name,required"` + RouterIPs []string `json:"router_ips,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseResultJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseResult] +type accountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseResultJSON struct { + DefaultSampling apijson.Field + Name apijson.Field + RouterIPs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseSuccess bool + +const ( + AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseSuccessTrue AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponseSuccess = true +) + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponse struct { + Errors []AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseError `json:"errors"` + Messages []AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseMessage `json:"messages"` + Result AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseSuccess `json:"success"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponse] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseErrorJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseError] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseMessageJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseMessage] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseResult struct { + // Fallback sampling rate of flow messages being sent in packets per second. This + // should match the packet sampling rate configured on the router. + DefaultSampling float64 `json:"default_sampling,required"` + // The account name. + Name string `json:"name,required"` + RouterIPs []string `json:"router_ips,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseResultJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseResult] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseResultJSON struct { + DefaultSampling apijson.Field + Name apijson.Field + RouterIPs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseSuccess bool + +const ( + AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseSuccessTrue AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponseSuccess = true +) + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponse struct { + Errors []AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseError `json:"errors"` + Messages []AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseMessage `json:"messages"` + Result AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseSuccess `json:"success"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponse] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseErrorJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseError] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseMessageJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseMessage] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseResult struct { + // Fallback sampling rate of flow messages being sent in packets per second. This + // should match the packet sampling rate configured on the router. + DefaultSampling float64 `json:"default_sampling,required"` + // The account name. + Name string `json:"name,required"` + RouterIPs []string `json:"router_ips,required"` + JSON accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseResultJSON `json:"-"` +} + +// accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseResult] +type accountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseResultJSON struct { + DefaultSampling apijson.Field + Name apijson.Field + RouterIPs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseSuccess bool + +const ( + AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseSuccessTrue AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponseSuccess = true +) diff --git a/accountmnmconfig_test.go b/accountmnmconfig_test.go new file mode 100644 index 00000000000..643b3c16901 --- /dev/null +++ b/accountmnmconfig_test.go @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMnmConfigDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Configs.Delete(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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 TestAccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationNewAccountConfiguration(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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 TestAccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationListAccountConfiguration(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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 TestAccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFields(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationUpdateAccountConfigurationFields(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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 TestAccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfiguration(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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/accountmnmconfigfull.go b/accountmnmconfigfull.go new file mode 100644 index 00000000000..44f1c68f7e7 --- /dev/null +++ b/accountmnmconfigfull.go @@ -0,0 +1,136 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMnmConfigFullService 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 [NewAccountMnmConfigFullService] +// method instead. +type AccountMnmConfigFullService struct { + Options []option.RequestOption +} + +// NewAccountMnmConfigFullService 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 NewAccountMnmConfigFullService(opts ...option.RequestOption) (r *AccountMnmConfigFullService) { + r = &AccountMnmConfigFullService{} + r.Options = opts + return +} + +// Lists default sampling, router IPs, and rules for account. +func (r *AccountMnmConfigFullService) MagicNetworkMonitoringConfigurationListRulesAndAccountConfiguration(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/config/full", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponse struct { + Errors []AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseError `json:"errors"` + Messages []AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseMessage `json:"messages"` + Result AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseSuccess `json:"success"` + JSON accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseJSON `json:"-"` +} + +// accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponse] +type accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseErrorJSON `json:"-"` +} + +// accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseError] +type accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseMessageJSON `json:"-"` +} + +// accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseMessage] +type accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseResult struct { + // Fallback sampling rate of flow messages being sent in packets per second. This + // should match the packet sampling rate configured on the router. + DefaultSampling float64 `json:"default_sampling,required"` + // The account name. + Name string `json:"name,required"` + RouterIPs []string `json:"router_ips,required"` + JSON accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseResultJSON `json:"-"` +} + +// accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseResult] +type accountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseResultJSON struct { + DefaultSampling apijson.Field + Name apijson.Field + RouterIPs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseSuccess bool + +const ( + AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseSuccessTrue AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponseSuccess = true +) diff --git a/accountmnmconfigfull_test.go b/accountmnmconfigfull_test.go new file mode 100644 index 00000000000..97b685660ba --- /dev/null +++ b/accountmnmconfigfull_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Configs.Fulls.MagicNetworkMonitoringConfigurationListRulesAndAccountConfiguration(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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/accountmnmrule.go b/accountmnmrule.go new file mode 100644 index 00000000000..778a4db2b5f --- /dev/null +++ b/accountmnmrule.go @@ -0,0 +1,802 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMnmRuleService 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 [NewAccountMnmRuleService] method +// instead. +type AccountMnmRuleService struct { + Options []option.RequestOption + Advertisements *AccountMnmRuleAdvertisementService +} + +// NewAccountMnmRuleService 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 NewAccountMnmRuleService(opts ...option.RequestOption) (r *AccountMnmRuleService) { + r = &AccountMnmRuleService{} + r.Options = opts + r.Advertisements = NewAccountMnmRuleAdvertisementService(opts...) + return +} + +// List a single network monitoring rule for account. +func (r *AccountMnmRuleService) Get(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmRuleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/rules/%v", accountIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a network monitoring rule for account. +func (r *AccountMnmRuleService) Update(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/rules/%v", accountIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &res, opts...) + return +} + +// Delete a network monitoring rule for account. +func (r *AccountMnmRuleService) Delete(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/rules/%v", accountIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create network monitoring rules for account. Currently only supports creating a +// single rule per API request. +func (r *AccountMnmRuleService) MagicNetworkMonitoringRulesNewRules(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/rules", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Lists network monitoring rules for account. +func (r *AccountMnmRuleService) MagicNetworkMonitoringRulesListRules(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/rules", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update network monitoring rules for account. +func (r *AccountMnmRuleService) MagicNetworkMonitoringRulesUpdateRules(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/rules", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +type AccountMnmRuleGetResponse struct { + Errors []AccountMnmRuleGetResponseError `json:"errors"` + Messages []AccountMnmRuleGetResponseMessage `json:"messages"` + Result AccountMnmRuleGetResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountMnmRuleGetResponseSuccess `json:"success"` + JSON accountMnmRuleGetResponseJSON `json:"-"` +} + +// accountMnmRuleGetResponseJSON contains the JSON metadata for the struct +// [AccountMnmRuleGetResponse] +type accountMnmRuleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleGetResponseErrorJSON `json:"-"` +} + +// accountMnmRuleGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountMnmRuleGetResponseError] +type accountMnmRuleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleGetResponseMessageJSON `json:"-"` +} + +// accountMnmRuleGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountMnmRuleGetResponseMessage] +type accountMnmRuleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleGetResponseResult struct { + // Toggle on if you would like Cloudflare to automatically advertise the IP + // Prefixes within the rule via Magic Transit when the rule is triggered. Only + // available for users of Magic Transit. + AutomaticAdvertisement bool `json:"automatic_advertisement,required,nullable"` + // The amount of time that the rule threshold must be exceeded to send an alert + // notification. The final value must be equivalent to one of the following 8 + // values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is + // AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + // least one unit must be provided. + Duration string `json:"duration,required"` + // The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, + // underscore (\_), dash (-), period (.), and tilde (~). You can’t have a space in + // the rule name. Max 256 characters. + Name string `json:"name,required"` + Prefixes []string `json:"prefixes,required"` + ID interface{} `json:"id"` + // The number of bits per second for the rule. When this value is exceeded for the + // set duration, an alert notification is sent. Minimum of 1 and no maximum. + BandwidthThreshold float64 `json:"bandwidth_threshold"` + // The number of packets per second for the rule. When this value is exceeded for + // the set duration, an alert notification is sent. Minimum of 1 and no maximum. + PacketThreshold float64 `json:"packet_threshold"` + JSON accountMnmRuleGetResponseResultJSON `json:"-"` +} + +// accountMnmRuleGetResponseResultJSON contains the JSON metadata for the struct +// [AccountMnmRuleGetResponseResult] +type accountMnmRuleGetResponseResultJSON struct { + AutomaticAdvertisement apijson.Field + Duration apijson.Field + Name apijson.Field + Prefixes apijson.Field + ID apijson.Field + BandwidthThreshold apijson.Field + PacketThreshold apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmRuleGetResponseSuccess bool + +const ( + AccountMnmRuleGetResponseSuccessTrue AccountMnmRuleGetResponseSuccess = true +) + +type AccountMnmRuleUpdateResponse struct { + Errors []AccountMnmRuleUpdateResponseError `json:"errors"` + Messages []AccountMnmRuleUpdateResponseMessage `json:"messages"` + Result AccountMnmRuleUpdateResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountMnmRuleUpdateResponseSuccess `json:"success"` + JSON accountMnmRuleUpdateResponseJSON `json:"-"` +} + +// accountMnmRuleUpdateResponseJSON contains the JSON metadata for the struct +// [AccountMnmRuleUpdateResponse] +type accountMnmRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleUpdateResponseErrorJSON `json:"-"` +} + +// accountMnmRuleUpdateResponseErrorJSON contains the JSON metadata for the struct +// [AccountMnmRuleUpdateResponseError] +type accountMnmRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleUpdateResponseMessageJSON `json:"-"` +} + +// accountMnmRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountMnmRuleUpdateResponseMessage] +type accountMnmRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleUpdateResponseResult struct { + // Toggle on if you would like Cloudflare to automatically advertise the IP + // Prefixes within the rule via Magic Transit when the rule is triggered. Only + // available for users of Magic Transit. + AutomaticAdvertisement bool `json:"automatic_advertisement,required,nullable"` + // The amount of time that the rule threshold must be exceeded to send an alert + // notification. The final value must be equivalent to one of the following 8 + // values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is + // AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + // least one unit must be provided. + Duration string `json:"duration,required"` + // The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, + // underscore (\_), dash (-), period (.), and tilde (~). You can’t have a space in + // the rule name. Max 256 characters. + Name string `json:"name,required"` + Prefixes []string `json:"prefixes,required"` + ID interface{} `json:"id"` + // The number of bits per second for the rule. When this value is exceeded for the + // set duration, an alert notification is sent. Minimum of 1 and no maximum. + BandwidthThreshold float64 `json:"bandwidth_threshold"` + // The number of packets per second for the rule. When this value is exceeded for + // the set duration, an alert notification is sent. Minimum of 1 and no maximum. + PacketThreshold float64 `json:"packet_threshold"` + JSON accountMnmRuleUpdateResponseResultJSON `json:"-"` +} + +// accountMnmRuleUpdateResponseResultJSON contains the JSON metadata for the struct +// [AccountMnmRuleUpdateResponseResult] +type accountMnmRuleUpdateResponseResultJSON struct { + AutomaticAdvertisement apijson.Field + Duration apijson.Field + Name apijson.Field + Prefixes apijson.Field + ID apijson.Field + BandwidthThreshold apijson.Field + PacketThreshold apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmRuleUpdateResponseSuccess bool + +const ( + AccountMnmRuleUpdateResponseSuccessTrue AccountMnmRuleUpdateResponseSuccess = true +) + +type AccountMnmRuleDeleteResponse struct { + Errors []AccountMnmRuleDeleteResponseError `json:"errors"` + Messages []AccountMnmRuleDeleteResponseMessage `json:"messages"` + Result AccountMnmRuleDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountMnmRuleDeleteResponseSuccess `json:"success"` + JSON accountMnmRuleDeleteResponseJSON `json:"-"` +} + +// accountMnmRuleDeleteResponseJSON contains the JSON metadata for the struct +// [AccountMnmRuleDeleteResponse] +type accountMnmRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleDeleteResponseErrorJSON `json:"-"` +} + +// accountMnmRuleDeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountMnmRuleDeleteResponseError] +type accountMnmRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleDeleteResponseMessageJSON `json:"-"` +} + +// accountMnmRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountMnmRuleDeleteResponseMessage] +type accountMnmRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleDeleteResponseResult struct { + // Toggle on if you would like Cloudflare to automatically advertise the IP + // Prefixes within the rule via Magic Transit when the rule is triggered. Only + // available for users of Magic Transit. + AutomaticAdvertisement bool `json:"automatic_advertisement,required,nullable"` + // The amount of time that the rule threshold must be exceeded to send an alert + // notification. The final value must be equivalent to one of the following 8 + // values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is + // AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + // least one unit must be provided. + Duration string `json:"duration,required"` + // The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, + // underscore (\_), dash (-), period (.), and tilde (~). You can’t have a space in + // the rule name. Max 256 characters. + Name string `json:"name,required"` + Prefixes []string `json:"prefixes,required"` + ID interface{} `json:"id"` + // The number of bits per second for the rule. When this value is exceeded for the + // set duration, an alert notification is sent. Minimum of 1 and no maximum. + BandwidthThreshold float64 `json:"bandwidth_threshold"` + // The number of packets per second for the rule. When this value is exceeded for + // the set duration, an alert notification is sent. Minimum of 1 and no maximum. + PacketThreshold float64 `json:"packet_threshold"` + JSON accountMnmRuleDeleteResponseResultJSON `json:"-"` +} + +// accountMnmRuleDeleteResponseResultJSON contains the JSON metadata for the struct +// [AccountMnmRuleDeleteResponseResult] +type accountMnmRuleDeleteResponseResultJSON struct { + AutomaticAdvertisement apijson.Field + Duration apijson.Field + Name apijson.Field + Prefixes apijson.Field + ID apijson.Field + BandwidthThreshold apijson.Field + PacketThreshold apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmRuleDeleteResponseSuccess bool + +const ( + AccountMnmRuleDeleteResponseSuccessTrue AccountMnmRuleDeleteResponseSuccess = true +) + +type AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponse struct { + Errors []AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseError `json:"errors"` + Messages []AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseMessage `json:"messages"` + Result AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseSuccess `json:"success"` + JSON accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseJSON contains the JSON +// metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponse] +type accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseErrorJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseError] +type accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseMessageJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseMessage] +type accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseResult struct { + // Toggle on if you would like Cloudflare to automatically advertise the IP + // Prefixes within the rule via Magic Transit when the rule is triggered. Only + // available for users of Magic Transit. + AutomaticAdvertisement bool `json:"automatic_advertisement,required,nullable"` + // The amount of time that the rule threshold must be exceeded to send an alert + // notification. The final value must be equivalent to one of the following 8 + // values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is + // AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + // least one unit must be provided. + Duration string `json:"duration,required"` + // The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, + // underscore (\_), dash (-), period (.), and tilde (~). You can’t have a space in + // the rule name. Max 256 characters. + Name string `json:"name,required"` + Prefixes []string `json:"prefixes,required"` + ID interface{} `json:"id"` + // The number of bits per second for the rule. When this value is exceeded for the + // set duration, an alert notification is sent. Minimum of 1 and no maximum. + BandwidthThreshold float64 `json:"bandwidth_threshold"` + // The number of packets per second for the rule. When this value is exceeded for + // the set duration, an alert notification is sent. Minimum of 1 and no maximum. + PacketThreshold float64 `json:"packet_threshold"` + JSON accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseResultJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseResultJSON contains the +// JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseResult] +type accountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseResultJSON struct { + AutomaticAdvertisement apijson.Field + Duration apijson.Field + Name apijson.Field + Prefixes apijson.Field + ID apijson.Field + BandwidthThreshold apijson.Field + PacketThreshold apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseSuccess bool + +const ( + AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseSuccessTrue AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponseSuccess = true +) + +type AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponse struct { + Errors []AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseError `json:"errors"` + Messages []AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseMessage `json:"messages"` + Result []AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResult `json:"result,nullable"` + ResultInfo AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseSuccess `json:"success"` + JSON accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseJSON contains the JSON +// metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponse] +type accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseErrorJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseError] +type accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseMessageJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseMessage] +type accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResult struct { + // Toggle on if you would like Cloudflare to automatically advertise the IP + // Prefixes within the rule via Magic Transit when the rule is triggered. Only + // available for users of Magic Transit. + AutomaticAdvertisement bool `json:"automatic_advertisement,required,nullable"` + // The amount of time that the rule threshold must be exceeded to send an alert + // notification. The final value must be equivalent to one of the following 8 + // values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is + // AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + // least one unit must be provided. + Duration string `json:"duration,required"` + // The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, + // underscore (\_), dash (-), period (.), and tilde (~). You can’t have a space in + // the rule name. Max 256 characters. + Name string `json:"name,required"` + Prefixes []string `json:"prefixes,required"` + ID interface{} `json:"id"` + // The number of bits per second for the rule. When this value is exceeded for the + // set duration, an alert notification is sent. Minimum of 1 and no maximum. + BandwidthThreshold float64 `json:"bandwidth_threshold"` + // The number of packets per second for the rule. When this value is exceeded for + // the set duration, an alert notification is sent. Minimum of 1 and no maximum. + PacketThreshold float64 `json:"packet_threshold"` + JSON accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultJSON contains +// the JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResult] +type accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultJSON struct { + AutomaticAdvertisement apijson.Field + Duration apijson.Field + Name apijson.Field + Prefixes apijson.Field + ID apijson.Field + BandwidthThreshold apijson.Field + PacketThreshold apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultInfoJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultInfo] +type accountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseSuccess bool + +const ( + AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseSuccessTrue AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponseSuccess = true +) + +type AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponse struct { + Errors []AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseError `json:"errors"` + Messages []AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseMessage `json:"messages"` + Result AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseSuccess `json:"success"` + JSON accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseJSON contains the +// JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponse] +type accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseErrorJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseError] +type accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseMessageJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseMessage] +type accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseResult struct { + // Toggle on if you would like Cloudflare to automatically advertise the IP + // Prefixes within the rule via Magic Transit when the rule is triggered. Only + // available for users of Magic Transit. + AutomaticAdvertisement bool `json:"automatic_advertisement,required,nullable"` + // The amount of time that the rule threshold must be exceeded to send an alert + // notification. The final value must be equivalent to one of the following 8 + // values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is + // AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + // least one unit must be provided. + Duration string `json:"duration,required"` + // The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, + // underscore (\_), dash (-), period (.), and tilde (~). You can’t have a space in + // the rule name. Max 256 characters. + Name string `json:"name,required"` + Prefixes []string `json:"prefixes,required"` + ID interface{} `json:"id"` + // The number of bits per second for the rule. When this value is exceeded for the + // set duration, an alert notification is sent. Minimum of 1 and no maximum. + BandwidthThreshold float64 `json:"bandwidth_threshold"` + // The number of packets per second for the rule. When this value is exceeded for + // the set duration, an alert notification is sent. Minimum of 1 and no maximum. + PacketThreshold float64 `json:"packet_threshold"` + JSON accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseResultJSON `json:"-"` +} + +// accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseResultJSON contains +// the JSON metadata for the struct +// [AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseResult] +type accountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseResultJSON struct { + AutomaticAdvertisement apijson.Field + Duration apijson.Field + Name apijson.Field + Prefixes apijson.Field + ID apijson.Field + BandwidthThreshold apijson.Field + PacketThreshold apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseSuccess bool + +const ( + AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseSuccessTrue AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponseSuccess = true +) diff --git a/accountmnmrule_test.go b/accountmnmrule_test.go new file mode 100644 index 00000000000..9d54124b3df --- /dev/null +++ b/accountmnmrule_test.go @@ -0,0 +1,182 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMnmRuleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Rules.Get( + context.TODO(), + "6f91088a406011ed95aed352566e8d4c", + "2890e6fa406311ed9b5a23f70f6fb8cf", + ) + 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 TestAccountMnmRuleUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Rules.Update( + context.TODO(), + "6f91088a406011ed95aed352566e8d4c", + "2890e6fa406311ed9b5a23f70f6fb8cf", + ) + 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 TestAccountMnmRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Rules.Delete( + context.TODO(), + "6f91088a406011ed95aed352566e8d4c", + "2890e6fa406311ed9b5a23f70f6fb8cf", + ) + 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 TestAccountMnmRuleMagicNetworkMonitoringRulesNewRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Rules.MagicNetworkMonitoringRulesNewRules(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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 TestAccountMnmRuleMagicNetworkMonitoringRulesListRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Rules.MagicNetworkMonitoringRulesListRules(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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 TestAccountMnmRuleMagicNetworkMonitoringRulesUpdateRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Rules.MagicNetworkMonitoringRulesUpdateRules(context.TODO(), "6f91088a406011ed95aed352566e8d4c") + 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/accountmnmruleadvertisement.go b/accountmnmruleadvertisement.go new file mode 100644 index 00000000000..661e98a0431 --- /dev/null +++ b/accountmnmruleadvertisement.go @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMnmRuleAdvertisementService 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 +// [NewAccountMnmRuleAdvertisementService] method instead. +type AccountMnmRuleAdvertisementService struct { + Options []option.RequestOption +} + +// NewAccountMnmRuleAdvertisementService 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 NewAccountMnmRuleAdvertisementService(opts ...option.RequestOption) (r *AccountMnmRuleAdvertisementService) { + r = &AccountMnmRuleAdvertisementService{} + r.Options = opts + return +} + +// Update advertisement for rule. +func (r *AccountMnmRuleAdvertisementService) MagicNetworkMonitoringRulesUpdateAdvertisementForRule(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}, opts ...option.RequestOption) (res *AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/mnm/rules/%v/advertisement", accountIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &res, opts...) + return +} + +type AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponse struct { + Errors []AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseError `json:"errors"` + Messages []AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseMessage `json:"messages"` + Result AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseSuccess `json:"success"` + JSON accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseJSON `json:"-"` +} + +// accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseJSON +// contains the JSON metadata for the struct +// [AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponse] +type accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseErrorJSON `json:"-"` +} + +// accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseError] +type accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseMessageJSON `json:"-"` +} + +// accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseMessage] +type accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseResult struct { + // Toggle on if you would like Cloudflare to automatically advertise the IP + // Prefixes within the rule via Magic Transit when the rule is triggered. Only + // available for users of Magic Transit. + AutomaticAdvertisement bool `json:"automatic_advertisement,required,nullable"` + JSON accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseResultJSON `json:"-"` +} + +// accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseResult] +type accountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseResultJSON struct { + AutomaticAdvertisement apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseSuccess bool + +const ( + AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseSuccessTrue AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponseSuccess = true +) diff --git a/accountmnmruleadvertisement_test.go b/accountmnmruleadvertisement_test.go new file mode 100644 index 00000000000..e42ad1718cc --- /dev/null +++ b/accountmnmruleadvertisement_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRule(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Mnms.Rules.Advertisements.MagicNetworkMonitoringRulesUpdateAdvertisementForRule( + context.TODO(), + "6f91088a406011ed95aed352566e8d4c", + "2890e6fa406311ed9b5a23f70f6fb8cf", + ) + 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/accountmtlscertificate.go b/accountmtlscertificate.go new file mode 100644 index 00000000000..31f53cb37e4 --- /dev/null +++ b/accountmtlscertificate.go @@ -0,0 +1,566 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMtlsCertificateService 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 [NewAccountMtlsCertificateService] +// method instead. +type AccountMtlsCertificateService struct { + Options []option.RequestOption + Associations *AccountMtlsCertificateAssociationService +} + +// NewAccountMtlsCertificateService 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 NewAccountMtlsCertificateService(opts ...option.RequestOption) (r *AccountMtlsCertificateService) { + r = &AccountMtlsCertificateService{} + r.Options = opts + r.Associations = NewAccountMtlsCertificateAssociationService(opts...) + return +} + +// Fetches a single mTLS certificate. +func (r *AccountMtlsCertificateService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountMtlsCertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/mtls_certificates/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes the mTLS certificate unless the certificate is in use by one or more +// Cloudflare services. +func (r *AccountMtlsCertificateService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountMtlsCertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/mtls_certificates/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists all mTLS certificates. +func (r *AccountMtlsCertificateService) MTlsCertificateManagementListMTlsCertificates(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/mtls_certificates", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Upload a certificate that you want to use with mTLS-enabled Cloudflare services. +func (r *AccountMtlsCertificateService) MTlsCertificateManagementUploadMTlsCertificate(ctx context.Context, accountIdentifier string, body AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateParams, opts ...option.RequestOption) (res *AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/mtls_certificates", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountMtlsCertificateGetResponse struct { + Errors []AccountMtlsCertificateGetResponseError `json:"errors"` + Messages []AccountMtlsCertificateGetResponseMessage `json:"messages"` + Result AccountMtlsCertificateGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMtlsCertificateGetResponseSuccess `json:"success"` + JSON accountMtlsCertificateGetResponseJSON `json:"-"` +} + +// accountMtlsCertificateGetResponseJSON contains the JSON metadata for the struct +// [AccountMtlsCertificateGetResponse] +type accountMtlsCertificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateGetResponseErrorJSON `json:"-"` +} + +// accountMtlsCertificateGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountMtlsCertificateGetResponseError] +type accountMtlsCertificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateGetResponseMessageJSON `json:"-"` +} + +// accountMtlsCertificateGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountMtlsCertificateGetResponseMessage] +type accountMtlsCertificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateGetResponseResult struct { + // Identifier + ID string `json:"id"` + // Indicates whether the certificate is a CA or leaf certificate. + Ca bool `json:"ca"` + // The uploaded root CA certificate. + Certificates string `json:"certificates"` + // When the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // Optional unique name for the certificate. Only used for human readability. + Name string `json:"name"` + // The certificate serial number. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // This is the time the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON accountMtlsCertificateGetResponseResultJSON `json:"-"` +} + +// accountMtlsCertificateGetResponseResultJSON contains the JSON metadata for the +// struct [AccountMtlsCertificateGetResponseResult] +type accountMtlsCertificateGetResponseResultJSON struct { + ID apijson.Field + Ca apijson.Field + Certificates apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + Name apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMtlsCertificateGetResponseSuccess bool + +const ( + AccountMtlsCertificateGetResponseSuccessTrue AccountMtlsCertificateGetResponseSuccess = true +) + +type AccountMtlsCertificateDeleteResponse struct { + Errors []AccountMtlsCertificateDeleteResponseError `json:"errors"` + Messages []AccountMtlsCertificateDeleteResponseMessage `json:"messages"` + Result AccountMtlsCertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMtlsCertificateDeleteResponseSuccess `json:"success"` + JSON accountMtlsCertificateDeleteResponseJSON `json:"-"` +} + +// accountMtlsCertificateDeleteResponseJSON contains the JSON metadata for the +// struct [AccountMtlsCertificateDeleteResponse] +type accountMtlsCertificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateDeleteResponseErrorJSON `json:"-"` +} + +// accountMtlsCertificateDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountMtlsCertificateDeleteResponseError] +type accountMtlsCertificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateDeleteResponseMessageJSON `json:"-"` +} + +// accountMtlsCertificateDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountMtlsCertificateDeleteResponseMessage] +type accountMtlsCertificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + // Indicates whether the certificate is a CA or leaf certificate. + Ca bool `json:"ca"` + // The uploaded root CA certificate. + Certificates string `json:"certificates"` + // When the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // Optional unique name for the certificate. Only used for human readability. + Name string `json:"name"` + // The certificate serial number. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // This is the time the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON accountMtlsCertificateDeleteResponseResultJSON `json:"-"` +} + +// accountMtlsCertificateDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountMtlsCertificateDeleteResponseResult] +type accountMtlsCertificateDeleteResponseResultJSON struct { + ID apijson.Field + Ca apijson.Field + Certificates apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + Name apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMtlsCertificateDeleteResponseSuccess bool + +const ( + AccountMtlsCertificateDeleteResponseSuccessTrue AccountMtlsCertificateDeleteResponseSuccess = true +) + +type AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponse struct { + Errors []AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseError `json:"errors"` + Messages []AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseMessage `json:"messages"` + Result []AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResult `json:"result"` + ResultInfo AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseSuccess `json:"success"` + JSON accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponse] +type accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseErrorJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseError] +type accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseMessageJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseMessage] +type accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResult struct { + // Identifier + ID string `json:"id"` + // Indicates whether the certificate is a CA or leaf certificate. + Ca bool `json:"ca"` + // The uploaded root CA certificate. + Certificates string `json:"certificates"` + // When the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // Optional unique name for the certificate. Only used for human readability. + Name string `json:"name"` + // The certificate serial number. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // This is the time the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResult] +type accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultJSON struct { + ID apijson.Field + Ca apijson.Field + Certificates apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + Name apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + TotalPages interface{} `json:"total_pages"` + JSON accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultInfoJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultInfo] +type accountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + TotalPages apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseSuccess bool + +const ( + AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseSuccessTrue AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponseSuccess = true +) + +type AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponse struct { + Errors []AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseError `json:"errors"` + Messages []AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseMessage `json:"messages"` + Result AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseSuccess `json:"success"` + JSON accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponse] +type accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseErrorJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseError] +type accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseMessageJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseMessage] +type accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseResult struct { + // Identifier + ID string `json:"id"` + // Indicates whether the certificate is a CA or leaf certificate. + Ca bool `json:"ca"` + // The uploaded root CA certificate. + Certificates string `json:"certificates"` + // When the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // Optional unique name for the certificate. Only used for human readability. + Name string `json:"name"` + // The certificate serial number. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // This is the time the certificate was updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // This is the time the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseResultJSON `json:"-"` +} + +// accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseResult] +type accountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseResultJSON struct { + ID apijson.Field + Ca apijson.Field + Certificates apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + Name apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + UpdatedAt apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseSuccess bool + +const ( + AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseSuccessTrue AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponseSuccess = true +) + +type AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateParams struct { + // Indicates whether the certificate is a CA or leaf certificate. + Ca param.Field[bool] `json:"ca,required"` + // The uploaded root CA certificate. + Certificates param.Field[string] `json:"certificates,required"` + // Optional unique name for the certificate. Only used for human readability. + Name param.Field[string] `json:"name"` + // The private key for the certificate + PrivateKey param.Field[string] `json:"private_key"` +} + +func (r AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountmtlscertificate_test.go b/accountmtlscertificate_test.go new file mode 100644 index 00000000000..ab84ddf63b9 --- /dev/null +++ b/accountmtlscertificate_test.go @@ -0,0 +1,135 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMtlsCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.MtlsCertificates.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMtlsCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.MtlsCertificates.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountMtlsCertificateMTlsCertificateManagementListMTlsCertificates(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.MtlsCertificates.MTlsCertificateManagementListMTlsCertificates(context.TODO(), "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()) + } +} + +func TestAccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.MtlsCertificates.MTlsCertificateManagementUploadMTlsCertificate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateParams{ + Ca: cloudflare.F(true), + Certificates: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDmDCCAoCgAwIBAgIUKTOAZNjcXVZRj4oQt0SHsl1c1vMwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjAgFw0yMjExMjIxNjU5NDdaGA8yMTIyMTAyOTE2NTk0N1owUTELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDVNhbiBGcmFuY2lzY28xEzARBgNVBAcMCkNhbGlmb3JuaWExFTATBgNVBAoMDEV4YW1wbGUgSW5jLjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRcORwgJFTdcG/2GKI+cFYiOBNDKjCZUXEOvXWY42BkH9wxiMT869CO+enA1w5pIrXow6kCM1sQspHHaVmJUlotEMJxyoLFfA/8Kt1EKFyobOjuZs2SwyVyJ2sStvQuUQEosULZCNGZEqoH5g6zhMPxaxm7ZLrrsDZ9maNGVqo7EWLWHrZ57Q/5MtTrbxQL+eXjUmJ9K3kS+3uEwMdqR6Z3BluU1ivanpPc1CN2GNhdO0/hSY4YkGEnuLsqJyDd3cIiB1MxuCBJ4ZaqOd2viV1WcP3oU3dxVPm4MWyfYIldMWB14FahScxLhWdRnM9YZ/i9IFcLypXsuz7DjrJPtPUCAwEAAaNmMGQwHQYDVR0OBBYEFP5JzLUawNF+c3AXsYTEWHh7z2czMB8GA1UdIwQYMBaAFP5JzLUawNF+c3AXsYTEWHh7z2czMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMA0GCSqGSIb3DQEBCwUAA4IBAQBc+Be7NDhpE09y7hLPZGRPl1cSKBw4RI0XIv6rlbSTFs5EebpTGjhx/whNxwEZhB9HZ7111Oa1YlT8xkI9DshB78mjAHCKBAJ76moK8tkG0aqdYpJ4ZcJTVBB7l98Rvgc7zfTii7WemTy72deBbSeiEtXavm4EF0mWjHhQ5Nxpnp00Bqn5g1x8CyTDypgmugnep+xG+iFzNmTdsz7WI9T/7kDMXqB7M/FPWBORyS98OJqNDswCLF8bIZYwUBEe+bRHFomoShMzaC3tvim7WCb16noDkSTMlfKO4pnvKhpcVdSgwcruATV7y+W+Lvmz2OT/Gui4JhqeoTewsxndhDDE\n-----END CERTIFICATE-----"), + Name: cloudflare.F("example_ca_cert"), + PrivateKey: cloudflare.F("-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEXDkcICRU3XBv9hiiPnBWIjgTQyowmVFxDr11mONgZB/cMYjE/OvQjvnpwNcOaSK16MOpAjNbELKRx2lZiVJaLRDCccqCxXwP/CrdRChcqGzo7mbNksMlcidrErb0LlEBKLFC2QjRmRKqB+YOs4TD8WsZu2S667A2fZmjRlaqOxFi1h62ee0P+TLU628UC/nl41JifSt5Evt7hMDHakemdwZblNYr2p6T3NQjdhjYXTtP4UmOGJBhJ7i7Kicg3d3CIgdTMbggSeGWqjndr4ldVnD96FN3cVT5uDFsn2CJXTFgdeBWoUnMS4VnUZzPWGf4vSBXC8qV7Ls+w46yT7T1AgMBAAECggEAQZnp/oqCeNPOR6l5S2L+1tfx0gWjZ78hJVteUpZ0iHSK7F6kKeOxyOird7vUXV0kmo+cJq+0hp0Ke4eam640FCpwKfYoSQ4/R3vgujGWJnaihCN5tv5sMet0XeJPuz5qE7ALoKCvwI6aXLHs20aAeZIDTQJ9QbGSGnJVzOWn+JDTidIgZpN57RpXfSAwnJPTQK/PN8i5z108hsaDOdEgGmxYZ7kYqMqzX20KXmth58LDfPixs5JGtS60iiKC/wOcGzkB2/AdTSojR76oEU77cANP/3zO25NG//whUdYlW0t0d7PgXxIeJe+xgYnamDQJx3qonVyt4H77ha0ObRAj9QKBgQDicZr+VTwFMnELP3a+FXGnjehRiuS1i7MXGKxNweCD+dFlML0FplSQS8Ro2n+d8lu8BBXGx0qm6VXu8Rhn7TAUL6q+PCgfarzxfIhacb/TZCqfieIHsMlVBfhV5HCXnk+kis0tuC/PRArcWTwDHJUJXkBhvkUsNswvQzavDPI7KwKBgQDd/WgLkj7A3X5fgIHZH/GbDSBiXwzKb+rF4ZCT2XFgG/OAW7vapfcX/w+v+5lBLyrocmOAS3PGGAhM5T3HLnUCQfnK4qgps1Lqibkc9Tmnsn60LanUjuUMsYv/zSw70tozbzhJ0pioEpWfRxRZBztO2Rr8Ntm7h6Fk701EXGNAXwKBgQCD1xsjy2J3sCerIdcz0u5qXLAPkeuZW+34m4/ucdwTWwc0gEz9lhsULFj9p4G351zLuiEnq+7mAWLcDJlmIO3mQt6JhiLiL9Y0T4pgBmxmWqKKYtAsJB0EmMY+1BNN44mBRqMxZFTJu1cLdhT/xstrOeoIPqytknYNanfTMZlzIwKBgHrLXe5oq0XMP8dcMneEcAUwsaU4pr6kQd3L9EmUkl5zl7J9C+DaxWAEuwzBw/iGutlxzRB+rD/7szu14wJ29EqXbDGKRzMp+se5/yfBjm7xEZ1hVPw7PwBShfqt57X/4Ktq7lwHnmH6RcGhc+P7WBc5iO/S94YAdIp8xOT3pf9JAoGAE0QkqJUY+5Mgr+fBO0VNV72ZoPveGpW+De59uhKAOnu1zljQCUtk59m6+DXfm0tNYKtawa5n8iN71Zh+s62xXSt3pYi1Y5CCCmv8Y4BhwIcPwXKk3zEvLgSHVTpC0bayA9aSO4bbZgVXa5w+Z0w/vvfp9DWo1IS3EnQRrz6WMYA=\n-----END PRIVATE KEY-----"), + }, + ) + 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/accountmtlscertificateassociation.go b/accountmtlscertificateassociation.go new file mode 100644 index 00000000000..07c71a44d12 --- /dev/null +++ b/accountmtlscertificateassociation.go @@ -0,0 +1,163 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountMtlsCertificateAssociationService 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 +// [NewAccountMtlsCertificateAssociationService] method instead. +type AccountMtlsCertificateAssociationService struct { + Options []option.RequestOption +} + +// NewAccountMtlsCertificateAssociationService 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 NewAccountMtlsCertificateAssociationService(opts ...option.RequestOption) (r *AccountMtlsCertificateAssociationService) { + r = &AccountMtlsCertificateAssociationService{} + r.Options = opts + return +} + +// Lists all active associations between the certificate and Cloudflare services. +func (r *AccountMtlsCertificateAssociationService) MTlsCertificateManagementListMTlsCertificateAssociations(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/mtls_certificates/%s/associations", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponse struct { + Errors []AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseError `json:"errors"` + Messages []AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseMessage `json:"messages"` + Result []AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResult `json:"result"` + ResultInfo AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseSuccess `json:"success"` + JSON accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseJSON `json:"-"` +} + +// accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponse] +type accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseErrorJSON `json:"-"` +} + +// accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseError] +type accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseMessageJSON `json:"-"` +} + +// accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseMessage] +type accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResult struct { + // The service using the certificate. + Service string `json:"service"` + // Certificate deployment status for the given service. + Status string `json:"status"` + JSON accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultJSON `json:"-"` +} + +// accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResult] +type accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultJSON struct { + Service apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultInfoJSON `json:"-"` +} + +// accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultInfo] +type accountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseSuccess bool + +const ( + AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseSuccessTrue AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponseSuccess = true +) diff --git a/accountmtlscertificateassociation_test.go b/accountmtlscertificateassociation_test.go new file mode 100644 index 00000000000..747709d0996 --- /dev/null +++ b/accountmtlscertificateassociation_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociations(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.MtlsCertificates.Associations.MTlsCertificateManagementListMTlsCertificateAssociations( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountpage.go b/accountpage.go new file mode 100644 index 00000000000..851d46f07b0 --- /dev/null +++ b/accountpage.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageService 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 [NewAccountPageService] method +// instead. +type AccountPageService struct { + Options []option.RequestOption + Projects *AccountPageProjectService +} + +// NewAccountPageService 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 NewAccountPageService(opts ...option.RequestOption) (r *AccountPageService) { + r = &AccountPageService{} + r.Options = opts + r.Projects = NewAccountPageProjectService(opts...) + return +} diff --git a/accountpageproject.go b/accountpageproject.go new file mode 100644 index 00000000000..a7d52edd97b --- /dev/null +++ b/accountpageproject.go @@ -0,0 +1,2385 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageProjectService 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 [NewAccountPageProjectService] method +// instead. +type AccountPageProjectService struct { + Options []option.RequestOption + Deployments *AccountPageProjectDeploymentService + Domains *AccountPageProjectDomainService +} + +// NewAccountPageProjectService 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 NewAccountPageProjectService(opts ...option.RequestOption) (r *AccountPageProjectService) { + r = &AccountPageProjectService{} + r.Options = opts + r.Deployments = NewAccountPageProjectDeploymentService(opts...) + r.Domains = NewAccountPageProjectDomainService(opts...) + return +} + +// Fetch a project by name. +func (r *AccountPageProjectService) Get(ctx context.Context, accountIdentifier string, projectName string, opts ...option.RequestOption) (res *AccountPageProjectGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Set new attributes for an existing project. Modify environment variables. To +// delete an environment variable, set the key to null. +func (r *AccountPageProjectService) Update(ctx context.Context, accountIdentifier string, projectName string, body AccountPageProjectUpdateParams, opts ...option.RequestOption) (res *AccountPageProjectUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete a project by name. +func (r *AccountPageProjectService) Delete(ctx context.Context, accountIdentifier string, projectName string, opts ...option.RequestOption) (res *AccountPageProjectDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new project. +func (r *AccountPageProjectService) PagesProjectNewProject(ctx context.Context, accountIdentifier string, body AccountPageProjectPagesProjectNewProjectParams, opts ...option.RequestOption) (res *AccountPageProjectPagesProjectNewProjectResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetch a list of all user projects. +func (r *AccountPageProjectService) PagesProjectGetProjects(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountPageProjectPagesProjectGetProjectsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountPageProjectGetResponse struct { + Errors []AccountPageProjectGetResponseError `json:"errors"` + Messages []AccountPageProjectGetResponseMessage `json:"messages"` + Result AccountPageProjectGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPageProjectGetResponseSuccess `json:"success"` + JSON accountPageProjectGetResponseJSON `json:"-"` +} + +// accountPageProjectGetResponseJSON contains the JSON metadata for the struct +// [AccountPageProjectGetResponse] +type accountPageProjectGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectGetResponseErrorJSON `json:"-"` +} + +// accountPageProjectGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountPageProjectGetResponseError] +type accountPageProjectGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectGetResponseMessageJSON `json:"-"` +} + +// accountPageProjectGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountPageProjectGetResponseMessage] +type accountPageProjectGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectGetResponseResult struct { + // Id of the project. + ID string `json:"id"` + // Configs for the project build process. + BuildConfig AccountPageProjectGetResponseResultBuildConfig `json:"build_config"` + CanonicalDeployment AccountPageProjectGetResponseResultCanonicalDeployment `json:"canonical_deployment"` + // When the project was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Configs for deployments in a project. + DeploymentConfigs AccountPageProjectGetResponseResultDeploymentConfigs `json:"deployment_configs"` + // A list of associated custom domains for the project. + Domains []interface{} `json:"domains"` + LatestDeployment AccountPageProjectGetResponseResultLatestDeployment `json:"latest_deployment"` + // Name of the project. + Name string `json:"name"` + // Production branch of the project. Used to identify production deployments. + ProductionBranch string `json:"production_branch"` + Source interface{} `json:"source"` + // The Cloudflare subdomain associated with the project. + Subdomain string `json:"subdomain"` + JSON accountPageProjectGetResponseResultJSON `json:"-"` +} + +// accountPageProjectGetResponseResultJSON contains the JSON metadata for the +// struct [AccountPageProjectGetResponseResult] +type accountPageProjectGetResponseResultJSON struct { + ID apijson.Field + BuildConfig apijson.Field + CanonicalDeployment apijson.Field + CreatedOn apijson.Field + DeploymentConfigs apijson.Field + Domains apijson.Field + LatestDeployment apijson.Field + Name apijson.Field + ProductionBranch apijson.Field + Source apijson.Field + Subdomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configs for the project build process. +type AccountPageProjectGetResponseResultBuildConfig struct { + // Enable build caching for the project. + BuildCaching bool `json:"build_caching,nullable"` + // Command used to build project. + BuildCommand string `json:"build_command,nullable"` + // Output directory of the build. + DestinationDir string `json:"destination_dir,nullable"` + // Directory to run the command. + RootDir string `json:"root_dir,nullable"` + // The classifying tag for analytics. + WebAnalyticsTag string `json:"web_analytics_tag,nullable"` + // The auth token for analytics. + WebAnalyticsToken string `json:"web_analytics_token,nullable"` + JSON accountPageProjectGetResponseResultBuildConfigJSON `json:"-"` +} + +// accountPageProjectGetResponseResultBuildConfigJSON contains the JSON metadata +// for the struct [AccountPageProjectGetResponseResultBuildConfig] +type accountPageProjectGetResponseResultBuildConfigJSON struct { + BuildCaching apijson.Field + BuildCommand apijson.Field + DestinationDir apijson.Field + RootDir apijson.Field + WebAnalyticsTag apijson.Field + WebAnalyticsToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultBuildConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectGetResponseResultCanonicalDeployment struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectGetResponseResultCanonicalDeploymentStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectGetResponseResultCanonicalDeploymentJSON `json:"-"` +} + +// accountPageProjectGetResponseResultCanonicalDeploymentJSON contains the JSON +// metadata for the struct [AccountPageProjectGetResponseResultCanonicalDeployment] +type accountPageProjectGetResponseResultCanonicalDeploymentJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultCanonicalDeployment) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTrigger] +type accountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerMetadata] +type accountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultCanonicalDeploymentDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectGetResponseResultCanonicalDeploymentStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectGetResponseResultCanonicalDeploymentStageJSON `json:"-"` +} + +// accountPageProjectGetResponseResultCanonicalDeploymentStageJSON contains the +// JSON metadata for the struct +// [AccountPageProjectGetResponseResultCanonicalDeploymentStage] +type accountPageProjectGetResponseResultCanonicalDeploymentStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultCanonicalDeploymentStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configs for deployments in a project. +type AccountPageProjectGetResponseResultDeploymentConfigs struct { + // Configs for preview deploys. + Preview AccountPageProjectGetResponseResultDeploymentConfigsPreview `json:"preview"` + // Configs for production deploys. + Production AccountPageProjectGetResponseResultDeploymentConfigsProduction `json:"production"` + JSON accountPageProjectGetResponseResultDeploymentConfigsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsJSON contains the JSON +// metadata for the struct [AccountPageProjectGetResponseResultDeploymentConfigs] +type accountPageProjectGetResponseResultDeploymentConfigsJSON struct { + Preview apijson.Field + Production apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configs for preview deploys. +type AccountPageProjectGetResponseResultDeploymentConfigsPreview struct { + // Constellation bindings used for Pages Functions. + AIBindings AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindings `json:"ai_bindings,nullable"` + // Analytics Engine bindings used for Pages Functions. + AnalyticsEngineDatasets AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasets `json:"analytics_engine_datasets,nullable"` + // Compatibility date used for Pages Functions. + CompatibilityDate string `json:"compatibility_date"` + // Compatibility flags used for Pages Functions. + CompatibilityFlags []interface{} `json:"compatibility_flags"` + // D1 databases used for Pages Functions. + D1Databases AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1Databases `json:"d1_databases,nullable"` + // Durabble Object namespaces used for Pages Functions. + DurableObjectNamespaces AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespaces `json:"durable_object_namespaces,nullable"` + // Environment variables for build configs. + EnvVars AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVars `json:"env_vars,nullable"` + // KV namespaces used for Pages Functions. + KvNamespaces AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespaces `json:"kv_namespaces"` + // Placement setting used for Pages Functions. + Placement AccountPageProjectGetResponseResultDeploymentConfigsPreviewPlacement `json:"placement,nullable"` + // Queue Producer bindings used for Pages Functions. + QueueProducers AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducers `json:"queue_producers,nullable"` + // R2 buckets used for Pages Functions. + R2Buckets AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2Buckets `json:"r2_buckets,nullable"` + // Services used for Pages Functions. + ServiceBindings AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindings `json:"service_bindings,nullable"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewJSON contains the +// JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreview] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewJSON struct { + AIBindings apijson.Field + AnalyticsEngineDatasets apijson.Field + CompatibilityDate apijson.Field + CompatibilityFlags apijson.Field + D1Databases apijson.Field + DurableObjectNamespaces apijson.Field + EnvVars apijson.Field + KvNamespaces apijson.Field + Placement apijson.Field + QueueProducers apijson.Field + R2Buckets apijson.Field + ServiceBindings apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreview) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Constellation bindings used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindings struct { + // AI binding. + AIBinding AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsAIBinding `json:"AI_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindings] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsJSON struct { + AIBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// AI binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsAIBinding struct { + ProjectID interface{} `json:"project_id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsAIBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsAIBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsAIBinding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsAIBindingJSON struct { + ProjectID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewAIBindingsAIBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Analytics Engine bindings used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasets struct { + // Analytics Engine binding. + AnalyticsEngineBinding AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding `json:"ANALYTICS_ENGINE_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasets] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsJSON struct { + AnalyticsEngineBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasets) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Analytics Engine binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding struct { + // Name of the dataset. + Dataset string `json:"dataset"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBindingJSON struct { + Dataset apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// D1 databases used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1Databases struct { + // D1 binding. + D1Binding AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesD1Binding `json:"D1_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1Databases] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesJSON struct { + D1Binding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1Databases) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// D1 binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesD1Binding struct { + // UUID of the D1 database. + ID string `json:"id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesD1BindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesD1BindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesD1Binding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesD1BindingJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewD1DatabasesD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Durabble Object namespaces used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespaces struct { + // Durabble Object binding. + DoBinding AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesDoBinding `json:"DO_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespaces] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesJSON struct { + DoBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespaces) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Durabble Object binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesDoBinding struct { + // ID of the Durabble Object namespace. + NamespaceID string `json:"namespace_id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesDoBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesDoBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesDoBinding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesDoBindingJSON struct { + NamespaceID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewDurableObjectNamespacesDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Environment variables for build configs. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVars struct { + // Environment variable. + EnvironmentVariable AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariable `json:"ENVIRONMENT_VARIABLE"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsJSON contains +// the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVars] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsJSON struct { + EnvironmentVariable apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVars) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Environment variable. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariable struct { + // The type of environment variable (plain text or secret) + Type AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableType `json:"type"` + // Environment variable value. + Value string `json:"value"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariable] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariable) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of environment variable (plain text or secret) +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableType string + +const ( + AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypePlainText AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableType = "plain_text" + AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypeSecretText AccountPageProjectGetResponseResultDeploymentConfigsPreviewEnvVarsEnvironmentVariableType = "secret_text" +) + +// KV namespaces used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespaces struct { + // KV binding. + KvBinding AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesKvBinding `json:"KV_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespaces] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesJSON struct { + KvBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespaces) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// KV binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesKvBinding struct { + // ID of the KV namespace. + NamespaceID string `json:"namespace_id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesKvBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesKvBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesKvBinding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesKvBindingJSON struct { + NamespaceID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewKvNamespacesKvBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Placement setting used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewPlacement struct { + // Placement mode. + Mode string `json:"mode"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewPlacementJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewPlacementJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewPlacement] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewPlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewPlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Queue Producer bindings used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducers struct { + // Queue Producer binding. + QueueProducerBinding AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersQueueProducerBinding `json:"QUEUE_PRODUCER_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducers] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersJSON struct { + QueueProducerBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Queue Producer binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersQueueProducerBinding struct { + // Name of the Queue. + Name string `json:"name"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersQueueProducerBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersQueueProducerBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersQueueProducerBinding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersQueueProducerBindingJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewQueueProducersQueueProducerBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// R2 buckets used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2Buckets struct { + // R2 binding. + R2Binding AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsR2Binding `json:"R2_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2Buckets] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsJSON struct { + R2Binding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2Buckets) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// R2 binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsR2Binding struct { + // Name of the R2 bucket. + Name string `json:"name"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsR2BindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsR2BindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsR2Binding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsR2BindingJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewR2BucketsR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Services used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindings struct { + // Service binding. + ServiceBinding AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsServiceBinding `json:"SERVICE_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindings] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsJSON struct { + ServiceBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Service binding. +type AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsServiceBinding struct { + // The Service environment. + Environment string `json:"environment"` + // The Service name. + Service string `json:"service"` + JSON accountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsServiceBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsServiceBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsServiceBinding] +type accountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsServiceBindingJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsPreviewServiceBindingsServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configs for production deploys. +type AccountPageProjectGetResponseResultDeploymentConfigsProduction struct { + // Constellation bindings used for Pages Functions. + AIBindings AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindings `json:"ai_bindings,nullable"` + // Analytics Engine bindings used for Pages Functions. + AnalyticsEngineDatasets AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasets `json:"analytics_engine_datasets,nullable"` + // Compatibility date used for Pages Functions. + CompatibilityDate string `json:"compatibility_date"` + // Compatibility flags used for Pages Functions. + CompatibilityFlags []interface{} `json:"compatibility_flags"` + // D1 databases used for Pages Functions. + D1Databases AccountPageProjectGetResponseResultDeploymentConfigsProductionD1Databases `json:"d1_databases,nullable"` + // Durabble Object namespaces used for Pages Functions. + DurableObjectNamespaces AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespaces `json:"durable_object_namespaces,nullable"` + // Environment variables for build configs. + EnvVars AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVars `json:"env_vars,nullable"` + // KV namespaces used for Pages Functions. + KvNamespaces AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespaces `json:"kv_namespaces"` + // Placement setting used for Pages Functions. + Placement AccountPageProjectGetResponseResultDeploymentConfigsProductionPlacement `json:"placement,nullable"` + // Queue Producer bindings used for Pages Functions. + QueueProducers AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducers `json:"queue_producers,nullable"` + // R2 buckets used for Pages Functions. + R2Buckets AccountPageProjectGetResponseResultDeploymentConfigsProductionR2Buckets `json:"r2_buckets,nullable"` + // Services used for Pages Functions. + ServiceBindings AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindings `json:"service_bindings,nullable"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionJSON contains the +// JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProduction] +type accountPageProjectGetResponseResultDeploymentConfigsProductionJSON struct { + AIBindings apijson.Field + AnalyticsEngineDatasets apijson.Field + CompatibilityDate apijson.Field + CompatibilityFlags apijson.Field + D1Databases apijson.Field + DurableObjectNamespaces apijson.Field + EnvVars apijson.Field + KvNamespaces apijson.Field + Placement apijson.Field + QueueProducers apijson.Field + R2Buckets apijson.Field + ServiceBindings apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProduction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Constellation bindings used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindings struct { + // AI binding. + AIBinding AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsAIBinding `json:"AI_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindings] +type accountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsJSON struct { + AIBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// AI binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsAIBinding struct { + ProjectID interface{} `json:"project_id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsAIBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsAIBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsAIBinding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsAIBindingJSON struct { + ProjectID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionAIBindingsAIBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Analytics Engine bindings used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasets struct { + // Analytics Engine binding. + AnalyticsEngineBinding AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding `json:"ANALYTICS_ENGINE_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasets] +type accountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsJSON struct { + AnalyticsEngineBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasets) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Analytics Engine binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding struct { + // Name of the dataset. + Dataset string `json:"dataset"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBindingJSON struct { + Dataset apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// D1 databases used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionD1Databases struct { + // D1 binding. + D1Binding AccountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesD1Binding `json:"D1_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionD1Databases] +type accountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesJSON struct { + D1Binding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionD1Databases) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// D1 binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesD1Binding struct { + // UUID of the D1 database. + ID string `json:"id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesD1BindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesD1BindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesD1Binding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesD1BindingJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionD1DatabasesD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Durabble Object namespaces used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespaces struct { + // Durabble Object binding. + DoBinding AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesDoBinding `json:"DO_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespaces] +type accountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesJSON struct { + DoBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespaces) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Durabble Object binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesDoBinding struct { + // ID of the Durabble Object namespace. + NamespaceID string `json:"namespace_id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesDoBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesDoBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesDoBinding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesDoBindingJSON struct { + NamespaceID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionDurableObjectNamespacesDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Environment variables for build configs. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVars struct { + // Environment variable. + EnvironmentVariable AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariable `json:"ENVIRONMENT_VARIABLE"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVars] +type accountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsJSON struct { + EnvironmentVariable apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVars) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Environment variable. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariable struct { + // The type of environment variable (plain text or secret) + Type AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableType `json:"type"` + // Environment variable value. + Value string `json:"value"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariable] +type accountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariable) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of environment variable (plain text or secret) +type AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableType string + +const ( + AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableTypePlainText AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableType = "plain_text" + AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableTypeSecretText AccountPageProjectGetResponseResultDeploymentConfigsProductionEnvVarsEnvironmentVariableType = "secret_text" +) + +// KV namespaces used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespaces struct { + // KV binding. + KvBinding AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesKvBinding `json:"KV_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespaces] +type accountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesJSON struct { + KvBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespaces) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// KV binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesKvBinding struct { + // ID of the KV namespace. + NamespaceID string `json:"namespace_id"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesKvBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesKvBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesKvBinding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesKvBindingJSON struct { + NamespaceID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionKvNamespacesKvBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Placement setting used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionPlacement struct { + // Placement mode. + Mode string `json:"mode"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionPlacementJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionPlacementJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionPlacement] +type accountPageProjectGetResponseResultDeploymentConfigsProductionPlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionPlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Queue Producer bindings used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducers struct { + // Queue Producer binding. + QueueProducerBinding AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersQueueProducerBinding `json:"QUEUE_PRODUCER_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducers] +type accountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersJSON struct { + QueueProducerBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Queue Producer binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersQueueProducerBinding struct { + // Name of the Queue. + Name string `json:"name"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersQueueProducerBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersQueueProducerBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersQueueProducerBinding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersQueueProducerBindingJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionQueueProducersQueueProducerBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// R2 buckets used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionR2Buckets struct { + // R2 binding. + R2Binding AccountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsR2Binding `json:"R2_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionR2Buckets] +type accountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsJSON struct { + R2Binding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionR2Buckets) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// R2 binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsR2Binding struct { + // Name of the R2 bucket. + Name string `json:"name"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsR2BindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsR2BindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsR2Binding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsR2BindingJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionR2BucketsR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Services used for Pages Functions. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindings struct { + // Service binding. + ServiceBinding AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsServiceBinding `json:"SERVICE_BINDING"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindings] +type accountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsJSON struct { + ServiceBinding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Service binding. +type AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsServiceBinding struct { + // The Service environment. + Environment string `json:"environment"` + // The Service name. + Service string `json:"service"` + JSON accountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsServiceBindingJSON `json:"-"` +} + +// accountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsServiceBindingJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsServiceBinding] +type accountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsServiceBindingJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultDeploymentConfigsProductionServiceBindingsServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectGetResponseResultLatestDeployment struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectGetResponseResultLatestDeploymentDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectGetResponseResultLatestDeploymentStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectGetResponseResultLatestDeploymentJSON `json:"-"` +} + +// accountPageProjectGetResponseResultLatestDeploymentJSON contains the JSON +// metadata for the struct [AccountPageProjectGetResponseResultLatestDeployment] +type accountPageProjectGetResponseResultLatestDeploymentJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultLatestDeployment) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectGetResponseResultLatestDeploymentDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultLatestDeploymentDeploymentTrigger] +type accountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultLatestDeploymentDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerMetadata] +type accountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultLatestDeploymentDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectGetResponseResultLatestDeploymentStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectGetResponseResultLatestDeploymentStageJSON `json:"-"` +} + +// accountPageProjectGetResponseResultLatestDeploymentStageJSON contains the JSON +// metadata for the struct +// [AccountPageProjectGetResponseResultLatestDeploymentStage] +type accountPageProjectGetResponseResultLatestDeploymentStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectGetResponseResultLatestDeploymentStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectGetResponseSuccess bool + +const ( + AccountPageProjectGetResponseSuccessTrue AccountPageProjectGetResponseSuccess = true +) + +type AccountPageProjectUpdateResponse struct { + Errors []AccountPageProjectUpdateResponseError `json:"errors"` + Messages []AccountPageProjectUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountPageProjectUpdateResponseSuccess `json:"success"` + JSON accountPageProjectUpdateResponseJSON `json:"-"` +} + +// accountPageProjectUpdateResponseJSON contains the JSON metadata for the struct +// [AccountPageProjectUpdateResponse] +type accountPageProjectUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectUpdateResponseErrorJSON `json:"-"` +} + +// accountPageProjectUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountPageProjectUpdateResponseError] +type accountPageProjectUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectUpdateResponseMessageJSON `json:"-"` +} + +// accountPageProjectUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountPageProjectUpdateResponseMessage] +type accountPageProjectUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectUpdateResponseSuccess bool + +const ( + AccountPageProjectUpdateResponseSuccessTrue AccountPageProjectUpdateResponseSuccess = true +) + +type AccountPageProjectDeleteResponse = interface{} + +type AccountPageProjectPagesProjectNewProjectResponse struct { + Errors []AccountPageProjectPagesProjectNewProjectResponseError `json:"errors"` + Messages []AccountPageProjectPagesProjectNewProjectResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountPageProjectPagesProjectNewProjectResponseSuccess `json:"success"` + JSON accountPageProjectPagesProjectNewProjectResponseJSON `json:"-"` +} + +// accountPageProjectPagesProjectNewProjectResponseJSON contains the JSON metadata +// for the struct [AccountPageProjectPagesProjectNewProjectResponse] +type accountPageProjectPagesProjectNewProjectResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectNewProjectResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectPagesProjectNewProjectResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectPagesProjectNewProjectResponseErrorJSON `json:"-"` +} + +// accountPageProjectPagesProjectNewProjectResponseErrorJSON contains the JSON +// metadata for the struct [AccountPageProjectPagesProjectNewProjectResponseError] +type accountPageProjectPagesProjectNewProjectResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectNewProjectResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectPagesProjectNewProjectResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectPagesProjectNewProjectResponseMessageJSON `json:"-"` +} + +// accountPageProjectPagesProjectNewProjectResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountPageProjectPagesProjectNewProjectResponseMessage] +type accountPageProjectPagesProjectNewProjectResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectNewProjectResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectPagesProjectNewProjectResponseSuccess bool + +const ( + AccountPageProjectPagesProjectNewProjectResponseSuccessTrue AccountPageProjectPagesProjectNewProjectResponseSuccess = true +) + +type AccountPageProjectPagesProjectGetProjectsResponse struct { + Errors []AccountPageProjectPagesProjectGetProjectsResponseError `json:"errors"` + Messages []AccountPageProjectPagesProjectGetProjectsResponseMessage `json:"messages"` + Result []AccountPageProjectPagesProjectGetProjectsResponseResult `json:"result"` + ResultInfo AccountPageProjectPagesProjectGetProjectsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountPageProjectPagesProjectGetProjectsResponseSuccess `json:"success"` + JSON accountPageProjectPagesProjectGetProjectsResponseJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseJSON contains the JSON metadata +// for the struct [AccountPageProjectPagesProjectGetProjectsResponse] +type accountPageProjectPagesProjectGetProjectsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectPagesProjectGetProjectsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectPagesProjectGetProjectsResponseErrorJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseErrorJSON contains the JSON +// metadata for the struct [AccountPageProjectPagesProjectGetProjectsResponseError] +type accountPageProjectPagesProjectGetProjectsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectPagesProjectGetProjectsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectPagesProjectGetProjectsResponseMessageJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountPageProjectPagesProjectGetProjectsResponseMessage] +type accountPageProjectPagesProjectGetProjectsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectPagesProjectGetProjectsResponseResult struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectPagesProjectGetProjectsResponseResultStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectPagesProjectGetProjectsResponseResultJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseResultJSON contains the JSON +// metadata for the struct +// [AccountPageProjectPagesProjectGetProjectsResponseResult] +type accountPageProjectPagesProjectGetProjectsResponseResultJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerJSON +// contains the JSON metadata for the struct +// [AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTrigger] +type accountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerMetadata] +type accountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponseResultDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectPagesProjectGetProjectsResponseResultStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectPagesProjectGetProjectsResponseResultStageJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseResultStageJSON contains the +// JSON metadata for the struct +// [AccountPageProjectPagesProjectGetProjectsResponseResultStage] +type accountPageProjectPagesProjectGetProjectsResponseResultStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponseResultStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectPagesProjectGetProjectsResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + JSON accountPageProjectPagesProjectGetProjectsResponseResultInfoJSON `json:"-"` +} + +// accountPageProjectPagesProjectGetProjectsResponseResultInfoJSON contains the +// JSON metadata for the struct +// [AccountPageProjectPagesProjectGetProjectsResponseResultInfo] +type accountPageProjectPagesProjectGetProjectsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectPagesProjectGetProjectsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectPagesProjectGetProjectsResponseSuccess bool + +const ( + AccountPageProjectPagesProjectGetProjectsResponseSuccessTrue AccountPageProjectPagesProjectGetProjectsResponseSuccess = true +) + +type AccountPageProjectUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountPageProjectUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountPageProjectPagesProjectNewProjectParams struct { + // Configs for the project build process. + BuildConfig param.Field[AccountPageProjectPagesProjectNewProjectParamsBuildConfig] `json:"build_config"` + CanonicalDeployment param.Field[AccountPageProjectPagesProjectNewProjectParamsCanonicalDeployment] `json:"canonical_deployment"` + // Configs for deployments in a project. + DeploymentConfigs param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigs] `json:"deployment_configs"` + LatestDeployment param.Field[AccountPageProjectPagesProjectNewProjectParamsLatestDeployment] `json:"latest_deployment"` + // Name of the project. + Name param.Field[string] `json:"name"` + // Production branch of the project. Used to identify production deployments. + ProductionBranch param.Field[string] `json:"production_branch"` +} + +func (r AccountPageProjectPagesProjectNewProjectParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configs for the project build process. +type AccountPageProjectPagesProjectNewProjectParamsBuildConfig struct { + // Enable build caching for the project. + BuildCaching param.Field[bool] `json:"build_caching"` + // Command used to build project. + BuildCommand param.Field[string] `json:"build_command"` + // Output directory of the build. + DestinationDir param.Field[string] `json:"destination_dir"` + // Directory to run the command. + RootDir param.Field[string] `json:"root_dir"` + // The classifying tag for analytics. + WebAnalyticsTag param.Field[string] `json:"web_analytics_tag"` + // The auth token for analytics. + WebAnalyticsToken param.Field[string] `json:"web_analytics_token"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsBuildConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountPageProjectPagesProjectNewProjectParamsCanonicalDeployment struct { +} + +func (r AccountPageProjectPagesProjectNewProjectParamsCanonicalDeployment) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Info about what caused the deployment. +type AccountPageProjectPagesProjectNewProjectParamsCanonicalDeploymentDeploymentTrigger struct { + // Additional info about the trigger. + Metadata param.Field[AccountPageProjectPagesProjectNewProjectParamsCanonicalDeploymentDeploymentTriggerMetadata] `json:"metadata"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsCanonicalDeploymentDeploymentTrigger) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Additional info about the trigger. +type AccountPageProjectPagesProjectNewProjectParamsCanonicalDeploymentDeploymentTriggerMetadata struct { +} + +func (r AccountPageProjectPagesProjectNewProjectParamsCanonicalDeploymentDeploymentTriggerMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The status of the deployment. +type AccountPageProjectPagesProjectNewProjectParamsCanonicalDeploymentStage struct { + // The current build stage. + Name param.Field[string] `json:"name"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsCanonicalDeploymentStage) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configs for deployments in a project. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigs struct { + // Configs for preview deploys. + Preview param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreview] `json:"preview"` + // Configs for production deploys. + Production param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProduction] `json:"production"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigs) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configs for preview deploys. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreview struct { + // Constellation bindings used for Pages Functions. + AIBindings param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindings] `json:"ai_bindings"` + // Analytics Engine bindings used for Pages Functions. + AnalyticsEngineDatasets param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasets] `json:"analytics_engine_datasets"` + // Compatibility date used for Pages Functions. + CompatibilityDate param.Field[string] `json:"compatibility_date"` + // Compatibility flags used for Pages Functions. + CompatibilityFlags param.Field[[]interface{}] `json:"compatibility_flags"` + // D1 databases used for Pages Functions. + D1Databases param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1Databases] `json:"d1_databases"` + // Durabble Object namespaces used for Pages Functions. + DurableObjectNamespaces param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespaces] `json:"durable_object_namespaces"` + // Environment variables for build configs. + EnvVars param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVars] `json:"env_vars"` + // KV namespaces used for Pages Functions. + KvNamespaces param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespaces] `json:"kv_namespaces"` + // Placement setting used for Pages Functions. + Placement param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewPlacement] `json:"placement"` + // Queue Producer bindings used for Pages Functions. + QueueProducers param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducers] `json:"queue_producers"` + // R2 buckets used for Pages Functions. + R2Buckets param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2Buckets] `json:"r2_buckets"` + // Services used for Pages Functions. + ServiceBindings param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindings] `json:"service_bindings"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreview) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Constellation bindings used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindings struct { + // AI binding. + AIBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindingsAIBinding] `json:"AI_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// AI binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindingsAIBinding struct { + ProjectID param.Field[interface{}] `json:"project_id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindingsAIBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Analytics Engine bindings used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasets struct { + // Analytics Engine binding. + AnalyticsEngineBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding] `json:"ANALYTICS_ENGINE_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasets) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Analytics Engine binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding struct { + // Name of the dataset. + Dataset param.Field[string] `json:"dataset"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// D1 databases used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1Databases struct { + // D1 binding. + D1Binding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1DatabasesD1Binding] `json:"D1_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1Databases) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// D1 binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1DatabasesD1Binding struct { + // UUID of the D1 database. + ID param.Field[string] `json:"id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1DatabasesD1Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Durabble Object namespaces used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespaces struct { + // Durabble Object binding. + DoBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding] `json:"DO_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespaces) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Durabble Object binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding struct { + // ID of the Durabble Object namespace. + NamespaceID param.Field[string] `json:"namespace_id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Environment variables for build configs. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVars struct { + // Environment variable. + EnvironmentVariable param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable] `json:"ENVIRONMENT_VARIABLE"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVars) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Environment variable. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable struct { + // The type of environment variable (plain text or secret) + Type param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType] `json:"type"` + // Environment variable value. + Value param.Field[string] `json:"value"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of environment variable (plain text or secret) +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType string + +const ( + AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypePlainText AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType = "plain_text" + AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypeSecretText AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType = "secret_text" +) + +// KV namespaces used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespaces struct { + // KV binding. + KvBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespacesKvBinding] `json:"KV_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespaces) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// KV binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespacesKvBinding struct { + // ID of the KV namespace. + NamespaceID param.Field[string] `json:"namespace_id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespacesKvBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Placement setting used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewPlacement struct { + // Placement mode. + Mode param.Field[string] `json:"mode"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewPlacement) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Queue Producer bindings used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducers struct { + // Queue Producer binding. + QueueProducerBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding] `json:"QUEUE_PRODUCER_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducers) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Queue Producer binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding struct { + // Name of the Queue. + Name param.Field[string] `json:"name"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// R2 buckets used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2Buckets struct { + // R2 binding. + R2Binding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2BucketsR2Binding] `json:"R2_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2Buckets) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// R2 binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2BucketsR2Binding struct { + // Name of the R2 bucket. + Name param.Field[string] `json:"name"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2BucketsR2Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Services used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindings struct { + // Service binding. + ServiceBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindingsServiceBinding] `json:"SERVICE_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Service binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindingsServiceBinding struct { + // The Service environment. + Environment param.Field[string] `json:"environment"` + // The Service name. + Service param.Field[string] `json:"service"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindingsServiceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configs for production deploys. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProduction struct { + // Constellation bindings used for Pages Functions. + AIBindings param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindings] `json:"ai_bindings"` + // Analytics Engine bindings used for Pages Functions. + AnalyticsEngineDatasets param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasets] `json:"analytics_engine_datasets"` + // Compatibility date used for Pages Functions. + CompatibilityDate param.Field[string] `json:"compatibility_date"` + // Compatibility flags used for Pages Functions. + CompatibilityFlags param.Field[[]interface{}] `json:"compatibility_flags"` + // D1 databases used for Pages Functions. + D1Databases param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1Databases] `json:"d1_databases"` + // Durabble Object namespaces used for Pages Functions. + DurableObjectNamespaces param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespaces] `json:"durable_object_namespaces"` + // Environment variables for build configs. + EnvVars param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVars] `json:"env_vars"` + // KV namespaces used for Pages Functions. + KvNamespaces param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespaces] `json:"kv_namespaces"` + // Placement setting used for Pages Functions. + Placement param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionPlacement] `json:"placement"` + // Queue Producer bindings used for Pages Functions. + QueueProducers param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducers] `json:"queue_producers"` + // R2 buckets used for Pages Functions. + R2Buckets param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2Buckets] `json:"r2_buckets"` + // Services used for Pages Functions. + ServiceBindings param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindings] `json:"service_bindings"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProduction) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Constellation bindings used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindings struct { + // AI binding. + AIBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindingsAIBinding] `json:"AI_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// AI binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindingsAIBinding struct { + ProjectID param.Field[interface{}] `json:"project_id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindingsAIBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Analytics Engine bindings used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasets struct { + // Analytics Engine binding. + AnalyticsEngineBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding] `json:"ANALYTICS_ENGINE_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasets) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Analytics Engine binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding struct { + // Name of the dataset. + Dataset param.Field[string] `json:"dataset"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// D1 databases used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1Databases struct { + // D1 binding. + D1Binding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1DatabasesD1Binding] `json:"D1_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1Databases) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// D1 binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1DatabasesD1Binding struct { + // UUID of the D1 database. + ID param.Field[string] `json:"id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1DatabasesD1Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Durabble Object namespaces used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespaces struct { + // Durabble Object binding. + DoBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding] `json:"DO_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespaces) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Durabble Object binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding struct { + // ID of the Durabble Object namespace. + NamespaceID param.Field[string] `json:"namespace_id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Environment variables for build configs. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVars struct { + // Environment variable. + EnvironmentVariable param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable] `json:"ENVIRONMENT_VARIABLE"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVars) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Environment variable. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable struct { + // The type of environment variable (plain text or secret) + Type param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType] `json:"type"` + // Environment variable value. + Value param.Field[string] `json:"value"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of environment variable (plain text or secret) +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType string + +const ( + AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypePlainText AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType = "plain_text" + AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypeSecretText AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType = "secret_text" +) + +// KV namespaces used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespaces struct { + // KV binding. + KvBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespacesKvBinding] `json:"KV_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespaces) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// KV binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespacesKvBinding struct { + // ID of the KV namespace. + NamespaceID param.Field[string] `json:"namespace_id"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespacesKvBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Placement setting used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionPlacement struct { + // Placement mode. + Mode param.Field[string] `json:"mode"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionPlacement) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Queue Producer bindings used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducers struct { + // Queue Producer binding. + QueueProducerBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding] `json:"QUEUE_PRODUCER_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducers) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Queue Producer binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding struct { + // Name of the Queue. + Name param.Field[string] `json:"name"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// R2 buckets used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2Buckets struct { + // R2 binding. + R2Binding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2BucketsR2Binding] `json:"R2_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2Buckets) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// R2 binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2BucketsR2Binding struct { + // Name of the R2 bucket. + Name param.Field[string] `json:"name"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2BucketsR2Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Services used for Pages Functions. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindings struct { + // Service binding. + ServiceBinding param.Field[AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindingsServiceBinding] `json:"SERVICE_BINDING"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Service binding. +type AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindingsServiceBinding struct { + // The Service environment. + Environment param.Field[string] `json:"environment"` + // The Service name. + Service param.Field[string] `json:"service"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindingsServiceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountPageProjectPagesProjectNewProjectParamsLatestDeployment struct { +} + +func (r AccountPageProjectPagesProjectNewProjectParamsLatestDeployment) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Info about what caused the deployment. +type AccountPageProjectPagesProjectNewProjectParamsLatestDeploymentDeploymentTrigger struct { + // Additional info about the trigger. + Metadata param.Field[AccountPageProjectPagesProjectNewProjectParamsLatestDeploymentDeploymentTriggerMetadata] `json:"metadata"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsLatestDeploymentDeploymentTrigger) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Additional info about the trigger. +type AccountPageProjectPagesProjectNewProjectParamsLatestDeploymentDeploymentTriggerMetadata struct { +} + +func (r AccountPageProjectPagesProjectNewProjectParamsLatestDeploymentDeploymentTriggerMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The status of the deployment. +type AccountPageProjectPagesProjectNewProjectParamsLatestDeploymentStage struct { + // The current build stage. + Name param.Field[string] `json:"name"` +} + +func (r AccountPageProjectPagesProjectNewProjectParamsLatestDeploymentStage) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountpageproject_test.go b/accountpageproject_test.go new file mode 100644 index 00000000000..64172b7fc97 --- /dev/null +++ b/accountpageproject_test.go @@ -0,0 +1,305 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPageProjectGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + ) + 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 TestAccountPageProjectUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + cloudflare.AccountPageProjectUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{ + "deployment_configs": map[string]interface{}{ + "production": map[string]interface{}{ + "compatibility_date": "2022-01-01", + "compatibility_flags": map[string]interface{}{ + "0": "url_standard", + }, + "env_vars": map[string]interface{}{ + "BUILD_VERSION": map[string]interface{}{ + "value": "3.3", + }, + "delete_this_env_var": nil, + "secret_var": map[string]interface{}{ + "type": "secret_text", + "value": "A_CMS_API_TOKEN", + }, + }, + }, + }, + }), + }, + ) + 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 TestAccountPageProjectDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + ) + 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 TestAccountPageProjectPagesProjectNewProjectWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.PagesProjectNewProject( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountPageProjectPagesProjectNewProjectParams{ + BuildConfig: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsBuildConfig{ + BuildCaching: cloudflare.F(true), + BuildCommand: cloudflare.F("npm run build"), + DestinationDir: cloudflare.F("build"), + RootDir: cloudflare.F("/"), + WebAnalyticsTag: cloudflare.F("cee1c73f6e4743d0b5e6bb1a0bcaabcc"), + WebAnalyticsToken: cloudflare.F("021e1057c18547eca7b79f2516f06o7x"), + }), + CanonicalDeployment: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsCanonicalDeployment{}), + DeploymentConfigs: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigs{ + Preview: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreview{ + AIBindings: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindings{ + AIBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAIBindingsAIBinding{ + ProjectID: cloudflare.F[any](map[string]interface{}{}), + }), + }), + AnalyticsEngineDatasets: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasets{ + AnalyticsEngineBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding{ + Dataset: cloudflare.F("api_analytics"), + }), + }), + CompatibilityDate: cloudflare.F("2022-01-01"), + CompatibilityFlags: cloudflare.F([]interface{}{"url_standard"}), + D1Databases: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1Databases{ + D1Binding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewD1DatabasesD1Binding{ + ID: cloudflare.F("445e2955-951a-43f8-a35b-a4d0c8138f63"), + }), + }), + DurableObjectNamespaces: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespaces{ + DoBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), + }), + EnvVars: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVars{ + EnvironmentVariable: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable{ + Type: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypePlainText), + Value: cloudflare.F("hello world"), + }), + }), + KvNamespaces: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespaces{ + KvBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewKvNamespacesKvBinding{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), + }), + Placement: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewPlacement{ + Mode: cloudflare.F("smart"), + }), + QueueProducers: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducers{ + QueueProducerBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding{ + Name: cloudflare.F("some-queue"), + }), + }), + R2Buckets: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2Buckets{ + R2Binding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewR2BucketsR2Binding{ + Name: cloudflare.F("some-bucket"), + }), + }), + ServiceBindings: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindings{ + ServiceBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsPreviewServiceBindingsServiceBinding{ + Environment: cloudflare.F("production"), + Service: cloudflare.F("example-worker"), + }), + }), + }), + Production: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProduction{ + AIBindings: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindings{ + AIBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAIBindingsAIBinding{ + ProjectID: cloudflare.F[any](map[string]interface{}{}), + }), + }), + AnalyticsEngineDatasets: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasets{ + AnalyticsEngineBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding{ + Dataset: cloudflare.F("api_analytics"), + }), + }), + CompatibilityDate: cloudflare.F("2022-01-01"), + CompatibilityFlags: cloudflare.F([]interface{}{"url_standard"}), + D1Databases: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1Databases{ + D1Binding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionD1DatabasesD1Binding{ + ID: cloudflare.F("445e2955-951a-43f8-a35b-a4d0c8138f63"), + }), + }), + DurableObjectNamespaces: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespaces{ + DoBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), + }), + EnvVars: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVars{ + EnvironmentVariable: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable{ + Type: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypePlainText), + Value: cloudflare.F("hello world"), + }), + }), + KvNamespaces: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespaces{ + KvBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionKvNamespacesKvBinding{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), + }), + Placement: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionPlacement{ + Mode: cloudflare.F("smart"), + }), + QueueProducers: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducers{ + QueueProducerBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding{ + Name: cloudflare.F("some-queue"), + }), + }), + R2Buckets: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2Buckets{ + R2Binding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionR2BucketsR2Binding{ + Name: cloudflare.F("some-bucket"), + }), + }), + ServiceBindings: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindings{ + ServiceBinding: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsDeploymentConfigsProductionServiceBindingsServiceBinding{ + Environment: cloudflare.F("production"), + Service: cloudflare.F("example-worker"), + }), + }), + }), + }), + LatestDeployment: cloudflare.F(cloudflare.AccountPageProjectPagesProjectNewProjectParamsLatestDeployment{}), + Name: cloudflare.F("NextJS Blog"), + ProductionBranch: cloudflare.F("main"), + }, + ) + 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 TestAccountPageProjectPagesProjectGetProjects(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.PagesProjectGetProjects(context.TODO(), "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/accountpageprojectdeployment.go b/accountpageprojectdeployment.go new file mode 100644 index 00000000000..3d1bd6cb6a7 --- /dev/null +++ b/accountpageprojectdeployment.go @@ -0,0 +1,738 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageProjectDeploymentService 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 +// [NewAccountPageProjectDeploymentService] method instead. +type AccountPageProjectDeploymentService struct { + Options []option.RequestOption + Histories *AccountPageProjectDeploymentHistoryService + Retries *AccountPageProjectDeploymentRetryService + Rollbacks *AccountPageProjectDeploymentRollbackService +} + +// NewAccountPageProjectDeploymentService 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 NewAccountPageProjectDeploymentService(opts ...option.RequestOption) (r *AccountPageProjectDeploymentService) { + r = &AccountPageProjectDeploymentService{} + r.Options = opts + r.Histories = NewAccountPageProjectDeploymentHistoryService(opts...) + r.Retries = NewAccountPageProjectDeploymentRetryService(opts...) + r.Rollbacks = NewAccountPageProjectDeploymentRollbackService(opts...) + return +} + +// Fetch information about a deployment. +func (r *AccountPageProjectDeploymentService) Get(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string, opts ...option.RequestOption) (res *AccountPageProjectDeploymentGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s", accountIdentifier, projectName, deploymentIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a deployment. +func (r *AccountPageProjectDeploymentService) Delete(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string, opts ...option.RequestOption) (res *AccountPageProjectDeploymentDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s", accountIdentifier, projectName, deploymentIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Start a new deployment from production. The repository and account must have +// already been authorized on the Cloudflare Pages dashboard. +func (r *AccountPageProjectDeploymentService) PagesDeploymentNewDeployment(ctx context.Context, accountIdentifier string, projectName string, body AccountPageProjectDeploymentPagesDeploymentNewDeploymentParams, opts ...option.RequestOption) (res *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetch a list of project deployments. +func (r *AccountPageProjectDeploymentService) PagesDeploymentGetDeployments(ctx context.Context, accountIdentifier string, projectName string, opts ...option.RequestOption) (res *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountPageProjectDeploymentGetResponse struct { + Errors []AccountPageProjectDeploymentGetResponseError `json:"errors"` + Messages []AccountPageProjectDeploymentGetResponseMessage `json:"messages"` + Result AccountPageProjectDeploymentGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDeploymentGetResponseSuccess `json:"success"` + JSON accountPageProjectDeploymentGetResponseJSON `json:"-"` +} + +// accountPageProjectDeploymentGetResponseJSON contains the JSON metadata for the +// struct [AccountPageProjectDeploymentGetResponse] +type accountPageProjectDeploymentGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentGetResponseErrorJSON `json:"-"` +} + +// accountPageProjectDeploymentGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountPageProjectDeploymentGetResponseError] +type accountPageProjectDeploymentGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentGetResponseMessageJSON `json:"-"` +} + +// accountPageProjectDeploymentGetResponseMessageJSON contains the JSON metadata +// for the struct [AccountPageProjectDeploymentGetResponseMessage] +type accountPageProjectDeploymentGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentGetResponseResult struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectDeploymentGetResponseResultDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectDeploymentGetResponseResultStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectDeploymentGetResponseResultJSON `json:"-"` +} + +// accountPageProjectDeploymentGetResponseResultJSON contains the JSON metadata for +// the struct [AccountPageProjectDeploymentGetResponseResult] +type accountPageProjectDeploymentGetResponseResultJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectDeploymentGetResponseResultDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectDeploymentGetResponseResultDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectDeploymentGetResponseResultDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectDeploymentGetResponseResultDeploymentTriggerJSON contains the +// JSON metadata for the struct +// [AccountPageProjectDeploymentGetResponseResultDeploymentTrigger] +type accountPageProjectDeploymentGetResponseResultDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentGetResponseResultDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectDeploymentGetResponseResultDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectDeploymentGetResponseResultDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectDeploymentGetResponseResultDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentGetResponseResultDeploymentTriggerMetadata] +type accountPageProjectDeploymentGetResponseResultDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentGetResponseResultDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectDeploymentGetResponseResultStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectDeploymentGetResponseResultStageJSON `json:"-"` +} + +// accountPageProjectDeploymentGetResponseResultStageJSON contains the JSON +// metadata for the struct [AccountPageProjectDeploymentGetResponseResultStage] +type accountPageProjectDeploymentGetResponseResultStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentGetResponseResultStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDeploymentGetResponseSuccess bool + +const ( + AccountPageProjectDeploymentGetResponseSuccessTrue AccountPageProjectDeploymentGetResponseSuccess = true +) + +type AccountPageProjectDeploymentDeleteResponse = interface{} + +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponse struct { + Errors []AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseError `json:"errors"` + Messages []AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseMessage `json:"messages"` + Result AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseSuccess `json:"success"` + JSON accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseJSON contains +// the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponse] +type accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseErrorJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseError] +type accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseMessageJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseMessage] +type accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResult struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResult] +type accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTrigger] +type accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerMetadata] +type accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultStageJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultStageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultStage] +type accountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseResultStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseSuccess bool + +const ( + AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseSuccessTrue AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponseSuccess = true +) + +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponse struct { + Errors []AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseError `json:"errors"` + Messages []AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseMessage `json:"messages"` + Result []AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResult `json:"result"` + ResultInfo AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseSuccess `json:"success"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseJSON contains +// the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponse] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseErrorJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseError] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseMessageJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseMessage] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResult struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResult] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTrigger] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerMetadata] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultStageJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultStageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultStage] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + JSON accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultInfoJSON `json:"-"` +} + +// accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultInfo] +type accountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseSuccess bool + +const ( + AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseSuccessTrue AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponseSuccess = true +) + +type AccountPageProjectDeploymentPagesDeploymentNewDeploymentParams struct { + // The branch to build the new deployment from. The `HEAD` of the branch will be + // used. If omitted, the production branch will be used by default. + Branch param.Field[string] `json:"branch"` +} + +func (r AccountPageProjectDeploymentPagesDeploymentNewDeploymentParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountpageprojectdeployment_test.go b/accountpageprojectdeployment_test.go new file mode 100644 index 00000000000..0f9e0c79000 --- /dev/null +++ b/accountpageprojectdeployment_test.go @@ -0,0 +1,139 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPageProjectDeploymentGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Deployments.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "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()) + } +} + +func TestAccountPageProjectDeploymentDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Deployments.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "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()) + } +} + +func TestAccountPageProjectDeploymentPagesDeploymentNewDeploymentWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Deployments.PagesDeploymentNewDeployment( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + cloudflare.AccountPageProjectDeploymentPagesDeploymentNewDeploymentParams{ + Branch: cloudflare.F("staging"), + }, + ) + 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 TestAccountPageProjectDeploymentPagesDeploymentGetDeployments(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Deployments.PagesDeploymentGetDeployments( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + ) + 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/accountpageprojectdeploymenthistory.go b/accountpageprojectdeploymenthistory.go new file mode 100644 index 00000000000..71e0eb80d6c --- /dev/null +++ b/accountpageprojectdeploymenthistory.go @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageProjectDeploymentHistoryService 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 +// [NewAccountPageProjectDeploymentHistoryService] method instead. +type AccountPageProjectDeploymentHistoryService struct { + Options []option.RequestOption + Logs *AccountPageProjectDeploymentHistoryLogService +} + +// NewAccountPageProjectDeploymentHistoryService 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 NewAccountPageProjectDeploymentHistoryService(opts ...option.RequestOption) (r *AccountPageProjectDeploymentHistoryService) { + r = &AccountPageProjectDeploymentHistoryService{} + r.Options = opts + r.Logs = NewAccountPageProjectDeploymentHistoryLogService(opts...) + return +} diff --git a/accountpageprojectdeploymenthistorylog.go b/accountpageprojectdeploymenthistorylog.go new file mode 100644 index 00000000000..c5449a0d26a --- /dev/null +++ b/accountpageprojectdeploymenthistorylog.go @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageProjectDeploymentHistoryLogService 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 [NewAccountPageProjectDeploymentHistoryLogService] method instead. +type AccountPageProjectDeploymentHistoryLogService struct { + Options []option.RequestOption +} + +// NewAccountPageProjectDeploymentHistoryLogService 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 NewAccountPageProjectDeploymentHistoryLogService(opts ...option.RequestOption) (r *AccountPageProjectDeploymentHistoryLogService) { + r = &AccountPageProjectDeploymentHistoryLogService{} + r.Options = opts + return +} + +// Fetch deployment logs for a project. +func (r *AccountPageProjectDeploymentHistoryLogService) PagesDeploymentGetDeploymentLogs(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string, opts ...option.RequestOption) (res *AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s/history/logs", accountIdentifier, projectName, deploymentIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponse struct { + Errors []AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseError `json:"errors"` + Messages []AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseSuccess `json:"success"` + JSON accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseJSON `json:"-"` +} + +// accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponse] +type accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseErrorJSON `json:"-"` +} + +// accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseError] +type accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseMessageJSON `json:"-"` +} + +// accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseMessage] +type accountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseSuccess bool + +const ( + AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseSuccessTrue AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponseSuccess = true +) diff --git a/accountpageprojectdeploymenthistorylog_test.go b/accountpageprojectdeploymenthistorylog_test.go new file mode 100644 index 00000000000..44f2597121b --- /dev/null +++ b/accountpageprojectdeploymenthistorylog_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Deployments.Histories.Logs.PagesDeploymentGetDeploymentLogs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "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/accountpageprojectdeploymentretry.go b/accountpageprojectdeploymentretry.go new file mode 100644 index 00000000000..1f35fe3cb1f --- /dev/null +++ b/accountpageprojectdeploymentretry.go @@ -0,0 +1,251 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageProjectDeploymentRetryService 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 +// [NewAccountPageProjectDeploymentRetryService] method instead. +type AccountPageProjectDeploymentRetryService struct { + Options []option.RequestOption +} + +// NewAccountPageProjectDeploymentRetryService 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 NewAccountPageProjectDeploymentRetryService(opts ...option.RequestOption) (r *AccountPageProjectDeploymentRetryService) { + r = &AccountPageProjectDeploymentRetryService{} + r.Options = opts + return +} + +// Retry a previous deployment. +func (r *AccountPageProjectDeploymentRetryService) PagesDeploymentRetryDeployment(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string, opts ...option.RequestOption) (res *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s/retry", accountIdentifier, projectName, deploymentIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponse struct { + Errors []AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseError `json:"errors"` + Messages []AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseMessage `json:"messages"` + Result AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseSuccess `json:"success"` + JSON accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseJSON `json:"-"` +} + +// accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponse] +type accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseErrorJSON `json:"-"` +} + +// accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseError] +type accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseMessageJSON `json:"-"` +} + +// accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseMessage] +type accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResult struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultJSON `json:"-"` +} + +// accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResult] +type accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTrigger] +type accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerMetadata] +type accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultStageJSON `json:"-"` +} + +// accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultStageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultStage] +type accountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseResultStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseSuccess bool + +const ( + AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseSuccessTrue AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponseSuccess = true +) diff --git a/accountpageprojectdeploymentretry_test.go b/accountpageprojectdeploymentretry_test.go new file mode 100644 index 00000000000..c75cd1c4e24 --- /dev/null +++ b/accountpageprojectdeploymentretry_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPageProjectDeploymentRetryPagesDeploymentRetryDeployment(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Deployments.Retries.PagesDeploymentRetryDeployment( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "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/accountpageprojectdeploymentrollback.go b/accountpageprojectdeploymentrollback.go new file mode 100644 index 00000000000..e7e531480b9 --- /dev/null +++ b/accountpageprojectdeploymentrollback.go @@ -0,0 +1,253 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageProjectDeploymentRollbackService 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 +// [NewAccountPageProjectDeploymentRollbackService] method instead. +type AccountPageProjectDeploymentRollbackService struct { + Options []option.RequestOption +} + +// NewAccountPageProjectDeploymentRollbackService 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 NewAccountPageProjectDeploymentRollbackService(opts ...option.RequestOption) (r *AccountPageProjectDeploymentRollbackService) { + r = &AccountPageProjectDeploymentRollbackService{} + r.Options = opts + return +} + +// Rollback the production deployment to a previous deployment. You can only +// rollback to succesful builds on production. +func (r *AccountPageProjectDeploymentRollbackService) PagesDeploymentRollbackDeployment(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string, opts ...option.RequestOption) (res *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s/rollback", accountIdentifier, projectName, deploymentIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponse struct { + Errors []AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseError `json:"errors"` + Messages []AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseMessage `json:"messages"` + Result AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseSuccess `json:"success"` + JSON accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseJSON `json:"-"` +} + +// accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponse] +type accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseErrorJSON `json:"-"` +} + +// accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseError] +type accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseMessageJSON `json:"-"` +} + +// accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseMessage] +type accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResult struct { + // Id of the deployment. + ID string `json:"id"` + // A list of alias URLs pointing to this deployment. + Aliases []interface{} `json:"aliases,nullable"` + BuildConfig interface{} `json:"build_config"` + // When the deployment was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Info about what caused the deployment. + DeploymentTrigger AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTrigger `json:"deployment_trigger"` + // A dict of env variables to build this deploy. + EnvVars interface{} `json:"env_vars"` + // Type of deploy. + Environment string `json:"environment"` + // If the deployment has been skipped. + IsSkipped bool `json:"is_skipped"` + LatestStage interface{} `json:"latest_stage"` + // When the deployment was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Id of the project. + ProjectID string `json:"project_id"` + // Name of the project. + ProjectName string `json:"project_name"` + // Short Id (8 character) of the deployment. + ShortID string `json:"short_id"` + Source interface{} `json:"source"` + // List of past stages. + Stages []AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultStage `json:"stages"` + // The live URL to view this deployment. + URL string `json:"url"` + JSON accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultJSON `json:"-"` +} + +// accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResult] +type accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultJSON struct { + ID apijson.Field + Aliases apijson.Field + BuildConfig apijson.Field + CreatedOn apijson.Field + DeploymentTrigger apijson.Field + EnvVars apijson.Field + Environment apijson.Field + IsSkipped apijson.Field + LatestStage apijson.Field + ModifiedOn apijson.Field + ProjectID apijson.Field + ProjectName apijson.Field + ShortID apijson.Field + Source apijson.Field + Stages apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Info about what caused the deployment. +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTrigger struct { + // Additional info about the trigger. + Metadata AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerMetadata `json:"metadata"` + // What caused the deployment. + Type string `json:"type"` + JSON accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerJSON `json:"-"` +} + +// accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTrigger] +type accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerJSON struct { + Metadata apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Additional info about the trigger. +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerMetadata struct { + // Where the trigger happened. + Branch string `json:"branch"` + // Hash of the deployment trigger commit. + CommitHash string `json:"commit_hash"` + // Message of the deployment trigger commit. + CommitMessage string `json:"commit_message"` + JSON accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerMetadataJSON `json:"-"` +} + +// accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerMetadataJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerMetadata] +type accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerMetadataJSON struct { + Branch apijson.Field + CommitHash apijson.Field + CommitMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultDeploymentTriggerMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the deployment. +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultStage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultStageJSON `json:"-"` +} + +// accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultStageJSON +// contains the JSON metadata for the struct +// [AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultStage] +type accountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultStageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseResultStage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseSuccess bool + +const ( + AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseSuccessTrue AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponseSuccess = true +) diff --git a/accountpageprojectdeploymentrollback_test.go b/accountpageprojectdeploymentrollback_test.go new file mode 100644 index 00000000000..97c029057b4 --- /dev/null +++ b/accountpageprojectdeploymentrollback_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeployment(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Deployments.Rollbacks.PagesDeploymentRollbackDeployment( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "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/accountpageprojectdomain.go b/accountpageprojectdomain.go new file mode 100644 index 00000000000..7acee752d2f --- /dev/null +++ b/accountpageprojectdomain.go @@ -0,0 +1,388 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPageProjectDomainService 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 +// [NewAccountPageProjectDomainService] method instead. +type AccountPageProjectDomainService struct { + Options []option.RequestOption +} + +// NewAccountPageProjectDomainService 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 NewAccountPageProjectDomainService(opts ...option.RequestOption) (r *AccountPageProjectDomainService) { + r = &AccountPageProjectDomainService{} + r.Options = opts + return +} + +// Fetch a single domain. +func (r *AccountPageProjectDomainService) Get(ctx context.Context, accountIdentifier string, projectName string, domainName string, opts ...option.RequestOption) (res *AccountPageProjectDomainGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains/%s", accountIdentifier, projectName, domainName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Retry the validation status of a single domain. +func (r *AccountPageProjectDomainService) Update(ctx context.Context, accountIdentifier string, projectName string, domainName string, opts ...option.RequestOption) (res *AccountPageProjectDomainUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains/%s", accountIdentifier, projectName, domainName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &res, opts...) + return +} + +// Delete a Pages project's domain. +func (r *AccountPageProjectDomainService) Delete(ctx context.Context, accountIdentifier string, projectName string, domainName string, opts ...option.RequestOption) (res *AccountPageProjectDomainDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains/%s", accountIdentifier, projectName, domainName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Add a new domain for the Pages project. +func (r *AccountPageProjectDomainService) PagesDomainsAddDomain(ctx context.Context, accountIdentifier string, projectName string, body AccountPageProjectDomainPagesDomainsAddDomainParams, opts ...option.RequestOption) (res *AccountPageProjectDomainPagesDomainsAddDomainResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetch a list of all domains associated with a Pages project. +func (r *AccountPageProjectDomainService) PagesDomainsGetDomains(ctx context.Context, accountIdentifier string, projectName string, opts ...option.RequestOption) (res *AccountPageProjectDomainPagesDomainsGetDomainsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountPageProjectDomainGetResponse struct { + Errors []AccountPageProjectDomainGetResponseError `json:"errors"` + Messages []AccountPageProjectDomainGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDomainGetResponseSuccess `json:"success"` + JSON accountPageProjectDomainGetResponseJSON `json:"-"` +} + +// accountPageProjectDomainGetResponseJSON contains the JSON metadata for the +// struct [AccountPageProjectDomainGetResponse] +type accountPageProjectDomainGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainGetResponseErrorJSON `json:"-"` +} + +// accountPageProjectDomainGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountPageProjectDomainGetResponseError] +type accountPageProjectDomainGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainGetResponseMessageJSON `json:"-"` +} + +// accountPageProjectDomainGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountPageProjectDomainGetResponseMessage] +type accountPageProjectDomainGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDomainGetResponseSuccess bool + +const ( + AccountPageProjectDomainGetResponseSuccessTrue AccountPageProjectDomainGetResponseSuccess = true +) + +type AccountPageProjectDomainUpdateResponse struct { + Errors []AccountPageProjectDomainUpdateResponseError `json:"errors"` + Messages []AccountPageProjectDomainUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDomainUpdateResponseSuccess `json:"success"` + JSON accountPageProjectDomainUpdateResponseJSON `json:"-"` +} + +// accountPageProjectDomainUpdateResponseJSON contains the JSON metadata for the +// struct [AccountPageProjectDomainUpdateResponse] +type accountPageProjectDomainUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainUpdateResponseErrorJSON `json:"-"` +} + +// accountPageProjectDomainUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountPageProjectDomainUpdateResponseError] +type accountPageProjectDomainUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainUpdateResponseMessageJSON `json:"-"` +} + +// accountPageProjectDomainUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountPageProjectDomainUpdateResponseMessage] +type accountPageProjectDomainUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDomainUpdateResponseSuccess bool + +const ( + AccountPageProjectDomainUpdateResponseSuccessTrue AccountPageProjectDomainUpdateResponseSuccess = true +) + +type AccountPageProjectDomainDeleteResponse = interface{} + +type AccountPageProjectDomainPagesDomainsAddDomainResponse struct { + Errors []AccountPageProjectDomainPagesDomainsAddDomainResponseError `json:"errors"` + Messages []AccountPageProjectDomainPagesDomainsAddDomainResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountPageProjectDomainPagesDomainsAddDomainResponseSuccess `json:"success"` + JSON accountPageProjectDomainPagesDomainsAddDomainResponseJSON `json:"-"` +} + +// accountPageProjectDomainPagesDomainsAddDomainResponseJSON contains the JSON +// metadata for the struct [AccountPageProjectDomainPagesDomainsAddDomainResponse] +type accountPageProjectDomainPagesDomainsAddDomainResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainPagesDomainsAddDomainResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainPagesDomainsAddDomainResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainPagesDomainsAddDomainResponseErrorJSON `json:"-"` +} + +// accountPageProjectDomainPagesDomainsAddDomainResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountPageProjectDomainPagesDomainsAddDomainResponseError] +type accountPageProjectDomainPagesDomainsAddDomainResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainPagesDomainsAddDomainResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainPagesDomainsAddDomainResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainPagesDomainsAddDomainResponseMessageJSON `json:"-"` +} + +// accountPageProjectDomainPagesDomainsAddDomainResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountPageProjectDomainPagesDomainsAddDomainResponseMessage] +type accountPageProjectDomainPagesDomainsAddDomainResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainPagesDomainsAddDomainResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDomainPagesDomainsAddDomainResponseSuccess bool + +const ( + AccountPageProjectDomainPagesDomainsAddDomainResponseSuccessTrue AccountPageProjectDomainPagesDomainsAddDomainResponseSuccess = true +) + +type AccountPageProjectDomainPagesDomainsGetDomainsResponse struct { + Errors []AccountPageProjectDomainPagesDomainsGetDomainsResponseError `json:"errors"` + Messages []AccountPageProjectDomainPagesDomainsGetDomainsResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo AccountPageProjectDomainPagesDomainsGetDomainsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountPageProjectDomainPagesDomainsGetDomainsResponseSuccess `json:"success"` + JSON accountPageProjectDomainPagesDomainsGetDomainsResponseJSON `json:"-"` +} + +// accountPageProjectDomainPagesDomainsGetDomainsResponseJSON contains the JSON +// metadata for the struct [AccountPageProjectDomainPagesDomainsGetDomainsResponse] +type accountPageProjectDomainPagesDomainsGetDomainsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainPagesDomainsGetDomainsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainPagesDomainsGetDomainsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainPagesDomainsGetDomainsResponseErrorJSON `json:"-"` +} + +// accountPageProjectDomainPagesDomainsGetDomainsResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountPageProjectDomainPagesDomainsGetDomainsResponseError] +type accountPageProjectDomainPagesDomainsGetDomainsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainPagesDomainsGetDomainsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainPagesDomainsGetDomainsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPageProjectDomainPagesDomainsGetDomainsResponseMessageJSON `json:"-"` +} + +// accountPageProjectDomainPagesDomainsGetDomainsResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountPageProjectDomainPagesDomainsGetDomainsResponseMessage] +type accountPageProjectDomainPagesDomainsGetDomainsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainPagesDomainsGetDomainsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPageProjectDomainPagesDomainsGetDomainsResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + JSON accountPageProjectDomainPagesDomainsGetDomainsResponseResultInfoJSON `json:"-"` +} + +// accountPageProjectDomainPagesDomainsGetDomainsResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountPageProjectDomainPagesDomainsGetDomainsResponseResultInfo] +type accountPageProjectDomainPagesDomainsGetDomainsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPageProjectDomainPagesDomainsGetDomainsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPageProjectDomainPagesDomainsGetDomainsResponseSuccess bool + +const ( + AccountPageProjectDomainPagesDomainsGetDomainsResponseSuccessTrue AccountPageProjectDomainPagesDomainsGetDomainsResponseSuccess = true +) + +type AccountPageProjectDomainPagesDomainsAddDomainParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountPageProjectDomainPagesDomainsAddDomainParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountpageprojectdomain_test.go b/accountpageprojectdomain_test.go new file mode 100644 index 00000000000..cc38491ff99 --- /dev/null +++ b/accountpageprojectdomain_test.go @@ -0,0 +1,172 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPageProjectDomainGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Domains.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "string", + ) + 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 TestAccountPageProjectDomainUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Domains.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "string", + ) + 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 TestAccountPageProjectDomainDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Domains.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + "string", + ) + 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 TestAccountPageProjectDomainPagesDomainsAddDomain(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Domains.PagesDomainsAddDomain( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + cloudflare.AccountPageProjectDomainPagesDomainsAddDomainParams{ + Body: cloudflare.F[any](map[string]interface{}{ + "name": "example.com", + }), + }, + ) + 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 TestAccountPageProjectDomainPagesDomainsGetDomains(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pages.Projects.Domains.PagesDomainsGetDomains( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + ) + 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/accountpagesproject.go b/accountpagesproject.go new file mode 100644 index 00000000000..ef55945e6bf --- /dev/null +++ b/accountpagesproject.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPagesProjectService 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 [NewAccountPagesProjectService] +// method instead. +type AccountPagesProjectService struct { + Options []option.RequestOption +} + +// NewAccountPagesProjectService 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 NewAccountPagesProjectService(opts ...option.RequestOption) (r *AccountPagesProjectService) { + r = &AccountPagesProjectService{} + r.Options = opts + return +} + +// Purge all cached build artifacts for a Pages project +func (r *AccountPagesProjectService) PurgeBuildCache(ctx context.Context, accountIdentifier string, projectName string, opts ...option.RequestOption) (res *AccountPagesProjectPurgeBuildCacheResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/purge_build_cache", accountIdentifier, projectName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountPagesProjectPurgeBuildCacheResponse = interface{} diff --git a/accountpagesproject_test.go b/accountpagesproject_test.go new file mode 100644 index 00000000000..5dc1bc64128 --- /dev/null +++ b/accountpagesproject_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPagesProjectPurgeBuildCache(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.PagesProjects.PurgeBuildCache( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is-my-project-01", + ) + 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/accountpcap.go b/accountpcap.go new file mode 100644 index 00000000000..85ab7fb7313 --- /dev/null +++ b/accountpcap.go @@ -0,0 +1,1130 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPcapService 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 [NewAccountPcapService] method +// instead. +type AccountPcapService struct { + Options []option.RequestOption + Ownerships *AccountPcapOwnershipService + Downloads *AccountPcapDownloadService +} + +// NewAccountPcapService 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 NewAccountPcapService(opts ...option.RequestOption) (r *AccountPcapService) { + r = &AccountPcapService{} + r.Options = opts + r.Ownerships = NewAccountPcapOwnershipService(opts...) + r.Downloads = NewAccountPcapDownloadService(opts...) + return +} + +// Get information for a PCAP request by id. +func (r *AccountPcapService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountPcapGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pcaps/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Create new PCAP request for account. +func (r *AccountPcapService) MagicPcapCollectionNewPcapRequest(ctx context.Context, accountIdentifier string, body AccountPcapMagicPcapCollectionNewPcapRequestParams, opts ...option.RequestOption) (res *AccountPcapMagicPcapCollectionNewPcapRequestResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pcaps", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all packet capture requests for an account. +func (r *AccountPcapService) MagicPcapCollectionListPacketCaptureRequests(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pcaps", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountPcapGetResponse struct { + Errors []AccountPcapGetResponseError `json:"errors"` + Messages []AccountPcapGetResponseMessage `json:"messages"` + Result AccountPcapGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPcapGetResponseSuccess `json:"success"` + JSON accountPcapGetResponseJSON `json:"-"` +} + +// accountPcapGetResponseJSON contains the JSON metadata for the struct +// [AccountPcapGetResponse] +type accountPcapGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapGetResponseErrorJSON `json:"-"` +} + +// accountPcapGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountPcapGetResponseError] +type accountPcapGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapGetResponseMessageJSON `json:"-"` +} + +// accountPcapGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountPcapGetResponseMessage] +type accountPcapGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimple] or +// [AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFull]. +type AccountPcapGetResponseResult interface { + implementsAccountPcapGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountPcapGetResponseResult)(nil)).Elem(), "") +} + +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimple struct { + // The ID for the packet capture. + ID string `json:"id"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1 `json:"filter_v1"` + // The status of the packet capture request. + Status AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus `json:"status"` + // The RFC 3339 timestamp when the packet capture was created. + Submitted string `json:"submitted"` + // The system used to collect packet captures. + System AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleSystem `json:"system"` + // The packet capture duration in seconds. + TimeLimit float64 `json:"time_limit"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleType `json:"type"` + JSON accountPcapGetResponseResultJf8Dd6b2PcapsResponseSimpleJSON `json:"-"` +} + +// accountPcapGetResponseResultJf8Dd6b2PcapsResponseSimpleJSON contains the JSON +// metadata for the struct +// [AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimple] +type accountPcapGetResponseResultJf8Dd6b2PcapsResponseSimpleJSON struct { + ID apijson.Field + FilterV1 apijson.Field + Status apijson.Field + Submitted apijson.Field + System apijson.Field + TimeLimit apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimple) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimple) implementsAccountPcapGetResponseResult() { +} + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress string `json:"destination_address"` + // The destination port of the packet. + DestinationPort float64 `json:"destination_port"` + // The protocol number of the packet. + Protocol float64 `json:"protocol"` + // The source IP address of the packet. + SourceAddress string `json:"source_address"` + // The source port of the packet. + SourcePort float64 `json:"source_port"` + JSON accountPcapGetResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON `json:"-"` +} + +// accountPcapGetResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON contains the +// JSON metadata for the struct +// [AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1] +type accountPcapGetResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON struct { + DestinationAddress apijson.Field + DestinationPort apijson.Field + Protocol apijson.Field + SourceAddress apijson.Field + SourcePort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the packet capture request. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus string + +const ( + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusUnknown AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "unknown" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusSuccess AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "success" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusPending AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "pending" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusRunning AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "running" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusConversionPending AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "conversion_pending" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusConversionRunning AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "conversion_running" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusComplete AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "complete" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatusFailed AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "failed" +) + +// The system used to collect packet captures. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleSystem string + +const ( + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleSystemMagicTransit AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleType string + +const ( + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleTypeSimple AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleType = "simple" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleTypeFull AccountPcapGetResponseResultJF8Dd6b2PcapsResponseSimpleType = "full" +) + +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFull struct { + // The ID for the packet capture. + ID string `json:"id"` + // The maximum number of bytes to capture. This field only applies to `full` packet + // captures. + ByteLimit float64 `json:"byte_limit"` + // The name of the data center used for the packet capture. This can be a specific + // colo (ord02) or a multi-colo name (ORD). This field only applies to `full` + // packet captures. + ColoName string `json:"colo_name"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf string `json:"destination_conf"` + // An error message that describes why the packet capture failed. This field only + // applies to `full` packet captures. + ErrorMessage string `json:"error_message"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullFilterV1 `json:"filter_v1"` + // The status of the packet capture request. + Status AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus `json:"status"` + // The RFC 3339 timestamp when the packet capture was created. + Submitted string `json:"submitted"` + // The system used to collect packet captures. + System AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullSystem `json:"system"` + // The packet capture duration in seconds. + TimeLimit float64 `json:"time_limit"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullType `json:"type"` + JSON accountPcapGetResponseResultJf8Dd6b2PcapsResponseFullJSON `json:"-"` +} + +// accountPcapGetResponseResultJf8Dd6b2PcapsResponseFullJSON contains the JSON +// metadata for the struct [AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFull] +type accountPcapGetResponseResultJf8Dd6b2PcapsResponseFullJSON struct { + ID apijson.Field + ByteLimit apijson.Field + ColoName apijson.Field + DestinationConf apijson.Field + ErrorMessage apijson.Field + FilterV1 apijson.Field + Status apijson.Field + Submitted apijson.Field + System apijson.Field + TimeLimit apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFull) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFull) implementsAccountPcapGetResponseResult() { +} + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress string `json:"destination_address"` + // The destination port of the packet. + DestinationPort float64 `json:"destination_port"` + // The protocol number of the packet. + Protocol float64 `json:"protocol"` + // The source IP address of the packet. + SourceAddress string `json:"source_address"` + // The source port of the packet. + SourcePort float64 `json:"source_port"` + JSON accountPcapGetResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON `json:"-"` +} + +// accountPcapGetResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON contains the +// JSON metadata for the struct +// [AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullFilterV1] +type accountPcapGetResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON struct { + DestinationAddress apijson.Field + DestinationPort apijson.Field + Protocol apijson.Field + SourceAddress apijson.Field + SourcePort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullFilterV1) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the packet capture request. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus string + +const ( + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusUnknown AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "unknown" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusSuccess AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "success" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusPending AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "pending" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusRunning AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "running" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusConversionPending AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "conversion_pending" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusConversionRunning AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "conversion_running" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusComplete AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "complete" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatusFailed AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullStatus = "failed" +) + +// The system used to collect packet captures. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullSystem string + +const ( + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullSystemMagicTransit AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullType string + +const ( + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullTypeSimple AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullType = "simple" + AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullTypeFull AccountPcapGetResponseResultJF8Dd6b2PcapsResponseFullType = "full" +) + +// Whether the API call was successful +type AccountPcapGetResponseSuccess bool + +const ( + AccountPcapGetResponseSuccessTrue AccountPcapGetResponseSuccess = true +) + +type AccountPcapMagicPcapCollectionNewPcapRequestResponse struct { + Errors []AccountPcapMagicPcapCollectionNewPcapRequestResponseError `json:"errors"` + Messages []AccountPcapMagicPcapCollectionNewPcapRequestResponseMessage `json:"messages"` + Result AccountPcapMagicPcapCollectionNewPcapRequestResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPcapMagicPcapCollectionNewPcapRequestResponseSuccess `json:"success"` + JSON accountPcapMagicPcapCollectionNewPcapRequestResponseJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionNewPcapRequestResponseJSON contains the JSON +// metadata for the struct [AccountPcapMagicPcapCollectionNewPcapRequestResponse] +type accountPcapMagicPcapCollectionNewPcapRequestResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionNewPcapRequestResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapMagicPcapCollectionNewPcapRequestResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapMagicPcapCollectionNewPcapRequestResponseErrorJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionNewPcapRequestResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseError] +type accountPcapMagicPcapCollectionNewPcapRequestResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionNewPcapRequestResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapMagicPcapCollectionNewPcapRequestResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapMagicPcapCollectionNewPcapRequestResponseMessageJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionNewPcapRequestResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseMessage] +type accountPcapMagicPcapCollectionNewPcapRequestResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionNewPcapRequestResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimple] +// or +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFull]. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResult interface { + implementsAccountPcapMagicPcapCollectionNewPcapRequestResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountPcapMagicPcapCollectionNewPcapRequestResponseResult)(nil)).Elem(), "") +} + +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimple struct { + // The ID for the packet capture. + ID string `json:"id"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1 `json:"filter_v1"` + // The status of the packet capture request. + Status AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus `json:"status"` + // The RFC 3339 timestamp when the packet capture was created. + Submitted string `json:"submitted"` + // The system used to collect packet captures. + System AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleSystem `json:"system"` + // The packet capture duration in seconds. + TimeLimit float64 `json:"time_limit"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleType `json:"type"` + JSON accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseSimpleJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseSimpleJSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimple] +type accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseSimpleJSON struct { + ID apijson.Field + FilterV1 apijson.Field + Status apijson.Field + Submitted apijson.Field + System apijson.Field + TimeLimit apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimple) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimple) implementsAccountPcapMagicPcapCollectionNewPcapRequestResponseResult() { +} + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress string `json:"destination_address"` + // The destination port of the packet. + DestinationPort float64 `json:"destination_port"` + // The protocol number of the packet. + Protocol float64 `json:"protocol"` + // The source IP address of the packet. + SourceAddress string `json:"source_address"` + // The source port of the packet. + SourcePort float64 `json:"source_port"` + JSON accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON `json:"-"` +} + +// accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1] +type accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON struct { + DestinationAddress apijson.Field + DestinationPort apijson.Field + Protocol apijson.Field + SourceAddress apijson.Field + SourcePort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the packet capture request. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusUnknown AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "unknown" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusSuccess AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "success" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusPending AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "pending" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusRunning AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "running" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusConversionPending AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "conversion_pending" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusConversionRunning AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "conversion_running" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusComplete AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "complete" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatusFailed AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "failed" +) + +// The system used to collect packet captures. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleSystem string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleSystemMagicTransit AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleType string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleTypeSimple AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleType = "simple" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleTypeFull AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseSimpleType = "full" +) + +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFull struct { + // The ID for the packet capture. + ID string `json:"id"` + // The maximum number of bytes to capture. This field only applies to `full` packet + // captures. + ByteLimit float64 `json:"byte_limit"` + // The name of the data center used for the packet capture. This can be a specific + // colo (ord02) or a multi-colo name (ORD). This field only applies to `full` + // packet captures. + ColoName string `json:"colo_name"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf string `json:"destination_conf"` + // An error message that describes why the packet capture failed. This field only + // applies to `full` packet captures. + ErrorMessage string `json:"error_message"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullFilterV1 `json:"filter_v1"` + // The status of the packet capture request. + Status AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus `json:"status"` + // The RFC 3339 timestamp when the packet capture was created. + Submitted string `json:"submitted"` + // The system used to collect packet captures. + System AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullSystem `json:"system"` + // The packet capture duration in seconds. + TimeLimit float64 `json:"time_limit"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullType `json:"type"` + JSON accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseFullJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseFullJSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFull] +type accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseFullJSON struct { + ID apijson.Field + ByteLimit apijson.Field + ColoName apijson.Field + DestinationConf apijson.Field + ErrorMessage apijson.Field + FilterV1 apijson.Field + Status apijson.Field + Submitted apijson.Field + System apijson.Field + TimeLimit apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFull) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFull) implementsAccountPcapMagicPcapCollectionNewPcapRequestResponseResult() { +} + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress string `json:"destination_address"` + // The destination port of the packet. + DestinationPort float64 `json:"destination_port"` + // The protocol number of the packet. + Protocol float64 `json:"protocol"` + // The source IP address of the packet. + SourceAddress string `json:"source_address"` + // The source port of the packet. + SourcePort float64 `json:"source_port"` + JSON accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON `json:"-"` +} + +// accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullFilterV1] +type accountPcapMagicPcapCollectionNewPcapRequestResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON struct { + DestinationAddress apijson.Field + DestinationPort apijson.Field + Protocol apijson.Field + SourceAddress apijson.Field + SourcePort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullFilterV1) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the packet capture request. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusUnknown AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "unknown" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusSuccess AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "success" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusPending AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "pending" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusRunning AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "running" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusConversionPending AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "conversion_pending" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusConversionRunning AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "conversion_running" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusComplete AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "complete" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatusFailed AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullStatus = "failed" +) + +// The system used to collect packet captures. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullSystem string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullSystemMagicTransit AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullType string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullTypeSimple AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullType = "simple" + AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullTypeFull AccountPcapMagicPcapCollectionNewPcapRequestResponseResultJF8Dd6b2PcapsResponseFullType = "full" +) + +// Whether the API call was successful +type AccountPcapMagicPcapCollectionNewPcapRequestResponseSuccess bool + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestResponseSuccessTrue AccountPcapMagicPcapCollectionNewPcapRequestResponseSuccess = true +) + +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponse struct { + Errors []AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseError `json:"errors"` + Messages []AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseMessage `json:"messages"` + Result []AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResult `json:"result"` + ResultInfo AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseSuccess `json:"success"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseJSON contains the +// JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponse] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseErrorJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseError] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseMessageJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseMessage] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimple] +// or +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFull]. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResult interface { + implementsAccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResult)(nil)).Elem(), "") +} + +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimple struct { + // The ID for the packet capture. + ID string `json:"id"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1 `json:"filter_v1"` + // The status of the packet capture request. + Status AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus `json:"status"` + // The RFC 3339 timestamp when the packet capture was created. + Submitted string `json:"submitted"` + // The system used to collect packet captures. + System AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleSystem `json:"system"` + // The packet capture duration in seconds. + TimeLimit float64 `json:"time_limit"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleType `json:"type"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseSimpleJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseSimpleJSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimple] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseSimpleJSON struct { + ID apijson.Field + FilterV1 apijson.Field + Status apijson.Field + Submitted apijson.Field + System apijson.Field + TimeLimit apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimple) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimple) implementsAccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResult() { +} + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress string `json:"destination_address"` + // The destination port of the packet. + DestinationPort float64 `json:"destination_port"` + // The protocol number of the packet. + Protocol float64 `json:"protocol"` + // The source IP address of the packet. + SourceAddress string `json:"source_address"` + // The source port of the packet. + SourcePort float64 `json:"source_port"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseSimpleFilterV1JSON struct { + DestinationAddress apijson.Field + DestinationPort apijson.Field + Protocol apijson.Field + SourceAddress apijson.Field + SourcePort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleFilterV1) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the packet capture request. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus string + +const ( + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusUnknown AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "unknown" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusSuccess AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "success" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusPending AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "pending" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusRunning AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "running" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusConversionPending AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "conversion_pending" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusConversionRunning AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "conversion_running" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusComplete AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "complete" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatusFailed AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleStatus = "failed" +) + +// The system used to collect packet captures. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleSystem string + +const ( + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleSystemMagicTransit AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleType string + +const ( + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleTypeSimple AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleType = "simple" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleTypeFull AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseSimpleType = "full" +) + +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFull struct { + // The ID for the packet capture. + ID string `json:"id"` + // The maximum number of bytes to capture. This field only applies to `full` packet + // captures. + ByteLimit float64 `json:"byte_limit"` + // The name of the data center used for the packet capture. This can be a specific + // colo (ord02) or a multi-colo name (ORD). This field only applies to `full` + // packet captures. + ColoName string `json:"colo_name"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf string `json:"destination_conf"` + // An error message that describes why the packet capture failed. This field only + // applies to `full` packet captures. + ErrorMessage string `json:"error_message"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullFilterV1 `json:"filter_v1"` + // The status of the packet capture request. + Status AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus `json:"status"` + // The RFC 3339 timestamp when the packet capture was created. + Submitted string `json:"submitted"` + // The system used to collect packet captures. + System AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullSystem `json:"system"` + // The packet capture duration in seconds. + TimeLimit float64 `json:"time_limit"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullType `json:"type"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseFullJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseFullJSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFull] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseFullJSON struct { + ID apijson.Field + ByteLimit apijson.Field + ColoName apijson.Field + DestinationConf apijson.Field + ErrorMessage apijson.Field + FilterV1 apijson.Field + Status apijson.Field + Submitted apijson.Field + System apijson.Field + TimeLimit apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFull) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFull) implementsAccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResult() { +} + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress string `json:"destination_address"` + // The destination port of the packet. + DestinationPort float64 `json:"destination_port"` + // The protocol number of the packet. + Protocol float64 `json:"protocol"` + // The source IP address of the packet. + SourceAddress string `json:"source_address"` + // The source port of the packet. + SourcePort float64 `json:"source_port"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullFilterV1] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJf8Dd6b2PcapsResponseFullFilterV1JSON struct { + DestinationAddress apijson.Field + DestinationPort apijson.Field + Protocol apijson.Field + SourceAddress apijson.Field + SourcePort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullFilterV1) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the packet capture request. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus string + +const ( + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusUnknown AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "unknown" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusSuccess AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "success" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusPending AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "pending" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusRunning AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "running" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusConversionPending AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "conversion_pending" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusConversionRunning AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "conversion_running" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusComplete AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "complete" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatusFailed AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullStatus = "failed" +) + +// The system used to collect packet captures. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullSystem string + +const ( + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullSystemMagicTransit AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullType string + +const ( + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullTypeSimple AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullType = "simple" + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullTypeFull AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultJF8Dd6b2PcapsResponseFullType = "full" +) + +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultInfoJSON `json:"-"` +} + +// accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultInfo] +type accountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseSuccess bool + +const ( + AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseSuccessTrue AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponseSuccess = true +) + +// This interface is a union satisfied by one of the following: +// [AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestSimple], +// [AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestFull]. +type AccountPcapMagicPcapCollectionNewPcapRequestParams interface { + ImplementsAccountPcapMagicPcapCollectionNewPcapRequestParams() +} + +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestSimple struct { + // The limit of packets contained in a packet capture. + PacketLimit param.Field[float64] `json:"packet_limit,required"` + // The system used to collect packet captures. + System param.Field[AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleSystem] `json:"system,required"` + // The packet capture duration in seconds. + TimeLimit param.Field[float64] `json:"time_limit,required"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type param.Field[AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleType] `json:"type,required"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 param.Field[AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleFilterV1] `json:"filter_v1"` +} + +func (r AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestSimple) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestSimple) ImplementsAccountPcapMagicPcapCollectionNewPcapRequestParams() { + +} + +// The system used to collect packet captures. +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleSystem string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleSystemMagicTransit AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleType string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleTypeSimple AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleType = "simple" + AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleTypeFull AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleType = "full" +) + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress param.Field[string] `json:"destination_address"` + // The destination port of the packet. + DestinationPort param.Field[float64] `json:"destination_port"` + // The protocol number of the packet. + Protocol param.Field[float64] `json:"protocol"` + // The source IP address of the packet. + SourceAddress param.Field[string] `json:"source_address"` + // The source port of the packet. + SourcePort param.Field[float64] `json:"source_port"` +} + +func (r AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleFilterV1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestFull struct { + // The name of the data center used for the packet capture. This can be a specific + // colo (ord02) or a multi-colo name (ORD). This field only applies to `full` + // packet captures. + ColoName param.Field[string] `json:"colo_name,required"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf param.Field[string] `json:"destination_conf,required"` + // The system used to collect packet captures. + System param.Field[AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullSystem] `json:"system,required"` + // The packet capture duration in seconds. + TimeLimit param.Field[float64] `json:"time_limit,required"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type param.Field[AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullType] `json:"type,required"` + // The maximum number of bytes to capture. This field only applies to `full` packet + // captures. + ByteLimit param.Field[float64] `json:"byte_limit"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 param.Field[AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullFilterV1] `json:"filter_v1"` + // The limit of packets contained in a packet capture. + PacketLimit param.Field[float64] `json:"packet_limit"` +} + +func (r AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestFull) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestFull) ImplementsAccountPcapMagicPcapCollectionNewPcapRequestParams() { + +} + +// The system used to collect packet captures. +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullSystem string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullSystemMagicTransit AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullSystem = "magic-transit" +) + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullType string + +const ( + AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullTypeSimple AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullType = "simple" + AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullTypeFull AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullType = "full" +) + +// The packet capture filter. When this field is empty, all packets are captured. +type AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress param.Field[string] `json:"destination_address"` + // The destination port of the packet. + DestinationPort param.Field[float64] `json:"destination_port"` + // The protocol number of the packet. + Protocol param.Field[float64] `json:"protocol"` + // The source IP address of the packet. + SourceAddress param.Field[string] `json:"source_address"` + // The source port of the packet. + SourcePort param.Field[float64] `json:"source_port"` +} + +func (r AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestFullFilterV1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountpcap_test.go b/accountpcap_test.go new file mode 100644 index 00000000000..b893e44a66e --- /dev/null +++ b/accountpcap_test.go @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPcapGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pcaps.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountPcapMagicPcapCollectionNewPcapRequestWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pcaps.MagicPcapCollectionNewPcapRequest( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountPcapMagicPcapCollectionNewPcapRequestParamsJF8Dd6b2PcapsRequestSimple{ + PacketLimit: cloudflare.F(10000.000000), + System: cloudflare.F(cloudflare.AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleSystemMagicTransit), + TimeLimit: cloudflare.F(300.000000), + Type: cloudflare.F(cloudflare.AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleTypeSimple), + FilterV1: cloudflare.F(cloudflare.AccountPcapMagicPcapCollectionNewPcapRequestParamsJf8Dd6b2PcapsRequestSimpleFilterV1{ + DestinationAddress: cloudflare.F("1.2.3.4"), + DestinationPort: cloudflare.F(80.000000), + Protocol: cloudflare.F(6.000000), + SourceAddress: cloudflare.F("1.2.3.4"), + SourcePort: cloudflare.F(123.000000), + }), + }, + ) + 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 TestAccountPcapMagicPcapCollectionListPacketCaptureRequests(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pcaps.MagicPcapCollectionListPacketCaptureRequests(context.TODO(), "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/accountpcapdownload.go b/accountpcapdownload.go new file mode 100644 index 00000000000..57d589cfd39 --- /dev/null +++ b/accountpcapdownload.go @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPcapDownloadService 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 [NewAccountPcapDownloadService] +// method instead. +type AccountPcapDownloadService struct { + Options []option.RequestOption +} + +// NewAccountPcapDownloadService 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 NewAccountPcapDownloadService(opts ...option.RequestOption) (r *AccountPcapDownloadService) { + r = &AccountPcapDownloadService{} + r.Options = opts + return +} + +// Download PCAP information into a file. Response is a binary PCAP file. +func (r *AccountPcapDownloadService) List(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "application/vnd.tcpdump.pcap")}, opts...) + path := fmt.Sprintf("accounts/%s/pcaps/%s/download", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} diff --git a/accountpcapdownload_test.go b/accountpcapdownload_test.go new file mode 100644 index 00000000000..6212a648e35 --- /dev/null +++ b/accountpcapdownload_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPcapDownloadList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Accounts.Pcaps.Downloads.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/accountpcapownership.go b/accountpcapownership.go new file mode 100644 index 00000000000..32011b818df --- /dev/null +++ b/accountpcapownership.go @@ -0,0 +1,328 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPcapOwnershipService 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 [NewAccountPcapOwnershipService] +// method instead. +type AccountPcapOwnershipService struct { + Options []option.RequestOption + Validates *AccountPcapOwnershipValidateService +} + +// NewAccountPcapOwnershipService 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 NewAccountPcapOwnershipService(opts ...option.RequestOption) (r *AccountPcapOwnershipService) { + r = &AccountPcapOwnershipService{} + r.Options = opts + r.Validates = NewAccountPcapOwnershipValidateService(opts...) + return +} + +// Deletes buckets added to the packet captures API. +func (r *AccountPcapOwnershipService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/pcaps/ownership/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Adds an AWS or GCP bucket to use with full packet captures. +func (r *AccountPcapOwnershipService) MagicPcapCollectionAddBucketsForFullPacketCaptures(ctx context.Context, accountIdentifier string, body AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesParams, opts ...option.RequestOption) (res *AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pcaps/ownership", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all buckets configured for use with PCAPs API. +func (r *AccountPcapOwnershipService) MagicPcapCollectionListPcaPsBucketOwnership(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pcaps/ownership", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponse struct { + Errors []AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseError `json:"errors"` + Messages []AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseMessage `json:"messages"` + Result AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseSuccess `json:"success"` + JSON accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponse] +type accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseErrorJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseError] +type accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseMessageJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseMessage] +type accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResult struct { + // The bucket ID associated with the packet captures API. + ID string `json:"id,required"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf string `json:"destination_conf,required"` + // The ownership challenge filename stored in the bucket. + Filename string `json:"filename,required"` + // The status of the ownership challenge. Can be pending, success or failed. + Status AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatus `json:"status,required"` + // The RFC 3339 timestamp when the bucket was added to packet captures API. + Submitted string `json:"submitted,required"` + // The RFC 3339 timestamp when the bucket was validated. + Validated string `json:"validated"` + JSON accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResult] +type accountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultJSON struct { + ID apijson.Field + DestinationConf apijson.Field + Filename apijson.Field + Status apijson.Field + Submitted apijson.Field + Validated apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the ownership challenge. Can be pending, success or failed. +type AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatus string + +const ( + AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatusPending AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatus = "pending" + AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatusSuccess AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatus = "success" + AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatusFailed AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseResultStatus = "failed" +) + +// Whether the API call was successful +type AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseSuccess bool + +const ( + AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseSuccessTrue AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponseSuccess = true +) + +type AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponse struct { + Errors []AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseError `json:"errors"` + Messages []AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseMessage `json:"messages"` + Result []AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResult `json:"result,nullable"` + ResultInfo AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseSuccess `json:"success"` + JSON accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponse] +type accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseErrorJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseError] +type accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseMessageJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseMessage] +type accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResult struct { + // The bucket ID associated with the packet captures API. + ID string `json:"id,required"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf string `json:"destination_conf,required"` + // The ownership challenge filename stored in the bucket. + Filename string `json:"filename,required"` + // The status of the ownership challenge. Can be pending, success or failed. + Status AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatus `json:"status,required"` + // The RFC 3339 timestamp when the bucket was added to packet captures API. + Submitted string `json:"submitted,required"` + // The RFC 3339 timestamp when the bucket was validated. + Validated string `json:"validated"` + JSON accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResult] +type accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultJSON struct { + ID apijson.Field + DestinationConf apijson.Field + Filename apijson.Field + Status apijson.Field + Submitted apijson.Field + Validated apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the ownership challenge. Can be pending, success or failed. +type AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatus string + +const ( + AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatusPending AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatus = "pending" + AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatusSuccess AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatus = "success" + AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatusFailed AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultStatus = "failed" +) + +type AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultInfoJSON `json:"-"` +} + +// accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultInfo] +type accountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseSuccess bool + +const ( + AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseSuccessTrue AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponseSuccess = true +) + +type AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesParams struct { + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf param.Field[string] `json:"destination_conf,required"` +} + +func (r AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountpcapownership_test.go b/accountpcapownership_test.go new file mode 100644 index 00000000000..26680e4a1ff --- /dev/null +++ b/accountpcapownership_test.go @@ -0,0 +1,102 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPcapOwnershipDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Pcaps.Ownerships.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCaptures(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pcaps.Ownerships.MagicPcapCollectionAddBucketsForFullPacketCaptures( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesParams{ + DestinationConf: cloudflare.F("s3://pcaps-bucket?region=us-east-1"), + }, + ) + 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 TestAccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnership(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pcaps.Ownerships.MagicPcapCollectionListPcaPsBucketOwnership(context.TODO(), "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/accountpcapownershipvalidate.go b/accountpcapownershipvalidate.go new file mode 100644 index 00000000000..bc48e37a614 --- /dev/null +++ b/accountpcapownershipvalidate.go @@ -0,0 +1,166 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountPcapOwnershipValidateService 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 +// [NewAccountPcapOwnershipValidateService] method instead. +type AccountPcapOwnershipValidateService struct { + Options []option.RequestOption +} + +// NewAccountPcapOwnershipValidateService 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 NewAccountPcapOwnershipValidateService(opts ...option.RequestOption) (r *AccountPcapOwnershipValidateService) { + r = &AccountPcapOwnershipValidateService{} + r.Options = opts + return +} + +// Validates buckets added to the packet captures API. +func (r *AccountPcapOwnershipValidateService) MagicPcapCollectionValidateBucketsForFullPacketCaptures(ctx context.Context, accountIdentifier string, body AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesParams, opts ...option.RequestOption) (res *AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/pcaps/ownership/validate", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponse struct { + Errors []AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseError `json:"errors"` + Messages []AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseMessage `json:"messages"` + Result AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseSuccess `json:"success"` + JSON accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseJSON `json:"-"` +} + +// accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponse] +type accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseErrorJSON `json:"-"` +} + +// accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseError] +type accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseMessageJSON `json:"-"` +} + +// accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseMessage] +type accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResult struct { + // The bucket ID associated with the packet captures API. + ID string `json:"id,required"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf string `json:"destination_conf,required"` + // The ownership challenge filename stored in the bucket. + Filename string `json:"filename,required"` + // The status of the ownership challenge. Can be pending, success or failed. + Status AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatus `json:"status,required"` + // The RFC 3339 timestamp when the bucket was added to packet captures API. + Submitted string `json:"submitted,required"` + // The RFC 3339 timestamp when the bucket was validated. + Validated string `json:"validated"` + JSON accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultJSON `json:"-"` +} + +// accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResult] +type accountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultJSON struct { + ID apijson.Field + DestinationConf apijson.Field + Filename apijson.Field + Status apijson.Field + Submitted apijson.Field + Validated apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The status of the ownership challenge. Can be pending, success or failed. +type AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatus string + +const ( + AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatusPending AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatus = "pending" + AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatusSuccess AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatus = "success" + AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatusFailed AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseResultStatus = "failed" +) + +// Whether the API call was successful +type AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseSuccess bool + +const ( + AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseSuccessTrue AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponseSuccess = true +) + +type AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesParams struct { + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf param.Field[string] `json:"destination_conf,required"` + // The ownership challenge filename stored in the bucket. + OwnershipChallenge param.Field[string] `json:"ownership_challenge,required"` +} + +func (r AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountpcapownershipvalidate_test.go b/accountpcapownershipvalidate_test.go new file mode 100644 index 00000000000..e2119a164f1 --- /dev/null +++ b/accountpcapownershipvalidate_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCaptures(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Pcaps.Ownerships.Validates.MagicPcapCollectionValidateBucketsForFullPacketCaptures( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesParams{ + DestinationConf: cloudflare.F("s3://pcaps-bucket?region=us-east-1"), + OwnershipChallenge: cloudflare.F("ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt"), + }, + ) + 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/accountr2.go b/accountr2.go new file mode 100644 index 00000000000..2ba1c373921 --- /dev/null +++ b/accountr2.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountR2Service 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 [NewAccountR2Service] method instead. +type AccountR2Service struct { + Options []option.RequestOption + Buckets *AccountR2BucketService +} + +// NewAccountR2Service 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 NewAccountR2Service(opts ...option.RequestOption) (r *AccountR2Service) { + r = &AccountR2Service{} + r.Options = opts + r.Buckets = NewAccountR2BucketService(opts...) + return +} diff --git a/accountr2bucket.go b/accountr2bucket.go new file mode 100644 index 00000000000..f20402a9a97 --- /dev/null +++ b/accountr2bucket.go @@ -0,0 +1,462 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountR2BucketService 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 [NewAccountR2BucketService] method +// instead. +type AccountR2BucketService struct { + Options []option.RequestOption +} + +// NewAccountR2BucketService 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 NewAccountR2BucketService(opts ...option.RequestOption) (r *AccountR2BucketService) { + r = &AccountR2BucketService{} + r.Options = opts + return +} + +// Gets metadata for an existing R2 bucket. +func (r *AccountR2BucketService) Get(ctx context.Context, accountIdentifier string, bucketName string, opts ...option.RequestOption) (res *AccountR2BucketGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/r2/buckets/%s", accountIdentifier, bucketName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an existing R2 bucket. +func (r *AccountR2BucketService) Delete(ctx context.Context, accountIdentifier string, bucketName string, opts ...option.RequestOption) (res *AccountR2BucketDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/r2/buckets/%s", accountIdentifier, bucketName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new R2 bucket. +func (r *AccountR2BucketService) R2BucketNewBucket(ctx context.Context, accountIdentifier string, body AccountR2BucketR2BucketNewBucketParams, opts ...option.RequestOption) (res *AccountR2BucketR2BucketNewBucketResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/r2/buckets", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all R2 buckets on your account +func (r *AccountR2BucketService) R2BucketListBuckets(ctx context.Context, accountIdentifier string, query AccountR2BucketR2BucketListBucketsParams, opts ...option.RequestOption) (res *AccountR2BucketR2BucketListBucketsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/r2/buckets", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountR2BucketGetResponse struct { + Errors []AccountR2BucketGetResponseError `json:"errors"` + Messages []string `json:"messages"` + // A single R2 bucket + Result AccountR2BucketGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountR2BucketGetResponseSuccess `json:"success"` + JSON accountR2BucketGetResponseJSON `json:"-"` +} + +// accountR2BucketGetResponseJSON contains the JSON metadata for the struct +// [AccountR2BucketGetResponse] +type accountR2BucketGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountR2BucketGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountR2BucketGetResponseErrorJSON `json:"-"` +} + +// accountR2BucketGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountR2BucketGetResponseError] +type accountR2BucketGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A single R2 bucket +type AccountR2BucketGetResponseResult struct { + // Creation timestamp + CreationDate string `json:"creation_date"` + // Location of the bucket + Location AccountR2BucketGetResponseResultLocation `json:"location"` + // Name of the bucket + Name string `json:"name"` + JSON accountR2BucketGetResponseResultJSON `json:"-"` +} + +// accountR2BucketGetResponseResultJSON contains the JSON metadata for the struct +// [AccountR2BucketGetResponseResult] +type accountR2BucketGetResponseResultJSON struct { + CreationDate apijson.Field + Location apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Location of the bucket +type AccountR2BucketGetResponseResultLocation string + +const ( + AccountR2BucketGetResponseResultLocationApac AccountR2BucketGetResponseResultLocation = "apac" + AccountR2BucketGetResponseResultLocationEeur AccountR2BucketGetResponseResultLocation = "eeur" + AccountR2BucketGetResponseResultLocationEnam AccountR2BucketGetResponseResultLocation = "enam" + AccountR2BucketGetResponseResultLocationWeur AccountR2BucketGetResponseResultLocation = "weur" + AccountR2BucketGetResponseResultLocationWnam AccountR2BucketGetResponseResultLocation = "wnam" +) + +// Whether the API call was successful +type AccountR2BucketGetResponseSuccess bool + +const ( + AccountR2BucketGetResponseSuccessTrue AccountR2BucketGetResponseSuccess = true +) + +type AccountR2BucketDeleteResponse struct { + Errors []AccountR2BucketDeleteResponseError `json:"errors,required"` + Messages []string `json:"messages,required"` + Result interface{} `json:"result,required"` + // Whether the API call was successful + Success AccountR2BucketDeleteResponseSuccess `json:"success,required"` + JSON accountR2BucketDeleteResponseJSON `json:"-"` +} + +// accountR2BucketDeleteResponseJSON contains the JSON metadata for the struct +// [AccountR2BucketDeleteResponse] +type accountR2BucketDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountR2BucketDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountR2BucketDeleteResponseErrorJSON `json:"-"` +} + +// accountR2BucketDeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountR2BucketDeleteResponseError] +type accountR2BucketDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountR2BucketDeleteResponseSuccess bool + +const ( + AccountR2BucketDeleteResponseSuccessTrue AccountR2BucketDeleteResponseSuccess = true +) + +type AccountR2BucketR2BucketNewBucketResponse struct { + Errors []AccountR2BucketR2BucketNewBucketResponseError `json:"errors"` + Messages []string `json:"messages"` + // A single R2 bucket + Result AccountR2BucketR2BucketNewBucketResponseResult `json:"result"` + // Whether the API call was successful + Success AccountR2BucketR2BucketNewBucketResponseSuccess `json:"success"` + JSON accountR2BucketR2BucketNewBucketResponseJSON `json:"-"` +} + +// accountR2BucketR2BucketNewBucketResponseJSON contains the JSON metadata for the +// struct [AccountR2BucketR2BucketNewBucketResponse] +type accountR2BucketR2BucketNewBucketResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketR2BucketNewBucketResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountR2BucketR2BucketNewBucketResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountR2BucketR2BucketNewBucketResponseErrorJSON `json:"-"` +} + +// accountR2BucketR2BucketNewBucketResponseErrorJSON contains the JSON metadata for +// the struct [AccountR2BucketR2BucketNewBucketResponseError] +type accountR2BucketR2BucketNewBucketResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketR2BucketNewBucketResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A single R2 bucket +type AccountR2BucketR2BucketNewBucketResponseResult struct { + // Creation timestamp + CreationDate string `json:"creation_date"` + // Location of the bucket + Location AccountR2BucketR2BucketNewBucketResponseResultLocation `json:"location"` + // Name of the bucket + Name string `json:"name"` + JSON accountR2BucketR2BucketNewBucketResponseResultJSON `json:"-"` +} + +// accountR2BucketR2BucketNewBucketResponseResultJSON contains the JSON metadata +// for the struct [AccountR2BucketR2BucketNewBucketResponseResult] +type accountR2BucketR2BucketNewBucketResponseResultJSON struct { + CreationDate apijson.Field + Location apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketR2BucketNewBucketResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Location of the bucket +type AccountR2BucketR2BucketNewBucketResponseResultLocation string + +const ( + AccountR2BucketR2BucketNewBucketResponseResultLocationApac AccountR2BucketR2BucketNewBucketResponseResultLocation = "apac" + AccountR2BucketR2BucketNewBucketResponseResultLocationEeur AccountR2BucketR2BucketNewBucketResponseResultLocation = "eeur" + AccountR2BucketR2BucketNewBucketResponseResultLocationEnam AccountR2BucketR2BucketNewBucketResponseResultLocation = "enam" + AccountR2BucketR2BucketNewBucketResponseResultLocationWeur AccountR2BucketR2BucketNewBucketResponseResultLocation = "weur" + AccountR2BucketR2BucketNewBucketResponseResultLocationWnam AccountR2BucketR2BucketNewBucketResponseResultLocation = "wnam" +) + +// Whether the API call was successful +type AccountR2BucketR2BucketNewBucketResponseSuccess bool + +const ( + AccountR2BucketR2BucketNewBucketResponseSuccessTrue AccountR2BucketR2BucketNewBucketResponseSuccess = true +) + +type AccountR2BucketR2BucketListBucketsResponse struct { + Errors []AccountR2BucketR2BucketListBucketsResponseError `json:"errors"` + Messages []string `json:"messages"` + Result []AccountR2BucketR2BucketListBucketsResponseResult `json:"result"` + ResultInfo AccountR2BucketR2BucketListBucketsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountR2BucketR2BucketListBucketsResponseSuccess `json:"success"` + JSON accountR2BucketR2BucketListBucketsResponseJSON `json:"-"` +} + +// accountR2BucketR2BucketListBucketsResponseJSON contains the JSON metadata for +// the struct [AccountR2BucketR2BucketListBucketsResponse] +type accountR2BucketR2BucketListBucketsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketR2BucketListBucketsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountR2BucketR2BucketListBucketsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountR2BucketR2BucketListBucketsResponseErrorJSON `json:"-"` +} + +// accountR2BucketR2BucketListBucketsResponseErrorJSON contains the JSON metadata +// for the struct [AccountR2BucketR2BucketListBucketsResponseError] +type accountR2BucketR2BucketListBucketsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketR2BucketListBucketsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A single R2 bucket +type AccountR2BucketR2BucketListBucketsResponseResult struct { + // Creation timestamp + CreationDate string `json:"creation_date"` + // Location of the bucket + Location AccountR2BucketR2BucketListBucketsResponseResultLocation `json:"location"` + // Name of the bucket + Name string `json:"name"` + JSON accountR2BucketR2BucketListBucketsResponseResultJSON `json:"-"` +} + +// accountR2BucketR2BucketListBucketsResponseResultJSON contains the JSON metadata +// for the struct [AccountR2BucketR2BucketListBucketsResponseResult] +type accountR2BucketR2BucketListBucketsResponseResultJSON struct { + CreationDate apijson.Field + Location apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketR2BucketListBucketsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Location of the bucket +type AccountR2BucketR2BucketListBucketsResponseResultLocation string + +const ( + AccountR2BucketR2BucketListBucketsResponseResultLocationApac AccountR2BucketR2BucketListBucketsResponseResultLocation = "apac" + AccountR2BucketR2BucketListBucketsResponseResultLocationEeur AccountR2BucketR2BucketListBucketsResponseResultLocation = "eeur" + AccountR2BucketR2BucketListBucketsResponseResultLocationEnam AccountR2BucketR2BucketListBucketsResponseResultLocation = "enam" + AccountR2BucketR2BucketListBucketsResponseResultLocationWeur AccountR2BucketR2BucketListBucketsResponseResultLocation = "weur" + AccountR2BucketR2BucketListBucketsResponseResultLocationWnam AccountR2BucketR2BucketListBucketsResponseResultLocation = "wnam" +) + +type AccountR2BucketR2BucketListBucketsResponseResultInfo struct { + // A continuation token that should be used to fetch the next page of results + Cursor string `json:"cursor"` + // Maximum number of results on this page + PerPage float64 `json:"per_page"` + JSON accountR2BucketR2BucketListBucketsResponseResultInfoJSON `json:"-"` +} + +// accountR2BucketR2BucketListBucketsResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountR2BucketR2BucketListBucketsResponseResultInfo] +type accountR2BucketR2BucketListBucketsResponseResultInfoJSON struct { + Cursor apijson.Field + PerPage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountR2BucketR2BucketListBucketsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountR2BucketR2BucketListBucketsResponseSuccess bool + +const ( + AccountR2BucketR2BucketListBucketsResponseSuccessTrue AccountR2BucketR2BucketListBucketsResponseSuccess = true +) + +type AccountR2BucketR2BucketNewBucketParams struct { + // Name of the bucket + Name param.Field[string] `json:"name,required"` + // Location of the bucket + LocationHint param.Field[AccountR2BucketR2BucketNewBucketParamsLocationHint] `json:"locationHint"` +} + +func (r AccountR2BucketR2BucketNewBucketParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Location of the bucket +type AccountR2BucketR2BucketNewBucketParamsLocationHint string + +const ( + AccountR2BucketR2BucketNewBucketParamsLocationHintApac AccountR2BucketR2BucketNewBucketParamsLocationHint = "apac" + AccountR2BucketR2BucketNewBucketParamsLocationHintEeur AccountR2BucketR2BucketNewBucketParamsLocationHint = "eeur" + AccountR2BucketR2BucketNewBucketParamsLocationHintEnam AccountR2BucketR2BucketNewBucketParamsLocationHint = "enam" + AccountR2BucketR2BucketNewBucketParamsLocationHintWeur AccountR2BucketR2BucketNewBucketParamsLocationHint = "weur" + AccountR2BucketR2BucketNewBucketParamsLocationHintWnam AccountR2BucketR2BucketNewBucketParamsLocationHint = "wnam" +) + +type AccountR2BucketR2BucketListBucketsParams struct { + // Pagination cursor received during the last List Buckets call. R2 buckets are + // paginated using cursors instead of page numbers. + Cursor param.Field[string] `query:"cursor"` + // Direction to order buckets + Direction param.Field[AccountR2BucketR2BucketListBucketsParamsDirection] `query:"direction"` + // Bucket names to filter by. Only buckets with this phrase in their name will be + // returned. + NameContains param.Field[string] `query:"name_contains"` + // Field to order buckets by + Order param.Field[AccountR2BucketR2BucketListBucketsParamsOrder] `query:"order"` + // Maximum number of buckets to return in a single call + PerPage param.Field[float64] `query:"per_page"` + // Bucket name to start searching after. Buckets are ordered lexicographically. + StartAfter param.Field[string] `query:"start_after"` +} + +// URLQuery serializes [AccountR2BucketR2BucketListBucketsParams]'s query +// parameters as `url.Values`. +func (r AccountR2BucketR2BucketListBucketsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order buckets +type AccountR2BucketR2BucketListBucketsParamsDirection string + +const ( + AccountR2BucketR2BucketListBucketsParamsDirectionAsc AccountR2BucketR2BucketListBucketsParamsDirection = "asc" + AccountR2BucketR2BucketListBucketsParamsDirectionDesc AccountR2BucketR2BucketListBucketsParamsDirection = "desc" +) + +// Field to order buckets by +type AccountR2BucketR2BucketListBucketsParamsOrder string + +const ( + AccountR2BucketR2BucketListBucketsParamsOrderName AccountR2BucketR2BucketListBucketsParamsOrder = "name" +) diff --git a/accountr2bucket_test.go b/accountr2bucket_test.go new file mode 100644 index 00000000000..e4e8b465d07 --- /dev/null +++ b/accountr2bucket_test.go @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountR2BucketGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.R2.Buckets.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-bucket", + ) + 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 TestAccountR2BucketDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.R2.Buckets.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-bucket", + ) + 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 TestAccountR2BucketR2BucketNewBucketWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.R2.Buckets.R2BucketNewBucket( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountR2BucketR2BucketNewBucketParams{ + Name: cloudflare.F("example-bucket"), + LocationHint: cloudflare.F(cloudflare.AccountR2BucketR2BucketNewBucketParamsLocationHintApac), + }, + ) + 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 TestAccountR2BucketR2BucketListBucketsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.R2.Buckets.R2BucketListBuckets( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountR2BucketR2BucketListBucketsParams{ + Cursor: cloudflare.F("string"), + Direction: cloudflare.F(cloudflare.AccountR2BucketR2BucketListBucketsParamsDirectionDesc), + NameContains: cloudflare.F("my-bucket"), + Order: cloudflare.F(cloudflare.AccountR2BucketR2BucketListBucketsParamsOrderName), + PerPage: cloudflare.F(1.000000), + StartAfter: cloudflare.F("my-bucket"), + }, + ) + 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/accountrailgun.go b/accountrailgun.go new file mode 100644 index 00000000000..e264139efcc --- /dev/null +++ b/accountrailgun.go @@ -0,0 +1,531 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRailgunService 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 [NewAccountRailgunService] method +// instead. +type AccountRailgunService struct { + Options []option.RequestOption + Connections *AccountRailgunConnectionService +} + +// NewAccountRailgunService 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 NewAccountRailgunService(opts ...option.RequestOption) (r *AccountRailgunService) { + r = &AccountRailgunService{} + r.Options = opts + r.Connections = NewAccountRailgunConnectionService(opts...) + return +} + +// Railgun details +func (r *AccountRailgunService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountRailgunGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a Railgun. +func (r *AccountRailgunService) Update(ctx context.Context, accountIdentifier string, identifier string, body AccountRailgunUpdateParams, opts ...option.RequestOption) (res *AccountRailgunUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Disable and delete a Railgun. This will immediately disable the Railgun for any +// connected zones. +func (r *AccountRailgunService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountRailgunDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create Railgun +func (r *AccountRailgunService) AccountRailgunsNewRailgun(ctx context.Context, accountIdentifier string, body AccountRailgunAccountRailgunsNewRailgunParams, opts ...option.RequestOption) (res *AccountRailgunAccountRailgunsNewRailgunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List, search, sort and filter your Railguns. +func (r *AccountRailgunService) AccountRailgunsListRailguns(ctx context.Context, accountIdentifier string, query AccountRailgunAccountRailgunsListRailgunsParams, opts ...option.RequestOption) (res *shared.Page[AccountRailgunAccountRailgunsListRailgunsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/railguns", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountRailgunGetResponse struct { + Errors []AccountRailgunGetResponseError `json:"errors"` + Messages []AccountRailgunGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRailgunGetResponseSuccess `json:"success"` + JSON accountRailgunGetResponseJSON `json:"-"` +} + +// accountRailgunGetResponseJSON contains the JSON metadata for the struct +// [AccountRailgunGetResponse] +type accountRailgunGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunGetResponseErrorJSON `json:"-"` +} + +// accountRailgunGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountRailgunGetResponseError] +type accountRailgunGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunGetResponseMessageJSON `json:"-"` +} + +// accountRailgunGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountRailgunGetResponseMessage] +type accountRailgunGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunGetResponseSuccess bool + +const ( + AccountRailgunGetResponseSuccessTrue AccountRailgunGetResponseSuccess = true +) + +type AccountRailgunUpdateResponse struct { + Errors []AccountRailgunUpdateResponseError `json:"errors"` + Messages []AccountRailgunUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRailgunUpdateResponseSuccess `json:"success"` + JSON accountRailgunUpdateResponseJSON `json:"-"` +} + +// accountRailgunUpdateResponseJSON contains the JSON metadata for the struct +// [AccountRailgunUpdateResponse] +type accountRailgunUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunUpdateResponseErrorJSON `json:"-"` +} + +// accountRailgunUpdateResponseErrorJSON contains the JSON metadata for the struct +// [AccountRailgunUpdateResponseError] +type accountRailgunUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunUpdateResponseMessageJSON `json:"-"` +} + +// accountRailgunUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountRailgunUpdateResponseMessage] +type accountRailgunUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunUpdateResponseSuccess bool + +const ( + AccountRailgunUpdateResponseSuccessTrue AccountRailgunUpdateResponseSuccess = true +) + +type AccountRailgunDeleteResponse struct { + Errors []AccountRailgunDeleteResponseError `json:"errors"` + Messages []AccountRailgunDeleteResponseMessage `json:"messages"` + Result AccountRailgunDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRailgunDeleteResponseSuccess `json:"success"` + JSON accountRailgunDeleteResponseJSON `json:"-"` +} + +// accountRailgunDeleteResponseJSON contains the JSON metadata for the struct +// [AccountRailgunDeleteResponse] +type accountRailgunDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunDeleteResponseErrorJSON `json:"-"` +} + +// accountRailgunDeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountRailgunDeleteResponseError] +type accountRailgunDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunDeleteResponseMessageJSON `json:"-"` +} + +// accountRailgunDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountRailgunDeleteResponseMessage] +type accountRailgunDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunDeleteResponseResult struct { + // Railgun identifier tag. + ID string `json:"id"` + JSON accountRailgunDeleteResponseResultJSON `json:"-"` +} + +// accountRailgunDeleteResponseResultJSON contains the JSON metadata for the struct +// [AccountRailgunDeleteResponseResult] +type accountRailgunDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunDeleteResponseSuccess bool + +const ( + AccountRailgunDeleteResponseSuccessTrue AccountRailgunDeleteResponseSuccess = true +) + +type AccountRailgunAccountRailgunsNewRailgunResponse struct { + Errors []AccountRailgunAccountRailgunsNewRailgunResponseError `json:"errors"` + Messages []AccountRailgunAccountRailgunsNewRailgunResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRailgunAccountRailgunsNewRailgunResponseSuccess `json:"success"` + JSON accountRailgunAccountRailgunsNewRailgunResponseJSON `json:"-"` +} + +// accountRailgunAccountRailgunsNewRailgunResponseJSON contains the JSON metadata +// for the struct [AccountRailgunAccountRailgunsNewRailgunResponse] +type accountRailgunAccountRailgunsNewRailgunResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunAccountRailgunsNewRailgunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunAccountRailgunsNewRailgunResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunAccountRailgunsNewRailgunResponseErrorJSON `json:"-"` +} + +// accountRailgunAccountRailgunsNewRailgunResponseErrorJSON contains the JSON +// metadata for the struct [AccountRailgunAccountRailgunsNewRailgunResponseError] +type accountRailgunAccountRailgunsNewRailgunResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunAccountRailgunsNewRailgunResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunAccountRailgunsNewRailgunResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunAccountRailgunsNewRailgunResponseMessageJSON `json:"-"` +} + +// accountRailgunAccountRailgunsNewRailgunResponseMessageJSON contains the JSON +// metadata for the struct [AccountRailgunAccountRailgunsNewRailgunResponseMessage] +type accountRailgunAccountRailgunsNewRailgunResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunAccountRailgunsNewRailgunResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunAccountRailgunsNewRailgunResponseSuccess bool + +const ( + AccountRailgunAccountRailgunsNewRailgunResponseSuccessTrue AccountRailgunAccountRailgunsNewRailgunResponseSuccess = true +) + +type AccountRailgunAccountRailgunsListRailgunsResponse struct { + // Railgun identifier tag. + ID string `json:"id,required"` + // When the Railgun was activated. + ActivatedOn time.Time `json:"activated_on,required" format:"date-time"` + ActivationKey string `json:"activation_key,required"` + // The build identifier for the Railgun receiver. + Build string `json:"build,required"` + // When the Railgun was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Flag to determine if the Railgun is accepting connections. + Enabled bool `json:"enabled,required"` + // When the Railgun was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Readable identifier of the Railgun. + Name string `json:"name,required"` + // The revision of the Railgun receiver. + Revision string `json:"revision,required"` + // Status of the Railgun. + Status AccountRailgunAccountRailgunsListRailgunsResponseStatus `json:"status,required"` + // The version of the Railgun receiver. + Version string `json:"version,required"` + // The number of zones using this Railgun. + ZonesConnected float64 `json:"zones_connected,required"` + // Defined when the Railgun version is out of date from the latest release from + // Cloudflare. + UpgradeInfo AccountRailgunAccountRailgunsListRailgunsResponseUpgradeInfo `json:"upgrade_info"` + JSON accountRailgunAccountRailgunsListRailgunsResponseJSON `json:"-"` +} + +// accountRailgunAccountRailgunsListRailgunsResponseJSON contains the JSON metadata +// for the struct [AccountRailgunAccountRailgunsListRailgunsResponse] +type accountRailgunAccountRailgunsListRailgunsResponseJSON struct { + ID apijson.Field + ActivatedOn apijson.Field + ActivationKey apijson.Field + Build apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Revision apijson.Field + Status apijson.Field + Version apijson.Field + ZonesConnected apijson.Field + UpgradeInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunAccountRailgunsListRailgunsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Railgun. +type AccountRailgunAccountRailgunsListRailgunsResponseStatus string + +const ( + AccountRailgunAccountRailgunsListRailgunsResponseStatusInitializing AccountRailgunAccountRailgunsListRailgunsResponseStatus = "initializing" + AccountRailgunAccountRailgunsListRailgunsResponseStatusActive AccountRailgunAccountRailgunsListRailgunsResponseStatus = "active" +) + +// Defined when the Railgun version is out of date from the latest release from +// Cloudflare. +type AccountRailgunAccountRailgunsListRailgunsResponseUpgradeInfo struct { + // An HTTP link to download the latest Railgun binary. + DownloadLink string `json:"download_link"` + // Latest version of the Railgun receiver available to install. + LatestVersion string `json:"latest_version"` + JSON accountRailgunAccountRailgunsListRailgunsResponseUpgradeInfoJSON `json:"-"` +} + +// accountRailgunAccountRailgunsListRailgunsResponseUpgradeInfoJSON contains the +// JSON metadata for the struct +// [AccountRailgunAccountRailgunsListRailgunsResponseUpgradeInfo] +type accountRailgunAccountRailgunsListRailgunsResponseUpgradeInfoJSON struct { + DownloadLink apijson.Field + LatestVersion apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunAccountRailgunsListRailgunsResponseUpgradeInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunUpdateParams struct { + // Flag to determine if the Railgun is accepting connections. + Enabled param.Field[bool] `json:"enabled,required"` + // Readable identifier of the Railgun. + Name param.Field[string] `json:"name,required"` + // Defined when the Railgun version is out of date from the latest release from + // Cloudflare. + UpgradeInfo param.Field[AccountRailgunUpdateParamsUpgradeInfo] `json:"upgrade_info"` +} + +func (r AccountRailgunUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Defined when the Railgun version is out of date from the latest release from +// Cloudflare. +type AccountRailgunUpdateParamsUpgradeInfo struct { + // An HTTP link to download the latest Railgun binary. + DownloadLink param.Field[string] `json:"download_link"` + // Latest version of the Railgun receiver available to install. + LatestVersion param.Field[string] `json:"latest_version"` +} + +func (r AccountRailgunUpdateParamsUpgradeInfo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRailgunAccountRailgunsNewRailgunParams struct { + // Readable identifier of the Railgun. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountRailgunAccountRailgunsNewRailgunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRailgunAccountRailgunsListRailgunsParams struct { + // Sort Railguns in ascending or descending order. + Direction param.Field[AccountRailgunAccountRailgunsListRailgunsParamsDirection] `query:"direction"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [AccountRailgunAccountRailgunsListRailgunsParams]'s query +// parameters as `url.Values`. +func (r AccountRailgunAccountRailgunsListRailgunsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Sort Railguns in ascending or descending order. +type AccountRailgunAccountRailgunsListRailgunsParamsDirection string + +const ( + AccountRailgunAccountRailgunsListRailgunsParamsDirectionAsc AccountRailgunAccountRailgunsListRailgunsParamsDirection = "asc" + AccountRailgunAccountRailgunsListRailgunsParamsDirectionDesc AccountRailgunAccountRailgunsListRailgunsParamsDirection = "desc" +) diff --git a/accountrailgun_test.go b/accountrailgun_test.go new file mode 100644 index 00000000000..35818e79387 --- /dev/null +++ b/accountrailgun_test.go @@ -0,0 +1,178 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRailgunGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + ) + 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 TestAccountRailgunUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + cloudflare.AccountRailgunUpdateParams{ + Enabled: cloudflare.F(true), + Name: cloudflare.F("My Railgun."), + UpgradeInfo: cloudflare.F(cloudflare.AccountRailgunUpdateParamsUpgradeInfo{ + DownloadLink: cloudflare.F("https://www.cloudflare.com/downloads/railgun"), + LatestVersion: cloudflare.F("1.0.0"), + }), + }, + ) + 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 TestAccountRailgunDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + ) + 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 TestAccountRailgunAccountRailgunsNewRailgun(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.AccountRailgunsNewRailgun( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountRailgunAccountRailgunsNewRailgunParams{ + Name: cloudflare.F("My Railgun."), + }, + ) + 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 TestAccountRailgunAccountRailgunsListRailgunsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.AccountRailgunsListRailguns( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountRailgunAccountRailgunsListRailgunsParams{ + Direction: cloudflare.F(cloudflare.AccountRailgunAccountRailgunsListRailgunsParamsDirectionDesc), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/accountrailgunconnection.go b/accountrailgunconnection.go new file mode 100644 index 00000000000..4bcfe9461ed --- /dev/null +++ b/accountrailgunconnection.go @@ -0,0 +1,488 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRailgunConnectionService 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 +// [NewAccountRailgunConnectionService] method instead. +type AccountRailgunConnectionService struct { + Options []option.RequestOption +} + +// NewAccountRailgunConnectionService 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 NewAccountRailgunConnectionService(opts ...option.RequestOption) (r *AccountRailgunConnectionService) { + r = &AccountRailgunConnectionService{} + r.Options = opts + return +} + +// Get a connection by ID. +func (r *AccountRailgunConnectionService) Get(ctx context.Context, accountIdentifier string, railgunIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountRailgunConnectionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s/connections/%s", accountIdentifier, railgunIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Enable or disable a connection. +func (r *AccountRailgunConnectionService) Update(ctx context.Context, accountIdentifier string, railgunIdentifier string, identifier string, body AccountRailgunConnectionUpdateParams, opts ...option.RequestOption) (res *AccountRailgunConnectionUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s/connections/%s", accountIdentifier, railgunIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Disable and remove the connection to a zone. +func (r *AccountRailgunConnectionService) Delete(ctx context.Context, accountIdentifier string, railgunIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountRailgunConnectionDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s/connections/%s", accountIdentifier, railgunIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Associates a zone to the Railgun. +func (r *AccountRailgunConnectionService) RailgunConnectionsNewConnection(ctx context.Context, accountIdentifier string, railgunIdentifier string, body AccountRailgunConnectionRailgunConnectionsNewConnectionParams, opts ...option.RequestOption) (res *AccountRailgunConnectionRailgunConnectionsNewConnectionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s/connections", accountIdentifier, railgunIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List connections associated with the Railgun. +func (r *AccountRailgunConnectionService) RailgunConnectionsListConnections(ctx context.Context, accountIdentifier string, railgunIdentifier string, query AccountRailgunConnectionRailgunConnectionsListConnectionsParams, opts ...option.RequestOption) (res *shared.Page[AccountRailgunConnectionRailgunConnectionsListConnectionsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/railguns/%s/connections", accountIdentifier, railgunIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountRailgunConnectionGetResponse struct { + Errors []AccountRailgunConnectionGetResponseError `json:"errors"` + Messages []AccountRailgunConnectionGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRailgunConnectionGetResponseSuccess `json:"success"` + JSON accountRailgunConnectionGetResponseJSON `json:"-"` +} + +// accountRailgunConnectionGetResponseJSON contains the JSON metadata for the +// struct [AccountRailgunConnectionGetResponse] +type accountRailgunConnectionGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionGetResponseErrorJSON `json:"-"` +} + +// accountRailgunConnectionGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountRailgunConnectionGetResponseError] +type accountRailgunConnectionGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionGetResponseMessageJSON `json:"-"` +} + +// accountRailgunConnectionGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountRailgunConnectionGetResponseMessage] +type accountRailgunConnectionGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunConnectionGetResponseSuccess bool + +const ( + AccountRailgunConnectionGetResponseSuccessTrue AccountRailgunConnectionGetResponseSuccess = true +) + +type AccountRailgunConnectionUpdateResponse struct { + Errors []AccountRailgunConnectionUpdateResponseError `json:"errors"` + Messages []AccountRailgunConnectionUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRailgunConnectionUpdateResponseSuccess `json:"success"` + JSON accountRailgunConnectionUpdateResponseJSON `json:"-"` +} + +// accountRailgunConnectionUpdateResponseJSON contains the JSON metadata for the +// struct [AccountRailgunConnectionUpdateResponse] +type accountRailgunConnectionUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionUpdateResponseErrorJSON `json:"-"` +} + +// accountRailgunConnectionUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountRailgunConnectionUpdateResponseError] +type accountRailgunConnectionUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionUpdateResponseMessageJSON `json:"-"` +} + +// accountRailgunConnectionUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountRailgunConnectionUpdateResponseMessage] +type accountRailgunConnectionUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunConnectionUpdateResponseSuccess bool + +const ( + AccountRailgunConnectionUpdateResponseSuccessTrue AccountRailgunConnectionUpdateResponseSuccess = true +) + +type AccountRailgunConnectionDeleteResponse struct { + Errors []AccountRailgunConnectionDeleteResponseError `json:"errors"` + Messages []AccountRailgunConnectionDeleteResponseMessage `json:"messages"` + Result AccountRailgunConnectionDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRailgunConnectionDeleteResponseSuccess `json:"success"` + JSON accountRailgunConnectionDeleteResponseJSON `json:"-"` +} + +// accountRailgunConnectionDeleteResponseJSON contains the JSON metadata for the +// struct [AccountRailgunConnectionDeleteResponse] +type accountRailgunConnectionDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionDeleteResponseErrorJSON `json:"-"` +} + +// accountRailgunConnectionDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountRailgunConnectionDeleteResponseError] +type accountRailgunConnectionDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionDeleteResponseMessageJSON `json:"-"` +} + +// accountRailgunConnectionDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountRailgunConnectionDeleteResponseMessage] +type accountRailgunConnectionDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionDeleteResponseResult struct { + // Connection identifier tag. + ID string `json:"id"` + JSON accountRailgunConnectionDeleteResponseResultJSON `json:"-"` +} + +// accountRailgunConnectionDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountRailgunConnectionDeleteResponseResult] +type accountRailgunConnectionDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunConnectionDeleteResponseSuccess bool + +const ( + AccountRailgunConnectionDeleteResponseSuccessTrue AccountRailgunConnectionDeleteResponseSuccess = true +) + +type AccountRailgunConnectionRailgunConnectionsNewConnectionResponse struct { + Errors []AccountRailgunConnectionRailgunConnectionsNewConnectionResponseError `json:"errors"` + Messages []AccountRailgunConnectionRailgunConnectionsNewConnectionResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRailgunConnectionRailgunConnectionsNewConnectionResponseSuccess `json:"success"` + JSON accountRailgunConnectionRailgunConnectionsNewConnectionResponseJSON `json:"-"` +} + +// accountRailgunConnectionRailgunConnectionsNewConnectionResponseJSON contains the +// JSON metadata for the struct +// [AccountRailgunConnectionRailgunConnectionsNewConnectionResponse] +type accountRailgunConnectionRailgunConnectionsNewConnectionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionRailgunConnectionsNewConnectionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionRailgunConnectionsNewConnectionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionRailgunConnectionsNewConnectionResponseErrorJSON `json:"-"` +} + +// accountRailgunConnectionRailgunConnectionsNewConnectionResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountRailgunConnectionRailgunConnectionsNewConnectionResponseError] +type accountRailgunConnectionRailgunConnectionsNewConnectionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionRailgunConnectionsNewConnectionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionRailgunConnectionsNewConnectionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRailgunConnectionRailgunConnectionsNewConnectionResponseMessageJSON `json:"-"` +} + +// accountRailgunConnectionRailgunConnectionsNewConnectionResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountRailgunConnectionRailgunConnectionsNewConnectionResponseMessage] +type accountRailgunConnectionRailgunConnectionsNewConnectionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionRailgunConnectionsNewConnectionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRailgunConnectionRailgunConnectionsNewConnectionResponseSuccess bool + +const ( + AccountRailgunConnectionRailgunConnectionsNewConnectionResponseSuccessTrue AccountRailgunConnectionRailgunConnectionsNewConnectionResponseSuccess = true +) + +type AccountRailgunConnectionRailgunConnectionsListConnectionsResponse struct { + // Connection identifier tag. + ID string `json:"id,required"` + // A value indicating whether the connection is enabled or not. + Enabled bool `json:"enabled,required"` + Zone AccountRailgunConnectionRailgunConnectionsListConnectionsResponseZone `json:"zone,required"` + // When the connection was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // When the connection was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + JSON accountRailgunConnectionRailgunConnectionsListConnectionsResponseJSON `json:"-"` +} + +// accountRailgunConnectionRailgunConnectionsListConnectionsResponseJSON contains +// the JSON metadata for the struct +// [AccountRailgunConnectionRailgunConnectionsListConnectionsResponse] +type accountRailgunConnectionRailgunConnectionsListConnectionsResponseJSON struct { + ID apijson.Field + Enabled apijson.Field + Zone apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionRailgunConnectionsListConnectionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionRailgunConnectionsListConnectionsResponseZone struct { + // Identifier + ID string `json:"id"` + // The domain name + Name string `json:"name"` + JSON accountRailgunConnectionRailgunConnectionsListConnectionsResponseZoneJSON `json:"-"` +} + +// accountRailgunConnectionRailgunConnectionsListConnectionsResponseZoneJSON +// contains the JSON metadata for the struct +// [AccountRailgunConnectionRailgunConnectionsListConnectionsResponseZone] +type accountRailgunConnectionRailgunConnectionsListConnectionsResponseZoneJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRailgunConnectionRailgunConnectionsListConnectionsResponseZone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRailgunConnectionUpdateParams struct { + // A value indicating whether the connection is enabled or not. + Enabled param.Field[bool] `json:"enabled,required"` + Zone param.Field[AccountRailgunConnectionUpdateParamsZone] `json:"zone,required"` +} + +func (r AccountRailgunConnectionUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRailgunConnectionUpdateParamsZone struct { +} + +func (r AccountRailgunConnectionUpdateParamsZone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRailgunConnectionRailgunConnectionsNewConnectionParams struct { + Zone param.Field[AccountRailgunConnectionRailgunConnectionsNewConnectionParamsZone] `json:"zone,required"` + // A value indicating whether the connection is enabled or not. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountRailgunConnectionRailgunConnectionsNewConnectionParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRailgunConnectionRailgunConnectionsNewConnectionParamsZone struct { +} + +func (r AccountRailgunConnectionRailgunConnectionsNewConnectionParamsZone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRailgunConnectionRailgunConnectionsListConnectionsParams struct { + // A value indicating whether the connection is enabled or not. + Enabled param.Field[bool] `query:"enabled"` + // Requested page within paginated list of results. + Page param.Field[float64] `query:"page"` + // Maximum number of results requested. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [AccountRailgunConnectionRailgunConnectionsListConnectionsParams]'s query +// parameters as `url.Values`. +func (r AccountRailgunConnectionRailgunConnectionsListConnectionsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountrailgunconnection_test.go b/accountrailgunconnection_test.go new file mode 100644 index 00000000000..24b501e9d9c --- /dev/null +++ b/accountrailgunconnection_test.go @@ -0,0 +1,180 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRailgunConnectionGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Connections.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + "c4a7362d577a6c3019a474fd6f485821", + ) + 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 TestAccountRailgunConnectionUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Connections.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + "c4a7362d577a6c3019a474fd6f485821", + cloudflare.AccountRailgunConnectionUpdateParams{ + Enabled: cloudflare.F(true), + Zone: cloudflare.F(cloudflare.AccountRailgunConnectionUpdateParamsZone{}), + }, + ) + 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 TestAccountRailgunConnectionDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Connections.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + "c4a7362d577a6c3019a474fd6f485821", + ) + 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 TestAccountRailgunConnectionRailgunConnectionsNewConnectionWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Connections.RailgunConnectionsNewConnection( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + cloudflare.AccountRailgunConnectionRailgunConnectionsNewConnectionParams{ + Zone: cloudflare.F(cloudflare.AccountRailgunConnectionRailgunConnectionsNewConnectionParamsZone{}), + Enabled: cloudflare.F(true), + }, + ) + 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 TestAccountRailgunConnectionRailgunConnectionsListConnectionsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Railguns.Connections.RailgunConnectionsListConnections( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + cloudflare.AccountRailgunConnectionRailgunConnectionsListConnectionsParams{ + Enabled: cloudflare.F(true), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(20.000000), + }, + ) + 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/accountregistrar.go b/accountregistrar.go new file mode 100644 index 00000000000..5d7f7bd8da4 --- /dev/null +++ b/accountregistrar.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRegistrarService 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 [NewAccountRegistrarService] method +// instead. +type AccountRegistrarService struct { + Options []option.RequestOption + Domains *AccountRegistrarDomainService +} + +// NewAccountRegistrarService 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 NewAccountRegistrarService(opts ...option.RequestOption) (r *AccountRegistrarService) { + r = &AccountRegistrarService{} + r.Options = opts + r.Domains = NewAccountRegistrarDomainService(opts...) + return +} diff --git a/accountregistrardomain.go b/accountregistrardomain.go new file mode 100644 index 00000000000..691877799cf --- /dev/null +++ b/accountregistrardomain.go @@ -0,0 +1,450 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRegistrarDomainService 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 [NewAccountRegistrarDomainService] +// method instead. +type AccountRegistrarDomainService struct { + Options []option.RequestOption +} + +// NewAccountRegistrarDomainService 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 NewAccountRegistrarDomainService(opts ...option.RequestOption) (r *AccountRegistrarDomainService) { + r = &AccountRegistrarDomainService{} + r.Options = opts + return +} + +// Show individual domain. +func (r *AccountRegistrarDomainService) Get(ctx context.Context, accountIdentifier string, domainName string, opts ...option.RequestOption) (res *AccountRegistrarDomainGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/registrar/domains/%s", accountIdentifier, domainName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update individual domain. +func (r *AccountRegistrarDomainService) Update(ctx context.Context, accountIdentifier string, domainName string, body AccountRegistrarDomainUpdateParams, opts ...option.RequestOption) (res *AccountRegistrarDomainUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/registrar/domains/%s", accountIdentifier, domainName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// List domains handled by Registrar. +func (r *AccountRegistrarDomainService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *RegistrarAPIDomainResponseCollection, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/registrar/domains", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type RegistrarAPIDomainResponseCollection struct { + Errors []RegistrarAPIDomainResponseCollectionError `json:"errors"` + Messages []RegistrarAPIDomainResponseCollectionMessage `json:"messages"` + Result []RegistrarAPIDomainResponseCollectionResult `json:"result"` + ResultInfo RegistrarAPIDomainResponseCollectionResultInfo `json:"result_info"` + // Whether the API call was successful + Success RegistrarAPIDomainResponseCollectionSuccess `json:"success"` + JSON registrarAPIDomainResponseCollectionJSON `json:"-"` +} + +// registrarAPIDomainResponseCollectionJSON contains the JSON metadata for the +// struct [RegistrarAPIDomainResponseCollection] +type registrarAPIDomainResponseCollectionJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RegistrarAPIDomainResponseCollection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RegistrarAPIDomainResponseCollectionError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON registrarAPIDomainResponseCollectionErrorJSON `json:"-"` +} + +// registrarAPIDomainResponseCollectionErrorJSON contains the JSON metadata for the +// struct [RegistrarAPIDomainResponseCollectionError] +type registrarAPIDomainResponseCollectionErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RegistrarAPIDomainResponseCollectionError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RegistrarAPIDomainResponseCollectionMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON registrarAPIDomainResponseCollectionMessageJSON `json:"-"` +} + +// registrarAPIDomainResponseCollectionMessageJSON contains the JSON metadata for +// the struct [RegistrarAPIDomainResponseCollectionMessage] +type registrarAPIDomainResponseCollectionMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RegistrarAPIDomainResponseCollectionMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RegistrarAPIDomainResponseCollectionResult struct { + // Domain identifier. + ID string `json:"id"` + // Shows if a domain is available for transferring into Cloudflare Registrar. + Available bool `json:"available"` + // Indicates if the domain can be registered as a new domain. + CanRegister bool `json:"can_register"` + // Shows time of creation. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Shows name of current registrar. + CurrentRegistrar string `json:"current_registrar"` + // Shows when domain name registration expires. + ExpiresAt time.Time `json:"expires_at" format:"date-time"` + // Shows whether a registrar lock is in place for a domain. + Locked bool `json:"locked"` + RegistrantContact RegistrarAPIDomainResponseCollectionResultRegistrantContact `json:"registrant_contact"` + // A comma-separated list of registry status codes. A full list of status codes can + // be found at + // [EPP Status Codes](https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en). + RegistryStatuses string `json:"registry_statuses"` + // Whether a particular TLD is currently supported by Cloudflare Registrar. Refer + // to [TLD Policies](https://www.cloudflare.com/tld-policies/) for a list of + // supported TLDs. + SupportedTld bool `json:"supported_tld"` + // Statuses for domain transfers into Cloudflare Registrar. + TransferIn RegistrarAPIDomainResponseCollectionResultTransferIn `json:"transfer_in"` + // Last updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON registrarAPIDomainResponseCollectionResultJSON `json:"-"` +} + +// registrarAPIDomainResponseCollectionResultJSON contains the JSON metadata for +// the struct [RegistrarAPIDomainResponseCollectionResult] +type registrarAPIDomainResponseCollectionResultJSON struct { + ID apijson.Field + Available apijson.Field + CanRegister apijson.Field + CreatedAt apijson.Field + CurrentRegistrar apijson.Field + ExpiresAt apijson.Field + Locked apijson.Field + RegistrantContact apijson.Field + RegistryStatuses apijson.Field + SupportedTld apijson.Field + TransferIn apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RegistrarAPIDomainResponseCollectionResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RegistrarAPIDomainResponseCollectionResultRegistrantContact struct { + // Address. + Address string `json:"address,required"` + // City. + City string `json:"city,required"` + // The country in which the user lives. + Country string `json:"country,required,nullable"` + // User's first name + FirstName string `json:"first_name,required,nullable"` + // User's last name + LastName string `json:"last_name,required,nullable"` + // Name of organization. + Organization string `json:"organization,required"` + // User's telephone number + Phone string `json:"phone,required,nullable"` + // State. + State string `json:"state,required"` + // The zipcode or postal code where the user lives. + Zip string `json:"zip,required,nullable"` + // Contact Identifier. + ID string `json:"id"` + // Optional address line for unit, floor, suite, etc. + Address2 string `json:"address2"` + // The contact email address of the user. + Email string `json:"email"` + // Contact fax number. + Fax string `json:"fax"` + JSON registrarAPIDomainResponseCollectionResultRegistrantContactJSON `json:"-"` +} + +// registrarAPIDomainResponseCollectionResultRegistrantContactJSON contains the +// JSON metadata for the struct +// [RegistrarAPIDomainResponseCollectionResultRegistrantContact] +type registrarAPIDomainResponseCollectionResultRegistrantContactJSON struct { + Address apijson.Field + City apijson.Field + Country apijson.Field + FirstName apijson.Field + LastName apijson.Field + Organization apijson.Field + Phone apijson.Field + State apijson.Field + Zip apijson.Field + ID apijson.Field + Address2 apijson.Field + Email apijson.Field + Fax apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RegistrarAPIDomainResponseCollectionResultRegistrantContact) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Statuses for domain transfers into Cloudflare Registrar. +type RegistrarAPIDomainResponseCollectionResultTransferIn struct { + // Form of authorization has been accepted by the registrant. + AcceptFoa interface{} `json:"accept_foa"` + // Shows transfer status with the registry. + ApproveTransfer interface{} `json:"approve_transfer"` + // Indicates if cancellation is still possible. + CanCancelTransfer bool `json:"can_cancel_transfer"` + // Privacy guards are disabled at the foreign registrar. + DisablePrivacy interface{} `json:"disable_privacy"` + // Auth code has been entered and verified. + EnterAuthCode interface{} `json:"enter_auth_code"` + // Domain is unlocked at the foreign registrar. + UnlockDomain interface{} `json:"unlock_domain"` + JSON registrarAPIDomainResponseCollectionResultTransferInJSON `json:"-"` +} + +// registrarAPIDomainResponseCollectionResultTransferInJSON contains the JSON +// metadata for the struct [RegistrarAPIDomainResponseCollectionResultTransferIn] +type registrarAPIDomainResponseCollectionResultTransferInJSON struct { + AcceptFoa apijson.Field + ApproveTransfer apijson.Field + CanCancelTransfer apijson.Field + DisablePrivacy apijson.Field + EnterAuthCode apijson.Field + UnlockDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RegistrarAPIDomainResponseCollectionResultTransferIn) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RegistrarAPIDomainResponseCollectionResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON registrarAPIDomainResponseCollectionResultInfoJSON `json:"-"` +} + +// registrarAPIDomainResponseCollectionResultInfoJSON contains the JSON metadata +// for the struct [RegistrarAPIDomainResponseCollectionResultInfo] +type registrarAPIDomainResponseCollectionResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RegistrarAPIDomainResponseCollectionResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type RegistrarAPIDomainResponseCollectionSuccess bool + +const ( + RegistrarAPIDomainResponseCollectionSuccessTrue RegistrarAPIDomainResponseCollectionSuccess = true +) + +type AccountRegistrarDomainGetResponse struct { + Errors []AccountRegistrarDomainGetResponseError `json:"errors"` + Messages []AccountRegistrarDomainGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRegistrarDomainGetResponseSuccess `json:"success"` + JSON accountRegistrarDomainGetResponseJSON `json:"-"` +} + +// accountRegistrarDomainGetResponseJSON contains the JSON metadata for the struct +// [AccountRegistrarDomainGetResponse] +type accountRegistrarDomainGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRegistrarDomainGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRegistrarDomainGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRegistrarDomainGetResponseErrorJSON `json:"-"` +} + +// accountRegistrarDomainGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountRegistrarDomainGetResponseError] +type accountRegistrarDomainGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRegistrarDomainGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRegistrarDomainGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRegistrarDomainGetResponseMessageJSON `json:"-"` +} + +// accountRegistrarDomainGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountRegistrarDomainGetResponseMessage] +type accountRegistrarDomainGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRegistrarDomainGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRegistrarDomainGetResponseSuccess bool + +const ( + AccountRegistrarDomainGetResponseSuccessTrue AccountRegistrarDomainGetResponseSuccess = true +) + +type AccountRegistrarDomainUpdateResponse struct { + Errors []AccountRegistrarDomainUpdateResponseError `json:"errors"` + Messages []AccountRegistrarDomainUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRegistrarDomainUpdateResponseSuccess `json:"success"` + JSON accountRegistrarDomainUpdateResponseJSON `json:"-"` +} + +// accountRegistrarDomainUpdateResponseJSON contains the JSON metadata for the +// struct [AccountRegistrarDomainUpdateResponse] +type accountRegistrarDomainUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRegistrarDomainUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRegistrarDomainUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRegistrarDomainUpdateResponseErrorJSON `json:"-"` +} + +// accountRegistrarDomainUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountRegistrarDomainUpdateResponseError] +type accountRegistrarDomainUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRegistrarDomainUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRegistrarDomainUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRegistrarDomainUpdateResponseMessageJSON `json:"-"` +} + +// accountRegistrarDomainUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountRegistrarDomainUpdateResponseMessage] +type accountRegistrarDomainUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRegistrarDomainUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRegistrarDomainUpdateResponseSuccess bool + +const ( + AccountRegistrarDomainUpdateResponseSuccessTrue AccountRegistrarDomainUpdateResponseSuccess = true +) + +type AccountRegistrarDomainUpdateParams struct { + // Auto-renew controls whether subscription is automatically renewed upon domain + // expiration. + AutoRenew param.Field[bool] `json:"auto_renew"` + // Shows whether a registrar lock is in place for a domain. + Locked param.Field[bool] `json:"locked"` + // Privacy option controls redacting WHOIS information. + Privacy param.Field[bool] `json:"privacy"` +} + +func (r AccountRegistrarDomainUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountregistrardomain_test.go b/accountregistrardomain_test.go new file mode 100644 index 00000000000..5e86dab5dca --- /dev/null +++ b/accountregistrardomain_test.go @@ -0,0 +1,105 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRegistrarDomainGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Registrar.Domains.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "cloudflare.com", + ) + 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 TestAccountRegistrarDomainUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Registrar.Domains.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "cloudflare.com", + cloudflare.AccountRegistrarDomainUpdateParams{ + AutoRenew: cloudflare.F(true), + Locked: cloudflare.F(false), + Privacy: cloudflare.F(true), + }, + ) + 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 TestAccountRegistrarDomainList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Registrar.Domains.List(context.TODO(), "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/accountrequesttracer.go b/accountrequesttracer.go new file mode 100644 index 00000000000..41c2670440b --- /dev/null +++ b/accountrequesttracer.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRequestTracerService 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 [NewAccountRequestTracerService] +// method instead. +type AccountRequestTracerService struct { + Options []option.RequestOption + Traces *AccountRequestTracerTraceService +} + +// NewAccountRequestTracerService 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 NewAccountRequestTracerService(opts ...option.RequestOption) (r *AccountRequestTracerService) { + r = &AccountRequestTracerService{} + r.Options = opts + r.Traces = NewAccountRequestTracerTraceService(opts...) + return +} diff --git a/accountrequesttracertrace.go b/accountrequesttracertrace.go new file mode 100644 index 00000000000..ed021357bcf --- /dev/null +++ b/accountrequesttracertrace.go @@ -0,0 +1,25 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRequestTracerTraceService 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 +// [NewAccountRequestTracerTraceService] method instead. +type AccountRequestTracerTraceService struct { + Options []option.RequestOption +} + +// NewAccountRequestTracerTraceService 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 NewAccountRequestTracerTraceService(opts ...option.RequestOption) (r *AccountRequestTracerTraceService) { + r = &AccountRequestTracerTraceService{} + r.Options = opts + return +} diff --git a/accountrole.go b/accountrole.go new file mode 100644 index 00000000000..e41720e3569 --- /dev/null +++ b/accountrole.go @@ -0,0 +1,241 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRoleService 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 [NewAccountRoleService] method +// instead. +type AccountRoleService struct { + Options []option.RequestOption +} + +// NewAccountRoleService 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 NewAccountRoleService(opts ...option.RequestOption) (r *AccountRoleService) { + r = &AccountRoleService{} + r.Options = opts + return +} + +// Get information about a specific role for an account. +func (r *AccountRoleService) Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountRoleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/roles/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Get all available roles for an account. +func (r *AccountRoleService) AccountRolesListRoles(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountRoleAccountRolesListRolesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/roles", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountRoleGetResponse struct { + Errors []AccountRoleGetResponseError `json:"errors"` + Messages []AccountRoleGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountRoleGetResponseSuccess `json:"success"` + JSON accountRoleGetResponseJSON `json:"-"` +} + +// accountRoleGetResponseJSON contains the JSON metadata for the struct +// [AccountRoleGetResponse] +type accountRoleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRoleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRoleGetResponseErrorJSON `json:"-"` +} + +// accountRoleGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountRoleGetResponseError] +type accountRoleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRoleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRoleGetResponseMessageJSON `json:"-"` +} + +// accountRoleGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountRoleGetResponseMessage] +type accountRoleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRoleGetResponseSuccess bool + +const ( + AccountRoleGetResponseSuccessTrue AccountRoleGetResponseSuccess = true +) + +type AccountRoleAccountRolesListRolesResponse struct { + Errors []AccountRoleAccountRolesListRolesResponseError `json:"errors"` + Messages []AccountRoleAccountRolesListRolesResponseMessage `json:"messages"` + Result []AccountRoleAccountRolesListRolesResponseResult `json:"result"` + ResultInfo AccountRoleAccountRolesListRolesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountRoleAccountRolesListRolesResponseSuccess `json:"success"` + JSON accountRoleAccountRolesListRolesResponseJSON `json:"-"` +} + +// accountRoleAccountRolesListRolesResponseJSON contains the JSON metadata for the +// struct [AccountRoleAccountRolesListRolesResponse] +type accountRoleAccountRolesListRolesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleAccountRolesListRolesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRoleAccountRolesListRolesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRoleAccountRolesListRolesResponseErrorJSON `json:"-"` +} + +// accountRoleAccountRolesListRolesResponseErrorJSON contains the JSON metadata for +// the struct [AccountRoleAccountRolesListRolesResponseError] +type accountRoleAccountRolesListRolesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleAccountRolesListRolesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRoleAccountRolesListRolesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRoleAccountRolesListRolesResponseMessageJSON `json:"-"` +} + +// accountRoleAccountRolesListRolesResponseMessageJSON contains the JSON metadata +// for the struct [AccountRoleAccountRolesListRolesResponseMessage] +type accountRoleAccountRolesListRolesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleAccountRolesListRolesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRoleAccountRolesListRolesResponseResult struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role Name. + Name string `json:"name,required"` + // Access permissions for this User. + Permissions []string `json:"permissions,required"` + JSON accountRoleAccountRolesListRolesResponseResultJSON `json:"-"` +} + +// accountRoleAccountRolesListRolesResponseResultJSON contains the JSON metadata +// for the struct [AccountRoleAccountRolesListRolesResponseResult] +type accountRoleAccountRolesListRolesResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleAccountRolesListRolesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRoleAccountRolesListRolesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountRoleAccountRolesListRolesResponseResultInfoJSON `json:"-"` +} + +// accountRoleAccountRolesListRolesResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountRoleAccountRolesListRolesResponseResultInfo] +type accountRoleAccountRolesListRolesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRoleAccountRolesListRolesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRoleAccountRolesListRolesResponseSuccess bool + +const ( + AccountRoleAccountRolesListRolesResponseSuccessTrue AccountRoleAccountRolesListRolesResponseSuccess = true +) diff --git a/accountrole_test.go b/accountrole_test.go new file mode 100644 index 00000000000..6def94a67e4 --- /dev/null +++ b/accountrole_test.go @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRoleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Roles.Get( + context.TODO(), + map[string]interface{}{}, + map[string]interface{}{}, + ) + 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 TestAccountRoleAccountRolesListRoles(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Roles.AccountRolesListRoles(context.TODO(), map[string]interface{}{}) + 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/accountrule.go b/accountrule.go new file mode 100644 index 00000000000..ac68b1afe0e --- /dev/null +++ b/accountrule.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRuleService 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 [NewAccountRuleService] method +// instead. +type AccountRuleService struct { + Options []option.RequestOption + Lists *AccountRuleListService +} + +// NewAccountRuleService 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 NewAccountRuleService(opts ...option.RequestOption) (r *AccountRuleService) { + r = &AccountRuleService{} + r.Options = opts + r.Lists = NewAccountRuleListService(opts...) + return +} diff --git a/accountrulelist.go b/accountrulelist.go new file mode 100644 index 00000000000..50215835ae2 --- /dev/null +++ b/accountrulelist.go @@ -0,0 +1,677 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRuleListService 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 [NewAccountRuleListService] method +// instead. +type AccountRuleListService struct { + Options []option.RequestOption + BulkOperations *AccountRuleListBulkOperationService + Items *AccountRuleListItemService +} + +// NewAccountRuleListService 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 NewAccountRuleListService(opts ...option.RequestOption) (r *AccountRuleListService) { + r = &AccountRuleListService{} + r.Options = opts + r.BulkOperations = NewAccountRuleListBulkOperationService(opts...) + r.Items = NewAccountRuleListItemService(opts...) + return +} + +// Fetches the details of a list. +func (r *AccountRuleListService) Get(ctx context.Context, accountIdentifier string, listID string, opts ...option.RequestOption) (res *AccountRuleListGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s", accountIdentifier, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the description of a list. +func (r *AccountRuleListService) Update(ctx context.Context, accountIdentifier string, listID string, body AccountRuleListUpdateParams, opts ...option.RequestOption) (res *AccountRuleListUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s", accountIdentifier, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a specific list and all its items. +func (r *AccountRuleListService) Delete(ctx context.Context, accountIdentifier string, listID string, opts ...option.RequestOption) (res *AccountRuleListDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s", accountIdentifier, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new list of the specified type. +func (r *AccountRuleListService) ListsNewAList(ctx context.Context, accountIdentifier string, body AccountRuleListListsNewAListParams, opts ...option.RequestOption) (res *AccountRuleListListsNewAListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches all lists in the account. +func (r *AccountRuleListService) ListsGetLists(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountRuleListListsGetListsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountRuleListGetResponse struct { + Errors []AccountRuleListGetResponseError `json:"errors"` + Messages []AccountRuleListGetResponseMessage `json:"messages"` + Result AccountRuleListGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListGetResponseSuccess `json:"success"` + JSON accountRuleListGetResponseJSON `json:"-"` +} + +// accountRuleListGetResponseJSON contains the JSON metadata for the struct +// [AccountRuleListGetResponse] +type accountRuleListGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListGetResponseErrorJSON `json:"-"` +} + +// accountRuleListGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountRuleListGetResponseError] +type accountRuleListGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListGetResponseMessageJSON `json:"-"` +} + +// accountRuleListGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountRuleListGetResponseMessage] +type accountRuleListGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListGetResponseResult struct { + // The unique ID of the list. + ID string `json:"id"` + // The RFC 3339 timestamp of when the list was created. + CreatedOn string `json:"created_on"` + // An informative summary of the list. + Description string `json:"description"` + // The type of the list. Each type supports specific list items (IP addresses, + // ASNs, hostnames or redirects). + Kind AccountRuleListGetResponseResultKind `json:"kind"` + // The RFC 3339 timestamp of when the list was last modified. + ModifiedOn string `json:"modified_on"` + // An informative name for the list. Use this name in filter and rule expressions. + Name string `json:"name"` + // The number of items in the list. + NumItems float64 `json:"num_items"` + // The number of [filters](#filters) referencing the list. + NumReferencingFilters float64 `json:"num_referencing_filters"` + JSON accountRuleListGetResponseResultJSON `json:"-"` +} + +// accountRuleListGetResponseResultJSON contains the JSON metadata for the struct +// [AccountRuleListGetResponseResult] +type accountRuleListGetResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Kind apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NumItems apijson.Field + NumReferencingFilters apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the list. Each type supports specific list items (IP addresses, +// ASNs, hostnames or redirects). +type AccountRuleListGetResponseResultKind string + +const ( + AccountRuleListGetResponseResultKindIP AccountRuleListGetResponseResultKind = "ip" + AccountRuleListGetResponseResultKindRedirect AccountRuleListGetResponseResultKind = "redirect" + AccountRuleListGetResponseResultKindHostname AccountRuleListGetResponseResultKind = "hostname" + AccountRuleListGetResponseResultKindASN AccountRuleListGetResponseResultKind = "asn" +) + +// Whether the API call was successful +type AccountRuleListGetResponseSuccess bool + +const ( + AccountRuleListGetResponseSuccessTrue AccountRuleListGetResponseSuccess = true +) + +type AccountRuleListUpdateResponse struct { + Errors []AccountRuleListUpdateResponseError `json:"errors"` + Messages []AccountRuleListUpdateResponseMessage `json:"messages"` + Result AccountRuleListUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListUpdateResponseSuccess `json:"success"` + JSON accountRuleListUpdateResponseJSON `json:"-"` +} + +// accountRuleListUpdateResponseJSON contains the JSON metadata for the struct +// [AccountRuleListUpdateResponse] +type accountRuleListUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListUpdateResponseErrorJSON `json:"-"` +} + +// accountRuleListUpdateResponseErrorJSON contains the JSON metadata for the struct +// [AccountRuleListUpdateResponseError] +type accountRuleListUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListUpdateResponseMessageJSON `json:"-"` +} + +// accountRuleListUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountRuleListUpdateResponseMessage] +type accountRuleListUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListUpdateResponseResult struct { + // The unique ID of the list. + ID string `json:"id"` + // The RFC 3339 timestamp of when the list was created. + CreatedOn string `json:"created_on"` + // An informative summary of the list. + Description string `json:"description"` + // The type of the list. Each type supports specific list items (IP addresses, + // ASNs, hostnames or redirects). + Kind AccountRuleListUpdateResponseResultKind `json:"kind"` + // The RFC 3339 timestamp of when the list was last modified. + ModifiedOn string `json:"modified_on"` + // An informative name for the list. Use this name in filter and rule expressions. + Name string `json:"name"` + // The number of items in the list. + NumItems float64 `json:"num_items"` + // The number of [filters](#filters) referencing the list. + NumReferencingFilters float64 `json:"num_referencing_filters"` + JSON accountRuleListUpdateResponseResultJSON `json:"-"` +} + +// accountRuleListUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountRuleListUpdateResponseResult] +type accountRuleListUpdateResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Kind apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NumItems apijson.Field + NumReferencingFilters apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the list. Each type supports specific list items (IP addresses, +// ASNs, hostnames or redirects). +type AccountRuleListUpdateResponseResultKind string + +const ( + AccountRuleListUpdateResponseResultKindIP AccountRuleListUpdateResponseResultKind = "ip" + AccountRuleListUpdateResponseResultKindRedirect AccountRuleListUpdateResponseResultKind = "redirect" + AccountRuleListUpdateResponseResultKindHostname AccountRuleListUpdateResponseResultKind = "hostname" + AccountRuleListUpdateResponseResultKindASN AccountRuleListUpdateResponseResultKind = "asn" +) + +// Whether the API call was successful +type AccountRuleListUpdateResponseSuccess bool + +const ( + AccountRuleListUpdateResponseSuccessTrue AccountRuleListUpdateResponseSuccess = true +) + +type AccountRuleListDeleteResponse struct { + Errors []AccountRuleListDeleteResponseError `json:"errors"` + Messages []AccountRuleListDeleteResponseMessage `json:"messages"` + Result AccountRuleListDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListDeleteResponseSuccess `json:"success"` + JSON accountRuleListDeleteResponseJSON `json:"-"` +} + +// accountRuleListDeleteResponseJSON contains the JSON metadata for the struct +// [AccountRuleListDeleteResponse] +type accountRuleListDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListDeleteResponseErrorJSON `json:"-"` +} + +// accountRuleListDeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountRuleListDeleteResponseError] +type accountRuleListDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListDeleteResponseMessageJSON `json:"-"` +} + +// accountRuleListDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountRuleListDeleteResponseMessage] +type accountRuleListDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListDeleteResponseResult struct { + // The unique ID of the item in the List. + ID string `json:"id"` + JSON accountRuleListDeleteResponseResultJSON `json:"-"` +} + +// accountRuleListDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountRuleListDeleteResponseResult] +type accountRuleListDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRuleListDeleteResponseSuccess bool + +const ( + AccountRuleListDeleteResponseSuccessTrue AccountRuleListDeleteResponseSuccess = true +) + +type AccountRuleListListsNewAListResponse struct { + Errors []AccountRuleListListsNewAListResponseError `json:"errors"` + Messages []AccountRuleListListsNewAListResponseMessage `json:"messages"` + Result AccountRuleListListsNewAListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListListsNewAListResponseSuccess `json:"success"` + JSON accountRuleListListsNewAListResponseJSON `json:"-"` +} + +// accountRuleListListsNewAListResponseJSON contains the JSON metadata for the +// struct [AccountRuleListListsNewAListResponse] +type accountRuleListListsNewAListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsNewAListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListListsNewAListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListListsNewAListResponseErrorJSON `json:"-"` +} + +// accountRuleListListsNewAListResponseErrorJSON contains the JSON metadata for the +// struct [AccountRuleListListsNewAListResponseError] +type accountRuleListListsNewAListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsNewAListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListListsNewAListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListListsNewAListResponseMessageJSON `json:"-"` +} + +// accountRuleListListsNewAListResponseMessageJSON contains the JSON metadata for +// the struct [AccountRuleListListsNewAListResponseMessage] +type accountRuleListListsNewAListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsNewAListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListListsNewAListResponseResult struct { + // The unique ID of the list. + ID string `json:"id"` + // The RFC 3339 timestamp of when the list was created. + CreatedOn string `json:"created_on"` + // An informative summary of the list. + Description string `json:"description"` + // The type of the list. Each type supports specific list items (IP addresses, + // ASNs, hostnames or redirects). + Kind AccountRuleListListsNewAListResponseResultKind `json:"kind"` + // The RFC 3339 timestamp of when the list was last modified. + ModifiedOn string `json:"modified_on"` + // An informative name for the list. Use this name in filter and rule expressions. + Name string `json:"name"` + // The number of items in the list. + NumItems float64 `json:"num_items"` + // The number of [filters](#filters) referencing the list. + NumReferencingFilters float64 `json:"num_referencing_filters"` + JSON accountRuleListListsNewAListResponseResultJSON `json:"-"` +} + +// accountRuleListListsNewAListResponseResultJSON contains the JSON metadata for +// the struct [AccountRuleListListsNewAListResponseResult] +type accountRuleListListsNewAListResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Kind apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NumItems apijson.Field + NumReferencingFilters apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsNewAListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the list. Each type supports specific list items (IP addresses, +// ASNs, hostnames or redirects). +type AccountRuleListListsNewAListResponseResultKind string + +const ( + AccountRuleListListsNewAListResponseResultKindIP AccountRuleListListsNewAListResponseResultKind = "ip" + AccountRuleListListsNewAListResponseResultKindRedirect AccountRuleListListsNewAListResponseResultKind = "redirect" + AccountRuleListListsNewAListResponseResultKindHostname AccountRuleListListsNewAListResponseResultKind = "hostname" + AccountRuleListListsNewAListResponseResultKindASN AccountRuleListListsNewAListResponseResultKind = "asn" +) + +// Whether the API call was successful +type AccountRuleListListsNewAListResponseSuccess bool + +const ( + AccountRuleListListsNewAListResponseSuccessTrue AccountRuleListListsNewAListResponseSuccess = true +) + +type AccountRuleListListsGetListsResponse struct { + Errors []AccountRuleListListsGetListsResponseError `json:"errors"` + Messages []AccountRuleListListsGetListsResponseMessage `json:"messages"` + Result []AccountRuleListListsGetListsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListListsGetListsResponseSuccess `json:"success"` + JSON accountRuleListListsGetListsResponseJSON `json:"-"` +} + +// accountRuleListListsGetListsResponseJSON contains the JSON metadata for the +// struct [AccountRuleListListsGetListsResponse] +type accountRuleListListsGetListsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsGetListsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListListsGetListsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListListsGetListsResponseErrorJSON `json:"-"` +} + +// accountRuleListListsGetListsResponseErrorJSON contains the JSON metadata for the +// struct [AccountRuleListListsGetListsResponseError] +type accountRuleListListsGetListsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsGetListsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListListsGetListsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListListsGetListsResponseMessageJSON `json:"-"` +} + +// accountRuleListListsGetListsResponseMessageJSON contains the JSON metadata for +// the struct [AccountRuleListListsGetListsResponseMessage] +type accountRuleListListsGetListsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsGetListsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListListsGetListsResponseResult struct { + // The unique ID of the list. + ID string `json:"id"` + // The RFC 3339 timestamp of when the list was created. + CreatedOn string `json:"created_on"` + // An informative summary of the list. + Description string `json:"description"` + // The type of the list. Each type supports specific list items (IP addresses, + // ASNs, hostnames or redirects). + Kind AccountRuleListListsGetListsResponseResultKind `json:"kind"` + // The RFC 3339 timestamp of when the list was last modified. + ModifiedOn string `json:"modified_on"` + // An informative name for the list. Use this name in filter and rule expressions. + Name string `json:"name"` + // The number of items in the list. + NumItems float64 `json:"num_items"` + // The number of [filters](#filters) referencing the list. + NumReferencingFilters float64 `json:"num_referencing_filters"` + JSON accountRuleListListsGetListsResponseResultJSON `json:"-"` +} + +// accountRuleListListsGetListsResponseResultJSON contains the JSON metadata for +// the struct [AccountRuleListListsGetListsResponseResult] +type accountRuleListListsGetListsResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Kind apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NumItems apijson.Field + NumReferencingFilters apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListListsGetListsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of the list. Each type supports specific list items (IP addresses, +// ASNs, hostnames or redirects). +type AccountRuleListListsGetListsResponseResultKind string + +const ( + AccountRuleListListsGetListsResponseResultKindIP AccountRuleListListsGetListsResponseResultKind = "ip" + AccountRuleListListsGetListsResponseResultKindRedirect AccountRuleListListsGetListsResponseResultKind = "redirect" + AccountRuleListListsGetListsResponseResultKindHostname AccountRuleListListsGetListsResponseResultKind = "hostname" + AccountRuleListListsGetListsResponseResultKindASN AccountRuleListListsGetListsResponseResultKind = "asn" +) + +// Whether the API call was successful +type AccountRuleListListsGetListsResponseSuccess bool + +const ( + AccountRuleListListsGetListsResponseSuccessTrue AccountRuleListListsGetListsResponseSuccess = true +) + +type AccountRuleListUpdateParams struct { + // An informative summary of the list. + Description param.Field[string] `json:"description"` +} + +func (r AccountRuleListUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRuleListListsNewAListParams struct { + // The type of the list. Each type supports specific list items (IP addresses, + // ASNs, hostnames or redirects). + Kind param.Field[AccountRuleListListsNewAListParamsKind] `json:"kind,required"` + // An informative name for the list. Use this name in filter and rule expressions. + Name param.Field[string] `json:"name,required"` + // An informative summary of the list. + Description param.Field[string] `json:"description"` +} + +func (r AccountRuleListListsNewAListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of the list. Each type supports specific list items (IP addresses, +// ASNs, hostnames or redirects). +type AccountRuleListListsNewAListParamsKind string + +const ( + AccountRuleListListsNewAListParamsKindIP AccountRuleListListsNewAListParamsKind = "ip" + AccountRuleListListsNewAListParamsKindRedirect AccountRuleListListsNewAListParamsKind = "redirect" + AccountRuleListListsNewAListParamsKindHostname AccountRuleListListsNewAListParamsKind = "hostname" + AccountRuleListListsNewAListParamsKindASN AccountRuleListListsNewAListParamsKind = "asn" +) diff --git a/accountrulelist_test.go b/accountrulelist_test.go new file mode 100644 index 00000000000..b4f7c56c70f --- /dev/null +++ b/accountrulelist_test.go @@ -0,0 +1,167 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRuleListGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + ) + 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 TestAccountRuleListUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + cloudflare.AccountRuleListUpdateParams{ + Description: cloudflare.F("This is a note"), + }, + ) + 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 TestAccountRuleListDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + ) + 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 TestAccountRuleListListsNewAListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.ListsNewAList( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountRuleListListsNewAListParams{ + Kind: cloudflare.F(cloudflare.AccountRuleListListsNewAListParamsKindIP), + Name: cloudflare.F("list1"), + Description: cloudflare.F("This is a note"), + }, + ) + 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 TestAccountRuleListListsGetLists(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.ListsGetLists(context.TODO(), "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/accountrulelistbulkoperation.go b/accountrulelistbulkoperation.go new file mode 100644 index 00000000000..92d7aa41add --- /dev/null +++ b/accountrulelistbulkoperation.go @@ -0,0 +1,149 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRuleListBulkOperationService 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 +// [NewAccountRuleListBulkOperationService] method instead. +type AccountRuleListBulkOperationService struct { + Options []option.RequestOption +} + +// NewAccountRuleListBulkOperationService 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 NewAccountRuleListBulkOperationService(opts ...option.RequestOption) (r *AccountRuleListBulkOperationService) { + r = &AccountRuleListBulkOperationService{} + r.Options = opts + return +} + +// Gets the current status of an asynchronous operation on a list. +// +// The `status` property can have one of the following values: `pending`, +// `running`, `completed`, or `failed`. If the status is `failed`, the `error` +// property will contain a message describing the error. +func (r *AccountRuleListBulkOperationService) Get(ctx context.Context, accountIdentifier string, operationID string, opts ...option.RequestOption) (res *AccountRuleListBulkOperationGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/bulk_operations/%s", accountIdentifier, operationID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountRuleListBulkOperationGetResponse struct { + Errors []AccountRuleListBulkOperationGetResponseError `json:"errors"` + Messages []AccountRuleListBulkOperationGetResponseMessage `json:"messages"` + Result AccountRuleListBulkOperationGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListBulkOperationGetResponseSuccess `json:"success"` + JSON accountRuleListBulkOperationGetResponseJSON `json:"-"` +} + +// accountRuleListBulkOperationGetResponseJSON contains the JSON metadata for the +// struct [AccountRuleListBulkOperationGetResponse] +type accountRuleListBulkOperationGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListBulkOperationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListBulkOperationGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListBulkOperationGetResponseErrorJSON `json:"-"` +} + +// accountRuleListBulkOperationGetResponseErrorJSON contains the JSON metadata for +// the struct [AccountRuleListBulkOperationGetResponseError] +type accountRuleListBulkOperationGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListBulkOperationGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListBulkOperationGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListBulkOperationGetResponseMessageJSON `json:"-"` +} + +// accountRuleListBulkOperationGetResponseMessageJSON contains the JSON metadata +// for the struct [AccountRuleListBulkOperationGetResponseMessage] +type accountRuleListBulkOperationGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListBulkOperationGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListBulkOperationGetResponseResult struct { + // The unique operation ID of the asynchronous action. + ID string `json:"id,required"` + // The current status of the asynchronous operation. + Status AccountRuleListBulkOperationGetResponseResultStatus `json:"status,required"` + // The RFC 3339 timestamp of when the operation was completed. + Completed string `json:"completed"` + // A message describing the error when the status is `failed`. + Error string `json:"error"` + JSON accountRuleListBulkOperationGetResponseResultJSON `json:"-"` +} + +// accountRuleListBulkOperationGetResponseResultJSON contains the JSON metadata for +// the struct [AccountRuleListBulkOperationGetResponseResult] +type accountRuleListBulkOperationGetResponseResultJSON struct { + ID apijson.Field + Status apijson.Field + Completed apijson.Field + Error apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListBulkOperationGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The current status of the asynchronous operation. +type AccountRuleListBulkOperationGetResponseResultStatus string + +const ( + AccountRuleListBulkOperationGetResponseResultStatusPending AccountRuleListBulkOperationGetResponseResultStatus = "pending" + AccountRuleListBulkOperationGetResponseResultStatusRunning AccountRuleListBulkOperationGetResponseResultStatus = "running" + AccountRuleListBulkOperationGetResponseResultStatusCompleted AccountRuleListBulkOperationGetResponseResultStatus = "completed" + AccountRuleListBulkOperationGetResponseResultStatusFailed AccountRuleListBulkOperationGetResponseResultStatus = "failed" +) + +// Whether the API call was successful +type AccountRuleListBulkOperationGetResponseSuccess bool + +const ( + AccountRuleListBulkOperationGetResponseSuccessTrue AccountRuleListBulkOperationGetResponseSuccess = true +) diff --git a/accountrulelistbulkoperation_test.go b/accountrulelistbulkoperation_test.go new file mode 100644 index 00000000000..c13a195d3df --- /dev/null +++ b/accountrulelistbulkoperation_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRuleListBulkOperationGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.BulkOperations.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "4da8780eeb215e6cb7f48dd981c4ea02", + ) + 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/accountrulelistitem.go b/accountrulelistitem.go new file mode 100644 index 00000000000..925988b85e7 --- /dev/null +++ b/accountrulelistitem.go @@ -0,0 +1,1575 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRuleListItemService 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 [NewAccountRuleListItemService] +// method instead. +type AccountRuleListItemService struct { + Options []option.RequestOption +} + +// NewAccountRuleListItemService 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 NewAccountRuleListItemService(opts ...option.RequestOption) (r *AccountRuleListItemService) { + r = &AccountRuleListItemService{} + r.Options = opts + return +} + +// Fetches a list item in the list. +func (r *AccountRuleListItemService) Get(ctx context.Context, accountIdentifier string, listID string, itemID string, opts ...option.RequestOption) (res *AccountRuleListItemGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s/items/%s", accountIdentifier, listID, itemID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Removes one or more items from a list. +// +// This operation is asynchronous. To get current the operation status, invoke the +// [Get bulk operation status](#lists-get-bulk-operation-status) endpoint with the +// returned `operation_id`. +func (r *AccountRuleListItemService) Delete(ctx context.Context, accountIdentifier string, listID string, body AccountRuleListItemDeleteParams, opts ...option.RequestOption) (res *AccountRuleListItemDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s/items", accountIdentifier, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Appends new items to the list. +// +// This operation is asynchronous. To get current the operation status, invoke the +// [Get bulk operation status](#lists-get-bulk-operation-status) endpoint with the +// returned `operation_id`. +func (r *AccountRuleListItemService) ListsNewListItems(ctx context.Context, accountIdentifier string, listID string, body AccountRuleListItemListsNewListItemsParams, opts ...option.RequestOption) (res *AccountRuleListItemListsNewListItemsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s/items", accountIdentifier, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches all the items in the list. +func (r *AccountRuleListItemService) ListsGetListItems(ctx context.Context, accountIdentifier string, listID string, query AccountRuleListItemListsGetListItemsParams, opts ...option.RequestOption) (res *AccountRuleListItemListsGetListItemsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s/items", accountIdentifier, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Removes all existing items from the list and adds the provided items to the +// list. +// +// This operation is asynchronous. To get current the operation status, invoke the +// [Get bulk operation status](#lists-get-bulk-operation-status) endpoint with the +// returned `operation_id`. +func (r *AccountRuleListItemService) ListsUpdateAllListItems(ctx context.Context, accountIdentifier string, listID string, body AccountRuleListItemListsUpdateAllListItemsParams, opts ...option.RequestOption) (res *AccountRuleListItemListsUpdateAllListItemsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s/items", accountIdentifier, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountRuleListItemGetResponse struct { + Errors []AccountRuleListItemGetResponseError `json:"errors"` + Messages []AccountRuleListItemGetResponseMessage `json:"messages"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + Result AccountRuleListItemGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListItemGetResponseSuccess `json:"success"` + JSON accountRuleListItemGetResponseJSON `json:"-"` +} + +// accountRuleListItemGetResponseJSON contains the JSON metadata for the struct +// [AccountRuleListItemGetResponse] +type accountRuleListItemGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemGetResponseErrorJSON `json:"-"` +} + +// accountRuleListItemGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountRuleListItemGetResponseError] +type accountRuleListItemGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemGetResponseMessageJSON `json:"-"` +} + +// accountRuleListItemGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountRuleListItemGetResponseMessage] +type accountRuleListItemGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a +// maximum of /64. +// +// Union satisfied by [AccountRuleListItemGetResponseResultPeciSksBItemIP], +// [AccountRuleListItemGetResponseResultPeciSksBItemRedirect], +// [AccountRuleListItemGetResponseResultPeciSksBItemHostname] or +// [AccountRuleListItemGetResponseResultPeciSksBItemASN]. +type AccountRuleListItemGetResponseResult interface { + implementsAccountRuleListItemGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountRuleListItemGetResponseResult)(nil)).Elem(), "") +} + +// An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a +// maximum of /64. +type AccountRuleListItemGetResponseResultPeciSksBItemIP struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemGetResponseResultPeciSksBItemIPHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemGetResponseResultPeciSksBItemIPRedirect `json:"redirect"` + JSON accountRuleListItemGetResponseResultPeciSksBItemIPJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemIPJSON contains the JSON +// metadata for the struct [AccountRuleListItemGetResponseResultPeciSksBItemIP] +type accountRuleListItemGetResponseResultPeciSksBItemIPJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemGetResponseResultPeciSksBItemIP) implementsAccountRuleListItemGetResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemGetResponseResultPeciSksBItemIPHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemGetResponseResultPeciSksBItemIPHostnameJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemIPHostnameJSON contains the JSON +// metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemIPHostname] +type accountRuleListItemGetResponseResultPeciSksBItemIPHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemIPHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemGetResponseResultPeciSksBItemIPRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemGetResponseResultPeciSksBItemIPRedirectJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemIPRedirectJSON contains the JSON +// metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemIPRedirect] +type accountRuleListItemGetResponseResultPeciSksBItemIPRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemIPRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode int64 + +const ( + AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode301 AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode = 301 + AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode302 AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode = 302 + AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode307 AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode = 307 + AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode308 AccountRuleListItemGetResponseResultPeciSksBItemIPRedirectStatusCode = 308 +) + +// The definition of the redirect. +type AccountRuleListItemGetResponseResultPeciSksBItemRedirect struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemGetResponseResultPeciSksBItemRedirectHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirect `json:"redirect"` + JSON accountRuleListItemGetResponseResultPeciSksBItemRedirectJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemRedirectJSON contains the JSON +// metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemRedirect] +type accountRuleListItemGetResponseResultPeciSksBItemRedirectJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemGetResponseResultPeciSksBItemRedirect) implementsAccountRuleListItemGetResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemGetResponseResultPeciSksBItemRedirectHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemGetResponseResultPeciSksBItemRedirectHostnameJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemRedirectHostnameJSON contains +// the JSON metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemRedirectHostname] +type accountRuleListItemGetResponseResultPeciSksBItemRedirectHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemRedirectHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectJSON contains +// the JSON metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirect] +type accountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode int64 + +const ( + AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode301 AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode = 301 + AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode302 AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode = 302 + AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode307 AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode = 307 + AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode308 AccountRuleListItemGetResponseResultPeciSksBItemRedirectRedirectStatusCode = 308 +) + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemGetResponseResultPeciSksBItemHostname struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemGetResponseResultPeciSksBItemHostnameHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirect `json:"redirect"` + JSON accountRuleListItemGetResponseResultPeciSksBItemHostnameJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemHostnameJSON contains the JSON +// metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemHostname] +type accountRuleListItemGetResponseResultPeciSksBItemHostnameJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemGetResponseResultPeciSksBItemHostname) implementsAccountRuleListItemGetResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemGetResponseResultPeciSksBItemHostnameHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemGetResponseResultPeciSksBItemHostnameHostnameJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemHostnameHostnameJSON contains +// the JSON metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemHostnameHostname] +type accountRuleListItemGetResponseResultPeciSksBItemHostnameHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemHostnameHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectJSON contains +// the JSON metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirect] +type accountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode int64 + +const ( + AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode301 AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode = 301 + AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode302 AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode = 302 + AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode307 AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode = 307 + AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode308 AccountRuleListItemGetResponseResultPeciSksBItemHostnameRedirectStatusCode = 308 +) + +// A non-negative 32 bit integer +type AccountRuleListItemGetResponseResultPeciSksBItemASN struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemGetResponseResultPeciSksBItemASNHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemGetResponseResultPeciSksBItemASNRedirect `json:"redirect"` + JSON accountRuleListItemGetResponseResultPeciSksBItemASNJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemASNJSON contains the JSON +// metadata for the struct [AccountRuleListItemGetResponseResultPeciSksBItemASN] +type accountRuleListItemGetResponseResultPeciSksBItemASNJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemASN) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemGetResponseResultPeciSksBItemASN) implementsAccountRuleListItemGetResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemGetResponseResultPeciSksBItemASNHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemGetResponseResultPeciSksBItemASNHostnameJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemASNHostnameJSON contains the +// JSON metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemASNHostname] +type accountRuleListItemGetResponseResultPeciSksBItemASNHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemASNHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemGetResponseResultPeciSksBItemASNRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemGetResponseResultPeciSksBItemASNRedirectJSON `json:"-"` +} + +// accountRuleListItemGetResponseResultPeciSksBItemASNRedirectJSON contains the +// JSON metadata for the struct +// [AccountRuleListItemGetResponseResultPeciSksBItemASNRedirect] +type accountRuleListItemGetResponseResultPeciSksBItemASNRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemGetResponseResultPeciSksBItemASNRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode int64 + +const ( + AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode301 AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode = 301 + AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode302 AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode = 302 + AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode307 AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode = 307 + AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode308 AccountRuleListItemGetResponseResultPeciSksBItemASNRedirectStatusCode = 308 +) + +// Whether the API call was successful +type AccountRuleListItemGetResponseSuccess bool + +const ( + AccountRuleListItemGetResponseSuccessTrue AccountRuleListItemGetResponseSuccess = true +) + +type AccountRuleListItemDeleteResponse struct { + Errors []AccountRuleListItemDeleteResponseError `json:"errors"` + Messages []AccountRuleListItemDeleteResponseMessage `json:"messages"` + Result AccountRuleListItemDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListItemDeleteResponseSuccess `json:"success"` + JSON accountRuleListItemDeleteResponseJSON `json:"-"` +} + +// accountRuleListItemDeleteResponseJSON contains the JSON metadata for the struct +// [AccountRuleListItemDeleteResponse] +type accountRuleListItemDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemDeleteResponseErrorJSON `json:"-"` +} + +// accountRuleListItemDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountRuleListItemDeleteResponseError] +type accountRuleListItemDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemDeleteResponseMessageJSON `json:"-"` +} + +// accountRuleListItemDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountRuleListItemDeleteResponseMessage] +type accountRuleListItemDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemDeleteResponseResult struct { + // The unique operation ID of the asynchronous action. + OperationID string `json:"operation_id"` + JSON accountRuleListItemDeleteResponseResultJSON `json:"-"` +} + +// accountRuleListItemDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountRuleListItemDeleteResponseResult] +type accountRuleListItemDeleteResponseResultJSON struct { + OperationID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRuleListItemDeleteResponseSuccess bool + +const ( + AccountRuleListItemDeleteResponseSuccessTrue AccountRuleListItemDeleteResponseSuccess = true +) + +type AccountRuleListItemListsNewListItemsResponse struct { + Errors []AccountRuleListItemListsNewListItemsResponseError `json:"errors"` + Messages []AccountRuleListItemListsNewListItemsResponseMessage `json:"messages"` + Result AccountRuleListItemListsNewListItemsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListItemListsNewListItemsResponseSuccess `json:"success"` + JSON accountRuleListItemListsNewListItemsResponseJSON `json:"-"` +} + +// accountRuleListItemListsNewListItemsResponseJSON contains the JSON metadata for +// the struct [AccountRuleListItemListsNewListItemsResponse] +type accountRuleListItemListsNewListItemsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsNewListItemsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsNewListItemsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemListsNewListItemsResponseErrorJSON `json:"-"` +} + +// accountRuleListItemListsNewListItemsResponseErrorJSON contains the JSON metadata +// for the struct [AccountRuleListItemListsNewListItemsResponseError] +type accountRuleListItemListsNewListItemsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsNewListItemsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsNewListItemsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemListsNewListItemsResponseMessageJSON `json:"-"` +} + +// accountRuleListItemListsNewListItemsResponseMessageJSON contains the JSON +// metadata for the struct [AccountRuleListItemListsNewListItemsResponseMessage] +type accountRuleListItemListsNewListItemsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsNewListItemsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsNewListItemsResponseResult struct { + // The unique operation ID of the asynchronous action. + OperationID string `json:"operation_id"` + JSON accountRuleListItemListsNewListItemsResponseResultJSON `json:"-"` +} + +// accountRuleListItemListsNewListItemsResponseResultJSON contains the JSON +// metadata for the struct [AccountRuleListItemListsNewListItemsResponseResult] +type accountRuleListItemListsNewListItemsResponseResultJSON struct { + OperationID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsNewListItemsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRuleListItemListsNewListItemsResponseSuccess bool + +const ( + AccountRuleListItemListsNewListItemsResponseSuccessTrue AccountRuleListItemListsNewListItemsResponseSuccess = true +) + +type AccountRuleListItemListsGetListItemsResponse struct { + Errors []AccountRuleListItemListsGetListItemsResponseError `json:"errors"` + Messages []AccountRuleListItemListsGetListItemsResponseMessage `json:"messages"` + Result []AccountRuleListItemListsGetListItemsResponseResult `json:"result"` + ResultInfo AccountRuleListItemListsGetListItemsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountRuleListItemListsGetListItemsResponseSuccess `json:"success"` + JSON accountRuleListItemListsGetListItemsResponseJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseJSON contains the JSON metadata for +// the struct [AccountRuleListItemListsGetListItemsResponse] +type accountRuleListItemListsGetListItemsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsGetListItemsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemListsGetListItemsResponseErrorJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseErrorJSON contains the JSON metadata +// for the struct [AccountRuleListItemListsGetListItemsResponseError] +type accountRuleListItemListsGetListItemsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsGetListItemsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemListsGetListItemsResponseMessageJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseMessageJSON contains the JSON +// metadata for the struct [AccountRuleListItemListsGetListItemsResponseMessage] +type accountRuleListItemListsGetListItemsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a +// maximum of /64. +// +// Union satisfied by +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIP], +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirect], +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostname] or +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASN]. +type AccountRuleListItemListsGetListItemsResponseResult interface { + implementsAccountRuleListItemListsGetListItemsResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountRuleListItemListsGetListItemsResponseResult)(nil)).Elem(), "") +} + +// An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a +// maximum of /64. +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIP struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirect `json:"redirect"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPJSON contains +// the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIP] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIP) implementsAccountRuleListItemListsGetListItemsResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPHostnameJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPHostnameJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPHostname] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirect] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode int64 + +const ( + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode301 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode = 301 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode302 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode = 302 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode307 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode = 307 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode308 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemIPRedirectStatusCode = 308 +) + +// The definition of the redirect. +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirect struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirect `json:"redirect"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirect] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirect) implementsAccountRuleListItemListsGetListItemsResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectHostnameJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectHostnameJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectHostname] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirect] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode int64 + +const ( + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode301 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode = 301 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode302 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode = 302 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode307 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode = 307 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode308 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemRedirectRedirectStatusCode = 308 +) + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostname struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirect `json:"redirect"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostname] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostname) implementsAccountRuleListItemListsGetListItemsResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameHostnameJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameHostnameJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameHostname] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirect] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode int64 + +const ( + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode301 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode = 301 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode302 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode = 302 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode307 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode = 307 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode308 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemHostnameRedirectStatusCode = 308 +) + +// A non-negative 32 bit integer +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASN struct { + // The unique ID of the list. + ID string `json:"id"` + // A non-negative 32 bit integer + ASN int64 `json:"asn"` + // An informative summary of the list item. + Comment string `json:"comment"` + // The RFC 3339 timestamp of when the item was created. + CreatedOn string `json:"created_on"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNHostname `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP string `json:"ip"` + // The RFC 3339 timestamp of when the item was last modified. + ModifiedOn string `json:"modified_on"` + // The definition of the redirect. + Redirect AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirect `json:"redirect"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNJSON contains +// the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASN] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNJSON struct { + ID apijson.Field + ASN apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Hostname apijson.Field + IP apijson.Field + ModifiedOn apijson.Field + Redirect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASN) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASN) implementsAccountRuleListItemListsGetListItemsResponseResult() { +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNHostname struct { + URLHostname string `json:"url_hostname,required"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNHostnameJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNHostnameJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNHostname] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNHostnameJSON struct { + URLHostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNHostname) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The definition of the redirect. +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirect struct { + SourceURL string `json:"source_url,required"` + TargetURL string `json:"target_url,required"` + IncludeSubdomains bool `json:"include_subdomains"` + PreservePathSuffix bool `json:"preserve_path_suffix"` + PreserveQueryString bool `json:"preserve_query_string"` + StatusCode AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode `json:"status_code"` + SubpathMatching bool `json:"subpath_matching"` + JSON accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectJSON +// contains the JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirect] +type accountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectJSON struct { + SourceURL apijson.Field + TargetURL apijson.Field + IncludeSubdomains apijson.Field + PreservePathSuffix apijson.Field + PreserveQueryString apijson.Field + StatusCode apijson.Field + SubpathMatching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode int64 + +const ( + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode301 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode = 301 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode302 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode = 302 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode307 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode = 307 + AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode308 AccountRuleListItemListsGetListItemsResponseResultPeciSksBItemASNRedirectStatusCode = 308 +) + +type AccountRuleListItemListsGetListItemsResponseResultInfo struct { + Cursors AccountRuleListItemListsGetListItemsResponseResultInfoCursors `json:"cursors"` + JSON accountRuleListItemListsGetListItemsResponseResultInfoJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountRuleListItemListsGetListItemsResponseResultInfo] +type accountRuleListItemListsGetListItemsResponseResultInfoJSON struct { + Cursors apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsGetListItemsResponseResultInfoCursors struct { + After string `json:"after"` + Before string `json:"before"` + JSON accountRuleListItemListsGetListItemsResponseResultInfoCursorsJSON `json:"-"` +} + +// accountRuleListItemListsGetListItemsResponseResultInfoCursorsJSON contains the +// JSON metadata for the struct +// [AccountRuleListItemListsGetListItemsResponseResultInfoCursors] +type accountRuleListItemListsGetListItemsResponseResultInfoCursorsJSON struct { + After apijson.Field + Before apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsGetListItemsResponseResultInfoCursors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRuleListItemListsGetListItemsResponseSuccess bool + +const ( + AccountRuleListItemListsGetListItemsResponseSuccessTrue AccountRuleListItemListsGetListItemsResponseSuccess = true +) + +type AccountRuleListItemListsUpdateAllListItemsResponse struct { + Errors []AccountRuleListItemListsUpdateAllListItemsResponseError `json:"errors"` + Messages []AccountRuleListItemListsUpdateAllListItemsResponseMessage `json:"messages"` + Result AccountRuleListItemListsUpdateAllListItemsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountRuleListItemListsUpdateAllListItemsResponseSuccess `json:"success"` + JSON accountRuleListItemListsUpdateAllListItemsResponseJSON `json:"-"` +} + +// accountRuleListItemListsUpdateAllListItemsResponseJSON contains the JSON +// metadata for the struct [AccountRuleListItemListsUpdateAllListItemsResponse] +type accountRuleListItemListsUpdateAllListItemsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsUpdateAllListItemsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsUpdateAllListItemsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemListsUpdateAllListItemsResponseErrorJSON `json:"-"` +} + +// accountRuleListItemListsUpdateAllListItemsResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountRuleListItemListsUpdateAllListItemsResponseError] +type accountRuleListItemListsUpdateAllListItemsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsUpdateAllListItemsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsUpdateAllListItemsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRuleListItemListsUpdateAllListItemsResponseMessageJSON `json:"-"` +} + +// accountRuleListItemListsUpdateAllListItemsResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountRuleListItemListsUpdateAllListItemsResponseMessage] +type accountRuleListItemListsUpdateAllListItemsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsUpdateAllListItemsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRuleListItemListsUpdateAllListItemsResponseResult struct { + // The unique operation ID of the asynchronous action. + OperationID string `json:"operation_id"` + JSON accountRuleListItemListsUpdateAllListItemsResponseResultJSON `json:"-"` +} + +// accountRuleListItemListsUpdateAllListItemsResponseResultJSON contains the JSON +// metadata for the struct +// [AccountRuleListItemListsUpdateAllListItemsResponseResult] +type accountRuleListItemListsUpdateAllListItemsResponseResultJSON struct { + OperationID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRuleListItemListsUpdateAllListItemsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountRuleListItemListsUpdateAllListItemsResponseSuccess bool + +const ( + AccountRuleListItemListsUpdateAllListItemsResponseSuccessTrue AccountRuleListItemListsUpdateAllListItemsResponseSuccess = true +) + +type AccountRuleListItemDeleteParams struct { + Items param.Field[[]AccountRuleListItemDeleteParamsItem] `json:"items"` +} + +func (r AccountRuleListItemDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRuleListItemDeleteParamsItem struct { + // The unique ID of the item in the List. + ID param.Field[string] `json:"id"` +} + +func (r AccountRuleListItemDeleteParamsItem) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRuleListItemListsNewListItemsParams struct { + Body param.Field[[]AccountRuleListItemListsNewListItemsParamsBody] `json:"body,required"` +} + +func (r AccountRuleListItemListsNewListItemsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountRuleListItemListsNewListItemsParamsBody struct { + // A non-negative 32 bit integer + ASN param.Field[int64] `json:"asn"` + // An informative summary of the list item. + Comment param.Field[string] `json:"comment"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname param.Field[AccountRuleListItemListsNewListItemsParamsBodyHostname] `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP param.Field[string] `json:"ip"` + // The definition of the redirect. + Redirect param.Field[AccountRuleListItemListsNewListItemsParamsBodyRedirect] `json:"redirect"` +} + +func (r AccountRuleListItemListsNewListItemsParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemListsNewListItemsParamsBodyHostname struct { + URLHostname param.Field[string] `json:"url_hostname,required"` +} + +func (r AccountRuleListItemListsNewListItemsParamsBodyHostname) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The definition of the redirect. +type AccountRuleListItemListsNewListItemsParamsBodyRedirect struct { + SourceURL param.Field[string] `json:"source_url,required"` + TargetURL param.Field[string] `json:"target_url,required"` + IncludeSubdomains param.Field[bool] `json:"include_subdomains"` + PreservePathSuffix param.Field[bool] `json:"preserve_path_suffix"` + PreserveQueryString param.Field[bool] `json:"preserve_query_string"` + StatusCode param.Field[AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode] `json:"status_code"` + SubpathMatching param.Field[bool] `json:"subpath_matching"` +} + +func (r AccountRuleListItemListsNewListItemsParamsBodyRedirect) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode int64 + +const ( + AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode301 AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode = 301 + AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode302 AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode = 302 + AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode307 AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode = 307 + AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode308 AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode = 308 +) + +type AccountRuleListItemListsGetListItemsParams struct { + // The pagination cursor. An opaque string token indicating the position from which + // to continue when requesting the next/previous set of records. Cursor values are + // provided under `result_info.cursors` in the response. You should make no + // assumptions about a cursor's content or length. + Cursor param.Field[string] `query:"cursor"` + // Amount of results to include in each paginated response. A non-negative 32 bit + // integer. + PerPage param.Field[int64] `query:"per_page"` + // A search query to filter returned items. Its meaning depends on the list type: + // IP addresses must start with the provided string, hostnames and bulk redirects + // must contain the string, and ASNs must match the string exactly. + Search param.Field[string] `query:"search"` +} + +// URLQuery serializes [AccountRuleListItemListsGetListItemsParams]'s query +// parameters as `url.Values`. +func (r AccountRuleListItemListsGetListItemsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountRuleListItemListsUpdateAllListItemsParams struct { + Body param.Field[[]AccountRuleListItemListsUpdateAllListItemsParamsBody] `json:"body,required"` +} + +func (r AccountRuleListItemListsUpdateAllListItemsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountRuleListItemListsUpdateAllListItemsParamsBody struct { + // A non-negative 32 bit integer + ASN param.Field[int64] `json:"asn"` + // An informative summary of the list item. + Comment param.Field[string] `json:"comment"` + // Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + // 0 to 9, wildcards (\*), and the hyphen (-). + Hostname param.Field[AccountRuleListItemListsUpdateAllListItemsParamsBodyHostname] `json:"hostname"` + // An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + // maximum of /64. + IP param.Field[string] `json:"ip"` + // The definition of the redirect. + Redirect param.Field[AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirect] `json:"redirect"` +} + +func (r AccountRuleListItemListsUpdateAllListItemsParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Valid characters for hostnames are ASCII(7) letters from a to z, the digits from +// 0 to 9, wildcards (\*), and the hyphen (-). +type AccountRuleListItemListsUpdateAllListItemsParamsBodyHostname struct { + URLHostname param.Field[string] `json:"url_hostname,required"` +} + +func (r AccountRuleListItemListsUpdateAllListItemsParamsBodyHostname) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The definition of the redirect. +type AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirect struct { + SourceURL param.Field[string] `json:"source_url,required"` + TargetURL param.Field[string] `json:"target_url,required"` + IncludeSubdomains param.Field[bool] `json:"include_subdomains"` + PreservePathSuffix param.Field[bool] `json:"preserve_path_suffix"` + PreserveQueryString param.Field[bool] `json:"preserve_query_string"` + StatusCode param.Field[AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode] `json:"status_code"` + SubpathMatching param.Field[bool] `json:"subpath_matching"` +} + +func (r AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirect) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode int64 + +const ( + AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode301 AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode = 301 + AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode302 AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode = 302 + AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode307 AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode = 307 + AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode308 AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode = 308 +) diff --git a/accountrulelistitem_test.go b/accountrulelistitem_test.go new file mode 100644 index 00000000000..b5df60ee99b --- /dev/null +++ b/accountrulelistitem_test.go @@ -0,0 +1,277 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRuleListItemGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Items.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + "34b12448945f11eaa1b71c4d701ab86e", + ) + 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 TestAccountRuleListItemDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Items.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + cloudflare.AccountRuleListItemDeleteParams{ + Items: cloudflare.F([]cloudflare.AccountRuleListItemDeleteParamsItem{{ + ID: cloudflare.F("34b12448945f11eaa1b71c4d701ab86e"), + }}), + }, + ) + 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 TestAccountRuleListItemListsNewListItems(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Items.ListsNewListItems( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + cloudflare.AccountRuleListItemListsNewListItemsParams{ + Body: cloudflare.F([]cloudflare.AccountRuleListItemListsNewListItemsParamsBody{{ + ASN: cloudflare.F(int64(5567)), + Comment: cloudflare.F("Private IP address"), + Hostname: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyHostname{ + URLHostname: cloudflare.F("example.com"), + }), + IP: cloudflare.F("10.0.0.1"), + Redirect: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyRedirect{ + IncludeSubdomains: cloudflare.F(true), + PreservePathSuffix: cloudflare.F(true), + PreserveQueryString: cloudflare.F(true), + SourceURL: cloudflare.F("example.com/arch"), + StatusCode: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode301), + SubpathMatching: cloudflare.F(true), + TargetURL: cloudflare.F("https://archlinux.org/"), + }), + }, { + ASN: cloudflare.F(int64(5567)), + Comment: cloudflare.F("Private IP address"), + Hostname: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyHostname{ + URLHostname: cloudflare.F("example.com"), + }), + IP: cloudflare.F("10.0.0.1"), + Redirect: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyRedirect{ + IncludeSubdomains: cloudflare.F(true), + PreservePathSuffix: cloudflare.F(true), + PreserveQueryString: cloudflare.F(true), + SourceURL: cloudflare.F("example.com/arch"), + StatusCode: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode301), + SubpathMatching: cloudflare.F(true), + TargetURL: cloudflare.F("https://archlinux.org/"), + }), + }, { + ASN: cloudflare.F(int64(5567)), + Comment: cloudflare.F("Private IP address"), + Hostname: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyHostname{ + URLHostname: cloudflare.F("example.com"), + }), + IP: cloudflare.F("10.0.0.1"), + Redirect: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyRedirect{ + IncludeSubdomains: cloudflare.F(true), + PreservePathSuffix: cloudflare.F(true), + PreserveQueryString: cloudflare.F(true), + SourceURL: cloudflare.F("example.com/arch"), + StatusCode: cloudflare.F(cloudflare.AccountRuleListItemListsNewListItemsParamsBodyRedirectStatusCode301), + SubpathMatching: cloudflare.F(true), + TargetURL: cloudflare.F("https://archlinux.org/"), + }), + }}), + }, + ) + 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 TestAccountRuleListItemListsGetListItemsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Items.ListsGetListItems( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + cloudflare.AccountRuleListItemListsGetListItemsParams{ + Cursor: cloudflare.F("zzz"), + PerPage: cloudflare.F(int64(1)), + Search: cloudflare.F("1.1.1."), + }, + ) + 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 TestAccountRuleListItemListsUpdateAllListItems(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rules.Lists.Items.ListsUpdateAllListItems( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "2c0fc9fa937b11eaa1b71c4d701ab86e", + cloudflare.AccountRuleListItemListsUpdateAllListItemsParams{ + Body: cloudflare.F([]cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBody{{ + ASN: cloudflare.F(int64(5567)), + Comment: cloudflare.F("Private IP address"), + Hostname: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyHostname{ + URLHostname: cloudflare.F("example.com"), + }), + IP: cloudflare.F("10.0.0.1"), + Redirect: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirect{ + IncludeSubdomains: cloudflare.F(true), + PreservePathSuffix: cloudflare.F(true), + PreserveQueryString: cloudflare.F(true), + SourceURL: cloudflare.F("example.com/arch"), + StatusCode: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode301), + SubpathMatching: cloudflare.F(true), + TargetURL: cloudflare.F("https://archlinux.org/"), + }), + }, { + ASN: cloudflare.F(int64(5567)), + Comment: cloudflare.F("Private IP address"), + Hostname: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyHostname{ + URLHostname: cloudflare.F("example.com"), + }), + IP: cloudflare.F("10.0.0.1"), + Redirect: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirect{ + IncludeSubdomains: cloudflare.F(true), + PreservePathSuffix: cloudflare.F(true), + PreserveQueryString: cloudflare.F(true), + SourceURL: cloudflare.F("example.com/arch"), + StatusCode: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode301), + SubpathMatching: cloudflare.F(true), + TargetURL: cloudflare.F("https://archlinux.org/"), + }), + }, { + ASN: cloudflare.F(int64(5567)), + Comment: cloudflare.F("Private IP address"), + Hostname: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyHostname{ + URLHostname: cloudflare.F("example.com"), + }), + IP: cloudflare.F("10.0.0.1"), + Redirect: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirect{ + IncludeSubdomains: cloudflare.F(true), + PreservePathSuffix: cloudflare.F(true), + PreserveQueryString: cloudflare.F(true), + SourceURL: cloudflare.F("example.com/arch"), + StatusCode: cloudflare.F(cloudflare.AccountRuleListItemListsUpdateAllListItemsParamsBodyRedirectStatusCode301), + SubpathMatching: cloudflare.F(true), + TargetURL: cloudflare.F("https://archlinux.org/"), + }), + }}), + }, + ) + 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/accountruleset.go b/accountruleset.go new file mode 100644 index 00000000000..fd24c0e6795 --- /dev/null +++ b/accountruleset.go @@ -0,0 +1,1390 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRulesetService 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 [NewAccountRulesetService] method +// instead. +type AccountRulesetService struct { + Options []option.RequestOption + Phases *AccountRulesetPhaseService + Rules *AccountRulesetRuleService + Versions *AccountRulesetVersionService +} + +// NewAccountRulesetService 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 NewAccountRulesetService(opts ...option.RequestOption) (r *AccountRulesetService) { + r = &AccountRulesetService{} + r.Options = opts + r.Phases = NewAccountRulesetPhaseService(opts...) + r.Rules = NewAccountRulesetRuleService(opts...) + r.Versions = NewAccountRulesetVersionService(opts...) + return +} + +// Fetches the latest version of an account ruleset. +func (r *AccountRulesetService) Get(ctx context.Context, accountID string, rulesetID string, opts ...option.RequestOption) (res *AccountRulesetGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s", accountID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an account ruleset, creating a new version. +func (r *AccountRulesetService) Update(ctx context.Context, accountID string, rulesetID string, body AccountRulesetUpdateParams, opts ...option.RequestOption) (res *AccountRulesetUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s", accountID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes all versions of an existing account ruleset. +func (r *AccountRulesetService) Delete(ctx context.Context, accountID string, rulesetID string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s", accountID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Creates a ruleset at the account level. +func (r *AccountRulesetService) AccountRulesetsNewAnAccountRuleset(ctx context.Context, accountID string, body AccountRulesetAccountRulesetsNewAnAccountRulesetParams, opts ...option.RequestOption) (res *AccountRulesetAccountRulesetsNewAnAccountRulesetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches all rulesets at the account level. +func (r *AccountRulesetService) AccountRulesetsListAccountRulesets(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AccountRulesetAccountRulesetsListAccountRulesetsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountRulesetGetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetGetResponseMessage `json:"messages"` + Result AccountRulesetGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetGetResponseSuccess `json:"success"` + JSON accountRulesetGetResponseJSON `json:"-"` +} + +// accountRulesetGetResponseJSON contains the JSON metadata for the struct +// [AccountRulesetGetResponse] +type accountRulesetGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetGetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetGetResponseMessagesSource `json:"source"` + JSON accountRulesetGetResponseMessageJSON `json:"-"` +} + +// accountRulesetGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountRulesetGetResponseMessage] +type accountRulesetGetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetGetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetGetResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetGetResponseMessagesSourceJSON contains the JSON metadata for the +// struct [AccountRulesetGetResponseMessagesSource] +type accountRulesetGetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetGetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetGetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetGetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetGetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetGetResponseResultJSON `json:"-"` +} + +// accountRulesetGetResponseResultJSON contains the JSON metadata for the struct +// [AccountRulesetGetResponseResult] +type accountRulesetGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetGetResponseResultKind string + +const ( + AccountRulesetGetResponseResultKindManaged AccountRulesetGetResponseResultKind = "managed" + AccountRulesetGetResponseResultKindCustom AccountRulesetGetResponseResultKind = "custom" + AccountRulesetGetResponseResultKindRoot AccountRulesetGetResponseResultKind = "root" + AccountRulesetGetResponseResultKindZone AccountRulesetGetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetGetResponseResultPhase string + +const ( + AccountRulesetGetResponseResultPhaseDdosL4 AccountRulesetGetResponseResultPhase = "ddos_l4" + AccountRulesetGetResponseResultPhaseDdosL7 AccountRulesetGetResponseResultPhase = "ddos_l7" + AccountRulesetGetResponseResultPhaseHTTPConfigSettings AccountRulesetGetResponseResultPhase = "http_config_settings" + AccountRulesetGetResponseResultPhaseHTTPCustomErrors AccountRulesetGetResponseResultPhase = "http_custom_errors" + AccountRulesetGetResponseResultPhaseHTTPLogCustomFields AccountRulesetGetResponseResultPhase = "http_log_custom_fields" + AccountRulesetGetResponseResultPhaseHTTPRatelimit AccountRulesetGetResponseResultPhase = "http_ratelimit" + AccountRulesetGetResponseResultPhaseHTTPRequestCacheSettings AccountRulesetGetResponseResultPhase = "http_request_cache_settings" + AccountRulesetGetResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetGetResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetGetResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetGetResponseResultPhase = "http_request_firewall_custom" + AccountRulesetGetResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetGetResponseResultPhase = "http_request_firewall_managed" + AccountRulesetGetResponseResultPhaseHTTPRequestLateTransform AccountRulesetGetResponseResultPhase = "http_request_late_transform" + AccountRulesetGetResponseResultPhaseHTTPRequestOrigin AccountRulesetGetResponseResultPhase = "http_request_origin" + AccountRulesetGetResponseResultPhaseHTTPRequestRedirect AccountRulesetGetResponseResultPhase = "http_request_redirect" + AccountRulesetGetResponseResultPhaseHTTPRequestSanitize AccountRulesetGetResponseResultPhase = "http_request_sanitize" + AccountRulesetGetResponseResultPhaseHTTPRequestSbfm AccountRulesetGetResponseResultPhase = "http_request_sbfm" + AccountRulesetGetResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetGetResponseResultPhase = "http_request_select_configuration" + AccountRulesetGetResponseResultPhaseHTTPRequestTransform AccountRulesetGetResponseResultPhase = "http_request_transform" + AccountRulesetGetResponseResultPhaseHTTPResponseCompression AccountRulesetGetResponseResultPhase = "http_response_compression" + AccountRulesetGetResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetGetResponseResultPhase = "http_response_firewall_managed" + AccountRulesetGetResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetGetResponseResultPhase = "http_response_headers_transform" + AccountRulesetGetResponseResultPhaseMagicTransit AccountRulesetGetResponseResultPhase = "magic_transit" + AccountRulesetGetResponseResultPhaseMagicTransitIDsManaged AccountRulesetGetResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetGetResponseResultPhaseMagicTransitManaged AccountRulesetGetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetGetResponseSuccess bool + +const ( + AccountRulesetGetResponseSuccessTrue AccountRulesetGetResponseSuccess = true +) + +type AccountRulesetUpdateResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetUpdateResponseMessage `json:"messages"` + Result AccountRulesetUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetUpdateResponseSuccess `json:"success"` + JSON accountRulesetUpdateResponseJSON `json:"-"` +} + +// accountRulesetUpdateResponseJSON contains the JSON metadata for the struct +// [AccountRulesetUpdateResponse] +type accountRulesetUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetUpdateResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetUpdateResponseMessagesSource `json:"source"` + JSON accountRulesetUpdateResponseMessageJSON `json:"-"` +} + +// accountRulesetUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountRulesetUpdateResponseMessage] +type accountRulesetUpdateResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetUpdateResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetUpdateResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetUpdateResponseMessagesSourceJSON contains the JSON metadata for +// the struct [AccountRulesetUpdateResponseMessagesSource] +type accountRulesetUpdateResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetUpdateResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetUpdateResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetUpdateResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetUpdateResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetUpdateResponseResultJSON `json:"-"` +} + +// accountRulesetUpdateResponseResultJSON contains the JSON metadata for the struct +// [AccountRulesetUpdateResponseResult] +type accountRulesetUpdateResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetUpdateResponseResultKind string + +const ( + AccountRulesetUpdateResponseResultKindManaged AccountRulesetUpdateResponseResultKind = "managed" + AccountRulesetUpdateResponseResultKindCustom AccountRulesetUpdateResponseResultKind = "custom" + AccountRulesetUpdateResponseResultKindRoot AccountRulesetUpdateResponseResultKind = "root" + AccountRulesetUpdateResponseResultKindZone AccountRulesetUpdateResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetUpdateResponseResultPhase string + +const ( + AccountRulesetUpdateResponseResultPhaseDdosL4 AccountRulesetUpdateResponseResultPhase = "ddos_l4" + AccountRulesetUpdateResponseResultPhaseDdosL7 AccountRulesetUpdateResponseResultPhase = "ddos_l7" + AccountRulesetUpdateResponseResultPhaseHTTPConfigSettings AccountRulesetUpdateResponseResultPhase = "http_config_settings" + AccountRulesetUpdateResponseResultPhaseHTTPCustomErrors AccountRulesetUpdateResponseResultPhase = "http_custom_errors" + AccountRulesetUpdateResponseResultPhaseHTTPLogCustomFields AccountRulesetUpdateResponseResultPhase = "http_log_custom_fields" + AccountRulesetUpdateResponseResultPhaseHTTPRatelimit AccountRulesetUpdateResponseResultPhase = "http_ratelimit" + AccountRulesetUpdateResponseResultPhaseHTTPRequestCacheSettings AccountRulesetUpdateResponseResultPhase = "http_request_cache_settings" + AccountRulesetUpdateResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetUpdateResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetUpdateResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetUpdateResponseResultPhase = "http_request_firewall_custom" + AccountRulesetUpdateResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetUpdateResponseResultPhase = "http_request_firewall_managed" + AccountRulesetUpdateResponseResultPhaseHTTPRequestLateTransform AccountRulesetUpdateResponseResultPhase = "http_request_late_transform" + AccountRulesetUpdateResponseResultPhaseHTTPRequestOrigin AccountRulesetUpdateResponseResultPhase = "http_request_origin" + AccountRulesetUpdateResponseResultPhaseHTTPRequestRedirect AccountRulesetUpdateResponseResultPhase = "http_request_redirect" + AccountRulesetUpdateResponseResultPhaseHTTPRequestSanitize AccountRulesetUpdateResponseResultPhase = "http_request_sanitize" + AccountRulesetUpdateResponseResultPhaseHTTPRequestSbfm AccountRulesetUpdateResponseResultPhase = "http_request_sbfm" + AccountRulesetUpdateResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetUpdateResponseResultPhase = "http_request_select_configuration" + AccountRulesetUpdateResponseResultPhaseHTTPRequestTransform AccountRulesetUpdateResponseResultPhase = "http_request_transform" + AccountRulesetUpdateResponseResultPhaseHTTPResponseCompression AccountRulesetUpdateResponseResultPhase = "http_response_compression" + AccountRulesetUpdateResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetUpdateResponseResultPhase = "http_response_firewall_managed" + AccountRulesetUpdateResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetUpdateResponseResultPhase = "http_response_headers_transform" + AccountRulesetUpdateResponseResultPhaseMagicTransit AccountRulesetUpdateResponseResultPhase = "magic_transit" + AccountRulesetUpdateResponseResultPhaseMagicTransitIDsManaged AccountRulesetUpdateResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetUpdateResponseResultPhaseMagicTransitManaged AccountRulesetUpdateResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetUpdateResponseSuccess bool + +const ( + AccountRulesetUpdateResponseSuccessTrue AccountRulesetUpdateResponseSuccess = true +) + +type AccountRulesetAccountRulesetsNewAnAccountRulesetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessage `json:"messages"` + Result AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetAccountRulesetsNewAnAccountRulesetResponseSuccess `json:"success"` + JSON accountRulesetAccountRulesetsNewAnAccountRulesetResponseJSON `json:"-"` +} + +// accountRulesetAccountRulesetsNewAnAccountRulesetResponseJSON contains the JSON +// metadata for the struct +// [AccountRulesetAccountRulesetsNewAnAccountRulesetResponse] +type accountRulesetAccountRulesetsNewAnAccountRulesetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsNewAnAccountRulesetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessagesSource `json:"source"` + JSON accountRulesetAccountRulesetsNewAnAccountRulesetResponseMessageJSON `json:"-"` +} + +// accountRulesetAccountRulesetsNewAnAccountRulesetResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessage] +type accountRulesetAccountRulesetsNewAnAccountRulesetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetAccountRulesetsNewAnAccountRulesetResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetAccountRulesetsNewAnAccountRulesetResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessagesSource] +type accountRulesetAccountRulesetsNewAnAccountRulesetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsNewAnAccountRulesetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetAccountRulesetsNewAnAccountRulesetResponseResultJSON `json:"-"` +} + +// accountRulesetAccountRulesetsNewAnAccountRulesetResponseResultJSON contains the +// JSON metadata for the struct +// [AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResult] +type accountRulesetAccountRulesetsNewAnAccountRulesetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKind string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKindManaged AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKind = "managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKindCustom AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKind = "custom" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKindRoot AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKind = "root" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKindZone AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseDdosL4 AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "ddos_l4" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseDdosL7 AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "ddos_l7" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPConfigSettings AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_config_settings" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPCustomErrors AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_custom_errors" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPLogCustomFields AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_log_custom_fields" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRatelimit AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_ratelimit" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestCacheSettings AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_cache_settings" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_firewall_custom" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_firewall_managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestLateTransform AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_late_transform" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestOrigin AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_origin" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestRedirect AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_redirect" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestSanitize AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_sanitize" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestSbfm AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_sbfm" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_select_configuration" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPRequestTransform AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_request_transform" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPResponseCompression AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_response_compression" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_response_firewall_managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "http_response_headers_transform" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseMagicTransit AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "magic_transit" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseMagicTransitIDsManaged AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhaseMagicTransitManaged AccountRulesetAccountRulesetsNewAnAccountRulesetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetAccountRulesetsNewAnAccountRulesetResponseSuccess bool + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetResponseSuccessTrue AccountRulesetAccountRulesetsNewAnAccountRulesetResponseSuccess = true +) + +type AccountRulesetAccountRulesetsListAccountRulesetsResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetAccountRulesetsListAccountRulesetsResponseMessage `json:"messages"` + // A list of rulesets. The returned information will not include the rules in each + // ruleset. + Result []AccountRulesetAccountRulesetsListAccountRulesetsResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetAccountRulesetsListAccountRulesetsResponseSuccess `json:"success"` + JSON accountRulesetAccountRulesetsListAccountRulesetsResponseJSON `json:"-"` +} + +// accountRulesetAccountRulesetsListAccountRulesetsResponseJSON contains the JSON +// metadata for the struct +// [AccountRulesetAccountRulesetsListAccountRulesetsResponse] +type accountRulesetAccountRulesetsListAccountRulesetsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsListAccountRulesetsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetAccountRulesetsListAccountRulesetsResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetAccountRulesetsListAccountRulesetsResponseMessagesSource `json:"source"` + JSON accountRulesetAccountRulesetsListAccountRulesetsResponseMessageJSON `json:"-"` +} + +// accountRulesetAccountRulesetsListAccountRulesetsResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountRulesetAccountRulesetsListAccountRulesetsResponseMessage] +type accountRulesetAccountRulesetsListAccountRulesetsResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsListAccountRulesetsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetAccountRulesetsListAccountRulesetsResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetAccountRulesetsListAccountRulesetsResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetAccountRulesetsListAccountRulesetsResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [AccountRulesetAccountRulesetsListAccountRulesetsResponseMessagesSource] +type accountRulesetAccountRulesetsListAccountRulesetsResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsListAccountRulesetsResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetAccountRulesetsListAccountRulesetsResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase `json:"phase"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetAccountRulesetsListAccountRulesetsResponseResultJSON `json:"-"` +} + +// accountRulesetAccountRulesetsListAccountRulesetsResponseResultJSON contains the +// JSON metadata for the struct +// [AccountRulesetAccountRulesetsListAccountRulesetsResponseResult] +type accountRulesetAccountRulesetsListAccountRulesetsResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetAccountRulesetsListAccountRulesetsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKind string + +const ( + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKindManaged AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKind = "managed" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKindCustom AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKind = "custom" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKindRoot AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKind = "root" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKindZone AccountRulesetAccountRulesetsListAccountRulesetsResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase string + +const ( + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseDdosL4 AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "ddos_l4" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseDdosL7 AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "ddos_l7" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPConfigSettings AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_config_settings" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPCustomErrors AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_custom_errors" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPLogCustomFields AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_log_custom_fields" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRatelimit AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_ratelimit" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestCacheSettings AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_cache_settings" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_firewall_custom" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_firewall_managed" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestLateTransform AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_late_transform" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestOrigin AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_origin" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestRedirect AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_redirect" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestSanitize AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_sanitize" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestSbfm AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_sbfm" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_select_configuration" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPRequestTransform AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_request_transform" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPResponseCompression AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_response_compression" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_response_firewall_managed" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "http_response_headers_transform" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseMagicTransit AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "magic_transit" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseMagicTransitIDsManaged AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhaseMagicTransitManaged AccountRulesetAccountRulesetsListAccountRulesetsResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetAccountRulesetsListAccountRulesetsResponseSuccess bool + +const ( + AccountRulesetAccountRulesetsListAccountRulesetsResponseSuccessTrue AccountRulesetAccountRulesetsListAccountRulesetsResponseSuccess = true +) + +type AccountRulesetUpdateParams struct { + ID param.Field[interface{}] `json:"id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[AccountRulesetUpdateParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[AccountRulesetUpdateParamsPhase] `json:"phase"` + // The list of rules in the ruleset. + Rules param.Field[[]AccountRulesetUpdateParamsRule] `json:"rules"` +} + +func (r AccountRulesetUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The kind of the ruleset. +type AccountRulesetUpdateParamsKind string + +const ( + AccountRulesetUpdateParamsKindManaged AccountRulesetUpdateParamsKind = "managed" + AccountRulesetUpdateParamsKindCustom AccountRulesetUpdateParamsKind = "custom" + AccountRulesetUpdateParamsKindRoot AccountRulesetUpdateParamsKind = "root" + AccountRulesetUpdateParamsKindZone AccountRulesetUpdateParamsKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetUpdateParamsPhase string + +const ( + AccountRulesetUpdateParamsPhaseDdosL4 AccountRulesetUpdateParamsPhase = "ddos_l4" + AccountRulesetUpdateParamsPhaseDdosL7 AccountRulesetUpdateParamsPhase = "ddos_l7" + AccountRulesetUpdateParamsPhaseHTTPConfigSettings AccountRulesetUpdateParamsPhase = "http_config_settings" + AccountRulesetUpdateParamsPhaseHTTPCustomErrors AccountRulesetUpdateParamsPhase = "http_custom_errors" + AccountRulesetUpdateParamsPhaseHTTPLogCustomFields AccountRulesetUpdateParamsPhase = "http_log_custom_fields" + AccountRulesetUpdateParamsPhaseHTTPRatelimit AccountRulesetUpdateParamsPhase = "http_ratelimit" + AccountRulesetUpdateParamsPhaseHTTPRequestCacheSettings AccountRulesetUpdateParamsPhase = "http_request_cache_settings" + AccountRulesetUpdateParamsPhaseHTTPRequestDynamicRedirect AccountRulesetUpdateParamsPhase = "http_request_dynamic_redirect" + AccountRulesetUpdateParamsPhaseHTTPRequestFirewallCustom AccountRulesetUpdateParamsPhase = "http_request_firewall_custom" + AccountRulesetUpdateParamsPhaseHTTPRequestFirewallManaged AccountRulesetUpdateParamsPhase = "http_request_firewall_managed" + AccountRulesetUpdateParamsPhaseHTTPRequestLateTransform AccountRulesetUpdateParamsPhase = "http_request_late_transform" + AccountRulesetUpdateParamsPhaseHTTPRequestOrigin AccountRulesetUpdateParamsPhase = "http_request_origin" + AccountRulesetUpdateParamsPhaseHTTPRequestRedirect AccountRulesetUpdateParamsPhase = "http_request_redirect" + AccountRulesetUpdateParamsPhaseHTTPRequestSanitize AccountRulesetUpdateParamsPhase = "http_request_sanitize" + AccountRulesetUpdateParamsPhaseHTTPRequestSbfm AccountRulesetUpdateParamsPhase = "http_request_sbfm" + AccountRulesetUpdateParamsPhaseHTTPRequestSelectConfiguration AccountRulesetUpdateParamsPhase = "http_request_select_configuration" + AccountRulesetUpdateParamsPhaseHTTPRequestTransform AccountRulesetUpdateParamsPhase = "http_request_transform" + AccountRulesetUpdateParamsPhaseHTTPResponseCompression AccountRulesetUpdateParamsPhase = "http_response_compression" + AccountRulesetUpdateParamsPhaseHTTPResponseFirewallManaged AccountRulesetUpdateParamsPhase = "http_response_firewall_managed" + AccountRulesetUpdateParamsPhaseHTTPResponseHeadersTransform AccountRulesetUpdateParamsPhase = "http_response_headers_transform" + AccountRulesetUpdateParamsPhaseMagicTransit AccountRulesetUpdateParamsPhase = "magic_transit" + AccountRulesetUpdateParamsPhaseMagicTransitIDsManaged AccountRulesetUpdateParamsPhase = "magic_transit_ids_managed" + AccountRulesetUpdateParamsPhaseMagicTransitManaged AccountRulesetUpdateParamsPhase = "magic_transit_managed" +) + +// Satisfied by [AccountRulesetUpdateParamsRulesOexZd8xKBlockRule], +// [AccountRulesetUpdateParamsRulesOexZd8xKExecuteRule], +// [AccountRulesetUpdateParamsRulesOexZd8xKLogRule], +// [AccountRulesetUpdateParamsRulesOexZd8xKSkipRule]. +type AccountRulesetUpdateParamsRule interface { + implementsAccountRulesetUpdateParamsRule() +} + +type AccountRulesetUpdateParamsRulesOexZd8xKBlockRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKBlockRule) implementsAccountRulesetUpdateParamsRule() { +} + +type AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleAction string + +const ( + AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleAction = "block" +) + +type AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse] `json:"response"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response to show when the block is applied. +type AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRule) implementsAccountRulesetUpdateParamsRule() { +} + +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleAction string + +const ( + AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionExecute AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleAction = "execute" +) + +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParameters struct { + ID param.Field[interface{}] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration to use for matched data logging. +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A set of overrides to apply to the target ruleset. +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverrides struct { + Action param.Field[interface{}] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory] `json:"categories"` + Enabled param.Field[interface{}] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule] `json:"rules"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A category-level override +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory struct { + Category param.Field[interface{}] `json:"category,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A rule-level override +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule struct { + ID param.Field[interface{}] `json:"id,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetUpdateParamsRulesOexZd8xKLogRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetUpdateParamsRulesOexZd8xKLogRuleAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetUpdateParamsRulesOexZd8xKLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKLogRule) implementsAccountRulesetUpdateParamsRule() {} + +type AccountRulesetUpdateParamsRulesOexZd8xKLogRuleAction string + +const ( + AccountRulesetUpdateParamsRulesOexZd8xKLogRuleActionLog AccountRulesetUpdateParamsRulesOexZd8xKLogRuleAction = "log" +) + +// An object configuring the rule's logging behavior. +type AccountRulesetUpdateParamsRulesOexZd8xKLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetUpdateParamsRulesOexZd8xKSkipRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKSkipRule) implementsAccountRulesetUpdateParamsRule() {} + +type AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleAction string + +const ( + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionSkip AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleAction = "skip" +) + +type AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]interface{}] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct] `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules param.Field[interface{}] `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset param.Field[AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRuleset] `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets param.Field[[]interface{}] `json:"rulesets"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The name of a legacy security product to skip the execution of. +type AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct string + +const ( + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductBic AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "bic" + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductHot AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "hot" + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductRateLimit AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "rateLimit" + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductSecurityLevel AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "securityLevel" + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductUaBlock AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "uaBlock" + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductWaf AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "waf" + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductZoneLockdown AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "zoneLockdown" +) + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRuleset string + +const ( + AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRulesetCurrent AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRuleset = "current" +) + +// An object configuring the rule's logging behavior. +type AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetUpdateParamsRulesOexZd8xKSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParams struct { + ID param.Field[interface{}] `json:"id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase] `json:"phase"` + // The list of rules in the ruleset. + Rules param.Field[[]AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule] `json:"rules"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The kind of the ruleset. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKind string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKindManaged AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKind = "managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKindCustom AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKind = "custom" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKindRoot AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKind = "root" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKindZone AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseDdosL4 AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "ddos_l4" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseDdosL7 AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "ddos_l7" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPConfigSettings AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_config_settings" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPCustomErrors AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_custom_errors" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPLogCustomFields AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_log_custom_fields" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRatelimit AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_ratelimit" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestCacheSettings AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_cache_settings" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestDynamicRedirect AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_dynamic_redirect" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestFirewallCustom AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_firewall_custom" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestFirewallManaged AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_firewall_managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestLateTransform AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_late_transform" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestOrigin AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_origin" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestRedirect AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_redirect" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestSanitize AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_sanitize" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestSbfm AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_sbfm" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestSelectConfiguration AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_select_configuration" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestTransform AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_request_transform" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPResponseCompression AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_response_compression" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPResponseFirewallManaged AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_response_firewall_managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPResponseHeadersTransform AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "http_response_headers_transform" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseMagicTransit AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "magic_transit" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseMagicTransitIDsManaged AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "magic_transit_ids_managed" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseMagicTransitManaged AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhase = "magic_transit_managed" +) + +// Satisfied by +// [AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule], +// [AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRule], +// [AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRule], +// [AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRule]. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule interface { + implementsAccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule() +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule) implementsAccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule() { +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleAction string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionBlock AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleAction = "block" +) + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse] `json:"response"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response to show when the block is applied. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRule) implementsAccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule() { +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleAction string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionExecute AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleAction = "execute" +) + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParameters struct { + ID param.Field[interface{}] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration to use for matched data logging. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A set of overrides to apply to the target ruleset. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides struct { + Action param.Field[interface{}] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory] `json:"categories"` + Enabled param.Field[interface{}] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule] `json:"rules"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A category-level override +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory struct { + Category param.Field[interface{}] `json:"category,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A rule-level override +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule struct { + ID param.Field[interface{}] `json:"id,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRuleAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRule) implementsAccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule() { +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRuleAction string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRuleActionLog AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRuleAction = "log" +) + +// An object configuring the rule's logging behavior. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRule) implementsAccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule() { +} + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleAction string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionSkip AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleAction = "skip" +) + +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]interface{}] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct] `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules param.Field[interface{}] `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset param.Field[AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset] `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets param.Field[[]interface{}] `json:"rulesets"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The name of a legacy security product to skip the execution of. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductBic AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "bic" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductHot AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "hot" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductRateLimit AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "rateLimit" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductSecurityLevel AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "securityLevel" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductUaBlock AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "uaBlock" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductWaf AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "waf" + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductZoneLockdown AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "zoneLockdown" +) + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset string + +const ( + AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersRulesetCurrent AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset = "current" +) + +// An object configuring the rule's logging behavior. +type AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountruleset_test.go b/accountruleset_test.go new file mode 100644 index 00000000000..aceccf68218 --- /dev/null +++ b/accountruleset_test.go @@ -0,0 +1,277 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRulesetGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Get( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + ) + 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 TestAccountRulesetUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Update( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + cloudflare.AccountRulesetUpdateParams{ + ID: cloudflare.F[any](map[string]interface{}{}), + Description: cloudflare.F("My ruleset to execute managed rulesets"), + Kind: cloudflare.F(cloudflare.AccountRulesetUpdateParamsKindRoot), + Name: cloudflare.F("My ruleset"), + Phase: cloudflare.F(cloudflare.AccountRulesetUpdateParamsPhaseHTTPRequestFirewallCustom), + Rules: cloudflare.F([]cloudflare.AccountRulesetUpdateParamsRule{cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + })}), + }, + ) + 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 TestAccountRulesetDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Rulesets.Delete( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + ) + 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 TestAccountRulesetAccountRulesetsNewAnAccountRulesetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.AccountRulesetsNewAnAccountRuleset( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParams{ + ID: cloudflare.F[any](map[string]interface{}{}), + Description: cloudflare.F("My ruleset to execute managed rulesets"), + Kind: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsKindRoot), + Name: cloudflare.F("My ruleset"), + Phase: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsPhaseHTTPRequestFirewallCustom), + Rules: cloudflare.F([]cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRule{cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + })}), + }, + ) + 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 TestAccountRulesetAccountRulesetsListAccountRulesets(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.AccountRulesetsListAccountRulesets(context.TODO(), "abf9b32d38c5f572afde3336ec0ce302") + 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/accountrulesetphase.go b/accountrulesetphase.go new file mode 100644 index 00000000000..a8717c66c07 --- /dev/null +++ b/accountrulesetphase.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRulesetPhaseService 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 [NewAccountRulesetPhaseService] +// method instead. +type AccountRulesetPhaseService struct { + Options []option.RequestOption + Entrypoints *AccountRulesetPhaseEntrypointService +} + +// NewAccountRulesetPhaseService 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 NewAccountRulesetPhaseService(opts ...option.RequestOption) (r *AccountRulesetPhaseService) { + r = &AccountRulesetPhaseService{} + r.Options = opts + r.Entrypoints = NewAccountRulesetPhaseEntrypointService(opts...) + return +} diff --git a/accountrulesetphaseentrypoint.go b/accountrulesetphaseentrypoint.go new file mode 100644 index 00000000000..836f1fcb86f --- /dev/null +++ b/accountrulesetphaseentrypoint.go @@ -0,0 +1,770 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRulesetPhaseEntrypointService 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 +// [NewAccountRulesetPhaseEntrypointService] method instead. +type AccountRulesetPhaseEntrypointService struct { + Options []option.RequestOption + Versions *AccountRulesetPhaseEntrypointVersionService +} + +// NewAccountRulesetPhaseEntrypointService 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 NewAccountRulesetPhaseEntrypointService(opts ...option.RequestOption) (r *AccountRulesetPhaseEntrypointService) { + r = &AccountRulesetPhaseEntrypointService{} + r.Options = opts + r.Versions = NewAccountRulesetPhaseEntrypointVersionService(opts...) + return +} + +// Fetches the latest version of the account entry point ruleset for a given phase. +func (r *AccountRulesetPhaseEntrypointService) AccountRulesetsGetAnAccountEntryPointRuleset(ctx context.Context, accountID string, rulesetPhase AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase, opts ...option.RequestOption) (res *AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/phases/%v/entrypoint", accountID, rulesetPhase) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an account entry point ruleset, creating a new version. +func (r *AccountRulesetPhaseEntrypointService) AccountRulesetsUpdateAnAccountEntryPointRuleset(ctx context.Context, accountID string, rulesetPhase AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase, body AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParams, opts ...option.RequestOption) (res *AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/phases/%v/entrypoint", accountID, rulesetPhase) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessage `json:"messages"` + Result AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseSuccess `json:"success"` + JSON accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponse] +type accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessagesSource `json:"source"` + JSON accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessageJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessage] +type accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessagesSource] +type accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResult] +type accountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKind string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKindManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKind = "managed" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKindCustom AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKind = "custom" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKindRoot AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKind = "root" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKindZone AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseDdosL4 AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "ddos_l4" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseDdosL7 AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "ddos_l7" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_config_settings" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRatelimit AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_origin" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_request_transform" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_response_compression" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseMagicTransit AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "magic_transit" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhaseMagicTransitManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseSuccess bool + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseSuccessTrue AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponseSuccess = true +) + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessage `json:"messages"` + Result AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseSuccess `json:"success"` + JSON accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponse] +type accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessagesSource `json:"source"` + JSON accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessageJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessage] +type accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessagesSource] +type accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResult] +type accountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKind string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKindManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKind = "managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKindCustom AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKind = "custom" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKindRoot AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKind = "root" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKindZone AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseDdosL4 AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "ddos_l4" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseDdosL7 AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "ddos_l7" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_config_settings" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRatelimit AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_origin" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_request_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_response_compression" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseMagicTransit AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "magic_transit" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhaseMagicTransitManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseSuccess bool + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseSuccessTrue AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponseSuccess = true +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseDdosL4 AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "ddos_l4" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseDdosL7 AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "ddos_l7" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_config_settings" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRatelimit AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_origin" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_transform" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_response_compression" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseMagicTransit AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "magic_transit" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseMagicTransitManaged AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase = "magic_transit_managed" +) + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParams struct { + ID param.Field[interface{}] `json:"id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase] `json:"phase"` + // The list of rules in the ruleset. + Rules param.Field[[]AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule] `json:"rules"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseDdosL4 AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "ddos_l4" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseDdosL7 AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "ddos_l7" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_config_settings" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRatelimit AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_origin" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_request_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_response_compression" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseMagicTransit AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "magic_transit" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseMagicTransitManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase = "magic_transit_managed" +) + +// The kind of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKind string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKindManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKind = "managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKindCustom AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKind = "custom" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKindRoot AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKind = "root" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKindZone AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseDdosL4 AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "ddos_l4" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseDdosL7 AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "ddos_l7" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_config_settings" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRatelimit AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_origin" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_request_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_response_compression" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseMagicTransit AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "magic_transit" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseMagicTransitManaged AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhase = "magic_transit_managed" +) + +// Satisfied by +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule], +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRule], +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRule], +// [AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRule]. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule interface { + implementsAccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule() +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule) implementsAccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule() { +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleAction string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionBlock AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleAction = "block" +) + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse] `json:"response"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response to show when the block is applied. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRule) implementsAccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule() { +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleAction string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionExecute AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleAction = "execute" +) + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParameters struct { + ID param.Field[interface{}] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration to use for matched data logging. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A set of overrides to apply to the target ruleset. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides struct { + Action param.Field[interface{}] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory] `json:"categories"` + Enabled param.Field[interface{}] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule] `json:"rules"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A category-level override +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory struct { + Category param.Field[interface{}] `json:"category,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A rule-level override +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule struct { + ID param.Field[interface{}] `json:"id,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRuleAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRule) implementsAccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule() { +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRuleAction string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRuleActionLog AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRuleAction = "log" +) + +// An object configuring the rule's logging behavior. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleAction] `json:"action"` + ActionParameters param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRule) implementsAccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule() { +} + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleAction string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionSkip AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleAction = "skip" +) + +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]interface{}] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct] `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules param.Field[interface{}] `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset param.Field[AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset] `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets param.Field[[]interface{}] `json:"rulesets"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The name of a legacy security product to skip the execution of. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductBic AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "bic" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductHot AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "hot" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductRateLimit AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "rateLimit" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductSecurityLevel AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "securityLevel" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductUaBlock AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "uaBlock" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductWaf AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "waf" + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductZoneLockdown AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "zoneLockdown" +) + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset string + +const ( + AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersRulesetCurrent AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset = "current" +) + +// An object configuring the rule's logging behavior. +type AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountrulesetphaseentrypoint_test.go b/accountrulesetphaseentrypoint_test.go new file mode 100644 index 00000000000..c528cb419c7 --- /dev/null +++ b/accountrulesetphaseentrypoint_test.go @@ -0,0 +1,133 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRuleset(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Phases.Entrypoints.AccountRulesetsGetAnAccountEntryPointRuleset( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestFirewallCustom, + ) + 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 TestAccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Phases.Entrypoints.AccountRulesetsUpdateAnAccountEntryPointRuleset( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhaseHTTPRequestFirewallCustom, + cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParams{ + ID: cloudflare.F[any](map[string]interface{}{}), + Description: cloudflare.F("My ruleset to execute managed rulesets"), + Kind: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsKindRoot), + Name: cloudflare.F("My ruleset"), + Phase: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsPhaseHTTPRequestFirewallCustom), + Rules: cloudflare.F([]cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRule{cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + })}), + }, + ) + 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/accountrulesetphaseentrypointversion.go b/accountrulesetphaseentrypointversion.go new file mode 100644 index 00000000000..01d17fead65 --- /dev/null +++ b/accountrulesetphaseentrypointversion.go @@ -0,0 +1,417 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRulesetPhaseEntrypointVersionService 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 +// [NewAccountRulesetPhaseEntrypointVersionService] method instead. +type AccountRulesetPhaseEntrypointVersionService struct { + Options []option.RequestOption +} + +// NewAccountRulesetPhaseEntrypointVersionService 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 NewAccountRulesetPhaseEntrypointVersionService(opts ...option.RequestOption) (r *AccountRulesetPhaseEntrypointVersionService) { + r = &AccountRulesetPhaseEntrypointVersionService{} + r.Options = opts + return +} + +// Fetches a specific version of an account entry point ruleset. +func (r *AccountRulesetPhaseEntrypointVersionService) Get(ctx context.Context, accountID string, rulesetPhase AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase, rulesetVersion string, opts ...option.RequestOption) (res *AccountRulesetPhaseEntrypointVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/phases/%v/entrypoint/versions/%s", accountID, rulesetPhase, rulesetVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Fetches the versions of an account entry point ruleset. +func (r *AccountRulesetPhaseEntrypointVersionService) AccountRulesetsListAnAccountEntryPointRulesetSVersions(ctx context.Context, accountID string, rulesetPhase AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase, opts ...option.RequestOption) (res *AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/phases/%v/entrypoint/versions", accountID, rulesetPhase) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountRulesetPhaseEntrypointVersionGetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetPhaseEntrypointVersionGetResponseMessage `json:"messages"` + Result AccountRulesetPhaseEntrypointVersionGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetPhaseEntrypointVersionGetResponseSuccess `json:"success"` + JSON accountRulesetPhaseEntrypointVersionGetResponseJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionGetResponseJSON contains the JSON metadata +// for the struct [AccountRulesetPhaseEntrypointVersionGetResponse] +type accountRulesetPhaseEntrypointVersionGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetPhaseEntrypointVersionGetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetPhaseEntrypointVersionGetResponseMessagesSource `json:"source"` + JSON accountRulesetPhaseEntrypointVersionGetResponseMessageJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionGetResponseMessageJSON contains the JSON +// metadata for the struct [AccountRulesetPhaseEntrypointVersionGetResponseMessage] +type accountRulesetPhaseEntrypointVersionGetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetPhaseEntrypointVersionGetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetPhaseEntrypointVersionGetResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionGetResponseMessagesSourceJSON contains the +// JSON metadata for the struct +// [AccountRulesetPhaseEntrypointVersionGetResponseMessagesSource] +type accountRulesetPhaseEntrypointVersionGetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionGetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetPhaseEntrypointVersionGetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetPhaseEntrypointVersionGetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetPhaseEntrypointVersionGetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetPhaseEntrypointVersionGetResponseResultJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionGetResponseResultJSON contains the JSON +// metadata for the struct [AccountRulesetPhaseEntrypointVersionGetResponseResult] +type accountRulesetPhaseEntrypointVersionGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetPhaseEntrypointVersionGetResponseResultKind string + +const ( + AccountRulesetPhaseEntrypointVersionGetResponseResultKindManaged AccountRulesetPhaseEntrypointVersionGetResponseResultKind = "managed" + AccountRulesetPhaseEntrypointVersionGetResponseResultKindCustom AccountRulesetPhaseEntrypointVersionGetResponseResultKind = "custom" + AccountRulesetPhaseEntrypointVersionGetResponseResultKindRoot AccountRulesetPhaseEntrypointVersionGetResponseResultKind = "root" + AccountRulesetPhaseEntrypointVersionGetResponseResultKindZone AccountRulesetPhaseEntrypointVersionGetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointVersionGetResponseResultPhase string + +const ( + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseDdosL4 AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "ddos_l4" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseDdosL7 AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "ddos_l7" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_config_settings" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRatelimit AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_origin" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_transform" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_response_compression" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseMagicTransit AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "magic_transit" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointVersionGetResponseResultPhaseMagicTransitManaged AccountRulesetPhaseEntrypointVersionGetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetPhaseEntrypointVersionGetResponseSuccess bool + +const ( + AccountRulesetPhaseEntrypointVersionGetResponseSuccessTrue AccountRulesetPhaseEntrypointVersionGetResponseSuccess = true +) + +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessage `json:"messages"` + // A list of rulesets. The returned information will not include the rules in each + // ruleset. + Result []AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseSuccess `json:"success"` + JSON accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponse] +type accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessagesSource `json:"source"` + JSON accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessageJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessage] +type accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessagesSource] +type accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase `json:"phase"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultJSON `json:"-"` +} + +// accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResult] +type accountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKind string + +const ( + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKindManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKind = "managed" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKindCustom AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKind = "custom" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKindRoot AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKind = "root" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKindZone AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase string + +const ( + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseDdosL4 AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "ddos_l4" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseDdosL7 AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "ddos_l7" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_config_settings" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRatelimit AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_origin" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_request_transform" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_response_compression" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseMagicTransit AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "magic_transit" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhaseMagicTransitManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseSuccess bool + +const ( + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseSuccessTrue AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponseSuccess = true +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase string + +const ( + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseDdosL4 AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "ddos_l4" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseDdosL7 AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "ddos_l7" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_config_settings" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRatelimit AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_origin" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_transform" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_response_compression" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseMagicTransit AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "magic_transit" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseMagicTransitManaged AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "magic_transit_managed" +) + +// The phase of the ruleset. +type AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase string + +const ( + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseDdosL4 AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "ddos_l4" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseDdosL7 AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "ddos_l7" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPConfigSettings AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_config_settings" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPCustomErrors AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_custom_errors" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPLogCustomFields AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_log_custom_fields" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRatelimit AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_ratelimit" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestCacheSettings AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_cache_settings" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestDynamicRedirect AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_dynamic_redirect" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestFirewallCustom AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_firewall_custom" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestFirewallManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_firewall_managed" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestLateTransform AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_late_transform" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestOrigin AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_origin" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestRedirect AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_redirect" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestSanitize AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_sanitize" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestSbfm AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_sbfm" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestSelectConfiguration AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_select_configuration" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestTransform AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_transform" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPResponseCompression AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_response_compression" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPResponseFirewallManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_response_firewall_managed" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPResponseHeadersTransform AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "http_response_headers_transform" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseMagicTransit AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "magic_transit" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseMagicTransitIDsManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "magic_transit_ids_managed" + AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseMagicTransitManaged AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase = "magic_transit_managed" +) diff --git a/accountrulesetphaseentrypointversion_test.go b/accountrulesetphaseentrypointversion_test.go new file mode 100644 index 00000000000..28eb5fd90f6 --- /dev/null +++ b/accountrulesetphaseentrypointversion_test.go @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRulesetPhaseEntrypointVersionGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Phases.Entrypoints.Versions.Get( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + cloudflare.AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestFirewallCustom, + "1", + ) + 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 TestAccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersions(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Phases.Entrypoints.Versions.AccountRulesetsListAnAccountEntryPointRulesetSVersions( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + cloudflare.AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestFirewallCustom, + ) + 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/accountrulesetrule.go b/accountrulesetrule.go new file mode 100644 index 00000000000..a5c8db67b97 --- /dev/null +++ b/accountrulesetrule.go @@ -0,0 +1,578 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRulesetRuleService 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 [NewAccountRulesetRuleService] method +// instead. +type AccountRulesetRuleService struct { + Options []option.RequestOption +} + +// NewAccountRulesetRuleService 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 NewAccountRulesetRuleService(opts ...option.RequestOption) (r *AccountRulesetRuleService) { + r = &AccountRulesetRuleService{} + r.Options = opts + return +} + +// Updates an existing rule in an account ruleset. +func (r *AccountRulesetRuleService) Update(ctx context.Context, accountID string, rulesetID string, ruleID string, body AccountRulesetRuleUpdateParams, opts ...option.RequestOption) (res *AccountRulesetRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s/rules/%s", accountID, rulesetID, ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes an existing rule from an account ruleset. +func (r *AccountRulesetRuleService) Delete(ctx context.Context, accountID string, rulesetID string, ruleID string, opts ...option.RequestOption) (res *AccountRulesetRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s/rules/%s", accountID, rulesetID, ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds a new rule to an account ruleset. The rule will be added to the end of the +// existing list of rules in the ruleset by default. +func (r *AccountRulesetRuleService) AccountRulesetsNewAnAccountRulesetRule(ctx context.Context, accountID string, rulesetID string, body AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParams, opts ...option.RequestOption) (res *AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s/rules", accountID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountRulesetRuleUpdateResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetRuleUpdateResponseMessage `json:"messages"` + Result AccountRulesetRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetRuleUpdateResponseSuccess `json:"success"` + JSON accountRulesetRuleUpdateResponseJSON `json:"-"` +} + +// accountRulesetRuleUpdateResponseJSON contains the JSON metadata for the struct +// [AccountRulesetRuleUpdateResponse] +type accountRulesetRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetRuleUpdateResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetRuleUpdateResponseMessagesSource `json:"source"` + JSON accountRulesetRuleUpdateResponseMessageJSON `json:"-"` +} + +// accountRulesetRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountRulesetRuleUpdateResponseMessage] +type accountRulesetRuleUpdateResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetRuleUpdateResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetRuleUpdateResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetRuleUpdateResponseMessagesSourceJSON contains the JSON metadata +// for the struct [AccountRulesetRuleUpdateResponseMessagesSource] +type accountRulesetRuleUpdateResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleUpdateResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetRuleUpdateResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetRuleUpdateResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetRuleUpdateResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetRuleUpdateResponseResultJSON `json:"-"` +} + +// accountRulesetRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountRulesetRuleUpdateResponseResult] +type accountRulesetRuleUpdateResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetRuleUpdateResponseResultKind string + +const ( + AccountRulesetRuleUpdateResponseResultKindManaged AccountRulesetRuleUpdateResponseResultKind = "managed" + AccountRulesetRuleUpdateResponseResultKindCustom AccountRulesetRuleUpdateResponseResultKind = "custom" + AccountRulesetRuleUpdateResponseResultKindRoot AccountRulesetRuleUpdateResponseResultKind = "root" + AccountRulesetRuleUpdateResponseResultKindZone AccountRulesetRuleUpdateResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetRuleUpdateResponseResultPhase string + +const ( + AccountRulesetRuleUpdateResponseResultPhaseDdosL4 AccountRulesetRuleUpdateResponseResultPhase = "ddos_l4" + AccountRulesetRuleUpdateResponseResultPhaseDdosL7 AccountRulesetRuleUpdateResponseResultPhase = "ddos_l7" + AccountRulesetRuleUpdateResponseResultPhaseHTTPConfigSettings AccountRulesetRuleUpdateResponseResultPhase = "http_config_settings" + AccountRulesetRuleUpdateResponseResultPhaseHTTPCustomErrors AccountRulesetRuleUpdateResponseResultPhase = "http_custom_errors" + AccountRulesetRuleUpdateResponseResultPhaseHTTPLogCustomFields AccountRulesetRuleUpdateResponseResultPhase = "http_log_custom_fields" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRatelimit AccountRulesetRuleUpdateResponseResultPhase = "http_ratelimit" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestCacheSettings AccountRulesetRuleUpdateResponseResultPhase = "http_request_cache_settings" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetRuleUpdateResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetRuleUpdateResponseResultPhase = "http_request_firewall_custom" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetRuleUpdateResponseResultPhase = "http_request_firewall_managed" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestLateTransform AccountRulesetRuleUpdateResponseResultPhase = "http_request_late_transform" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestOrigin AccountRulesetRuleUpdateResponseResultPhase = "http_request_origin" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestRedirect AccountRulesetRuleUpdateResponseResultPhase = "http_request_redirect" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestSanitize AccountRulesetRuleUpdateResponseResultPhase = "http_request_sanitize" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestSbfm AccountRulesetRuleUpdateResponseResultPhase = "http_request_sbfm" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetRuleUpdateResponseResultPhase = "http_request_select_configuration" + AccountRulesetRuleUpdateResponseResultPhaseHTTPRequestTransform AccountRulesetRuleUpdateResponseResultPhase = "http_request_transform" + AccountRulesetRuleUpdateResponseResultPhaseHTTPResponseCompression AccountRulesetRuleUpdateResponseResultPhase = "http_response_compression" + AccountRulesetRuleUpdateResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetRuleUpdateResponseResultPhase = "http_response_firewall_managed" + AccountRulesetRuleUpdateResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetRuleUpdateResponseResultPhase = "http_response_headers_transform" + AccountRulesetRuleUpdateResponseResultPhaseMagicTransit AccountRulesetRuleUpdateResponseResultPhase = "magic_transit" + AccountRulesetRuleUpdateResponseResultPhaseMagicTransitIDsManaged AccountRulesetRuleUpdateResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetRuleUpdateResponseResultPhaseMagicTransitManaged AccountRulesetRuleUpdateResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetRuleUpdateResponseSuccess bool + +const ( + AccountRulesetRuleUpdateResponseSuccessTrue AccountRulesetRuleUpdateResponseSuccess = true +) + +type AccountRulesetRuleDeleteResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetRuleDeleteResponseMessage `json:"messages"` + Result AccountRulesetRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetRuleDeleteResponseSuccess `json:"success"` + JSON accountRulesetRuleDeleteResponseJSON `json:"-"` +} + +// accountRulesetRuleDeleteResponseJSON contains the JSON metadata for the struct +// [AccountRulesetRuleDeleteResponse] +type accountRulesetRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetRuleDeleteResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetRuleDeleteResponseMessagesSource `json:"source"` + JSON accountRulesetRuleDeleteResponseMessageJSON `json:"-"` +} + +// accountRulesetRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountRulesetRuleDeleteResponseMessage] +type accountRulesetRuleDeleteResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetRuleDeleteResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetRuleDeleteResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetRuleDeleteResponseMessagesSourceJSON contains the JSON metadata +// for the struct [AccountRulesetRuleDeleteResponseMessagesSource] +type accountRulesetRuleDeleteResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleDeleteResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetRuleDeleteResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetRuleDeleteResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetRuleDeleteResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetRuleDeleteResponseResultJSON `json:"-"` +} + +// accountRulesetRuleDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountRulesetRuleDeleteResponseResult] +type accountRulesetRuleDeleteResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetRuleDeleteResponseResultKind string + +const ( + AccountRulesetRuleDeleteResponseResultKindManaged AccountRulesetRuleDeleteResponseResultKind = "managed" + AccountRulesetRuleDeleteResponseResultKindCustom AccountRulesetRuleDeleteResponseResultKind = "custom" + AccountRulesetRuleDeleteResponseResultKindRoot AccountRulesetRuleDeleteResponseResultKind = "root" + AccountRulesetRuleDeleteResponseResultKindZone AccountRulesetRuleDeleteResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetRuleDeleteResponseResultPhase string + +const ( + AccountRulesetRuleDeleteResponseResultPhaseDdosL4 AccountRulesetRuleDeleteResponseResultPhase = "ddos_l4" + AccountRulesetRuleDeleteResponseResultPhaseDdosL7 AccountRulesetRuleDeleteResponseResultPhase = "ddos_l7" + AccountRulesetRuleDeleteResponseResultPhaseHTTPConfigSettings AccountRulesetRuleDeleteResponseResultPhase = "http_config_settings" + AccountRulesetRuleDeleteResponseResultPhaseHTTPCustomErrors AccountRulesetRuleDeleteResponseResultPhase = "http_custom_errors" + AccountRulesetRuleDeleteResponseResultPhaseHTTPLogCustomFields AccountRulesetRuleDeleteResponseResultPhase = "http_log_custom_fields" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRatelimit AccountRulesetRuleDeleteResponseResultPhase = "http_ratelimit" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestCacheSettings AccountRulesetRuleDeleteResponseResultPhase = "http_request_cache_settings" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetRuleDeleteResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetRuleDeleteResponseResultPhase = "http_request_firewall_custom" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetRuleDeleteResponseResultPhase = "http_request_firewall_managed" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestLateTransform AccountRulesetRuleDeleteResponseResultPhase = "http_request_late_transform" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestOrigin AccountRulesetRuleDeleteResponseResultPhase = "http_request_origin" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestRedirect AccountRulesetRuleDeleteResponseResultPhase = "http_request_redirect" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestSanitize AccountRulesetRuleDeleteResponseResultPhase = "http_request_sanitize" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestSbfm AccountRulesetRuleDeleteResponseResultPhase = "http_request_sbfm" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetRuleDeleteResponseResultPhase = "http_request_select_configuration" + AccountRulesetRuleDeleteResponseResultPhaseHTTPRequestTransform AccountRulesetRuleDeleteResponseResultPhase = "http_request_transform" + AccountRulesetRuleDeleteResponseResultPhaseHTTPResponseCompression AccountRulesetRuleDeleteResponseResultPhase = "http_response_compression" + AccountRulesetRuleDeleteResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetRuleDeleteResponseResultPhase = "http_response_firewall_managed" + AccountRulesetRuleDeleteResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetRuleDeleteResponseResultPhase = "http_response_headers_transform" + AccountRulesetRuleDeleteResponseResultPhaseMagicTransit AccountRulesetRuleDeleteResponseResultPhase = "magic_transit" + AccountRulesetRuleDeleteResponseResultPhaseMagicTransitIDsManaged AccountRulesetRuleDeleteResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetRuleDeleteResponseResultPhaseMagicTransitManaged AccountRulesetRuleDeleteResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetRuleDeleteResponseSuccess bool + +const ( + AccountRulesetRuleDeleteResponseSuccessTrue AccountRulesetRuleDeleteResponseSuccess = true +) + +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessage `json:"messages"` + Result AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseSuccess `json:"success"` + JSON accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseJSON `json:"-"` +} + +// accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseJSON contains +// the JSON metadata for the struct +// [AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponse] +type accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessagesSource `json:"source"` + JSON accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessageJSON `json:"-"` +} + +// accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessage] +type accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessagesSource] +type accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultJSON `json:"-"` +} + +// accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultJSON +// contains the JSON metadata for the struct +// [AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResult] +type accountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKind string + +const ( + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKindManaged AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKind = "managed" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKindCustom AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKind = "custom" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKindRoot AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKind = "root" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKindZone AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase string + +const ( + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseDdosL4 AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "ddos_l4" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseDdosL7 AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "ddos_l7" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPConfigSettings AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_config_settings" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPCustomErrors AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_custom_errors" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPLogCustomFields AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_log_custom_fields" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRatelimit AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_ratelimit" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestCacheSettings AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_cache_settings" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_firewall_custom" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_firewall_managed" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestLateTransform AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_late_transform" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestOrigin AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_origin" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestRedirect AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_redirect" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestSanitize AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_sanitize" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestSbfm AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_sbfm" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_select_configuration" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPRequestTransform AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_request_transform" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPResponseCompression AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_response_compression" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_response_firewall_managed" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "http_response_headers_transform" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseMagicTransit AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "magic_transit" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseMagicTransitIDsManaged AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhaseMagicTransitManaged AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseSuccess bool + +const ( + AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseSuccessTrue AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponseSuccess = true +) + +type AccountRulesetRuleUpdateParams struct { + Position param.Field[AccountRulesetRuleUpdateParamsPosition] `json:"position"` +} + +func (r AccountRulesetRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Satisfied by [AccountRulesetRuleUpdateParamsPositionObject], +// [AccountRulesetRuleUpdateParamsPositionObject], +// [AccountRulesetRuleUpdateParamsPositionObject]. +type AccountRulesetRuleUpdateParamsPosition interface { + implementsAccountRulesetRuleUpdateParamsPosition() +} + +type AccountRulesetRuleUpdateParamsPositionObject struct { + // The ID of another rule to place the rule before. An empty value causes the rule + // to be placed at the top. + Before param.Field[string] `json:"before"` +} + +func (r AccountRulesetRuleUpdateParamsPositionObject) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetRuleUpdateParamsPositionObject) implementsAccountRulesetRuleUpdateParamsPosition() { +} + +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParams struct { + Position param.Field[AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPosition] `json:"position"` +} + +func (r AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Satisfied by +// [AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject], +// [AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject], +// [AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject]. +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPosition interface { + implementsAccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPosition() +} + +type AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject struct { + // The ID of another rule to place the rule before. An empty value causes the rule + // to be placed at the top. + Before param.Field[string] `json:"before"` +} + +func (r AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject) implementsAccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPosition() { +} diff --git a/accountrulesetrule_test.go b/accountrulesetrule_test.go new file mode 100644 index 00000000000..e04601da4b6 --- /dev/null +++ b/accountrulesetrule_test.go @@ -0,0 +1,116 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRulesetRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Rules.Update( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + "3a03d665bac047339bb530ecb439a90d", + cloudflare.AccountRulesetRuleUpdateParams{ + Position: cloudflare.F[cloudflare.AccountRulesetRuleUpdateParamsPosition](cloudflare.AccountRulesetRuleUpdateParamsPositionObject(cloudflare.AccountRulesetRuleUpdateParamsPositionObject{ + Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), + })), + }, + ) + 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 TestAccountRulesetRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Rules.Delete( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + "3a03d665bac047339bb530ecb439a90d", + ) + 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 TestAccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Rules.AccountRulesetsNewAnAccountRulesetRule( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + cloudflare.AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParams{ + Position: cloudflare.F[cloudflare.AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPosition](cloudflare.AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject(cloudflare.AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParamsPositionObject{ + Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), + })), + }, + ) + 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/accountrulesetversion.go b/accountrulesetversion.go new file mode 100644 index 00000000000..8977b6b9408 --- /dev/null +++ b/accountrulesetversion.go @@ -0,0 +1,368 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRulesetVersionService 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 [NewAccountRulesetVersionService] +// method instead. +type AccountRulesetVersionService struct { + Options []option.RequestOption + ByTags *AccountRulesetVersionByTagService +} + +// NewAccountRulesetVersionService 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 NewAccountRulesetVersionService(opts ...option.RequestOption) (r *AccountRulesetVersionService) { + r = &AccountRulesetVersionService{} + r.Options = opts + r.ByTags = NewAccountRulesetVersionByTagService(opts...) + return +} + +// Fetches a specific version of an account ruleset. +func (r *AccountRulesetVersionService) Get(ctx context.Context, accountID string, rulesetID string, rulesetVersion string, opts ...option.RequestOption) (res *AccountRulesetVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s/versions/%s", accountID, rulesetID, rulesetVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an existing version of an account ruleset. +func (r *AccountRulesetVersionService) Delete(ctx context.Context, accountID string, rulesetID string, rulesetVersion string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s/versions/%s", accountID, rulesetID, rulesetVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Fetches the versions of an account ruleset. +func (r *AccountRulesetVersionService) AccountRulesetsListAnAccountRulesetSVersions(ctx context.Context, accountID string, rulesetID string, opts ...option.RequestOption) (res *AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s/versions", accountID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountRulesetVersionGetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetVersionGetResponseMessage `json:"messages"` + Result AccountRulesetVersionGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetVersionGetResponseSuccess `json:"success"` + JSON accountRulesetVersionGetResponseJSON `json:"-"` +} + +// accountRulesetVersionGetResponseJSON contains the JSON metadata for the struct +// [AccountRulesetVersionGetResponse] +type accountRulesetVersionGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetVersionGetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetVersionGetResponseMessagesSource `json:"source"` + JSON accountRulesetVersionGetResponseMessageJSON `json:"-"` +} + +// accountRulesetVersionGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountRulesetVersionGetResponseMessage] +type accountRulesetVersionGetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetVersionGetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetVersionGetResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetVersionGetResponseMessagesSourceJSON contains the JSON metadata +// for the struct [AccountRulesetVersionGetResponseMessagesSource] +type accountRulesetVersionGetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionGetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetVersionGetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetVersionGetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetVersionGetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetVersionGetResponseResultJSON `json:"-"` +} + +// accountRulesetVersionGetResponseResultJSON contains the JSON metadata for the +// struct [AccountRulesetVersionGetResponseResult] +type accountRulesetVersionGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetVersionGetResponseResultKind string + +const ( + AccountRulesetVersionGetResponseResultKindManaged AccountRulesetVersionGetResponseResultKind = "managed" + AccountRulesetVersionGetResponseResultKindCustom AccountRulesetVersionGetResponseResultKind = "custom" + AccountRulesetVersionGetResponseResultKindRoot AccountRulesetVersionGetResponseResultKind = "root" + AccountRulesetVersionGetResponseResultKindZone AccountRulesetVersionGetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetVersionGetResponseResultPhase string + +const ( + AccountRulesetVersionGetResponseResultPhaseDdosL4 AccountRulesetVersionGetResponseResultPhase = "ddos_l4" + AccountRulesetVersionGetResponseResultPhaseDdosL7 AccountRulesetVersionGetResponseResultPhase = "ddos_l7" + AccountRulesetVersionGetResponseResultPhaseHTTPConfigSettings AccountRulesetVersionGetResponseResultPhase = "http_config_settings" + AccountRulesetVersionGetResponseResultPhaseHTTPCustomErrors AccountRulesetVersionGetResponseResultPhase = "http_custom_errors" + AccountRulesetVersionGetResponseResultPhaseHTTPLogCustomFields AccountRulesetVersionGetResponseResultPhase = "http_log_custom_fields" + AccountRulesetVersionGetResponseResultPhaseHTTPRatelimit AccountRulesetVersionGetResponseResultPhase = "http_ratelimit" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestCacheSettings AccountRulesetVersionGetResponseResultPhase = "http_request_cache_settings" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetVersionGetResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetVersionGetResponseResultPhase = "http_request_firewall_custom" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetVersionGetResponseResultPhase = "http_request_firewall_managed" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestLateTransform AccountRulesetVersionGetResponseResultPhase = "http_request_late_transform" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestOrigin AccountRulesetVersionGetResponseResultPhase = "http_request_origin" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestRedirect AccountRulesetVersionGetResponseResultPhase = "http_request_redirect" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestSanitize AccountRulesetVersionGetResponseResultPhase = "http_request_sanitize" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestSbfm AccountRulesetVersionGetResponseResultPhase = "http_request_sbfm" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetVersionGetResponseResultPhase = "http_request_select_configuration" + AccountRulesetVersionGetResponseResultPhaseHTTPRequestTransform AccountRulesetVersionGetResponseResultPhase = "http_request_transform" + AccountRulesetVersionGetResponseResultPhaseHTTPResponseCompression AccountRulesetVersionGetResponseResultPhase = "http_response_compression" + AccountRulesetVersionGetResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetVersionGetResponseResultPhase = "http_response_firewall_managed" + AccountRulesetVersionGetResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetVersionGetResponseResultPhase = "http_response_headers_transform" + AccountRulesetVersionGetResponseResultPhaseMagicTransit AccountRulesetVersionGetResponseResultPhase = "magic_transit" + AccountRulesetVersionGetResponseResultPhaseMagicTransitIDsManaged AccountRulesetVersionGetResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetVersionGetResponseResultPhaseMagicTransitManaged AccountRulesetVersionGetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetVersionGetResponseSuccess bool + +const ( + AccountRulesetVersionGetResponseSuccessTrue AccountRulesetVersionGetResponseSuccess = true +) + +type AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessage `json:"messages"` + // A list of rulesets. The returned information will not include the rules in each + // ruleset. + Result []AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseSuccess `json:"success"` + JSON accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseJSON `json:"-"` +} + +// accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseJSON +// contains the JSON metadata for the struct +// [AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponse] +type accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessagesSource `json:"source"` + JSON accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessageJSON `json:"-"` +} + +// accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessage] +type accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessagesSource] +type accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase `json:"phase"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultJSON `json:"-"` +} + +// accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResult] +type accountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKind string + +const ( + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKindManaged AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKind = "managed" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKindCustom AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKind = "custom" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKindRoot AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKind = "root" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKindZone AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase string + +const ( + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseDdosL4 AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "ddos_l4" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseDdosL7 AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "ddos_l7" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPConfigSettings AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_config_settings" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPCustomErrors AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_custom_errors" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPLogCustomFields AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_log_custom_fields" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRatelimit AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_ratelimit" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestCacheSettings AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_cache_settings" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_firewall_custom" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_firewall_managed" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestLateTransform AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_late_transform" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestOrigin AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_origin" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestRedirect AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_redirect" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestSanitize AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_sanitize" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestSbfm AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_sbfm" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_select_configuration" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPRequestTransform AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_request_transform" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPResponseCompression AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_response_compression" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_response_firewall_managed" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "http_response_headers_transform" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseMagicTransit AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "magic_transit" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseMagicTransitIDsManaged AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhaseMagicTransitManaged AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseSuccess bool + +const ( + AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseSuccessTrue AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponseSuccess = true +) diff --git a/accountrulesetversion_test.go b/accountrulesetversion_test.go new file mode 100644 index 00000000000..7367f3b4b95 --- /dev/null +++ b/accountrulesetversion_test.go @@ -0,0 +1,106 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRulesetVersionGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Versions.Get( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + "1", + ) + 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 TestAccountRulesetVersionDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Rulesets.Versions.Delete( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + "1", + ) + 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 TestAccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersions(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Versions.AccountRulesetsListAnAccountRulesetSVersions( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + ) + 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/accountrulesetversionbytag.go b/accountrulesetversionbytag.go new file mode 100644 index 00000000000..e88b00032ef --- /dev/null +++ b/accountrulesetversionbytag.go @@ -0,0 +1,193 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRulesetVersionByTagService 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 +// [NewAccountRulesetVersionByTagService] method instead. +type AccountRulesetVersionByTagService struct { + Options []option.RequestOption +} + +// NewAccountRulesetVersionByTagService 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 NewAccountRulesetVersionByTagService(opts ...option.RequestOption) (r *AccountRulesetVersionByTagService) { + r = &AccountRulesetVersionByTagService{} + r.Options = opts + return +} + +// Fetches the rules of a managed account ruleset version for a given tag. +func (r *AccountRulesetVersionByTagService) Get(ctx context.Context, accountID string, rulesetID string, rulesetVersion string, ruleTag string, opts ...option.RequestOption) (res *AccountRulesetVersionByTagGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rulesets/%s/versions/%s/by_tag/%s", accountID, rulesetID, rulesetVersion, ruleTag) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountRulesetVersionByTagGetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []AccountRulesetVersionByTagGetResponseMessage `json:"messages"` + Result AccountRulesetVersionByTagGetResponseResult `json:"result"` + // Whether the API call was successful. + Success AccountRulesetVersionByTagGetResponseSuccess `json:"success"` + JSON accountRulesetVersionByTagGetResponseJSON `json:"-"` +} + +// accountRulesetVersionByTagGetResponseJSON contains the JSON metadata for the +// struct [AccountRulesetVersionByTagGetResponse] +type accountRulesetVersionByTagGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionByTagGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type AccountRulesetVersionByTagGetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source AccountRulesetVersionByTagGetResponseMessagesSource `json:"source"` + JSON accountRulesetVersionByTagGetResponseMessageJSON `json:"-"` +} + +// accountRulesetVersionByTagGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountRulesetVersionByTagGetResponseMessage] +type accountRulesetVersionByTagGetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionByTagGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type AccountRulesetVersionByTagGetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON accountRulesetVersionByTagGetResponseMessagesSourceJSON `json:"-"` +} + +// accountRulesetVersionByTagGetResponseMessagesSourceJSON contains the JSON +// metadata for the struct [AccountRulesetVersionByTagGetResponseMessagesSource] +type accountRulesetVersionByTagGetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionByTagGetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRulesetVersionByTagGetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind AccountRulesetVersionByTagGetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase AccountRulesetVersionByTagGetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON accountRulesetVersionByTagGetResponseResultJSON `json:"-"` +} + +// accountRulesetVersionByTagGetResponseResultJSON contains the JSON metadata for +// the struct [AccountRulesetVersionByTagGetResponseResult] +type accountRulesetVersionByTagGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRulesetVersionByTagGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type AccountRulesetVersionByTagGetResponseResultKind string + +const ( + AccountRulesetVersionByTagGetResponseResultKindManaged AccountRulesetVersionByTagGetResponseResultKind = "managed" + AccountRulesetVersionByTagGetResponseResultKindCustom AccountRulesetVersionByTagGetResponseResultKind = "custom" + AccountRulesetVersionByTagGetResponseResultKindRoot AccountRulesetVersionByTagGetResponseResultKind = "root" + AccountRulesetVersionByTagGetResponseResultKindZone AccountRulesetVersionByTagGetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type AccountRulesetVersionByTagGetResponseResultPhase string + +const ( + AccountRulesetVersionByTagGetResponseResultPhaseDdosL4 AccountRulesetVersionByTagGetResponseResultPhase = "ddos_l4" + AccountRulesetVersionByTagGetResponseResultPhaseDdosL7 AccountRulesetVersionByTagGetResponseResultPhase = "ddos_l7" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPConfigSettings AccountRulesetVersionByTagGetResponseResultPhase = "http_config_settings" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPCustomErrors AccountRulesetVersionByTagGetResponseResultPhase = "http_custom_errors" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPLogCustomFields AccountRulesetVersionByTagGetResponseResultPhase = "http_log_custom_fields" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRatelimit AccountRulesetVersionByTagGetResponseResultPhase = "http_ratelimit" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestCacheSettings AccountRulesetVersionByTagGetResponseResultPhase = "http_request_cache_settings" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestDynamicRedirect AccountRulesetVersionByTagGetResponseResultPhase = "http_request_dynamic_redirect" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestFirewallCustom AccountRulesetVersionByTagGetResponseResultPhase = "http_request_firewall_custom" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestFirewallManaged AccountRulesetVersionByTagGetResponseResultPhase = "http_request_firewall_managed" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestLateTransform AccountRulesetVersionByTagGetResponseResultPhase = "http_request_late_transform" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestOrigin AccountRulesetVersionByTagGetResponseResultPhase = "http_request_origin" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestRedirect AccountRulesetVersionByTagGetResponseResultPhase = "http_request_redirect" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestSanitize AccountRulesetVersionByTagGetResponseResultPhase = "http_request_sanitize" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestSbfm AccountRulesetVersionByTagGetResponseResultPhase = "http_request_sbfm" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestSelectConfiguration AccountRulesetVersionByTagGetResponseResultPhase = "http_request_select_configuration" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPRequestTransform AccountRulesetVersionByTagGetResponseResultPhase = "http_request_transform" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPResponseCompression AccountRulesetVersionByTagGetResponseResultPhase = "http_response_compression" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPResponseFirewallManaged AccountRulesetVersionByTagGetResponseResultPhase = "http_response_firewall_managed" + AccountRulesetVersionByTagGetResponseResultPhaseHTTPResponseHeadersTransform AccountRulesetVersionByTagGetResponseResultPhase = "http_response_headers_transform" + AccountRulesetVersionByTagGetResponseResultPhaseMagicTransit AccountRulesetVersionByTagGetResponseResultPhase = "magic_transit" + AccountRulesetVersionByTagGetResponseResultPhaseMagicTransitIDsManaged AccountRulesetVersionByTagGetResponseResultPhase = "magic_transit_ids_managed" + AccountRulesetVersionByTagGetResponseResultPhaseMagicTransitManaged AccountRulesetVersionByTagGetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type AccountRulesetVersionByTagGetResponseSuccess bool + +const ( + AccountRulesetVersionByTagGetResponseSuccessTrue AccountRulesetVersionByTagGetResponseSuccess = true +) diff --git a/accountrulesetversionbytag_test.go b/accountrulesetversionbytag_test.go new file mode 100644 index 00000000000..fc409871dd5 --- /dev/null +++ b/accountrulesetversionbytag_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRulesetVersionByTagGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rulesets.Versions.ByTags.Get( + context.TODO(), + "abf9b32d38c5f572afde3336ec0ce302", + "2f2feab2026849078ba485f918791bdc", + "1", + "directory-traversal", + ) + 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/accountrum.go b/accountrum.go new file mode 100644 index 00000000000..841c9f84fb9 --- /dev/null +++ b/accountrum.go @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRumService 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 [NewAccountRumService] method instead. +type AccountRumService struct { + Options []option.RequestOption + SiteInfo *AccountRumSiteInfoService + V2 *AccountRumV2Service +} + +// NewAccountRumService 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 NewAccountRumService(opts ...option.RequestOption) (r *AccountRumService) { + r = &AccountRumService{} + r.Options = opts + r.SiteInfo = NewAccountRumSiteInfoService(opts...) + r.V2 = NewAccountRumV2Service(opts...) + return +} diff --git a/accountrumsiteinfo.go b/accountrumsiteinfo.go new file mode 100644 index 00000000000..6c34dbc205d --- /dev/null +++ b/accountrumsiteinfo.go @@ -0,0 +1,212 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRumSiteInfoService 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 [NewAccountRumSiteInfoService] method +// instead. +type AccountRumSiteInfoService struct { + Options []option.RequestOption +} + +// NewAccountRumSiteInfoService 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 NewAccountRumSiteInfoService(opts ...option.RequestOption) (r *AccountRumSiteInfoService) { + r = &AccountRumSiteInfoService{} + r.Options = opts + return +} + +// Creates a new Web Analytics site. +func (r *AccountRumSiteInfoService) New(ctx context.Context, accountIdentifier string, body AccountRumSiteInfoNewParams, opts ...option.RequestOption) (res *AccountRumSiteInfoNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/site_info", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountRumSiteInfoNewResponse struct { + Errors []AccountRumSiteInfoNewResponseError `json:"errors"` + Messages []AccountRumSiteInfoNewResponseMessage `json:"messages"` + Result AccountRumSiteInfoNewResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON accountRumSiteInfoNewResponseJSON `json:"-"` +} + +// accountRumSiteInfoNewResponseJSON contains the JSON metadata for the struct +// [AccountRumSiteInfoNewResponse] +type accountRumSiteInfoNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRumSiteInfoNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRumSiteInfoNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRumSiteInfoNewResponseErrorJSON `json:"-"` +} + +// accountRumSiteInfoNewResponseErrorJSON contains the JSON metadata for the struct +// [AccountRumSiteInfoNewResponseError] +type accountRumSiteInfoNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRumSiteInfoNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRumSiteInfoNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountRumSiteInfoNewResponseMessageJSON `json:"-"` +} + +// accountRumSiteInfoNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountRumSiteInfoNewResponseMessage] +type accountRumSiteInfoNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRumSiteInfoNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRumSiteInfoNewResponseResult struct { + // If enabled, the JavaScript snippet is automatically injected for orange-clouded + // sites. + AutoInstall bool `json:"auto_install"` + Created time.Time `json:"created" format:"date-time"` + // A list of rules. + Rules []AccountRumSiteInfoNewResponseResultRule `json:"rules"` + Ruleset AccountRumSiteInfoNewResponseResultRuleset `json:"ruleset"` + // The Web Analytics site identifier. + SiteTag string `json:"site_tag"` + // The Web Analytics site token. + SiteToken string `json:"site_token"` + // Encoded JavaScript snippet. + Snippet string `json:"snippet"` + JSON accountRumSiteInfoNewResponseResultJSON `json:"-"` +} + +// accountRumSiteInfoNewResponseResultJSON contains the JSON metadata for the +// struct [AccountRumSiteInfoNewResponseResult] +type accountRumSiteInfoNewResponseResultJSON struct { + AutoInstall apijson.Field + Created apijson.Field + Rules apijson.Field + Ruleset apijson.Field + SiteTag apijson.Field + SiteToken apijson.Field + Snippet apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRumSiteInfoNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRumSiteInfoNewResponseResultRule struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + Created time.Time `json:"created" format:"date-time"` + // The hostname the rule will be applied to. + Host string `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive bool `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused bool `json:"is_paused"` + // The paths the rule will be applied to. + Paths []string `json:"paths"` + Priority float64 `json:"priority"` + JSON accountRumSiteInfoNewResponseResultRuleJSON `json:"-"` +} + +// accountRumSiteInfoNewResponseResultRuleJSON contains the JSON metadata for the +// struct [AccountRumSiteInfoNewResponseResultRule] +type accountRumSiteInfoNewResponseResultRuleJSON struct { + ID apijson.Field + Created apijson.Field + Host apijson.Field + Inclusive apijson.Field + IsPaused apijson.Field + Paths apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRumSiteInfoNewResponseResultRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRumSiteInfoNewResponseResultRuleset struct { + // The Web Analytics ruleset identifier. + ID string `json:"id"` + // Whether the ruleset is enabled. + Enabled bool `json:"enabled"` + ZoneName string `json:"zone_name"` + // The zone identifier. + ZoneTag string `json:"zone_tag"` + JSON accountRumSiteInfoNewResponseResultRulesetJSON `json:"-"` +} + +// accountRumSiteInfoNewResponseResultRulesetJSON contains the JSON metadata for +// the struct [AccountRumSiteInfoNewResponseResultRuleset] +type accountRumSiteInfoNewResponseResultRulesetJSON struct { + ID apijson.Field + Enabled apijson.Field + ZoneName apijson.Field + ZoneTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountRumSiteInfoNewResponseResultRuleset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRumSiteInfoNewParams struct { + // If enabled, the JavaScript snippet is automatically injected for orange-clouded + // sites. + AutoInstall param.Field[bool] `json:"auto_install"` + // The hostname to use for gray-clouded sites. + Host param.Field[string] `json:"host"` + // The zone identifier. + ZoneTag param.Field[string] `json:"zone_tag"` +} + +func (r AccountRumSiteInfoNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountrumsiteinfo_test.go b/accountrumsiteinfo_test.go new file mode 100644 index 00000000000..dd7984da1af --- /dev/null +++ b/accountrumsiteinfo_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRumSiteInfoNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rum.SiteInfo.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountRumSiteInfoNewParams{ + AutoInstall: cloudflare.F(true), + Host: cloudflare.F("example.com"), + ZoneTag: 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/accountrumv2.go b/accountrumv2.go new file mode 100644 index 00000000000..d356df2d049 --- /dev/null +++ b/accountrumv2.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRumV2Service 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 [NewAccountRumV2Service] method +// instead. +type AccountRumV2Service struct { + Options []option.RequestOption + Rule *AccountRumV2RuleService +} + +// NewAccountRumV2Service 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 NewAccountRumV2Service(opts ...option.RequestOption) (r *AccountRumV2Service) { + r = &AccountRumV2Service{} + r.Options = opts + r.Rule = NewAccountRumV2RuleService(opts...) + return +} diff --git a/accountrumv2rule.go b/accountrumv2rule.go new file mode 100644 index 00000000000..9f46de11e89 --- /dev/null +++ b/accountrumv2rule.go @@ -0,0 +1,146 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountRumV2RuleService 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 [NewAccountRumV2RuleService] method +// instead. +type AccountRumV2RuleService struct { + Options []option.RequestOption +} + +// NewAccountRumV2RuleService 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 NewAccountRumV2RuleService(opts ...option.RequestOption) (r *AccountRumV2RuleService) { + r = &AccountRumV2RuleService{} + r.Options = opts + return +} + +// Updates a rule in a Web Analytics ruleset. +func (r *AccountRumV2RuleService) Update(ctx context.Context, accountIdentifier string, rulesetIdentifier string, ruleIdentifier string, body AccountRumV2RuleUpdateParams, opts ...option.RequestOption) (res *Rule, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/v2/%s/rule/%s", accountIdentifier, rulesetIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type Rule struct { + Errors []RuleError `json:"errors"` + Messages []RuleMessage `json:"messages"` + Result RuleResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON ruleJSON `json:"-"` +} + +// ruleJSON contains the JSON metadata for the struct [Rule] +type ruleJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Rule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RuleError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON ruleErrorJSON `json:"-"` +} + +// ruleErrorJSON contains the JSON metadata for the struct [RuleError] +type ruleErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RuleError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RuleMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON ruleMessageJSON `json:"-"` +} + +// ruleMessageJSON contains the JSON metadata for the struct [RuleMessage] +type ruleMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RuleMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RuleResult struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + Created time.Time `json:"created" format:"date-time"` + // The hostname the rule will be applied to. + Host string `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive bool `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused bool `json:"is_paused"` + // The paths the rule will be applied to. + Paths []string `json:"paths"` + Priority float64 `json:"priority"` + JSON ruleResultJSON `json:"-"` +} + +// ruleResultJSON contains the JSON metadata for the struct [RuleResult] +type ruleResultJSON struct { + ID apijson.Field + Created apijson.Field + Host apijson.Field + Inclusive apijson.Field + IsPaused apijson.Field + Paths apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RuleResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountRumV2RuleUpdateParams struct { + Host param.Field[string] `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive param.Field[bool] `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused param.Field[bool] `json:"is_paused"` + Paths param.Field[[]string] `json:"paths"` +} + +func (r AccountRumV2RuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountrumv2rule_test.go b/accountrumv2rule_test.go new file mode 100644 index 00000000000..e8343140a35 --- /dev/null +++ b/accountrumv2rule_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountRumV2RuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Rum.V2.Rule.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountRumV2RuleUpdateParams{ + Host: cloudflare.F("example.com"), + Inclusive: cloudflare.F(true), + IsPaused: cloudflare.F(false), + Paths: cloudflare.F([]string{"*"}), + }, + ) + 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/accountsecondarydns.go b/accountsecondarydns.go new file mode 100644 index 00000000000..02bcc412a93 --- /dev/null +++ b/accountsecondarydns.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountSecondaryDNSService 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 [NewAccountSecondaryDNSService] +// method instead. +type AccountSecondaryDNSService struct { + Options []option.RequestOption + ACLs *AccountSecondaryDNSACLService + Peers *AccountSecondaryDNSPeerService + Tsigs *AccountSecondaryDNSTsigService +} + +// NewAccountSecondaryDNSService 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 NewAccountSecondaryDNSService(opts ...option.RequestOption) (r *AccountSecondaryDNSService) { + r = &AccountSecondaryDNSService{} + r.Options = opts + r.ACLs = NewAccountSecondaryDNSACLService(opts...) + r.Peers = NewAccountSecondaryDNSPeerService(opts...) + r.Tsigs = NewAccountSecondaryDNSTsigService(opts...) + return +} diff --git a/accountsecondarydnsacl.go b/accountsecondarydnsacl.go new file mode 100644 index 00000000000..9309b66eed6 --- /dev/null +++ b/accountsecondarydnsacl.go @@ -0,0 +1,601 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountSecondaryDNSACLService 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 [NewAccountSecondaryDNSACLService] +// method instead. +type AccountSecondaryDNSACLService struct { + Options []option.RequestOption +} + +// NewAccountSecondaryDNSACLService 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 NewAccountSecondaryDNSACLService(opts ...option.RequestOption) (r *AccountSecondaryDNSACLService) { + r = &AccountSecondaryDNSACLService{} + r.Options = opts + return +} + +// Get ACL. +func (r *AccountSecondaryDNSACLService) Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDnsaclGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/acls/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify ACL. +func (r *AccountSecondaryDNSACLService) Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body AccountSecondaryDNSACLUpdateParams, opts ...option.RequestOption) (res *AccountSecondaryDnsaclUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/acls/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete ACL. +func (r *AccountSecondaryDNSACLService) Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDnsaclDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/acls/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create ACL. +func (r *AccountSecondaryDNSACLService) SecondaryDNSACLNewACL(ctx context.Context, accountIdentifier interface{}, body AccountSecondaryDNSACLSecondaryDNSACLNewACLParams, opts ...option.RequestOption) (res *AccountSecondaryDnsaclSecondaryDnsaclNewACLResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/acls", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List ACLs. +func (r *AccountSecondaryDNSACLService) SecondaryDNSACLListACLs(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDnsaclSecondaryDnsaclListACLsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/acls", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountSecondaryDnsaclGetResponse struct { + Errors []AccountSecondaryDnsaclGetResponseError `json:"errors"` + Messages []AccountSecondaryDnsaclGetResponseMessage `json:"messages"` + Result AccountSecondaryDnsaclGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDnsaclGetResponseSuccess `json:"success"` + JSON accountSecondaryDnsaclGetResponseJSON `json:"-"` +} + +// accountSecondaryDnsaclGetResponseJSON contains the JSON metadata for the struct +// [AccountSecondaryDnsaclGetResponse] +type accountSecondaryDnsaclGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclGetResponseErrorJSON `json:"-"` +} + +// accountSecondaryDnsaclGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountSecondaryDnsaclGetResponseError] +type accountSecondaryDnsaclGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclGetResponseMessageJSON `json:"-"` +} + +// accountSecondaryDnsaclGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountSecondaryDnsaclGetResponseMessage] +type accountSecondaryDnsaclGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclGetResponseResult struct { + ID interface{} `json:"id,required"` + // Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will + // be applied for the entire account. The IP range is used to allow additional + // NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from + // for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for + // IPv6 respectively. + IPRange string `json:"ip_range,required"` + // The name of the acl. + Name string `json:"name,required"` + JSON accountSecondaryDnsaclGetResponseResultJSON `json:"-"` +} + +// accountSecondaryDnsaclGetResponseResultJSON contains the JSON metadata for the +// struct [AccountSecondaryDnsaclGetResponseResult] +type accountSecondaryDnsaclGetResponseResultJSON struct { + ID apijson.Field + IPRange apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDnsaclGetResponseSuccess bool + +const ( + AccountSecondaryDnsaclGetResponseSuccessTrue AccountSecondaryDnsaclGetResponseSuccess = true +) + +type AccountSecondaryDnsaclUpdateResponse struct { + Errors []AccountSecondaryDnsaclUpdateResponseError `json:"errors"` + Messages []AccountSecondaryDnsaclUpdateResponseMessage `json:"messages"` + Result AccountSecondaryDnsaclUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDnsaclUpdateResponseSuccess `json:"success"` + JSON accountSecondaryDnsaclUpdateResponseJSON `json:"-"` +} + +// accountSecondaryDnsaclUpdateResponseJSON contains the JSON metadata for the +// struct [AccountSecondaryDnsaclUpdateResponse] +type accountSecondaryDnsaclUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclUpdateResponseErrorJSON `json:"-"` +} + +// accountSecondaryDnsaclUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountSecondaryDnsaclUpdateResponseError] +type accountSecondaryDnsaclUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclUpdateResponseMessageJSON `json:"-"` +} + +// accountSecondaryDnsaclUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountSecondaryDnsaclUpdateResponseMessage] +type accountSecondaryDnsaclUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclUpdateResponseResult struct { + ID interface{} `json:"id,required"` + // Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will + // be applied for the entire account. The IP range is used to allow additional + // NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from + // for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for + // IPv6 respectively. + IPRange string `json:"ip_range,required"` + // The name of the acl. + Name string `json:"name,required"` + JSON accountSecondaryDnsaclUpdateResponseResultJSON `json:"-"` +} + +// accountSecondaryDnsaclUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountSecondaryDnsaclUpdateResponseResult] +type accountSecondaryDnsaclUpdateResponseResultJSON struct { + ID apijson.Field + IPRange apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDnsaclUpdateResponseSuccess bool + +const ( + AccountSecondaryDnsaclUpdateResponseSuccessTrue AccountSecondaryDnsaclUpdateResponseSuccess = true +) + +type AccountSecondaryDnsaclDeleteResponse struct { + Errors []AccountSecondaryDnsaclDeleteResponseError `json:"errors"` + Messages []AccountSecondaryDnsaclDeleteResponseMessage `json:"messages"` + Result AccountSecondaryDnsaclDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDnsaclDeleteResponseSuccess `json:"success"` + JSON accountSecondaryDnsaclDeleteResponseJSON `json:"-"` +} + +// accountSecondaryDnsaclDeleteResponseJSON contains the JSON metadata for the +// struct [AccountSecondaryDnsaclDeleteResponse] +type accountSecondaryDnsaclDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclDeleteResponseErrorJSON `json:"-"` +} + +// accountSecondaryDnsaclDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountSecondaryDnsaclDeleteResponseError] +type accountSecondaryDnsaclDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclDeleteResponseMessageJSON `json:"-"` +} + +// accountSecondaryDnsaclDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountSecondaryDnsaclDeleteResponseMessage] +type accountSecondaryDnsaclDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclDeleteResponseResult struct { + ID interface{} `json:"id"` + JSON accountSecondaryDnsaclDeleteResponseResultJSON `json:"-"` +} + +// accountSecondaryDnsaclDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountSecondaryDnsaclDeleteResponseResult] +type accountSecondaryDnsaclDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDnsaclDeleteResponseSuccess bool + +const ( + AccountSecondaryDnsaclDeleteResponseSuccessTrue AccountSecondaryDnsaclDeleteResponseSuccess = true +) + +type AccountSecondaryDnsaclSecondaryDnsaclNewACLResponse struct { + Errors []AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseError `json:"errors"` + Messages []AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseMessage `json:"messages"` + Result AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseSuccess `json:"success"` + JSON accountSecondaryDnsaclSecondaryDnsaclNewACLResponseJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclNewACLResponseJSON contains the JSON +// metadata for the struct [AccountSecondaryDnsaclSecondaryDnsaclNewACLResponse] +type accountSecondaryDnsaclSecondaryDnsaclNewACLResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclNewACLResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclSecondaryDnsaclNewACLResponseErrorJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclNewACLResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseError] +type accountSecondaryDnsaclSecondaryDnsaclNewACLResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclSecondaryDnsaclNewACLResponseMessageJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclNewACLResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseMessage] +type accountSecondaryDnsaclSecondaryDnsaclNewACLResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseResult struct { + ID interface{} `json:"id,required"` + // Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will + // be applied for the entire account. The IP range is used to allow additional + // NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from + // for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for + // IPv6 respectively. + IPRange string `json:"ip_range,required"` + // The name of the acl. + Name string `json:"name,required"` + JSON accountSecondaryDnsaclSecondaryDnsaclNewACLResponseResultJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclNewACLResponseResultJSON contains the JSON +// metadata for the struct +// [AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseResult] +type accountSecondaryDnsaclSecondaryDnsaclNewACLResponseResultJSON struct { + ID apijson.Field + IPRange apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseSuccess bool + +const ( + AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseSuccessTrue AccountSecondaryDnsaclSecondaryDnsaclNewACLResponseSuccess = true +) + +type AccountSecondaryDnsaclSecondaryDnsaclListACLsResponse struct { + Errors []AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseError `json:"errors"` + Messages []AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseMessage `json:"messages"` + Result []AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResult `json:"result"` + ResultInfo AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseSuccess `json:"success"` + JSON accountSecondaryDnsaclSecondaryDnsaclListACLsResponseJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclListACLsResponseJSON contains the JSON +// metadata for the struct [AccountSecondaryDnsaclSecondaryDnsaclListACLsResponse] +type accountSecondaryDnsaclSecondaryDnsaclListACLsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclListACLsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclSecondaryDnsaclListACLsResponseErrorJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclListACLsResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseError] +type accountSecondaryDnsaclSecondaryDnsaclListACLsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDnsaclSecondaryDnsaclListACLsResponseMessageJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclListACLsResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseMessage] +type accountSecondaryDnsaclSecondaryDnsaclListACLsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResult struct { + ID interface{} `json:"id,required"` + // Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will + // be applied for the entire account. The IP range is used to allow additional + // NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from + // for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for + // IPv6 respectively. + IPRange string `json:"ip_range,required"` + // The name of the acl. + Name string `json:"name,required"` + JSON accountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResult] +type accountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultJSON struct { + ID apijson.Field + IPRange apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultInfoJSON `json:"-"` +} + +// accountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultInfoJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultInfo] +type accountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseSuccess bool + +const ( + AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseSuccessTrue AccountSecondaryDnsaclSecondaryDnsaclListACLsResponseSuccess = true +) + +type AccountSecondaryDNSACLUpdateParams struct { + // Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will + // be applied for the entire account. The IP range is used to allow additional + // NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from + // for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for + // IPv6 respectively. + IPRange param.Field[string] `json:"ip_range,required"` + // The name of the acl. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountSecondaryDNSACLUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountSecondaryDNSACLSecondaryDNSACLNewACLParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountSecondaryDNSACLSecondaryDNSACLNewACLParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountsecondarydnsacl_test.go b/accountsecondarydnsacl_test.go new file mode 100644 index 00000000000..bc6127d5152 --- /dev/null +++ b/accountsecondarydnsacl_test.go @@ -0,0 +1,166 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountSecondaryDNSACLGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.ACLs.Get( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "23ff594956f20c2a721606e94745a8aa", + ) + 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 TestAccountSecondaryDNSACLUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.ACLs.Update( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "23ff594956f20c2a721606e94745a8aa", + cloudflare.AccountSecondaryDNSACLUpdateParams{ + IPRange: cloudflare.F("192.0.2.53/28"), + Name: cloudflare.F("my-acl-1"), + }, + ) + 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 TestAccountSecondaryDNSACLDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.ACLs.Delete( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "23ff594956f20c2a721606e94745a8aa", + ) + 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 TestAccountSecondaryDNSACLSecondaryDNSACLNewACL(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.ACLs.SecondaryDNSACLNewACL( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountSecondaryDNSACLSecondaryDNSACLNewACLParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountSecondaryDNSACLSecondaryDNSACLListACLs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.ACLs.SecondaryDNSACLListACLs(context.TODO(), "01a7362d577a6c3019a474fd6f485823") + 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/accountsecondarydnspeer.go b/accountsecondarydnspeer.go new file mode 100644 index 00000000000..0d6998a45ff --- /dev/null +++ b/accountsecondarydnspeer.go @@ -0,0 +1,654 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountSecondaryDNSPeerService 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 +// [NewAccountSecondaryDNSPeerService] method instead. +type AccountSecondaryDNSPeerService struct { + Options []option.RequestOption +} + +// NewAccountSecondaryDNSPeerService 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 NewAccountSecondaryDNSPeerService(opts ...option.RequestOption) (r *AccountSecondaryDNSPeerService) { + r = &AccountSecondaryDNSPeerService{} + r.Options = opts + return +} + +// Get Peer. +func (r *AccountSecondaryDNSPeerService) Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDNSPeerGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/peers/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify Peer. +func (r *AccountSecondaryDNSPeerService) Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body AccountSecondaryDNSPeerUpdateParams, opts ...option.RequestOption) (res *AccountSecondaryDNSPeerUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/peers/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete Peer. +func (r *AccountSecondaryDNSPeerService) Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDNSPeerDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/peers/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create Peer. +func (r *AccountSecondaryDNSPeerService) SecondaryDNSPeerNewPeer(ctx context.Context, accountIdentifier interface{}, body AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerParams, opts ...option.RequestOption) (res *AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/peers", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List Peers. +func (r *AccountSecondaryDNSPeerService) SecondaryDNSPeerListPeers(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/peers", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountSecondaryDNSPeerGetResponse struct { + Errors []AccountSecondaryDNSPeerGetResponseError `json:"errors"` + Messages []AccountSecondaryDNSPeerGetResponseMessage `json:"messages"` + Result AccountSecondaryDNSPeerGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSPeerGetResponseSuccess `json:"success"` + JSON accountSecondaryDNSPeerGetResponseJSON `json:"-"` +} + +// accountSecondaryDNSPeerGetResponseJSON contains the JSON metadata for the struct +// [AccountSecondaryDNSPeerGetResponse] +type accountSecondaryDNSPeerGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerGetResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSPeerGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSPeerGetResponseError] +type accountSecondaryDNSPeerGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerGetResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSPeerGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSPeerGetResponseMessage] +type accountSecondaryDNSPeerGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerGetResponseResult struct { + ID interface{} `json:"id,required"` + // The name of the peer. + Name string `json:"name,required"` + // IPv4/IPv6 address of primary or secondary nameserver, depending on what zone + // this peer is linked to. For primary zones this IP defines the IP of the + // secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary + // zones this IP defines the IP of the primary nameserver Cloudflare will send + // AXFR/IXFR requests to. + IP string `json:"ip"` + // Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary + // zones. + IxfrEnable bool `json:"ixfr_enable"` + // DNS port of primary or secondary nameserver, depending on what zone this peer is + // linked to. + Port float64 `json:"port"` + // TSIG authentication will be used for zone transfer if configured. + TsigID string `json:"tsig_id"` + JSON accountSecondaryDNSPeerGetResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSPeerGetResponseResultJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSPeerGetResponseResult] +type accountSecondaryDNSPeerGetResponseResultJSON struct { + ID apijson.Field + Name apijson.Field + IP apijson.Field + IxfrEnable apijson.Field + Port apijson.Field + TsigID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSPeerGetResponseSuccess bool + +const ( + AccountSecondaryDNSPeerGetResponseSuccessTrue AccountSecondaryDNSPeerGetResponseSuccess = true +) + +type AccountSecondaryDNSPeerUpdateResponse struct { + Errors []AccountSecondaryDNSPeerUpdateResponseError `json:"errors"` + Messages []AccountSecondaryDNSPeerUpdateResponseMessage `json:"messages"` + Result AccountSecondaryDNSPeerUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSPeerUpdateResponseSuccess `json:"success"` + JSON accountSecondaryDNSPeerUpdateResponseJSON `json:"-"` +} + +// accountSecondaryDNSPeerUpdateResponseJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSPeerUpdateResponse] +type accountSecondaryDNSPeerUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerUpdateResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSPeerUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSPeerUpdateResponseError] +type accountSecondaryDNSPeerUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerUpdateResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSPeerUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSPeerUpdateResponseMessage] +type accountSecondaryDNSPeerUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerUpdateResponseResult struct { + ID interface{} `json:"id,required"` + // The name of the peer. + Name string `json:"name,required"` + // IPv4/IPv6 address of primary or secondary nameserver, depending on what zone + // this peer is linked to. For primary zones this IP defines the IP of the + // secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary + // zones this IP defines the IP of the primary nameserver Cloudflare will send + // AXFR/IXFR requests to. + IP string `json:"ip"` + // Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary + // zones. + IxfrEnable bool `json:"ixfr_enable"` + // DNS port of primary or secondary nameserver, depending on what zone this peer is + // linked to. + Port float64 `json:"port"` + // TSIG authentication will be used for zone transfer if configured. + TsigID string `json:"tsig_id"` + JSON accountSecondaryDNSPeerUpdateResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSPeerUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSPeerUpdateResponseResult] +type accountSecondaryDNSPeerUpdateResponseResultJSON struct { + ID apijson.Field + Name apijson.Field + IP apijson.Field + IxfrEnable apijson.Field + Port apijson.Field + TsigID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSPeerUpdateResponseSuccess bool + +const ( + AccountSecondaryDNSPeerUpdateResponseSuccessTrue AccountSecondaryDNSPeerUpdateResponseSuccess = true +) + +type AccountSecondaryDNSPeerDeleteResponse struct { + Errors []AccountSecondaryDNSPeerDeleteResponseError `json:"errors"` + Messages []AccountSecondaryDNSPeerDeleteResponseMessage `json:"messages"` + Result AccountSecondaryDNSPeerDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSPeerDeleteResponseSuccess `json:"success"` + JSON accountSecondaryDNSPeerDeleteResponseJSON `json:"-"` +} + +// accountSecondaryDNSPeerDeleteResponseJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSPeerDeleteResponse] +type accountSecondaryDNSPeerDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerDeleteResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSPeerDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSPeerDeleteResponseError] +type accountSecondaryDNSPeerDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerDeleteResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSPeerDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSPeerDeleteResponseMessage] +type accountSecondaryDNSPeerDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerDeleteResponseResult struct { + ID interface{} `json:"id"` + JSON accountSecondaryDNSPeerDeleteResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSPeerDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSPeerDeleteResponseResult] +type accountSecondaryDNSPeerDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSPeerDeleteResponseSuccess bool + +const ( + AccountSecondaryDNSPeerDeleteResponseSuccessTrue AccountSecondaryDNSPeerDeleteResponseSuccess = true +) + +type AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponse struct { + Errors []AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseError `json:"errors"` + Messages []AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseMessage `json:"messages"` + Result AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseSuccess `json:"success"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseJSON contains the JSON +// metadata for the struct [AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponse] +type accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseError] +type accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseMessage] +type accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseResult struct { + ID interface{} `json:"id,required"` + // The name of the peer. + Name string `json:"name,required"` + // IPv4/IPv6 address of primary or secondary nameserver, depending on what zone + // this peer is linked to. For primary zones this IP defines the IP of the + // secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary + // zones this IP defines the IP of the primary nameserver Cloudflare will send + // AXFR/IXFR requests to. + IP string `json:"ip"` + // Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary + // zones. + IxfrEnable bool `json:"ixfr_enable"` + // DNS port of primary or secondary nameserver, depending on what zone this peer is + // linked to. + Port float64 `json:"port"` + // TSIG authentication will be used for zone transfer if configured. + TsigID string `json:"tsig_id"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseResultJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseResult] +type accountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseResultJSON struct { + ID apijson.Field + Name apijson.Field + IP apijson.Field + IxfrEnable apijson.Field + Port apijson.Field + TsigID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseSuccess bool + +const ( + AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseSuccessTrue AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponseSuccess = true +) + +type AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponse struct { + Errors []AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseError `json:"errors"` + Messages []AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseMessage `json:"messages"` + Result []AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResult `json:"result"` + ResultInfo AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseSuccess `json:"success"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseJSON contains the JSON +// metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponse] +type accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseError] +type accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseMessage] +type accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResult struct { + ID interface{} `json:"id,required"` + // The name of the peer. + Name string `json:"name,required"` + // IPv4/IPv6 address of primary or secondary nameserver, depending on what zone + // this peer is linked to. For primary zones this IP defines the IP of the + // secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary + // zones this IP defines the IP of the primary nameserver Cloudflare will send + // AXFR/IXFR requests to. + IP string `json:"ip"` + // Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary + // zones. + IxfrEnable bool `json:"ixfr_enable"` + // DNS port of primary or secondary nameserver, depending on what zone this peer is + // linked to. + Port float64 `json:"port"` + // TSIG authentication will be used for zone transfer if configured. + TsigID string `json:"tsig_id"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResult] +type accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultJSON struct { + ID apijson.Field + Name apijson.Field + IP apijson.Field + IxfrEnable apijson.Field + Port apijson.Field + TsigID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultInfoJSON `json:"-"` +} + +// accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultInfo] +type accountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseSuccess bool + +const ( + AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseSuccessTrue AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponseSuccess = true +) + +type AccountSecondaryDNSPeerUpdateParams struct { + // The name of the peer. + Name param.Field[string] `json:"name,required"` + // IPv4/IPv6 address of primary or secondary nameserver, depending on what zone + // this peer is linked to. For primary zones this IP defines the IP of the + // secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary + // zones this IP defines the IP of the primary nameserver Cloudflare will send + // AXFR/IXFR requests to. + IP param.Field[string] `json:"ip"` + // Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary + // zones. + IxfrEnable param.Field[bool] `json:"ixfr_enable"` + // DNS port of primary or secondary nameserver, depending on what zone this peer is + // linked to. + Port param.Field[float64] `json:"port"` + // TSIG authentication will be used for zone transfer if configured. + TsigID param.Field[string] `json:"tsig_id"` +} + +func (r AccountSecondaryDNSPeerUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountsecondarydnspeer_test.go b/accountsecondarydnspeer_test.go new file mode 100644 index 00000000000..5775c4f569a --- /dev/null +++ b/accountsecondarydnspeer_test.go @@ -0,0 +1,169 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountSecondaryDNSPeerGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Peers.Get( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "23ff594956f20c2a721606e94745a8aa", + ) + 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 TestAccountSecondaryDNSPeerUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Peers.Update( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "23ff594956f20c2a721606e94745a8aa", + cloudflare.AccountSecondaryDNSPeerUpdateParams{ + Name: cloudflare.F("my-peer-1"), + IP: cloudflare.F("192.0.2.53"), + IxfrEnable: cloudflare.F(false), + Port: cloudflare.F(53.000000), + TsigID: cloudflare.F("69cd1e104af3e6ed3cb344f263fd0d5a"), + }, + ) + 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 TestAccountSecondaryDNSPeerDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Peers.Delete( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "23ff594956f20c2a721606e94745a8aa", + ) + 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 TestAccountSecondaryDNSPeerSecondaryDNSPeerNewPeer(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Peers.SecondaryDNSPeerNewPeer( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountSecondaryDNSPeerSecondaryDNSPeerListPeers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Peers.SecondaryDNSPeerListPeers(context.TODO(), "01a7362d577a6c3019a474fd6f485823") + 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/accountsecondarydnstsig.go b/accountsecondarydnstsig.go new file mode 100644 index 00000000000..be6d415716e --- /dev/null +++ b/accountsecondarydnstsig.go @@ -0,0 +1,601 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountSecondaryDNSTsigService 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 +// [NewAccountSecondaryDNSTsigService] method instead. +type AccountSecondaryDNSTsigService struct { + Options []option.RequestOption +} + +// NewAccountSecondaryDNSTsigService 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 NewAccountSecondaryDNSTsigService(opts ...option.RequestOption) (r *AccountSecondaryDNSTsigService) { + r = &AccountSecondaryDNSTsigService{} + r.Options = opts + return +} + +// Get TSIG. +func (r *AccountSecondaryDNSTsigService) Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDNSTsigGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/tsigs/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify TSIG. +func (r *AccountSecondaryDNSTsigService) Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body AccountSecondaryDNSTsigUpdateParams, opts ...option.RequestOption) (res *AccountSecondaryDNSTsigUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/tsigs/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete TSIG. +func (r *AccountSecondaryDNSTsigService) Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDNSTsigDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/tsigs/%v", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create TSIG. +func (r *AccountSecondaryDNSTsigService) SecondaryDNSTsigNewTsig(ctx context.Context, accountIdentifier interface{}, body AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigParams, opts ...option.RequestOption) (res *AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/tsigs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List TSIGs. +func (r *AccountSecondaryDNSTsigService) SecondaryDNSTsigListTsiGs(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/secondary_dns/tsigs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountSecondaryDNSTsigGetResponse struct { + Errors []AccountSecondaryDNSTsigGetResponseError `json:"errors"` + Messages []AccountSecondaryDNSTsigGetResponseMessage `json:"messages"` + Result AccountSecondaryDNSTsigGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSTsigGetResponseSuccess `json:"success"` + JSON accountSecondaryDNSTsigGetResponseJSON `json:"-"` +} + +// accountSecondaryDNSTsigGetResponseJSON contains the JSON metadata for the struct +// [AccountSecondaryDNSTsigGetResponse] +type accountSecondaryDNSTsigGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigGetResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSTsigGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSTsigGetResponseError] +type accountSecondaryDNSTsigGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigGetResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSTsigGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSTsigGetResponseMessage] +type accountSecondaryDNSTsigGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigGetResponseResult struct { + ID interface{} `json:"id,required"` + // TSIG algorithm. + Algo string `json:"algo,required"` + // TSIG key name. + Name string `json:"name,required"` + // TSIG secret. + Secret string `json:"secret,required"` + JSON accountSecondaryDNSTsigGetResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSTsigGetResponseResultJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSTsigGetResponseResult] +type accountSecondaryDNSTsigGetResponseResultJSON struct { + ID apijson.Field + Algo apijson.Field + Name apijson.Field + Secret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSTsigGetResponseSuccess bool + +const ( + AccountSecondaryDNSTsigGetResponseSuccessTrue AccountSecondaryDNSTsigGetResponseSuccess = true +) + +type AccountSecondaryDNSTsigUpdateResponse struct { + Errors []AccountSecondaryDNSTsigUpdateResponseError `json:"errors"` + Messages []AccountSecondaryDNSTsigUpdateResponseMessage `json:"messages"` + Result AccountSecondaryDNSTsigUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSTsigUpdateResponseSuccess `json:"success"` + JSON accountSecondaryDNSTsigUpdateResponseJSON `json:"-"` +} + +// accountSecondaryDNSTsigUpdateResponseJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSTsigUpdateResponse] +type accountSecondaryDNSTsigUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigUpdateResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSTsigUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSTsigUpdateResponseError] +type accountSecondaryDNSTsigUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigUpdateResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSTsigUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSTsigUpdateResponseMessage] +type accountSecondaryDNSTsigUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigUpdateResponseResult struct { + ID interface{} `json:"id,required"` + // TSIG algorithm. + Algo string `json:"algo,required"` + // TSIG key name. + Name string `json:"name,required"` + // TSIG secret. + Secret string `json:"secret,required"` + JSON accountSecondaryDNSTsigUpdateResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSTsigUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSTsigUpdateResponseResult] +type accountSecondaryDNSTsigUpdateResponseResultJSON struct { + ID apijson.Field + Algo apijson.Field + Name apijson.Field + Secret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSTsigUpdateResponseSuccess bool + +const ( + AccountSecondaryDNSTsigUpdateResponseSuccessTrue AccountSecondaryDNSTsigUpdateResponseSuccess = true +) + +type AccountSecondaryDNSTsigDeleteResponse struct { + Errors []AccountSecondaryDNSTsigDeleteResponseError `json:"errors"` + Messages []AccountSecondaryDNSTsigDeleteResponseMessage `json:"messages"` + Result AccountSecondaryDNSTsigDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSTsigDeleteResponseSuccess `json:"success"` + JSON accountSecondaryDNSTsigDeleteResponseJSON `json:"-"` +} + +// accountSecondaryDNSTsigDeleteResponseJSON contains the JSON metadata for the +// struct [AccountSecondaryDNSTsigDeleteResponse] +type accountSecondaryDNSTsigDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigDeleteResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSTsigDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSTsigDeleteResponseError] +type accountSecondaryDNSTsigDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigDeleteResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSTsigDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSTsigDeleteResponseMessage] +type accountSecondaryDNSTsigDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigDeleteResponseResult struct { + ID interface{} `json:"id"` + JSON accountSecondaryDNSTsigDeleteResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSTsigDeleteResponseResultJSON contains the JSON metadata for +// the struct [AccountSecondaryDNSTsigDeleteResponseResult] +type accountSecondaryDNSTsigDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSTsigDeleteResponseSuccess bool + +const ( + AccountSecondaryDNSTsigDeleteResponseSuccessTrue AccountSecondaryDNSTsigDeleteResponseSuccess = true +) + +type AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponse struct { + Errors []AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseError `json:"errors"` + Messages []AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseMessage `json:"messages"` + Result AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseSuccess `json:"success"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseJSON contains the JSON +// metadata for the struct [AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponse] +type accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseError] +type accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseMessage] +type accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseResult struct { + ID interface{} `json:"id,required"` + // TSIG algorithm. + Algo string `json:"algo,required"` + // TSIG key name. + Name string `json:"name,required"` + // TSIG secret. + Secret string `json:"secret,required"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseResultJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseResult] +type accountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseResultJSON struct { + ID apijson.Field + Algo apijson.Field + Name apijson.Field + Secret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseSuccess bool + +const ( + AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseSuccessTrue AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponseSuccess = true +) + +type AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponse struct { + Errors []AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseError `json:"errors"` + Messages []AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseMessage `json:"messages"` + Result []AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResult `json:"result"` + ResultInfo AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseSuccess `json:"success"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseJSON contains the JSON +// metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponse] +type accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseErrorJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseError] +type accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseMessageJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseMessage] +type accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResult struct { + ID interface{} `json:"id,required"` + // TSIG algorithm. + Algo string `json:"algo,required"` + // TSIG key name. + Name string `json:"name,required"` + // TSIG secret. + Secret string `json:"secret,required"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultJSON contains the +// JSON metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResult] +type accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultJSON struct { + ID apijson.Field + Algo apijson.Field + Name apijson.Field + Secret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultInfoJSON `json:"-"` +} + +// accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultInfo] +type accountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseSuccess bool + +const ( + AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseSuccessTrue AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponseSuccess = true +) + +type AccountSecondaryDNSTsigUpdateParams struct { + // TSIG algorithm. + Algo param.Field[string] `json:"algo,required"` + // TSIG key name. + Name param.Field[string] `json:"name,required"` + // TSIG secret. + Secret param.Field[string] `json:"secret,required"` +} + +func (r AccountSecondaryDNSTsigUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigParams struct { + // TSIG algorithm. + Algo param.Field[string] `json:"algo,required"` + // TSIG key name. + Name param.Field[string] `json:"name,required"` + // TSIG secret. + Secret param.Field[string] `json:"secret,required"` +} + +func (r AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountsecondarydnstsig_test.go b/accountsecondarydnstsig_test.go new file mode 100644 index 00000000000..d1f1f71458f --- /dev/null +++ b/accountsecondarydnstsig_test.go @@ -0,0 +1,169 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountSecondaryDNSTsigGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Tsigs.Get( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "69cd1e104af3e6ed3cb344f263fd0d5a", + ) + 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 TestAccountSecondaryDNSTsigUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Tsigs.Update( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "69cd1e104af3e6ed3cb344f263fd0d5a", + cloudflare.AccountSecondaryDNSTsigUpdateParams{ + Algo: cloudflare.F("hmac-sha512."), + Name: cloudflare.F("tsig.customer.cf."), + Secret: cloudflare.F("caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c"), + }, + ) + 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 TestAccountSecondaryDNSTsigDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Tsigs.Delete( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "69cd1e104af3e6ed3cb344f263fd0d5a", + ) + 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 TestAccountSecondaryDNSTsigSecondaryDNSTsigNewTsig(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Tsigs.SecondaryDNSTsigNewTsig( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + cloudflare.AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigParams{ + Algo: cloudflare.F("hmac-sha512."), + Name: cloudflare.F("tsig.customer.cf."), + Secret: cloudflare.F("caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c"), + }, + ) + 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 TestAccountSecondaryDNSTsigSecondaryDNSTsigListTsiGs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.SecondaryDNS.Tsigs.SecondaryDNSTsigListTsiGs(context.TODO(), "01a7362d577a6c3019a474fd6f485823") + 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/accountstorage.go b/accountstorage.go new file mode 100644 index 00000000000..b1ea4120058 --- /dev/null +++ b/accountstorage.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStorageService 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 [NewAccountStorageService] method +// instead. +type AccountStorageService struct { + Options []option.RequestOption + Analytics *AccountStorageAnalyticsService + Kvs *AccountStorageKvService +} + +// NewAccountStorageService 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 NewAccountStorageService(opts ...option.RequestOption) (r *AccountStorageService) { + r = &AccountStorageService{} + r.Options = opts + r.Analytics = NewAccountStorageAnalyticsService(opts...) + r.Kvs = NewAccountStorageKvService(opts...) + return +} diff --git a/accountstorageanalytics.go b/accountstorageanalytics.go new file mode 100644 index 00000000000..dfaf7a55224 --- /dev/null +++ b/accountstorageanalytics.go @@ -0,0 +1,458 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStorageAnalyticsService 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 +// [NewAccountStorageAnalyticsService] method instead. +type AccountStorageAnalyticsService struct { + Options []option.RequestOption +} + +// NewAccountStorageAnalyticsService 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 NewAccountStorageAnalyticsService(opts ...option.RequestOption) (r *AccountStorageAnalyticsService) { + r = &AccountStorageAnalyticsService{} + r.Options = opts + return +} + +// Retrieves Workers KV request metrics for the given account. +func (r *AccountStorageAnalyticsService) List(ctx context.Context, accountIdentifier string, query AccountStorageAnalyticsListParams, opts ...option.RequestOption) (res *AccountStorageAnalyticsListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/analytics", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Retrieves Workers KV stored data metrics for the given account. +func (r *AccountStorageAnalyticsService) Stored(ctx context.Context, accountIdentifier string, query AccountStorageAnalyticsStoredParams, opts ...option.RequestOption) (res *AccountStorageAnalyticsStoredResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/analytics/stored", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountStorageAnalyticsListResponse struct { + Errors []AccountStorageAnalyticsListResponseError `json:"errors"` + Messages []AccountStorageAnalyticsListResponseMessage `json:"messages"` + Result AccountStorageAnalyticsListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageAnalyticsListResponseSuccess `json:"success"` + JSON accountStorageAnalyticsListResponseJSON `json:"-"` +} + +// accountStorageAnalyticsListResponseJSON contains the JSON metadata for the +// struct [AccountStorageAnalyticsListResponse] +type accountStorageAnalyticsListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageAnalyticsListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageAnalyticsListResponseErrorJSON `json:"-"` +} + +// accountStorageAnalyticsListResponseErrorJSON contains the JSON metadata for the +// struct [AccountStorageAnalyticsListResponseError] +type accountStorageAnalyticsListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageAnalyticsListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageAnalyticsListResponseMessageJSON `json:"-"` +} + +// accountStorageAnalyticsListResponseMessageJSON contains the JSON metadata for +// the struct [AccountStorageAnalyticsListResponseMessage] +type accountStorageAnalyticsListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageAnalyticsListResponseResult struct { + Data interface{} `json:"data"` + // Number of seconds between current time and last processed event, i.e. how many + // seconds of data could be missing. + DataLag float64 `json:"data_lag"` + Max interface{} `json:"max"` + Min interface{} `json:"min"` + // For specifying result metrics. + Query AccountStorageAnalyticsListResponseResultQuery `json:"query"` + // Total number of rows in the result. + Rows float64 `json:"rows"` + Totals interface{} `json:"totals"` + JSON accountStorageAnalyticsListResponseResultJSON `json:"-"` +} + +// accountStorageAnalyticsListResponseResultJSON contains the JSON metadata for the +// struct [AccountStorageAnalyticsListResponseResult] +type accountStorageAnalyticsListResponseResultJSON struct { + Data apijson.Field + DataLag apijson.Field + Max apijson.Field + Min apijson.Field + Query apijson.Field + Rows apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// For specifying result metrics. +type AccountStorageAnalyticsListResponseResultQuery struct { + // Can be used to break down the data by given attributes. + Dimensions []string `json:"dimensions"` + // Used to filter rows by one or more dimensions. Filters can be combined using OR + // and AND boolean logic. AND takes precedence over OR in all the expressions. The + // OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. + // The AND operator is defined using a semicolon (;) or AND keyword surrounded by + // whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) + // and needs to be percent-encoded as %3B. Comparison options are: + // + // | Operator | Name | URL Encoded | + // | -------- | ------------------------ | ----------- | + // | == | Equals | %3D%3D | + // | != | Does not equals | !%3D | + // | > | Greater Than | %3E | + // | < | Less Than | %3C | + // | >= | Greater than or equal to | %3E%3D | + // | <= | Less than or equal to | %3C%3D . | + Filters string `json:"filters"` + // Limit number of returned metrics. + Limit int64 `json:"limit"` + // One or more metrics to compute. + Metrics []string `json:"metrics"` + // Start of time interval to query, defaults to 6 hours before request received. + Since time.Time `json:"since" format:"date-time"` + // Array of dimensions or metrics to sort by, each dimension/metric may be prefixed + // by - (descending) or + (ascending). + Sort []interface{} `json:"sort"` + // End of time interval to query, defaults to current time. + Until time.Time `json:"until" format:"date-time"` + JSON accountStorageAnalyticsListResponseResultQueryJSON `json:"-"` +} + +// accountStorageAnalyticsListResponseResultQueryJSON contains the JSON metadata +// for the struct [AccountStorageAnalyticsListResponseResultQuery] +type accountStorageAnalyticsListResponseResultQueryJSON struct { + Dimensions apijson.Field + Filters apijson.Field + Limit apijson.Field + Metrics apijson.Field + Since apijson.Field + Sort apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsListResponseResultQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStorageAnalyticsListResponseSuccess bool + +const ( + AccountStorageAnalyticsListResponseSuccessTrue AccountStorageAnalyticsListResponseSuccess = true +) + +type AccountStorageAnalyticsStoredResponse struct { + Errors []AccountStorageAnalyticsStoredResponseError `json:"errors"` + Messages []AccountStorageAnalyticsStoredResponseMessage `json:"messages"` + Result AccountStorageAnalyticsStoredResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageAnalyticsStoredResponseSuccess `json:"success"` + JSON accountStorageAnalyticsStoredResponseJSON `json:"-"` +} + +// accountStorageAnalyticsStoredResponseJSON contains the JSON metadata for the +// struct [AccountStorageAnalyticsStoredResponse] +type accountStorageAnalyticsStoredResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsStoredResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageAnalyticsStoredResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageAnalyticsStoredResponseErrorJSON `json:"-"` +} + +// accountStorageAnalyticsStoredResponseErrorJSON contains the JSON metadata for +// the struct [AccountStorageAnalyticsStoredResponseError] +type accountStorageAnalyticsStoredResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsStoredResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageAnalyticsStoredResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageAnalyticsStoredResponseMessageJSON `json:"-"` +} + +// accountStorageAnalyticsStoredResponseMessageJSON contains the JSON metadata for +// the struct [AccountStorageAnalyticsStoredResponseMessage] +type accountStorageAnalyticsStoredResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsStoredResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageAnalyticsStoredResponseResult struct { + Data interface{} `json:"data"` + // Number of seconds between current time and last processed event, i.e. how many + // seconds of data could be missing. + DataLag float64 `json:"data_lag"` + Max interface{} `json:"max"` + Min interface{} `json:"min"` + // For specifying result metrics. + Query AccountStorageAnalyticsStoredResponseResultQuery `json:"query"` + // Total number of rows in the result. + Rows float64 `json:"rows"` + Totals interface{} `json:"totals"` + JSON accountStorageAnalyticsStoredResponseResultJSON `json:"-"` +} + +// accountStorageAnalyticsStoredResponseResultJSON contains the JSON metadata for +// the struct [AccountStorageAnalyticsStoredResponseResult] +type accountStorageAnalyticsStoredResponseResultJSON struct { + Data apijson.Field + DataLag apijson.Field + Max apijson.Field + Min apijson.Field + Query apijson.Field + Rows apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsStoredResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// For specifying result metrics. +type AccountStorageAnalyticsStoredResponseResultQuery struct { + // Can be used to break down the data by given attributes. + Dimensions []string `json:"dimensions"` + // Used to filter rows by one or more dimensions. Filters can be combined using OR + // and AND boolean logic. AND takes precedence over OR in all the expressions. The + // OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. + // The AND operator is defined using a semicolon (;) or AND keyword surrounded by + // whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) + // and needs to be percent-encoded as %3B. Comparison options are: + // + // | Operator | Name | URL Encoded | + // | -------- | ------------------------ | ----------- | + // | == | Equals | %3D%3D | + // | != | Does not equals | !%3D | + // | > | Greater Than | %3E | + // | < | Less Than | %3C | + // | >= | Greater than or equal to | %3E%3D | + // | <= | Less than or equal to | %3C%3D . | + Filters string `json:"filters"` + // Limit number of returned metrics. + Limit int64 `json:"limit"` + // One or more metrics to compute. + Metrics []string `json:"metrics"` + // Start of time interval to query, defaults to 6 hours before request received. + Since time.Time `json:"since" format:"date-time"` + // Array of dimensions or metrics to sort by, each dimension/metric may be prefixed + // by - (descending) or + (ascending). + Sort []interface{} `json:"sort"` + // End of time interval to query, defaults to current time. + Until time.Time `json:"until" format:"date-time"` + JSON accountStorageAnalyticsStoredResponseResultQueryJSON `json:"-"` +} + +// accountStorageAnalyticsStoredResponseResultQueryJSON contains the JSON metadata +// for the struct [AccountStorageAnalyticsStoredResponseResultQuery] +type accountStorageAnalyticsStoredResponseResultQueryJSON struct { + Dimensions apijson.Field + Filters apijson.Field + Limit apijson.Field + Metrics apijson.Field + Since apijson.Field + Sort apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageAnalyticsStoredResponseResultQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStorageAnalyticsStoredResponseSuccess bool + +const ( + AccountStorageAnalyticsStoredResponseSuccessTrue AccountStorageAnalyticsStoredResponseSuccess = true +) + +type AccountStorageAnalyticsListParams struct { + Query param.Field[AccountStorageAnalyticsListParamsQuery] `query:"query"` +} + +// URLQuery serializes [AccountStorageAnalyticsListParams]'s query parameters as +// `url.Values`. +func (r AccountStorageAnalyticsListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountStorageAnalyticsListParamsQuery struct { + Dimensions param.Field[[]AccountStorageAnalyticsListParamsQueryDimension] `query:"dimensions"` + Filters param.Field[interface{}] `query:"filters"` + // Limit number of returned metrics. + Limit param.Field[int64] `query:"limit"` + Metrics param.Field[[]AccountStorageAnalyticsListParamsQueryMetric] `query:"metrics"` + // Start of time interval to query, defaults to 6 hours before request received. + Since param.Field[time.Time] `query:"since" format:"date-time"` + Sort param.Field[interface{}] `query:"sort"` + // End of time interval to query, defaults to current time. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes [AccountStorageAnalyticsListParamsQuery]'s query parameters +// as `url.Values`. +func (r AccountStorageAnalyticsListParamsQuery) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountStorageAnalyticsListParamsQueryDimension string + +const ( + AccountStorageAnalyticsListParamsQueryDimensionAccountID AccountStorageAnalyticsListParamsQueryDimension = "accountId" + AccountStorageAnalyticsListParamsQueryDimensionResponseCode AccountStorageAnalyticsListParamsQueryDimension = "responseCode" + AccountStorageAnalyticsListParamsQueryDimensionRequestType AccountStorageAnalyticsListParamsQueryDimension = "requestType" +) + +type AccountStorageAnalyticsListParamsQueryMetric string + +const ( + AccountStorageAnalyticsListParamsQueryMetricRequests AccountStorageAnalyticsListParamsQueryMetric = "requests" + AccountStorageAnalyticsListParamsQueryMetricWriteKiB AccountStorageAnalyticsListParamsQueryMetric = "writeKiB" + AccountStorageAnalyticsListParamsQueryMetricReadKiB AccountStorageAnalyticsListParamsQueryMetric = "readKiB" +) + +type AccountStorageAnalyticsStoredParams struct { + Query param.Field[AccountStorageAnalyticsStoredParamsQuery] `query:"query"` +} + +// URLQuery serializes [AccountStorageAnalyticsStoredParams]'s query parameters as +// `url.Values`. +func (r AccountStorageAnalyticsStoredParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountStorageAnalyticsStoredParamsQuery struct { + Dimensions param.Field[[]AccountStorageAnalyticsStoredParamsQueryDimension] `query:"dimensions"` + Filters param.Field[interface{}] `query:"filters"` + // Limit number of returned metrics. + Limit param.Field[int64] `query:"limit"` + Metrics param.Field[[]AccountStorageAnalyticsStoredParamsQueryMetric] `query:"metrics"` + // Start of time interval to query, defaults to 6 hours before request received. + Since param.Field[time.Time] `query:"since" format:"date-time"` + Sort param.Field[interface{}] `query:"sort"` + // End of time interval to query, defaults to current time. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes [AccountStorageAnalyticsStoredParamsQuery]'s query +// parameters as `url.Values`. +func (r AccountStorageAnalyticsStoredParamsQuery) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountStorageAnalyticsStoredParamsQueryDimension string + +const ( + AccountStorageAnalyticsStoredParamsQueryDimensionNamespaceID AccountStorageAnalyticsStoredParamsQueryDimension = "namespaceId" +) + +type AccountStorageAnalyticsStoredParamsQueryMetric string + +const ( + AccountStorageAnalyticsStoredParamsQueryMetricStoredBytes AccountStorageAnalyticsStoredParamsQueryMetric = "storedBytes" + AccountStorageAnalyticsStoredParamsQueryMetricStoredKeys AccountStorageAnalyticsStoredParamsQueryMetric = "storedKeys" +) diff --git a/accountstorageanalytics_test.go b/accountstorageanalytics_test.go new file mode 100644 index 00000000000..2d2a9b377b6 --- /dev/null +++ b/accountstorageanalytics_test.go @@ -0,0 +1,101 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStorageAnalyticsListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Analytics.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStorageAnalyticsListParams{ + Query: cloudflare.F(cloudflare.AccountStorageAnalyticsListParamsQuery{ + Dimensions: cloudflare.F([]cloudflare.AccountStorageAnalyticsListParamsQueryDimension{cloudflare.AccountStorageAnalyticsListParamsQueryDimensionAccountID, cloudflare.AccountStorageAnalyticsListParamsQueryDimensionResponseCode}), + Filters: cloudflare.F[any]("requestType==read AND responseCode!=200"), + Limit: cloudflare.F(int64(0)), + Metrics: cloudflare.F([]cloudflare.AccountStorageAnalyticsListParamsQueryMetric{cloudflare.AccountStorageAnalyticsListParamsQueryMetricRequests, cloudflare.AccountStorageAnalyticsListParamsQueryMetricReadKiB}), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F[any](map[string]interface{}{ + "0": "+requests", + "1": "-responseCode", + }), + Until: cloudflare.F(time.Now()), + }), + }, + ) + 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 TestAccountStorageAnalyticsStoredWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Analytics.Stored( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStorageAnalyticsStoredParams{ + Query: cloudflare.F(cloudflare.AccountStorageAnalyticsStoredParamsQuery{ + Dimensions: cloudflare.F([]cloudflare.AccountStorageAnalyticsStoredParamsQueryDimension{cloudflare.AccountStorageAnalyticsStoredParamsQueryDimensionNamespaceID}), + Filters: cloudflare.F[any]("namespaceId==a4e8cbb7-1b58-4990-925e-e026d40c4c64"), + Limit: cloudflare.F(int64(0)), + Metrics: cloudflare.F([]cloudflare.AccountStorageAnalyticsStoredParamsQueryMetric{cloudflare.AccountStorageAnalyticsStoredParamsQueryMetricStoredBytes, cloudflare.AccountStorageAnalyticsStoredParamsQueryMetricStoredKeys}), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F[any](map[string]interface{}{ + "0": "+storedBytes", + "1": "-namespaceId", + }), + Until: cloudflare.F(time.Now()), + }), + }, + ) + 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/accountstoragekv.go b/accountstoragekv.go new file mode 100644 index 00000000000..aa7e61804ea --- /dev/null +++ b/accountstoragekv.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStorageKvService 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 [NewAccountStorageKvService] method +// instead. +type AccountStorageKvService struct { + Options []option.RequestOption + Namespaces *AccountStorageKvNamespaceService +} + +// NewAccountStorageKvService 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 NewAccountStorageKvService(opts ...option.RequestOption) (r *AccountStorageKvService) { + r = &AccountStorageKvService{} + r.Options = opts + r.Namespaces = NewAccountStorageKvNamespaceService(opts...) + return +} diff --git a/accountstoragekvnamespace.go b/accountstoragekvnamespace.go new file mode 100644 index 00000000000..e9f61e4e3d6 --- /dev/null +++ b/accountstoragekvnamespace.go @@ -0,0 +1,440 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountStorageKvNamespaceService 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 +// [NewAccountStorageKvNamespaceService] method instead. +type AccountStorageKvNamespaceService struct { + Options []option.RequestOption + Bulks *AccountStorageKvNamespaceBulkService + Keys *AccountStorageKvNamespaceKeyService + Metadata *AccountStorageKvNamespaceMetadataService + Values *AccountStorageKvNamespaceValueService +} + +// NewAccountStorageKvNamespaceService 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 NewAccountStorageKvNamespaceService(opts ...option.RequestOption) (r *AccountStorageKvNamespaceService) { + r = &AccountStorageKvNamespaceService{} + r.Options = opts + r.Bulks = NewAccountStorageKvNamespaceBulkService(opts...) + r.Keys = NewAccountStorageKvNamespaceKeyService(opts...) + r.Metadata = NewAccountStorageKvNamespaceMetadataService(opts...) + r.Values = NewAccountStorageKvNamespaceValueService(opts...) + return +} + +// Modifies a namespace's title. +func (r *AccountStorageKvNamespaceService) Update(ctx context.Context, accountIdentifier string, namespaceIdentifier string, body AccountStorageKvNamespaceUpdateParams, opts ...option.RequestOption) (res *AccountStorageKvNamespaceUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", accountIdentifier, namespaceIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Returns the namespaces owned by an account. +func (r *AccountStorageKvNamespaceService) List(ctx context.Context, accountIdentifier string, query AccountStorageKvNamespaceListParams, opts ...option.RequestOption) (res *shared.Page[AccountStorageKvNamespaceListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Deletes the namespace corresponding to the given ID. +func (r *AccountStorageKvNamespaceService) Delete(ctx context.Context, accountIdentifier string, namespaceIdentifier string, opts ...option.RequestOption) (res *AccountStorageKvNamespaceDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", accountIdentifier, namespaceIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a namespace under the given title. A `400` is returned if the account +// already owns a namespace with this title. A namespace must be explicitly deleted +// to be replaced. +func (r *AccountStorageKvNamespaceService) WorkersKvNamespaceNewANamespace(ctx context.Context, accountIdentifier string, body AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceParams, opts ...option.RequestOption) (res *AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountStorageKvNamespaceUpdateResponse struct { + Errors []AccountStorageKvNamespaceUpdateResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceUpdateResponseMessage `json:"messages"` + Result AccountStorageKvNamespaceUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceUpdateResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceUpdateResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceUpdateResponseJSON contains the JSON metadata for the +// struct [AccountStorageKvNamespaceUpdateResponse] +type accountStorageKvNamespaceUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceUpdateResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountStorageKvNamespaceUpdateResponseError] +type accountStorageKvNamespaceUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceUpdateResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceUpdateResponseMessage] +type accountStorageKvNamespaceUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountStorageKvNamespaceUpdateResponseResultUnknown] or +// [shared.UnionString]. +type AccountStorageKvNamespaceUpdateResponseResult interface { + ImplementsAccountStorageKvNamespaceUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountStorageKvNamespaceUpdateResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceUpdateResponseSuccess bool + +const ( + AccountStorageKvNamespaceUpdateResponseSuccessTrue AccountStorageKvNamespaceUpdateResponseSuccess = true +) + +type AccountStorageKvNamespaceListResponse struct { + // Namespace identifier tag. + ID string `json:"id,required"` + // A human-readable string name for a Namespace. + Title string `json:"title,required"` + // True if keys written on the URL will be URL-decoded before storing. For example, + // if set to "true", a key written on the URL as "%3F" will be stored as "?". + SupportsURLEncoding bool `json:"supports_url_encoding"` + JSON accountStorageKvNamespaceListResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceListResponseJSON contains the JSON metadata for the +// struct [AccountStorageKvNamespaceListResponse] +type accountStorageKvNamespaceListResponseJSON struct { + ID apijson.Field + Title apijson.Field + SupportsURLEncoding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceDeleteResponse struct { + Errors []AccountStorageKvNamespaceDeleteResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceDeleteResponseMessage `json:"messages"` + Result AccountStorageKvNamespaceDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceDeleteResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceDeleteResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceDeleteResponseJSON contains the JSON metadata for the +// struct [AccountStorageKvNamespaceDeleteResponse] +type accountStorageKvNamespaceDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceDeleteResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountStorageKvNamespaceDeleteResponseError] +type accountStorageKvNamespaceDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceDeleteResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceDeleteResponseMessage] +type accountStorageKvNamespaceDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountStorageKvNamespaceDeleteResponseResultUnknown] or +// [shared.UnionString]. +type AccountStorageKvNamespaceDeleteResponseResult interface { + ImplementsAccountStorageKvNamespaceDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountStorageKvNamespaceDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceDeleteResponseSuccess bool + +const ( + AccountStorageKvNamespaceDeleteResponseSuccessTrue AccountStorageKvNamespaceDeleteResponseSuccess = true +) + +type AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponse struct { + Errors []AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseMessage `json:"messages"` + Result AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseJSON contains +// the JSON metadata for the struct +// [AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponse] +type accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseError] +type accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseMessage] +type accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseResult struct { + // Namespace identifier tag. + ID string `json:"id,required"` + // A human-readable string name for a Namespace. + Title string `json:"title,required"` + // True if keys written on the URL will be URL-decoded before storing. For example, + // if set to "true", a key written on the URL as "%3F" will be stored as "?". + SupportsURLEncoding bool `json:"supports_url_encoding"` + JSON accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseResultJSON `json:"-"` +} + +// accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseResult] +type accountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseResultJSON struct { + ID apijson.Field + Title apijson.Field + SupportsURLEncoding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseSuccess bool + +const ( + AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseSuccessTrue AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponseSuccess = true +) + +type AccountStorageKvNamespaceUpdateParams struct { + // A human-readable string name for a Namespace. + Title param.Field[string] `json:"title,required"` +} + +func (r AccountStorageKvNamespaceUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountStorageKvNamespaceListParams struct { + // Direction to order namespaces. + Direction param.Field[AccountStorageKvNamespaceListParamsDirection] `query:"direction"` + // Field to order results by. + Order param.Field[AccountStorageKvNamespaceListParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [AccountStorageKvNamespaceListParams]'s query parameters as +// `url.Values`. +func (r AccountStorageKvNamespaceListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order namespaces. +type AccountStorageKvNamespaceListParamsDirection string + +const ( + AccountStorageKvNamespaceListParamsDirectionAsc AccountStorageKvNamespaceListParamsDirection = "asc" + AccountStorageKvNamespaceListParamsDirectionDesc AccountStorageKvNamespaceListParamsDirection = "desc" +) + +// Field to order results by. +type AccountStorageKvNamespaceListParamsOrder string + +const ( + AccountStorageKvNamespaceListParamsOrderID AccountStorageKvNamespaceListParamsOrder = "id" + AccountStorageKvNamespaceListParamsOrderTitle AccountStorageKvNamespaceListParamsOrder = "title" +) + +type AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceParams struct { + // A human-readable string name for a Namespace. + Title param.Field[string] `json:"title,required"` +} + +func (r AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstoragekvnamespace_test.go b/accountstoragekvnamespace_test.go new file mode 100644 index 00000000000..a0cc400fa5d --- /dev/null +++ b/accountstoragekvnamespace_test.go @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStorageKvNamespaceUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + cloudflare.AccountStorageKvNamespaceUpdateParams{ + Title: cloudflare.F("My Own Namespace"), + }, + ) + 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 TestAccountStorageKvNamespaceListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStorageKvNamespaceListParams{ + Direction: cloudflare.F(cloudflare.AccountStorageKvNamespaceListParamsDirectionAsc), + Order: cloudflare.F(cloudflare.AccountStorageKvNamespaceListParamsOrderID), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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 TestAccountStorageKvNamespaceDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + ) + 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 TestAccountStorageKvNamespaceWorkersKvNamespaceNewANamespace(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.WorkersKvNamespaceNewANamespace( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceParams{ + Title: cloudflare.F("My Own Namespace"), + }, + ) + 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/accountstoragekvnamespacebulk.go b/accountstoragekvnamespacebulk.go new file mode 100644 index 00000000000..3ed781955e2 --- /dev/null +++ b/accountstoragekvnamespacebulk.go @@ -0,0 +1,275 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountStorageKvNamespaceBulkService 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 +// [NewAccountStorageKvNamespaceBulkService] method instead. +type AccountStorageKvNamespaceBulkService struct { + Options []option.RequestOption +} + +// NewAccountStorageKvNamespaceBulkService 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 NewAccountStorageKvNamespaceBulkService(opts ...option.RequestOption) (r *AccountStorageKvNamespaceBulkService) { + r = &AccountStorageKvNamespaceBulkService{} + r.Options = opts + return +} + +// Remove multiple KV pairs from the namespace. Body should be an array of up to +// 10,000 keys to be removed. +func (r *AccountStorageKvNamespaceBulkService) Delete(ctx context.Context, accountIdentifier string, namespaceIdentifier string, body AccountStorageKvNamespaceBulkDeleteParams, opts ...option.RequestOption) (res *AccountStorageKvNamespaceBulkDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", accountIdentifier, namespaceIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Write multiple keys and values at once. Body should be an array of up to 10,000 +// key-value pairs to be stored, along with optional expiration information. +// Existing values and expirations will be overwritten. If neither `expiration` nor +// `expiration_ttl` is specified, the key-value pair will never expire. If both are +// set, `expiration_ttl` is used and `expiration` is ignored. The entire request +// size must be 100 megabytes or less. +func (r *AccountStorageKvNamespaceBulkService) WorkersKvNamespaceWriteMultipleKeyValuePairs(ctx context.Context, accountIdentifier string, namespaceIdentifier string, body AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParams, opts ...option.RequestOption) (res *AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", accountIdentifier, namespaceIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountStorageKvNamespaceBulkDeleteResponse struct { + Errors []AccountStorageKvNamespaceBulkDeleteResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceBulkDeleteResponseMessage `json:"messages"` + Result AccountStorageKvNamespaceBulkDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceBulkDeleteResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceBulkDeleteResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceBulkDeleteResponseJSON contains the JSON metadata for +// the struct [AccountStorageKvNamespaceBulkDeleteResponse] +type accountStorageKvNamespaceBulkDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceBulkDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceBulkDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceBulkDeleteResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceBulkDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceBulkDeleteResponseError] +type accountStorageKvNamespaceBulkDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceBulkDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceBulkDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceBulkDeleteResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceBulkDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountStorageKvNamespaceBulkDeleteResponseMessage] +type accountStorageKvNamespaceBulkDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceBulkDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountStorageKvNamespaceBulkDeleteResponseResultUnknown] or +// [shared.UnionString]. +type AccountStorageKvNamespaceBulkDeleteResponseResult interface { + ImplementsAccountStorageKvNamespaceBulkDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountStorageKvNamespaceBulkDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceBulkDeleteResponseSuccess bool + +const ( + AccountStorageKvNamespaceBulkDeleteResponseSuccessTrue AccountStorageKvNamespaceBulkDeleteResponseSuccess = true +) + +type AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponse struct { + Errors []AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseMessage `json:"messages"` + Result AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseJSON +// contains the JSON metadata for the struct +// [AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponse] +type accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseError] +type accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseMessage] +type accountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseResultUnknown] +// or [shared.UnionString]. +type AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseResult interface { + ImplementsAccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseSuccess bool + +const ( + AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseSuccessTrue AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseSuccess = true +) + +type AccountStorageKvNamespaceBulkDeleteParams struct { + Body param.Field[[]string] `json:"body,required"` +} + +func (r AccountStorageKvNamespaceBulkDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParams struct { + Body param.Field[[]AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParamsBody] `json:"body,required"` +} + +func (r AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParamsBody struct { + // Whether or not the server should base64 decode the value before storing it. + // Useful for writing values that wouldn't otherwise be valid JSON strings, such as + // images. + Base64 param.Field[bool] `json:"base64"` + // The time, measured in number of seconds since the UNIX epoch, at which the key + // should expire. + Expiration param.Field[float64] `json:"expiration"` + // The number of seconds for which the key should be visible before it expires. At + // least 60. + ExpirationTtl param.Field[float64] `json:"expiration_ttl"` + // A key's name. The name may be at most 512 bytes. All printable, non-whitespace + // characters are valid. + Key param.Field[string] `json:"key"` + // Arbitrary JSON that is associated with a key. + Metadata param.Field[interface{}] `json:"metadata"` + // A UTF-8 encoded string to be stored, up to 25 MiB in length. + Value param.Field[string] `json:"value"` +} + +func (r AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstoragekvnamespacebulk_test.go b/accountstoragekvnamespacebulk_test.go new file mode 100644 index 00000000000..4c0a3e20b88 --- /dev/null +++ b/accountstoragekvnamespacebulk_test.go @@ -0,0 +1,107 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStorageKvNamespaceBulkDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Bulks.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + cloudflare.AccountStorageKvNamespaceBulkDeleteParams{ + Body: cloudflare.F([]string{"My-Key", "My-Key", "My-Key"}), + }, + ) + 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 TestAccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Bulks.WorkersKvNamespaceWriteMultipleKeyValuePairs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + cloudflare.AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParams{ + Body: cloudflare.F([]cloudflare.AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParamsBody{{ + Base64: cloudflare.F(true), + Expiration: cloudflare.F(1578435000.000000), + ExpirationTtl: cloudflare.F(300.000000), + Key: cloudflare.F("My-Key"), + Metadata: cloudflare.F[any](map[string]interface{}{ + "someMetadataKey": "someMetadataValue", + }), + Value: cloudflare.F("Some string"), + }, { + Base64: cloudflare.F(true), + Expiration: cloudflare.F(1578435000.000000), + ExpirationTtl: cloudflare.F(300.000000), + Key: cloudflare.F("My-Key"), + Metadata: cloudflare.F[any](map[string]interface{}{ + "someMetadataKey": "someMetadataValue", + }), + Value: cloudflare.F("Some string"), + }, { + Base64: cloudflare.F(true), + Expiration: cloudflare.F(1578435000.000000), + ExpirationTtl: cloudflare.F(300.000000), + Key: cloudflare.F("My-Key"), + Metadata: cloudflare.F[any](map[string]interface{}{ + "someMetadataKey": "someMetadataValue", + }), + Value: cloudflare.F("Some string"), + }}), + }, + ) + 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/accountstoragekvnamespacekey.go b/accountstoragekvnamespacekey.go new file mode 100644 index 00000000000..fbb7f0570d7 --- /dev/null +++ b/accountstoragekvnamespacekey.go @@ -0,0 +1,188 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStorageKvNamespaceKeyService 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 +// [NewAccountStorageKvNamespaceKeyService] method instead. +type AccountStorageKvNamespaceKeyService struct { + Options []option.RequestOption +} + +// NewAccountStorageKvNamespaceKeyService 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 NewAccountStorageKvNamespaceKeyService(opts ...option.RequestOption) (r *AccountStorageKvNamespaceKeyService) { + r = &AccountStorageKvNamespaceKeyService{} + r.Options = opts + return +} + +// Lists a namespace's keys. +func (r *AccountStorageKvNamespaceKeyService) List(ctx context.Context, accountIdentifier string, namespaceIdentifier string, query AccountStorageKvNamespaceKeyListParams, opts ...option.RequestOption) (res *AccountStorageKvNamespaceKeyListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/keys", accountIdentifier, namespaceIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountStorageKvNamespaceKeyListResponse struct { + Errors []AccountStorageKvNamespaceKeyListResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceKeyListResponseMessage `json:"messages"` + Result []AccountStorageKvNamespaceKeyListResponseResult `json:"result"` + ResultInfo AccountStorageKvNamespaceKeyListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountStorageKvNamespaceKeyListResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceKeyListResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceKeyListResponseJSON contains the JSON metadata for the +// struct [AccountStorageKvNamespaceKeyListResponse] +type accountStorageKvNamespaceKeyListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceKeyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceKeyListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceKeyListResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceKeyListResponseErrorJSON contains the JSON metadata for +// the struct [AccountStorageKvNamespaceKeyListResponseError] +type accountStorageKvNamespaceKeyListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceKeyListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceKeyListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceKeyListResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceKeyListResponseMessageJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceKeyListResponseMessage] +type accountStorageKvNamespaceKeyListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceKeyListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A name for a value. A value stored under a given key may be retrieved via the +// same key. +type AccountStorageKvNamespaceKeyListResponseResult struct { + // A key's name. The name may be at most 512 bytes. All printable, non-whitespace + // characters are valid. Use percent-encoding to define key names as part of a URL. + Name string `json:"name,required"` + // The time, measured in number of seconds since the UNIX epoch, at which the key + // will expire. This property is omitted for keys that will not expire. + Expiration float64 `json:"expiration"` + // Arbitrary JSON that is associated with a key. + Metadata interface{} `json:"metadata"` + JSON accountStorageKvNamespaceKeyListResponseResultJSON `json:"-"` +} + +// accountStorageKvNamespaceKeyListResponseResultJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceKeyListResponseResult] +type accountStorageKvNamespaceKeyListResponseResultJSON struct { + Name apijson.Field + Expiration apijson.Field + Metadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceKeyListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceKeyListResponseResultInfo struct { + // Total results returned based on your list parameters. + Count float64 `json:"count"` + // Opaque token indicating the position from which to continue when requesting the + // next set of records if the amount of list results was limited by the limit + // parameter. A valid value for the cursor can be obtained from the cursors object + // in the result_info structure. + Cursor string `json:"cursor"` + JSON accountStorageKvNamespaceKeyListResponseResultInfoJSON `json:"-"` +} + +// accountStorageKvNamespaceKeyListResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountStorageKvNamespaceKeyListResponseResultInfo] +type accountStorageKvNamespaceKeyListResponseResultInfoJSON struct { + Count apijson.Field + Cursor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceKeyListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceKeyListResponseSuccess bool + +const ( + AccountStorageKvNamespaceKeyListResponseSuccessTrue AccountStorageKvNamespaceKeyListResponseSuccess = true +) + +type AccountStorageKvNamespaceKeyListParams struct { + // Opaque token indicating the position from which to continue when requesting the + // next set of records if the amount of list results was limited by the limit + // parameter. A valid value for the cursor can be obtained from the `cursors` + // object in the `result_info` structure. + Cursor param.Field[string] `query:"cursor"` + // The number of keys to return. The cursor attribute may be used to iterate over + // the next batch of keys if there are more than the limit. + Limit param.Field[float64] `query:"limit"` + // A string prefix used to filter down which keys will be returned. Exact matches + // and any key names that begin with the prefix will be returned. + Prefix param.Field[string] `query:"prefix"` +} + +// URLQuery serializes [AccountStorageKvNamespaceKeyListParams]'s query parameters +// as `url.Values`. +func (r AccountStorageKvNamespaceKeyListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountstoragekvnamespacekey_test.go b/accountstoragekvnamespacekey_test.go new file mode 100644 index 00000000000..beb96e70517 --- /dev/null +++ b/accountstoragekvnamespacekey_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStorageKvNamespaceKeyListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Keys.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + cloudflare.AccountStorageKvNamespaceKeyListParams{ + Cursor: cloudflare.F("6Ck1la0VxJ0djhidm1MdX2FyDGxLKVeeHZZmORS_8XeSuhz9SjIJRaSa2lnsF01tQOHrfTGAP3R5X1Kv5iVUuMbNKhWNAXHOl6ePB0TUL8nw"), + Limit: cloudflare.F(10.000000), + Prefix: cloudflare.F("My-Prefix"), + }, + ) + 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/accountstoragekvnamespacemetadata.go b/accountstoragekvnamespacemetadata.go new file mode 100644 index 00000000000..4ef2d5c24f9 --- /dev/null +++ b/accountstoragekvnamespacemetadata.go @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStorageKvNamespaceMetadataService 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 +// [NewAccountStorageKvNamespaceMetadataService] method instead. +type AccountStorageKvNamespaceMetadataService struct { + Options []option.RequestOption +} + +// NewAccountStorageKvNamespaceMetadataService 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 NewAccountStorageKvNamespaceMetadataService(opts ...option.RequestOption) (r *AccountStorageKvNamespaceMetadataService) { + r = &AccountStorageKvNamespaceMetadataService{} + r.Options = opts + return +} + +// Returns the metadata associated with the given key in the given namespace. Use +// URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key +// name. +func (r *AccountStorageKvNamespaceMetadataService) Get(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string, opts ...option.RequestOption) (res *AccountStorageKvNamespaceMetadataGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/metadata/%s", accountIdentifier, namespaceIdentifier, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStorageKvNamespaceMetadataGetResponse struct { + Errors []AccountStorageKvNamespaceMetadataGetResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceMetadataGetResponseMessage `json:"messages"` + // Arbitrary JSON that is associated with a key. + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceMetadataGetResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceMetadataGetResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceMetadataGetResponseJSON contains the JSON metadata for +// the struct [AccountStorageKvNamespaceMetadataGetResponse] +type accountStorageKvNamespaceMetadataGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceMetadataGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceMetadataGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceMetadataGetResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceMetadataGetResponseErrorJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceMetadataGetResponseError] +type accountStorageKvNamespaceMetadataGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceMetadataGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceMetadataGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceMetadataGetResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceMetadataGetResponseMessageJSON contains the JSON +// metadata for the struct [AccountStorageKvNamespaceMetadataGetResponseMessage] +type accountStorageKvNamespaceMetadataGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceMetadataGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceMetadataGetResponseSuccess bool + +const ( + AccountStorageKvNamespaceMetadataGetResponseSuccessTrue AccountStorageKvNamespaceMetadataGetResponseSuccess = true +) diff --git a/accountstoragekvnamespacemetadata_test.go b/accountstoragekvnamespacemetadata_test.go new file mode 100644 index 00000000000..4f6d8b31369 --- /dev/null +++ b/accountstoragekvnamespacemetadata_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStorageKvNamespaceMetadataGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Metadata.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + "My-Key", + ) + 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/accountstoragekvnamespacevalue.go b/accountstoragekvnamespacevalue.go new file mode 100644 index 00000000000..6766cf4e749 --- /dev/null +++ b/accountstoragekvnamespacevalue.go @@ -0,0 +1,254 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountStorageKvNamespaceValueService 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 +// [NewAccountStorageKvNamespaceValueService] method instead. +type AccountStorageKvNamespaceValueService struct { + Options []option.RequestOption +} + +// NewAccountStorageKvNamespaceValueService 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 NewAccountStorageKvNamespaceValueService(opts ...option.RequestOption) (r *AccountStorageKvNamespaceValueService) { + r = &AccountStorageKvNamespaceValueService{} + r.Options = opts + return +} + +// Returns the value associated with the given key in the given namespace. Use +// URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key +// name. If the KV-pair is set to expire at some point, the expiration time as +// measured in seconds since the UNIX epoch will be returned in the `expiration` +// response header. +func (r *AccountStorageKvNamespaceValueService) Get(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string, opts ...option.RequestOption) (res *string, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", accountIdentifier, namespaceIdentifier, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Write a value identified by a key. Use URL-encoding to use special characters +// (for example, `:`, `!`, `%`) in the key name. Body should be the value to be +// stored along with JSON metadata to be associated with the key/value pair. +// Existing values, expirations, and metadata will be overwritten. If neither +// `expiration` nor `expiration_ttl` is specified, the key-value pair will never +// expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. +func (r *AccountStorageKvNamespaceValueService) Update(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string, body AccountStorageKvNamespaceValueUpdateParams, opts ...option.RequestOption) (res *AccountStorageKvNamespaceValueUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", accountIdentifier, namespaceIdentifier, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Remove a KV pair from the namespace. Use URL-encoding to use special characters +// (for example, `:`, `!`, `%`) in the key name. +func (r *AccountStorageKvNamespaceValueService) Delete(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string, opts ...option.RequestOption) (res *AccountStorageKvNamespaceValueDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", accountIdentifier, namespaceIdentifier, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AccountStorageKvNamespaceValueUpdateResponse struct { + Errors []AccountStorageKvNamespaceValueUpdateResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceValueUpdateResponseMessage `json:"messages"` + Result AccountStorageKvNamespaceValueUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceValueUpdateResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceValueUpdateResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceValueUpdateResponseJSON contains the JSON metadata for +// the struct [AccountStorageKvNamespaceValueUpdateResponse] +type accountStorageKvNamespaceValueUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceValueUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceValueUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceValueUpdateResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceValueUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceValueUpdateResponseError] +type accountStorageKvNamespaceValueUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceValueUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceValueUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceValueUpdateResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceValueUpdateResponseMessageJSON contains the JSON +// metadata for the struct [AccountStorageKvNamespaceValueUpdateResponseMessage] +type accountStorageKvNamespaceValueUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceValueUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountStorageKvNamespaceValueUpdateResponseResultUnknown] +// or [shared.UnionString]. +type AccountStorageKvNamespaceValueUpdateResponseResult interface { + ImplementsAccountStorageKvNamespaceValueUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountStorageKvNamespaceValueUpdateResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceValueUpdateResponseSuccess bool + +const ( + AccountStorageKvNamespaceValueUpdateResponseSuccessTrue AccountStorageKvNamespaceValueUpdateResponseSuccess = true +) + +type AccountStorageKvNamespaceValueDeleteResponse struct { + Errors []AccountStorageKvNamespaceValueDeleteResponseError `json:"errors"` + Messages []AccountStorageKvNamespaceValueDeleteResponseMessage `json:"messages"` + Result AccountStorageKvNamespaceValueDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStorageKvNamespaceValueDeleteResponseSuccess `json:"success"` + JSON accountStorageKvNamespaceValueDeleteResponseJSON `json:"-"` +} + +// accountStorageKvNamespaceValueDeleteResponseJSON contains the JSON metadata for +// the struct [AccountStorageKvNamespaceValueDeleteResponse] +type accountStorageKvNamespaceValueDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceValueDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceValueDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceValueDeleteResponseErrorJSON `json:"-"` +} + +// accountStorageKvNamespaceValueDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountStorageKvNamespaceValueDeleteResponseError] +type accountStorageKvNamespaceValueDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceValueDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStorageKvNamespaceValueDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStorageKvNamespaceValueDeleteResponseMessageJSON `json:"-"` +} + +// accountStorageKvNamespaceValueDeleteResponseMessageJSON contains the JSON +// metadata for the struct [AccountStorageKvNamespaceValueDeleteResponseMessage] +type accountStorageKvNamespaceValueDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStorageKvNamespaceValueDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountStorageKvNamespaceValueDeleteResponseResultUnknown] +// or [shared.UnionString]. +type AccountStorageKvNamespaceValueDeleteResponseResult interface { + ImplementsAccountStorageKvNamespaceValueDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountStorageKvNamespaceValueDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type AccountStorageKvNamespaceValueDeleteResponseSuccess bool + +const ( + AccountStorageKvNamespaceValueDeleteResponseSuccessTrue AccountStorageKvNamespaceValueDeleteResponseSuccess = true +) + +type AccountStorageKvNamespaceValueUpdateParams struct { + // Arbitrary JSON to be associated with a key/value pair. + Metadata param.Field[string] `json:"metadata,required"` + // A byte sequence to be stored, up to 25 MiB in length. + Value param.Field[string] `json:"value,required"` +} + +func (r AccountStorageKvNamespaceValueUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstoragekvnamespacevalue_test.go b/accountstoragekvnamespacevalue_test.go new file mode 100644 index 00000000000..46998e3ec96 --- /dev/null +++ b/accountstoragekvnamespacevalue_test.go @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStorageKvNamespaceValueGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Values.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + "My-Key", + ) + 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 TestAccountStorageKvNamespaceValueUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Values.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + "My-Key", + cloudflare.AccountStorageKvNamespaceValueUpdateParams{ + Metadata: cloudflare.F("{\"someMetadataKey\": \"someMetadataValue\"}"), + Value: cloudflare.F("Some Value"), + }, + ) + 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 TestAccountStorageKvNamespaceValueDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Storages.Kvs.Namespaces.Values.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0f2ac74b498b48028cb68387c421e279", + "My-Key", + ) + 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/accountstream.go b/accountstream.go new file mode 100644 index 00000000000..136e7c96edc --- /dev/null +++ b/accountstream.go @@ -0,0 +1,1180 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamService 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 [NewAccountStreamService] method +// instead. +type AccountStreamService struct { + Options []option.RequestOption + Clips *AccountStreamClipService + Copies *AccountStreamCopyService + DirectUploads *AccountStreamDirectUploadService + Keys *AccountStreamKeyService + LiveInputs *AccountStreamLiveInputService + Watermarks *AccountStreamWatermarkService + Webhooks *AccountStreamWebhookService + Captions *AccountStreamCaptionService + Downloads *AccountStreamDownloadService + Embeds *AccountStreamEmbedService + Tokens *AccountStreamTokenService + Audios *AccountStreamAudioService + StorageUsages *AccountStreamStorageUsageService +} + +// NewAccountStreamService 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 NewAccountStreamService(opts ...option.RequestOption) (r *AccountStreamService) { + r = &AccountStreamService{} + r.Options = opts + r.Clips = NewAccountStreamClipService(opts...) + r.Copies = NewAccountStreamCopyService(opts...) + r.DirectUploads = NewAccountStreamDirectUploadService(opts...) + r.Keys = NewAccountStreamKeyService(opts...) + r.LiveInputs = NewAccountStreamLiveInputService(opts...) + r.Watermarks = NewAccountStreamWatermarkService(opts...) + r.Webhooks = NewAccountStreamWebhookService(opts...) + r.Captions = NewAccountStreamCaptionService(opts...) + r.Downloads = NewAccountStreamDownloadService(opts...) + r.Embeds = NewAccountStreamEmbedService(opts...) + r.Tokens = NewAccountStreamTokenService(opts...) + r.Audios = NewAccountStreamAudioService(opts...) + r.StorageUsages = NewAccountStreamStorageUsageService(opts...) + return +} + +// Fetches details for a single video. +func (r *AccountStreamService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Edit details for a single video. +func (r *AccountStreamService) Update(ctx context.Context, accountIdentifier string, identifier string, body AccountStreamUpdateParams, opts ...option.RequestOption) (res *AccountStreamUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Deletes a video and its copies from Cloudflare Stream. +func (r *AccountStreamService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/stream/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Initiates a video upload using the TUS protocol. On success, the server responds +// with a status code 201 (created) and includes a `location` header to indicate +// where the content should be uploaded. Refer to https://tus.io for protocol +// details. +func (r *AccountStreamService) StreamVideosInitiateVideoUploadsUsingTus(ctx context.Context, accountIdentifier string, body AccountStreamStreamVideosInitiateVideoUploadsUsingTusParams, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/stream", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...) + return +} + +// Lists up to 1000 videos from a single request. For a specific range, refer to +// the optional parameters. +func (r *AccountStreamService) StreamVideosListVideos(ctx context.Context, accountIdentifier string, query AccountStreamStreamVideosListVideosParams, opts ...option.RequestOption) (res *AccountStreamStreamVideosListVideosResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountStreamGetResponse struct { + Errors []AccountStreamGetResponseError `json:"errors"` + Messages []AccountStreamGetResponseMessage `json:"messages"` + Result AccountStreamGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamGetResponseSuccess `json:"success"` + JSON accountStreamGetResponseJSON `json:"-"` +} + +// accountStreamGetResponseJSON contains the JSON metadata for the struct +// [AccountStreamGetResponse] +type accountStreamGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamGetResponseErrorJSON `json:"-"` +} + +// accountStreamGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountStreamGetResponseError] +type accountStreamGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamGetResponseMessageJSON `json:"-"` +} + +// accountStreamGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountStreamGetResponseMessage] +type accountStreamGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamGetResponseResult struct { + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // The date and time the media item was created. + Created time.Time `json:"created" format:"date-time"` + // A user-defined identifier for the media creator. + Creator string `json:"creator"` + // The duration of the video in seconds. A value of `-1` means the duration is + // unknown. The duration becomes available after the upload and before the video is + // ready. + Duration float64 `json:"duration"` + Input AccountStreamGetResponseResultInput `json:"input"` + // The live input ID used to upload a video with Stream Live. + LiveInput string `json:"liveInput"` + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds int64 `json:"maxDurationSeconds"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta interface{} `json:"meta"` + // The date and time the media item was last modified. + Modified time.Time `json:"modified" format:"date-time"` + Playback AccountStreamGetResponseResultPlayback `json:"playback"` + // The video's preview page URI. This field is omitted until encoding is complete. + Preview string `json:"preview" format:"uri"` + // Indicates whether the video is playable. The field is empty if the video is not + // ready for viewing or the live stream is still in progress. + ReadyToStream bool `json:"readyToStream"` + // Indicates the time at which the video became playable. The field is empty if the + // video is not ready for viewing or the live stream is still in progress. + ReadyToStreamAt time.Time `json:"readyToStreamAt" format:"date-time"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion time.Time `json:"scheduledDeletion" format:"date-time"` + // The size of the media item in bytes. + Size float64 `json:"size"` + // Specifies a detailed status for a video. If the `state` is `inprogress` or + // `error`, the `step` field returns `encoding` or `manifest`. If the `state` is + // `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the + // approximate percent of completion. If the `state` is `error`, `errorReasonCode` + // and `errorReasonText` provide additional details. + Status AccountStreamGetResponseResultStatus `json:"status"` + // The media item's thumbnail URI. This field is omitted until encoding is + // complete. + Thumbnail string `json:"thumbnail" format:"uri"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct float64 `json:"thumbnailTimestampPct"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + // The date and time the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // The date and time when the video upload URL is no longer valid for direct user + // uploads. + UploadExpiry time.Time `json:"uploadExpiry" format:"date-time"` + Watermark AccountStreamGetResponseResultWatermark `json:"watermark"` + JSON accountStreamGetResponseResultJSON `json:"-"` +} + +// accountStreamGetResponseResultJSON contains the JSON metadata for the struct +// [AccountStreamGetResponseResult] +type accountStreamGetResponseResultJSON struct { + AllowedOrigins apijson.Field + Created apijson.Field + Creator apijson.Field + Duration apijson.Field + Input apijson.Field + LiveInput apijson.Field + MaxDurationSeconds apijson.Field + Meta apijson.Field + Modified apijson.Field + Playback apijson.Field + Preview apijson.Field + ReadyToStream apijson.Field + ReadyToStreamAt apijson.Field + RequireSignedURLs apijson.Field + ScheduledDeletion apijson.Field + Size apijson.Field + Status apijson.Field + Thumbnail apijson.Field + ThumbnailTimestampPct apijson.Field + Uid apijson.Field + Uploaded apijson.Field + UploadExpiry apijson.Field + Watermark apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamGetResponseResultInput struct { + // The video height in pixels. A value of `-1` means the height is unknown. The + // value becomes available after the upload and before the video is ready. + Height int64 `json:"height"` + // The video width in pixels. A value of `-1` means the width is unknown. The value + // becomes available after the upload and before the video is ready. + Width int64 `json:"width"` + JSON accountStreamGetResponseResultInputJSON `json:"-"` +} + +// accountStreamGetResponseResultInputJSON contains the JSON metadata for the +// struct [AccountStreamGetResponseResultInput] +type accountStreamGetResponseResultInputJSON struct { + Height apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponseResultInput) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamGetResponseResultPlayback struct { + // DASH Media Presentation Description for the video. + Dash string `json:"dash"` + // The HLS manifest for the video. + Hls string `json:"hls"` + JSON accountStreamGetResponseResultPlaybackJSON `json:"-"` +} + +// accountStreamGetResponseResultPlaybackJSON contains the JSON metadata for the +// struct [AccountStreamGetResponseResultPlayback] +type accountStreamGetResponseResultPlaybackJSON struct { + Dash apijson.Field + Hls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponseResultPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies a detailed status for a video. If the `state` is `inprogress` or +// `error`, the `step` field returns `encoding` or `manifest`. If the `state` is +// `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the +// approximate percent of completion. If the `state` is `error`, `errorReasonCode` +// and `errorReasonText` provide additional details. +type AccountStreamGetResponseResultStatus struct { + // Specifies why the video failed to encode. This field is empty if the video is + // not in an `error` state. Preferred for programmatic use. + ErrorReasonCode string `json:"errorReasonCode"` + // Specifies why the video failed to encode using a human readable error message in + // English. This field is empty if the video is not in an `error` state. + ErrorReasonText string `json:"errorReasonText"` + // Indicates the size of the entire upload in bytes. The value must be a + // non-negative integer. + PctComplete string `json:"pctComplete"` + // Specifies the processing status for all quality levels for a video. + State AccountStreamGetResponseResultStatusState `json:"state"` + JSON accountStreamGetResponseResultStatusJSON `json:"-"` +} + +// accountStreamGetResponseResultStatusJSON contains the JSON metadata for the +// struct [AccountStreamGetResponseResultStatus] +type accountStreamGetResponseResultStatusJSON struct { + ErrorReasonCode apijson.Field + ErrorReasonText apijson.Field + PctComplete apijson.Field + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponseResultStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status for all quality levels for a video. +type AccountStreamGetResponseResultStatusState string + +const ( + AccountStreamGetResponseResultStatusStatePendingupload AccountStreamGetResponseResultStatusState = "pendingupload" + AccountStreamGetResponseResultStatusStateDownloading AccountStreamGetResponseResultStatusState = "downloading" + AccountStreamGetResponseResultStatusStateQueued AccountStreamGetResponseResultStatusState = "queued" + AccountStreamGetResponseResultStatusStateInprogress AccountStreamGetResponseResultStatusState = "inprogress" + AccountStreamGetResponseResultStatusStateReady AccountStreamGetResponseResultStatusState = "ready" + AccountStreamGetResponseResultStatusStateError AccountStreamGetResponseResultStatusState = "error" +) + +type AccountStreamGetResponseResultWatermark struct { + // The date and a time a watermark profile was created. + Created time.Time `json:"created" format:"date-time"` + // The source URL for a downloaded image. If the watermark profile was created via + // direct upload, this field is null. + DownloadedFrom string `json:"downloadedFrom"` + // The height of the image in pixels. + Height int64 `json:"height"` + // A short description of the watermark profile. + Name string `json:"name"` + // The translucency of the image. A value of `0.0` makes the image completely + // transparent, and `1.0` makes the image completely opaque. Note that if the image + // is already semi-transparent, setting this to `1.0` will not make the image + // completely opaque. + Opacity float64 `json:"opacity"` + // The whitespace between the adjacent edges (determined by position) of the video + // and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + // video width or length, as determined by the algorithm. + Padding float64 `json:"padding"` + // The location of the image. Valid positions are: `upperRight`, `upperLeft`, + // `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the + // `padding` parameter. + Position string `json:"position"` + // The size of the image relative to the overall size of the video. This parameter + // will adapt to horizontal and vertical videos automatically. `0.0` indicates no + // scaling (use the size of the image as-is), and `1.0 `fills the entire video. + Scale float64 `json:"scale"` + // The size of the image in bytes. + Size float64 `json:"size"` + // The unique identifier for a watermark profile. + Uid string `json:"uid"` + // The width of the image in pixels. + Width int64 `json:"width"` + JSON accountStreamGetResponseResultWatermarkJSON `json:"-"` +} + +// accountStreamGetResponseResultWatermarkJSON contains the JSON metadata for the +// struct [AccountStreamGetResponseResultWatermark] +type accountStreamGetResponseResultWatermarkJSON struct { + Created apijson.Field + DownloadedFrom apijson.Field + Height apijson.Field + Name apijson.Field + Opacity apijson.Field + Padding apijson.Field + Position apijson.Field + Scale apijson.Field + Size apijson.Field + Uid apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamGetResponseResultWatermark) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamGetResponseSuccess bool + +const ( + AccountStreamGetResponseSuccessTrue AccountStreamGetResponseSuccess = true +) + +type AccountStreamUpdateResponse struct { + Errors []AccountStreamUpdateResponseError `json:"errors"` + Messages []AccountStreamUpdateResponseMessage `json:"messages"` + Result AccountStreamUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamUpdateResponseSuccess `json:"success"` + JSON accountStreamUpdateResponseJSON `json:"-"` +} + +// accountStreamUpdateResponseJSON contains the JSON metadata for the struct +// [AccountStreamUpdateResponse] +type accountStreamUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamUpdateResponseErrorJSON `json:"-"` +} + +// accountStreamUpdateResponseErrorJSON contains the JSON metadata for the struct +// [AccountStreamUpdateResponseError] +type accountStreamUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamUpdateResponseMessageJSON `json:"-"` +} + +// accountStreamUpdateResponseMessageJSON contains the JSON metadata for the struct +// [AccountStreamUpdateResponseMessage] +type accountStreamUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamUpdateResponseResult struct { + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // The date and time the media item was created. + Created time.Time `json:"created" format:"date-time"` + // A user-defined identifier for the media creator. + Creator string `json:"creator"` + // The duration of the video in seconds. A value of `-1` means the duration is + // unknown. The duration becomes available after the upload and before the video is + // ready. + Duration float64 `json:"duration"` + Input AccountStreamUpdateResponseResultInput `json:"input"` + // The live input ID used to upload a video with Stream Live. + LiveInput string `json:"liveInput"` + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds int64 `json:"maxDurationSeconds"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta interface{} `json:"meta"` + // The date and time the media item was last modified. + Modified time.Time `json:"modified" format:"date-time"` + Playback AccountStreamUpdateResponseResultPlayback `json:"playback"` + // The video's preview page URI. This field is omitted until encoding is complete. + Preview string `json:"preview" format:"uri"` + // Indicates whether the video is playable. The field is empty if the video is not + // ready for viewing or the live stream is still in progress. + ReadyToStream bool `json:"readyToStream"` + // Indicates the time at which the video became playable. The field is empty if the + // video is not ready for viewing or the live stream is still in progress. + ReadyToStreamAt time.Time `json:"readyToStreamAt" format:"date-time"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion time.Time `json:"scheduledDeletion" format:"date-time"` + // The size of the media item in bytes. + Size float64 `json:"size"` + // Specifies a detailed status for a video. If the `state` is `inprogress` or + // `error`, the `step` field returns `encoding` or `manifest`. If the `state` is + // `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the + // approximate percent of completion. If the `state` is `error`, `errorReasonCode` + // and `errorReasonText` provide additional details. + Status AccountStreamUpdateResponseResultStatus `json:"status"` + // The media item's thumbnail URI. This field is omitted until encoding is + // complete. + Thumbnail string `json:"thumbnail" format:"uri"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct float64 `json:"thumbnailTimestampPct"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + // The date and time the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // The date and time when the video upload URL is no longer valid for direct user + // uploads. + UploadExpiry time.Time `json:"uploadExpiry" format:"date-time"` + Watermark AccountStreamUpdateResponseResultWatermark `json:"watermark"` + JSON accountStreamUpdateResponseResultJSON `json:"-"` +} + +// accountStreamUpdateResponseResultJSON contains the JSON metadata for the struct +// [AccountStreamUpdateResponseResult] +type accountStreamUpdateResponseResultJSON struct { + AllowedOrigins apijson.Field + Created apijson.Field + Creator apijson.Field + Duration apijson.Field + Input apijson.Field + LiveInput apijson.Field + MaxDurationSeconds apijson.Field + Meta apijson.Field + Modified apijson.Field + Playback apijson.Field + Preview apijson.Field + ReadyToStream apijson.Field + ReadyToStreamAt apijson.Field + RequireSignedURLs apijson.Field + ScheduledDeletion apijson.Field + Size apijson.Field + Status apijson.Field + Thumbnail apijson.Field + ThumbnailTimestampPct apijson.Field + Uid apijson.Field + Uploaded apijson.Field + UploadExpiry apijson.Field + Watermark apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamUpdateResponseResultInput struct { + // The video height in pixels. A value of `-1` means the height is unknown. The + // value becomes available after the upload and before the video is ready. + Height int64 `json:"height"` + // The video width in pixels. A value of `-1` means the width is unknown. The value + // becomes available after the upload and before the video is ready. + Width int64 `json:"width"` + JSON accountStreamUpdateResponseResultInputJSON `json:"-"` +} + +// accountStreamUpdateResponseResultInputJSON contains the JSON metadata for the +// struct [AccountStreamUpdateResponseResultInput] +type accountStreamUpdateResponseResultInputJSON struct { + Height apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponseResultInput) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamUpdateResponseResultPlayback struct { + // DASH Media Presentation Description for the video. + Dash string `json:"dash"` + // The HLS manifest for the video. + Hls string `json:"hls"` + JSON accountStreamUpdateResponseResultPlaybackJSON `json:"-"` +} + +// accountStreamUpdateResponseResultPlaybackJSON contains the JSON metadata for the +// struct [AccountStreamUpdateResponseResultPlayback] +type accountStreamUpdateResponseResultPlaybackJSON struct { + Dash apijson.Field + Hls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponseResultPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies a detailed status for a video. If the `state` is `inprogress` or +// `error`, the `step` field returns `encoding` or `manifest`. If the `state` is +// `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the +// approximate percent of completion. If the `state` is `error`, `errorReasonCode` +// and `errorReasonText` provide additional details. +type AccountStreamUpdateResponseResultStatus struct { + // Specifies why the video failed to encode. This field is empty if the video is + // not in an `error` state. Preferred for programmatic use. + ErrorReasonCode string `json:"errorReasonCode"` + // Specifies why the video failed to encode using a human readable error message in + // English. This field is empty if the video is not in an `error` state. + ErrorReasonText string `json:"errorReasonText"` + // Indicates the size of the entire upload in bytes. The value must be a + // non-negative integer. + PctComplete string `json:"pctComplete"` + // Specifies the processing status for all quality levels for a video. + State AccountStreamUpdateResponseResultStatusState `json:"state"` + JSON accountStreamUpdateResponseResultStatusJSON `json:"-"` +} + +// accountStreamUpdateResponseResultStatusJSON contains the JSON metadata for the +// struct [AccountStreamUpdateResponseResultStatus] +type accountStreamUpdateResponseResultStatusJSON struct { + ErrorReasonCode apijson.Field + ErrorReasonText apijson.Field + PctComplete apijson.Field + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponseResultStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status for all quality levels for a video. +type AccountStreamUpdateResponseResultStatusState string + +const ( + AccountStreamUpdateResponseResultStatusStatePendingupload AccountStreamUpdateResponseResultStatusState = "pendingupload" + AccountStreamUpdateResponseResultStatusStateDownloading AccountStreamUpdateResponseResultStatusState = "downloading" + AccountStreamUpdateResponseResultStatusStateQueued AccountStreamUpdateResponseResultStatusState = "queued" + AccountStreamUpdateResponseResultStatusStateInprogress AccountStreamUpdateResponseResultStatusState = "inprogress" + AccountStreamUpdateResponseResultStatusStateReady AccountStreamUpdateResponseResultStatusState = "ready" + AccountStreamUpdateResponseResultStatusStateError AccountStreamUpdateResponseResultStatusState = "error" +) + +type AccountStreamUpdateResponseResultWatermark struct { + // The date and a time a watermark profile was created. + Created time.Time `json:"created" format:"date-time"` + // The source URL for a downloaded image. If the watermark profile was created via + // direct upload, this field is null. + DownloadedFrom string `json:"downloadedFrom"` + // The height of the image in pixels. + Height int64 `json:"height"` + // A short description of the watermark profile. + Name string `json:"name"` + // The translucency of the image. A value of `0.0` makes the image completely + // transparent, and `1.0` makes the image completely opaque. Note that if the image + // is already semi-transparent, setting this to `1.0` will not make the image + // completely opaque. + Opacity float64 `json:"opacity"` + // The whitespace between the adjacent edges (determined by position) of the video + // and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + // video width or length, as determined by the algorithm. + Padding float64 `json:"padding"` + // The location of the image. Valid positions are: `upperRight`, `upperLeft`, + // `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the + // `padding` parameter. + Position string `json:"position"` + // The size of the image relative to the overall size of the video. This parameter + // will adapt to horizontal and vertical videos automatically. `0.0` indicates no + // scaling (use the size of the image as-is), and `1.0 `fills the entire video. + Scale float64 `json:"scale"` + // The size of the image in bytes. + Size float64 `json:"size"` + // The unique identifier for a watermark profile. + Uid string `json:"uid"` + // The width of the image in pixels. + Width int64 `json:"width"` + JSON accountStreamUpdateResponseResultWatermarkJSON `json:"-"` +} + +// accountStreamUpdateResponseResultWatermarkJSON contains the JSON metadata for +// the struct [AccountStreamUpdateResponseResultWatermark] +type accountStreamUpdateResponseResultWatermarkJSON struct { + Created apijson.Field + DownloadedFrom apijson.Field + Height apijson.Field + Name apijson.Field + Opacity apijson.Field + Padding apijson.Field + Position apijson.Field + Scale apijson.Field + Size apijson.Field + Uid apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamUpdateResponseResultWatermark) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamUpdateResponseSuccess bool + +const ( + AccountStreamUpdateResponseSuccessTrue AccountStreamUpdateResponseSuccess = true +) + +type AccountStreamStreamVideosListVideosResponse struct { + Errors []AccountStreamStreamVideosListVideosResponseError `json:"errors"` + Messages []AccountStreamStreamVideosListVideosResponseMessage `json:"messages"` + // The total number of remaining videos based on cursor position. + Range int64 `json:"range"` + Result []AccountStreamStreamVideosListVideosResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamStreamVideosListVideosResponseSuccess `json:"success"` + // The total number of videos that match the provided filters. + Total int64 `json:"total"` + JSON accountStreamStreamVideosListVideosResponseJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseJSON contains the JSON metadata for +// the struct [AccountStreamStreamVideosListVideosResponse] +type accountStreamStreamVideosListVideosResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Range apijson.Field + Result apijson.Field + Success apijson.Field + Total apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStreamVideosListVideosResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamStreamVideosListVideosResponseErrorJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseErrorJSON contains the JSON metadata +// for the struct [AccountStreamStreamVideosListVideosResponseError] +type accountStreamStreamVideosListVideosResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStreamVideosListVideosResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamStreamVideosListVideosResponseMessageJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseMessageJSON contains the JSON +// metadata for the struct [AccountStreamStreamVideosListVideosResponseMessage] +type accountStreamStreamVideosListVideosResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStreamVideosListVideosResponseResult struct { + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // The date and time the media item was created. + Created time.Time `json:"created" format:"date-time"` + // A user-defined identifier for the media creator. + Creator string `json:"creator"` + // The duration of the video in seconds. A value of `-1` means the duration is + // unknown. The duration becomes available after the upload and before the video is + // ready. + Duration float64 `json:"duration"` + Input AccountStreamStreamVideosListVideosResponseResultInput `json:"input"` + // The live input ID used to upload a video with Stream Live. + LiveInput string `json:"liveInput"` + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds int64 `json:"maxDurationSeconds"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta interface{} `json:"meta"` + // The date and time the media item was last modified. + Modified time.Time `json:"modified" format:"date-time"` + Playback AccountStreamStreamVideosListVideosResponseResultPlayback `json:"playback"` + // The video's preview page URI. This field is omitted until encoding is complete. + Preview string `json:"preview" format:"uri"` + // Indicates whether the video is playable. The field is empty if the video is not + // ready for viewing or the live stream is still in progress. + ReadyToStream bool `json:"readyToStream"` + // Indicates the time at which the video became playable. The field is empty if the + // video is not ready for viewing or the live stream is still in progress. + ReadyToStreamAt time.Time `json:"readyToStreamAt" format:"date-time"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion time.Time `json:"scheduledDeletion" format:"date-time"` + // The size of the media item in bytes. + Size float64 `json:"size"` + // Specifies a detailed status for a video. If the `state` is `inprogress` or + // `error`, the `step` field returns `encoding` or `manifest`. If the `state` is + // `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the + // approximate percent of completion. If the `state` is `error`, `errorReasonCode` + // and `errorReasonText` provide additional details. + Status AccountStreamStreamVideosListVideosResponseResultStatus `json:"status"` + // The media item's thumbnail URI. This field is omitted until encoding is + // complete. + Thumbnail string `json:"thumbnail" format:"uri"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct float64 `json:"thumbnailTimestampPct"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + // The date and time the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // The date and time when the video upload URL is no longer valid for direct user + // uploads. + UploadExpiry time.Time `json:"uploadExpiry" format:"date-time"` + Watermark AccountStreamStreamVideosListVideosResponseResultWatermark `json:"watermark"` + JSON accountStreamStreamVideosListVideosResponseResultJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseResultJSON contains the JSON metadata +// for the struct [AccountStreamStreamVideosListVideosResponseResult] +type accountStreamStreamVideosListVideosResponseResultJSON struct { + AllowedOrigins apijson.Field + Created apijson.Field + Creator apijson.Field + Duration apijson.Field + Input apijson.Field + LiveInput apijson.Field + MaxDurationSeconds apijson.Field + Meta apijson.Field + Modified apijson.Field + Playback apijson.Field + Preview apijson.Field + ReadyToStream apijson.Field + ReadyToStreamAt apijson.Field + RequireSignedURLs apijson.Field + ScheduledDeletion apijson.Field + Size apijson.Field + Status apijson.Field + Thumbnail apijson.Field + ThumbnailTimestampPct apijson.Field + Uid apijson.Field + Uploaded apijson.Field + UploadExpiry apijson.Field + Watermark apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStreamVideosListVideosResponseResultInput struct { + // The video height in pixels. A value of `-1` means the height is unknown. The + // value becomes available after the upload and before the video is ready. + Height int64 `json:"height"` + // The video width in pixels. A value of `-1` means the width is unknown. The value + // becomes available after the upload and before the video is ready. + Width int64 `json:"width"` + JSON accountStreamStreamVideosListVideosResponseResultInputJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseResultInputJSON contains the JSON +// metadata for the struct [AccountStreamStreamVideosListVideosResponseResultInput] +type accountStreamStreamVideosListVideosResponseResultInputJSON struct { + Height apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponseResultInput) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStreamVideosListVideosResponseResultPlayback struct { + // DASH Media Presentation Description for the video. + Dash string `json:"dash"` + // The HLS manifest for the video. + Hls string `json:"hls"` + JSON accountStreamStreamVideosListVideosResponseResultPlaybackJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseResultPlaybackJSON contains the JSON +// metadata for the struct +// [AccountStreamStreamVideosListVideosResponseResultPlayback] +type accountStreamStreamVideosListVideosResponseResultPlaybackJSON struct { + Dash apijson.Field + Hls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponseResultPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies a detailed status for a video. If the `state` is `inprogress` or +// `error`, the `step` field returns `encoding` or `manifest`. If the `state` is +// `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the +// approximate percent of completion. If the `state` is `error`, `errorReasonCode` +// and `errorReasonText` provide additional details. +type AccountStreamStreamVideosListVideosResponseResultStatus struct { + // Specifies why the video failed to encode. This field is empty if the video is + // not in an `error` state. Preferred for programmatic use. + ErrorReasonCode string `json:"errorReasonCode"` + // Specifies why the video failed to encode using a human readable error message in + // English. This field is empty if the video is not in an `error` state. + ErrorReasonText string `json:"errorReasonText"` + // Indicates the size of the entire upload in bytes. The value must be a + // non-negative integer. + PctComplete string `json:"pctComplete"` + // Specifies the processing status for all quality levels for a video. + State AccountStreamStreamVideosListVideosResponseResultStatusState `json:"state"` + JSON accountStreamStreamVideosListVideosResponseResultStatusJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseResultStatusJSON contains the JSON +// metadata for the struct +// [AccountStreamStreamVideosListVideosResponseResultStatus] +type accountStreamStreamVideosListVideosResponseResultStatusJSON struct { + ErrorReasonCode apijson.Field + ErrorReasonText apijson.Field + PctComplete apijson.Field + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponseResultStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status for all quality levels for a video. +type AccountStreamStreamVideosListVideosResponseResultStatusState string + +const ( + AccountStreamStreamVideosListVideosResponseResultStatusStatePendingupload AccountStreamStreamVideosListVideosResponseResultStatusState = "pendingupload" + AccountStreamStreamVideosListVideosResponseResultStatusStateDownloading AccountStreamStreamVideosListVideosResponseResultStatusState = "downloading" + AccountStreamStreamVideosListVideosResponseResultStatusStateQueued AccountStreamStreamVideosListVideosResponseResultStatusState = "queued" + AccountStreamStreamVideosListVideosResponseResultStatusStateInprogress AccountStreamStreamVideosListVideosResponseResultStatusState = "inprogress" + AccountStreamStreamVideosListVideosResponseResultStatusStateReady AccountStreamStreamVideosListVideosResponseResultStatusState = "ready" + AccountStreamStreamVideosListVideosResponseResultStatusStateError AccountStreamStreamVideosListVideosResponseResultStatusState = "error" +) + +type AccountStreamStreamVideosListVideosResponseResultWatermark struct { + // The date and a time a watermark profile was created. + Created time.Time `json:"created" format:"date-time"` + // The source URL for a downloaded image. If the watermark profile was created via + // direct upload, this field is null. + DownloadedFrom string `json:"downloadedFrom"` + // The height of the image in pixels. + Height int64 `json:"height"` + // A short description of the watermark profile. + Name string `json:"name"` + // The translucency of the image. A value of `0.0` makes the image completely + // transparent, and `1.0` makes the image completely opaque. Note that if the image + // is already semi-transparent, setting this to `1.0` will not make the image + // completely opaque. + Opacity float64 `json:"opacity"` + // The whitespace between the adjacent edges (determined by position) of the video + // and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + // video width or length, as determined by the algorithm. + Padding float64 `json:"padding"` + // The location of the image. Valid positions are: `upperRight`, `upperLeft`, + // `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the + // `padding` parameter. + Position string `json:"position"` + // The size of the image relative to the overall size of the video. This parameter + // will adapt to horizontal and vertical videos automatically. `0.0` indicates no + // scaling (use the size of the image as-is), and `1.0 `fills the entire video. + Scale float64 `json:"scale"` + // The size of the image in bytes. + Size float64 `json:"size"` + // The unique identifier for a watermark profile. + Uid string `json:"uid"` + // The width of the image in pixels. + Width int64 `json:"width"` + JSON accountStreamStreamVideosListVideosResponseResultWatermarkJSON `json:"-"` +} + +// accountStreamStreamVideosListVideosResponseResultWatermarkJSON contains the JSON +// metadata for the struct +// [AccountStreamStreamVideosListVideosResponseResultWatermark] +type accountStreamStreamVideosListVideosResponseResultWatermarkJSON struct { + Created apijson.Field + DownloadedFrom apijson.Field + Height apijson.Field + Name apijson.Field + Opacity apijson.Field + Padding apijson.Field + Position apijson.Field + Scale apijson.Field + Size apijson.Field + Uid apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStreamVideosListVideosResponseResultWatermark) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamStreamVideosListVideosResponseSuccess bool + +const ( + AccountStreamStreamVideosListVideosResponseSuccessTrue AccountStreamStreamVideosListVideosResponseSuccess = true +) + +type AccountStreamUpdateParams struct { + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins param.Field[[]string] `json:"allowedOrigins"` + // A user-defined identifier for the media creator. + Creator param.Field[string] `json:"creator"` + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds param.Field[int64] `json:"maxDurationSeconds"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta param.Field[interface{}] `json:"meta"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion param.Field[time.Time] `json:"scheduledDeletion" format:"date-time"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct param.Field[float64] `json:"thumbnailTimestampPct"` + // The date and time when the video upload URL is no longer valid for direct user + // uploads. + UploadExpiry param.Field[time.Time] `json:"uploadExpiry" format:"date-time"` +} + +func (r AccountStreamUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountStreamStreamVideosInitiateVideoUploadsUsingTusParams struct { + // Specifies the TUS protocol version. This value must be included in every upload + // request. Notes: The only supported version of TUS protocol is 1.0.0. + TusResumable param.Field[AccountStreamStreamVideosInitiateVideoUploadsUsingTusParamsTusResumable] `header:"Tus-Resumable,required"` + // Indicates the size of the entire upload in bytes. The value must be a + // non-negative integer. + UploadLength param.Field[int64] `header:"Upload-Length,required"` + // A user-defined identifier for the media creator. + UploadCreator param.Field[string] `header:"Upload-Creator"` + // Comma-separated key-value pairs following the TUS protocol specification. Values + // are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + // `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + UploadMetadata param.Field[string] `header:"Upload-Metadata"` +} + +// Specifies the TUS protocol version. This value must be included in every upload +// request. Notes: The only supported version of TUS protocol is 1.0.0. +type AccountStreamStreamVideosInitiateVideoUploadsUsingTusParamsTusResumable string + +const ( + AccountStreamStreamVideosInitiateVideoUploadsUsingTusParamsTusResumable1_0_0 AccountStreamStreamVideosInitiateVideoUploadsUsingTusParamsTusResumable = "1.0.0" +) + +type AccountStreamStreamVideosListVideosParams struct { + // Lists videos in ascending order of creation. + Asc param.Field[bool] `query:"asc"` + // A user-defined identifier for the media creator. + Creator param.Field[string] `query:"creator"` + // Lists videos created before the specified date. + End param.Field[time.Time] `query:"end" format:"date-time"` + // Includes the total number of videos associated with the submitted query + // parameters. + IncludeCounts param.Field[bool] `query:"include_counts"` + // Searches over the `name` key in the `meta` field. This field can be set with or + // after the upload request. + Search param.Field[string] `query:"search"` + // Lists videos created after the specified date. + Start param.Field[time.Time] `query:"start" format:"date-time"` + // Specifies the processing status for all quality levels for a video. + Status param.Field[AccountStreamStreamVideosListVideosParamsStatus] `query:"status"` + // Specifies whether the video is `vod` or `live`. + Type param.Field[string] `query:"type"` +} + +// URLQuery serializes [AccountStreamStreamVideosListVideosParams]'s query +// parameters as `url.Values`. +func (r AccountStreamStreamVideosListVideosParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Specifies the processing status for all quality levels for a video. +type AccountStreamStreamVideosListVideosParamsStatus string + +const ( + AccountStreamStreamVideosListVideosParamsStatusPendingupload AccountStreamStreamVideosListVideosParamsStatus = "pendingupload" + AccountStreamStreamVideosListVideosParamsStatusDownloading AccountStreamStreamVideosListVideosParamsStatus = "downloading" + AccountStreamStreamVideosListVideosParamsStatusQueued AccountStreamStreamVideosListVideosParamsStatus = "queued" + AccountStreamStreamVideosListVideosParamsStatusInprogress AccountStreamStreamVideosListVideosParamsStatus = "inprogress" + AccountStreamStreamVideosListVideosParamsStatusReady AccountStreamStreamVideosListVideosParamsStatus = "ready" + AccountStreamStreamVideosListVideosParamsStatusError AccountStreamStreamVideosListVideosParamsStatus = "error" +) diff --git a/accountstream_test.go b/accountstream_test.go new file mode 100644 index 00000000000..2860eedc432 --- /dev/null +++ b/accountstream_test.go @@ -0,0 +1,191 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountStreamUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + cloudflare.AccountStreamUpdateParams{ + AllowedOrigins: cloudflare.F([]string{"example.com"}), + Creator: cloudflare.F("creator-id_abcde12345"), + MaxDurationSeconds: cloudflare.F(int64(1)), + Meta: cloudflare.F[any](map[string]interface{}{ + "name": "video12345.mp4", + }), + RequireSignedURLs: cloudflare.F(true), + ScheduledDeletion: cloudflare.F(time.Now()), + ThumbnailTimestampPct: cloudflare.F(0.529241), + UploadExpiry: cloudflare.F(time.Now()), + }, + ) + 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 TestAccountStreamDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Streams.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountStreamStreamVideosInitiateVideoUploadsUsingTusWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Streams.StreamVideosInitiateVideoUploadsUsingTus( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamStreamVideosInitiateVideoUploadsUsingTusParams{ + TusResumable: cloudflare.F(cloudflare.AccountStreamStreamVideosInitiateVideoUploadsUsingTusParamsTusResumable1_0_0), + UploadLength: cloudflare.F(int64(0)), + UploadCreator: cloudflare.F("creator-id_abcde12345"), + UploadMetadata: cloudflare.F("name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20="), + }, + ) + 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 TestAccountStreamStreamVideosListVideosWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.StreamVideosListVideos( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamStreamVideosListVideosParams{ + Asc: cloudflare.F(true), + Creator: cloudflare.F("creator-id_abcde12345"), + End: cloudflare.F(time.Now()), + IncludeCounts: cloudflare.F(true), + Search: cloudflare.F("puppy.mp4"), + Start: cloudflare.F(time.Now()), + Status: cloudflare.F(cloudflare.AccountStreamStreamVideosListVideosParamsStatusInprogress), + Type: cloudflare.F("live"), + }, + ) + 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/accountstreamaudio.go b/accountstreamaudio.go new file mode 100644 index 00000000000..75ed4de0061 --- /dev/null +++ b/accountstreamaudio.go @@ -0,0 +1,366 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamAudioService 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 [NewAccountStreamAudioService] method +// instead. +type AccountStreamAudioService struct { + Options []option.RequestOption +} + +// NewAccountStreamAudioService 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 NewAccountStreamAudioService(opts ...option.RequestOption) (r *AccountStreamAudioService) { + r = &AccountStreamAudioService{} + r.Options = opts + return +} + +// Edits additional audio tracks on a video. Editing the default status of an audio +// track to `true` will mark all other audio tracks on the video default status to +// `false`. +func (r *AccountStreamAudioService) Update(ctx context.Context, accountIdentifier string, identifier string, audioIdentifier string, body AccountStreamAudioUpdateParams, opts ...option.RequestOption) (res *AccountStreamAudioUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/audio/%s", accountIdentifier, identifier, audioIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes additional audio tracks on a video. Deleting a default audio track is +// not allowed. You must assign another audio track as default prior to deletion. +func (r *AccountStreamAudioService) Delete(ctx context.Context, accountIdentifier string, identifier string, audioIdentifier string, opts ...option.RequestOption) (res *AccountStreamAudioDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/audio/%s", accountIdentifier, identifier, audioIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds an additional audio track to a video using the provided audio track URL. +func (r *AccountStreamAudioService) Copy(ctx context.Context, accountIdentifier string, identifier string, body AccountStreamAudioCopyParams, opts ...option.RequestOption) (res *AccountStreamAudioCopyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/audio/copy", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountStreamAudioUpdateResponse struct { + Errors []AccountStreamAudioUpdateResponseError `json:"errors"` + Messages []AccountStreamAudioUpdateResponseMessage `json:"messages"` + Result AccountStreamAudioUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamAudioUpdateResponseSuccess `json:"success"` + JSON accountStreamAudioUpdateResponseJSON `json:"-"` +} + +// accountStreamAudioUpdateResponseJSON contains the JSON metadata for the struct +// [AccountStreamAudioUpdateResponse] +type accountStreamAudioUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamAudioUpdateResponseErrorJSON `json:"-"` +} + +// accountStreamAudioUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamAudioUpdateResponseError] +type accountStreamAudioUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamAudioUpdateResponseMessageJSON `json:"-"` +} + +// accountStreamAudioUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamAudioUpdateResponseMessage] +type accountStreamAudioUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioUpdateResponseResult struct { + // Denotes whether the audio track will be played by default in a player. + Default bool `json:"default"` + // A string to uniquely identify the track amongst other audio track labels for the + // specified video. + Label string `json:"label"` + // Specifies the processing status of the video. + Status AccountStreamAudioUpdateResponseResultStatus `json:"status"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + JSON accountStreamAudioUpdateResponseResultJSON `json:"-"` +} + +// accountStreamAudioUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountStreamAudioUpdateResponseResult] +type accountStreamAudioUpdateResponseResultJSON struct { + Default apijson.Field + Label apijson.Field + Status apijson.Field + Uid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status of the video. +type AccountStreamAudioUpdateResponseResultStatus string + +const ( + AccountStreamAudioUpdateResponseResultStatusQueued AccountStreamAudioUpdateResponseResultStatus = "queued" + AccountStreamAudioUpdateResponseResultStatusReady AccountStreamAudioUpdateResponseResultStatus = "ready" + AccountStreamAudioUpdateResponseResultStatusError AccountStreamAudioUpdateResponseResultStatus = "error" +) + +// Whether the API call was successful +type AccountStreamAudioUpdateResponseSuccess bool + +const ( + AccountStreamAudioUpdateResponseSuccessTrue AccountStreamAudioUpdateResponseSuccess = true +) + +type AccountStreamAudioDeleteResponse struct { + Errors []AccountStreamAudioDeleteResponseError `json:"errors"` + Messages []AccountStreamAudioDeleteResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountStreamAudioDeleteResponseSuccess `json:"success"` + JSON accountStreamAudioDeleteResponseJSON `json:"-"` +} + +// accountStreamAudioDeleteResponseJSON contains the JSON metadata for the struct +// [AccountStreamAudioDeleteResponse] +type accountStreamAudioDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamAudioDeleteResponseErrorJSON `json:"-"` +} + +// accountStreamAudioDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamAudioDeleteResponseError] +type accountStreamAudioDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamAudioDeleteResponseMessageJSON `json:"-"` +} + +// accountStreamAudioDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamAudioDeleteResponseMessage] +type accountStreamAudioDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamAudioDeleteResponseSuccess bool + +const ( + AccountStreamAudioDeleteResponseSuccessTrue AccountStreamAudioDeleteResponseSuccess = true +) + +type AccountStreamAudioCopyResponse struct { + Errors []AccountStreamAudioCopyResponseError `json:"errors"` + Messages []AccountStreamAudioCopyResponseMessage `json:"messages"` + Result AccountStreamAudioCopyResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamAudioCopyResponseSuccess `json:"success"` + JSON accountStreamAudioCopyResponseJSON `json:"-"` +} + +// accountStreamAudioCopyResponseJSON contains the JSON metadata for the struct +// [AccountStreamAudioCopyResponse] +type accountStreamAudioCopyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioCopyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioCopyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamAudioCopyResponseErrorJSON `json:"-"` +} + +// accountStreamAudioCopyResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamAudioCopyResponseError] +type accountStreamAudioCopyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioCopyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioCopyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamAudioCopyResponseMessageJSON `json:"-"` +} + +// accountStreamAudioCopyResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamAudioCopyResponseMessage] +type accountStreamAudioCopyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioCopyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamAudioCopyResponseResult struct { + // Denotes whether the audio track will be played by default in a player. + Default bool `json:"default"` + // A string to uniquely identify the track amongst other audio track labels for the + // specified video. + Label string `json:"label"` + // Specifies the processing status of the video. + Status AccountStreamAudioCopyResponseResultStatus `json:"status"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + JSON accountStreamAudioCopyResponseResultJSON `json:"-"` +} + +// accountStreamAudioCopyResponseResultJSON contains the JSON metadata for the +// struct [AccountStreamAudioCopyResponseResult] +type accountStreamAudioCopyResponseResultJSON struct { + Default apijson.Field + Label apijson.Field + Status apijson.Field + Uid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamAudioCopyResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status of the video. +type AccountStreamAudioCopyResponseResultStatus string + +const ( + AccountStreamAudioCopyResponseResultStatusQueued AccountStreamAudioCopyResponseResultStatus = "queued" + AccountStreamAudioCopyResponseResultStatusReady AccountStreamAudioCopyResponseResultStatus = "ready" + AccountStreamAudioCopyResponseResultStatusError AccountStreamAudioCopyResponseResultStatus = "error" +) + +// Whether the API call was successful +type AccountStreamAudioCopyResponseSuccess bool + +const ( + AccountStreamAudioCopyResponseSuccessTrue AccountStreamAudioCopyResponseSuccess = true +) + +type AccountStreamAudioUpdateParams struct { + // Denotes whether the audio track will be played by default in a player. + Default param.Field[bool] `json:"default"` + // A string to uniquely identify the track amongst other audio track labels for the + // specified video. + Label param.Field[string] `json:"label"` +} + +func (r AccountStreamAudioUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountStreamAudioCopyParams struct { + // A string to uniquely identify the track amongst other audio track labels for the + // specified video. + Label param.Field[string] `json:"label,required"` + // An audio track URL. The server must be publicly routable and support `HTTP HEAD` + // requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` + // requests with a `content-range` header that includes the size of the file. + URL param.Field[string] `json:"url" format:"uri"` +} + +func (r AccountStreamAudioCopyParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamaudio_test.go b/accountstreamaudio_test.go new file mode 100644 index 00000000000..d1be21c2f6e --- /dev/null +++ b/accountstreamaudio_test.go @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamAudioUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Audios.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + "ea95132c15732412d22c1476fa83f27a", + cloudflare.AccountStreamAudioUpdateParams{ + Default: cloudflare.F(true), + Label: cloudflare.F("director commentary"), + }, + ) + 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 TestAccountStreamAudioDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Audios.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountStreamAudioCopyWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Audios.Copy( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + cloudflare.AccountStreamAudioCopyParams{ + Label: cloudflare.F("director commentary"), + URL: cloudflare.F("https://www.examplestorage.com/audio_file.mp3"), + }, + ) + 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/accountstreamcaption.go b/accountstreamcaption.go new file mode 100644 index 00000000000..ae077efc11c --- /dev/null +++ b/accountstreamcaption.go @@ -0,0 +1,298 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamCaptionService 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 [NewAccountStreamCaptionService] +// method instead. +type AccountStreamCaptionService struct { + Options []option.RequestOption +} + +// NewAccountStreamCaptionService 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 NewAccountStreamCaptionService(opts ...option.RequestOption) (r *AccountStreamCaptionService) { + r = &AccountStreamCaptionService{} + r.Options = opts + return +} + +// Uploads the caption or subtitle file to the endpoint for a specific BCP47 +// language. One caption or subtitle file per language is allowed. +func (r *AccountStreamCaptionService) Update(ctx context.Context, accountIdentifier string, identifier string, language string, body AccountStreamCaptionUpdateParams, opts ...option.RequestOption) (res *AccountStreamCaptionUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", accountIdentifier, identifier, language) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Removes the captions or subtitles from a video. +func (r *AccountStreamCaptionService) Delete(ctx context.Context, accountIdentifier string, identifier string, language string, opts ...option.RequestOption) (res *AccountStreamCaptionDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", accountIdentifier, identifier, language) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists the available captions or subtitles for a specific video. +func (r *AccountStreamCaptionService) StreamSubtitlesCaptionsListCaptionsOrSubtitles(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/captions", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStreamCaptionUpdateResponse struct { + Errors []AccountStreamCaptionUpdateResponseError `json:"errors"` + Messages []AccountStreamCaptionUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStreamCaptionUpdateResponseSuccess `json:"success"` + JSON accountStreamCaptionUpdateResponseJSON `json:"-"` +} + +// accountStreamCaptionUpdateResponseJSON contains the JSON metadata for the struct +// [AccountStreamCaptionUpdateResponse] +type accountStreamCaptionUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCaptionUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCaptionUpdateResponseErrorJSON `json:"-"` +} + +// accountStreamCaptionUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamCaptionUpdateResponseError] +type accountStreamCaptionUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCaptionUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCaptionUpdateResponseMessageJSON `json:"-"` +} + +// accountStreamCaptionUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamCaptionUpdateResponseMessage] +type accountStreamCaptionUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamCaptionUpdateResponseSuccess bool + +const ( + AccountStreamCaptionUpdateResponseSuccessTrue AccountStreamCaptionUpdateResponseSuccess = true +) + +type AccountStreamCaptionDeleteResponse struct { + Errors []AccountStreamCaptionDeleteResponseError `json:"errors"` + Messages []AccountStreamCaptionDeleteResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountStreamCaptionDeleteResponseSuccess `json:"success"` + JSON accountStreamCaptionDeleteResponseJSON `json:"-"` +} + +// accountStreamCaptionDeleteResponseJSON contains the JSON metadata for the struct +// [AccountStreamCaptionDeleteResponse] +type accountStreamCaptionDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCaptionDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCaptionDeleteResponseErrorJSON `json:"-"` +} + +// accountStreamCaptionDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamCaptionDeleteResponseError] +type accountStreamCaptionDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCaptionDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCaptionDeleteResponseMessageJSON `json:"-"` +} + +// accountStreamCaptionDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamCaptionDeleteResponseMessage] +type accountStreamCaptionDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamCaptionDeleteResponseSuccess bool + +const ( + AccountStreamCaptionDeleteResponseSuccessTrue AccountStreamCaptionDeleteResponseSuccess = true +) + +type AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponse struct { + Errors []AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseError `json:"errors"` + Messages []AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseMessage `json:"messages"` + Result []AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseSuccess `json:"success"` + JSON accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseJSON `json:"-"` +} + +// accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseJSON +// contains the JSON metadata for the struct +// [AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponse] +type accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseErrorJSON `json:"-"` +} + +// accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseError] +type accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseMessageJSON `json:"-"` +} + +// accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseMessage] +type accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseResult struct { + // The language label displayed in the native language to users. + Label string `json:"label"` + // The language tag in BCP 47 format. + Language string `json:"language"` + JSON accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseResultJSON `json:"-"` +} + +// accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseResult] +type accountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseResultJSON struct { + Label apijson.Field + Language apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseSuccess bool + +const ( + AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseSuccessTrue AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponseSuccess = true +) + +type AccountStreamCaptionUpdateParams struct { + // The WebVTT file containing the caption or subtitle content. + File param.Field[string] `json:"file,required"` +} + +func (r AccountStreamCaptionUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamcaption_test.go b/accountstreamcaption_test.go new file mode 100644 index 00000000000..2af92854273 --- /dev/null +++ b/accountstreamcaption_test.go @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamCaptionUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Captions.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + "tr", + cloudflare.AccountStreamCaptionUpdateParams{ + File: cloudflare.F("@/Users/kyle/Desktop/tr.vtt"), + }, + ) + 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 TestAccountStreamCaptionDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Captions.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + "tr", + ) + 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 TestAccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitles(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Captions.StreamSubtitlesCaptionsListCaptionsOrSubtitles( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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/accountstreamclip.go b/accountstreamclip.go new file mode 100644 index 00000000000..d45077c491e --- /dev/null +++ b/accountstreamclip.go @@ -0,0 +1,277 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamClipService 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 [NewAccountStreamClipService] method +// instead. +type AccountStreamClipService struct { + Options []option.RequestOption +} + +// NewAccountStreamClipService 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 NewAccountStreamClipService(opts ...option.RequestOption) (r *AccountStreamClipService) { + r = &AccountStreamClipService{} + r.Options = opts + return +} + +// Clips a video based on the specified start and end times provided in seconds. +func (r *AccountStreamClipService) StreamVideoClippingClipVideosGivenAStartAndEndTime(ctx context.Context, accountIdentifier string, body AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParams, opts ...option.RequestOption) (res *AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/clip", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponse struct { + Errors []AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseError `json:"errors"` + Messages []AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseMessage `json:"messages"` + Result AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseSuccess `json:"success"` + JSON accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseJSON `json:"-"` +} + +// accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseJSON +// contains the JSON metadata for the struct +// [AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponse] +type accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseErrorJSON `json:"-"` +} + +// accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseError] +type accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseMessageJSON `json:"-"` +} + +// accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseMessage] +type accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResult struct { + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // The unique video identifier (UID). + ClippedFromVideoUid string `json:"clippedFromVideoUID"` + // The date and time the clip was created. + Created time.Time `json:"created" format:"date-time"` + // A user-defined identifier for the media creator. + Creator string `json:"creator"` + // Specifies the end time for the video clip in seconds. + EndTimeSeconds int64 `json:"endTimeSeconds"` + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds int64 `json:"maxDurationSeconds"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta interface{} `json:"meta"` + // The date and time the live input was last modified. + Modified time.Time `json:"modified" format:"date-time"` + Playback AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultPlayback `json:"playback"` + // The video's preview page URI. This field is omitted until encoding is complete. + Preview string `json:"preview" format:"uri"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Specifies the start time for the video clip in seconds. + StartTimeSeconds int64 `json:"startTimeSeconds"` + // Specifies the processing status for all quality levels for a video. + Status AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus `json:"status"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct float64 `json:"thumbnailTimestampPct"` + Watermark AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultWatermark `json:"watermark"` + JSON accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultJSON `json:"-"` +} + +// accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResult] +type accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultJSON struct { + AllowedOrigins apijson.Field + ClippedFromVideoUid apijson.Field + Created apijson.Field + Creator apijson.Field + EndTimeSeconds apijson.Field + MaxDurationSeconds apijson.Field + Meta apijson.Field + Modified apijson.Field + Playback apijson.Field + Preview apijson.Field + RequireSignedURLs apijson.Field + StartTimeSeconds apijson.Field + Status apijson.Field + ThumbnailTimestampPct apijson.Field + Watermark apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultPlayback struct { + // DASH Media Presentation Description for the video. + Dash string `json:"dash"` + // The HLS manifest for the video. + Hls string `json:"hls"` + JSON accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultPlaybackJSON `json:"-"` +} + +// accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultPlaybackJSON +// contains the JSON metadata for the struct +// [AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultPlayback] +type accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultPlaybackJSON struct { + Dash apijson.Field + Hls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status for all quality levels for a video. +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus string + +const ( + AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatusPendingupload AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus = "pendingupload" + AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatusDownloading AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus = "downloading" + AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatusQueued AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus = "queued" + AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatusInprogress AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus = "inprogress" + AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatusReady AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus = "ready" + AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatusError AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultStatus = "error" +) + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultWatermark struct { + // The unique identifier for the watermark profile. + Uid string `json:"uid"` + JSON accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultWatermarkJSON `json:"-"` +} + +// accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultWatermarkJSON +// contains the JSON metadata for the struct +// [AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultWatermark] +type accountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultWatermarkJSON struct { + Uid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseResultWatermark) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseSuccess bool + +const ( + AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseSuccessTrue AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponseSuccess = true +) + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParams struct { + // The unique video identifier (UID). + ClippedFromVideoUid param.Field[string] `json:"clippedFromVideoUID,required"` + // Specifies the end time for the video clip in seconds. + EndTimeSeconds param.Field[int64] `json:"endTimeSeconds,required"` + // Specifies the start time for the video clip in seconds. + StartTimeSeconds param.Field[int64] `json:"startTimeSeconds,required"` + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins param.Field[[]string] `json:"allowedOrigins"` + // A user-defined identifier for the media creator. + Creator param.Field[string] `json:"creator"` + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds param.Field[int64] `json:"maxDurationSeconds"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct param.Field[float64] `json:"thumbnailTimestampPct"` + Watermark param.Field[AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParamsWatermark] `json:"watermark"` +} + +func (r AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParamsWatermark struct { + // The unique identifier for the watermark profile. + Uid param.Field[string] `json:"uid"` +} + +func (r AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParamsWatermark) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamclip_test.go b/accountstreamclip_test.go new file mode 100644 index 00000000000..deb5c64b474 --- /dev/null +++ b/accountstreamclip_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Clips.StreamVideoClippingClipVideosGivenAStartAndEndTime( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParams{ + ClippedFromVideoUid: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + EndTimeSeconds: cloudflare.F(int64(0)), + StartTimeSeconds: cloudflare.F(int64(0)), + AllowedOrigins: cloudflare.F([]string{"example.com"}), + Creator: cloudflare.F("creator-id_abcde12345"), + MaxDurationSeconds: cloudflare.F(int64(1)), + RequireSignedURLs: cloudflare.F(true), + ThumbnailTimestampPct: cloudflare.F(0.529241), + Watermark: cloudflare.F(cloudflare.AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParamsWatermark{ + Uid: cloudflare.F("ea95132c15732412d22c1476fa83f27a"), + }), + }, + ) + 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/accountstreamcopy.go b/accountstreamcopy.go new file mode 100644 index 00000000000..884bdb0ec54 --- /dev/null +++ b/accountstreamcopy.go @@ -0,0 +1,418 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamCopyService 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 [NewAccountStreamCopyService] method +// instead. +type AccountStreamCopyService struct { + Options []option.RequestOption +} + +// NewAccountStreamCopyService 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 NewAccountStreamCopyService(opts ...option.RequestOption) (r *AccountStreamCopyService) { + r = &AccountStreamCopyService{} + r.Options = opts + return +} + +// Uploads a video to Stream from a provided URL. +func (r *AccountStreamCopyService) StreamVideosUploadVideosFromAURL(ctx context.Context, accountIdentifier string, params AccountStreamCopyStreamVideosUploadVideosFromAURLParams, opts ...option.RequestOption) (res *AccountStreamCopyStreamVideosUploadVideosFromAurlResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/copy", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) + return +} + +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponse struct { + Errors []AccountStreamCopyStreamVideosUploadVideosFromAurlResponseError `json:"errors"` + Messages []AccountStreamCopyStreamVideosUploadVideosFromAurlResponseMessage `json:"messages"` + Result AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamCopyStreamVideosUploadVideosFromAurlResponseSuccess `json:"success"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseJSON contains the JSON +// metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponse] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseErrorJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponseError] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseMessageJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponseMessage] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResult struct { + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // The date and time the media item was created. + Created time.Time `json:"created" format:"date-time"` + // A user-defined identifier for the media creator. + Creator string `json:"creator"` + // The duration of the video in seconds. A value of `-1` means the duration is + // unknown. The duration becomes available after the upload and before the video is + // ready. + Duration float64 `json:"duration"` + Input AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultInput `json:"input"` + // The live input ID used to upload a video with Stream Live. + LiveInput string `json:"liveInput"` + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds int64 `json:"maxDurationSeconds"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta interface{} `json:"meta"` + // The date and time the media item was last modified. + Modified time.Time `json:"modified" format:"date-time"` + Playback AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultPlayback `json:"playback"` + // The video's preview page URI. This field is omitted until encoding is complete. + Preview string `json:"preview" format:"uri"` + // Indicates whether the video is playable. The field is empty if the video is not + // ready for viewing or the live stream is still in progress. + ReadyToStream bool `json:"readyToStream"` + // Indicates the time at which the video became playable. The field is empty if the + // video is not ready for viewing or the live stream is still in progress. + ReadyToStreamAt time.Time `json:"readyToStreamAt" format:"date-time"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion time.Time `json:"scheduledDeletion" format:"date-time"` + // The size of the media item in bytes. + Size float64 `json:"size"` + // Specifies a detailed status for a video. If the `state` is `inprogress` or + // `error`, the `step` field returns `encoding` or `manifest`. If the `state` is + // `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the + // approximate percent of completion. If the `state` is `error`, `errorReasonCode` + // and `errorReasonText` provide additional details. + Status AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatus `json:"status"` + // The media item's thumbnail URI. This field is omitted until encoding is + // complete. + Thumbnail string `json:"thumbnail" format:"uri"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct float64 `json:"thumbnailTimestampPct"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + // The date and time the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // The date and time when the video upload URL is no longer valid for direct user + // uploads. + UploadExpiry time.Time `json:"uploadExpiry" format:"date-time"` + Watermark AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultWatermark `json:"watermark"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultJSON contains the +// JSON metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResult] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultJSON struct { + AllowedOrigins apijson.Field + Created apijson.Field + Creator apijson.Field + Duration apijson.Field + Input apijson.Field + LiveInput apijson.Field + MaxDurationSeconds apijson.Field + Meta apijson.Field + Modified apijson.Field + Playback apijson.Field + Preview apijson.Field + ReadyToStream apijson.Field + ReadyToStreamAt apijson.Field + RequireSignedURLs apijson.Field + ScheduledDeletion apijson.Field + Size apijson.Field + Status apijson.Field + Thumbnail apijson.Field + ThumbnailTimestampPct apijson.Field + Uid apijson.Field + Uploaded apijson.Field + UploadExpiry apijson.Field + Watermark apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultInput struct { + // The video height in pixels. A value of `-1` means the height is unknown. The + // value becomes available after the upload and before the video is ready. + Height int64 `json:"height"` + // The video width in pixels. A value of `-1` means the width is unknown. The value + // becomes available after the upload and before the video is ready. + Width int64 `json:"width"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultInputJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultInputJSON +// contains the JSON metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultInput] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultInputJSON struct { + Height apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultInput) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultPlayback struct { + // DASH Media Presentation Description for the video. + Dash string `json:"dash"` + // The HLS manifest for the video. + Hls string `json:"hls"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultPlaybackJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultPlaybackJSON +// contains the JSON metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultPlayback] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultPlaybackJSON struct { + Dash apijson.Field + Hls apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies a detailed status for a video. If the `state` is `inprogress` or +// `error`, the `step` field returns `encoding` or `manifest`. If the `state` is +// `inprogress`, `pctComplete` returns a number between 0 and 100 to indicate the +// approximate percent of completion. If the `state` is `error`, `errorReasonCode` +// and `errorReasonText` provide additional details. +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatus struct { + // Specifies why the video failed to encode. This field is empty if the video is + // not in an `error` state. Preferred for programmatic use. + ErrorReasonCode string `json:"errorReasonCode"` + // Specifies why the video failed to encode using a human readable error message in + // English. This field is empty if the video is not in an `error` state. + ErrorReasonText string `json:"errorReasonText"` + // Indicates the size of the entire upload in bytes. The value must be a + // non-negative integer. + PctComplete string `json:"pctComplete"` + // Specifies the processing status for all quality levels for a video. + State AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState `json:"state"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusJSON +// contains the JSON metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatus] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusJSON struct { + ErrorReasonCode apijson.Field + ErrorReasonText apijson.Field + PctComplete apijson.Field + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status for all quality levels for a video. +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState string + +const ( + AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusStatePendingupload AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState = "pendingupload" + AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusStateDownloading AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState = "downloading" + AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusStateQueued AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState = "queued" + AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusStateInprogress AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState = "inprogress" + AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusStateReady AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState = "ready" + AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusStateError AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultStatusState = "error" +) + +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultWatermark struct { + // The date and a time a watermark profile was created. + Created time.Time `json:"created" format:"date-time"` + // The source URL for a downloaded image. If the watermark profile was created via + // direct upload, this field is null. + DownloadedFrom string `json:"downloadedFrom"` + // The height of the image in pixels. + Height int64 `json:"height"` + // A short description of the watermark profile. + Name string `json:"name"` + // The translucency of the image. A value of `0.0` makes the image completely + // transparent, and `1.0` makes the image completely opaque. Note that if the image + // is already semi-transparent, setting this to `1.0` will not make the image + // completely opaque. + Opacity float64 `json:"opacity"` + // The whitespace between the adjacent edges (determined by position) of the video + // and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + // video width or length, as determined by the algorithm. + Padding float64 `json:"padding"` + // The location of the image. Valid positions are: `upperRight`, `upperLeft`, + // `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the + // `padding` parameter. + Position string `json:"position"` + // The size of the image relative to the overall size of the video. This parameter + // will adapt to horizontal and vertical videos automatically. `0.0` indicates no + // scaling (use the size of the image as-is), and `1.0 `fills the entire video. + Scale float64 `json:"scale"` + // The size of the image in bytes. + Size float64 `json:"size"` + // The unique identifier for a watermark profile. + Uid string `json:"uid"` + // The width of the image in pixels. + Width int64 `json:"width"` + JSON accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultWatermarkJSON `json:"-"` +} + +// accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultWatermarkJSON +// contains the JSON metadata for the struct +// [AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultWatermark] +type accountStreamCopyStreamVideosUploadVideosFromAurlResponseResultWatermarkJSON struct { + Created apijson.Field + DownloadedFrom apijson.Field + Height apijson.Field + Name apijson.Field + Opacity apijson.Field + Padding apijson.Field + Position apijson.Field + Scale apijson.Field + Size apijson.Field + Uid apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamCopyStreamVideosUploadVideosFromAurlResponseResultWatermark) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamCopyStreamVideosUploadVideosFromAurlResponseSuccess bool + +const ( + AccountStreamCopyStreamVideosUploadVideosFromAurlResponseSuccessTrue AccountStreamCopyStreamVideosUploadVideosFromAurlResponseSuccess = true +) + +type AccountStreamCopyStreamVideosUploadVideosFromAURLParams struct { + // A video's URL. The server must be publicly routable and support `HTTP HEAD` + // requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` + // requests with a `content-range` header that includes the size of the file. + URL param.Field[string] `json:"url,required" format:"uri"` + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins param.Field[[]string] `json:"allowedOrigins"` + // A user-defined identifier for the media creator. + Creator param.Field[string] `json:"creator"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta param.Field[interface{}] `json:"meta"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion param.Field[time.Time] `json:"scheduledDeletion" format:"date-time"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct param.Field[float64] `json:"thumbnailTimestampPct"` + Watermark param.Field[AccountStreamCopyStreamVideosUploadVideosFromAurlParamsWatermark] `json:"watermark"` + // A user-defined identifier for the media creator. + UploadCreator param.Field[string] `header:"Upload-Creator"` + // Comma-separated key-value pairs following the TUS protocol specification. Values + // are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + // `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + UploadMetadata param.Field[string] `header:"Upload-Metadata"` +} + +func (r AccountStreamCopyStreamVideosUploadVideosFromAURLParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountStreamCopyStreamVideosUploadVideosFromAurlParamsWatermark struct { + // The unique identifier for the watermark profile. + Uid param.Field[string] `json:"uid"` +} + +func (r AccountStreamCopyStreamVideosUploadVideosFromAurlParamsWatermark) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamcopy_test.go b/accountstreamcopy_test.go new file mode 100644 index 00000000000..8cceec65aeb --- /dev/null +++ b/accountstreamcopy_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamCopyStreamVideosUploadVideosFromAURLWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Copies.StreamVideosUploadVideosFromAURL( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamCopyStreamVideosUploadVideosFromAURLParams{ + URL: cloudflare.F("https://example.com/myvideo.mp4"), + AllowedOrigins: cloudflare.F([]string{"example.com"}), + Creator: cloudflare.F("creator-id_abcde12345"), + Meta: cloudflare.F[any](map[string]interface{}{ + "name": "video12345.mp4", + }), + RequireSignedURLs: cloudflare.F(true), + ScheduledDeletion: cloudflare.F(time.Now()), + ThumbnailTimestampPct: cloudflare.F(0.529241), + Watermark: cloudflare.F(cloudflare.AccountStreamCopyStreamVideosUploadVideosFromAurlParamsWatermark{ + Uid: cloudflare.F("ea95132c15732412d22c1476fa83f27a"), + }), + UploadCreator: cloudflare.F("creator-id_abcde12345"), + UploadMetadata: cloudflare.F("name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20="), + }, + ) + 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/accountstreamdirectupload.go b/accountstreamdirectupload.go new file mode 100644 index 00000000000..4101ebac911 --- /dev/null +++ b/accountstreamdirectupload.go @@ -0,0 +1,249 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamDirectUploadService 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 +// [NewAccountStreamDirectUploadService] method instead. +type AccountStreamDirectUploadService struct { + Options []option.RequestOption +} + +// NewAccountStreamDirectUploadService 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 NewAccountStreamDirectUploadService(opts ...option.RequestOption) (r *AccountStreamDirectUploadService) { + r = &AccountStreamDirectUploadService{} + r.Options = opts + return +} + +// Creates a direct upload that allows video uploads without an API key. +func (r *AccountStreamDirectUploadService) StreamVideosUploadVideosViaDirectUploadURLs(ctx context.Context, accountIdentifier string, params AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParams, opts ...option.RequestOption) (res *AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/direct_upload", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) + return +} + +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponse struct { + Errors []AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseError `json:"errors"` + Messages []AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseMessage `json:"messages"` + Result AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseSuccess `json:"success"` + JSON accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseJSON `json:"-"` +} + +// accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseJSON +// contains the JSON metadata for the struct +// [AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponse] +type accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseErrorJSON `json:"-"` +} + +// accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseError] +type accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseMessageJSON `json:"-"` +} + +// accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseMessage] +type accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResult struct { + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion time.Time `json:"scheduledDeletion" format:"date-time"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + // The URL an unauthenticated upload can use for a single + // `HTTP POST multipart/form-data` request. + UploadURL string `json:"uploadURL"` + Watermark AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultWatermark `json:"watermark"` + JSON accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultJSON `json:"-"` +} + +// accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResult] +type accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultJSON struct { + ScheduledDeletion apijson.Field + Uid apijson.Field + UploadURL apijson.Field + Watermark apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultWatermark struct { + // The date and a time a watermark profile was created. + Created time.Time `json:"created" format:"date-time"` + // The source URL for a downloaded image. If the watermark profile was created via + // direct upload, this field is null. + DownloadedFrom string `json:"downloadedFrom"` + // The height of the image in pixels. + Height int64 `json:"height"` + // A short description of the watermark profile. + Name string `json:"name"` + // The translucency of the image. A value of `0.0` makes the image completely + // transparent, and `1.0` makes the image completely opaque. Note that if the image + // is already semi-transparent, setting this to `1.0` will not make the image + // completely opaque. + Opacity float64 `json:"opacity"` + // The whitespace between the adjacent edges (determined by position) of the video + // and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + // video width or length, as determined by the algorithm. + Padding float64 `json:"padding"` + // The location of the image. Valid positions are: `upperRight`, `upperLeft`, + // `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the + // `padding` parameter. + Position string `json:"position"` + // The size of the image relative to the overall size of the video. This parameter + // will adapt to horizontal and vertical videos automatically. `0.0` indicates no + // scaling (use the size of the image as-is), and `1.0 `fills the entire video. + Scale float64 `json:"scale"` + // The size of the image in bytes. + Size float64 `json:"size"` + // The unique identifier for a watermark profile. + Uid string `json:"uid"` + // The width of the image in pixels. + Width int64 `json:"width"` + JSON accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultWatermarkJSON `json:"-"` +} + +// accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultWatermarkJSON +// contains the JSON metadata for the struct +// [AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultWatermark] +type accountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultWatermarkJSON struct { + Created apijson.Field + DownloadedFrom apijson.Field + Height apijson.Field + Name apijson.Field + Opacity apijson.Field + Padding apijson.Field + Position apijson.Field + Scale apijson.Field + Size apijson.Field + Uid apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseResultWatermark) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseSuccess bool + +const ( + AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseSuccessTrue AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponseSuccess = true +) + +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParams struct { + // The maximum duration in seconds for a video upload. Can be set for a video that + // is not yet uploaded to limit its duration. Uploads that exceed the specified + // duration will fail during processing. A value of `-1` means the value is + // unknown. + MaxDurationSeconds param.Field[int64] `json:"maxDurationSeconds,required"` + // Lists the origins allowed to display the video. Enter allowed origin domains in + // an array and use `*` for wildcard subdomains. Empty arrays allow the video to be + // viewed on any origin. + AllowedOrigins param.Field[[]string] `json:"allowedOrigins"` + // A user-defined identifier for the media creator. + Creator param.Field[string] `json:"creator"` + // The date and time after upload when videos will not be accepted. + Expiry param.Field[time.Time] `json:"expiry" format:"date-time"` + // A user modifiable key-value store used to reference other systems of record for + // managing videos. + Meta param.Field[interface{}] `json:"meta"` + // Indicates whether the video can be a accessed using the UID. When set to `true`, + // a signed token must be generated with a signing key to view the video. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` + // Indicates the date and time at which the video will be deleted. Omit the field + // to indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. If specified, must be at least 30 days from upload time. + ScheduledDeletion param.Field[time.Time] `json:"scheduledDeletion" format:"date-time"` + // The timestamp for a thumbnail image calculated as a percentage value of the + // video's duration. To convert from a second-wise timestamp to a percentage, + // divide the desired timestamp by the total duration of the video. If this value + // is not set, the default thumbnail image is taken from 0s of the video. + ThumbnailTimestampPct param.Field[float64] `json:"thumbnailTimestampPct"` + Watermark param.Field[AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParamsWatermark] `json:"watermark"` + // A user-defined identifier for the media creator. + UploadCreator param.Field[string] `header:"Upload-Creator"` +} + +func (r AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParamsWatermark struct { + // The unique identifier for the watermark profile. + Uid param.Field[string] `json:"uid"` +} + +func (r AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParamsWatermark) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamdirectupload_test.go b/accountstreamdirectupload_test.go new file mode 100644 index 00000000000..a4f41d9c1b5 --- /dev/null +++ b/accountstreamdirectupload_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.DirectUploads.StreamVideosUploadVideosViaDirectUploadURLs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParams{ + MaxDurationSeconds: cloudflare.F(int64(1)), + AllowedOrigins: cloudflare.F([]string{"example.com"}), + Creator: cloudflare.F("creator-id_abcde12345"), + Expiry: cloudflare.F(time.Now()), + Meta: cloudflare.F[any](map[string]interface{}{ + "name": "video12345.mp4", + }), + RequireSignedURLs: cloudflare.F(true), + ScheduledDeletion: cloudflare.F(time.Now()), + ThumbnailTimestampPct: cloudflare.F(0.529241), + Watermark: cloudflare.F(cloudflare.AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParamsWatermark{ + Uid: cloudflare.F("ea95132c15732412d22c1476fa83f27a"), + }), + UploadCreator: cloudflare.F("creator-id_abcde12345"), + }, + ) + 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/accountstreamdownload.go b/accountstreamdownload.go new file mode 100644 index 00000000000..8e089f8cee3 --- /dev/null +++ b/accountstreamdownload.go @@ -0,0 +1,268 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamDownloadService 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 [NewAccountStreamDownloadService] +// method instead. +type AccountStreamDownloadService struct { + Options []option.RequestOption +} + +// NewAccountStreamDownloadService 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 NewAccountStreamDownloadService(opts ...option.RequestOption) (r *AccountStreamDownloadService) { + r = &AccountStreamDownloadService{} + r.Options = opts + return +} + +// Delete the downloads for a video. +func (r *AccountStreamDownloadService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamDownloadDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/downloads", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a download for a video when a video is ready to view. +func (r *AccountStreamDownloadService) StreamMP4DownloadsNewDownloads(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/downloads", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Lists the downloads created for a video. +func (r *AccountStreamDownloadService) StreamMP4DownloadsListDownloads(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamDownloadStreamMP4DownloadsListDownloadsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/downloads", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStreamDownloadDeleteResponse struct { + Errors []AccountStreamDownloadDeleteResponseError `json:"errors"` + Messages []AccountStreamDownloadDeleteResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountStreamDownloadDeleteResponseSuccess `json:"success"` + JSON accountStreamDownloadDeleteResponseJSON `json:"-"` +} + +// accountStreamDownloadDeleteResponseJSON contains the JSON metadata for the +// struct [AccountStreamDownloadDeleteResponse] +type accountStreamDownloadDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDownloadDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDownloadDeleteResponseErrorJSON `json:"-"` +} + +// accountStreamDownloadDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamDownloadDeleteResponseError] +type accountStreamDownloadDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDownloadDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDownloadDeleteResponseMessageJSON `json:"-"` +} + +// accountStreamDownloadDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountStreamDownloadDeleteResponseMessage] +type accountStreamDownloadDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamDownloadDeleteResponseSuccess bool + +const ( + AccountStreamDownloadDeleteResponseSuccessTrue AccountStreamDownloadDeleteResponseSuccess = true +) + +type AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponse struct { + Errors []AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseError `json:"errors"` + Messages []AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseSuccess `json:"success"` + JSON accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseJSON `json:"-"` +} + +// accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseJSON contains the +// JSON metadata for the struct +// [AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponse] +type accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseErrorJSON `json:"-"` +} + +// accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseError] +type accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseMessageJSON `json:"-"` +} + +// accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseMessage] +type accountStreamDownloadStreamMP4DownloadsNewDownloadsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseSuccess bool + +const ( + AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseSuccessTrue AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponseSuccess = true +) + +type AccountStreamDownloadStreamMP4DownloadsListDownloadsResponse struct { + Errors []AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseError `json:"errors"` + Messages []AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseSuccess `json:"success"` + JSON accountStreamDownloadStreamMP4DownloadsListDownloadsResponseJSON `json:"-"` +} + +// accountStreamDownloadStreamMP4DownloadsListDownloadsResponseJSON contains the +// JSON metadata for the struct +// [AccountStreamDownloadStreamMP4DownloadsListDownloadsResponse] +type accountStreamDownloadStreamMP4DownloadsListDownloadsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadStreamMP4DownloadsListDownloadsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDownloadStreamMP4DownloadsListDownloadsResponseErrorJSON `json:"-"` +} + +// accountStreamDownloadStreamMP4DownloadsListDownloadsResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseError] +type accountStreamDownloadStreamMP4DownloadsListDownloadsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamDownloadStreamMP4DownloadsListDownloadsResponseMessageJSON `json:"-"` +} + +// accountStreamDownloadStreamMP4DownloadsListDownloadsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseMessage] +type accountStreamDownloadStreamMP4DownloadsListDownloadsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseSuccess bool + +const ( + AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseSuccessTrue AccountStreamDownloadStreamMP4DownloadsListDownloadsResponseSuccess = true +) diff --git a/accountstreamdownload_test.go b/accountstreamdownload_test.go new file mode 100644 index 00000000000..edaad00d498 --- /dev/null +++ b/accountstreamdownload_test.go @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamDownloadDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Downloads.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountStreamDownloadStreamMP4DownloadsNewDownloads(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Downloads.StreamMP4DownloadsNewDownloads( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountStreamDownloadStreamMP4DownloadsListDownloads(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Downloads.StreamMP4DownloadsListDownloads( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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/accountstreamembed.go b/accountstreamembed.go new file mode 100644 index 00000000000..82663a0dd47 --- /dev/null +++ b/accountstreamembed.go @@ -0,0 +1,42 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamEmbedService 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 [NewAccountStreamEmbedService] method +// instead. +type AccountStreamEmbedService struct { + Options []option.RequestOption +} + +// NewAccountStreamEmbedService 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 NewAccountStreamEmbedService(opts ...option.RequestOption) (r *AccountStreamEmbedService) { + r = &AccountStreamEmbedService{} + r.Options = opts + return +} + +// Fetches an HTML code snippet to embed a video in a web page delivered through +// Cloudflare. On success, returns an HTML fragment for use on web pages to display +// a video. On failure, returns a JSON response body. +func (r *AccountStreamEmbedService) List(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamEmbedListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/embed", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStreamEmbedListResponse = interface{} diff --git a/accountstreamembed_test.go b/accountstreamembed_test.go new file mode 100644 index 00000000000..760476ae99b --- /dev/null +++ b/accountstreamembed_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamEmbedList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Embeds.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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/accountstreamkey.go b/accountstreamkey.go new file mode 100644 index 00000000000..b368119e024 --- /dev/null +++ b/accountstreamkey.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamKeyService 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 [NewAccountStreamKeyService] method +// instead. +type AccountStreamKeyService struct { + Options []option.RequestOption +} + +// NewAccountStreamKeyService 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 NewAccountStreamKeyService(opts ...option.RequestOption) (r *AccountStreamKeyService) { + r = &AccountStreamKeyService{} + r.Options = opts + return +} + +// Deletes signing keys and revokes all signed URLs generated with the key. +func (r *AccountStreamKeyService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamKeyDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/keys/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates an RSA private key in PEM and JWK formats. Key files are only displayed +// once after creation. Keys are created, used, and deleted independently of +// videos, and every key can sign any video. +func (r *AccountStreamKeyService) StreamSigningKeysNewSigningKeys(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountStreamKeyStreamSigningKeysNewSigningKeysResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/keys", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Lists the video ID and creation date and time when a signing key was created. +func (r *AccountStreamKeyService) StreamSigningKeysListSigningKeys(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountStreamKeyStreamSigningKeysListSigningKeysResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/keys", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStreamKeyDeleteResponse struct { + Errors []AccountStreamKeyDeleteResponseError `json:"errors"` + Messages []AccountStreamKeyDeleteResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountStreamKeyDeleteResponseSuccess `json:"success"` + JSON accountStreamKeyDeleteResponseJSON `json:"-"` +} + +// accountStreamKeyDeleteResponseJSON contains the JSON metadata for the struct +// [AccountStreamKeyDeleteResponse] +type accountStreamKeyDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamKeyDeleteResponseErrorJSON `json:"-"` +} + +// accountStreamKeyDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamKeyDeleteResponseError] +type accountStreamKeyDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamKeyDeleteResponseMessageJSON `json:"-"` +} + +// accountStreamKeyDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamKeyDeleteResponseMessage] +type accountStreamKeyDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamKeyDeleteResponseSuccess bool + +const ( + AccountStreamKeyDeleteResponseSuccessTrue AccountStreamKeyDeleteResponseSuccess = true +) + +type AccountStreamKeyStreamSigningKeysNewSigningKeysResponse struct { + Errors []AccountStreamKeyStreamSigningKeysNewSigningKeysResponseError `json:"errors"` + Messages []AccountStreamKeyStreamSigningKeysNewSigningKeysResponseMessage `json:"messages"` + Result AccountStreamKeyStreamSigningKeysNewSigningKeysResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamKeyStreamSigningKeysNewSigningKeysResponseSuccess `json:"success"` + JSON accountStreamKeyStreamSigningKeysNewSigningKeysResponseJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysNewSigningKeysResponseJSON contains the JSON +// metadata for the struct +// [AccountStreamKeyStreamSigningKeysNewSigningKeysResponse] +type accountStreamKeyStreamSigningKeysNewSigningKeysResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysNewSigningKeysResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyStreamSigningKeysNewSigningKeysResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamKeyStreamSigningKeysNewSigningKeysResponseErrorJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysNewSigningKeysResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountStreamKeyStreamSigningKeysNewSigningKeysResponseError] +type accountStreamKeyStreamSigningKeysNewSigningKeysResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysNewSigningKeysResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyStreamSigningKeysNewSigningKeysResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamKeyStreamSigningKeysNewSigningKeysResponseMessageJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysNewSigningKeysResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountStreamKeyStreamSigningKeysNewSigningKeysResponseMessage] +type accountStreamKeyStreamSigningKeysNewSigningKeysResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysNewSigningKeysResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyStreamSigningKeysNewSigningKeysResponseResult struct { + // Identifier + ID string `json:"id"` + // The date and time a signing key was created. + Created time.Time `json:"created" format:"date-time"` + // The signing key in JWK format. + Jwk string `json:"jwk"` + // The signing key in PEM format. + Pem string `json:"pem"` + JSON accountStreamKeyStreamSigningKeysNewSigningKeysResponseResultJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysNewSigningKeysResponseResultJSON contains the +// JSON metadata for the struct +// [AccountStreamKeyStreamSigningKeysNewSigningKeysResponseResult] +type accountStreamKeyStreamSigningKeysNewSigningKeysResponseResultJSON struct { + ID apijson.Field + Created apijson.Field + Jwk apijson.Field + Pem apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysNewSigningKeysResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamKeyStreamSigningKeysNewSigningKeysResponseSuccess bool + +const ( + AccountStreamKeyStreamSigningKeysNewSigningKeysResponseSuccessTrue AccountStreamKeyStreamSigningKeysNewSigningKeysResponseSuccess = true +) + +type AccountStreamKeyStreamSigningKeysListSigningKeysResponse struct { + Errors []AccountStreamKeyStreamSigningKeysListSigningKeysResponseError `json:"errors"` + Messages []AccountStreamKeyStreamSigningKeysListSigningKeysResponseMessage `json:"messages"` + Result []AccountStreamKeyStreamSigningKeysListSigningKeysResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamKeyStreamSigningKeysListSigningKeysResponseSuccess `json:"success"` + JSON accountStreamKeyStreamSigningKeysListSigningKeysResponseJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysListSigningKeysResponseJSON contains the JSON +// metadata for the struct +// [AccountStreamKeyStreamSigningKeysListSigningKeysResponse] +type accountStreamKeyStreamSigningKeysListSigningKeysResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysListSigningKeysResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyStreamSigningKeysListSigningKeysResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamKeyStreamSigningKeysListSigningKeysResponseErrorJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysListSigningKeysResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountStreamKeyStreamSigningKeysListSigningKeysResponseError] +type accountStreamKeyStreamSigningKeysListSigningKeysResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysListSigningKeysResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyStreamSigningKeysListSigningKeysResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamKeyStreamSigningKeysListSigningKeysResponseMessageJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysListSigningKeysResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountStreamKeyStreamSigningKeysListSigningKeysResponseMessage] +type accountStreamKeyStreamSigningKeysListSigningKeysResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysListSigningKeysResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamKeyStreamSigningKeysListSigningKeysResponseResult struct { + // Identifier + ID string `json:"id"` + // The date and time a signing key was created. + Created time.Time `json:"created" format:"date-time"` + JSON accountStreamKeyStreamSigningKeysListSigningKeysResponseResultJSON `json:"-"` +} + +// accountStreamKeyStreamSigningKeysListSigningKeysResponseResultJSON contains the +// JSON metadata for the struct +// [AccountStreamKeyStreamSigningKeysListSigningKeysResponseResult] +type accountStreamKeyStreamSigningKeysListSigningKeysResponseResultJSON struct { + ID apijson.Field + Created apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamKeyStreamSigningKeysListSigningKeysResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamKeyStreamSigningKeysListSigningKeysResponseSuccess bool + +const ( + AccountStreamKeyStreamSigningKeysListSigningKeysResponseSuccessTrue AccountStreamKeyStreamSigningKeysListSigningKeysResponseSuccess = true +) diff --git a/accountstreamkey_test.go b/accountstreamkey_test.go new file mode 100644 index 00000000000..c317cea5bd4 --- /dev/null +++ b/accountstreamkey_test.go @@ -0,0 +1,96 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamKeyDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Keys.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAccountStreamKeyStreamSigningKeysNewSigningKeys(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Keys.StreamSigningKeysNewSigningKeys(context.TODO(), "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()) + } +} + +func TestAccountStreamKeyStreamSigningKeysListSigningKeys(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Keys.StreamSigningKeysListSigningKeys(context.TODO(), "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/accountstreamliveinput.go b/accountstreamliveinput.go new file mode 100644 index 00000000000..3c79477ad8d --- /dev/null +++ b/accountstreamliveinput.go @@ -0,0 +1,1336 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamLiveInputService 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 [NewAccountStreamLiveInputService] +// method instead. +type AccountStreamLiveInputService struct { + Options []option.RequestOption + Outputs *AccountStreamLiveInputOutputService +} + +// NewAccountStreamLiveInputService 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 NewAccountStreamLiveInputService(opts ...option.RequestOption) (r *AccountStreamLiveInputService) { + r = &AccountStreamLiveInputService{} + r.Options = opts + r.Outputs = NewAccountStreamLiveInputOutputService(opts...) + return +} + +// Retrieves details of an existing live input. +func (r *AccountStreamLiveInputService) Get(ctx context.Context, accountIdentifier string, liveInputIdentifier string, opts ...option.RequestOption) (res *AccountStreamLiveInputGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s", accountIdentifier, liveInputIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a specified live input. +func (r *AccountStreamLiveInputService) Update(ctx context.Context, accountIdentifier string, liveInputIdentifier string, body AccountStreamLiveInputUpdateParams, opts ...option.RequestOption) (res *AccountStreamLiveInputUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s", accountIdentifier, liveInputIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Prevents a live input from being streamed to and makes the live input +// inaccessible to any future API calls. +func (r *AccountStreamLiveInputService) Delete(ctx context.Context, accountIdentifier string, liveInputIdentifier string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s", accountIdentifier, liveInputIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Creates a live input, and returns credentials that you or your users can use to +// stream live video to Cloudflare Stream. +func (r *AccountStreamLiveInputService) StreamLiveInputsNewALiveInput(ctx context.Context, accountIdentifier string, body AccountStreamLiveInputStreamLiveInputsNewALiveInputParams, opts ...option.RequestOption) (res *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists the live inputs created for an account. To get the credentials needed to +// stream to a specific live input, request a single live input. +func (r *AccountStreamLiveInputService) StreamLiveInputsListLiveInputs(ctx context.Context, accountIdentifier string, query AccountStreamLiveInputStreamLiveInputsListLiveInputsParams, opts ...option.RequestOption) (res *AccountStreamLiveInputStreamLiveInputsListLiveInputsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountStreamLiveInputGetResponse struct { + Errors []AccountStreamLiveInputGetResponseError `json:"errors"` + Messages []AccountStreamLiveInputGetResponseMessage `json:"messages"` + // Details about a live input. + Result AccountStreamLiveInputGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamLiveInputGetResponseSuccess `json:"success"` + JSON accountStreamLiveInputGetResponseJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseJSON contains the JSON metadata for the struct +// [AccountStreamLiveInputGetResponse] +type accountStreamLiveInputGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputGetResponseErrorJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamLiveInputGetResponseError] +type accountStreamLiveInputGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputGetResponseMessageJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamLiveInputGetResponseMessage] +type accountStreamLiveInputGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details about a live input. +type AccountStreamLiveInputGetResponseResult struct { + // The date and time the live input was created. + Created time.Time `json:"created" format:"date-time"` + // Indicates the number of days after which the live inputs recordings will be + // deleted. When a stream completes and the recording is ready, the value is used + // to calculate a scheduled deletion date for that recording. Omit the field to + // indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. + DeleteRecordingAfterDays float64 `json:"deleteRecordingAfterDays"` + // A user modifiable key-value store used to reference other systems of record for + // managing live inputs. + Meta interface{} `json:"meta"` + // The date and time the live input was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // Records the input to a Cloudflare Stream video. Behavior depends on the mode. In + // most cases, the video will initially be viewable as a live video and transition + // to on-demand after a condition is satisfied. + Recording AccountStreamLiveInputGetResponseResultRecording `json:"recording"` + // Details for streaming to an live input using RTMPS. + Rtmps AccountStreamLiveInputGetResponseResultRtmps `json:"rtmps"` + // Details for playback from an live input using RTMPS. + RtmpsPlayback AccountStreamLiveInputGetResponseResultRtmpsPlayback `json:"rtmpsPlayback"` + // Details for streaming to a live input using SRT. + Srt AccountStreamLiveInputGetResponseResultSrt `json:"srt"` + // Details for playback from an live input using SRT. + SrtPlayback AccountStreamLiveInputGetResponseResultSrtPlayback `json:"srtPlayback"` + // The connection status of a live input. + Status AccountStreamLiveInputGetResponseResultStatus `json:"status,nullable"` + // A unique identifier for a live input. + Uid string `json:"uid"` + // Details for streaming to a live input using WebRTC. + WebRtc AccountStreamLiveInputGetResponseResultWebRtc `json:"webRTC"` + // Details for playback from a live input using WebRTC. + WebRtcPlayback AccountStreamLiveInputGetResponseResultWebRtcPlayback `json:"webRTCPlayback"` + JSON accountStreamLiveInputGetResponseResultJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultJSON contains the JSON metadata for the +// struct [AccountStreamLiveInputGetResponseResult] +type accountStreamLiveInputGetResponseResultJSON struct { + Created apijson.Field + DeleteRecordingAfterDays apijson.Field + Meta apijson.Field + Modified apijson.Field + Recording apijson.Field + Rtmps apijson.Field + RtmpsPlayback apijson.Field + Srt apijson.Field + SrtPlayback apijson.Field + Status apijson.Field + Uid apijson.Field + WebRtc apijson.Field + WebRtcPlayback apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Records the input to a Cloudflare Stream video. Behavior depends on the mode. In +// most cases, the video will initially be viewable as a live video and transition +// to on-demand after a condition is satisfied. +type AccountStreamLiveInputGetResponseResultRecording struct { + // Lists the origins allowed to display videos created with this input. Enter + // allowed origin domains in an array and use `*` for wildcard subdomains. An empty + // array allows videos to be viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // Specifies the recording behavior for the live input. Set this value to `off` to + // prevent a recording. Set the value to `automatic` to begin a recording and + // transition to on-demand after Stream Live stops receiving input. + Mode AccountStreamLiveInputGetResponseResultRecordingMode `json:"mode"` + // Indicates if a video using the live input has the `requireSignedURLs` property + // set. Also enforces access controls on any video recording of the livestream with + // the live input. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Determines the amount of time a live input configured in `automatic` mode should + // wait before a recording transitions from live to on-demand. `0` is recommended + // for most use cases and indicates the platform default should be used. + TimeoutSeconds int64 `json:"timeoutSeconds"` + JSON accountStreamLiveInputGetResponseResultRecordingJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultRecordingJSON contains the JSON metadata +// for the struct [AccountStreamLiveInputGetResponseResultRecording] +type accountStreamLiveInputGetResponseResultRecordingJSON struct { + AllowedOrigins apijson.Field + Mode apijson.Field + RequireSignedURLs apijson.Field + TimeoutSeconds apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResultRecording) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the recording behavior for the live input. Set this value to `off` to +// prevent a recording. Set the value to `automatic` to begin a recording and +// transition to on-demand after Stream Live stops receiving input. +type AccountStreamLiveInputGetResponseResultRecordingMode string + +const ( + AccountStreamLiveInputGetResponseResultRecordingModeOff AccountStreamLiveInputGetResponseResultRecordingMode = "off" + AccountStreamLiveInputGetResponseResultRecordingModeAutomatic AccountStreamLiveInputGetResponseResultRecordingMode = "automatic" +) + +// Details for streaming to an live input using RTMPS. +type AccountStreamLiveInputGetResponseResultRtmps struct { + // The secret key to use when streaming via RTMPS to a live input. + StreamKey string `json:"streamKey"` + // The RTMPS URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputGetResponseResultRtmpsJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultRtmpsJSON contains the JSON metadata for +// the struct [AccountStreamLiveInputGetResponseResultRtmps] +type accountStreamLiveInputGetResponseResultRtmpsJSON struct { + StreamKey apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResultRtmps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from an live input using RTMPS. +type AccountStreamLiveInputGetResponseResultRtmpsPlayback struct { + // The secret key to use for playback via RTMPS. + StreamKey string `json:"streamKey"` + // The URL used to play live video over RTMPS. + URL string `json:"url"` + JSON accountStreamLiveInputGetResponseResultRtmpsPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultRtmpsPlaybackJSON contains the JSON +// metadata for the struct [AccountStreamLiveInputGetResponseResultRtmpsPlayback] +type accountStreamLiveInputGetResponseResultRtmpsPlaybackJSON struct { + StreamKey apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResultRtmpsPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for streaming to a live input using SRT. +type AccountStreamLiveInputGetResponseResultSrt struct { + // The secret key to use when streaming via SRT to a live input. + Passphrase string `json:"passphrase"` + // The identifier of the live input to use when streaming via SRT. + StreamID string `json:"streamId"` + // The SRT URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputGetResponseResultSrtJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultSrtJSON contains the JSON metadata for +// the struct [AccountStreamLiveInputGetResponseResultSrt] +type accountStreamLiveInputGetResponseResultSrtJSON struct { + Passphrase apijson.Field + StreamID apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResultSrt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from an live input using SRT. +type AccountStreamLiveInputGetResponseResultSrtPlayback struct { + // The secret key to use for playback via SRT. + Passphrase string `json:"passphrase"` + // The identifier of the live input to use for playback via SRT. + StreamID string `json:"streamId"` + // The URL used to play live video over SRT. + URL string `json:"url"` + JSON accountStreamLiveInputGetResponseResultSrtPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultSrtPlaybackJSON contains the JSON +// metadata for the struct [AccountStreamLiveInputGetResponseResultSrtPlayback] +type accountStreamLiveInputGetResponseResultSrtPlaybackJSON struct { + Passphrase apijson.Field + StreamID apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResultSrtPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The connection status of a live input. +type AccountStreamLiveInputGetResponseResultStatus string + +const ( + AccountStreamLiveInputGetResponseResultStatusConnected AccountStreamLiveInputGetResponseResultStatus = "connected" + AccountStreamLiveInputGetResponseResultStatusReconnected AccountStreamLiveInputGetResponseResultStatus = "reconnected" + AccountStreamLiveInputGetResponseResultStatusReconnecting AccountStreamLiveInputGetResponseResultStatus = "reconnecting" + AccountStreamLiveInputGetResponseResultStatusClientDisconnect AccountStreamLiveInputGetResponseResultStatus = "client_disconnect" + AccountStreamLiveInputGetResponseResultStatusTtlExceeded AccountStreamLiveInputGetResponseResultStatus = "ttl_exceeded" + AccountStreamLiveInputGetResponseResultStatusFailedToConnect AccountStreamLiveInputGetResponseResultStatus = "failed_to_connect" + AccountStreamLiveInputGetResponseResultStatusFailedToReconnect AccountStreamLiveInputGetResponseResultStatus = "failed_to_reconnect" + AccountStreamLiveInputGetResponseResultStatusNewConfigurationAccepted AccountStreamLiveInputGetResponseResultStatus = "new_configuration_accepted" +) + +// Details for streaming to a live input using WebRTC. +type AccountStreamLiveInputGetResponseResultWebRtc struct { + // The WebRTC URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputGetResponseResultWebRtcJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultWebRtcJSON contains the JSON metadata for +// the struct [AccountStreamLiveInputGetResponseResultWebRtc] +type accountStreamLiveInputGetResponseResultWebRtcJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResultWebRtc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from a live input using WebRTC. +type AccountStreamLiveInputGetResponseResultWebRtcPlayback struct { + // The URL used to play live video over WebRTC. + URL string `json:"url"` + JSON accountStreamLiveInputGetResponseResultWebRtcPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputGetResponseResultWebRtcPlaybackJSON contains the JSON +// metadata for the struct [AccountStreamLiveInputGetResponseResultWebRtcPlayback] +type accountStreamLiveInputGetResponseResultWebRtcPlaybackJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputGetResponseResultWebRtcPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamLiveInputGetResponseSuccess bool + +const ( + AccountStreamLiveInputGetResponseSuccessTrue AccountStreamLiveInputGetResponseSuccess = true +) + +type AccountStreamLiveInputUpdateResponse struct { + Errors []AccountStreamLiveInputUpdateResponseError `json:"errors"` + Messages []AccountStreamLiveInputUpdateResponseMessage `json:"messages"` + // Details about a live input. + Result AccountStreamLiveInputUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamLiveInputUpdateResponseSuccess `json:"success"` + JSON accountStreamLiveInputUpdateResponseJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseJSON contains the JSON metadata for the +// struct [AccountStreamLiveInputUpdateResponse] +type accountStreamLiveInputUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputUpdateResponseErrorJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamLiveInputUpdateResponseError] +type accountStreamLiveInputUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputUpdateResponseMessageJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountStreamLiveInputUpdateResponseMessage] +type accountStreamLiveInputUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details about a live input. +type AccountStreamLiveInputUpdateResponseResult struct { + // The date and time the live input was created. + Created time.Time `json:"created" format:"date-time"` + // Indicates the number of days after which the live inputs recordings will be + // deleted. When a stream completes and the recording is ready, the value is used + // to calculate a scheduled deletion date for that recording. Omit the field to + // indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. + DeleteRecordingAfterDays float64 `json:"deleteRecordingAfterDays"` + // A user modifiable key-value store used to reference other systems of record for + // managing live inputs. + Meta interface{} `json:"meta"` + // The date and time the live input was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // Records the input to a Cloudflare Stream video. Behavior depends on the mode. In + // most cases, the video will initially be viewable as a live video and transition + // to on-demand after a condition is satisfied. + Recording AccountStreamLiveInputUpdateResponseResultRecording `json:"recording"` + // Details for streaming to an live input using RTMPS. + Rtmps AccountStreamLiveInputUpdateResponseResultRtmps `json:"rtmps"` + // Details for playback from an live input using RTMPS. + RtmpsPlayback AccountStreamLiveInputUpdateResponseResultRtmpsPlayback `json:"rtmpsPlayback"` + // Details for streaming to a live input using SRT. + Srt AccountStreamLiveInputUpdateResponseResultSrt `json:"srt"` + // Details for playback from an live input using SRT. + SrtPlayback AccountStreamLiveInputUpdateResponseResultSrtPlayback `json:"srtPlayback"` + // The connection status of a live input. + Status AccountStreamLiveInputUpdateResponseResultStatus `json:"status,nullable"` + // A unique identifier for a live input. + Uid string `json:"uid"` + // Details for streaming to a live input using WebRTC. + WebRtc AccountStreamLiveInputUpdateResponseResultWebRtc `json:"webRTC"` + // Details for playback from a live input using WebRTC. + WebRtcPlayback AccountStreamLiveInputUpdateResponseResultWebRtcPlayback `json:"webRTCPlayback"` + JSON accountStreamLiveInputUpdateResponseResultJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultJSON contains the JSON metadata for +// the struct [AccountStreamLiveInputUpdateResponseResult] +type accountStreamLiveInputUpdateResponseResultJSON struct { + Created apijson.Field + DeleteRecordingAfterDays apijson.Field + Meta apijson.Field + Modified apijson.Field + Recording apijson.Field + Rtmps apijson.Field + RtmpsPlayback apijson.Field + Srt apijson.Field + SrtPlayback apijson.Field + Status apijson.Field + Uid apijson.Field + WebRtc apijson.Field + WebRtcPlayback apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Records the input to a Cloudflare Stream video. Behavior depends on the mode. In +// most cases, the video will initially be viewable as a live video and transition +// to on-demand after a condition is satisfied. +type AccountStreamLiveInputUpdateResponseResultRecording struct { + // Lists the origins allowed to display videos created with this input. Enter + // allowed origin domains in an array and use `*` for wildcard subdomains. An empty + // array allows videos to be viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // Specifies the recording behavior for the live input. Set this value to `off` to + // prevent a recording. Set the value to `automatic` to begin a recording and + // transition to on-demand after Stream Live stops receiving input. + Mode AccountStreamLiveInputUpdateResponseResultRecordingMode `json:"mode"` + // Indicates if a video using the live input has the `requireSignedURLs` property + // set. Also enforces access controls on any video recording of the livestream with + // the live input. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Determines the amount of time a live input configured in `automatic` mode should + // wait before a recording transitions from live to on-demand. `0` is recommended + // for most use cases and indicates the platform default should be used. + TimeoutSeconds int64 `json:"timeoutSeconds"` + JSON accountStreamLiveInputUpdateResponseResultRecordingJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultRecordingJSON contains the JSON +// metadata for the struct [AccountStreamLiveInputUpdateResponseResultRecording] +type accountStreamLiveInputUpdateResponseResultRecordingJSON struct { + AllowedOrigins apijson.Field + Mode apijson.Field + RequireSignedURLs apijson.Field + TimeoutSeconds apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResultRecording) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the recording behavior for the live input. Set this value to `off` to +// prevent a recording. Set the value to `automatic` to begin a recording and +// transition to on-demand after Stream Live stops receiving input. +type AccountStreamLiveInputUpdateResponseResultRecordingMode string + +const ( + AccountStreamLiveInputUpdateResponseResultRecordingModeOff AccountStreamLiveInputUpdateResponseResultRecordingMode = "off" + AccountStreamLiveInputUpdateResponseResultRecordingModeAutomatic AccountStreamLiveInputUpdateResponseResultRecordingMode = "automatic" +) + +// Details for streaming to an live input using RTMPS. +type AccountStreamLiveInputUpdateResponseResultRtmps struct { + // The secret key to use when streaming via RTMPS to a live input. + StreamKey string `json:"streamKey"` + // The RTMPS URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputUpdateResponseResultRtmpsJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultRtmpsJSON contains the JSON metadata +// for the struct [AccountStreamLiveInputUpdateResponseResultRtmps] +type accountStreamLiveInputUpdateResponseResultRtmpsJSON struct { + StreamKey apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResultRtmps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from an live input using RTMPS. +type AccountStreamLiveInputUpdateResponseResultRtmpsPlayback struct { + // The secret key to use for playback via RTMPS. + StreamKey string `json:"streamKey"` + // The URL used to play live video over RTMPS. + URL string `json:"url"` + JSON accountStreamLiveInputUpdateResponseResultRtmpsPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultRtmpsPlaybackJSON contains the JSON +// metadata for the struct +// [AccountStreamLiveInputUpdateResponseResultRtmpsPlayback] +type accountStreamLiveInputUpdateResponseResultRtmpsPlaybackJSON struct { + StreamKey apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResultRtmpsPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for streaming to a live input using SRT. +type AccountStreamLiveInputUpdateResponseResultSrt struct { + // The secret key to use when streaming via SRT to a live input. + Passphrase string `json:"passphrase"` + // The identifier of the live input to use when streaming via SRT. + StreamID string `json:"streamId"` + // The SRT URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputUpdateResponseResultSrtJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultSrtJSON contains the JSON metadata for +// the struct [AccountStreamLiveInputUpdateResponseResultSrt] +type accountStreamLiveInputUpdateResponseResultSrtJSON struct { + Passphrase apijson.Field + StreamID apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResultSrt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from an live input using SRT. +type AccountStreamLiveInputUpdateResponseResultSrtPlayback struct { + // The secret key to use for playback via SRT. + Passphrase string `json:"passphrase"` + // The identifier of the live input to use for playback via SRT. + StreamID string `json:"streamId"` + // The URL used to play live video over SRT. + URL string `json:"url"` + JSON accountStreamLiveInputUpdateResponseResultSrtPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultSrtPlaybackJSON contains the JSON +// metadata for the struct [AccountStreamLiveInputUpdateResponseResultSrtPlayback] +type accountStreamLiveInputUpdateResponseResultSrtPlaybackJSON struct { + Passphrase apijson.Field + StreamID apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResultSrtPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The connection status of a live input. +type AccountStreamLiveInputUpdateResponseResultStatus string + +const ( + AccountStreamLiveInputUpdateResponseResultStatusConnected AccountStreamLiveInputUpdateResponseResultStatus = "connected" + AccountStreamLiveInputUpdateResponseResultStatusReconnected AccountStreamLiveInputUpdateResponseResultStatus = "reconnected" + AccountStreamLiveInputUpdateResponseResultStatusReconnecting AccountStreamLiveInputUpdateResponseResultStatus = "reconnecting" + AccountStreamLiveInputUpdateResponseResultStatusClientDisconnect AccountStreamLiveInputUpdateResponseResultStatus = "client_disconnect" + AccountStreamLiveInputUpdateResponseResultStatusTtlExceeded AccountStreamLiveInputUpdateResponseResultStatus = "ttl_exceeded" + AccountStreamLiveInputUpdateResponseResultStatusFailedToConnect AccountStreamLiveInputUpdateResponseResultStatus = "failed_to_connect" + AccountStreamLiveInputUpdateResponseResultStatusFailedToReconnect AccountStreamLiveInputUpdateResponseResultStatus = "failed_to_reconnect" + AccountStreamLiveInputUpdateResponseResultStatusNewConfigurationAccepted AccountStreamLiveInputUpdateResponseResultStatus = "new_configuration_accepted" +) + +// Details for streaming to a live input using WebRTC. +type AccountStreamLiveInputUpdateResponseResultWebRtc struct { + // The WebRTC URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputUpdateResponseResultWebRtcJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultWebRtcJSON contains the JSON metadata +// for the struct [AccountStreamLiveInputUpdateResponseResultWebRtc] +type accountStreamLiveInputUpdateResponseResultWebRtcJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResultWebRtc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from a live input using WebRTC. +type AccountStreamLiveInputUpdateResponseResultWebRtcPlayback struct { + // The URL used to play live video over WebRTC. + URL string `json:"url"` + JSON accountStreamLiveInputUpdateResponseResultWebRtcPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputUpdateResponseResultWebRtcPlaybackJSON contains the JSON +// metadata for the struct +// [AccountStreamLiveInputUpdateResponseResultWebRtcPlayback] +type accountStreamLiveInputUpdateResponseResultWebRtcPlaybackJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputUpdateResponseResultWebRtcPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamLiveInputUpdateResponseSuccess bool + +const ( + AccountStreamLiveInputUpdateResponseSuccessTrue AccountStreamLiveInputUpdateResponseSuccess = true +) + +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponse struct { + Errors []AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseError `json:"errors"` + Messages []AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseMessage `json:"messages"` + // Details about a live input. + Result AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseSuccess `json:"success"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseJSON contains the +// JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponse] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseErrorJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseError] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseMessageJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseMessage] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details about a live input. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResult struct { + // The date and time the live input was created. + Created time.Time `json:"created" format:"date-time"` + // Indicates the number of days after which the live inputs recordings will be + // deleted. When a stream completes and the recording is ready, the value is used + // to calculate a scheduled deletion date for that recording. Omit the field to + // indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. + DeleteRecordingAfterDays float64 `json:"deleteRecordingAfterDays"` + // A user modifiable key-value store used to reference other systems of record for + // managing live inputs. + Meta interface{} `json:"meta"` + // The date and time the live input was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // Records the input to a Cloudflare Stream video. Behavior depends on the mode. In + // most cases, the video will initially be viewable as a live video and transition + // to on-demand after a condition is satisfied. + Recording AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecording `json:"recording"` + // Details for streaming to an live input using RTMPS. + Rtmps AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmps `json:"rtmps"` + // Details for playback from an live input using RTMPS. + RtmpsPlayback AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsPlayback `json:"rtmpsPlayback"` + // Details for streaming to a live input using SRT. + Srt AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrt `json:"srt"` + // Details for playback from an live input using SRT. + SrtPlayback AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtPlayback `json:"srtPlayback"` + // The connection status of a live input. + Status AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus `json:"status,nullable"` + // A unique identifier for a live input. + Uid string `json:"uid"` + // Details for streaming to a live input using WebRTC. + WebRtc AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtc `json:"webRTC"` + // Details for playback from a live input using WebRTC. + WebRtcPlayback AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcPlayback `json:"webRTCPlayback"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultJSON contains +// the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResult] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultJSON struct { + Created apijson.Field + DeleteRecordingAfterDays apijson.Field + Meta apijson.Field + Modified apijson.Field + Recording apijson.Field + Rtmps apijson.Field + RtmpsPlayback apijson.Field + Srt apijson.Field + SrtPlayback apijson.Field + Status apijson.Field + Uid apijson.Field + WebRtc apijson.Field + WebRtcPlayback apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Records the input to a Cloudflare Stream video. Behavior depends on the mode. In +// most cases, the video will initially be viewable as a live video and transition +// to on-demand after a condition is satisfied. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecording struct { + // Lists the origins allowed to display videos created with this input. Enter + // allowed origin domains in an array and use `*` for wildcard subdomains. An empty + // array allows videos to be viewed on any origin. + AllowedOrigins []string `json:"allowedOrigins"` + // Specifies the recording behavior for the live input. Set this value to `off` to + // prevent a recording. Set the value to `automatic` to begin a recording and + // transition to on-demand after Stream Live stops receiving input. + Mode AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingMode `json:"mode"` + // Indicates if a video using the live input has the `requireSignedURLs` property + // set. Also enforces access controls on any video recording of the livestream with + // the live input. + RequireSignedURLs bool `json:"requireSignedURLs"` + // Determines the amount of time a live input configured in `automatic` mode should + // wait before a recording transitions from live to on-demand. `0` is recommended + // for most use cases and indicates the platform default should be used. + TimeoutSeconds int64 `json:"timeoutSeconds"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecording] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingJSON struct { + AllowedOrigins apijson.Field + Mode apijson.Field + RequireSignedURLs apijson.Field + TimeoutSeconds apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecording) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the recording behavior for the live input. Set this value to `off` to +// prevent a recording. Set the value to `automatic` to begin a recording and +// transition to on-demand after Stream Live stops receiving input. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingMode string + +const ( + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingModeOff AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingMode = "off" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingModeAutomatic AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRecordingMode = "automatic" +) + +// Details for streaming to an live input using RTMPS. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmps struct { + // The secret key to use when streaming via RTMPS to a live input. + StreamKey string `json:"streamKey"` + // The RTMPS URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmps] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsJSON struct { + StreamKey apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from an live input using RTMPS. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsPlayback struct { + // The secret key to use for playback via RTMPS. + StreamKey string `json:"streamKey"` + // The URL used to play live video over RTMPS. + URL string `json:"url"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsPlaybackJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsPlayback] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsPlaybackJSON struct { + StreamKey apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultRtmpsPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for streaming to a live input using SRT. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrt struct { + // The secret key to use when streaming via SRT to a live input. + Passphrase string `json:"passphrase"` + // The identifier of the live input to use when streaming via SRT. + StreamID string `json:"streamId"` + // The SRT URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrt] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtJSON struct { + Passphrase apijson.Field + StreamID apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from an live input using SRT. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtPlayback struct { + // The secret key to use for playback via SRT. + Passphrase string `json:"passphrase"` + // The identifier of the live input to use for playback via SRT. + StreamID string `json:"streamId"` + // The URL used to play live video over SRT. + URL string `json:"url"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtPlaybackJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtPlayback] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtPlaybackJSON struct { + Passphrase apijson.Field + StreamID apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultSrtPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The connection status of a live input. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus string + +const ( + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusConnected AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "connected" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusReconnected AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "reconnected" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusReconnecting AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "reconnecting" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusClientDisconnect AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "client_disconnect" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusTtlExceeded AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "ttl_exceeded" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusFailedToConnect AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "failed_to_connect" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusFailedToReconnect AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "failed_to_reconnect" + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatusNewConfigurationAccepted AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultStatus = "new_configuration_accepted" +) + +// Details for streaming to a live input using WebRTC. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtc struct { + // The WebRTC URL you provide to the broadcaster, which they stream live video to. + URL string `json:"url"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtc] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details for playback from a live input using WebRTC. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcPlayback struct { + // The URL used to play live video over WebRTC. + URL string `json:"url"` + JSON accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcPlaybackJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcPlaybackJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcPlayback] +type accountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcPlaybackJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseResultWebRtcPlayback) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseSuccess bool + +const ( + AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseSuccessTrue AccountStreamLiveInputStreamLiveInputsNewALiveInputResponseSuccess = true +) + +type AccountStreamLiveInputStreamLiveInputsListLiveInputsResponse struct { + Errors []AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseError `json:"errors"` + Messages []AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseMessage `json:"messages"` + Result AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseSuccess `json:"success"` + JSON accountStreamLiveInputStreamLiveInputsListLiveInputsResponseJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsListLiveInputsResponseJSON contains the +// JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsListLiveInputsResponse] +type accountStreamLiveInputStreamLiveInputsListLiveInputsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsListLiveInputsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputStreamLiveInputsListLiveInputsResponseErrorJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsListLiveInputsResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseError] +type accountStreamLiveInputStreamLiveInputsListLiveInputsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputStreamLiveInputsListLiveInputsResponseMessageJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsListLiveInputsResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseMessage] +type accountStreamLiveInputStreamLiveInputsListLiveInputsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResult struct { + LiveInputs []AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultLiveInput `json:"liveInputs"` + // The total number of remaining live inputs based on cursor position. + Range int64 `json:"range"` + // The total number of live inputs that match the provided filters. + Total int64 `json:"total"` + JSON accountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultJSON contains +// the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResult] +type accountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultJSON struct { + LiveInputs apijson.Field + Range apijson.Field + Total apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultLiveInput struct { + // The date and time the live input was created. + Created time.Time `json:"created" format:"date-time"` + // Indicates the number of days after which the live inputs recordings will be + // deleted. When a stream completes and the recording is ready, the value is used + // to calculate a scheduled deletion date for that recording. Omit the field to + // indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. + DeleteRecordingAfterDays float64 `json:"deleteRecordingAfterDays"` + // A user modifiable key-value store used to reference other systems of record for + // managing live inputs. + Meta interface{} `json:"meta"` + // The date and time the live input was last modified. + Modified time.Time `json:"modified" format:"date-time"` + // A unique identifier for a live input. + Uid string `json:"uid"` + JSON accountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultLiveInputJSON `json:"-"` +} + +// accountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultLiveInputJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultLiveInput] +type accountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultLiveInputJSON struct { + Created apijson.Field + DeleteRecordingAfterDays apijson.Field + Meta apijson.Field + Modified apijson.Field + Uid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseResultLiveInput) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseSuccess bool + +const ( + AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseSuccessTrue AccountStreamLiveInputStreamLiveInputsListLiveInputsResponseSuccess = true +) + +type AccountStreamLiveInputUpdateParams struct { + // Sets the creator ID asssociated with this live input. + DefaultCreator param.Field[string] `json:"defaultCreator"` + // Indicates the number of days after which the live inputs recordings will be + // deleted. When a stream completes and the recording is ready, the value is used + // to calculate a scheduled deletion date for that recording. Omit the field to + // indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. + DeleteRecordingAfterDays param.Field[float64] `json:"deleteRecordingAfterDays"` + // A user modifiable key-value store used to reference other systems of record for + // managing live inputs. + Meta param.Field[interface{}] `json:"meta"` + // Records the input to a Cloudflare Stream video. Behavior depends on the mode. In + // most cases, the video will initially be viewable as a live video and transition + // to on-demand after a condition is satisfied. + Recording param.Field[AccountStreamLiveInputUpdateParamsRecording] `json:"recording"` +} + +func (r AccountStreamLiveInputUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Records the input to a Cloudflare Stream video. Behavior depends on the mode. In +// most cases, the video will initially be viewable as a live video and transition +// to on-demand after a condition is satisfied. +type AccountStreamLiveInputUpdateParamsRecording struct { + // Lists the origins allowed to display videos created with this input. Enter + // allowed origin domains in an array and use `*` for wildcard subdomains. An empty + // array allows videos to be viewed on any origin. + AllowedOrigins param.Field[[]string] `json:"allowedOrigins"` + // Specifies the recording behavior for the live input. Set this value to `off` to + // prevent a recording. Set the value to `automatic` to begin a recording and + // transition to on-demand after Stream Live stops receiving input. + Mode param.Field[AccountStreamLiveInputUpdateParamsRecordingMode] `json:"mode"` + // Indicates if a video using the live input has the `requireSignedURLs` property + // set. Also enforces access controls on any video recording of the livestream with + // the live input. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` + // Determines the amount of time a live input configured in `automatic` mode should + // wait before a recording transitions from live to on-demand. `0` is recommended + // for most use cases and indicates the platform default should be used. + TimeoutSeconds param.Field[int64] `json:"timeoutSeconds"` +} + +func (r AccountStreamLiveInputUpdateParamsRecording) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Specifies the recording behavior for the live input. Set this value to `off` to +// prevent a recording. Set the value to `automatic` to begin a recording and +// transition to on-demand after Stream Live stops receiving input. +type AccountStreamLiveInputUpdateParamsRecordingMode string + +const ( + AccountStreamLiveInputUpdateParamsRecordingModeOff AccountStreamLiveInputUpdateParamsRecordingMode = "off" + AccountStreamLiveInputUpdateParamsRecordingModeAutomatic AccountStreamLiveInputUpdateParamsRecordingMode = "automatic" +) + +type AccountStreamLiveInputStreamLiveInputsNewALiveInputParams struct { + // Sets the creator ID asssociated with this live input. + DefaultCreator param.Field[string] `json:"defaultCreator"` + // Indicates the number of days after which the live inputs recordings will be + // deleted. When a stream completes and the recording is ready, the value is used + // to calculate a scheduled deletion date for that recording. Omit the field to + // indicate no change, or include with a `null` value to remove an existing + // scheduled deletion. + DeleteRecordingAfterDays param.Field[float64] `json:"deleteRecordingAfterDays"` + // A user modifiable key-value store used to reference other systems of record for + // managing live inputs. + Meta param.Field[interface{}] `json:"meta"` + // Records the input to a Cloudflare Stream video. Behavior depends on the mode. In + // most cases, the video will initially be viewable as a live video and transition + // to on-demand after a condition is satisfied. + Recording param.Field[AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecording] `json:"recording"` +} + +func (r AccountStreamLiveInputStreamLiveInputsNewALiveInputParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Records the input to a Cloudflare Stream video. Behavior depends on the mode. In +// most cases, the video will initially be viewable as a live video and transition +// to on-demand after a condition is satisfied. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecording struct { + // Lists the origins allowed to display videos created with this input. Enter + // allowed origin domains in an array and use `*` for wildcard subdomains. An empty + // array allows videos to be viewed on any origin. + AllowedOrigins param.Field[[]string] `json:"allowedOrigins"` + // Specifies the recording behavior for the live input. Set this value to `off` to + // prevent a recording. Set the value to `automatic` to begin a recording and + // transition to on-demand after Stream Live stops receiving input. + Mode param.Field[AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecordingMode] `json:"mode"` + // Indicates if a video using the live input has the `requireSignedURLs` property + // set. Also enforces access controls on any video recording of the livestream with + // the live input. + RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` + // Determines the amount of time a live input configured in `automatic` mode should + // wait before a recording transitions from live to on-demand. `0` is recommended + // for most use cases and indicates the platform default should be used. + TimeoutSeconds param.Field[int64] `json:"timeoutSeconds"` +} + +func (r AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecording) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Specifies the recording behavior for the live input. Set this value to `off` to +// prevent a recording. Set the value to `automatic` to begin a recording and +// transition to on-demand after Stream Live stops receiving input. +type AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecordingMode string + +const ( + AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecordingModeOff AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecordingMode = "off" + AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecordingModeAutomatic AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecordingMode = "automatic" +) + +type AccountStreamLiveInputStreamLiveInputsListLiveInputsParams struct { + // Includes the total number of videos associated with the submitted query + // parameters. + IncludeCounts param.Field[bool] `query:"include_counts"` +} + +// URLQuery serializes +// [AccountStreamLiveInputStreamLiveInputsListLiveInputsParams]'s query parameters +// as `url.Values`. +func (r AccountStreamLiveInputStreamLiveInputsListLiveInputsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountstreamliveinput_test.go b/accountstreamliveinput_test.go new file mode 100644 index 00000000000..982c91c82d9 --- /dev/null +++ b/accountstreamliveinput_test.go @@ -0,0 +1,191 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamLiveInputGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.LiveInputs.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "66be4bf738797e01e1fca35a7bdecdcd", + ) + 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 TestAccountStreamLiveInputUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.LiveInputs.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "66be4bf738797e01e1fca35a7bdecdcd", + cloudflare.AccountStreamLiveInputUpdateParams{ + DefaultCreator: cloudflare.F("string"), + DeleteRecordingAfterDays: cloudflare.F(45.000000), + Meta: cloudflare.F[any](map[string]interface{}{ + "name": "test stream 1", + }), + Recording: cloudflare.F(cloudflare.AccountStreamLiveInputUpdateParamsRecording{ + AllowedOrigins: cloudflare.F([]string{"example.com"}), + Mode: cloudflare.F(cloudflare.AccountStreamLiveInputUpdateParamsRecordingModeOff), + RequireSignedURLs: cloudflare.F(false), + TimeoutSeconds: cloudflare.F(int64(0)), + }), + }, + ) + 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 TestAccountStreamLiveInputDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Streams.LiveInputs.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "66be4bf738797e01e1fca35a7bdecdcd", + ) + 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 TestAccountStreamLiveInputStreamLiveInputsNewALiveInputWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.LiveInputs.StreamLiveInputsNewALiveInput( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamLiveInputStreamLiveInputsNewALiveInputParams{ + DefaultCreator: cloudflare.F("string"), + DeleteRecordingAfterDays: cloudflare.F(45.000000), + Meta: cloudflare.F[any](map[string]interface{}{ + "name": "test stream 1", + }), + Recording: cloudflare.F(cloudflare.AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecording{ + AllowedOrigins: cloudflare.F([]string{"example.com"}), + Mode: cloudflare.F(cloudflare.AccountStreamLiveInputStreamLiveInputsNewALiveInputParamsRecordingModeOff), + RequireSignedURLs: cloudflare.F(false), + TimeoutSeconds: cloudflare.F(int64(0)), + }), + }, + ) + 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 TestAccountStreamLiveInputStreamLiveInputsListLiveInputsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.LiveInputs.StreamLiveInputsListLiveInputs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamLiveInputStreamLiveInputsListLiveInputsParams{ + IncludeCounts: cloudflare.F(true), + }, + ) + 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/accountstreamliveinputoutput.go b/accountstreamliveinputoutput.go new file mode 100644 index 00000000000..aaa2b2c55b3 --- /dev/null +++ b/accountstreamliveinputoutput.go @@ -0,0 +1,405 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamLiveInputOutputService 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 +// [NewAccountStreamLiveInputOutputService] method instead. +type AccountStreamLiveInputOutputService struct { + Options []option.RequestOption +} + +// NewAccountStreamLiveInputOutputService 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 NewAccountStreamLiveInputOutputService(opts ...option.RequestOption) (r *AccountStreamLiveInputOutputService) { + r = &AccountStreamLiveInputOutputService{} + r.Options = opts + return +} + +// Updates the state of an output. +func (r *AccountStreamLiveInputOutputService) Update(ctx context.Context, accountIdentifier string, liveInputIdentifier string, outputIdentifier string, body AccountStreamLiveInputOutputUpdateParams, opts ...option.RequestOption) (res *AccountStreamLiveInputOutputUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s/outputs/%s", accountIdentifier, liveInputIdentifier, outputIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an output and removes it from the associated live input. +func (r *AccountStreamLiveInputOutputService) Delete(ctx context.Context, accountIdentifier string, liveInputIdentifier string, outputIdentifier string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s/outputs/%s", accountIdentifier, liveInputIdentifier, outputIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Creates a new output that can be used to simulcast or restream live video to +// other RTMP or SRT destinations. Outputs are always linked to a specific live +// input — one live input can have many outputs. +func (r *AccountStreamLiveInputOutputService) StreamLiveInputsNewANewOutputConnectedToALiveInput(ctx context.Context, accountIdentifier string, liveInputIdentifier string, body AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputParams, opts ...option.RequestOption) (res *AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s/outputs", accountIdentifier, liveInputIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Retrieves all outputs associated with a specified live input. +func (r *AccountStreamLiveInputOutputService) StreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInput(ctx context.Context, accountIdentifier string, liveInputIdentifier string, opts ...option.RequestOption) (res *AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s/outputs", accountIdentifier, liveInputIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStreamLiveInputOutputUpdateResponse struct { + Errors []AccountStreamLiveInputOutputUpdateResponseError `json:"errors"` + Messages []AccountStreamLiveInputOutputUpdateResponseMessage `json:"messages"` + Result AccountStreamLiveInputOutputUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamLiveInputOutputUpdateResponseSuccess `json:"success"` + JSON accountStreamLiveInputOutputUpdateResponseJSON `json:"-"` +} + +// accountStreamLiveInputOutputUpdateResponseJSON contains the JSON metadata for +// the struct [AccountStreamLiveInputOutputUpdateResponse] +type accountStreamLiveInputOutputUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputOutputUpdateResponseErrorJSON `json:"-"` +} + +// accountStreamLiveInputOutputUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountStreamLiveInputOutputUpdateResponseError] +type accountStreamLiveInputOutputUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputOutputUpdateResponseMessageJSON `json:"-"` +} + +// accountStreamLiveInputOutputUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountStreamLiveInputOutputUpdateResponseMessage] +type accountStreamLiveInputOutputUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputUpdateResponseResult struct { + // When enabled, live video streamed to the associated live input will be sent to + // the output URL. When disabled, live video will not be sent to the output URL, + // even when streaming to the associated live input. Use this to control precisely + // when you start and stop simulcasting to specific destinations like YouTube and + // Twitch. + Enabled bool `json:"enabled"` + // The streamKey used to authenticate against an output's target. + StreamKey string `json:"streamKey"` + // A unique identifier for the output. + Uid string `json:"uid"` + // The URL an output uses to restream. + URL string `json:"url"` + JSON accountStreamLiveInputOutputUpdateResponseResultJSON `json:"-"` +} + +// accountStreamLiveInputOutputUpdateResponseResultJSON contains the JSON metadata +// for the struct [AccountStreamLiveInputOutputUpdateResponseResult] +type accountStreamLiveInputOutputUpdateResponseResultJSON struct { + Enabled apijson.Field + StreamKey apijson.Field + Uid apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamLiveInputOutputUpdateResponseSuccess bool + +const ( + AccountStreamLiveInputOutputUpdateResponseSuccessTrue AccountStreamLiveInputOutputUpdateResponseSuccess = true +) + +type AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponse struct { + Errors []AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseError `json:"errors"` + Messages []AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseMessage `json:"messages"` + Result AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseSuccess `json:"success"` + JSON accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponse] +type accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseErrorJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseError] +type accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseMessageJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseMessage] +type accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseResult struct { + // When enabled, live video streamed to the associated live input will be sent to + // the output URL. When disabled, live video will not be sent to the output URL, + // even when streaming to the associated live input. Use this to control precisely + // when you start and stop simulcasting to specific destinations like YouTube and + // Twitch. + Enabled bool `json:"enabled"` + // The streamKey used to authenticate against an output's target. + StreamKey string `json:"streamKey"` + // A unique identifier for the output. + Uid string `json:"uid"` + // The URL an output uses to restream. + URL string `json:"url"` + JSON accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseResultJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseResult] +type accountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseResultJSON struct { + Enabled apijson.Field + StreamKey apijson.Field + Uid apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseSuccess bool + +const ( + AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseSuccessTrue AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponseSuccess = true +) + +type AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponse struct { + Errors []AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseError `json:"errors"` + Messages []AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseMessage `json:"messages"` + Result []AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseSuccess `json:"success"` + JSON accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponse] +type accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseErrorJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseError] +type accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseMessageJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseMessage] +type accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseResult struct { + // When enabled, live video streamed to the associated live input will be sent to + // the output URL. When disabled, live video will not be sent to the output URL, + // even when streaming to the associated live input. Use this to control precisely + // when you start and stop simulcasting to specific destinations like YouTube and + // Twitch. + Enabled bool `json:"enabled"` + // The streamKey used to authenticate against an output's target. + StreamKey string `json:"streamKey"` + // A unique identifier for the output. + Uid string `json:"uid"` + // The URL an output uses to restream. + URL string `json:"url"` + JSON accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseResultJSON `json:"-"` +} + +// accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseResult] +type accountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseResultJSON struct { + Enabled apijson.Field + StreamKey apijson.Field + Uid apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseSuccess bool + +const ( + AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseSuccessTrue AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponseSuccess = true +) + +type AccountStreamLiveInputOutputUpdateParams struct { + // When enabled, live video streamed to the associated live input will be sent to + // the output URL. When disabled, live video will not be sent to the output URL, + // even when streaming to the associated live input. Use this to control precisely + // when you start and stop simulcasting to specific destinations like YouTube and + // Twitch. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r AccountStreamLiveInputOutputUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputParams struct { + // The streamKey used to authenticate against an output's target. + StreamKey param.Field[string] `json:"streamKey,required"` + // The URL an output uses to restream. + URL param.Field[string] `json:"url,required"` + // When enabled, live video streamed to the associated live input will be sent to + // the output URL. When disabled, live video will not be sent to the output URL, + // even when streaming to the associated live input. Use this to control precisely + // when you start and stop simulcasting to specific destinations like YouTube and + // Twitch. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamliveinputoutput_test.go b/accountstreamliveinputoutput_test.go new file mode 100644 index 00000000000..cbc023fdd8a --- /dev/null +++ b/accountstreamliveinputoutput_test.go @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamLiveInputOutputUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.LiveInputs.Outputs.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "66be4bf738797e01e1fca35a7bdecdcd", + "baea4d9c515887b80289d5c33cf01145", + cloudflare.AccountStreamLiveInputOutputUpdateParams{ + Enabled: cloudflare.F(true), + }, + ) + 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 TestAccountStreamLiveInputOutputDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Streams.LiveInputs.Outputs.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "66be4bf738797e01e1fca35a7bdecdcd", + "baea4d9c515887b80289d5c33cf01145", + ) + 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 TestAccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.LiveInputs.Outputs.StreamLiveInputsNewANewOutputConnectedToALiveInput( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "66be4bf738797e01e1fca35a7bdecdcd", + cloudflare.AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputParams{ + StreamKey: cloudflare.F("uzya-f19y-g2g9-a2ee-51j2"), + URL: cloudflare.F("rtmp://a.rtmp.youtube.com/live2"), + Enabled: cloudflare.F(true), + }, + ) + 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 TestAccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInput(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.LiveInputs.Outputs.StreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInput( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "66be4bf738797e01e1fca35a7bdecdcd", + ) + 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/accountstreamstorageusage.go b/accountstreamstorageusage.go new file mode 100644 index 00000000000..0bbb0f6cf1e --- /dev/null +++ b/accountstreamstorageusage.go @@ -0,0 +1,152 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamStorageUsageService 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 +// [NewAccountStreamStorageUsageService] method instead. +type AccountStreamStorageUsageService struct { + Options []option.RequestOption +} + +// NewAccountStreamStorageUsageService 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 NewAccountStreamStorageUsageService(opts ...option.RequestOption) (r *AccountStreamStorageUsageService) { + r = &AccountStreamStorageUsageService{} + r.Options = opts + return +} + +// Returns information about an account's storage use. +func (r *AccountStreamStorageUsageService) Get(ctx context.Context, accountIdentifier string, query AccountStreamStorageUsageGetParams, opts ...option.RequestOption) (res *AccountStreamStorageUsageGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/storage-usage", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountStreamStorageUsageGetResponse struct { + Errors []AccountStreamStorageUsageGetResponseError `json:"errors"` + Messages []AccountStreamStorageUsageGetResponseMessage `json:"messages"` + Result AccountStreamStorageUsageGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamStorageUsageGetResponseSuccess `json:"success"` + JSON accountStreamStorageUsageGetResponseJSON `json:"-"` +} + +// accountStreamStorageUsageGetResponseJSON contains the JSON metadata for the +// struct [AccountStreamStorageUsageGetResponse] +type accountStreamStorageUsageGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStorageUsageGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStorageUsageGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamStorageUsageGetResponseErrorJSON `json:"-"` +} + +// accountStreamStorageUsageGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamStorageUsageGetResponseError] +type accountStreamStorageUsageGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStorageUsageGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStorageUsageGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamStorageUsageGetResponseMessageJSON `json:"-"` +} + +// accountStreamStorageUsageGetResponseMessageJSON contains the JSON metadata for +// the struct [AccountStreamStorageUsageGetResponseMessage] +type accountStreamStorageUsageGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStorageUsageGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamStorageUsageGetResponseResult struct { + // A user-defined identifier for the media creator. + Creator string `json:"creator"` + // The total minutes of video content stored in the account. + TotalStorageMinutes int64 `json:"totalStorageMinutes"` + // The storage capacity alloted for the account. + TotalStorageMinutesLimit int64 `json:"totalStorageMinutesLimit"` + // The total count of videos associated with the account. + VideoCount int64 `json:"videoCount"` + JSON accountStreamStorageUsageGetResponseResultJSON `json:"-"` +} + +// accountStreamStorageUsageGetResponseResultJSON contains the JSON metadata for +// the struct [AccountStreamStorageUsageGetResponseResult] +type accountStreamStorageUsageGetResponseResultJSON struct { + Creator apijson.Field + TotalStorageMinutes apijson.Field + TotalStorageMinutesLimit apijson.Field + VideoCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamStorageUsageGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamStorageUsageGetResponseSuccess bool + +const ( + AccountStreamStorageUsageGetResponseSuccessTrue AccountStreamStorageUsageGetResponseSuccess = true +) + +type AccountStreamStorageUsageGetParams struct { + // A user-defined identifier for the media creator. + Creator param.Field[string] `query:"creator"` +} + +// URLQuery serializes [AccountStreamStorageUsageGetParams]'s query parameters as +// `url.Values`. +func (r AccountStreamStorageUsageGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountstreamstorageusage_test.go b/accountstreamstorageusage_test.go new file mode 100644 index 00000000000..9fd128e1235 --- /dev/null +++ b/accountstreamstorageusage_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamStorageUsageGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.StorageUsages.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamStorageUsageGetParams{ + Creator: cloudflare.F("creator-id_abcde12345"), + }, + ) + 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/accountstreamtoken.go b/accountstreamtoken.go new file mode 100644 index 00000000000..f19ab3e6401 --- /dev/null +++ b/accountstreamtoken.go @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamTokenService 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 [NewAccountStreamTokenService] method +// instead. +type AccountStreamTokenService struct { + Options []option.RequestOption +} + +// NewAccountStreamTokenService 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 NewAccountStreamTokenService(opts ...option.RequestOption) (r *AccountStreamTokenService) { + r = &AccountStreamTokenService{} + r.Options = opts + return +} + +// Creates a signed URL token for a video. If a body is not provided in the +// request, a token is created with default values. +func (r *AccountStreamTokenService) StreamVideosNewSignedURLTokensForVideos(ctx context.Context, accountIdentifier string, identifier string, body AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParams, opts ...option.RequestOption) (res *AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/token", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponse struct { + Errors []AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseError `json:"errors"` + Messages []AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseMessage `json:"messages"` + Result AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseSuccess `json:"success"` + JSON accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseJSON `json:"-"` +} + +// accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseJSON contains +// the JSON metadata for the struct +// [AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponse] +type accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseErrorJSON `json:"-"` +} + +// accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseError] +type accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseMessageJSON `json:"-"` +} + +// accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseMessage] +type accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseResult struct { + // The signed token used with the signed URLs feature. + Token string `json:"token"` + JSON accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseResultJSON `json:"-"` +} + +// accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseResult] +type accountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseResultJSON struct { + Token apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseSuccess bool + +const ( + AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseSuccessTrue AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponseSuccess = true +) + +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParams struct { + // The optional ID of a Stream signing key. If present, the `pem` field is also + // required. + ID param.Field[string] `json:"id"` + // The optional list of access rule constraints on the token. Access can be blocked + // or allowed based on an IP, IP range, or by country. Access rules are evaluated + // from first to last. If a rule matches, the associated action is applied and no + // further rules are evaluated. + AccessRules param.Field[[]AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRule] `json:"accessRules"` + // The optional boolean value that enables using signed tokens to access MP4 + // download links for a video. + Downloadable param.Field[bool] `json:"downloadable"` + // The optional unix epoch timestamp that specficies the time after a token is not + // accepted. The maximum time specification is 24 hours from issuing time. If this + // field is not set, the default is one hour after issuing. + Exp param.Field[int64] `json:"exp"` + // The optional unix epoch timestamp that specifies the time before a the token is + // not accepted. If this field is not set, the default is one hour before issuing. + Nbf param.Field[int64] `json:"nbf"` + // The optional base64 encoded private key in PEM format associated with a Stream + // signing key. If present, the `id` field is also required. + Pem param.Field[string] `json:"pem"` +} + +func (r AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Defines rules for fine-grained control over content than signed URL tokens +// alone. Access rules primarily make tokens conditionally valid based on user +// information. Access Rules are specified on token payloads as the `accessRules` +// property containing an array of Rule objects. +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRule struct { + // The action to take when a request matches a rule. If the action is `block`, the + // signed token blocks views for viewers matching the rule. + Action param.Field[AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesAction] `json:"action"` + // An array of 2-letter country codes in ISO 3166-1 Alpha-2 format used to match + // requests. + Country param.Field[[]string] `json:"country"` + // An array of IPv4 or IPV6 addresses or CIDRs used to match requests. + IP param.Field[[]string] `json:"ip"` + // Lists available rule types to match for requests. An `any` type matches all + // requests and can be used as a wildcard to apply default actions after other + // rules. + Type param.Field[AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesType] `json:"type"` +} + +func (r AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to take when a request matches a rule. If the action is `block`, the +// signed token blocks views for viewers matching the rule. +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesAction string + +const ( + AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesActionAllow AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesAction = "allow" + AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesActionBlock AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesAction = "block" +) + +// Lists available rule types to match for requests. An `any` type matches all +// requests and can be used as a wildcard to apply default actions after other +// rules. +type AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesType string + +const ( + AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesTypeAny AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesType = "any" + AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesTypeIPSrc AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesType = "ip.src" + AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesTypeIPGeoipCountry AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesType = "ip.geoip.country" +) diff --git a/accountstreamtoken_test.go b/accountstreamtoken_test.go new file mode 100644 index 00000000000..2e66df420c6 --- /dev/null +++ b/accountstreamtoken_test.go @@ -0,0 +1,67 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamTokenStreamVideosNewSignedURLTokensForVideosWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Tokens.StreamVideosNewSignedURLTokensForVideos( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParams{ + ID: cloudflare.F("ab0d4ef71g4425f8dcba9041231813000"), + AccessRules: cloudflare.F([]cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRule{{ + Action: cloudflare.F(cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesActionBlock), + Country: cloudflare.F([]string{"US", "MX"}), + IP: cloudflare.F([]string{"string", "string", "string"}), + Type: cloudflare.F(cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesTypeIPGeoipCountry), + }, { + Action: cloudflare.F(cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesActionAllow), + Country: cloudflare.F([]string{"string", "string", "string"}), + IP: cloudflare.F([]string{"93.184.216.0/24", "2400:cb00::/32"}), + Type: cloudflare.F(cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesTypeIPSrc), + }, { + Action: cloudflare.F(cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesActionBlock), + Country: cloudflare.F([]string{"string", "string", "string"}), + IP: cloudflare.F([]string{"string", "string", "string"}), + Type: cloudflare.F(cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParamsAccessRulesTypeAny), + }}), + Downloadable: cloudflare.F(true), + Exp: cloudflare.F(int64(0)), + Nbf: cloudflare.F(int64(0)), + Pem: cloudflare.F("LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBc284dnBvOFpEWXRkOUgzbWlPaW1qYXAzVXlVM0oyZ3kwTUYvN1R4blJuRnkwRHpDCkxqUk9naFZsQ0hPQmxsd3NVaE9GU0lyYnN4K05tUTdBeS90TFpXSGxuVGF3UWJ5WGZGOStJeDhVSnNlSHBGV1oKNVF5Z1JYd2liSjh1MVVsZ2xlcmZHMkpueldjVXpZTzEySktZN3doSkw1ajROMWgxZFJNUXQ5Q1pkZFlCQWRzOQpCdk02cjRFMDcxQkhQekhWeDMrUTI1VWtubGdUNXIwS3FiM1E1Y0dlTlBXY1JreW1ybkJEWWR0OXR4eFFMb1dPCllzNXdsMnVYWFVYL0VGcDMwajU0Nmp6czllWExLYlNDbjJjTDZFVE96Y2x3aG9DRGx2a2VQT05rUE9LMDVKNUMKTm1TdFdhMG9hV1VGRzM0MFl3cVVrWGt4OU9tNndXd1JldU1uU1FJREFRQUJBb0lCQUFJOHo1ck5kOEdtOGJBMgo1S3pxQjI1R2lOVENwbUNJeW53NXRJWHZTQmNHcEdydUcvdlN2WG9kVlFVSVY0TWdHQkVXUEFrVzdsNWVBcHI4CnA1ZFd5SkRXYTNkdklFSE9vSEpYU3dBYksxZzZEMTNVa2NkZ1EyRGpoNVhuWDhHZCtBY2c2SmRTQWgxOWtYSHEKMk54RUtBVDB6Ri83a1g2MkRkREFBcWxmQkpGSXJodVIvZUdEVWh4L2piTTRhQ2JCcFdiM0pnRE9OYm5tS1ZoMwpxS2ZwZmRZZENZU1lzWUxrNTlxRDF2VFNwUVFUQ0VadW9VKzNzRVNhdkJzaUs1bU0vTzY5ZkRMRXNURG1MeTVQCmhEK3BMQXI0SlhNNjFwRGVBS0l3cUVqWWJybXlDRHRXTUdJNnZzZ0E1eXQzUUJaME9vV2w5QUkwdWxoZ3p4dXQKZ2ZFNTRRRUNnWUVBN0F3a0lhVEEzYmQ4Nk9jSVZnNFlrWGk1cm5aNDdsM1k4V24zcjIzUmVISXhLdkllRUtSbgp5bUlFNDFtRVBBSmlGWFpLK1VPTXdkeS9EcnFJUithT1JiT2NiV01jWUg2QzgvbG1wdVJFaXE3SW1Ub3VWcnA4CnlnUkprMWprVDA4cTIvNmg4eTBEdjJqMitsaHFXNzRNOUt0cmwxcTRlWmZRUFREL01tR1NnTWtDZ1lFQXdhY04KaSttN1p6dnJtL3NuekF2VlZ5SEtwZHVUUjNERk1naC9maC9tZ0ZHZ1RwZWtUOVV5b3FleGNYQXdwMVlhL01iQQoyNTVJVDZRbXZZTm5yNXp6Wmxic2tMV0hsYllvbWhmWnVXTHhXR3hRaEFORWdaMFVVdUVTRGMvbWx2UXZHbEtSCkZoaGhBUWlVSmdDamhPaHk1SlBiNGFldGRKd0UxK09lVWRFaE1vRUNnWUVBNG8yZ25CM1o4ck5xa3NzemlBek4KYmNuMlJVbDJOaW9pejBwS3JMaDFaT29NNE5BekpQdjJsaHRQMzdtS0htS1hLMHczRjFqTEgwSTBxZmxFVmVZbQpSU1huakdHazJjUnpBYUVzOGgrQzNheDE0Z01pZUtGU3BqNUpNOEFNbVVZOXQ1cUVhN2FYc3o0V1ZoOUlMYmVTCkRiNzlhKzVwd21LQVBrcnBsTHhyZFdrQ2dZQlNNSHVBWVdBbmJYZ1BDS2FZWklGVWJNUWNacmY0ZnpWQ2lmYksKYWZHampvRlNPZXdEOGdGK3BWdWJRTGwxbkFieU44ek1xVDRaaHhybUhpcFlqMjJDaHV2NmN3RXJtbGRiSnpwQwpBMnRaVXdkTk1ESFlMUG5lUHlZeGRJWnlsUXFVeW14SGkydElUQUxNcWtLOGV3ZWdXZHpkeGhQSlJScU5JazhrCmZIVHhnUUtCZ1FEUFc2UXIxY3F3QjNUdnVWdWR4WGRqUTdIcDFodXhrNEVWaEFJZllKNFhSTW1NUE5YS28wdHUKdUt6LzE0QW14R0dvSWJxYVc1bDMzeFNteUxhem84clNUN0tSTjVKME9JSHcrZkR5SFgxdHpVSjZCTldDcEFTcwpjbWdNK0htSzVON0w2bkNaZFJQY2IwU1hGaVRQUGhCUG1PVWFDUnpER0ZMK2JYM1VwajJKbWc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="), + }, + ) + 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/accountstreamwatermark.go b/accountstreamwatermark.go new file mode 100644 index 00000000000..3f3f0cccc98 --- /dev/null +++ b/accountstreamwatermark.go @@ -0,0 +1,435 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamWatermarkService 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 [NewAccountStreamWatermarkService] +// method instead. +type AccountStreamWatermarkService struct { + Options []option.RequestOption +} + +// NewAccountStreamWatermarkService 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 NewAccountStreamWatermarkService(opts ...option.RequestOption) (r *AccountStreamWatermarkService) { + r = &AccountStreamWatermarkService{} + r.Options = opts + return +} + +// Retrieves details for a single watermark profile. +func (r *AccountStreamWatermarkService) Get(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamWatermarkGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/watermarks/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes a watermark profile. +func (r *AccountStreamWatermarkService) Delete(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *AccountStreamWatermarkDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/watermarks/%s", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates watermark profiles using a single `HTTP POST multipart/form-data` +// request. +func (r *AccountStreamWatermarkService) StreamWatermarkProfileNewWatermarkProfilesViaBasicUpload(ctx context.Context, accountIdentifier string, body AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadParams, opts ...option.RequestOption) (res *AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/watermarks", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all watermark profiles for an account. +func (r *AccountStreamWatermarkService) StreamWatermarkProfileListWatermarkProfiles(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/watermarks", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStreamWatermarkGetResponse struct { + Errors []AccountStreamWatermarkGetResponseError `json:"errors"` + Messages []AccountStreamWatermarkGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStreamWatermarkGetResponseSuccess `json:"success"` + JSON accountStreamWatermarkGetResponseJSON `json:"-"` +} + +// accountStreamWatermarkGetResponseJSON contains the JSON metadata for the struct +// [AccountStreamWatermarkGetResponse] +type accountStreamWatermarkGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkGetResponseErrorJSON `json:"-"` +} + +// accountStreamWatermarkGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamWatermarkGetResponseError] +type accountStreamWatermarkGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkGetResponseMessageJSON `json:"-"` +} + +// accountStreamWatermarkGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamWatermarkGetResponseMessage] +type accountStreamWatermarkGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamWatermarkGetResponseSuccess bool + +const ( + AccountStreamWatermarkGetResponseSuccessTrue AccountStreamWatermarkGetResponseSuccess = true +) + +type AccountStreamWatermarkDeleteResponse struct { + Errors []AccountStreamWatermarkDeleteResponseError `json:"errors"` + Messages []AccountStreamWatermarkDeleteResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountStreamWatermarkDeleteResponseSuccess `json:"success"` + JSON accountStreamWatermarkDeleteResponseJSON `json:"-"` +} + +// accountStreamWatermarkDeleteResponseJSON contains the JSON metadata for the +// struct [AccountStreamWatermarkDeleteResponse] +type accountStreamWatermarkDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkDeleteResponseErrorJSON `json:"-"` +} + +// accountStreamWatermarkDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamWatermarkDeleteResponseError] +type accountStreamWatermarkDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkDeleteResponseMessageJSON `json:"-"` +} + +// accountStreamWatermarkDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountStreamWatermarkDeleteResponseMessage] +type accountStreamWatermarkDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamWatermarkDeleteResponseSuccess bool + +const ( + AccountStreamWatermarkDeleteResponseSuccessTrue AccountStreamWatermarkDeleteResponseSuccess = true +) + +type AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponse struct { + Errors []AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseError `json:"errors"` + Messages []AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseSuccess `json:"success"` + JSON accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseJSON `json:"-"` +} + +// accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseJSON +// contains the JSON metadata for the struct +// [AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponse] +type accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseErrorJSON `json:"-"` +} + +// accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseError] +type accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseMessageJSON `json:"-"` +} + +// accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseMessage] +type accountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseSuccess bool + +const ( + AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseSuccessTrue AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponseSuccess = true +) + +type AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponse struct { + Errors []AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseError `json:"errors"` + Messages []AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseMessage `json:"messages"` + Result []AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseResult `json:"result"` + // Whether the API call was successful + Success AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseSuccess `json:"success"` + JSON accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseJSON `json:"-"` +} + +// accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseJSON +// contains the JSON metadata for the struct +// [AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponse] +type accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseErrorJSON `json:"-"` +} + +// accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseError] +type accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseMessageJSON `json:"-"` +} + +// accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseMessage] +type accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseResult struct { + // The date and a time a watermark profile was created. + Created time.Time `json:"created" format:"date-time"` + // The source URL for a downloaded image. If the watermark profile was created via + // direct upload, this field is null. + DownloadedFrom string `json:"downloadedFrom"` + // The height of the image in pixels. + Height int64 `json:"height"` + // A short description of the watermark profile. + Name string `json:"name"` + // The translucency of the image. A value of `0.0` makes the image completely + // transparent, and `1.0` makes the image completely opaque. Note that if the image + // is already semi-transparent, setting this to `1.0` will not make the image + // completely opaque. + Opacity float64 `json:"opacity"` + // The whitespace between the adjacent edges (determined by position) of the video + // and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + // video width or length, as determined by the algorithm. + Padding float64 `json:"padding"` + // The location of the image. Valid positions are: `upperRight`, `upperLeft`, + // `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the + // `padding` parameter. + Position string `json:"position"` + // The size of the image relative to the overall size of the video. This parameter + // will adapt to horizontal and vertical videos automatically. `0.0` indicates no + // scaling (use the size of the image as-is), and `1.0 `fills the entire video. + Scale float64 `json:"scale"` + // The size of the image in bytes. + Size float64 `json:"size"` + // The unique identifier for a watermark profile. + Uid string `json:"uid"` + // The width of the image in pixels. + Width int64 `json:"width"` + JSON accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseResultJSON `json:"-"` +} + +// accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseResultJSON +// contains the JSON metadata for the struct +// [AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseResult] +type accountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseResultJSON struct { + Created apijson.Field + DownloadedFrom apijson.Field + Height apijson.Field + Name apijson.Field + Opacity apijson.Field + Padding apijson.Field + Position apijson.Field + Scale apijson.Field + Size apijson.Field + Uid apijson.Field + Width apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseSuccess bool + +const ( + AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseSuccessTrue AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponseSuccess = true +) + +type AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadParams struct { + // The image file to upload. + File param.Field[string] `json:"file,required"` + // A short description of the watermark profile. + Name param.Field[string] `json:"name"` + // The translucency of the image. A value of `0.0` makes the image completely + // transparent, and `1.0` makes the image completely opaque. Note that if the image + // is already semi-transparent, setting this to `1.0` will not make the image + // completely opaque. + Opacity param.Field[float64] `json:"opacity"` + // The whitespace between the adjacent edges (determined by position) of the video + // and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded + // video width or length, as determined by the algorithm. + Padding param.Field[float64] `json:"padding"` + // The location of the image. Valid positions are: `upperRight`, `upperLeft`, + // `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the + // `padding` parameter. + Position param.Field[string] `json:"position"` + // The size of the image relative to the overall size of the video. This parameter + // will adapt to horizontal and vertical videos automatically. `0.0` indicates no + // scaling (use the size of the image as-is), and `1.0 `fills the entire video. + Scale param.Field[float64] `json:"scale"` +} + +func (r AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamwatermark_test.go b/accountstreamwatermark_test.go new file mode 100644 index 00000000000..d4a162c319e --- /dev/null +++ b/accountstreamwatermark_test.go @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamWatermarkGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Watermarks.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountStreamWatermarkDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Watermarks.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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 TestAccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Watermarks.StreamWatermarkProfileNewWatermarkProfilesViaBasicUpload( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadParams{ + File: cloudflare.F("@/Users/rchen/Downloads/watermark.png"), + Name: cloudflare.F("Marketing Videos"), + Opacity: cloudflare.F(0.750000), + Padding: cloudflare.F(0.100000), + Position: cloudflare.F("center"), + Scale: cloudflare.F(0.100000), + }, + ) + 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 TestAccountStreamWatermarkStreamWatermarkProfileListWatermarkProfiles(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Watermarks.StreamWatermarkProfileListWatermarkProfiles(context.TODO(), "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/accountstreamwebhook.go b/accountstreamwebhook.go new file mode 100644 index 00000000000..83ea4d36bd3 --- /dev/null +++ b/accountstreamwebhook.go @@ -0,0 +1,276 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountStreamWebhookService 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 [NewAccountStreamWebhookService] +// method instead. +type AccountStreamWebhookService struct { + Options []option.RequestOption +} + +// NewAccountStreamWebhookService 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 NewAccountStreamWebhookService(opts ...option.RequestOption) (r *AccountStreamWebhookService) { + r = &AccountStreamWebhookService{} + r.Options = opts + return +} + +// Deletes a webhook. +func (r *AccountStreamWebhookService) Delete(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountStreamWebhookDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/webhook", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a webhook notification. +func (r *AccountStreamWebhookService) StreamWebhookNewWebhooks(ctx context.Context, accountIdentifier string, body AccountStreamWebhookStreamWebhookNewWebhooksParams, opts ...option.RequestOption) (res *AccountStreamWebhookStreamWebhookNewWebhooksResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/webhook", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Retrieves a list of webhooks. +func (r *AccountStreamWebhookService) StreamWebhookViewWebhooks(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountStreamWebhookStreamWebhookViewWebhooksResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/webhook", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountStreamWebhookDeleteResponse struct { + Errors []AccountStreamWebhookDeleteResponseError `json:"errors"` + Messages []AccountStreamWebhookDeleteResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountStreamWebhookDeleteResponseSuccess `json:"success"` + JSON accountStreamWebhookDeleteResponseJSON `json:"-"` +} + +// accountStreamWebhookDeleteResponseJSON contains the JSON metadata for the struct +// [AccountStreamWebhookDeleteResponse] +type accountStreamWebhookDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWebhookDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWebhookDeleteResponseErrorJSON `json:"-"` +} + +// accountStreamWebhookDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountStreamWebhookDeleteResponseError] +type accountStreamWebhookDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWebhookDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWebhookDeleteResponseMessageJSON `json:"-"` +} + +// accountStreamWebhookDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountStreamWebhookDeleteResponseMessage] +type accountStreamWebhookDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamWebhookDeleteResponseSuccess bool + +const ( + AccountStreamWebhookDeleteResponseSuccessTrue AccountStreamWebhookDeleteResponseSuccess = true +) + +type AccountStreamWebhookStreamWebhookNewWebhooksResponse struct { + Errors []AccountStreamWebhookStreamWebhookNewWebhooksResponseError `json:"errors"` + Messages []AccountStreamWebhookStreamWebhookNewWebhooksResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStreamWebhookStreamWebhookNewWebhooksResponseSuccess `json:"success"` + JSON accountStreamWebhookStreamWebhookNewWebhooksResponseJSON `json:"-"` +} + +// accountStreamWebhookStreamWebhookNewWebhooksResponseJSON contains the JSON +// metadata for the struct [AccountStreamWebhookStreamWebhookNewWebhooksResponse] +type accountStreamWebhookStreamWebhookNewWebhooksResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookStreamWebhookNewWebhooksResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWebhookStreamWebhookNewWebhooksResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWebhookStreamWebhookNewWebhooksResponseErrorJSON `json:"-"` +} + +// accountStreamWebhookStreamWebhookNewWebhooksResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountStreamWebhookStreamWebhookNewWebhooksResponseError] +type accountStreamWebhookStreamWebhookNewWebhooksResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookStreamWebhookNewWebhooksResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWebhookStreamWebhookNewWebhooksResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWebhookStreamWebhookNewWebhooksResponseMessageJSON `json:"-"` +} + +// accountStreamWebhookStreamWebhookNewWebhooksResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountStreamWebhookStreamWebhookNewWebhooksResponseMessage] +type accountStreamWebhookStreamWebhookNewWebhooksResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookStreamWebhookNewWebhooksResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamWebhookStreamWebhookNewWebhooksResponseSuccess bool + +const ( + AccountStreamWebhookStreamWebhookNewWebhooksResponseSuccessTrue AccountStreamWebhookStreamWebhookNewWebhooksResponseSuccess = true +) + +type AccountStreamWebhookStreamWebhookViewWebhooksResponse struct { + Errors []AccountStreamWebhookStreamWebhookViewWebhooksResponseError `json:"errors"` + Messages []AccountStreamWebhookStreamWebhookViewWebhooksResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountStreamWebhookStreamWebhookViewWebhooksResponseSuccess `json:"success"` + JSON accountStreamWebhookStreamWebhookViewWebhooksResponseJSON `json:"-"` +} + +// accountStreamWebhookStreamWebhookViewWebhooksResponseJSON contains the JSON +// metadata for the struct [AccountStreamWebhookStreamWebhookViewWebhooksResponse] +type accountStreamWebhookStreamWebhookViewWebhooksResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookStreamWebhookViewWebhooksResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWebhookStreamWebhookViewWebhooksResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWebhookStreamWebhookViewWebhooksResponseErrorJSON `json:"-"` +} + +// accountStreamWebhookStreamWebhookViewWebhooksResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountStreamWebhookStreamWebhookViewWebhooksResponseError] +type accountStreamWebhookStreamWebhookViewWebhooksResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookStreamWebhookViewWebhooksResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountStreamWebhookStreamWebhookViewWebhooksResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountStreamWebhookStreamWebhookViewWebhooksResponseMessageJSON `json:"-"` +} + +// accountStreamWebhookStreamWebhookViewWebhooksResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountStreamWebhookStreamWebhookViewWebhooksResponseMessage] +type accountStreamWebhookStreamWebhookViewWebhooksResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountStreamWebhookStreamWebhookViewWebhooksResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountStreamWebhookStreamWebhookViewWebhooksResponseSuccess bool + +const ( + AccountStreamWebhookStreamWebhookViewWebhooksResponseSuccessTrue AccountStreamWebhookStreamWebhookViewWebhooksResponseSuccess = true +) + +type AccountStreamWebhookStreamWebhookNewWebhooksParams struct { + // The URL where webhooks will be sent. + NotificationURL param.Field[string] `json:"notificationUrl,required" format:"uri"` +} + +func (r AccountStreamWebhookStreamWebhookNewWebhooksParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountstreamwebhook_test.go b/accountstreamwebhook_test.go new file mode 100644 index 00000000000..3e27abae715 --- /dev/null +++ b/accountstreamwebhook_test.go @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountStreamWebhookDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Webhooks.Delete(context.TODO(), "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()) + } +} + +func TestAccountStreamWebhookStreamWebhookNewWebhooks(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Webhooks.StreamWebhookNewWebhooks( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountStreamWebhookStreamWebhookNewWebhooksParams{ + NotificationURL: cloudflare.F("https://example.com"), + }, + ) + 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 TestAccountStreamWebhookStreamWebhookViewWebhooks(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Streams.Webhooks.StreamWebhookViewWebhooks(context.TODO(), "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/accountsubscription.go b/accountsubscription.go new file mode 100644 index 00000000000..b529d718041 --- /dev/null +++ b/accountsubscription.go @@ -0,0 +1,738 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountSubscriptionService 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 [NewAccountSubscriptionService] +// method instead. +type AccountSubscriptionService struct { + Options []option.RequestOption +} + +// NewAccountSubscriptionService 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 NewAccountSubscriptionService(opts ...option.RequestOption) (r *AccountSubscriptionService) { + r = &AccountSubscriptionService{} + r.Options = opts + return +} + +// Updates an account subscription. +func (r *AccountSubscriptionService) Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body AccountSubscriptionUpdateParams, opts ...option.RequestOption) (res *AccountSubscriptionUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/subscriptions/%s", accountIdentifier, subscriptionIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an account's subscription. +func (r *AccountSubscriptionService) Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, opts ...option.RequestOption) (res *AccountSubscriptionDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/subscriptions/%s", accountIdentifier, subscriptionIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates an account subscription. +func (r *AccountSubscriptionService) AccountSubscriptionsNewSubscription(ctx context.Context, accountIdentifier string, body AccountSubscriptionAccountSubscriptionsNewSubscriptionParams, opts ...option.RequestOption) (res *AccountSubscriptionAccountSubscriptionsNewSubscriptionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/subscriptions", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all of an account's subscriptions. +func (r *AccountSubscriptionService) AccountSubscriptionsListSubscriptions(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/subscriptions", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountSubscriptionUpdateResponse struct { + Errors []AccountSubscriptionUpdateResponseError `json:"errors"` + Messages []AccountSubscriptionUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountSubscriptionUpdateResponseSuccess `json:"success"` + JSON accountSubscriptionUpdateResponseJSON `json:"-"` +} + +// accountSubscriptionUpdateResponseJSON contains the JSON metadata for the struct +// [AccountSubscriptionUpdateResponse] +type accountSubscriptionUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionUpdateResponseErrorJSON `json:"-"` +} + +// accountSubscriptionUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountSubscriptionUpdateResponseError] +type accountSubscriptionUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionUpdateResponseMessageJSON `json:"-"` +} + +// accountSubscriptionUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountSubscriptionUpdateResponseMessage] +type accountSubscriptionUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSubscriptionUpdateResponseSuccess bool + +const ( + AccountSubscriptionUpdateResponseSuccessTrue AccountSubscriptionUpdateResponseSuccess = true +) + +type AccountSubscriptionDeleteResponse struct { + Errors []AccountSubscriptionDeleteResponseError `json:"errors"` + Messages []AccountSubscriptionDeleteResponseMessage `json:"messages"` + Result AccountSubscriptionDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountSubscriptionDeleteResponseSuccess `json:"success"` + JSON accountSubscriptionDeleteResponseJSON `json:"-"` +} + +// accountSubscriptionDeleteResponseJSON contains the JSON metadata for the struct +// [AccountSubscriptionDeleteResponse] +type accountSubscriptionDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionDeleteResponseErrorJSON `json:"-"` +} + +// accountSubscriptionDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountSubscriptionDeleteResponseError] +type accountSubscriptionDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionDeleteResponseMessageJSON `json:"-"` +} + +// accountSubscriptionDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountSubscriptionDeleteResponseMessage] +type accountSubscriptionDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionDeleteResponseResult struct { + // Subscription identifier tag. + SubscriptionID string `json:"subscription_id"` + JSON accountSubscriptionDeleteResponseResultJSON `json:"-"` +} + +// accountSubscriptionDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountSubscriptionDeleteResponseResult] +type accountSubscriptionDeleteResponseResultJSON struct { + SubscriptionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSubscriptionDeleteResponseSuccess bool + +const ( + AccountSubscriptionDeleteResponseSuccessTrue AccountSubscriptionDeleteResponseSuccess = true +) + +type AccountSubscriptionAccountSubscriptionsNewSubscriptionResponse struct { + Errors []AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseError `json:"errors"` + Messages []AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseSuccess `json:"success"` + JSON accountSubscriptionAccountSubscriptionsNewSubscriptionResponseJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsNewSubscriptionResponseJSON contains the +// JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsNewSubscriptionResponse] +type accountSubscriptionAccountSubscriptionsNewSubscriptionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsNewSubscriptionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionAccountSubscriptionsNewSubscriptionResponseErrorJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsNewSubscriptionResponseErrorJSON contains +// the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseError] +type accountSubscriptionAccountSubscriptionsNewSubscriptionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionAccountSubscriptionsNewSubscriptionResponseMessageJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsNewSubscriptionResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseMessage] +type accountSubscriptionAccountSubscriptionsNewSubscriptionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseSuccess bool + +const ( + AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseSuccessTrue AccountSubscriptionAccountSubscriptionsNewSubscriptionResponseSuccess = true +) + +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponse struct { + Errors []AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseError `json:"errors"` + Messages []AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseMessage `json:"messages"` + Result []AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResult `json:"result"` + ResultInfo AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseSuccess `json:"success"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseJSON contains +// the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponse] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseErrorJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseError] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseMessageJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseMessage] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResult struct { + // Subscription identifier tag. + ID string `json:"id"` + App AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultApp `json:"app"` + // The list of add-ons subscribed to. + ComponentValues []AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultComponentValue `json:"component_values"` + // The monetary unit in which pricing information is displayed. + Currency string `json:"currency"` + // The end of the current period and also when the next billing is due. + CurrentPeriodEnd time.Time `json:"current_period_end" format:"date-time"` + // When the current billing period started. May match initial_period_start if this + // is the first period. + CurrentPeriodStart time.Time `json:"current_period_start" format:"date-time"` + // How often the subscription is renewed automatically. + Frequency AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequency `json:"frequency"` + // The price of the subscription that will be billed, in US dollars. + Price float64 `json:"price"` + // The rate plan applied to the subscription. + RatePlan AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultRatePlan `json:"rate_plan"` + // The state that the subscription is in. + State AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState `json:"state"` + // A simple zone object. May have null properties if not a zone subscription. + Zone AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultZone `json:"zone"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResult] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultJSON struct { + ID apijson.Field + App apijson.Field + ComponentValues apijson.Field + Currency apijson.Field + CurrentPeriodEnd apijson.Field + CurrentPeriodStart apijson.Field + Frequency apijson.Field + Price apijson.Field + RatePlan apijson.Field + State apijson.Field + Zone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultApp struct { + // app install id. + InstallID string `json:"install_id"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultAppJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultAppJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultApp] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultAppJSON struct { + InstallID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultApp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A component value for a subscription. +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultComponentValue struct { + // The default amount assigned. + Default float64 `json:"default"` + // The name of the component value. + Name string `json:"name"` + // The unit price for the component value. + Price float64 `json:"price"` + // The amount of the component value assigned. + Value float64 `json:"value"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultComponentValueJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultComponentValueJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultComponentValue] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultComponentValueJSON struct { + Default apijson.Field + Name apijson.Field + Price apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultComponentValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How often the subscription is renewed automatically. +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequency string + +const ( + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequencyWeekly AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequency = "weekly" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequencyMonthly AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequency = "monthly" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequencyQuarterly AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequency = "quarterly" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequencyYearly AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultFrequency = "yearly" +) + +// The rate plan applied to the subscription. +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultRatePlan struct { + // The ID of the rate plan. + ID interface{} `json:"id"` + // The currency applied to the rate plan subscription. + Currency string `json:"currency"` + // Whether this rate plan is managed externally from Cloudflare. + ExternallyManaged bool `json:"externally_managed"` + // Whether a rate plan is enterprise-based (or newly adopted term contract). + IsContract bool `json:"is_contract"` + // The full name of the rate plan. + PublicName string `json:"public_name"` + // The scope that this rate plan applies to. + Scope string `json:"scope"` + // The list of sets this rate plan applies to. + Sets []string `json:"sets"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultRatePlanJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultRatePlanJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultRatePlan] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultRatePlanJSON struct { + ID apijson.Field + Currency apijson.Field + ExternallyManaged apijson.Field + IsContract apijson.Field + PublicName apijson.Field + Scope apijson.Field + Sets apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultRatePlan) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The state that the subscription is in. +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState string + +const ( + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultStateTrial AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState = "Trial" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultStateProvisioned AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState = "Provisioned" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultStatePaid AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState = "Paid" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultStateAwaitingPayment AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState = "AwaitingPayment" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultStateCancelled AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState = "Cancelled" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultStateFailed AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState = "Failed" + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultStateExpired AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultState = "Expired" +) + +// A simple zone object. May have null properties if not a zone subscription. +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultZone struct { + // Identifier + ID string `json:"id"` + // The domain name + Name string `json:"name"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultZoneJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultZoneJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultZone] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultZoneJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultZone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultInfoJSON `json:"-"` +} + +// accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultInfo] +type accountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseSuccess bool + +const ( + AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseSuccessTrue AccountSubscriptionAccountSubscriptionsListSubscriptionsResponseSuccess = true +) + +type AccountSubscriptionUpdateParams struct { + App param.Field[AccountSubscriptionUpdateParamsApp] `json:"app"` + // The list of add-ons subscribed to. + ComponentValues param.Field[[]AccountSubscriptionUpdateParamsComponentValue] `json:"component_values"` + // How often the subscription is renewed automatically. + Frequency param.Field[AccountSubscriptionUpdateParamsFrequency] `json:"frequency"` + // The rate plan applied to the subscription. + RatePlan param.Field[AccountSubscriptionUpdateParamsRatePlan] `json:"rate_plan"` + // A simple zone object. May have null properties if not a zone subscription. + Zone param.Field[AccountSubscriptionUpdateParamsZone] `json:"zone"` +} + +func (r AccountSubscriptionUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountSubscriptionUpdateParamsApp struct { + // app install id. + InstallID param.Field[string] `json:"install_id"` +} + +func (r AccountSubscriptionUpdateParamsApp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A component value for a subscription. +type AccountSubscriptionUpdateParamsComponentValue struct { + // The default amount assigned. + Default param.Field[float64] `json:"default"` + // The name of the component value. + Name param.Field[string] `json:"name"` + // The unit price for the component value. + Price param.Field[float64] `json:"price"` + // The amount of the component value assigned. + Value param.Field[float64] `json:"value"` +} + +func (r AccountSubscriptionUpdateParamsComponentValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// How often the subscription is renewed automatically. +type AccountSubscriptionUpdateParamsFrequency string + +const ( + AccountSubscriptionUpdateParamsFrequencyWeekly AccountSubscriptionUpdateParamsFrequency = "weekly" + AccountSubscriptionUpdateParamsFrequencyMonthly AccountSubscriptionUpdateParamsFrequency = "monthly" + AccountSubscriptionUpdateParamsFrequencyQuarterly AccountSubscriptionUpdateParamsFrequency = "quarterly" + AccountSubscriptionUpdateParamsFrequencyYearly AccountSubscriptionUpdateParamsFrequency = "yearly" +) + +// The rate plan applied to the subscription. +type AccountSubscriptionUpdateParamsRatePlan struct { + // The ID of the rate plan. + ID param.Field[interface{}] `json:"id"` + // The currency applied to the rate plan subscription. + Currency param.Field[string] `json:"currency"` + // Whether this rate plan is managed externally from Cloudflare. + ExternallyManaged param.Field[bool] `json:"externally_managed"` + // Whether a rate plan is enterprise-based (or newly adopted term contract). + IsContract param.Field[bool] `json:"is_contract"` + // The full name of the rate plan. + PublicName param.Field[string] `json:"public_name"` + // The scope that this rate plan applies to. + Scope param.Field[string] `json:"scope"` + // The list of sets this rate plan applies to. + Sets param.Field[[]string] `json:"sets"` +} + +func (r AccountSubscriptionUpdateParamsRatePlan) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A simple zone object. May have null properties if not a zone subscription. +type AccountSubscriptionUpdateParamsZone struct { +} + +func (r AccountSubscriptionUpdateParamsZone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountSubscriptionAccountSubscriptionsNewSubscriptionParams struct { + App param.Field[AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsApp] `json:"app"` + // The list of add-ons subscribed to. + ComponentValues param.Field[[]AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsComponentValue] `json:"component_values"` + // How often the subscription is renewed automatically. + Frequency param.Field[AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequency] `json:"frequency"` + // The rate plan applied to the subscription. + RatePlan param.Field[AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsRatePlan] `json:"rate_plan"` + // A simple zone object. May have null properties if not a zone subscription. + Zone param.Field[AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsZone] `json:"zone"` +} + +func (r AccountSubscriptionAccountSubscriptionsNewSubscriptionParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsApp struct { + // app install id. + InstallID param.Field[string] `json:"install_id"` +} + +func (r AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsApp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A component value for a subscription. +type AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsComponentValue struct { + // The default amount assigned. + Default param.Field[float64] `json:"default"` + // The name of the component value. + Name param.Field[string] `json:"name"` + // The unit price for the component value. + Price param.Field[float64] `json:"price"` + // The amount of the component value assigned. + Value param.Field[float64] `json:"value"` +} + +func (r AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsComponentValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// How often the subscription is renewed automatically. +type AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequency string + +const ( + AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequencyWeekly AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequency = "weekly" + AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequencyMonthly AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequency = "monthly" + AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequencyQuarterly AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequency = "quarterly" + AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequencyYearly AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequency = "yearly" +) + +// The rate plan applied to the subscription. +type AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsRatePlan struct { + // The ID of the rate plan. + ID param.Field[interface{}] `json:"id"` + // The currency applied to the rate plan subscription. + Currency param.Field[string] `json:"currency"` + // Whether this rate plan is managed externally from Cloudflare. + ExternallyManaged param.Field[bool] `json:"externally_managed"` + // Whether a rate plan is enterprise-based (or newly adopted term contract). + IsContract param.Field[bool] `json:"is_contract"` + // The full name of the rate plan. + PublicName param.Field[string] `json:"public_name"` + // The scope that this rate plan applies to. + Scope param.Field[string] `json:"scope"` + // The list of sets this rate plan applies to. + Sets param.Field[[]string] `json:"sets"` +} + +func (r AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsRatePlan) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A simple zone object. May have null properties if not a zone subscription. +type AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsZone struct { +} + +func (r AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsZone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountsubscription_test.go b/accountsubscription_test.go new file mode 100644 index 00000000000..8403563d8e6 --- /dev/null +++ b/accountsubscription_test.go @@ -0,0 +1,193 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountSubscriptionUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Subscriptions.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "506e3185e9c882d175a2d0cb0093d9f2", + cloudflare.AccountSubscriptionUpdateParams{ + App: cloudflare.F(cloudflare.AccountSubscriptionUpdateParamsApp{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]cloudflare.AccountSubscriptionUpdateParamsComponentValue{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(cloudflare.AccountSubscriptionUpdateParamsFrequencyMonthly), + RatePlan: cloudflare.F(cloudflare.AccountSubscriptionUpdateParamsRatePlan{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F[any]("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(cloudflare.AccountSubscriptionUpdateParamsZone{}), + }, + ) + 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 TestAccountSubscriptionDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Subscriptions.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "506e3185e9c882d175a2d0cb0093d9f2", + ) + 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 TestAccountSubscriptionAccountSubscriptionsNewSubscriptionWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Subscriptions.AccountSubscriptionsNewSubscription( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionParams{ + App: cloudflare.F(cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsApp{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsComponentValue{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsFrequencyMonthly), + RatePlan: cloudflare.F(cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsRatePlan{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F[any]("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionParamsZone{}), + }, + ) + 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 TestAccountSubscriptionAccountSubscriptionsListSubscriptions(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Subscriptions.AccountSubscriptionsListSubscriptions(context.TODO(), "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/accountteamnet.go b/accountteamnet.go new file mode 100644 index 00000000000..cc9a5bf38ac --- /dev/null +++ b/accountteamnet.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountTeamnetService 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 [NewAccountTeamnetService] method +// instead. +type AccountTeamnetService struct { + Options []option.RequestOption + Routes *AccountTeamnetRouteService + VirtualNetworks *AccountTeamnetVirtualNetworkService +} + +// NewAccountTeamnetService 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 NewAccountTeamnetService(opts ...option.RequestOption) (r *AccountTeamnetService) { + r = &AccountTeamnetService{} + r.Options = opts + r.Routes = NewAccountTeamnetRouteService(opts...) + r.VirtualNetworks = NewAccountTeamnetVirtualNetworkService(opts...) + return +} diff --git a/accountteamnetroute.go b/accountteamnetroute.go new file mode 100644 index 00000000000..6bca070940e --- /dev/null +++ b/accountteamnetroute.go @@ -0,0 +1,547 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountTeamnetRouteService 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 [NewAccountTeamnetRouteService] +// method instead. +type AccountTeamnetRouteService struct { + Options []option.RequestOption + IPs *AccountTeamnetRouteIPService + Networks *AccountTeamnetRouteNetworkService +} + +// NewAccountTeamnetRouteService 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 NewAccountTeamnetRouteService(opts ...option.RequestOption) (r *AccountTeamnetRouteService) { + r = &AccountTeamnetRouteService{} + r.Options = opts + r.IPs = NewAccountTeamnetRouteIPService(opts...) + r.Networks = NewAccountTeamnetRouteNetworkService(opts...) + return +} + +// Routes a private network through a Cloudflare Tunnel. +func (r *AccountTeamnetRouteService) New(ctx context.Context, accountIdentifier string, body AccountTeamnetRouteNewParams, opts ...option.RequestOption) (res *AccountTeamnetRouteNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Updates an existing private network route in an account. The fields that are +// meant to be updated should be provided in the body of the request. +func (r *AccountTeamnetRouteService) Update(ctx context.Context, accountIdentifier string, routeID string, body AccountTeamnetRouteUpdateParams, opts ...option.RequestOption) (res *AccountTeamnetRouteUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/routes/%s", accountIdentifier, routeID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes a private network route from an account. +func (r *AccountTeamnetRouteService) Delete(ctx context.Context, accountIdentifier string, routeID string, opts ...option.RequestOption) (res *AccountTeamnetRouteDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/routes/%s", accountIdentifier, routeID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists and filters private network routes in an account. +func (r *AccountTeamnetRouteService) TunnelRouteListTunnelRoutes(ctx context.Context, accountIdentifier string, query AccountTeamnetRouteTunnelRouteListTunnelRoutesParams, opts ...option.RequestOption) (res *shared.Page[AccountTeamnetRouteTunnelRouteListTunnelRoutesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/teamnet/routes", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountTeamnetRouteNewResponse struct { + Errors []AccountTeamnetRouteNewResponseError `json:"errors"` + Messages []AccountTeamnetRouteNewResponseMessage `json:"messages"` + Result AccountTeamnetRouteNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTeamnetRouteNewResponseSuccess `json:"success"` + JSON accountTeamnetRouteNewResponseJSON `json:"-"` +} + +// accountTeamnetRouteNewResponseJSON contains the JSON metadata for the struct +// [AccountTeamnetRouteNewResponse] +type accountTeamnetRouteNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteNewResponseErrorJSON `json:"-"` +} + +// accountTeamnetRouteNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteNewResponseError] +type accountTeamnetRouteNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteNewResponseMessageJSON `json:"-"` +} + +// accountTeamnetRouteNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteNewResponseMessage] +type accountTeamnetRouteNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNewResponseResult struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON accountTeamnetRouteNewResponseResultJSON `json:"-"` +} + +// accountTeamnetRouteNewResponseResultJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteNewResponseResult] +type accountTeamnetRouteNewResponseResultJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetRouteNewResponseSuccess bool + +const ( + AccountTeamnetRouteNewResponseSuccessTrue AccountTeamnetRouteNewResponseSuccess = true +) + +type AccountTeamnetRouteUpdateResponse struct { + Errors []AccountTeamnetRouteUpdateResponseError `json:"errors"` + Messages []AccountTeamnetRouteUpdateResponseMessage `json:"messages"` + Result AccountTeamnetRouteUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTeamnetRouteUpdateResponseSuccess `json:"success"` + JSON accountTeamnetRouteUpdateResponseJSON `json:"-"` +} + +// accountTeamnetRouteUpdateResponseJSON contains the JSON metadata for the struct +// [AccountTeamnetRouteUpdateResponse] +type accountTeamnetRouteUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteUpdateResponseErrorJSON `json:"-"` +} + +// accountTeamnetRouteUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteUpdateResponseError] +type accountTeamnetRouteUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteUpdateResponseMessageJSON `json:"-"` +} + +// accountTeamnetRouteUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteUpdateResponseMessage] +type accountTeamnetRouteUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteUpdateResponseResult struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON accountTeamnetRouteUpdateResponseResultJSON `json:"-"` +} + +// accountTeamnetRouteUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteUpdateResponseResult] +type accountTeamnetRouteUpdateResponseResultJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetRouteUpdateResponseSuccess bool + +const ( + AccountTeamnetRouteUpdateResponseSuccessTrue AccountTeamnetRouteUpdateResponseSuccess = true +) + +type AccountTeamnetRouteDeleteResponse struct { + Errors []AccountTeamnetRouteDeleteResponseError `json:"errors"` + Messages []AccountTeamnetRouteDeleteResponseMessage `json:"messages"` + Result AccountTeamnetRouteDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTeamnetRouteDeleteResponseSuccess `json:"success"` + JSON accountTeamnetRouteDeleteResponseJSON `json:"-"` +} + +// accountTeamnetRouteDeleteResponseJSON contains the JSON metadata for the struct +// [AccountTeamnetRouteDeleteResponse] +type accountTeamnetRouteDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteDeleteResponseErrorJSON `json:"-"` +} + +// accountTeamnetRouteDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteDeleteResponseError] +type accountTeamnetRouteDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteDeleteResponseMessageJSON `json:"-"` +} + +// accountTeamnetRouteDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteDeleteResponseMessage] +type accountTeamnetRouteDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteDeleteResponseResult struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON accountTeamnetRouteDeleteResponseResultJSON `json:"-"` +} + +// accountTeamnetRouteDeleteResponseResultJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteDeleteResponseResult] +type accountTeamnetRouteDeleteResponseResultJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetRouteDeleteResponseSuccess bool + +const ( + AccountTeamnetRouteDeleteResponseSuccessTrue AccountTeamnetRouteDeleteResponseSuccess = true +) + +type AccountTeamnetRouteTunnelRouteListTunnelRoutesResponse struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // The type of tunnel. + TunType AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunType `json:"tun_type"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // The user-friendly name of the Cloudflare Tunnel serving the route. + TunnelName interface{} `json:"tunnel_name"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + // A user-friendly name for the virtual network. + VirtualNetworkName string `json:"virtual_network_name"` + JSON accountTeamnetRouteTunnelRouteListTunnelRoutesResponseJSON `json:"-"` +} + +// accountTeamnetRouteTunnelRouteListTunnelRoutesResponseJSON contains the JSON +// metadata for the struct [AccountTeamnetRouteTunnelRouteListTunnelRoutesResponse] +type accountTeamnetRouteTunnelRouteListTunnelRoutesResponseJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunType apijson.Field + TunnelID apijson.Field + TunnelName apijson.Field + VirtualNetworkID apijson.Field + VirtualNetworkName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteTunnelRouteListTunnelRoutesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunType string + +const ( + AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunTypeCfdTunnel AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunType = "cfd_tunnel" + AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunTypeWarpConnector AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunType = "warp_connector" + AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunTypeIPSec AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunType = "ip_sec" + AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunTypeGre AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunType = "gre" + AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunTypeCni AccountTeamnetRouteTunnelRouteListTunnelRoutesResponseTunType = "cni" +) + +type AccountTeamnetRouteNewParams struct { + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + IPNetwork param.Field[string] `json:"ip_network,required"` + // Optional remark describing the route. + Comment param.Field[string] `json:"comment"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID param.Field[interface{}] `json:"virtual_network_id"` +} + +func (r AccountTeamnetRouteNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountTeamnetRouteUpdateParams struct { + // Optional remark describing the route. + Comment param.Field[string] `json:"comment"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network param.Field[string] `json:"network"` + // The type of tunnel. + TunType param.Field[AccountTeamnetRouteUpdateParamsTunType] `json:"tun_type"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID param.Field[interface{}] `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID param.Field[interface{}] `json:"virtual_network_id"` +} + +func (r AccountTeamnetRouteUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of tunnel. +type AccountTeamnetRouteUpdateParamsTunType string + +const ( + AccountTeamnetRouteUpdateParamsTunTypeCfdTunnel AccountTeamnetRouteUpdateParamsTunType = "cfd_tunnel" + AccountTeamnetRouteUpdateParamsTunTypeWarpConnector AccountTeamnetRouteUpdateParamsTunType = "warp_connector" + AccountTeamnetRouteUpdateParamsTunTypeIPSec AccountTeamnetRouteUpdateParamsTunType = "ip_sec" + AccountTeamnetRouteUpdateParamsTunTypeGre AccountTeamnetRouteUpdateParamsTunType = "gre" + AccountTeamnetRouteUpdateParamsTunTypeCni AccountTeamnetRouteUpdateParamsTunType = "cni" +) + +type AccountTeamnetRouteTunnelRouteListTunnelRoutesParams struct { + // Optional remark describing the route. + Comment param.Field[string] `query:"comment"` + // If provided, include only routes that were created (and not deleted) before this + // time. + ExistedAt param.Field[interface{}] `query:"existed_at"` + // If `true`, only include deleted routes. If `false`, exclude deleted routes. If + // empty, all routes will be included. + IsDeleted param.Field[interface{}] `query:"is_deleted"` + // If set, only list routes that are contained within this IP range. + NetworkSubset param.Field[interface{}] `query:"network_subset"` + // If set, only list routes that contain this IP range. + NetworkSuperset param.Field[interface{}] `query:"network_superset"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of results to display. + PerPage param.Field[float64] `query:"per_page"` + // The types of tunnels to filter separated by a comma. + TunTypes param.Field[string] `query:"tun_types"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID param.Field[interface{}] `query:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID param.Field[interface{}] `query:"virtual_network_id"` +} + +// URLQuery serializes [AccountTeamnetRouteTunnelRouteListTunnelRoutesParams]'s +// query parameters as `url.Values`. +func (r AccountTeamnetRouteTunnelRouteListTunnelRoutesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountteamnetroute_test.go b/accountteamnetroute_test.go new file mode 100644 index 00000000000..bd47402089c --- /dev/null +++ b/accountteamnetroute_test.go @@ -0,0 +1,156 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountTeamnetRouteNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.Routes.New( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountTeamnetRouteNewParams{ + IPNetwork: cloudflare.F("172.16.0.0/16"), + Comment: cloudflare.F("Example comment for this route."), + VirtualNetworkID: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountTeamnetRouteUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.Routes.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountTeamnetRouteUpdateParams{ + Comment: cloudflare.F("Example comment for this route."), + Network: cloudflare.F("172.16.0.0/16"), + TunType: cloudflare.F(cloudflare.AccountTeamnetRouteUpdateParamsTunTypeCfdTunnel), + TunnelID: cloudflare.F[any](map[string]interface{}{}), + VirtualNetworkID: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountTeamnetRouteDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.Routes.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountTeamnetRouteTunnelRouteListTunnelRoutesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.Routes.TunnelRouteListTunnelRoutes( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountTeamnetRouteTunnelRouteListTunnelRoutesParams{ + Comment: cloudflare.F("Example comment for this route."), + ExistedAt: cloudflare.F[any](map[string]interface{}{}), + IsDeleted: cloudflare.F[any](map[string]interface{}{}), + NetworkSubset: cloudflare.F[any](map[string]interface{}{}), + NetworkSuperset: cloudflare.F[any](map[string]interface{}{}), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + TunTypes: cloudflare.F("cfd_tunnel,warp_connector"), + TunnelID: cloudflare.F[any](map[string]interface{}{}), + VirtualNetworkID: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountteamnetrouteip.go b/accountteamnetrouteip.go new file mode 100644 index 00000000000..c8f5dbbd0eb --- /dev/null +++ b/accountteamnetrouteip.go @@ -0,0 +1,187 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountTeamnetRouteIPService 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 [NewAccountTeamnetRouteIPService] +// method instead. +type AccountTeamnetRouteIPService struct { + Options []option.RequestOption +} + +// NewAccountTeamnetRouteIPService 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 NewAccountTeamnetRouteIPService(opts ...option.RequestOption) (r *AccountTeamnetRouteIPService) { + r = &AccountTeamnetRouteIPService{} + r.Options = opts + return +} + +// Fetches routes that contain the given IP address. +func (r *AccountTeamnetRouteIPService) Get(ctx context.Context, accountIdentifier string, ip string, query AccountTeamnetRouteIPGetParams, opts ...option.RequestOption) (res *AccountTeamnetRouteIPGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/routes/ip/%s", accountIdentifier, ip) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountTeamnetRouteIPGetResponse struct { + Errors []AccountTeamnetRouteIPGetResponseError `json:"errors"` + Messages []AccountTeamnetRouteIPGetResponseMessage `json:"messages"` + Result AccountTeamnetRouteIPGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTeamnetRouteIPGetResponseSuccess `json:"success"` + JSON accountTeamnetRouteIPGetResponseJSON `json:"-"` +} + +// accountTeamnetRouteIPGetResponseJSON contains the JSON metadata for the struct +// [AccountTeamnetRouteIPGetResponse] +type accountTeamnetRouteIPGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteIPGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteIPGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteIPGetResponseErrorJSON `json:"-"` +} + +// accountTeamnetRouteIPGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteIPGetResponseError] +type accountTeamnetRouteIPGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteIPGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteIPGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteIPGetResponseMessageJSON `json:"-"` +} + +// accountTeamnetRouteIPGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteIPGetResponseMessage] +type accountTeamnetRouteIPGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteIPGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteIPGetResponseResult struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // The type of tunnel. + TunType AccountTeamnetRouteIPGetResponseResultTunType `json:"tun_type"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // The user-friendly name of the Cloudflare Tunnel serving the route. + TunnelName interface{} `json:"tunnel_name"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + // A user-friendly name for the virtual network. + VirtualNetworkName string `json:"virtual_network_name"` + JSON accountTeamnetRouteIPGetResponseResultJSON `json:"-"` +} + +// accountTeamnetRouteIPGetResponseResultJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteIPGetResponseResult] +type accountTeamnetRouteIPGetResponseResultJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunType apijson.Field + TunnelID apijson.Field + TunnelName apijson.Field + VirtualNetworkID apijson.Field + VirtualNetworkName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteIPGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountTeamnetRouteIPGetResponseResultTunType string + +const ( + AccountTeamnetRouteIPGetResponseResultTunTypeCfdTunnel AccountTeamnetRouteIPGetResponseResultTunType = "cfd_tunnel" + AccountTeamnetRouteIPGetResponseResultTunTypeWarpConnector AccountTeamnetRouteIPGetResponseResultTunType = "warp_connector" + AccountTeamnetRouteIPGetResponseResultTunTypeIPSec AccountTeamnetRouteIPGetResponseResultTunType = "ip_sec" + AccountTeamnetRouteIPGetResponseResultTunTypeGre AccountTeamnetRouteIPGetResponseResultTunType = "gre" + AccountTeamnetRouteIPGetResponseResultTunTypeCni AccountTeamnetRouteIPGetResponseResultTunType = "cni" +) + +// Whether the API call was successful +type AccountTeamnetRouteIPGetResponseSuccess bool + +const ( + AccountTeamnetRouteIPGetResponseSuccessTrue AccountTeamnetRouteIPGetResponseSuccess = true +) + +type AccountTeamnetRouteIPGetParams struct { + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID param.Field[interface{}] `query:"virtual_network_id"` +} + +// URLQuery serializes [AccountTeamnetRouteIPGetParams]'s query parameters as +// `url.Values`. +func (r AccountTeamnetRouteIPGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountteamnetrouteip_test.go b/accountteamnetrouteip_test.go new file mode 100644 index 00000000000..640064bfa0c --- /dev/null +++ b/accountteamnetrouteip_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountTeamnetRouteIPGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.Routes.IPs.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "10.1.0.137", + cloudflare.AccountTeamnetRouteIPGetParams{ + VirtualNetworkID: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accountteamnetroutenetwork.go b/accountteamnetroutenetwork.go new file mode 100644 index 00000000000..b5ac0f929da --- /dev/null +++ b/accountteamnetroutenetwork.go @@ -0,0 +1,312 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountTeamnetRouteNetworkService 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 +// [NewAccountTeamnetRouteNetworkService] method instead. +type AccountTeamnetRouteNetworkService struct { + Options []option.RequestOption +} + +// NewAccountTeamnetRouteNetworkService 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 NewAccountTeamnetRouteNetworkService(opts ...option.RequestOption) (r *AccountTeamnetRouteNetworkService) { + r = &AccountTeamnetRouteNetworkService{} + r.Options = opts + return +} + +// Routes a private network through a Cloudflare Tunnel. The CIDR in +// `ip_network_encoded` must be written in URL-encoded format. +func (r *AccountTeamnetRouteNetworkService) Update(ctx context.Context, accountIdentifier string, ipNetworkEncoded string, body AccountTeamnetRouteNetworkUpdateParams, opts ...option.RequestOption) (res *AccountTeamnetRouteNetworkUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/routes/network/%s", accountIdentifier, ipNetworkEncoded) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Deletes a private network route from an account. The CIDR in +// `ip_network_encoded` must be written in URL-encoded format. If no +// virtual_network_id is provided it will delete the route from the default vnet. +// If no tun_type is provided it will fetch the type from the tunnel_id or if that +// is missing it will assume Cloudflare Tunnel as default. If tunnel_id is provided +// it will delete the route from that tunnel, otherwise it will delete the route +// based on the vnet and tun_type. +func (r *AccountTeamnetRouteNetworkService) Delete(ctx context.Context, accountIdentifier string, ipNetworkEncoded string, body AccountTeamnetRouteNetworkDeleteParams, opts ...option.RequestOption) (res *AccountTeamnetRouteNetworkDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/routes/network/%s", accountIdentifier, ipNetworkEncoded) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +type AccountTeamnetRouteNetworkUpdateResponse struct { + Errors []AccountTeamnetRouteNetworkUpdateResponseError `json:"errors"` + Messages []AccountTeamnetRouteNetworkUpdateResponseMessage `json:"messages"` + Result AccountTeamnetRouteNetworkUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTeamnetRouteNetworkUpdateResponseSuccess `json:"success"` + JSON accountTeamnetRouteNetworkUpdateResponseJSON `json:"-"` +} + +// accountTeamnetRouteNetworkUpdateResponseJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteNetworkUpdateResponse] +type accountTeamnetRouteNetworkUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNetworkUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteNetworkUpdateResponseErrorJSON `json:"-"` +} + +// accountTeamnetRouteNetworkUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountTeamnetRouteNetworkUpdateResponseError] +type accountTeamnetRouteNetworkUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNetworkUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteNetworkUpdateResponseMessageJSON `json:"-"` +} + +// accountTeamnetRouteNetworkUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountTeamnetRouteNetworkUpdateResponseMessage] +type accountTeamnetRouteNetworkUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNetworkUpdateResponseResult struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON accountTeamnetRouteNetworkUpdateResponseResultJSON `json:"-"` +} + +// accountTeamnetRouteNetworkUpdateResponseResultJSON contains the JSON metadata +// for the struct [AccountTeamnetRouteNetworkUpdateResponseResult] +type accountTeamnetRouteNetworkUpdateResponseResultJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetRouteNetworkUpdateResponseSuccess bool + +const ( + AccountTeamnetRouteNetworkUpdateResponseSuccessTrue AccountTeamnetRouteNetworkUpdateResponseSuccess = true +) + +type AccountTeamnetRouteNetworkDeleteResponse struct { + Errors []AccountTeamnetRouteNetworkDeleteResponseError `json:"errors"` + Messages []AccountTeamnetRouteNetworkDeleteResponseMessage `json:"messages"` + Result AccountTeamnetRouteNetworkDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTeamnetRouteNetworkDeleteResponseSuccess `json:"success"` + JSON accountTeamnetRouteNetworkDeleteResponseJSON `json:"-"` +} + +// accountTeamnetRouteNetworkDeleteResponseJSON contains the JSON metadata for the +// struct [AccountTeamnetRouteNetworkDeleteResponse] +type accountTeamnetRouteNetworkDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNetworkDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteNetworkDeleteResponseErrorJSON `json:"-"` +} + +// accountTeamnetRouteNetworkDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountTeamnetRouteNetworkDeleteResponseError] +type accountTeamnetRouteNetworkDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNetworkDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetRouteNetworkDeleteResponseMessageJSON `json:"-"` +} + +// accountTeamnetRouteNetworkDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountTeamnetRouteNetworkDeleteResponseMessage] +type accountTeamnetRouteNetworkDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetRouteNetworkDeleteResponseResult struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON accountTeamnetRouteNetworkDeleteResponseResultJSON `json:"-"` +} + +// accountTeamnetRouteNetworkDeleteResponseResultJSON contains the JSON metadata +// for the struct [AccountTeamnetRouteNetworkDeleteResponseResult] +type accountTeamnetRouteNetworkDeleteResponseResultJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetRouteNetworkDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetRouteNetworkDeleteResponseSuccess bool + +const ( + AccountTeamnetRouteNetworkDeleteResponseSuccessTrue AccountTeamnetRouteNetworkDeleteResponseSuccess = true +) + +type AccountTeamnetRouteNetworkUpdateParams struct { + // Optional remark describing the route. + Comment param.Field[string] `json:"comment"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID param.Field[interface{}] `json:"virtual_network_id"` +} + +func (r AccountTeamnetRouteNetworkUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountTeamnetRouteNetworkDeleteParams struct { + // The type of tunnel. + TunType param.Field[AccountTeamnetRouteNetworkDeleteParamsTunType] `query:"tun_type"` +} + +// URLQuery serializes [AccountTeamnetRouteNetworkDeleteParams]'s query parameters +// as `url.Values`. +func (r AccountTeamnetRouteNetworkDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The type of tunnel. +type AccountTeamnetRouteNetworkDeleteParamsTunType string + +const ( + AccountTeamnetRouteNetworkDeleteParamsTunTypeCfdTunnel AccountTeamnetRouteNetworkDeleteParamsTunType = "cfd_tunnel" + AccountTeamnetRouteNetworkDeleteParamsTunTypeWarpConnector AccountTeamnetRouteNetworkDeleteParamsTunType = "warp_connector" + AccountTeamnetRouteNetworkDeleteParamsTunTypeIPSec AccountTeamnetRouteNetworkDeleteParamsTunType = "ip_sec" + AccountTeamnetRouteNetworkDeleteParamsTunTypeGre AccountTeamnetRouteNetworkDeleteParamsTunType = "gre" + AccountTeamnetRouteNetworkDeleteParamsTunTypeCni AccountTeamnetRouteNetworkDeleteParamsTunType = "cni" +) diff --git a/accountteamnetroutenetwork_test.go b/accountteamnetroutenetwork_test.go new file mode 100644 index 00000000000..000efeb8201 --- /dev/null +++ b/accountteamnetroutenetwork_test.go @@ -0,0 +1,81 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountTeamnetRouteNetworkUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.Routes.Networks.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "172.16.0.0%2F16", + cloudflare.AccountTeamnetRouteNetworkUpdateParams{ + Comment: cloudflare.F("Example comment for this route."), + VirtualNetworkID: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountTeamnetRouteNetworkDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.Routes.Networks.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "172.16.0.0%2F16", + cloudflare.AccountTeamnetRouteNetworkDeleteParams{ + TunType: cloudflare.F(cloudflare.AccountTeamnetRouteNetworkDeleteParamsTunTypeCfdTunnel), + }, + ) + 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/accountteamnetvirtualnetwork.go b/accountteamnetvirtualnetwork.go new file mode 100644 index 00000000000..16e332a21ec --- /dev/null +++ b/accountteamnetvirtualnetwork.go @@ -0,0 +1,462 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountTeamnetVirtualNetworkService 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 +// [NewAccountTeamnetVirtualNetworkService] method instead. +type AccountTeamnetVirtualNetworkService struct { + Options []option.RequestOption +} + +// NewAccountTeamnetVirtualNetworkService 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 NewAccountTeamnetVirtualNetworkService(opts ...option.RequestOption) (r *AccountTeamnetVirtualNetworkService) { + r = &AccountTeamnetVirtualNetworkService{} + r.Options = opts + return +} + +// Updates an existing virtual network. +func (r *AccountTeamnetVirtualNetworkService) Update(ctx context.Context, accountIdentifier string, vnetID string, body AccountTeamnetVirtualNetworkUpdateParams, opts ...option.RequestOption) (res *AccountTeamnetVirtualNetworkUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/virtual_networks/%s", accountIdentifier, vnetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes an existing virtual network. +func (r *AccountTeamnetVirtualNetworkService) Delete(ctx context.Context, accountIdentifier string, vnetID string, opts ...option.RequestOption) (res *AccountTeamnetVirtualNetworkDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/virtual_networks/%s", accountIdentifier, vnetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds a new virtual network to an account. +func (r *AccountTeamnetVirtualNetworkService) TunnelVirtualNetworkNewAVirtualNetwork(ctx context.Context, accountIdentifier string, body AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkParams, opts ...option.RequestOption) (res *AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/virtual_networks", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists and filters virtual networks in an account. +func (r *AccountTeamnetVirtualNetworkService) TunnelVirtualNetworkListVirtualNetworks(ctx context.Context, accountIdentifier string, query AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksParams, opts ...option.RequestOption) (res *AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/teamnet/virtual_networks", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountTeamnetVirtualNetworkUpdateResponse struct { + Errors []AccountTeamnetVirtualNetworkUpdateResponseError `json:"errors"` + Messages []AccountTeamnetVirtualNetworkUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountTeamnetVirtualNetworkUpdateResponseSuccess `json:"success"` + JSON accountTeamnetVirtualNetworkUpdateResponseJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkUpdateResponseJSON contains the JSON metadata for +// the struct [AccountTeamnetVirtualNetworkUpdateResponse] +type accountTeamnetVirtualNetworkUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkUpdateResponseErrorJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AccountTeamnetVirtualNetworkUpdateResponseError] +type accountTeamnetVirtualNetworkUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkUpdateResponseMessageJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountTeamnetVirtualNetworkUpdateResponseMessage] +type accountTeamnetVirtualNetworkUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetVirtualNetworkUpdateResponseSuccess bool + +const ( + AccountTeamnetVirtualNetworkUpdateResponseSuccessTrue AccountTeamnetVirtualNetworkUpdateResponseSuccess = true +) + +type AccountTeamnetVirtualNetworkDeleteResponse struct { + Errors []AccountTeamnetVirtualNetworkDeleteResponseError `json:"errors"` + Messages []AccountTeamnetVirtualNetworkDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountTeamnetVirtualNetworkDeleteResponseSuccess `json:"success"` + JSON accountTeamnetVirtualNetworkDeleteResponseJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkDeleteResponseJSON contains the JSON metadata for +// the struct [AccountTeamnetVirtualNetworkDeleteResponse] +type accountTeamnetVirtualNetworkDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkDeleteResponseErrorJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkDeleteResponseErrorJSON contains the JSON metadata +// for the struct [AccountTeamnetVirtualNetworkDeleteResponseError] +type accountTeamnetVirtualNetworkDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkDeleteResponseMessageJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountTeamnetVirtualNetworkDeleteResponseMessage] +type accountTeamnetVirtualNetworkDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetVirtualNetworkDeleteResponseSuccess bool + +const ( + AccountTeamnetVirtualNetworkDeleteResponseSuccessTrue AccountTeamnetVirtualNetworkDeleteResponseSuccess = true +) + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponse struct { + Errors []AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseError `json:"errors"` + Messages []AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseSuccess `json:"success"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponse] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseErrorJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseError] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseMessageJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseMessage] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseSuccess bool + +const ( + AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseSuccessTrue AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponseSuccess = true +) + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponse struct { + Errors []AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseError `json:"errors"` + Messages []AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseMessage `json:"messages"` + Result []AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResult `json:"result"` + ResultInfo AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseSuccess `json:"success"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponse] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseErrorJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseError] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseMessageJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseMessage] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResult struct { + // UUID of the virtual network. + ID string `json:"id,required"` + // Optional remark describing the virtual network. + Comment string `json:"comment,required"` + // Timestamp of when the virtual network was created. + CreatedAt interface{} `json:"created_at,required"` + // If `true`, this virtual network is the default for the account. + IsDefaultNetwork bool `json:"is_default_network,required"` + // A user-friendly name for the virtual network. + Name string `json:"name,required"` + // Timestamp of when the virtual network was deleted. If `null`, the virtual + // network has not been deleted. + DeletedAt interface{} `json:"deleted_at"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResult] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + IsDefaultNetwork apijson.Field + Name apijson.Field + DeletedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultInfoJSON `json:"-"` +} + +// accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultInfoJSON +// contains the JSON metadata for the struct +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultInfo] +type accountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseSuccess bool + +const ( + AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseSuccessTrue AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponseSuccess = true +) + +type AccountTeamnetVirtualNetworkUpdateParams struct { + // Optional remark describing the virtual network. + Comment param.Field[string] `json:"comment"` + // If `true`, this virtual network is the default for the account. + IsDefaultNetwork param.Field[bool] `json:"is_default_network"` + // A user-friendly name for the virtual network. + Name param.Field[string] `json:"name"` +} + +func (r AccountTeamnetVirtualNetworkUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkParams struct { + // A user-friendly name for the virtual network. + Name param.Field[string] `json:"name,required"` + // Optional remark describing the virtual network. + Comment param.Field[string] `json:"comment"` + // If `true`, this virtual network is the default for the account. + IsDefault param.Field[bool] `json:"is_default"` +} + +func (r AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksParams struct { + // If `true`, only include the default virtual network. If `false`, exclude the + // default virtual network. If empty, all virtual networks will be included. + IsDefault param.Field[interface{}] `query:"is_default"` + // If `true`, only include deleted virtual networks. If `false`, exclude deleted + // virtual networks. If empty, all virtual networks will be included. + IsDeleted param.Field[interface{}] `query:"is_deleted"` + // A user-friendly name for the virtual network. + Name param.Field[string] `query:"name"` + // A user-friendly name for the virtual network. + VnetName param.Field[string] `query:"vnet_name"` +} + +// URLQuery serializes +// [AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksParams]'s +// query parameters as `url.Values`. +func (r AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountteamnetvirtualnetwork_test.go b/accountteamnetvirtualnetwork_test.go new file mode 100644 index 00000000000..cf397b0ca9c --- /dev/null +++ b/accountteamnetvirtualnetwork_test.go @@ -0,0 +1,148 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountTeamnetVirtualNetworkUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.VirtualNetworks.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountTeamnetVirtualNetworkUpdateParams{ + Comment: cloudflare.F("Staging VPC for data science"), + IsDefaultNetwork: cloudflare.F(true), + Name: cloudflare.F("us-east-1-vpc"), + }, + ) + 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 TestAccountTeamnetVirtualNetworkDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.VirtualNetworks.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.VirtualNetworks.TunnelVirtualNetworkNewAVirtualNetwork( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkParams{ + Name: cloudflare.F("us-east-1-vpc"), + Comment: cloudflare.F("Staging VPC for data science"), + IsDefault: cloudflare.F(true), + }, + ) + 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 TestAccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Teamnet.VirtualNetworks.TunnelVirtualNetworkListVirtualNetworks( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksParams{ + IsDefault: cloudflare.F[any](map[string]interface{}{}), + IsDeleted: cloudflare.F[any](map[string]interface{}{}), + Name: cloudflare.F("us-east-1-vpc"), + VnetName: cloudflare.F("us-east-1-vpc"), + }, + ) + 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/accounttunnel.go b/accounttunnel.go new file mode 100644 index 00000000000..46f27d7217d --- /dev/null +++ b/accounttunnel.go @@ -0,0 +1,756 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountTunnelService 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 [NewAccountTunnelService] method +// instead. +type AccountTunnelService struct { + Options []option.RequestOption + Connections *AccountTunnelConnectionService +} + +// NewAccountTunnelService 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 NewAccountTunnelService(opts ...option.RequestOption) (r *AccountTunnelService) { + r = &AccountTunnelService{} + r.Options = opts + r.Connections = NewAccountTunnelConnectionService(opts...) + return +} + +// Fetches a single Argo Tunnel. +func (r *AccountTunnelService) Get(ctx context.Context, accountIdentifier string, tunnelID string, opts ...option.RequestOption) (res *AccountTunnelGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/tunnels/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an Argo Tunnel from an account. +func (r *AccountTunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelID string, body AccountTunnelDeleteParams, opts ...option.RequestOption) (res *AccountTunnelDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/tunnels/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Creates a new Argo Tunnel in an account. +func (r *AccountTunnelService) ArgoTunnelNewAnArgoTunnel(ctx context.Context, accountIdentifier string, body AccountTunnelArgoTunnelNewAnArgoTunnelParams, opts ...option.RequestOption) (res *AccountTunnelArgoTunnelNewAnArgoTunnelResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists and filters all types of Tunnels in an account. +func (r *AccountTunnelService) ArgoTunnelListArgoTunnels(ctx context.Context, accountIdentifier string, query AccountTunnelArgoTunnelListArgoTunnelsParams, opts ...option.RequestOption) (res *shared.Page[AccountTunnelArgoTunnelListArgoTunnelsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/tunnels", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AccountTunnelGetResponse struct { + Errors []AccountTunnelGetResponseError `json:"errors"` + Messages []AccountTunnelGetResponseMessage `json:"messages"` + Result AccountTunnelGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTunnelGetResponseSuccess `json:"success"` + JSON accountTunnelGetResponseJSON `json:"-"` +} + +// accountTunnelGetResponseJSON contains the JSON metadata for the struct +// [AccountTunnelGetResponse] +type accountTunnelGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelGetResponseErrorJSON `json:"-"` +} + +// accountTunnelGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountTunnelGetResponseError] +type accountTunnelGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelGetResponseMessageJSON `json:"-"` +} + +// accountTunnelGetResponseMessageJSON contains the JSON metadata for the struct +// [AccountTunnelGetResponseMessage] +type accountTunnelGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelGetResponseResult struct { + // UUID of the tunnel. + ID string `json:"id,required"` + // The tunnel connections between your origin and Cloudflare's edge. + Connections []AccountTunnelGetResponseResultConnection `json:"connections,required"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // A user-friendly name for the tunnel. + Name string `json:"name,required"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + JSON accountTunnelGetResponseResultJSON `json:"-"` +} + +// accountTunnelGetResponseResultJSON contains the JSON metadata for the struct +// [AccountTunnelGetResponseResult] +type accountTunnelGetResponseResultJSON struct { + ID apijson.Field + Connections apijson.Field + CreatedAt apijson.Field + Name apijson.Field + DeletedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelGetResponseResultConnection struct { + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountTunnelGetResponseResultConnectionJSON `json:"-"` +} + +// accountTunnelGetResponseResultConnectionJSON contains the JSON metadata for the +// struct [AccountTunnelGetResponseResultConnection] +type accountTunnelGetResponseResultConnectionJSON struct { + ColoName apijson.Field + IsPendingReconnect apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelGetResponseResultConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTunnelGetResponseSuccess bool + +const ( + AccountTunnelGetResponseSuccessTrue AccountTunnelGetResponseSuccess = true +) + +type AccountTunnelDeleteResponse struct { + Errors []AccountTunnelDeleteResponseError `json:"errors"` + Messages []AccountTunnelDeleteResponseMessage `json:"messages"` + Result AccountTunnelDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTunnelDeleteResponseSuccess `json:"success"` + JSON accountTunnelDeleteResponseJSON `json:"-"` +} + +// accountTunnelDeleteResponseJSON contains the JSON metadata for the struct +// [AccountTunnelDeleteResponse] +type accountTunnelDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelDeleteResponseErrorJSON `json:"-"` +} + +// accountTunnelDeleteResponseErrorJSON contains the JSON metadata for the struct +// [AccountTunnelDeleteResponseError] +type accountTunnelDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelDeleteResponseMessageJSON `json:"-"` +} + +// accountTunnelDeleteResponseMessageJSON contains the JSON metadata for the struct +// [AccountTunnelDeleteResponseMessage] +type accountTunnelDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelDeleteResponseResult struct { + // UUID of the tunnel. + ID string `json:"id,required"` + // The tunnel connections between your origin and Cloudflare's edge. + Connections []AccountTunnelDeleteResponseResultConnection `json:"connections,required"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // A user-friendly name for the tunnel. + Name string `json:"name,required"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + JSON accountTunnelDeleteResponseResultJSON `json:"-"` +} + +// accountTunnelDeleteResponseResultJSON contains the JSON metadata for the struct +// [AccountTunnelDeleteResponseResult] +type accountTunnelDeleteResponseResultJSON struct { + ID apijson.Field + Connections apijson.Field + CreatedAt apijson.Field + Name apijson.Field + DeletedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelDeleteResponseResultConnection struct { + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountTunnelDeleteResponseResultConnectionJSON `json:"-"` +} + +// accountTunnelDeleteResponseResultConnectionJSON contains the JSON metadata for +// the struct [AccountTunnelDeleteResponseResultConnection] +type accountTunnelDeleteResponseResultConnectionJSON struct { + ColoName apijson.Field + IsPendingReconnect apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelDeleteResponseResultConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTunnelDeleteResponseSuccess bool + +const ( + AccountTunnelDeleteResponseSuccessTrue AccountTunnelDeleteResponseSuccess = true +) + +type AccountTunnelArgoTunnelNewAnArgoTunnelResponse struct { + Errors []AccountTunnelArgoTunnelNewAnArgoTunnelResponseError `json:"errors"` + Messages []AccountTunnelArgoTunnelNewAnArgoTunnelResponseMessage `json:"messages"` + Result AccountTunnelArgoTunnelNewAnArgoTunnelResponseResult `json:"result"` + // Whether the API call was successful + Success AccountTunnelArgoTunnelNewAnArgoTunnelResponseSuccess `json:"success"` + JSON accountTunnelArgoTunnelNewAnArgoTunnelResponseJSON `json:"-"` +} + +// accountTunnelArgoTunnelNewAnArgoTunnelResponseJSON contains the JSON metadata +// for the struct [AccountTunnelArgoTunnelNewAnArgoTunnelResponse] +type accountTunnelArgoTunnelNewAnArgoTunnelResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelNewAnArgoTunnelResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelArgoTunnelNewAnArgoTunnelResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelArgoTunnelNewAnArgoTunnelResponseErrorJSON `json:"-"` +} + +// accountTunnelArgoTunnelNewAnArgoTunnelResponseErrorJSON contains the JSON +// metadata for the struct [AccountTunnelArgoTunnelNewAnArgoTunnelResponseError] +type accountTunnelArgoTunnelNewAnArgoTunnelResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelNewAnArgoTunnelResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelArgoTunnelNewAnArgoTunnelResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelArgoTunnelNewAnArgoTunnelResponseMessageJSON `json:"-"` +} + +// accountTunnelArgoTunnelNewAnArgoTunnelResponseMessageJSON contains the JSON +// metadata for the struct [AccountTunnelArgoTunnelNewAnArgoTunnelResponseMessage] +type accountTunnelArgoTunnelNewAnArgoTunnelResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelNewAnArgoTunnelResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelArgoTunnelNewAnArgoTunnelResponseResult struct { + // UUID of the tunnel. + ID string `json:"id,required"` + // The tunnel connections between your origin and Cloudflare's edge. + Connections []AccountTunnelArgoTunnelNewAnArgoTunnelResponseResultConnection `json:"connections,required"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // A user-friendly name for the tunnel. + Name string `json:"name,required"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + JSON accountTunnelArgoTunnelNewAnArgoTunnelResponseResultJSON `json:"-"` +} + +// accountTunnelArgoTunnelNewAnArgoTunnelResponseResultJSON contains the JSON +// metadata for the struct [AccountTunnelArgoTunnelNewAnArgoTunnelResponseResult] +type accountTunnelArgoTunnelNewAnArgoTunnelResponseResultJSON struct { + ID apijson.Field + Connections apijson.Field + CreatedAt apijson.Field + Name apijson.Field + DeletedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelNewAnArgoTunnelResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelArgoTunnelNewAnArgoTunnelResponseResultConnection struct { + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountTunnelArgoTunnelNewAnArgoTunnelResponseResultConnectionJSON `json:"-"` +} + +// accountTunnelArgoTunnelNewAnArgoTunnelResponseResultConnectionJSON contains the +// JSON metadata for the struct +// [AccountTunnelArgoTunnelNewAnArgoTunnelResponseResultConnection] +type accountTunnelArgoTunnelNewAnArgoTunnelResponseResultConnectionJSON struct { + ColoName apijson.Field + IsPendingReconnect apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelNewAnArgoTunnelResponseResultConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTunnelArgoTunnelNewAnArgoTunnelResponseSuccess bool + +const ( + AccountTunnelArgoTunnelNewAnArgoTunnelResponseSuccessTrue AccountTunnelArgoTunnelNewAnArgoTunnelResponseSuccess = true +) + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by +// [AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnel] or +// [AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnel]. +type AccountTunnelArgoTunnelListArgoTunnelsResponse interface { + implementsAccountTunnelArgoTunnelListArgoTunnelsResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountTunnelArgoTunnelListArgoTunnelsResponse)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelJSON contains the +// JSON metadata for the struct +// [AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnel] +type accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnel) implementsAccountTunnelArgoTunnelListArgoTunnelsResponse() { +} + +type AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelConnection] +type accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunType string + +const ( + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunTypeCfdTunnel AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunTypeWarpConnector AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunType = "warp_connector" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunTypeIPSec AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunType = "ip_sec" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunTypeGre AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunType = "gre" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunTypeCni AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelJSON +// contains the JSON metadata for the struct +// [AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnel] +type accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnel) implementsAccountTunnelArgoTunnelListArgoTunnelsResponse() { +} + +type AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelConnection] +type accountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeGre AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunTypeCni AccountTunnelArgoTunnelListArgoTunnelsResponseXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +type AccountTunnelDeleteParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountTunnelDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountTunnelArgoTunnelNewAnArgoTunnelParams struct { + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name,required"` + // Sets the password required to run the tunnel. Must be at least 32 bytes and + // encoded as a base64 string. + TunnelSecret param.Field[interface{}] `json:"tunnel_secret,required"` +} + +func (r AccountTunnelArgoTunnelNewAnArgoTunnelParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountTunnelArgoTunnelListArgoTunnelsParams struct { + ExcludePrefix param.Field[string] `query:"exclude_prefix"` + // If provided, include only tunnels that were created (and not deleted) before + // this time. + ExistedAt param.Field[time.Time] `query:"existed_at" format:"date-time"` + IncludePrefix param.Field[string] `query:"include_prefix"` + // If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If + // empty, all tunnels will be included. + IsDeleted param.Field[bool] `query:"is_deleted"` + // A user-friendly name for the tunnel. + Name param.Field[string] `query:"name"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of results to display. + PerPage param.Field[float64] `query:"per_page"` + // The types of tunnels to filter separated by a comma. + TunTypes param.Field[string] `query:"tun_types"` + WasActiveAt param.Field[time.Time] `query:"was_active_at" format:"date-time"` + WasInactiveAt param.Field[time.Time] `query:"was_inactive_at" format:"date-time"` +} + +// URLQuery serializes [AccountTunnelArgoTunnelListArgoTunnelsParams]'s query +// parameters as `url.Values`. +func (r AccountTunnelArgoTunnelListArgoTunnelsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accounttunnel_test.go b/accounttunnel_test.go new file mode 100644 index 00000000000..d53bacd5ca9 --- /dev/null +++ b/accounttunnel_test.go @@ -0,0 +1,152 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountTunnelGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Tunnels.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountTunnelDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Tunnels.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountTunnelDeleteParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountTunnelArgoTunnelNewAnArgoTunnel(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Tunnels.ArgoTunnelNewAnArgoTunnel( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountTunnelArgoTunnelNewAnArgoTunnelParams{ + Name: cloudflare.F("blog"), + TunnelSecret: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountTunnelArgoTunnelListArgoTunnelsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Tunnels.ArgoTunnelListArgoTunnels( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountTunnelArgoTunnelListArgoTunnelsParams{ + ExcludePrefix: cloudflare.F("vpc1-"), + ExistedAt: cloudflare.F(time.Now()), + IncludePrefix: cloudflare.F("vpc1-"), + IsDeleted: cloudflare.F(true), + Name: cloudflare.F("blog"), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + TunTypes: cloudflare.F("cfd_tunnel,warp_connector"), + WasActiveAt: cloudflare.F(time.Now()), + WasInactiveAt: cloudflare.F(time.Now()), + }, + ) + 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/accounttunnelconnection.go b/accounttunnelconnection.go new file mode 100644 index 00000000000..30de43780be --- /dev/null +++ b/accounttunnelconnection.go @@ -0,0 +1,118 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountTunnelConnectionService 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 +// [NewAccountTunnelConnectionService] method instead. +type AccountTunnelConnectionService struct { + Options []option.RequestOption +} + +// NewAccountTunnelConnectionService 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 NewAccountTunnelConnectionService(opts ...option.RequestOption) (r *AccountTunnelConnectionService) { + r = &AccountTunnelConnectionService{} + r.Options = opts + return +} + +// Removes connections that are in a disconnected or pending reconnect state. We +// recommend running this command after shutting down a tunnel. +func (r *AccountTunnelConnectionService) Delete(ctx context.Context, accountIdentifier string, tunnelID string, body AccountTunnelConnectionDeleteParams, opts ...option.RequestOption) (res *AccountTunnelConnectionDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/tunnels/%s/connections", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +type AccountTunnelConnectionDeleteResponse struct { + Errors []AccountTunnelConnectionDeleteResponseError `json:"errors"` + Messages []AccountTunnelConnectionDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success AccountTunnelConnectionDeleteResponseSuccess `json:"success"` + JSON accountTunnelConnectionDeleteResponseJSON `json:"-"` +} + +// accountTunnelConnectionDeleteResponseJSON contains the JSON metadata for the +// struct [AccountTunnelConnectionDeleteResponse] +type accountTunnelConnectionDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelConnectionDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelConnectionDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelConnectionDeleteResponseErrorJSON `json:"-"` +} + +// accountTunnelConnectionDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountTunnelConnectionDeleteResponseError] +type accountTunnelConnectionDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelConnectionDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountTunnelConnectionDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountTunnelConnectionDeleteResponseMessageJSON `json:"-"` +} + +// accountTunnelConnectionDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountTunnelConnectionDeleteResponseMessage] +type accountTunnelConnectionDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountTunnelConnectionDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountTunnelConnectionDeleteResponseSuccess bool + +const ( + AccountTunnelConnectionDeleteResponseSuccessTrue AccountTunnelConnectionDeleteResponseSuccess = true +) + +type AccountTunnelConnectionDeleteParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountTunnelConnectionDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accounttunnelconnection_test.go b/accounttunnelconnection_test.go new file mode 100644 index 00000000000..990ec0c638d --- /dev/null +++ b/accounttunnelconnection_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountTunnelConnectionDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Tunnels.Connections.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountTunnelConnectionDeleteParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/accounturlscanner.go b/accounturlscanner.go new file mode 100644 index 00000000000..11fce071bb6 --- /dev/null +++ b/accounturlscanner.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountUrlscannerService 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 [NewAccountUrlscannerService] method +// instead. +type AccountUrlscannerService struct { + Options []option.RequestOption + Scan *AccountUrlscannerScanService + Har *AccountUrlscannerHarService + Screenshot *AccountUrlscannerScreenshotService +} + +// NewAccountUrlscannerService 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 NewAccountUrlscannerService(opts ...option.RequestOption) (r *AccountUrlscannerService) { + r = &AccountUrlscannerService{} + r.Options = opts + r.Scan = NewAccountUrlscannerScanService(opts...) + r.Har = NewAccountUrlscannerHarService(opts...) + r.Screenshot = NewAccountUrlscannerScreenshotService(opts...) + return +} diff --git a/accounturlscannerhar.go b/accounturlscannerhar.go new file mode 100644 index 00000000000..a597dc3f6b8 --- /dev/null +++ b/accounturlscannerhar.go @@ -0,0 +1,386 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountUrlscannerHarService 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 [NewAccountUrlscannerHarService] +// method instead. +type AccountUrlscannerHarService struct { + Options []option.RequestOption +} + +// NewAccountUrlscannerHarService 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 NewAccountUrlscannerHarService(opts ...option.RequestOption) (r *AccountUrlscannerHarService) { + r = &AccountUrlscannerHarService{} + r.Options = opts + return +} + +// Get a URL scan's HAR file. See HAR spec at +// http://www.softwareishard.com/blog/har-12-spec/. +func (r *AccountUrlscannerHarService) Get(ctx context.Context, accountID string, scanID string, opts ...option.RequestOption) (res *AccountUrlscannerHarGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/urlscanner/scan/%s/har", accountID, scanID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountUrlscannerHarGetResponse struct { + Errors []AccountUrlscannerHarGetResponseError `json:"errors,required"` + Messages []AccountUrlscannerHarGetResponseMessage `json:"messages,required"` + Result AccountUrlscannerHarGetResponseResult `json:"result,required"` + // Whether search request was successful or not + Success bool `json:"success,required"` + JSON accountUrlscannerHarGetResponseJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseJSON contains the JSON metadata for the struct +// [AccountUrlscannerHarGetResponse] +type accountUrlscannerHarGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseError struct { + Message string `json:"message,required"` + JSON accountUrlscannerHarGetResponseErrorJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountUrlscannerHarGetResponseError] +type accountUrlscannerHarGetResponseErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseMessage struct { + Message string `json:"message,required"` + JSON accountUrlscannerHarGetResponseMessageJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountUrlscannerHarGetResponseMessage] +type accountUrlscannerHarGetResponseMessageJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResult struct { + Har AccountUrlscannerHarGetResponseResultHar `json:"har,required"` + JSON accountUrlscannerHarGetResponseResultJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultJSON contains the JSON metadata for the +// struct [AccountUrlscannerHarGetResponseResult] +type accountUrlscannerHarGetResponseResultJSON struct { + Har apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHar struct { + Log AccountUrlscannerHarGetResponseResultHarLog `json:"log,required"` + JSON accountUrlscannerHarGetResponseResultHarJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarJSON contains the JSON metadata for the +// struct [AccountUrlscannerHarGetResponseResultHar] +type accountUrlscannerHarGetResponseResultHarJSON struct { + Log apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHar) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLog struct { + Creator AccountUrlscannerHarGetResponseResultHarLogCreator `json:"creator,required"` + Entries []AccountUrlscannerHarGetResponseResultHarLogEntry `json:"entries,required"` + Pages []AccountUrlscannerHarGetResponseResultHarLogPage `json:"pages,required"` + Version string `json:"version,required"` + JSON accountUrlscannerHarGetResponseResultHarLogJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogJSON contains the JSON metadata for +// the struct [AccountUrlscannerHarGetResponseResultHarLog] +type accountUrlscannerHarGetResponseResultHarLogJSON struct { + Creator apijson.Field + Entries apijson.Field + Pages apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLog) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogCreator struct { + Comment string `json:"comment,required"` + Name string `json:"name,required"` + Version string `json:"version,required"` + JSON accountUrlscannerHarGetResponseResultHarLogCreatorJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogCreatorJSON contains the JSON +// metadata for the struct [AccountUrlscannerHarGetResponseResultHarLogCreator] +type accountUrlscannerHarGetResponseResultHarLogCreatorJSON struct { + Comment apijson.Field + Name apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogCreator) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogEntry struct { + InitialPriority string `json:"_initialPriority,required"` + InitiatorType string `json:"_initiator_type,required"` + Priority string `json:"_priority,required"` + RequestID string `json:"_requestId,required"` + RequestTime float64 `json:"_requestTime,required"` + ResourceType string `json:"_resourceType,required"` + Cache interface{} `json:"cache,required"` + Connection string `json:"connection,required"` + Pageref string `json:"pageref,required"` + Request AccountUrlscannerHarGetResponseResultHarLogEntriesRequest `json:"request,required"` + Response AccountUrlscannerHarGetResponseResultHarLogEntriesResponse `json:"response,required"` + ServerIPAddress string `json:"serverIPAddress,required"` + StartedDateTime string `json:"startedDateTime,required"` + Time float64 `json:"time,required"` + JSON accountUrlscannerHarGetResponseResultHarLogEntryJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogEntryJSON contains the JSON metadata +// for the struct [AccountUrlscannerHarGetResponseResultHarLogEntry] +type accountUrlscannerHarGetResponseResultHarLogEntryJSON struct { + InitialPriority apijson.Field + InitiatorType apijson.Field + Priority apijson.Field + RequestID apijson.Field + RequestTime apijson.Field + ResourceType apijson.Field + Cache apijson.Field + Connection apijson.Field + Pageref apijson.Field + Request apijson.Field + Response apijson.Field + ServerIPAddress apijson.Field + StartedDateTime apijson.Field + Time apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogEntriesRequest struct { + BodySize float64 `json:"bodySize,required"` + Headers []AccountUrlscannerHarGetResponseResultHarLogEntriesRequestHeader `json:"headers,required"` + HeadersSize float64 `json:"headersSize,required"` + HTTPVersion string `json:"httpVersion,required"` + Method string `json:"method,required"` + URL string `json:"url,required"` + JSON accountUrlscannerHarGetResponseResultHarLogEntriesRequestJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogEntriesRequestJSON contains the JSON +// metadata for the struct +// [AccountUrlscannerHarGetResponseResultHarLogEntriesRequest] +type accountUrlscannerHarGetResponseResultHarLogEntriesRequestJSON struct { + BodySize apijson.Field + Headers apijson.Field + HeadersSize apijson.Field + HTTPVersion apijson.Field + Method apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogEntriesRequest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogEntriesRequestHeader struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON accountUrlscannerHarGetResponseResultHarLogEntriesRequestHeaderJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogEntriesRequestHeaderJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerHarGetResponseResultHarLogEntriesRequestHeader] +type accountUrlscannerHarGetResponseResultHarLogEntriesRequestHeaderJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogEntriesRequestHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogEntriesResponse struct { + TransferSize float64 `json:"_transferSize,required"` + BodySize float64 `json:"bodySize,required"` + Content AccountUrlscannerHarGetResponseResultHarLogEntriesResponseContent `json:"content,required"` + Headers []AccountUrlscannerHarGetResponseResultHarLogEntriesResponseHeader `json:"headers,required"` + HeadersSize float64 `json:"headersSize,required"` + HTTPVersion string `json:"httpVersion,required"` + RedirectURL string `json:"redirectURL,required"` + Status float64 `json:"status,required"` + StatusText string `json:"statusText,required"` + JSON accountUrlscannerHarGetResponseResultHarLogEntriesResponseJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogEntriesResponseJSON contains the JSON +// metadata for the struct +// [AccountUrlscannerHarGetResponseResultHarLogEntriesResponse] +type accountUrlscannerHarGetResponseResultHarLogEntriesResponseJSON struct { + TransferSize apijson.Field + BodySize apijson.Field + Content apijson.Field + Headers apijson.Field + HeadersSize apijson.Field + HTTPVersion apijson.Field + RedirectURL apijson.Field + Status apijson.Field + StatusText apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogEntriesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogEntriesResponseContent struct { + MimeType string `json:"mimeType,required"` + Size float64 `json:"size,required"` + Compression int64 `json:"compression"` + JSON accountUrlscannerHarGetResponseResultHarLogEntriesResponseContentJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogEntriesResponseContentJSON contains +// the JSON metadata for the struct +// [AccountUrlscannerHarGetResponseResultHarLogEntriesResponseContent] +type accountUrlscannerHarGetResponseResultHarLogEntriesResponseContentJSON struct { + MimeType apijson.Field + Size apijson.Field + Compression apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogEntriesResponseContent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogEntriesResponseHeader struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON accountUrlscannerHarGetResponseResultHarLogEntriesResponseHeaderJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogEntriesResponseHeaderJSON contains +// the JSON metadata for the struct +// [AccountUrlscannerHarGetResponseResultHarLogEntriesResponseHeader] +type accountUrlscannerHarGetResponseResultHarLogEntriesResponseHeaderJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogEntriesResponseHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogPage struct { + ID string `json:"id,required"` + PageTimings AccountUrlscannerHarGetResponseResultHarLogPagesPageTimings `json:"pageTimings,required"` + StartedDateTime string `json:"startedDateTime,required"` + Title string `json:"title,required"` + JSON accountUrlscannerHarGetResponseResultHarLogPageJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogPageJSON contains the JSON metadata +// for the struct [AccountUrlscannerHarGetResponseResultHarLogPage] +type accountUrlscannerHarGetResponseResultHarLogPageJSON struct { + ID apijson.Field + PageTimings apijson.Field + StartedDateTime apijson.Field + Title apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogPage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerHarGetResponseResultHarLogPagesPageTimings struct { + OnContentLoad float64 `json:"onContentLoad,required"` + OnLoad float64 `json:"onLoad,required"` + JSON accountUrlscannerHarGetResponseResultHarLogPagesPageTimingsJSON `json:"-"` +} + +// accountUrlscannerHarGetResponseResultHarLogPagesPageTimingsJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerHarGetResponseResultHarLogPagesPageTimings] +type accountUrlscannerHarGetResponseResultHarLogPagesPageTimingsJSON struct { + OnContentLoad apijson.Field + OnLoad apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerHarGetResponseResultHarLogPagesPageTimings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/accounturlscannerhar_test.go b/accounturlscannerhar_test.go new file mode 100644 index 00000000000..b8bfbff37b0 --- /dev/null +++ b/accounturlscannerhar_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountUrlscannerHarGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Urlscanner.Har.Get( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + 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/accounturlscannerscan.go b/accounturlscannerscan.go new file mode 100644 index 00000000000..2b0571c9b19 --- /dev/null +++ b/accounturlscannerscan.go @@ -0,0 +1,1530 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountUrlscannerScanService 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 [NewAccountUrlscannerScanService] +// method instead. +type AccountUrlscannerScanService struct { + Options []option.RequestOption +} + +// NewAccountUrlscannerScanService 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 NewAccountUrlscannerScanService(opts ...option.RequestOption) (r *AccountUrlscannerScanService) { + r = &AccountUrlscannerScanService{} + r.Options = opts + return +} + +// Submit a URL to scan. You can also set some options, like the visibility level +// and custom headers. Accounts are limited to 1 new scan every 10 seconds and 8000 +// per month. If you need more, please reach out. +func (r *AccountUrlscannerScanService) New(ctx context.Context, accountID string, body AccountUrlscannerScanNewParams, opts ...option.RequestOption) (res *AccountUrlscannerScanNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/urlscanner/scan", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get URL scan by uuid +func (r *AccountUrlscannerScanService) Get(ctx context.Context, accountID string, scanID string, opts ...option.RequestOption) (res *AccountUrlscannerScanGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/urlscanner/scan/%s", accountID, scanID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Search scans by date and webpages' requests, including full URL (after +// redirects), hostname, and path.
A successful scan will appear in search +// results a few minutes after finishing but may take much longer if the system in +// under load. By default, only successfully completed scans will appear in search +// results, unless searching by `scanId`. Please take into account that older scans +// may be removed from the search index at an unspecified time. +func (r *AccountUrlscannerScanService) List(ctx context.Context, accountID string, query AccountUrlscannerScanListParams, opts ...option.RequestOption) (res *AccountUrlscannerScanListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/urlscanner/scan", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountUrlscannerScanNewResponse struct { + Errors []AccountUrlscannerScanNewResponseError `json:"errors,required"` + Messages []AccountUrlscannerScanNewResponseMessage `json:"messages,required"` + Result AccountUrlscannerScanNewResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON accountUrlscannerScanNewResponseJSON `json:"-"` +} + +// accountUrlscannerScanNewResponseJSON contains the JSON metadata for the struct +// [AccountUrlscannerScanNewResponse] +type accountUrlscannerScanNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanNewResponseError struct { + Message string `json:"message,required"` + JSON accountUrlscannerScanNewResponseErrorJSON `json:"-"` +} + +// accountUrlscannerScanNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanNewResponseError] +type accountUrlscannerScanNewResponseErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanNewResponseMessage struct { + Message string `json:"message,required"` + JSON accountUrlscannerScanNewResponseMessageJSON `json:"-"` +} + +// accountUrlscannerScanNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanNewResponseMessage] +type accountUrlscannerScanNewResponseMessageJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanNewResponseResult struct { + // Time when url was submitted for scanning. + Time time.Time `json:"time,required" format:"date-time"` + // Canonical form of submitted URL. Use this if you want to later search by URL. + URL string `json:"url,required"` + // Scan ID. + Uuid string `json:"uuid,required" format:"uuid"` + // Submitted visibility status. + Visibility string `json:"visibility,required"` + JSON accountUrlscannerScanNewResponseResultJSON `json:"-"` +} + +// accountUrlscannerScanNewResponseResultJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanNewResponseResult] +type accountUrlscannerScanNewResponseResultJSON struct { + Time apijson.Field + URL apijson.Field + Uuid apijson.Field + Visibility apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponse struct { + Errors []AccountUrlscannerScanGetResponseError `json:"errors,required"` + Messages []AccountUrlscannerScanGetResponseMessage `json:"messages,required"` + Result AccountUrlscannerScanGetResponseResult `json:"result,required"` + // Whether request was successful or not + Success bool `json:"success,required"` + JSON accountUrlscannerScanGetResponseJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseJSON contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponse] +type accountUrlscannerScanGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseError struct { + Message string `json:"message,required"` + JSON accountUrlscannerScanGetResponseErrorJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanGetResponseError] +type accountUrlscannerScanGetResponseErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseMessage struct { + Message string `json:"message,required"` + JSON accountUrlscannerScanGetResponseMessageJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanGetResponseMessage] +type accountUrlscannerScanGetResponseMessageJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResult struct { + Scan AccountUrlscannerScanGetResponseResultScan `json:"scan,required"` + JSON accountUrlscannerScanGetResponseResultJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanGetResponseResult] +type accountUrlscannerScanGetResponseResultJSON struct { + Scan apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScan struct { + Certificates []AccountUrlscannerScanGetResponseResultScanCertificate `json:"certificates,required"` + Geo AccountUrlscannerScanGetResponseResultScanGeo `json:"geo,required"` + Meta AccountUrlscannerScanGetResponseResultScanMeta `json:"meta,required"` + Page AccountUrlscannerScanGetResponseResultScanPage `json:"page,required"` + Performance []AccountUrlscannerScanGetResponseResultScanPerformance `json:"performance,required"` + Task AccountUrlscannerScanGetResponseResultScanTask `json:"task,required"` + Verdicts AccountUrlscannerScanGetResponseResultScanVerdicts `json:"verdicts,required"` + // Dictionary of Autonomous System Numbers where ASN's are the keys + ASNs AccountUrlscannerScanGetResponseResultScanASNs `json:"asns"` + Domains AccountUrlscannerScanGetResponseResultScanDomains `json:"domains"` + IPs AccountUrlscannerScanGetResponseResultScanIPs `json:"ips"` + Links AccountUrlscannerScanGetResponseResultScanLinks `json:"links"` + JSON accountUrlscannerScanGetResponseResultScanJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanJSON contains the JSON metadata for +// the struct [AccountUrlscannerScanGetResponseResultScan] +type accountUrlscannerScanGetResponseResultScanJSON struct { + Certificates apijson.Field + Geo apijson.Field + Meta apijson.Field + Page apijson.Field + Performance apijson.Field + Task apijson.Field + Verdicts apijson.Field + ASNs apijson.Field + Domains apijson.Field + IPs apijson.Field + Links apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScan) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanCertificate struct { + Issuer string `json:"issuer,required"` + SubjectName string `json:"subjectName,required"` + ValidFrom float64 `json:"validFrom,required"` + ValidTo float64 `json:"validTo,required"` + JSON accountUrlscannerScanGetResponseResultScanCertificateJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanCertificateJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanCertificate] +type accountUrlscannerScanGetResponseResultScanCertificateJSON struct { + Issuer apijson.Field + SubjectName apijson.Field + ValidFrom apijson.Field + ValidTo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanCertificate) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanGeo struct { + // GeoIP continent location + Continents []string `json:"continents,required"` + // GeoIP country location + Locations []string `json:"locations,required"` + JSON accountUrlscannerScanGetResponseResultScanGeoJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanGeoJSON contains the JSON metadata for +// the struct [AccountUrlscannerScanGetResponseResultScanGeo] +type accountUrlscannerScanGetResponseResultScanGeoJSON struct { + Continents apijson.Field + Locations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMeta struct { + Processors AccountUrlscannerScanGetResponseResultScanMetaProcessors `json:"processors,required"` + JSON accountUrlscannerScanGetResponseResultScanMetaJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanMeta] +type accountUrlscannerScanGetResponseResultScanMetaJSON struct { + Processors apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessors struct { + Categories AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategories `json:"categories,required"` + GoogleSafeBrowsing []string `json:"google_safe_browsing,required"` + Phishing []string `json:"phishing,required"` + Rank AccountUrlscannerScanGetResponseResultScanMetaProcessorsRank `json:"rank,required"` + Tech []AccountUrlscannerScanGetResponseResultScanMetaProcessorsTech `json:"tech,required"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsJSON contains the JSON +// metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessors] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsJSON struct { + Categories apijson.Field + GoogleSafeBrowsing apijson.Field + Phishing apijson.Field + Rank apijson.Field + Tech apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategories struct { + Content []AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesContent `json:"content,required"` + Risks []AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesRisk `json:"risks,required"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesJSON contains +// the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategories] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesJSON struct { + Content apijson.Field + Risks apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategories) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesContent struct { + ID int64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesContentJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesContentJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesContent] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesContentJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesContent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesRisk struct { + ID int64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID int64 `json:"super_category_id,required"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesRiskJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesRiskJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesRisk] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesRiskJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsCategoriesRisk) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsRank struct { + Bucket string `json:"bucket,required"` + Name string `json:"name,required"` + // Rank in the Global Radar Rank, if set. See more at + // https://blog.cloudflare.com/radar-domain-rankings/ + Rank int64 `json:"rank"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsRankJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsRankJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsRank] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsRankJSON struct { + Bucket apijson.Field + Name apijson.Field + Rank apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsRank) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsTech struct { + Categories []AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechCategory `json:"categories,required"` + Confidence int64 `json:"confidence,required"` + Evidence AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidence `json:"evidence,required"` + Icon string `json:"icon,required"` + Name string `json:"name,required"` + Slug string `json:"slug,required"` + Website string `json:"website,required"` + Description string `json:"description"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsTechJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsTechJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsTech] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsTechJSON struct { + Categories apijson.Field + Confidence apijson.Field + Evidence apijson.Field + Icon apijson.Field + Name apijson.Field + Slug apijson.Field + Website apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsTech) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechCategory struct { + ID int64 `json:"id,required"` + Groups []int64 `json:"groups,required"` + Name string `json:"name,required"` + Priority int64 `json:"priority,required"` + Slug string `json:"slug,required"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsTechCategoryJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsTechCategoryJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechCategory] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsTechCategoryJSON struct { + ID apijson.Field + Groups apijson.Field + Name apijson.Field + Priority apijson.Field + Slug apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechCategory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidence struct { + ImpliedBy []string `json:"impliedBy,required"` + Patterns []AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidencePattern `json:"patterns,required"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidenceJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidenceJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidence] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidenceJSON struct { + ImpliedBy apijson.Field + Patterns apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidence) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidencePattern struct { + Confidence int64 `json:"confidence,required"` + Excludes []string `json:"excludes,required"` + Implies []string `json:"implies,required"` + Match string `json:"match,required"` + // Header or Cookie name when set + Name string `json:"name,required"` + Regex string `json:"regex,required"` + Type string `json:"type,required"` + Value string `json:"value,required"` + Version string `json:"version,required"` + JSON accountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidencePatternJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidencePatternJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidencePattern] +type accountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidencePatternJSON struct { + Confidence apijson.Field + Excludes apijson.Field + Implies apijson.Field + Match apijson.Field + Name apijson.Field + Regex apijson.Field + Type apijson.Field + Value apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanMetaProcessorsTechEvidencePattern) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPage struct { + ASN string `json:"asn,required"` + ASNLocationAlpha2 string `json:"asnLocationAlpha2,required"` + Asnname string `json:"asnname,required"` + Console []AccountUrlscannerScanGetResponseResultScanPageConsole `json:"console,required"` + Cookies []AccountUrlscannerScanGetResponseResultScanPageCooky `json:"cookies,required"` + Country string `json:"country,required"` + CountryLocationAlpha2 string `json:"countryLocationAlpha2,required"` + Domain string `json:"domain,required"` + Headers []AccountUrlscannerScanGetResponseResultScanPageHeader `json:"headers,required"` + IP string `json:"ip,required"` + Js AccountUrlscannerScanGetResponseResultScanPageJs `json:"js,required"` + SecurityViolations []AccountUrlscannerScanGetResponseResultScanPageSecurityViolation `json:"securityViolations,required"` + Status float64 `json:"status,required"` + Subdivision1Name string `json:"subdivision1Name,required"` + Subdivision2name string `json:"subdivision2name,required"` + URL string `json:"url,required"` + JSON accountUrlscannerScanGetResponseResultScanPageJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPageJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanPage] +type accountUrlscannerScanGetResponseResultScanPageJSON struct { + ASN apijson.Field + ASNLocationAlpha2 apijson.Field + Asnname apijson.Field + Console apijson.Field + Cookies apijson.Field + Country apijson.Field + CountryLocationAlpha2 apijson.Field + Domain apijson.Field + Headers apijson.Field + IP apijson.Field + Js apijson.Field + SecurityViolations apijson.Field + Status apijson.Field + Subdivision1Name apijson.Field + Subdivision2name apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPageConsole struct { + Category string `json:"category,required"` + Text string `json:"text,required"` + Type string `json:"type,required"` + URL string `json:"url"` + JSON accountUrlscannerScanGetResponseResultScanPageConsoleJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPageConsoleJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanPageConsole] +type accountUrlscannerScanGetResponseResultScanPageConsoleJSON struct { + Category apijson.Field + Text apijson.Field + Type apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPageConsole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPageCooky struct { + Domain string `json:"domain,required"` + Expires float64 `json:"expires,required"` + HTTPOnly bool `json:"httpOnly,required"` + Name string `json:"name,required"` + Path string `json:"path,required"` + SameParty bool `json:"sameParty,required"` + Secure bool `json:"secure,required"` + Session bool `json:"session,required"` + Size float64 `json:"size,required"` + SourcePort float64 `json:"sourcePort,required"` + SourceScheme string `json:"sourceScheme,required"` + Value string `json:"value,required"` + Priority string `json:"priority"` + JSON accountUrlscannerScanGetResponseResultScanPageCookyJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPageCookyJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanPageCooky] +type accountUrlscannerScanGetResponseResultScanPageCookyJSON struct { + Domain apijson.Field + Expires apijson.Field + HTTPOnly apijson.Field + Name apijson.Field + Path apijson.Field + SameParty apijson.Field + Secure apijson.Field + Session apijson.Field + Size apijson.Field + SourcePort apijson.Field + SourceScheme apijson.Field + Value apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPageCooky) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPageHeader struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON accountUrlscannerScanGetResponseResultScanPageHeaderJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPageHeaderJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanPageHeader] +type accountUrlscannerScanGetResponseResultScanPageHeaderJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPageHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPageJs struct { + Variables []AccountUrlscannerScanGetResponseResultScanPageJsVariable `json:"variables,required"` + JSON accountUrlscannerScanGetResponseResultScanPageJsJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPageJsJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanPageJs] +type accountUrlscannerScanGetResponseResultScanPageJsJSON struct { + Variables apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPageJs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPageJsVariable struct { + Name string `json:"name,required"` + Type string `json:"type,required"` + JSON accountUrlscannerScanGetResponseResultScanPageJsVariableJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPageJsVariableJSON contains the JSON +// metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanPageJsVariable] +type accountUrlscannerScanGetResponseResultScanPageJsVariableJSON struct { + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPageJsVariable) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPageSecurityViolation struct { + Category string `json:"category,required"` + Text string `json:"text,required"` + URL string `json:"url,required"` + JSON accountUrlscannerScanGetResponseResultScanPageSecurityViolationJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPageSecurityViolationJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanPageSecurityViolation] +type accountUrlscannerScanGetResponseResultScanPageSecurityViolationJSON struct { + Category apijson.Field + Text apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPageSecurityViolation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanPerformance struct { + ConnectEnd float64 `json:"connectEnd,required"` + ConnectStart float64 `json:"connectStart,required"` + DecodedBodySize float64 `json:"decodedBodySize,required"` + DomainLookupEnd float64 `json:"domainLookupEnd,required"` + DomainLookupStart float64 `json:"domainLookupStart,required"` + DomComplete float64 `json:"domComplete,required"` + DomContentLoadedEventEnd float64 `json:"domContentLoadedEventEnd,required"` + DomContentLoadedEventStart float64 `json:"domContentLoadedEventStart,required"` + DomInteractive float64 `json:"domInteractive,required"` + Duration float64 `json:"duration,required"` + EncodedBodySize float64 `json:"encodedBodySize,required"` + EntryType string `json:"entryType,required"` + FetchStart float64 `json:"fetchStart,required"` + InitiatorType string `json:"initiatorType,required"` + LoadEventEnd float64 `json:"loadEventEnd,required"` + LoadEventStart float64 `json:"loadEventStart,required"` + Name string `json:"name,required"` + NextHopProtocol string `json:"nextHopProtocol,required"` + RedirectCount float64 `json:"redirectCount,required"` + RedirectEnd float64 `json:"redirectEnd,required"` + RedirectStart float64 `json:"redirectStart,required"` + RequestStart float64 `json:"requestStart,required"` + ResponseEnd float64 `json:"responseEnd,required"` + ResponseStart float64 `json:"responseStart,required"` + SecureConnectionStart float64 `json:"secureConnectionStart,required"` + StartTime float64 `json:"startTime,required"` + TransferSize float64 `json:"transferSize,required"` + Type string `json:"type,required"` + UnloadEventEnd float64 `json:"unloadEventEnd,required"` + UnloadEventStart float64 `json:"unloadEventStart,required"` + WorkerStart float64 `json:"workerStart,required"` + JSON accountUrlscannerScanGetResponseResultScanPerformanceJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanPerformanceJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanPerformance] +type accountUrlscannerScanGetResponseResultScanPerformanceJSON struct { + ConnectEnd apijson.Field + ConnectStart apijson.Field + DecodedBodySize apijson.Field + DomainLookupEnd apijson.Field + DomainLookupStart apijson.Field + DomComplete apijson.Field + DomContentLoadedEventEnd apijson.Field + DomContentLoadedEventStart apijson.Field + DomInteractive apijson.Field + Duration apijson.Field + EncodedBodySize apijson.Field + EntryType apijson.Field + FetchStart apijson.Field + InitiatorType apijson.Field + LoadEventEnd apijson.Field + LoadEventStart apijson.Field + Name apijson.Field + NextHopProtocol apijson.Field + RedirectCount apijson.Field + RedirectEnd apijson.Field + RedirectStart apijson.Field + RequestStart apijson.Field + ResponseEnd apijson.Field + ResponseStart apijson.Field + SecureConnectionStart apijson.Field + StartTime apijson.Field + TransferSize apijson.Field + Type apijson.Field + UnloadEventEnd apijson.Field + UnloadEventStart apijson.Field + WorkerStart apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanPerformance) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanTask struct { + // Submitter location + ClientLocation string `json:"clientLocation,required"` + ClientType AccountUrlscannerScanGetResponseResultScanTaskClientType `json:"clientType,required"` + // URL of the primary request, after all HTTP redirects + EffectiveURL string `json:"effectiveUrl,required"` + Errors []AccountUrlscannerScanGetResponseResultScanTaskError `json:"errors,required"` + ScannedFrom AccountUrlscannerScanGetResponseResultScanTaskScannedFrom `json:"scannedFrom,required"` + Status AccountUrlscannerScanGetResponseResultScanTaskStatus `json:"status,required"` + Success bool `json:"success,required"` + Time string `json:"time,required"` + TimeEnd string `json:"timeEnd,required"` + // Submitted URL + URL string `json:"url,required"` + // Scan ID + Uuid string `json:"uuid,required"` + Visibility AccountUrlscannerScanGetResponseResultScanTaskVisibility `json:"visibility,required"` + JSON accountUrlscannerScanGetResponseResultScanTaskJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanTaskJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanTask] +type accountUrlscannerScanGetResponseResultScanTaskJSON struct { + ClientLocation apijson.Field + ClientType apijson.Field + EffectiveURL apijson.Field + Errors apijson.Field + ScannedFrom apijson.Field + Status apijson.Field + Success apijson.Field + Time apijson.Field + TimeEnd apijson.Field + URL apijson.Field + Uuid apijson.Field + Visibility apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanTask) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanTaskClientType string + +const ( + AccountUrlscannerScanGetResponseResultScanTaskClientTypeSite AccountUrlscannerScanGetResponseResultScanTaskClientType = "Site" + AccountUrlscannerScanGetResponseResultScanTaskClientTypeAutomatic AccountUrlscannerScanGetResponseResultScanTaskClientType = "Automatic" + AccountUrlscannerScanGetResponseResultScanTaskClientTypeAPI AccountUrlscannerScanGetResponseResultScanTaskClientType = "Api" +) + +type AccountUrlscannerScanGetResponseResultScanTaskError struct { + Message string `json:"message,required"` + JSON accountUrlscannerScanGetResponseResultScanTaskErrorJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanTaskErrorJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanTaskError] +type accountUrlscannerScanGetResponseResultScanTaskErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanTaskError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanTaskScannedFrom struct { + // IATA code of Cloudflare datacenter + Colo string `json:"colo,required"` + JSON accountUrlscannerScanGetResponseResultScanTaskScannedFromJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanTaskScannedFromJSON contains the JSON +// metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanTaskScannedFrom] +type accountUrlscannerScanGetResponseResultScanTaskScannedFromJSON struct { + Colo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanTaskScannedFrom) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanTaskStatus string + +const ( + AccountUrlscannerScanGetResponseResultScanTaskStatusQueued AccountUrlscannerScanGetResponseResultScanTaskStatus = "Queued" + AccountUrlscannerScanGetResponseResultScanTaskStatusInProgress AccountUrlscannerScanGetResponseResultScanTaskStatus = "InProgress" + AccountUrlscannerScanGetResponseResultScanTaskStatusInPostProcessing AccountUrlscannerScanGetResponseResultScanTaskStatus = "InPostProcessing" + AccountUrlscannerScanGetResponseResultScanTaskStatusFinished AccountUrlscannerScanGetResponseResultScanTaskStatus = "Finished" +) + +type AccountUrlscannerScanGetResponseResultScanTaskVisibility string + +const ( + AccountUrlscannerScanGetResponseResultScanTaskVisibilityPublic AccountUrlscannerScanGetResponseResultScanTaskVisibility = "Public" + AccountUrlscannerScanGetResponseResultScanTaskVisibilityUnlisted AccountUrlscannerScanGetResponseResultScanTaskVisibility = "Unlisted" +) + +type AccountUrlscannerScanGetResponseResultScanVerdicts struct { + Overall AccountUrlscannerScanGetResponseResultScanVerdictsOverall `json:"overall,required"` + JSON accountUrlscannerScanGetResponseResultScanVerdictsJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanVerdictsJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanVerdicts] +type accountUrlscannerScanGetResponseResultScanVerdictsJSON struct { + Overall apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanVerdicts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanVerdictsOverall struct { + Categories []AccountUrlscannerScanGetResponseResultScanVerdictsOverallCategory `json:"categories,required"` + // Please visit https://safebrowsing.google.com/ for more information. + GsbThreatTypes []string `json:"gsb_threat_types,required"` + // At least one of our subsystems marked the site as potentially malicious at the + // time of the scan. + Malicious bool `json:"malicious,required"` + Phishing []string `json:"phishing,required"` + JSON accountUrlscannerScanGetResponseResultScanVerdictsOverallJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanVerdictsOverallJSON contains the JSON +// metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanVerdictsOverall] +type accountUrlscannerScanGetResponseResultScanVerdictsOverallJSON struct { + Categories apijson.Field + GsbThreatTypes apijson.Field + Malicious apijson.Field + Phishing apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanVerdictsOverall) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanVerdictsOverallCategory struct { + ID float64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID float64 `json:"super_category_id,required"` + JSON accountUrlscannerScanGetResponseResultScanVerdictsOverallCategoryJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanVerdictsOverallCategoryJSON contains +// the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanVerdictsOverallCategory] +type accountUrlscannerScanGetResponseResultScanVerdictsOverallCategoryJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanVerdictsOverallCategory) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Dictionary of Autonomous System Numbers where ASN's are the keys +type AccountUrlscannerScanGetResponseResultScanASNs struct { + // ASN's contacted + ASN AccountUrlscannerScanGetResponseResultScanASNsASN `json:"asn"` + JSON accountUrlscannerScanGetResponseResultScanASNsJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanASNsJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanASNs] +type accountUrlscannerScanGetResponseResultScanASNsJSON struct { + ASN apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanASNs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ASN's contacted +type AccountUrlscannerScanGetResponseResultScanASNsASN struct { + ASN string `json:"asn,required"` + Description string `json:"description,required"` + LocationAlpha2 string `json:"location_alpha2,required"` + Name string `json:"name,required"` + OrgName string `json:"org_name,required"` + JSON accountUrlscannerScanGetResponseResultScanASNsASNJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanASNsASNJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanASNsASN] +type accountUrlscannerScanGetResponseResultScanASNsASNJSON struct { + ASN apijson.Field + Description apijson.Field + LocationAlpha2 apijson.Field + Name apijson.Field + OrgName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanASNsASN) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomains struct { + ExampleCom AccountUrlscannerScanGetResponseResultScanDomainsExampleCom `json:"example.com"` + JSON accountUrlscannerScanGetResponseResultScanDomainsJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanDomains] +type accountUrlscannerScanGetResponseResultScanDomainsJSON struct { + ExampleCom apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomains) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleCom struct { + Categories AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategories `json:"categories,required"` + DNS []AccountUrlscannerScanGetResponseResultScanDomainsExampleComDNS `json:"dns,required"` + Name string `json:"name,required"` + Rank AccountUrlscannerScanGetResponseResultScanDomainsExampleComRank `json:"rank,required"` + Type string `json:"type,required"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleCom] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComJSON struct { + Categories apijson.Field + DNS apijson.Field + Name apijson.Field + Rank apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleCom) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategories struct { + Inherited AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInherited `json:"inherited,required"` + Content []AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesContent `json:"content"` + Risks []AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesRisk `json:"risks"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategories] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesJSON struct { + Inherited apijson.Field + Content apijson.Field + Risks apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategories) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInherited struct { + Content []AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedContent `json:"content"` + From string `json:"from"` + Risks []AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedRisk `json:"risks"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInherited] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedJSON struct { + Content apijson.Field + From apijson.Field + Risks apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInherited) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedContent struct { + ID int64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedContentJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedContentJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedContent] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedContentJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedContent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedRisk struct { + ID int64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedRiskJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedRiskJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedRisk] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedRiskJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesInheritedRisk) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesContent struct { + ID int64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesContentJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesContentJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesContent] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesContentJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesContent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesRisk struct { + ID int64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID int64 `json:"super_category_id"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesRiskJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesRiskJSON +// contains the JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesRisk] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesRiskJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComCategoriesRisk) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComDNS struct { + Address string `json:"address,required"` + DnssecValid bool `json:"dnssec_valid,required"` + Name string `json:"name,required"` + Type string `json:"type,required"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComDNSJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComDNSJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComDNS] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComDNSJSON struct { + Address apijson.Field + DnssecValid apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComDNS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanDomainsExampleComRank struct { + Bucket string `json:"bucket,required"` + Name string `json:"name,required"` + // Rank in the Global Radar Rank, if set. See more at + // https://blog.cloudflare.com/radar-domain-rankings/ + Rank int64 `json:"rank"` + JSON accountUrlscannerScanGetResponseResultScanDomainsExampleComRankJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanDomainsExampleComRankJSON contains the +// JSON metadata for the struct +// [AccountUrlscannerScanGetResponseResultScanDomainsExampleComRank] +type accountUrlscannerScanGetResponseResultScanDomainsExampleComRankJSON struct { + Bucket apijson.Field + Name apijson.Field + Rank apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanDomainsExampleComRank) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanIPs struct { + IP AccountUrlscannerScanGetResponseResultScanIPsIP `json:"ip"` + JSON accountUrlscannerScanGetResponseResultScanIPsJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanIPsJSON contains the JSON metadata for +// the struct [AccountUrlscannerScanGetResponseResultScanIPs] +type accountUrlscannerScanGetResponseResultScanIPsJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanIPs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanIPsIP struct { + ASN string `json:"asn,required"` + ASNDescription string `json:"asnDescription,required"` + ASNLocationAlpha2 string `json:"asnLocationAlpha2,required"` + ASNName string `json:"asnName,required"` + ASNOrgName string `json:"asnOrgName,required"` + Continent string `json:"continent,required"` + GeonameID string `json:"geonameId,required"` + IP string `json:"ip,required"` + IPVersion string `json:"ipVersion,required"` + Latitude string `json:"latitude,required"` + LocationAlpha2 string `json:"locationAlpha2,required"` + LocationName string `json:"locationName,required"` + Longitude string `json:"longitude,required"` + Subdivision1Name string `json:"subdivision1Name,required"` + Subdivision2Name string `json:"subdivision2Name,required"` + JSON accountUrlscannerScanGetResponseResultScanIPsIPJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanIPsIPJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanIPsIP] +type accountUrlscannerScanGetResponseResultScanIPsIPJSON struct { + ASN apijson.Field + ASNDescription apijson.Field + ASNLocationAlpha2 apijson.Field + ASNName apijson.Field + ASNOrgName apijson.Field + Continent apijson.Field + GeonameID apijson.Field + IP apijson.Field + IPVersion apijson.Field + Latitude apijson.Field + LocationAlpha2 apijson.Field + LocationName apijson.Field + Longitude apijson.Field + Subdivision1Name apijson.Field + Subdivision2Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanIPsIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanLinks struct { + Link AccountUrlscannerScanGetResponseResultScanLinksLink `json:"link"` + JSON accountUrlscannerScanGetResponseResultScanLinksJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanLinksJSON contains the JSON metadata +// for the struct [AccountUrlscannerScanGetResponseResultScanLinks] +type accountUrlscannerScanGetResponseResultScanLinksJSON struct { + Link apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanLinks) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanGetResponseResultScanLinksLink struct { + // Outgoing link detected in the DOM + Href string `json:"href,required"` + Text string `json:"text,required"` + JSON accountUrlscannerScanGetResponseResultScanLinksLinkJSON `json:"-"` +} + +// accountUrlscannerScanGetResponseResultScanLinksLinkJSON contains the JSON +// metadata for the struct [AccountUrlscannerScanGetResponseResultScanLinksLink] +type accountUrlscannerScanGetResponseResultScanLinksLinkJSON struct { + Href apijson.Field + Text apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanGetResponseResultScanLinksLink) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanListResponse struct { + Errors []AccountUrlscannerScanListResponseError `json:"errors,required"` + Messages []AccountUrlscannerScanListResponseMessage `json:"messages,required"` + Result AccountUrlscannerScanListResponseResult `json:"result,required"` + // Whether search request was successful or not + Success bool `json:"success,required"` + JSON accountUrlscannerScanListResponseJSON `json:"-"` +} + +// accountUrlscannerScanListResponseJSON contains the JSON metadata for the struct +// [AccountUrlscannerScanListResponse] +type accountUrlscannerScanListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanListResponseError struct { + Message string `json:"message,required"` + JSON accountUrlscannerScanListResponseErrorJSON `json:"-"` +} + +// accountUrlscannerScanListResponseErrorJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanListResponseError] +type accountUrlscannerScanListResponseErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanListResponseMessage struct { + Message string `json:"message,required"` + JSON accountUrlscannerScanListResponseMessageJSON `json:"-"` +} + +// accountUrlscannerScanListResponseMessageJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanListResponseMessage] +type accountUrlscannerScanListResponseMessageJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanListResponseResult struct { + Tasks []AccountUrlscannerScanListResponseResultTask `json:"tasks,required"` + JSON accountUrlscannerScanListResponseResultJSON `json:"-"` +} + +// accountUrlscannerScanListResponseResultJSON contains the JSON metadata for the +// struct [AccountUrlscannerScanListResponseResult] +type accountUrlscannerScanListResponseResultJSON struct { + Tasks apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanListResponseResultTask struct { + // Whether scan was successful or not + Success bool `json:"success,required"` + // When scan was submitted (UTC) + Time time.Time `json:"time,required" format:"date-time"` + // Scan url (after redirects) + URL string `json:"url,required"` + // Scan id + Uuid string `json:"uuid,required" format:"uuid"` + JSON accountUrlscannerScanListResponseResultTaskJSON `json:"-"` +} + +// accountUrlscannerScanListResponseResultTaskJSON contains the JSON metadata for +// the struct [AccountUrlscannerScanListResponseResultTask] +type accountUrlscannerScanListResponseResultTaskJSON struct { + Success apijson.Field + Time apijson.Field + URL apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountUrlscannerScanListResponseResultTask) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountUrlscannerScanNewParams struct { + URL param.Field[string] `json:"url,required"` + // Set custom headers + CustomHeaders param.Field[interface{}] `json:"customHeaders"` + // Take multiple screenshots targeting different device types + ScreenshotsResolutions param.Field[[]AccountUrlscannerScanNewParamsScreenshotsResolution] `json:"screenshotsResolutions"` + // The option `Public` means it will be included in listings like recent scans and + // search results. `Unlisted` means it will not be included in the aforementioned + // listings, users will need to have the scan's ID to access it. A a scan will be + // automatically marked as unlisted if it fails, if it contains potential PII or + // other sensitive material. + Visibility param.Field[AccountUrlscannerScanNewParamsVisibility] `json:"visibility"` +} + +func (r AccountUrlscannerScanNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Device resolutions. +type AccountUrlscannerScanNewParamsScreenshotsResolution string + +const ( + AccountUrlscannerScanNewParamsScreenshotsResolutionDesktop AccountUrlscannerScanNewParamsScreenshotsResolution = "desktop" + AccountUrlscannerScanNewParamsScreenshotsResolutionMobile AccountUrlscannerScanNewParamsScreenshotsResolution = "mobile" + AccountUrlscannerScanNewParamsScreenshotsResolutionTablet AccountUrlscannerScanNewParamsScreenshotsResolution = "tablet" +) + +// The option `Public` means it will be included in listings like recent scans and +// search results. `Unlisted` means it will not be included in the aforementioned +// listings, users will need to have the scan's ID to access it. A a scan will be +// automatically marked as unlisted if it fails, if it contains potential PII or +// other sensitive material. +type AccountUrlscannerScanNewParamsVisibility string + +const ( + AccountUrlscannerScanNewParamsVisibilityPublic AccountUrlscannerScanNewParamsVisibility = "Public" + AccountUrlscannerScanNewParamsVisibilityUnlisted AccountUrlscannerScanNewParamsVisibility = "Unlisted" +) + +type AccountUrlscannerScanListParams struct { + // Return only scans created by account. + AccountScans param.Field[bool] `query:"account_scans"` + // Filter scans requested before date (inclusive). + DateEnd param.Field[time.Time] `query:"date_end" format:"date-time"` + // Filter scans requested after date (inclusive). + DateStart param.Field[time.Time] `query:"date_start" format:"date-time"` + // Filter scans by hostname of _any_ request made by the webpage. + Hostname param.Field[string] `query:"hostname"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Pagination cursor to get the next set of results. + NextCursor param.Field[string] `query:"next_cursor"` + // Filter scans by main page hostname . + PageHostname param.Field[string] `query:"page_hostname"` + // Filter scans by exact match URL path (also supports suffix search). + PagePath param.Field[string] `query:"page_path"` + // Filter scans by exact match to scanned URL (_after redirects_) + PageURL param.Field[string] `query:"page_url"` + // Filter scans by url path of _any_ request made by the webpage. + Path param.Field[string] `query:"path"` + // Scan uuid + ScanID param.Field[string] `query:"scanId" format:"uuid"` + // Filter scans by exact match URL of _any_ request made by the webpage + URL param.Field[string] `query:"url"` +} + +// URLQuery serializes [AccountUrlscannerScanListParams]'s query parameters as +// `url.Values`. +func (r AccountUrlscannerScanListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accounturlscannerscan_test.go b/accounturlscannerscan_test.go new file mode 100644 index 00000000000..fe4858c87b4 --- /dev/null +++ b/accounturlscannerscan_test.go @@ -0,0 +1,123 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountUrlscannerScanNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Urlscanner.Scan.New( + context.TODO(), + "string", + cloudflare.AccountUrlscannerScanNewParams{ + URL: cloudflare.F("https://www.example.com"), + CustomHeaders: cloudflare.F[any](map[string]interface{}{}), + ScreenshotsResolutions: cloudflare.F([]cloudflare.AccountUrlscannerScanNewParamsScreenshotsResolution{cloudflare.AccountUrlscannerScanNewParamsScreenshotsResolutionDesktop, cloudflare.AccountUrlscannerScanNewParamsScreenshotsResolutionMobile, cloudflare.AccountUrlscannerScanNewParamsScreenshotsResolutionTablet}), + Visibility: cloudflare.F(cloudflare.AccountUrlscannerScanNewParamsVisibilityPublic), + }, + ) + 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 TestAccountUrlscannerScanGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Urlscanner.Scan.Get( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + 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 TestAccountUrlscannerScanListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Urlscanner.Scan.List( + context.TODO(), + "string", + cloudflare.AccountUrlscannerScanListParams{ + AccountScans: cloudflare.F(true), + DateEnd: cloudflare.F(time.Now()), + DateStart: cloudflare.F(time.Now()), + Hostname: cloudflare.F("example.com"), + Limit: cloudflare.F(int64(100)), + NextCursor: cloudflare.F("string"), + PageHostname: cloudflare.F("string"), + PagePath: cloudflare.F("string"), + PageURL: cloudflare.F("string"), + Path: cloudflare.F("/samples/subresource-integrity/"), + ScanID: cloudflare.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + URL: cloudflare.F("https://example.com/?hello"), + }, + ) + 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/accounturlscannerscreenshot.go b/accounturlscannerscreenshot.go new file mode 100644 index 00000000000..6643f9f5a98 --- /dev/null +++ b/accounturlscannerscreenshot.go @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountUrlscannerScreenshotService 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 +// [NewAccountUrlscannerScreenshotService] method instead. +type AccountUrlscannerScreenshotService struct { + Options []option.RequestOption +} + +// NewAccountUrlscannerScreenshotService 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 NewAccountUrlscannerScreenshotService(opts ...option.RequestOption) (r *AccountUrlscannerScreenshotService) { + r = &AccountUrlscannerScreenshotService{} + r.Options = opts + return +} + +// Get scan's screenshot by resolution (desktop/mobile/tablet). +func (r *AccountUrlscannerScreenshotService) Get(ctx context.Context, accountID string, scanID string, query AccountUrlscannerScreenshotGetParams, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "image/png")}, opts...) + path := fmt.Sprintf("accounts/%s/urlscanner/scan/%s/screenshot", accountID, scanID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountUrlscannerScreenshotGetParams struct { + // Target device type + Resolution param.Field[AccountUrlscannerScreenshotGetParamsResolution] `query:"resolution"` +} + +// URLQuery serializes [AccountUrlscannerScreenshotGetParams]'s query parameters as +// `url.Values`. +func (r AccountUrlscannerScreenshotGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Target device type +type AccountUrlscannerScreenshotGetParamsResolution string + +const ( + AccountUrlscannerScreenshotGetParamsResolutionDesktop AccountUrlscannerScreenshotGetParamsResolution = "desktop" + AccountUrlscannerScreenshotGetParamsResolutionMobile AccountUrlscannerScreenshotGetParamsResolution = "mobile" + AccountUrlscannerScreenshotGetParamsResolutionTablet AccountUrlscannerScreenshotGetParamsResolution = "tablet" +) diff --git a/accounturlscannerscreenshot_test.go b/accounturlscannerscreenshot_test.go new file mode 100644 index 00000000000..71c514928a5 --- /dev/null +++ b/accounturlscannerscreenshot_test.go @@ -0,0 +1,61 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountUrlscannerScreenshotGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Accounts.Urlscanner.Screenshot.Get( + context.TODO(), + "string", + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + cloudflare.AccountUrlscannerScreenshotGetParams{ + Resolution: cloudflare.F(cloudflare.AccountUrlscannerScreenshotGetParamsResolutionDesktop), + }, + ) + 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/accountvectorizeindex.go b/accountvectorizeindex.go new file mode 100644 index 00000000000..468e502aac0 --- /dev/null +++ b/accountvectorizeindex.go @@ -0,0 +1,794 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountVectorizeIndexService 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 [NewAccountVectorizeIndexService] +// method instead. +type AccountVectorizeIndexService struct { + Options []option.RequestOption +} + +// NewAccountVectorizeIndexService 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 NewAccountVectorizeIndexService(opts ...option.RequestOption) (r *AccountVectorizeIndexService) { + r = &AccountVectorizeIndexService{} + r.Options = opts + return +} + +// Creates and returns a new Vectorize Index. +func (r *AccountVectorizeIndexService) New(ctx context.Context, accountIdentifier string, body AccountVectorizeIndexNewParams, opts ...option.RequestOption) (res *AccountVectorizeIndexNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Returns the specified Vectorize Index. +func (r *AccountVectorizeIndexService) Get(ctx context.Context, accountIdentifier string, indexName string, opts ...option.RequestOption) (res *AccountVectorizeIndexGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes/%s", accountIdentifier, indexName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates and returns the specified Vectorize Index. +func (r *AccountVectorizeIndexService) Update(ctx context.Context, accountIdentifier string, indexName string, body AccountVectorizeIndexUpdateParams, opts ...option.RequestOption) (res *AccountVectorizeIndexUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes/%s", accountIdentifier, indexName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Returns a list of Vectorize Indexes +func (r *AccountVectorizeIndexService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountVectorizeIndexListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes the specified Vectorize Index. +func (r *AccountVectorizeIndexService) Delete(ctx context.Context, accountIdentifier string, indexName string, opts ...option.RequestOption) (res *AccountVectorizeIndexDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes/%s", accountIdentifier, indexName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Inserts vectors into the specified index and returns the count of the vectors +// successfully inserted. +func (r *AccountVectorizeIndexService) Insert(ctx context.Context, accountIdentifier string, indexName string, opts ...option.RequestOption) (res *AccountVectorizeIndexInsertResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes/%s/insert", accountIdentifier, indexName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +// Finds vectors closest to a given vector in an index. +func (r *AccountVectorizeIndexService) Query(ctx context.Context, accountIdentifier string, indexName string, body AccountVectorizeIndexQueryParams, opts ...option.RequestOption) (res *AccountVectorizeIndexQueryResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes/%s/query", accountIdentifier, indexName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Upserts vectors into the specified index, creating them if they do not exist and +// returns the count of values and ids successfully inserted. +func (r *AccountVectorizeIndexService) Upsert(ctx context.Context, accountIdentifier string, indexName string, opts ...option.RequestOption) (res *AccountVectorizeIndexUpsertResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/vectorize/indexes/%s/upsert", accountIdentifier, indexName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountVectorizeIndexNewResponse struct { + Errors []AccountVectorizeIndexNewResponseError `json:"errors"` + Messages []AccountVectorizeIndexNewResponseMessage `json:"messages"` + Result shared.VectorizeCreateIndexResponse `json:"result"` + // Whether the API call was successful + Success AccountVectorizeIndexNewResponseSuccess `json:"success"` + JSON accountVectorizeIndexNewResponseJSON `json:"-"` +} + +// accountVectorizeIndexNewResponseJSON contains the JSON metadata for the struct +// [AccountVectorizeIndexNewResponse] +type accountVectorizeIndexNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexNewResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexNewResponseError] +type accountVectorizeIndexNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexNewResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexNewResponseMessage] +type accountVectorizeIndexNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexNewResponseSuccess bool + +const ( + AccountVectorizeIndexNewResponseSuccessTrue AccountVectorizeIndexNewResponseSuccess = true +) + +type AccountVectorizeIndexGetResponse struct { + Errors []AccountVectorizeIndexGetResponseError `json:"errors"` + Messages []AccountVectorizeIndexGetResponseMessage `json:"messages"` + Result shared.VectorizeCreateIndexResponse `json:"result"` + // Whether the API call was successful + Success AccountVectorizeIndexGetResponseSuccess `json:"success"` + JSON accountVectorizeIndexGetResponseJSON `json:"-"` +} + +// accountVectorizeIndexGetResponseJSON contains the JSON metadata for the struct +// [AccountVectorizeIndexGetResponse] +type accountVectorizeIndexGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexGetResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexGetResponseError] +type accountVectorizeIndexGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexGetResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexGetResponseMessage] +type accountVectorizeIndexGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexGetResponseSuccess bool + +const ( + AccountVectorizeIndexGetResponseSuccessTrue AccountVectorizeIndexGetResponseSuccess = true +) + +type AccountVectorizeIndexUpdateResponse struct { + Errors []AccountVectorizeIndexUpdateResponseError `json:"errors"` + Messages []AccountVectorizeIndexUpdateResponseMessage `json:"messages"` + Result shared.VectorizeCreateIndexResponse `json:"result"` + // Whether the API call was successful + Success AccountVectorizeIndexUpdateResponseSuccess `json:"success"` + JSON accountVectorizeIndexUpdateResponseJSON `json:"-"` +} + +// accountVectorizeIndexUpdateResponseJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexUpdateResponse] +type accountVectorizeIndexUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexUpdateResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexUpdateResponseError] +type accountVectorizeIndexUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexUpdateResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexUpdateResponseMessageJSON contains the JSON metadata for +// the struct [AccountVectorizeIndexUpdateResponseMessage] +type accountVectorizeIndexUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexUpdateResponseSuccess bool + +const ( + AccountVectorizeIndexUpdateResponseSuccessTrue AccountVectorizeIndexUpdateResponseSuccess = true +) + +type AccountVectorizeIndexListResponse struct { + Errors []AccountVectorizeIndexListResponseError `json:"errors"` + Messages []AccountVectorizeIndexListResponseMessage `json:"messages"` + Result []shared.VectorizeCreateIndexResponse `json:"result"` + // Whether the API call was successful + Success AccountVectorizeIndexListResponseSuccess `json:"success"` + JSON accountVectorizeIndexListResponseJSON `json:"-"` +} + +// accountVectorizeIndexListResponseJSON contains the JSON metadata for the struct +// [AccountVectorizeIndexListResponse] +type accountVectorizeIndexListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexListResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexListResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexListResponseError] +type accountVectorizeIndexListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexListResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexListResponseMessageJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexListResponseMessage] +type accountVectorizeIndexListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexListResponseSuccess bool + +const ( + AccountVectorizeIndexListResponseSuccessTrue AccountVectorizeIndexListResponseSuccess = true +) + +type AccountVectorizeIndexDeleteResponse struct { + Errors []AccountVectorizeIndexDeleteResponseError `json:"errors"` + Messages []AccountVectorizeIndexDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result,nullable"` + // Whether the API call was successful + Success AccountVectorizeIndexDeleteResponseSuccess `json:"success"` + JSON accountVectorizeIndexDeleteResponseJSON `json:"-"` +} + +// accountVectorizeIndexDeleteResponseJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexDeleteResponse] +type accountVectorizeIndexDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexDeleteResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexDeleteResponseError] +type accountVectorizeIndexDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexDeleteResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountVectorizeIndexDeleteResponseMessage] +type accountVectorizeIndexDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexDeleteResponseSuccess bool + +const ( + AccountVectorizeIndexDeleteResponseSuccessTrue AccountVectorizeIndexDeleteResponseSuccess = true +) + +type AccountVectorizeIndexInsertResponse struct { + Errors []AccountVectorizeIndexInsertResponseError `json:"errors"` + Messages []AccountVectorizeIndexInsertResponseMessage `json:"messages"` + Result AccountVectorizeIndexInsertResponseResult `json:"result"` + // Whether the API call was successful + Success AccountVectorizeIndexInsertResponseSuccess `json:"success"` + JSON accountVectorizeIndexInsertResponseJSON `json:"-"` +} + +// accountVectorizeIndexInsertResponseJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexInsertResponse] +type accountVectorizeIndexInsertResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexInsertResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexInsertResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexInsertResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexInsertResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexInsertResponseError] +type accountVectorizeIndexInsertResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexInsertResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexInsertResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexInsertResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexInsertResponseMessageJSON contains the JSON metadata for +// the struct [AccountVectorizeIndexInsertResponseMessage] +type accountVectorizeIndexInsertResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexInsertResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexInsertResponseResult struct { + // Specifies the count of the vectors successfully inserted. + Count int64 `json:"count"` + // Array of vector identifiers of the vectors successfully inserted. + IDs []string `json:"ids"` + JSON accountVectorizeIndexInsertResponseResultJSON `json:"-"` +} + +// accountVectorizeIndexInsertResponseResultJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexInsertResponseResult] +type accountVectorizeIndexInsertResponseResultJSON struct { + Count apijson.Field + IDs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexInsertResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexInsertResponseSuccess bool + +const ( + AccountVectorizeIndexInsertResponseSuccessTrue AccountVectorizeIndexInsertResponseSuccess = true +) + +type AccountVectorizeIndexQueryResponse struct { + Errors []AccountVectorizeIndexQueryResponseError `json:"errors"` + Messages []AccountVectorizeIndexQueryResponseMessage `json:"messages"` + Result AccountVectorizeIndexQueryResponseResult `json:"result"` + // Whether the API call was successful + Success AccountVectorizeIndexQueryResponseSuccess `json:"success"` + JSON accountVectorizeIndexQueryResponseJSON `json:"-"` +} + +// accountVectorizeIndexQueryResponseJSON contains the JSON metadata for the struct +// [AccountVectorizeIndexQueryResponse] +type accountVectorizeIndexQueryResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexQueryResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexQueryResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexQueryResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexQueryResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexQueryResponseError] +type accountVectorizeIndexQueryResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexQueryResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexQueryResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexQueryResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexQueryResponseMessageJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexQueryResponseMessage] +type accountVectorizeIndexQueryResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexQueryResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexQueryResponseResult struct { + // Specifies the count of vectors returned by the search + Count int64 `json:"count"` + // Array of vectors matched by the search + Matches []AccountVectorizeIndexQueryResponseResultMatch `json:"matches"` + JSON accountVectorizeIndexQueryResponseResultJSON `json:"-"` +} + +// accountVectorizeIndexQueryResponseResultJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexQueryResponseResult] +type accountVectorizeIndexQueryResponseResultJSON struct { + Count apijson.Field + Matches apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexQueryResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexQueryResponseResultMatch struct { + // The score of the vector according to the index's distance metric + Score float64 `json:"score"` + // If the returnVectors option is set, the vector itself + Vector AccountVectorizeIndexQueryResponseResultMatchesVector `json:"vector,nullable"` + // Identifier + VectorID string `json:"vectorId"` + JSON accountVectorizeIndexQueryResponseResultMatchJSON `json:"-"` +} + +// accountVectorizeIndexQueryResponseResultMatchJSON contains the JSON metadata for +// the struct [AccountVectorizeIndexQueryResponseResultMatch] +type accountVectorizeIndexQueryResponseResultMatchJSON struct { + Score apijson.Field + Vector apijson.Field + VectorID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexQueryResponseResultMatch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// If the returnVectors option is set, the vector itself +type AccountVectorizeIndexQueryResponseResultMatchesVector struct { + // Identifier + ID string `json:"id"` + Metadata interface{} `json:"metadata"` + Values []float64 `json:"values"` + JSON accountVectorizeIndexQueryResponseResultMatchesVectorJSON `json:"-"` +} + +// accountVectorizeIndexQueryResponseResultMatchesVectorJSON contains the JSON +// metadata for the struct [AccountVectorizeIndexQueryResponseResultMatchesVector] +type accountVectorizeIndexQueryResponseResultMatchesVectorJSON struct { + ID apijson.Field + Metadata apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexQueryResponseResultMatchesVector) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexQueryResponseSuccess bool + +const ( + AccountVectorizeIndexQueryResponseSuccessTrue AccountVectorizeIndexQueryResponseSuccess = true +) + +type AccountVectorizeIndexUpsertResponse struct { + Errors []AccountVectorizeIndexUpsertResponseError `json:"errors"` + Messages []AccountVectorizeIndexUpsertResponseMessage `json:"messages"` + Result AccountVectorizeIndexUpsertResponseResult `json:"result"` + // Whether the API call was successful + Success AccountVectorizeIndexUpsertResponseSuccess `json:"success"` + JSON accountVectorizeIndexUpsertResponseJSON `json:"-"` +} + +// accountVectorizeIndexUpsertResponseJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexUpsertResponse] +type accountVectorizeIndexUpsertResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexUpsertResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexUpsertResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexUpsertResponseErrorJSON `json:"-"` +} + +// accountVectorizeIndexUpsertResponseErrorJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexUpsertResponseError] +type accountVectorizeIndexUpsertResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexUpsertResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexUpsertResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountVectorizeIndexUpsertResponseMessageJSON `json:"-"` +} + +// accountVectorizeIndexUpsertResponseMessageJSON contains the JSON metadata for +// the struct [AccountVectorizeIndexUpsertResponseMessage] +type accountVectorizeIndexUpsertResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexUpsertResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountVectorizeIndexUpsertResponseResult struct { + // Specifies the count of the vectors successfully inserted. + Count int64 `json:"count"` + // Array of vector identifiers of the vectors successfully inserted. + IDs []string `json:"ids"` + JSON accountVectorizeIndexUpsertResponseResultJSON `json:"-"` +} + +// accountVectorizeIndexUpsertResponseResultJSON contains the JSON metadata for the +// struct [AccountVectorizeIndexUpsertResponseResult] +type accountVectorizeIndexUpsertResponseResultJSON struct { + Count apijson.Field + IDs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountVectorizeIndexUpsertResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountVectorizeIndexUpsertResponseSuccess bool + +const ( + AccountVectorizeIndexUpsertResponseSuccessTrue AccountVectorizeIndexUpsertResponseSuccess = true +) + +type AccountVectorizeIndexNewParams struct { + Config param.Field[interface{}] `json:"config,required"` + Name param.Field[string] `json:"name,required"` + // Specifies the description of the index. + Description param.Field[string] `json:"description"` +} + +func (r AccountVectorizeIndexNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountVectorizeIndexUpdateParams struct { + // Specifies the description of the index. + Description param.Field[string] `json:"description,required"` +} + +func (r AccountVectorizeIndexUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountVectorizeIndexQueryParams struct { + // Whether to return the values of the closest vectors, or just their identifiers. + ReturnVectors param.Field[bool] `json:"returnVectors"` + // The number of results to return + TopK param.Field[float64] `json:"topK"` + // The vector to find neighbors of + Vector param.Field[[]float64] `json:"vector"` +} + +func (r AccountVectorizeIndexQueryParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountvectorizeindex_test.go b/accountvectorizeindex_test.go new file mode 100644 index 00000000000..22faaa25684 --- /dev/null +++ b/accountvectorizeindex_test.go @@ -0,0 +1,262 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountVectorizeIndexNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountVectorizeIndexNewParams{ + Config: cloudflare.F[any](map[string]interface{}{}), + Name: cloudflare.F("example-index"), + Description: cloudflare.F("This is my example index."), + }, + ) + 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 TestAccountVectorizeIndexGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-index", + ) + 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 TestAccountVectorizeIndexUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-index", + cloudflare.AccountVectorizeIndexUpdateParams{ + Description: cloudflare.F("This is my example index."), + }, + ) + 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 TestAccountVectorizeIndexList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.List(context.TODO(), "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()) + } +} + +func TestAccountVectorizeIndexDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-index", + ) + 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 TestAccountVectorizeIndexInsert(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.Insert( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-index", + ) + 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 TestAccountVectorizeIndexQueryWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.Query( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-index", + cloudflare.AccountVectorizeIndexQueryParams{ + ReturnVectors: cloudflare.F(true), + TopK: cloudflare.F(5.000000), + Vector: cloudflare.F([]float64{0.500000, 0.500000, 0.500000}), + }, + ) + 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 TestAccountVectorizeIndexUpsert(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.VectorizeIndexes.Upsert( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-index", + ) + 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/accountwarpconnector.go b/accountwarpconnector.go new file mode 100644 index 00000000000..f3034d27431 --- /dev/null +++ b/accountwarpconnector.go @@ -0,0 +1,1709 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWarpConnectorService 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 [NewAccountWarpConnectorService] +// method instead. +type AccountWarpConnectorService struct { + Options []option.RequestOption +} + +// NewAccountWarpConnectorService 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 NewAccountWarpConnectorService(opts ...option.RequestOption) (r *AccountWarpConnectorService) { + r = &AccountWarpConnectorService{} + r.Options = opts + return +} + +// Creates a new Warp Connector Tunnel in an account. +func (r *AccountWarpConnectorService) New(ctx context.Context, accountIdentifier string, body AccountWarpConnectorNewParams, opts ...option.RequestOption) (res *AccountWarpConnectorNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/warp_connector", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches a single Warp Connector Tunnel. +func (r *AccountWarpConnectorService) Get(ctx context.Context, accountIdentifier string, tunnelID string, opts ...option.RequestOption) (res *AccountWarpConnectorGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/warp_connector/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an existing Warp Connector Tunnel. +func (r *AccountWarpConnectorService) Update(ctx context.Context, accountIdentifier string, tunnelID string, body AccountWarpConnectorUpdateParams, opts ...option.RequestOption) (res *AccountWarpConnectorUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/warp_connector/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Lists and filters Warp Connector Tunnels in an account. +func (r *AccountWarpConnectorService) List(ctx context.Context, accountIdentifier string, query AccountWarpConnectorListParams, opts ...option.RequestOption) (res *shared.Page[AccountWarpConnectorListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/warp_connector", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Deletes a Warp Connector Tunnel from an account. +func (r *AccountWarpConnectorService) Delete(ctx context.Context, accountIdentifier string, tunnelID string, body AccountWarpConnectorDeleteParams, opts ...option.RequestOption) (res *AccountWarpConnectorDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/warp_connector/%s", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Gets the token used to associate warp device with a specific Warp Connector +// tunnel. +func (r *AccountWarpConnectorService) Token(ctx context.Context, accountIdentifier string, tunnelID string, opts ...option.RequestOption) (res *AccountWarpConnectorTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/warp_connector/%s/token", accountIdentifier, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountWarpConnectorNewResponse struct { + Errors []AccountWarpConnectorNewResponseError `json:"errors"` + Messages []AccountWarpConnectorNewResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountWarpConnectorNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWarpConnectorNewResponseSuccess `json:"success"` + JSON accountWarpConnectorNewResponseJSON `json:"-"` +} + +// accountWarpConnectorNewResponseJSON contains the JSON metadata for the struct +// [AccountWarpConnectorNewResponse] +type accountWarpConnectorNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorNewResponseErrorJSON `json:"-"` +} + +// accountWarpConnectorNewResponseErrorJSON contains the JSON metadata for the +// struct [AccountWarpConnectorNewResponseError] +type accountWarpConnectorNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorNewResponseMessageJSON `json:"-"` +} + +// accountWarpConnectorNewResponseMessageJSON contains the JSON metadata for the +// struct [AccountWarpConnectorNewResponseMessage] +type accountWarpConnectorNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnel] or +// [AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountWarpConnectorNewResponseResult interface { + implementsAccountWarpConnectorNewResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWarpConnectorNewResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorNewResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountWarpConnectorNewResponseResultXk6JhoizCfdTunnelJSON contains the JSON +// metadata for the struct [AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnel] +type accountWarpConnectorNewResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnel) implementsAccountWarpConnectorNewResponseResult() { +} + +type AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorNewResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorNewResponseResultXk6JhoizCfdTunnelConnectionJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelConnection] +type accountWarpConnectorNewResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunTypeGre AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunTypeCni AccountWarpConnectorNewResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnel] +type accountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountWarpConnectorNewResponseResult() { +} + +type AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountWarpConnectorNewResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountWarpConnectorNewResponseSuccess bool + +const ( + AccountWarpConnectorNewResponseSuccessTrue AccountWarpConnectorNewResponseSuccess = true +) + +type AccountWarpConnectorGetResponse struct { + Errors []AccountWarpConnectorGetResponseError `json:"errors"` + Messages []AccountWarpConnectorGetResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountWarpConnectorGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWarpConnectorGetResponseSuccess `json:"success"` + JSON accountWarpConnectorGetResponseJSON `json:"-"` +} + +// accountWarpConnectorGetResponseJSON contains the JSON metadata for the struct +// [AccountWarpConnectorGetResponse] +type accountWarpConnectorGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorGetResponseErrorJSON `json:"-"` +} + +// accountWarpConnectorGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountWarpConnectorGetResponseError] +type accountWarpConnectorGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorGetResponseMessageJSON `json:"-"` +} + +// accountWarpConnectorGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountWarpConnectorGetResponseMessage] +type accountWarpConnectorGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnel] or +// [AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountWarpConnectorGetResponseResult interface { + implementsAccountWarpConnectorGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWarpConnectorGetResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorGetResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountWarpConnectorGetResponseResultXk6JhoizCfdTunnelJSON contains the JSON +// metadata for the struct [AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnel] +type accountWarpConnectorGetResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnel) implementsAccountWarpConnectorGetResponseResult() { +} + +type AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorGetResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorGetResponseResultXk6JhoizCfdTunnelConnectionJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelConnection] +type accountWarpConnectorGetResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunTypeGre AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunTypeCni AccountWarpConnectorGetResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnel] +type accountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountWarpConnectorGetResponseResult() { +} + +type AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountWarpConnectorGetResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountWarpConnectorGetResponseSuccess bool + +const ( + AccountWarpConnectorGetResponseSuccessTrue AccountWarpConnectorGetResponseSuccess = true +) + +type AccountWarpConnectorUpdateResponse struct { + Errors []AccountWarpConnectorUpdateResponseError `json:"errors"` + Messages []AccountWarpConnectorUpdateResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountWarpConnectorUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWarpConnectorUpdateResponseSuccess `json:"success"` + JSON accountWarpConnectorUpdateResponseJSON `json:"-"` +} + +// accountWarpConnectorUpdateResponseJSON contains the JSON metadata for the struct +// [AccountWarpConnectorUpdateResponse] +type accountWarpConnectorUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorUpdateResponseErrorJSON `json:"-"` +} + +// accountWarpConnectorUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountWarpConnectorUpdateResponseError] +type accountWarpConnectorUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorUpdateResponseMessageJSON `json:"-"` +} + +// accountWarpConnectorUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountWarpConnectorUpdateResponseMessage] +type accountWarpConnectorUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnel] +// or [AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountWarpConnectorUpdateResponseResult interface { + implementsAccountWarpConnectorUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWarpConnectorUpdateResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelJSON contains the JSON +// metadata for the struct +// [AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnel] +type accountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnel) implementsAccountWarpConnectorUpdateResponseResult() { +} + +type AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelConnectionJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelConnection] +type accountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunTypeGre AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunTypeCni AccountWarpConnectorUpdateResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnel] +type accountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountWarpConnectorUpdateResponseResult() { +} + +type AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountWarpConnectorUpdateResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountWarpConnectorUpdateResponseSuccess bool + +const ( + AccountWarpConnectorUpdateResponseSuccessTrue AccountWarpConnectorUpdateResponseSuccess = true +) + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountWarpConnectorListResponseXk6JhoizCfdTunnel] or +// [AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnel]. +type AccountWarpConnectorListResponse interface { + implementsAccountWarpConnectorListResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWarpConnectorListResponse)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorListResponseXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorListResponseXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorListResponseXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountWarpConnectorListResponseXk6JhoizCfdTunnelJSON contains the JSON metadata +// for the struct [AccountWarpConnectorListResponseXk6JhoizCfdTunnel] +type accountWarpConnectorListResponseXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorListResponseXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorListResponseXk6JhoizCfdTunnel) implementsAccountWarpConnectorListResponse() { +} + +type AccountWarpConnectorListResponseXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorListResponseXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorListResponseXk6JhoizCfdTunnelConnectionJSON contains the +// JSON metadata for the struct +// [AccountWarpConnectorListResponseXk6JhoizCfdTunnelConnection] +type accountWarpConnectorListResponseXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorListResponseXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunType string + +const ( + AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunTypeCfdTunnel AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunTypeWarpConnector AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunType = "warp_connector" + AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunTypeIPSec AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunType = "ip_sec" + AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunTypeGre AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunType = "gre" + AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunTypeCni AccountWarpConnectorListResponseXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelJSON contains the +// JSON metadata for the struct +// [AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnel] +type accountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnel) implementsAccountWarpConnectorListResponse() { +} + +type AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelConnection] +type accountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunTypeGre AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunTypeCni AccountWarpConnectorListResponseXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +type AccountWarpConnectorDeleteResponse struct { + Errors []AccountWarpConnectorDeleteResponseError `json:"errors"` + Messages []AccountWarpConnectorDeleteResponseMessage `json:"messages"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result AccountWarpConnectorDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWarpConnectorDeleteResponseSuccess `json:"success"` + JSON accountWarpConnectorDeleteResponseJSON `json:"-"` +} + +// accountWarpConnectorDeleteResponseJSON contains the JSON metadata for the struct +// [AccountWarpConnectorDeleteResponse] +type accountWarpConnectorDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorDeleteResponseErrorJSON `json:"-"` +} + +// accountWarpConnectorDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountWarpConnectorDeleteResponseError] +type accountWarpConnectorDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorDeleteResponseMessageJSON `json:"-"` +} + +// accountWarpConnectorDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountWarpConnectorDeleteResponseMessage] +type accountWarpConnectorDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// Union satisfied by [AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnel] +// or [AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnel]. +type AccountWarpConnectorDeleteResponseResult interface { + implementsAccountWarpConnectorDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWarpConnectorDeleteResponseResult)(nil)).Elem(), "") +} + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelJSON `json:"-"` +} + +// accountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelJSON contains the JSON +// metadata for the struct +// [AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnel] +type accountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnel) implementsAccountWarpConnectorDeleteResponseResult() { +} + +type AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelConnectionJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelConnection] +type accountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunType string + +const ( + AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunTypeCfdTunnel AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunType = "cfd_tunnel" + AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunTypeWarpConnector AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunType = "warp_connector" + AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunTypeIPSec AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunType = "ip_sec" + AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunTypeGre AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunType = "gre" + AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunTypeCni AccountWarpConnectorDeleteResponseResultXk6JhoizCfdTunnelTunType = "cni" +) + +// A Warp Connector Tunnel that connects your origin to Cloudflare's edge. +type AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnel struct { + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType `json:"tun_type"` + JSON accountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelJSON `json:"-"` +} + +// accountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelJSON contains +// the JSON metadata for the struct +// [AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnel] +type accountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelJSON struct { + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnel) implementsAccountWarpConnectorDeleteResponseResult() { +} + +type AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + Uuid string `json:"uuid"` + JSON accountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON `json:"-"` +} + +// accountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON +// contains the JSON metadata for the struct +// [AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection] +type accountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of tunnel. +type AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType string + +const ( + AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeCfdTunnel AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "cfd_tunnel" + AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeWarpConnector AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "warp_connector" + AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeIPSec AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "ip_sec" + AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeGre AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "gre" + AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunTypeCni AccountWarpConnectorDeleteResponseResultXk6JhoizWarpConnectorTunnelTunType = "cni" +) + +// Whether the API call was successful +type AccountWarpConnectorDeleteResponseSuccess bool + +const ( + AccountWarpConnectorDeleteResponseSuccessTrue AccountWarpConnectorDeleteResponseSuccess = true +) + +type AccountWarpConnectorTokenResponse struct { + Errors []AccountWarpConnectorTokenResponseError `json:"errors"` + Messages []AccountWarpConnectorTokenResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success AccountWarpConnectorTokenResponseSuccess `json:"success"` + JSON accountWarpConnectorTokenResponseJSON `json:"-"` +} + +// accountWarpConnectorTokenResponseJSON contains the JSON metadata for the struct +// [AccountWarpConnectorTokenResponse] +type accountWarpConnectorTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorTokenResponseErrorJSON `json:"-"` +} + +// accountWarpConnectorTokenResponseErrorJSON contains the JSON metadata for the +// struct [AccountWarpConnectorTokenResponseError] +type accountWarpConnectorTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWarpConnectorTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWarpConnectorTokenResponseMessageJSON `json:"-"` +} + +// accountWarpConnectorTokenResponseMessageJSON contains the JSON metadata for the +// struct [AccountWarpConnectorTokenResponseMessage] +type accountWarpConnectorTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWarpConnectorTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWarpConnectorTokenResponseSuccess bool + +const ( + AccountWarpConnectorTokenResponseSuccessTrue AccountWarpConnectorTokenResponseSuccess = true +) + +type AccountWarpConnectorNewParams struct { + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name,required"` +} + +func (r AccountWarpConnectorNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWarpConnectorUpdateParams struct { + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name"` + // Sets the password required to run a locally-managed tunnel. Must be at least 32 + // bytes and encoded as a base64 string. + TunnelSecret param.Field[string] `json:"tunnel_secret"` +} + +func (r AccountWarpConnectorUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWarpConnectorListParams struct { + ExcludePrefix param.Field[string] `query:"exclude_prefix"` + // If provided, include only tunnels that were created (and not deleted) before + // this time. + ExistedAt param.Field[time.Time] `query:"existed_at" format:"date-time"` + IncludePrefix param.Field[string] `query:"include_prefix"` + // If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If + // empty, all tunnels will be included. + IsDeleted param.Field[bool] `query:"is_deleted"` + // A user-friendly name for the tunnel. + Name param.Field[string] `query:"name"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of results to display. + PerPage param.Field[float64] `query:"per_page"` + WasActiveAt param.Field[time.Time] `query:"was_active_at" format:"date-time"` + WasInactiveAt param.Field[time.Time] `query:"was_inactive_at" format:"date-time"` +} + +// URLQuery serializes [AccountWarpConnectorListParams]'s query parameters as +// `url.Values`. +func (r AccountWarpConnectorListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AccountWarpConnectorDeleteParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWarpConnectorDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountwarpconnector_test.go b/accountwarpconnector_test.go new file mode 100644 index 00000000000..842131b839e --- /dev/null +++ b/accountwarpconnector_test.go @@ -0,0 +1,214 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWarpConnectorNew(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.WarpConnector.New( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountWarpConnectorNewParams{ + Name: cloudflare.F("blog"), + }, + ) + 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 TestAccountWarpConnectorGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.WarpConnector.Get( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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 TestAccountWarpConnectorUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.WarpConnector.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountWarpConnectorUpdateParams{ + Name: cloudflare.F("blog"), + TunnelSecret: cloudflare.F("AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg="), + }, + ) + 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 TestAccountWarpConnectorListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.WarpConnector.List( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountWarpConnectorListParams{ + ExcludePrefix: cloudflare.F("vpc1-"), + ExistedAt: cloudflare.F(time.Now()), + IncludePrefix: cloudflare.F("vpc1-"), + IsDeleted: cloudflare.F(true), + Name: cloudflare.F("blog"), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + WasActiveAt: cloudflare.F(time.Now()), + WasInactiveAt: cloudflare.F(time.Now()), + }, + ) + 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 TestAccountWarpConnectorDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.WarpConnector.Delete( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.AccountWarpConnectorDeleteParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestAccountWarpConnectorToken(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.WarpConnector.Token( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + ) + 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/accountworker.go b/accountworker.go new file mode 100644 index 00000000000..638d11f2383 --- /dev/null +++ b/accountworker.go @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerService 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 [NewAccountWorkerService] method +// instead. +type AccountWorkerService struct { + Options []option.RequestOption + AccountSettings *AccountWorkerAccountSettingService + Deployments *AccountWorkerDeploymentService + Domains *AccountWorkerDomainService + DurableObjects *AccountWorkerDurableObjectService + Queues *AccountWorkerQueueService + Scripts *AccountWorkerScriptService + Subdomains *AccountWorkerSubdomainService + Dispatch *AccountWorkerDispatchService + Services *AccountWorkerServiceService +} + +// NewAccountWorkerService 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 NewAccountWorkerService(opts ...option.RequestOption) (r *AccountWorkerService) { + r = &AccountWorkerService{} + r.Options = opts + r.AccountSettings = NewAccountWorkerAccountSettingService(opts...) + r.Deployments = NewAccountWorkerDeploymentService(opts...) + r.Domains = NewAccountWorkerDomainService(opts...) + r.DurableObjects = NewAccountWorkerDurableObjectService(opts...) + r.Queues = NewAccountWorkerQueueService(opts...) + r.Scripts = NewAccountWorkerScriptService(opts...) + r.Subdomains = NewAccountWorkerSubdomainService(opts...) + r.Dispatch = NewAccountWorkerDispatchService(opts...) + r.Services = NewAccountWorkerServiceService(opts...) + return +} diff --git a/accountworkeraccountsetting.go b/accountworkeraccountsetting.go new file mode 100644 index 00000000000..1fb1cde9ecf --- /dev/null +++ b/accountworkeraccountsetting.go @@ -0,0 +1,240 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerAccountSettingService 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 +// [NewAccountWorkerAccountSettingService] method instead. +type AccountWorkerAccountSettingService struct { + Options []option.RequestOption +} + +// NewAccountWorkerAccountSettingService 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 NewAccountWorkerAccountSettingService(opts ...option.RequestOption) (r *AccountWorkerAccountSettingService) { + r = &AccountWorkerAccountSettingService{} + r.Options = opts + return +} + +// Creates Worker account settings for an account. +func (r *AccountWorkerAccountSettingService) WorkerAccountSettingsNewWorkerAccountSettings(ctx context.Context, accountIdentifier string, body AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsParams, opts ...option.RequestOption) (res *AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/account-settings", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Fetches Worker account settings for an account. +func (r *AccountWorkerAccountSettingService) WorkerAccountSettingsFetchWorkerAccountSettings(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/account-settings", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponse struct { + Errors []AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseError `json:"errors"` + Messages []AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseMessage `json:"messages"` + Result AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseSuccess `json:"success"` + JSON accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponse] +type accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseErrorJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseError] +type accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseMessageJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseMessage] +type accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseResult struct { + DefaultUsageModel interface{} `json:"default_usage_model"` + GreenCompute interface{} `json:"green_compute"` + JSON accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseResultJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseResult] +type accountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseResultJSON struct { + DefaultUsageModel apijson.Field + GreenCompute apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseSuccess bool + +const ( + AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseSuccessTrue AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponseSuccess = true +) + +type AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponse struct { + Errors []AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseError `json:"errors"` + Messages []AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseMessage `json:"messages"` + Result AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseSuccess `json:"success"` + JSON accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponse] +type accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseErrorJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseError] +type accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseMessageJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseMessage] +type accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseResult struct { + DefaultUsageModel interface{} `json:"default_usage_model"` + GreenCompute interface{} `json:"green_compute"` + JSON accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseResultJSON `json:"-"` +} + +// accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseResultJSON +// contains the JSON metadata for the struct +// [AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseResult] +type accountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseResultJSON struct { + DefaultUsageModel apijson.Field + GreenCompute apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseSuccess bool + +const ( + AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseSuccessTrue AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponseSuccess = true +) + +type AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountworkeraccountsetting_test.go b/accountworkeraccountsetting_test.go new file mode 100644 index 00000000000..af9927ebcde --- /dev/null +++ b/accountworkeraccountsetting_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.AccountSettings.WorkerAccountSettingsNewWorkerAccountSettings( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsParams{ + Body: cloudflare.F[any]("{'default_usage_model': '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 TestAccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.AccountSettings.WorkerAccountSettingsFetchWorkerAccountSettings(context.TODO(), "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/accountworkerdeployment.go b/accountworkerdeployment.go new file mode 100644 index 00000000000..08d86efe976 --- /dev/null +++ b/accountworkerdeployment.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDeploymentService 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 +// [NewAccountWorkerDeploymentService] method instead. +type AccountWorkerDeploymentService struct { + Options []option.RequestOption + ByScripts *AccountWorkerDeploymentByScriptService +} + +// NewAccountWorkerDeploymentService 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 NewAccountWorkerDeploymentService(opts ...option.RequestOption) (r *AccountWorkerDeploymentService) { + r = &AccountWorkerDeploymentService{} + r.Options = opts + r.ByScripts = NewAccountWorkerDeploymentByScriptService(opts...) + return +} diff --git a/accountworkerdeploymentbyscript.go b/accountworkerdeploymentbyscript.go new file mode 100644 index 00000000000..605aac59c60 --- /dev/null +++ b/accountworkerdeploymentbyscript.go @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountWorkerDeploymentByScriptService 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 +// [NewAccountWorkerDeploymentByScriptService] method instead. +type AccountWorkerDeploymentByScriptService struct { + Options []option.RequestOption + Details *AccountWorkerDeploymentByScriptDetailService +} + +// NewAccountWorkerDeploymentByScriptService 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 NewAccountWorkerDeploymentByScriptService(opts ...option.RequestOption) (r *AccountWorkerDeploymentByScriptService) { + r = &AccountWorkerDeploymentByScriptService{} + r.Options = opts + r.Details = NewAccountWorkerDeploymentByScriptDetailService(opts...) + return +} + +// List Deployments +func (r *AccountWorkerDeploymentByScriptService) WorkerDeploymentsListDeployments(ctx context.Context, accountIdentifier string, scriptIdentifier string, opts ...option.RequestOption) (res *AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/deployments/by-script/%s", accountIdentifier, scriptIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponse struct { + Errors []AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseError `json:"errors"` + Items []interface{} `json:"items"` + Latest interface{} `json:"latest"` + Messages []AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseMessage `json:"messages"` + Result AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseSuccess `json:"success"` + JSON accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseJSON `json:"-"` +} + +// accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseJSON +// contains the JSON metadata for the struct +// [AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponse] +type accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseJSON struct { + Errors apijson.Field + Items apijson.Field + Latest apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseErrorJSON `json:"-"` +} + +// accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseError] +type accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseMessageJSON `json:"-"` +} + +// accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseMessage] +type accountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResultUnknown], +// [AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResultArray] +// or [shared.UnionString]. +type AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResult interface { + ImplementsAccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResultArray []interface{} + +func (r AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResultArray) ImplementsAccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResult() { +} + +// Whether the API call was successful +type AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseSuccess bool + +const ( + AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseSuccessTrue AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseSuccess = true +) diff --git a/accountworkerdeploymentbyscript_test.go b/accountworkerdeploymentbyscript_test.go new file mode 100644 index 00000000000..2467d1c9c27 --- /dev/null +++ b/accountworkerdeploymentbyscript_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDeploymentByScriptWorkerDeploymentsListDeployments(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Deployments.ByScripts.WorkerDeploymentsListDeployments( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "8ee82b3a2c0f42928b8f14dae4a97121", + ) + 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/accountworkerdeploymentbyscriptdetail.go b/accountworkerdeploymentbyscriptdetail.go new file mode 100644 index 00000000000..7a57c7dc8fc --- /dev/null +++ b/accountworkerdeploymentbyscriptdetail.go @@ -0,0 +1,146 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountWorkerDeploymentByScriptDetailService 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 +// [NewAccountWorkerDeploymentByScriptDetailService] method instead. +type AccountWorkerDeploymentByScriptDetailService struct { + Options []option.RequestOption +} + +// NewAccountWorkerDeploymentByScriptDetailService 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 NewAccountWorkerDeploymentByScriptDetailService(opts ...option.RequestOption) (r *AccountWorkerDeploymentByScriptDetailService) { + r = &AccountWorkerDeploymentByScriptDetailService{} + r.Options = opts + return +} + +// Get Deployment Detail +func (r *AccountWorkerDeploymentByScriptDetailService) Get(ctx context.Context, accountIdentifier string, scriptIdentifier string, deploymentIdentifier string, opts ...option.RequestOption) (res *AccountWorkerDeploymentByScriptDetailGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/deployments/by-script/%s/detail/%s", accountIdentifier, scriptIdentifier, deploymentIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountWorkerDeploymentByScriptDetailGetResponse struct { + ID string `json:"id"` + Errors []AccountWorkerDeploymentByScriptDetailGetResponseError `json:"errors"` + Messages []AccountWorkerDeploymentByScriptDetailGetResponseMessage `json:"messages"` + Metadata interface{} `json:"metadata"` + Number float64 `json:"number"` + Resources interface{} `json:"resources"` + Result AccountWorkerDeploymentByScriptDetailGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerDeploymentByScriptDetailGetResponseSuccess `json:"success"` + JSON accountWorkerDeploymentByScriptDetailGetResponseJSON `json:"-"` +} + +// accountWorkerDeploymentByScriptDetailGetResponseJSON contains the JSON metadata +// for the struct [AccountWorkerDeploymentByScriptDetailGetResponse] +type accountWorkerDeploymentByScriptDetailGetResponseJSON struct { + ID apijson.Field + Errors apijson.Field + Messages apijson.Field + Metadata apijson.Field + Number apijson.Field + Resources apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDeploymentByScriptDetailGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDeploymentByScriptDetailGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDeploymentByScriptDetailGetResponseErrorJSON `json:"-"` +} + +// accountWorkerDeploymentByScriptDetailGetResponseErrorJSON contains the JSON +// metadata for the struct [AccountWorkerDeploymentByScriptDetailGetResponseError] +type accountWorkerDeploymentByScriptDetailGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDeploymentByScriptDetailGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDeploymentByScriptDetailGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDeploymentByScriptDetailGetResponseMessageJSON `json:"-"` +} + +// accountWorkerDeploymentByScriptDetailGetResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountWorkerDeploymentByScriptDetailGetResponseMessage] +type accountWorkerDeploymentByScriptDetailGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDeploymentByScriptDetailGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [AccountWorkerDeploymentByScriptDetailGetResponseResultUnknown], +// [AccountWorkerDeploymentByScriptDetailGetResponseResultArray] or +// [shared.UnionString]. +type AccountWorkerDeploymentByScriptDetailGetResponseResult interface { + ImplementsAccountWorkerDeploymentByScriptDetailGetResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountWorkerDeploymentByScriptDetailGetResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AccountWorkerDeploymentByScriptDetailGetResponseResultArray []interface{} + +func (r AccountWorkerDeploymentByScriptDetailGetResponseResultArray) ImplementsAccountWorkerDeploymentByScriptDetailGetResponseResult() { +} + +// Whether the API call was successful +type AccountWorkerDeploymentByScriptDetailGetResponseSuccess bool + +const ( + AccountWorkerDeploymentByScriptDetailGetResponseSuccessTrue AccountWorkerDeploymentByScriptDetailGetResponseSuccess = true +) diff --git a/accountworkerdeploymentbyscriptdetail_test.go b/accountworkerdeploymentbyscriptdetail_test.go new file mode 100644 index 00000000000..b886006889c --- /dev/null +++ b/accountworkerdeploymentbyscriptdetail_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDeploymentByScriptDetailGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Deployments.ByScripts.Details.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "8ee82b3a2c0f42928b8f14dae4a97121", + "bcf48806-b317-4351-9ee7-36e7d557d4de", + ) + 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/accountworkerdispatch.go b/accountworkerdispatch.go new file mode 100644 index 00000000000..0ecdece8d1c --- /dev/null +++ b/accountworkerdispatch.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDispatchService 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 [NewAccountWorkerDispatchService] +// method instead. +type AccountWorkerDispatchService struct { + Options []option.RequestOption + Namespaces *AccountWorkerDispatchNamespaceService +} + +// NewAccountWorkerDispatchService 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 NewAccountWorkerDispatchService(opts ...option.RequestOption) (r *AccountWorkerDispatchService) { + r = &AccountWorkerDispatchService{} + r.Options = opts + r.Namespaces = NewAccountWorkerDispatchNamespaceService(opts...) + return +} diff --git a/accountworkerdispatchnamespace.go b/accountworkerdispatchnamespace.go new file mode 100644 index 00000000000..aa318b84ae5 --- /dev/null +++ b/accountworkerdispatchnamespace.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDispatchNamespaceService 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 +// [NewAccountWorkerDispatchNamespaceService] method instead. +type AccountWorkerDispatchNamespaceService struct { + Options []option.RequestOption + Scripts *AccountWorkerDispatchNamespaceScriptService +} + +// NewAccountWorkerDispatchNamespaceService 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 NewAccountWorkerDispatchNamespaceService(opts ...option.RequestOption) (r *AccountWorkerDispatchNamespaceService) { + r = &AccountWorkerDispatchNamespaceService{} + r.Options = opts + r.Scripts = NewAccountWorkerDispatchNamespaceScriptService(opts...) + return +} diff --git a/accountworkerdispatchnamespacescript.go b/accountworkerdispatchnamespacescript.go new file mode 100644 index 00000000000..16ca87073e7 --- /dev/null +++ b/accountworkerdispatchnamespacescript.go @@ -0,0 +1,553 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "bytes" + "context" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiform" + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDispatchNamespaceScriptService 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 +// [NewAccountWorkerDispatchNamespaceScriptService] method instead. +type AccountWorkerDispatchNamespaceScriptService struct { + Options []option.RequestOption + Content *AccountWorkerDispatchNamespaceScriptContentService + Settings *AccountWorkerDispatchNamespaceScriptSettingService +} + +// NewAccountWorkerDispatchNamespaceScriptService 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 NewAccountWorkerDispatchNamespaceScriptService(opts ...option.RequestOption) (r *AccountWorkerDispatchNamespaceScriptService) { + r = &AccountWorkerDispatchNamespaceScriptService{} + r.Options = opts + r.Content = NewAccountWorkerDispatchNamespaceScriptContentService(opts...) + r.Settings = NewAccountWorkerDispatchNamespaceScriptSettingService(opts...) + return +} + +// Upload a worker module to a Workers for Platforms namespace. +func (r *AccountWorkerDispatchNamespaceScriptService) New(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, body AccountWorkerDispatchNamespaceScriptNewParams, opts ...option.RequestOption) (res *AccountWorkerDispatchNamespaceScriptNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", accountIdentifier, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Fetch information about a script uploaded to a Workers for Platforms namespace. +func (r *AccountWorkerDispatchNamespaceScriptService) Get(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, opts ...option.RequestOption) (res *AccountWorkerDispatchNamespaceScriptGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", accountIdentifier, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a worker from a Workers for Platforms namespace. This call has no +// response body on a successful delete. +func (r *AccountWorkerDispatchNamespaceScriptService) Delete(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, body AccountWorkerDispatchNamespaceScriptDeleteParams, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", accountIdentifier, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, nil, opts...) + return +} + +type AccountWorkerDispatchNamespaceScriptNewResponse struct { + Errors []AccountWorkerDispatchNamespaceScriptNewResponseError `json:"errors"` + Messages []AccountWorkerDispatchNamespaceScriptNewResponseMessage `json:"messages"` + Result AccountWorkerDispatchNamespaceScriptNewResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerDispatchNamespaceScriptNewResponseSuccess `json:"success"` + JSON accountWorkerDispatchNamespaceScriptNewResponseJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptNewResponseJSON contains the JSON metadata +// for the struct [AccountWorkerDispatchNamespaceScriptNewResponse] +type accountWorkerDispatchNamespaceScriptNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDispatchNamespaceScriptNewResponseErrorJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptNewResponseErrorJSON contains the JSON +// metadata for the struct [AccountWorkerDispatchNamespaceScriptNewResponseError] +type accountWorkerDispatchNamespaceScriptNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDispatchNamespaceScriptNewResponseMessageJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptNewResponseMessageJSON contains the JSON +// metadata for the struct [AccountWorkerDispatchNamespaceScriptNewResponseMessage] +type accountWorkerDispatchNamespaceScriptNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptNewResponseResult struct { + // The id of the script in the Workers system. Usually the script name. + ID string `json:"id"` + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Hashed script content, can be used in a If-None-Match header when updating. + Etag string `json:"etag"` + // Whether Logpush is turned on for the Worker. + Logpush bool `json:"logpush"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Deprecated. Deployment metadata for internal usage. + PipelineHash string `json:"pipeline_hash"` + // Specifies the placement mode for the Worker (e.g. 'smart'). + PlacementMode string `json:"placement_mode"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerDispatchNamespaceScriptNewResponseResultTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerDispatchNamespaceScriptNewResponseResultJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptNewResponseResultJSON contains the JSON +// metadata for the struct [AccountWorkerDispatchNamespaceScriptNewResponseResult] +type accountWorkerDispatchNamespaceScriptNewResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Etag apijson.Field + Logpush apijson.Field + ModifiedOn apijson.Field + PipelineHash apijson.Field + PlacementMode apijson.Field + TailConsumers apijson.Field + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerDispatchNamespaceScriptNewResponseResultTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerDispatchNamespaceScriptNewResponseResultTailConsumerJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptNewResponseResultTailConsumerJSON contains +// the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptNewResponseResultTailConsumer] +type accountWorkerDispatchNamespaceScriptNewResponseResultTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptNewResponseResultTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerDispatchNamespaceScriptNewResponseSuccess bool + +const ( + AccountWorkerDispatchNamespaceScriptNewResponseSuccessTrue AccountWorkerDispatchNamespaceScriptNewResponseSuccess = true +) + +// Details about a worker uploaded to a Workers for Platforms namespace. +type AccountWorkerDispatchNamespaceScriptGetResponse struct { + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Name of the Workers for Platforms dispatch namespace. + DispatchNamespace string `json:"dispatch_namespace"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + Script AccountWorkerDispatchNamespaceScriptGetResponseScript `json:"script"` + JSON accountWorkerDispatchNamespaceScriptGetResponseJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptGetResponseJSON contains the JSON metadata +// for the struct [AccountWorkerDispatchNamespaceScriptGetResponse] +type accountWorkerDispatchNamespaceScriptGetResponseJSON struct { + CreatedOn apijson.Field + DispatchNamespace apijson.Field + ModifiedOn apijson.Field + Script apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptGetResponseScript struct { + // The id of the script in the Workers system. Usually the script name. + ID string `json:"id"` + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Hashed script content, can be used in a If-None-Match header when updating. + Etag string `json:"etag"` + // Whether Logpush is turned on for the Worker. + Logpush bool `json:"logpush"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Deprecated. Deployment metadata for internal usage. + PipelineHash string `json:"pipeline_hash"` + // Specifies the placement mode for the Worker (e.g. 'smart'). + PlacementMode string `json:"placement_mode"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerDispatchNamespaceScriptGetResponseScriptTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerDispatchNamespaceScriptGetResponseScriptJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptGetResponseScriptJSON contains the JSON +// metadata for the struct [AccountWorkerDispatchNamespaceScriptGetResponseScript] +type accountWorkerDispatchNamespaceScriptGetResponseScriptJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Etag apijson.Field + Logpush apijson.Field + ModifiedOn apijson.Field + PipelineHash apijson.Field + PlacementMode apijson.Field + TailConsumers apijson.Field + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptGetResponseScript) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerDispatchNamespaceScriptGetResponseScriptTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerDispatchNamespaceScriptGetResponseScriptTailConsumerJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptGetResponseScriptTailConsumerJSON contains +// the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptGetResponseScriptTailConsumer] +type accountWorkerDispatchNamespaceScriptGetResponseScriptTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptGetResponseScriptTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// This interface is a union satisfied by one of the following: +// [AccountWorkerDispatchNamespaceScriptNewParamsVariant0], +// [AccountWorkerDispatchNamespaceScriptNewParamsVariant1]. +type AccountWorkerDispatchNamespaceScriptNewParams interface { + ImplementsAccountWorkerDispatchNamespaceScriptNewParams() +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0 struct { + // A module comprising a Worker script, often a javascript file. Multiple modules + // may be provided as separate named parts, but at least one module must be present + // and referenced in the metadata as `main_module` or `body_part` by part name. + AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` + // JSON encoded metadata about the uploaded parts and Worker configuration. + Metadata param.Field[AccountWorkerDispatchNamespaceScriptNewParamsVariant0Metadata] `json:"metadata"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} + +func (AccountWorkerDispatchNamespaceScriptNewParamsVariant0) ImplementsAccountWorkerDispatchNamespaceScriptNewParams() { + +} + +// JSON encoded metadata about the uploaded parts and Worker configuration. +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0Metadata struct { + // List of bindings available to the worker. + Bindings param.Field[[]interface{}] `json:"bindings"` + // Name of the part in the multipart request that contains the script (e.g. the + // file adding a listener to the `fetch` event). Indicates a + // `service worker syntax` Worker. + BodyPart param.Field[string] `json:"body_part"` + // Date indicating targeted support in the Workers runtime. Backwards incompatible + // fixes to the runtime following this date will not affect this Worker. + CompatibilityDate param.Field[string] `json:"compatibility_date"` + // Flags that enable or disable certain features in the Workers runtime. Used to + // enable upcoming features or opt in or out of specific changes not included in a + // `compatibility_date`. + CompatibilityFlags param.Field[[]string] `json:"compatibility_flags"` + // List of binding types to keep from previous_upload. + KeepBindings param.Field[[]string] `json:"keep_bindings"` + // Whether Logpush is turned on for the Worker. + Logpush param.Field[bool] `json:"logpush"` + // Name of the part in the multipart request that contains the main module (e.g. + // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. + MainModule param.Field[string] `json:"main_module"` + // Migrations to apply for Durable Objects associated with this Worker. + Migrations param.Field[AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrations] `json:"migrations"` + Placement param.Field[AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacement] `json:"placement"` + // List of strings to use as tags for this Worker + Tags param.Field[[]string] `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers param.Field[[]AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataTailConsumer] `json:"tail_consumers"` + // Usage model to apply to invocations. + UsageModel param.Field[AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataUsageModel] `json:"usage_model"` + // Key-value pairs to use as tags for this version of this Worker + VersionTags param.Field[interface{}] `json:"version_tags"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0Metadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Satisfied by +// [AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations], +// [AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrations interface { + implementsAccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrations() +} + +// A single set of migrations to apply. +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // 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"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] `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 param.Field[[]AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations 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"` + // Migrations to apply in order. + Steps param.Field[[]AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStep] `json:"steps"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStep struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] `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 param.Field[[]AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode param.Field[AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacementMode] `json:"mode"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacement) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacementMode string + +const ( + AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacementModeSmart AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataTailConsumer struct { + // Name of Worker that is to be the consumer. + Service param.Field[string] `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment param.Field[string] `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace param.Field[string] `json:"namespace"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataTailConsumer) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Usage model to apply to invocations. +type AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataUsageModel string + +const ( + AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataUsageModelBundled AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataUsageModel = "bundled" + AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataUsageModelUnbound AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataUsageModel = "unbound" +) + +type AccountWorkerDispatchNamespaceScriptNewParamsVariant1 struct { + // Rollback message to be associated with this deployment. Only parsed when query + // param `"rollback_to"` is present. + Message param.Field[string] `json:"message"` +} + +func (r AccountWorkerDispatchNamespaceScriptNewParamsVariant1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AccountWorkerDispatchNamespaceScriptNewParamsVariant1) ImplementsAccountWorkerDispatchNamespaceScriptNewParams() { + +} + +type AccountWorkerDispatchNamespaceScriptDeleteParams struct { + // If set to true, delete will not be stopped by associated service binding, + // durable object, or other binding. Any of these associated bindings/durable + // objects will be deleted along with the script. + Force param.Field[bool] `query:"force"` +} + +// URLQuery serializes [AccountWorkerDispatchNamespaceScriptDeleteParams]'s query +// parameters as `url.Values`. +func (r AccountWorkerDispatchNamespaceScriptDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountworkerdispatchnamespacescript_test.go b/accountworkerdispatchnamespacescript_test.go new file mode 100644 index 00000000000..0b442a9a57a --- /dev/null +++ b/accountworkerdispatchnamespacescript_test.go @@ -0,0 +1,172 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDispatchNamespaceScriptNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Dispatch.Namespaces.Scripts.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-dispatch-namespace", + "this-is_my_script-01", + cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0{ + AnyPartName: cloudflare.F([]io.Reader{io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents")))}), + Metadata: cloudflare.F(cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0Metadata{ + Bindings: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + BodyPart: cloudflare.F("worker.js"), + CompatibilityDate: cloudflare.F("2023-07-25"), + CompatibilityFlags: cloudflare.F([]string{"string", "string", "string"}), + KeepBindings: cloudflare.F([]string{"string", "string", "string"}), + Logpush: cloudflare.F(false), + MainModule: cloudflare.F("worker.js"), + Migrations: cloudflare.F[cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrations](cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations(cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations{ + 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([]cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass{{ + 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([]cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass{{ + 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(cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacement{ + Mode: cloudflare.F(cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataPlacementModeSmart), + }), + Tags: cloudflare.F([]string{"string", "string", "string"}), + TailConsumers: cloudflare.F([]cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataTailConsumer{{ + 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(cloudflare.AccountWorkerDispatchNamespaceScriptNewParamsVariant0MetadataUsageModelBundled), + VersionTags: cloudflare.F[any](map[string]interface{}{}), + }), + }, + ) + 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 TestAccountWorkerDispatchNamespaceScriptGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Dispatch.Namespaces.Scripts.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-dispatch-namespace", + "this-is_my_script-01", + ) + 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 TestAccountWorkerDispatchNamespaceScriptDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Workers.Dispatch.Namespaces.Scripts.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-dispatch-namespace", + "this-is_my_script-01", + cloudflare.AccountWorkerDispatchNamespaceScriptDeleteParams{ + Force: cloudflare.F(true), + }, + ) + 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/accountworkerdispatchnamespacescriptcontent.go b/accountworkerdispatchnamespacescriptcontent.go new file mode 100644 index 00000000000..c32295a5906 --- /dev/null +++ b/accountworkerdispatchnamespacescriptcontent.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "bytes" + "context" + "fmt" + "io" + "mime/multipart" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiform" + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDispatchNamespaceScriptContentService 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 [NewAccountWorkerDispatchNamespaceScriptContentService] method instead. +type AccountWorkerDispatchNamespaceScriptContentService struct { + Options []option.RequestOption +} + +// NewAccountWorkerDispatchNamespaceScriptContentService 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 NewAccountWorkerDispatchNamespaceScriptContentService(opts ...option.RequestOption) (r *AccountWorkerDispatchNamespaceScriptContentService) { + r = &AccountWorkerDispatchNamespaceScriptContentService{} + r.Options = opts + return +} + +// Fetch script content from a script uploaded to a Workers for Platforms +// namespace. +func (r *AccountWorkerDispatchNamespaceScriptContentService) Get(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, 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/dispatch/namespaces/%s/scripts/%s/content", accountIdentifier, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Put script content for a script uploaded to a Workers for Platforms namespace. +func (r *AccountWorkerDispatchNamespaceScriptContentService) Update(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, params AccountWorkerDispatchNamespaceScriptContentUpdateParams, opts ...option.RequestOption) (res *AccountWorkerDispatchNamespaceScriptContentUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/content", accountIdentifier, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) + return +} + +type AccountWorkerDispatchNamespaceScriptContentUpdateResponse struct { + // The id of the script in the Workers system. Usually the script name. + ID string `json:"id"` + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Hashed script content, can be used in a If-None-Match header when updating. + Etag string `json:"etag"` + // Whether Logpush is turned on for the Worker. + Logpush bool `json:"logpush"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Deprecated. Deployment metadata for internal usage. + PipelineHash string `json:"pipeline_hash"` + // Specifies the placement mode for the Worker (e.g. 'smart'). + PlacementMode string `json:"placement_mode"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerDispatchNamespaceScriptContentUpdateResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerDispatchNamespaceScriptContentUpdateResponseJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptContentUpdateResponseJSON contains the JSON +// metadata for the struct +// [AccountWorkerDispatchNamespaceScriptContentUpdateResponse] +type accountWorkerDispatchNamespaceScriptContentUpdateResponseJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Etag apijson.Field + Logpush apijson.Field + ModifiedOn apijson.Field + PipelineHash apijson.Field + PlacementMode apijson.Field + TailConsumers apijson.Field + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptContentUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerDispatchNamespaceScriptContentUpdateResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerDispatchNamespaceScriptContentUpdateResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptContentUpdateResponseTailConsumerJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptContentUpdateResponseTailConsumer] +type accountWorkerDispatchNamespaceScriptContentUpdateResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptContentUpdateResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptContentUpdateParams struct { + // A module comprising a Worker script, often a javascript file. Multiple modules + // may be provided as separate named parts, but at least one module must be + // present. This should be referenced either in the metadata as `main_module` + // (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` + // (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. + AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` + // JSON encoded metadata about the uploaded parts and Worker configuration. + Metadata param.Field[AccountWorkerDispatchNamespaceScriptContentUpdateParamsMetadata] `json:"metadata"` + CfWorkerBodyPart param.Field[string] `header:"CF-WORKER-BODY-PART"` + CfWorkerMainModulePart param.Field[string] `header:"CF-WORKER-MAIN-MODULE-PART"` +} + +func (r AccountWorkerDispatchNamespaceScriptContentUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} + +// JSON encoded metadata about the uploaded parts and Worker configuration. +type AccountWorkerDispatchNamespaceScriptContentUpdateParamsMetadata struct { + // Name of the part in the multipart request that contains the script (e.g. the + // file adding a listener to the `fetch` event). Indicates a + // `service worker syntax` Worker. + BodyPart param.Field[string] `json:"body_part"` + // Name of the part in the multipart request that contains the main module (e.g. + // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. + MainModule param.Field[string] `json:"main_module"` +} + +func (r AccountWorkerDispatchNamespaceScriptContentUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountworkerdispatchnamespacescriptcontent_test.go b/accountworkerdispatchnamespacescriptcontent_test.go new file mode 100644 index 00000000000..6edf3b1e612 --- /dev/null +++ b/accountworkerdispatchnamespacescriptcontent_test.go @@ -0,0 +1,101 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDispatchNamespaceScriptContentGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Accounts.Workers.Dispatch.Namespaces.Scripts.Content.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-dispatch-namespace", + "this-is_my_script-01", + ) + 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) + } +} + +func TestAccountWorkerDispatchNamespaceScriptContentUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Dispatch.Namespaces.Scripts.Content.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-dispatch-namespace", + "this-is_my_script-01", + cloudflare.AccountWorkerDispatchNamespaceScriptContentUpdateParams{ + AnyPartName: cloudflare.F([]io.Reader{io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents")))}), + Metadata: cloudflare.F(cloudflare.AccountWorkerDispatchNamespaceScriptContentUpdateParamsMetadata{ + BodyPart: cloudflare.F("worker.js"), + MainModule: cloudflare.F("worker.js"), + }), + CfWorkerBodyPart: cloudflare.F("string"), + CfWorkerMainModulePart: cloudflare.F("string"), + }, + ) + 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/accountworkerdispatchnamespacescriptsetting.go b/accountworkerdispatchnamespacescriptsetting.go new file mode 100644 index 00000000000..b6f8f10f215 --- /dev/null +++ b/accountworkerdispatchnamespacescriptsetting.go @@ -0,0 +1,1746 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDispatchNamespaceScriptSettingService 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 [NewAccountWorkerDispatchNamespaceScriptSettingService] method instead. +type AccountWorkerDispatchNamespaceScriptSettingService struct { + Options []option.RequestOption +} + +// NewAccountWorkerDispatchNamespaceScriptSettingService 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 NewAccountWorkerDispatchNamespaceScriptSettingService(opts ...option.RequestOption) (r *AccountWorkerDispatchNamespaceScriptSettingService) { + r = &AccountWorkerDispatchNamespaceScriptSettingService{} + r.Options = opts + return +} + +// Get script settings from a script uploaded to a Workers for Platforms namespace. +func (r *AccountWorkerDispatchNamespaceScriptSettingService) Get(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, opts ...option.RequestOption) (res *AccountWorkerDispatchNamespaceScriptSettingGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/settings", accountIdentifier, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Patch script metadata, such as bindings +func (r *AccountWorkerDispatchNamespaceScriptSettingService) Update(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, body AccountWorkerDispatchNamespaceScriptSettingUpdateParams, opts ...option.RequestOption) (res *AccountWorkerDispatchNamespaceScriptSettingUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/settings", accountIdentifier, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponse struct { + // List of bindings attached to this Worker + Bindings []AccountWorkerDispatchNamespaceScriptSettingGetResponseBinding `json:"bindings"` + // Opt your Worker into changes after this date + CompatibilityDate string `json:"compatibility_date"` + // Opt your Worker into specific changes + CompatibilityFlags []string `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 AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrations `json:"migrations"` + Placement AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacement `json:"placement"` + // Tags to help you manage your Workers + Tags []string `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerDispatchNamespaceScriptSettingGetResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseJSON contains the JSON +// metadata for the struct [AccountWorkerDispatchNamespaceScriptSettingGetResponse] +type accountWorkerDispatchNamespaceScriptSettingGetResponseJSON 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 *AccountWorkerDispatchNamespaceScriptSettingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A binding to allow the Worker to communicate with resources +// +// Union satisfied by +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBinding], +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBinding], +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2Binding], +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBinding], +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1Binding], +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding] +// or +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBinding interface { + implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerDispatchNamespaceScriptSettingGetResponseBinding)(nil)).Elem(), "") +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON struct { + Name apijson.Field + NamespaceID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBinding struct { + // Optional environment if the Worker utilizes one. + Environment string `json:"environment,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Name of Worker to bind to + Service string `json:"service,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBinding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBindingJSON struct { + Environment apijson.Field + Name apijson.Field + Service apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBindingTypeService AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBinding struct { + // The exported class name of the Durable Object + ClassName string `json:"class_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBindingType `json:"type,required"` + // The environment of the script_name to bind to + Environment string `json:"environment"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id"` + // The script where the Durable Object is defined, if it is external to this Worker + ScriptName string `json:"script_name"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBinding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBindingJSON struct { + ClassName apijson.Field + Name apijson.Field + Type apijson.Field + Environment apijson.Field + NamespaceID apijson.Field + ScriptName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBinding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2Binding struct { + // R2 bucket to bind to + BucketName string `json:"bucket_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2BindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2BindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2Binding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2BindingJSON struct { + BucketName apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2Binding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBinding 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 AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBinding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBindingJSON struct { + Name apijson.Field + QueueName apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBinding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1Binding struct { + // ID of the D1 database to bind to + ID string `json:"id,required"` + // A JavaScript variable name for the binding. + Binding string `json:"binding,required"` + // The name of the D1 database associated with the 'id' provided. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1BindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1BindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1Binding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1BindingJSON struct { + ID apijson.Field + Binding apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1Binding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace to bind to + Namespace string `json:"namespace,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType `json:"type,required"` + // Outbound worker + Outbound AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound `json:"outbound"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON struct { + Name apijson.Field + Namespace apijson.Field + Type apijson.Field + Outbound apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound struct { + // Pass information from the Dispatch Worker to the Outbound Worker through the + // parameters + Params []string `json:"params"` + // Outbound worker + Worker AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker `json:"worker"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON struct { + Params apijson.Field + Worker apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Outbound worker +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker struct { + // Environment of the outbound worker + Environment string `json:"environment"` + // Name of the outbound worker + Service string `json:"service"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType `json:"type,required"` + // ID of the certificate to bind to + CertificateID string `json:"certificate_id"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding] +type accountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON struct { + Name apijson.Field + Type apijson.Field + CertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerDispatchNamespaceScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Union satisfied by +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations] +// or +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrations interface { + implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseMigrations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrations)(nil)).Elem(), "") +} + +// A single set of migrations to apply. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations 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 []AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass `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 []AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass `json:"transferred_classes"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations] +type accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON 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 *AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] +type accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] +type accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations 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 []AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep `json:"steps"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations] +type accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON struct { + NewTag apijson.Field + OldTag apijson.Field + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerDispatchNamespaceScriptSettingGetResponseMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep 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 []AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass `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 []AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass `json:"transferred_classes"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep] +type accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON struct { + DeletedClasses apijson.Field + NewClasses apijson.Field + RenamedClasses apijson.Field + TransferredClasses apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] +type accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] +type accountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacementMode `json:"mode"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponsePlacementJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponsePlacementJSON contains the +// JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacement] +type accountWorkerDispatchNamespaceScriptSettingGetResponsePlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacementMode string + +const ( + AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacementModeSmart AccountWorkerDispatchNamespaceScriptSettingGetResponsePlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerDispatchNamespaceScriptSettingGetResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerDispatchNamespaceScriptSettingGetResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingGetResponseTailConsumerJSON contains +// the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingGetResponseTailConsumer] +type accountWorkerDispatchNamespaceScriptSettingGetResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingGetResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponse struct { + // List of bindings attached to this Worker + Bindings []AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding `json:"bindings"` + // Opt your Worker into changes after this date + CompatibilityDate string `json:"compatibility_date"` + // Opt your Worker into specific changes + CompatibilityFlags []string `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 AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrations `json:"migrations"` + Placement AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacement `json:"placement"` + // Tags to help you manage your Workers + Tags []string `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerDispatchNamespaceScriptSettingUpdateResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseJSON contains the JSON +// metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponse] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseJSON 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 *AccountWorkerDispatchNamespaceScriptSettingUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A binding to allow the Worker to communicate with resources +// +// Union satisfied by +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding] +// or +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding interface { + implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding)(nil)).Elem(), "") +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON struct { + Name apijson.Field + NamespaceID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding struct { + // Optional environment if the Worker utilizes one. + Environment string `json:"environment,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Name of Worker to bind to + Service string `json:"service,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON struct { + Environment apijson.Field + Name apijson.Field + Service apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingTypeService AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding struct { + // The exported class name of the Durable Object + ClassName string `json:"class_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingType `json:"type,required"` + // The environment of the script_name to bind to + Environment string `json:"environment"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id"` + // The script where the Durable Object is defined, if it is external to this Worker + ScriptName string `json:"script_name"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON struct { + ClassName apijson.Field + Name apijson.Field + Type apijson.Field + Environment apijson.Field + NamespaceID apijson.Field + ScriptName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding struct { + // R2 bucket to bind to + BucketName string `json:"bucket_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON struct { + BucketName apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding 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 AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON struct { + Name apijson.Field + QueueName apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding struct { + // ID of the D1 database to bind to + ID string `json:"id,required"` + // A JavaScript variable name for the binding. + Binding string `json:"binding,required"` + // The name of the D1 database associated with the 'id' provided. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingType `json:"type,required"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON struct { + ID apijson.Field + Binding apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace to bind to + Namespace string `json:"namespace,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType `json:"type,required"` + // Outbound worker + Outbound AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound `json:"outbound"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON struct { + Name apijson.Field + Namespace apijson.Field + Type apijson.Field + Outbound apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound struct { + // Pass information from the Dispatch Worker to the Outbound Worker through the + // parameters + Params []string `json:"params"` + // Outbound worker + Worker AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker `json:"worker"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON struct { + Params apijson.Field + Worker apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Outbound worker +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker struct { + // Environment of the outbound worker + Environment string `json:"environment"` + // Name of the outbound worker + Service string `json:"service"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType `json:"type,required"` + // ID of the certificate to bind to + CertificateID string `json:"certificate_id"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON struct { + Name apijson.Field + Type apijson.Field + CertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerDispatchNamespaceScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Union satisfied by +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations] +// or +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrations interface { + implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrations)(nil)).Elem(), "") +} + +// A single set of migrations to apply. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations 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 []AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass `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 []AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass `json:"transferred_classes"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON 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 *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations 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 []AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep `json:"steps"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON struct { + NewTag apijson.Field + OldTag apijson.Field + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep 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 []AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass `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 []AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass `json:"transferred_classes"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON struct { + DeletedClasses apijson.Field + NewClasses apijson.Field + RenamedClasses apijson.Field + TransferredClasses apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacementMode `json:"mode"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacementJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacementJSON contains +// the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacement] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacementMode string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacementModeSmart AccountWorkerDispatchNamespaceScriptSettingUpdateResponsePlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerDispatchNamespaceScriptSettingUpdateResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerDispatchNamespaceScriptSettingUpdateResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerDispatchNamespaceScriptSettingUpdateResponseTailConsumerJSON +// contains the JSON metadata for the struct +// [AccountWorkerDispatchNamespaceScriptSettingUpdateResponseTailConsumer] +type accountWorkerDispatchNamespaceScriptSettingUpdateResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDispatchNamespaceScriptSettingUpdateResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParams struct { + // List of bindings attached to this Worker + Bindings param.Field[[]AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding] `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[[]string] `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[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrations] `json:"migrations"` + Placement param.Field[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacement] `json:"placement"` + // Tags to help you manage your Workers + Tags param.Field[[]string] `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers param.Field[[]AccountWorkerDispatchNamespaceScriptSettingUpdateParamsTailConsumer] `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel param.Field[string] `json:"usage_model"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A binding to allow the Worker to communicate with resources +// +// Satisfied by +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2Binding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1Binding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding interface { + implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding struct { + // The class of resource that the binding provides. + Type param.Field[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingType] `json:"type,required"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBinding 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[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBindingType] `json:"type,required"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBindingTypeService AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBinding 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[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBindingType] `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 AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2Binding 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[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2BindingType] `json:"type,required"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2Binding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBinding 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[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBindingType] `json:"type,required"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1Binding 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[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1BindingType] `json:"type,required"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1Binding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding struct { + // Namespace to bind to + Namespace param.Field[string] `json:"namespace,required"` + // The class of resource that the binding provides. + Type param.Field[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingType] `json:"type,required"` + // Outbound worker + Outbound param.Field[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutbound] `json:"outbound"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutbound 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[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] `json:"worker"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutbound) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Outbound worker +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker 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 AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding struct { + // The class of resource that the binding provides. + Type param.Field[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingType] `json:"type,required"` + // ID of the certificate to bind to + CertificateID param.Field[string] `json:"certificate_id"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Satisfied by +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations], +// [AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrations interface { + implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrations() +} + +// A single set of migrations to apply. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // 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"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] `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 param.Field[[]AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations 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"` + // Migrations to apply in order. + Steps param.Field[[]AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStep] `json:"steps"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrations() { +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStep struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] `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 param.Field[[]AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode param.Field[AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacementMode] `json:"mode"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacement) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacementMode string + +const ( + AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacementModeSmart AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerDispatchNamespaceScriptSettingUpdateParamsTailConsumer struct { + // Name of Worker that is to be the consumer. + Service param.Field[string] `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment param.Field[string] `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace param.Field[string] `json:"namespace"` +} + +func (r AccountWorkerDispatchNamespaceScriptSettingUpdateParamsTailConsumer) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountworkerdispatchnamespacescriptsetting_test.go b/accountworkerdispatchnamespacescriptsetting_test.go new file mode 100644 index 00000000000..7f81ca66c3f --- /dev/null +++ b/accountworkerdispatchnamespacescriptsetting_test.go @@ -0,0 +1,135 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDispatchNamespaceScriptSettingGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Dispatch.Namespaces.Scripts.Settings.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-dispatch-namespace", + "this-is_my_script-01", + ) + 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 TestAccountWorkerDispatchNamespaceScriptSettingUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Dispatch.Namespaces.Scripts.Settings.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-dispatch-namespace", + "this-is_my_script-01", + cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParams{ + Bindings: cloudflare.F([]cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBinding{cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + }), cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + }), cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + })}), + CompatibilityDate: cloudflare.F("2022-04-05"), + CompatibilityFlags: cloudflare.F([]string{"formdata_parser_supports_files", "formdata_parser_supports_files", "formdata_parser_supports_files"}), + Logpush: cloudflare.F(false), + Migrations: cloudflare.F[cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrations](cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations{ + 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([]cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass{{ + 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([]cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass{{ + 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(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacement{ + Mode: cloudflare.F(cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsPlacementModeSmart), + }), + Tags: cloudflare.F([]string{"my-tag", "my-tag", "my-tag"}), + TailConsumers: cloudflare.F([]cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParamsTailConsumer{{ + 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()) + } +} diff --git a/accountworkerdomain.go b/accountworkerdomain.go new file mode 100644 index 00000000000..8a383350f3b --- /dev/null +++ b/accountworkerdomain.go @@ -0,0 +1,416 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDomainService 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 [NewAccountWorkerDomainService] +// method instead. +type AccountWorkerDomainService struct { + Options []option.RequestOption +} + +// NewAccountWorkerDomainService 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 NewAccountWorkerDomainService(opts ...option.RequestOption) (r *AccountWorkerDomainService) { + r = &AccountWorkerDomainService{} + r.Options = opts + return +} + +// Gets a Worker domain. +func (r *AccountWorkerDomainService) Get(ctx context.Context, accountIdentifier interface{}, domainIdentifier interface{}, opts ...option.RequestOption) (res *AccountWorkerDomainGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/workers/domains/%v", accountIdentifier, domainIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Detaches a Worker from a zone and hostname. +func (r *AccountWorkerDomainService) Delete(ctx context.Context, accountIdentifier interface{}, domainIdentifier interface{}, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%v/workers/domains/%v", accountIdentifier, domainIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Attaches a Worker to a zone and hostname. +func (r *AccountWorkerDomainService) WorkerDomainAttachToDomain(ctx context.Context, accountIdentifier interface{}, body AccountWorkerDomainWorkerDomainAttachToDomainParams, opts ...option.RequestOption) (res *AccountWorkerDomainWorkerDomainAttachToDomainResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/workers/domains", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists all Worker Domains for an account. +func (r *AccountWorkerDomainService) WorkerDomainListDomains(ctx context.Context, accountIdentifier interface{}, query AccountWorkerDomainWorkerDomainListDomainsParams, opts ...option.RequestOption) (res *AccountWorkerDomainWorkerDomainListDomainsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%v/workers/domains", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountWorkerDomainGetResponse struct { + Errors []AccountWorkerDomainGetResponseError `json:"errors"` + Messages []AccountWorkerDomainGetResponseMessage `json:"messages"` + Result AccountWorkerDomainGetResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerDomainGetResponseSuccess `json:"success"` + JSON accountWorkerDomainGetResponseJSON `json:"-"` +} + +// accountWorkerDomainGetResponseJSON contains the JSON metadata for the struct +// [AccountWorkerDomainGetResponse] +type accountWorkerDomainGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDomainGetResponseErrorJSON `json:"-"` +} + +// accountWorkerDomainGetResponseErrorJSON contains the JSON metadata for the +// struct [AccountWorkerDomainGetResponseError] +type accountWorkerDomainGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDomainGetResponseMessageJSON `json:"-"` +} + +// accountWorkerDomainGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountWorkerDomainGetResponseMessage] +type accountWorkerDomainGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainGetResponseResult struct { + // Identifer of the Worker Domain. + ID interface{} `json:"id"` + // Worker environment associated with the zone and hostname. + Environment string `json:"environment"` + // Hostname of the Worker Domain. + Hostname string `json:"hostname"` + // Worker service associated with the zone and hostname. + Service string `json:"service"` + // Identifier of the zone. + ZoneID interface{} `json:"zone_id"` + // Name of the zone. + ZoneName string `json:"zone_name"` + JSON accountWorkerDomainGetResponseResultJSON `json:"-"` +} + +// accountWorkerDomainGetResponseResultJSON contains the JSON metadata for the +// struct [AccountWorkerDomainGetResponseResult] +type accountWorkerDomainGetResponseResultJSON struct { + ID apijson.Field + Environment apijson.Field + Hostname apijson.Field + Service apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerDomainGetResponseSuccess bool + +const ( + AccountWorkerDomainGetResponseSuccessTrue AccountWorkerDomainGetResponseSuccess = true +) + +type AccountWorkerDomainWorkerDomainAttachToDomainResponse struct { + Errors []AccountWorkerDomainWorkerDomainAttachToDomainResponseError `json:"errors"` + Messages []AccountWorkerDomainWorkerDomainAttachToDomainResponseMessage `json:"messages"` + Result AccountWorkerDomainWorkerDomainAttachToDomainResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerDomainWorkerDomainAttachToDomainResponseSuccess `json:"success"` + JSON accountWorkerDomainWorkerDomainAttachToDomainResponseJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainAttachToDomainResponseJSON contains the JSON +// metadata for the struct [AccountWorkerDomainWorkerDomainAttachToDomainResponse] +type accountWorkerDomainWorkerDomainAttachToDomainResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainAttachToDomainResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainWorkerDomainAttachToDomainResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDomainWorkerDomainAttachToDomainResponseErrorJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainAttachToDomainResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountWorkerDomainWorkerDomainAttachToDomainResponseError] +type accountWorkerDomainWorkerDomainAttachToDomainResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainAttachToDomainResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainWorkerDomainAttachToDomainResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDomainWorkerDomainAttachToDomainResponseMessageJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainAttachToDomainResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountWorkerDomainWorkerDomainAttachToDomainResponseMessage] +type accountWorkerDomainWorkerDomainAttachToDomainResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainAttachToDomainResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainWorkerDomainAttachToDomainResponseResult struct { + // Identifer of the Worker Domain. + ID interface{} `json:"id"` + // Worker environment associated with the zone and hostname. + Environment string `json:"environment"` + // Hostname of the Worker Domain. + Hostname string `json:"hostname"` + // Worker service associated with the zone and hostname. + Service string `json:"service"` + // Identifier of the zone. + ZoneID interface{} `json:"zone_id"` + // Name of the zone. + ZoneName string `json:"zone_name"` + JSON accountWorkerDomainWorkerDomainAttachToDomainResponseResultJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainAttachToDomainResponseResultJSON contains the +// JSON metadata for the struct +// [AccountWorkerDomainWorkerDomainAttachToDomainResponseResult] +type accountWorkerDomainWorkerDomainAttachToDomainResponseResultJSON struct { + ID apijson.Field + Environment apijson.Field + Hostname apijson.Field + Service apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainAttachToDomainResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerDomainWorkerDomainAttachToDomainResponseSuccess bool + +const ( + AccountWorkerDomainWorkerDomainAttachToDomainResponseSuccessTrue AccountWorkerDomainWorkerDomainAttachToDomainResponseSuccess = true +) + +type AccountWorkerDomainWorkerDomainListDomainsResponse struct { + Errors []AccountWorkerDomainWorkerDomainListDomainsResponseError `json:"errors"` + Messages []AccountWorkerDomainWorkerDomainListDomainsResponseMessage `json:"messages"` + Result []AccountWorkerDomainWorkerDomainListDomainsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerDomainWorkerDomainListDomainsResponseSuccess `json:"success"` + JSON accountWorkerDomainWorkerDomainListDomainsResponseJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainListDomainsResponseJSON contains the JSON +// metadata for the struct [AccountWorkerDomainWorkerDomainListDomainsResponse] +type accountWorkerDomainWorkerDomainListDomainsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainListDomainsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainWorkerDomainListDomainsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDomainWorkerDomainListDomainsResponseErrorJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainListDomainsResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountWorkerDomainWorkerDomainListDomainsResponseError] +type accountWorkerDomainWorkerDomainListDomainsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainListDomainsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainWorkerDomainListDomainsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDomainWorkerDomainListDomainsResponseMessageJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainListDomainsResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountWorkerDomainWorkerDomainListDomainsResponseMessage] +type accountWorkerDomainWorkerDomainListDomainsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainListDomainsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDomainWorkerDomainListDomainsResponseResult struct { + // Identifer of the Worker Domain. + ID interface{} `json:"id"` + // Worker environment associated with the zone and hostname. + Environment string `json:"environment"` + // Hostname of the Worker Domain. + Hostname string `json:"hostname"` + // Worker service associated with the zone and hostname. + Service string `json:"service"` + // Identifier of the zone. + ZoneID interface{} `json:"zone_id"` + // Name of the zone. + ZoneName string `json:"zone_name"` + JSON accountWorkerDomainWorkerDomainListDomainsResponseResultJSON `json:"-"` +} + +// accountWorkerDomainWorkerDomainListDomainsResponseResultJSON contains the JSON +// metadata for the struct +// [AccountWorkerDomainWorkerDomainListDomainsResponseResult] +type accountWorkerDomainWorkerDomainListDomainsResponseResultJSON struct { + ID apijson.Field + Environment apijson.Field + Hostname apijson.Field + Service apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDomainWorkerDomainListDomainsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerDomainWorkerDomainListDomainsResponseSuccess bool + +const ( + AccountWorkerDomainWorkerDomainListDomainsResponseSuccessTrue AccountWorkerDomainWorkerDomainListDomainsResponseSuccess = true +) + +type AccountWorkerDomainWorkerDomainAttachToDomainParams struct { + // Worker environment associated with the zone and hostname. + Environment param.Field[string] `json:"environment,required"` + // Hostname of the Worker Domain. + Hostname param.Field[string] `json:"hostname,required"` + // Worker service associated with the zone and hostname. + Service param.Field[string] `json:"service,required"` + // Identifier of the zone. + ZoneID param.Field[interface{}] `json:"zone_id,required"` +} + +func (r AccountWorkerDomainWorkerDomainAttachToDomainParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerDomainWorkerDomainListDomainsParams struct { + // Worker environment associated with the zone and hostname. + Environment param.Field[string] `query:"environment"` + // Hostname of the Worker Domain. + Hostname param.Field[string] `query:"hostname"` + // Worker service associated with the zone and hostname. + Service param.Field[string] `query:"service"` + // Identifier of the zone. + ZoneIdentifier param.Field[interface{}] `query:"zone_identifier"` + // Name of the zone. + ZoneName param.Field[string] `query:"zone_name"` +} + +// URLQuery serializes [AccountWorkerDomainWorkerDomainListDomainsParams]'s query +// parameters as `url.Values`. +func (r AccountWorkerDomainWorkerDomainListDomainsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountworkerdomain_test.go b/accountworkerdomain_test.go new file mode 100644 index 00000000000..14ce2165ff2 --- /dev/null +++ b/accountworkerdomain_test.go @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDomainGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Domains.Get( + context.TODO(), + "9a7806061c88ada191ed06f989cc3dac", + "dbe10b4bc17c295377eabd600e1787fd", + ) + 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 TestAccountWorkerDomainDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Workers.Domains.Delete( + context.TODO(), + "9a7806061c88ada191ed06f989cc3dac", + "dbe10b4bc17c295377eabd600e1787fd", + ) + 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 TestAccountWorkerDomainWorkerDomainAttachToDomain(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Domains.WorkerDomainAttachToDomain( + context.TODO(), + "9a7806061c88ada191ed06f989cc3dac", + cloudflare.AccountWorkerDomainWorkerDomainAttachToDomainParams{ + Environment: cloudflare.F("production"), + Hostname: cloudflare.F("foo.example.com"), + Service: cloudflare.F("foo"), + ZoneID: cloudflare.F[any]("593c9c94de529bbbfaac7c53ced0447d"), + }, + ) + 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 TestAccountWorkerDomainWorkerDomainListDomainsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Domains.WorkerDomainListDomains( + context.TODO(), + "9a7806061c88ada191ed06f989cc3dac", + cloudflare.AccountWorkerDomainWorkerDomainListDomainsParams{ + Environment: cloudflare.F("production"), + Hostname: cloudflare.F("foo.example.com"), + Service: cloudflare.F("foo"), + ZoneIdentifier: cloudflare.F[any]("593c9c94de529bbbfaac7c53ced0447d"), + ZoneName: cloudflare.F("example.com"), + }, + ) + 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/accountworkerdurableobject.go b/accountworkerdurableobject.go new file mode 100644 index 00000000000..396f58917b0 --- /dev/null +++ b/accountworkerdurableobject.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDurableObjectService 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 +// [NewAccountWorkerDurableObjectService] method instead. +type AccountWorkerDurableObjectService struct { + Options []option.RequestOption + Namespaces *AccountWorkerDurableObjectNamespaceService +} + +// NewAccountWorkerDurableObjectService 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 NewAccountWorkerDurableObjectService(opts ...option.RequestOption) (r *AccountWorkerDurableObjectService) { + r = &AccountWorkerDurableObjectService{} + r.Options = opts + r.Namespaces = NewAccountWorkerDurableObjectNamespaceService(opts...) + return +} diff --git a/accountworkerdurableobjectnamespace.go b/accountworkerdurableobjectnamespace.go new file mode 100644 index 00000000000..c810cadb033 --- /dev/null +++ b/accountworkerdurableobjectnamespace.go @@ -0,0 +1,164 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDurableObjectNamespaceService 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 +// [NewAccountWorkerDurableObjectNamespaceService] method instead. +type AccountWorkerDurableObjectNamespaceService struct { + Options []option.RequestOption + Objects *AccountWorkerDurableObjectNamespaceObjectService +} + +// NewAccountWorkerDurableObjectNamespaceService 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 NewAccountWorkerDurableObjectNamespaceService(opts ...option.RequestOption) (r *AccountWorkerDurableObjectNamespaceService) { + r = &AccountWorkerDurableObjectNamespaceService{} + r.Options = opts + r.Objects = NewAccountWorkerDurableObjectNamespaceObjectService(opts...) + return +} + +// Returns the Durable Object namespaces owned by an account. +func (r *AccountWorkerDurableObjectNamespaceService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountWorkerDurableObjectNamespaceListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/durable_objects/namespaces", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountWorkerDurableObjectNamespaceListResponse struct { + Errors []AccountWorkerDurableObjectNamespaceListResponseError `json:"errors"` + Messages []AccountWorkerDurableObjectNamespaceListResponseMessage `json:"messages"` + Result []AccountWorkerDurableObjectNamespaceListResponseResult `json:"result"` + ResultInfo AccountWorkerDurableObjectNamespaceListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerDurableObjectNamespaceListResponseSuccess `json:"success"` + JSON accountWorkerDurableObjectNamespaceListResponseJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceListResponseJSON contains the JSON metadata +// for the struct [AccountWorkerDurableObjectNamespaceListResponse] +type accountWorkerDurableObjectNamespaceListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDurableObjectNamespaceListResponseErrorJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceListResponseErrorJSON contains the JSON +// metadata for the struct [AccountWorkerDurableObjectNamespaceListResponseError] +type accountWorkerDurableObjectNamespaceListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDurableObjectNamespaceListResponseMessageJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceListResponseMessageJSON contains the JSON +// metadata for the struct [AccountWorkerDurableObjectNamespaceListResponseMessage] +type accountWorkerDurableObjectNamespaceListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceListResponseResult struct { + ID interface{} `json:"id"` + Class interface{} `json:"class"` + Name interface{} `json:"name"` + Script interface{} `json:"script"` + JSON accountWorkerDurableObjectNamespaceListResponseResultJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceListResponseResultJSON contains the JSON +// metadata for the struct [AccountWorkerDurableObjectNamespaceListResponseResult] +type accountWorkerDurableObjectNamespaceListResponseResultJSON struct { + ID apijson.Field + Class apijson.Field + Name apijson.Field + Script apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerDurableObjectNamespaceListResponseResultInfoJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceListResponseResultInfoJSON contains the JSON +// metadata for the struct +// [AccountWorkerDurableObjectNamespaceListResponseResultInfo] +type accountWorkerDurableObjectNamespaceListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerDurableObjectNamespaceListResponseSuccess bool + +const ( + AccountWorkerDurableObjectNamespaceListResponseSuccessTrue AccountWorkerDurableObjectNamespaceListResponseSuccess = true +) diff --git a/accountworkerdurableobjectnamespace_test.go b/accountworkerdurableobjectnamespace_test.go new file mode 100644 index 00000000000..05c96b87c76 --- /dev/null +++ b/accountworkerdurableobjectnamespace_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDurableObjectNamespaceList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.DurableObjects.Namespaces.List(context.TODO(), "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/accountworkerdurableobjectnamespaceobject.go b/accountworkerdurableobjectnamespaceobject.go new file mode 100644 index 00000000000..0e2d3793eaf --- /dev/null +++ b/accountworkerdurableobjectnamespaceobject.go @@ -0,0 +1,181 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerDurableObjectNamespaceObjectService 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 [NewAccountWorkerDurableObjectNamespaceObjectService] method instead. +type AccountWorkerDurableObjectNamespaceObjectService struct { + Options []option.RequestOption +} + +// NewAccountWorkerDurableObjectNamespaceObjectService 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 NewAccountWorkerDurableObjectNamespaceObjectService(opts ...option.RequestOption) (r *AccountWorkerDurableObjectNamespaceObjectService) { + r = &AccountWorkerDurableObjectNamespaceObjectService{} + r.Options = opts + return +} + +// Returns the Durable Objects in a given namespace. +func (r *AccountWorkerDurableObjectNamespaceObjectService) List(ctx context.Context, accountIdentifier string, id string, query AccountWorkerDurableObjectNamespaceObjectListParams, opts ...option.RequestOption) (res *AccountWorkerDurableObjectNamespaceObjectListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/durable_objects/namespaces/%s/objects", accountIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type AccountWorkerDurableObjectNamespaceObjectListResponse struct { + Errors []AccountWorkerDurableObjectNamespaceObjectListResponseError `json:"errors"` + Messages []AccountWorkerDurableObjectNamespaceObjectListResponseMessage `json:"messages"` + Result []AccountWorkerDurableObjectNamespaceObjectListResponseResult `json:"result"` + ResultInfo AccountWorkerDurableObjectNamespaceObjectListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerDurableObjectNamespaceObjectListResponseSuccess `json:"success"` + JSON accountWorkerDurableObjectNamespaceObjectListResponseJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceObjectListResponseJSON contains the JSON +// metadata for the struct [AccountWorkerDurableObjectNamespaceObjectListResponse] +type accountWorkerDurableObjectNamespaceObjectListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceObjectListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceObjectListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDurableObjectNamespaceObjectListResponseErrorJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceObjectListResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountWorkerDurableObjectNamespaceObjectListResponseError] +type accountWorkerDurableObjectNamespaceObjectListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceObjectListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceObjectListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerDurableObjectNamespaceObjectListResponseMessageJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceObjectListResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountWorkerDurableObjectNamespaceObjectListResponseMessage] +type accountWorkerDurableObjectNamespaceObjectListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceObjectListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceObjectListResponseResult struct { + // ID of the Durable Object. + ID string `json:"id"` + // Whether the Durable Object has stored data. + HasStoredData bool `json:"hasStoredData"` + JSON accountWorkerDurableObjectNamespaceObjectListResponseResultJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceObjectListResponseResultJSON contains the +// JSON metadata for the struct +// [AccountWorkerDurableObjectNamespaceObjectListResponseResult] +type accountWorkerDurableObjectNamespaceObjectListResponseResultJSON struct { + ID apijson.Field + HasStoredData apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceObjectListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerDurableObjectNamespaceObjectListResponseResultInfo struct { + // Total results returned based on your list parameters. + Count float64 `json:"count"` + // Opaque token indicating the position from which to continue when requesting the + // next set of records. A valid value for the cursor can be obtained from the + // cursors object in the result_info structure. + Cursor string `json:"cursor"` + JSON accountWorkerDurableObjectNamespaceObjectListResponseResultInfoJSON `json:"-"` +} + +// accountWorkerDurableObjectNamespaceObjectListResponseResultInfoJSON contains the +// JSON metadata for the struct +// [AccountWorkerDurableObjectNamespaceObjectListResponseResultInfo] +type accountWorkerDurableObjectNamespaceObjectListResponseResultInfoJSON struct { + Count apijson.Field + Cursor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerDurableObjectNamespaceObjectListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerDurableObjectNamespaceObjectListResponseSuccess bool + +const ( + AccountWorkerDurableObjectNamespaceObjectListResponseSuccessTrue AccountWorkerDurableObjectNamespaceObjectListResponseSuccess = true +) + +type AccountWorkerDurableObjectNamespaceObjectListParams struct { + // Opaque token indicating the position from which to continue when requesting the + // next set of records. A valid value for the cursor can be obtained from the + // cursors object in the result_info structure. + Cursor param.Field[string] `query:"cursor"` + // The number of objects to return. The cursor attribute may be used to iterate + // over the next batch of objects if there are more than the limit. + Limit param.Field[float64] `query:"limit"` +} + +// URLQuery serializes [AccountWorkerDurableObjectNamespaceObjectListParams]'s +// query parameters as `url.Values`. +func (r AccountWorkerDurableObjectNamespaceObjectListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountworkerdurableobjectnamespaceobject_test.go b/accountworkerdurableobjectnamespaceobject_test.go new file mode 100644 index 00000000000..934c492d08c --- /dev/null +++ b/accountworkerdurableobjectnamespaceobject_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerDurableObjectNamespaceObjectListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.DurableObjects.Namespaces.Objects.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "5fd1cafff895419c8bcc647fc64ab8f0", + cloudflare.AccountWorkerDurableObjectNamespaceObjectListParams{ + Cursor: cloudflare.F("AAAAANuhDN7SjacTnSVsDu3WW1Lvst6dxJGTjRY5BhxPXdf6L6uTcpd_NVtjhn11OUYRsVEykxoUwF-JQU4dn6QylZSKTOJuG0indrdn_MlHpMRtsxgXjs-RPdHYIVm3odE_uvEQ_dTQGFm8oikZMohns34DLBgrQpc"), + Limit: cloudflare.F(10.000000), + }, + ) + 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/accountworkerqueue.go b/accountworkerqueue.go new file mode 100644 index 00000000000..6559aa57a9e --- /dev/null +++ b/accountworkerqueue.go @@ -0,0 +1,648 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerQueueService 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 [NewAccountWorkerQueueService] method +// instead. +type AccountWorkerQueueService struct { + Options []option.RequestOption + Consumers *AccountWorkerQueueConsumerService +} + +// NewAccountWorkerQueueService 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 NewAccountWorkerQueueService(opts ...option.RequestOption) (r *AccountWorkerQueueService) { + r = &AccountWorkerQueueService{} + r.Options = opts + r.Consumers = NewAccountWorkerQueueConsumerService(opts...) + return +} + +// Get information about a specific queue. +func (r *AccountWorkerQueueService) Get(ctx context.Context, accountIdentifier string, name string, opts ...option.RequestOption) (res *AccountWorkerQueueGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues/%s", accountIdentifier, name) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a queue. +func (r *AccountWorkerQueueService) Update(ctx context.Context, accountIdentifier string, name string, body AccountWorkerQueueUpdateParams, opts ...option.RequestOption) (res *AccountWorkerQueueUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues/%s", accountIdentifier, name) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Returns the queues owned by an account. +func (r *AccountWorkerQueueService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountWorkerQueueListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes a queue. +func (r *AccountWorkerQueueService) Delete(ctx context.Context, accountIdentifier string, name string, opts ...option.RequestOption) (res *AccountWorkerQueueDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues/%s", accountIdentifier, name) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new queue. +func (r *AccountWorkerQueueService) QueueNewQueue(ctx context.Context, accountIdentifier string, body AccountWorkerQueueQueueNewQueueParams, opts ...option.RequestOption) (res *AccountWorkerQueueQueueNewQueueResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountWorkerQueueGetResponse struct { + Errors []AccountWorkerQueueGetResponseError `json:"errors"` + Messages []AccountWorkerQueueGetResponseMessage `json:"messages"` + Result AccountWorkerQueueGetResponseResult `json:"result"` + ResultInfo AccountWorkerQueueGetResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueGetResponseSuccess `json:"success"` + JSON accountWorkerQueueGetResponseJSON `json:"-"` +} + +// accountWorkerQueueGetResponseJSON contains the JSON metadata for the struct +// [AccountWorkerQueueGetResponse] +type accountWorkerQueueGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueGetResponseErrorJSON `json:"-"` +} + +// accountWorkerQueueGetResponseErrorJSON contains the JSON metadata for the struct +// [AccountWorkerQueueGetResponseError] +type accountWorkerQueueGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueGetResponseMessageJSON `json:"-"` +} + +// accountWorkerQueueGetResponseMessageJSON contains the JSON metadata for the +// struct [AccountWorkerQueueGetResponseMessage] +type accountWorkerQueueGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueGetResponseResult struct { + Consumers interface{} `json:"consumers"` + ConsumersTotalCount interface{} `json:"consumers_total_count"` + CreatedOn interface{} `json:"created_on"` + ModifiedOn interface{} `json:"modified_on"` + Producers interface{} `json:"producers"` + ProducersTotalCount interface{} `json:"producers_total_count"` + QueueID interface{} `json:"queue_id"` + QueueName string `json:"queue_name"` + JSON accountWorkerQueueGetResponseResultJSON `json:"-"` +} + +// accountWorkerQueueGetResponseResultJSON contains the JSON metadata for the +// struct [AccountWorkerQueueGetResponseResult] +type accountWorkerQueueGetResponseResultJSON struct { + Consumers apijson.Field + ConsumersTotalCount apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Producers apijson.Field + ProducersTotalCount apijson.Field + QueueID apijson.Field + QueueName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueGetResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerQueueGetResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueGetResponseResultInfoJSON contains the JSON metadata for the +// struct [AccountWorkerQueueGetResponseResultInfo] +type accountWorkerQueueGetResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueGetResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueGetResponseSuccess bool + +const ( + AccountWorkerQueueGetResponseSuccessTrue AccountWorkerQueueGetResponseSuccess = true +) + +type AccountWorkerQueueUpdateResponse struct { + Errors []AccountWorkerQueueUpdateResponseError `json:"errors"` + Messages []AccountWorkerQueueUpdateResponseMessage `json:"messages"` + Result AccountWorkerQueueUpdateResponseResult `json:"result"` + ResultInfo AccountWorkerQueueUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueUpdateResponseSuccess `json:"success"` + JSON accountWorkerQueueUpdateResponseJSON `json:"-"` +} + +// accountWorkerQueueUpdateResponseJSON contains the JSON metadata for the struct +// [AccountWorkerQueueUpdateResponse] +type accountWorkerQueueUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueUpdateResponseErrorJSON `json:"-"` +} + +// accountWorkerQueueUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountWorkerQueueUpdateResponseError] +type accountWorkerQueueUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueUpdateResponseMessageJSON `json:"-"` +} + +// accountWorkerQueueUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountWorkerQueueUpdateResponseMessage] +type accountWorkerQueueUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueUpdateResponseResult struct { + CreatedOn interface{} `json:"created_on"` + ModifiedOn interface{} `json:"modified_on"` + QueueID interface{} `json:"queue_id"` + QueueName string `json:"queue_name"` + JSON accountWorkerQueueUpdateResponseResultJSON `json:"-"` +} + +// accountWorkerQueueUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountWorkerQueueUpdateResponseResult] +type accountWorkerQueueUpdateResponseResultJSON struct { + CreatedOn apijson.Field + ModifiedOn apijson.Field + QueueID apijson.Field + QueueName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerQueueUpdateResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueUpdateResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountWorkerQueueUpdateResponseResultInfo] +type accountWorkerQueueUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueUpdateResponseSuccess bool + +const ( + AccountWorkerQueueUpdateResponseSuccessTrue AccountWorkerQueueUpdateResponseSuccess = true +) + +type AccountWorkerQueueListResponse struct { + Errors []interface{} `json:"errors,nullable"` + Messages []interface{} `json:"messages,nullable"` + Result []AccountWorkerQueueListResponseResult `json:"result"` + ResultInfo AccountWorkerQueueListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueListResponseSuccess `json:"success"` + JSON accountWorkerQueueListResponseJSON `json:"-"` +} + +// accountWorkerQueueListResponseJSON contains the JSON metadata for the struct +// [AccountWorkerQueueListResponse] +type accountWorkerQueueListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueListResponseResult struct { + Consumers interface{} `json:"consumers"` + ConsumersTotalCount interface{} `json:"consumers_total_count"` + CreatedOn interface{} `json:"created_on"` + ModifiedOn interface{} `json:"modified_on"` + Producers interface{} `json:"producers"` + ProducersTotalCount interface{} `json:"producers_total_count"` + QueueID interface{} `json:"queue_id"` + QueueName string `json:"queue_name"` + JSON accountWorkerQueueListResponseResultJSON `json:"-"` +} + +// accountWorkerQueueListResponseResultJSON contains the JSON metadata for the +// struct [AccountWorkerQueueListResponseResult] +type accountWorkerQueueListResponseResultJSON struct { + Consumers apijson.Field + ConsumersTotalCount apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Producers apijson.Field + ProducersTotalCount apijson.Field + QueueID apijson.Field + QueueName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueListResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + TotalPages interface{} `json:"total_pages"` + JSON accountWorkerQueueListResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueListResponseResultInfoJSON contains the JSON metadata for the +// struct [AccountWorkerQueueListResponseResultInfo] +type accountWorkerQueueListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + TotalPages apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueListResponseSuccess bool + +const ( + AccountWorkerQueueListResponseSuccessTrue AccountWorkerQueueListResponseSuccess = true +) + +type AccountWorkerQueueDeleteResponse struct { + Errors []AccountWorkerQueueDeleteResponseError `json:"errors"` + Messages []AccountWorkerQueueDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountWorkerQueueDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueDeleteResponseSuccess `json:"success"` + JSON accountWorkerQueueDeleteResponseJSON `json:"-"` +} + +// accountWorkerQueueDeleteResponseJSON contains the JSON metadata for the struct +// [AccountWorkerQueueDeleteResponse] +type accountWorkerQueueDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueDeleteResponseErrorJSON `json:"-"` +} + +// accountWorkerQueueDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AccountWorkerQueueDeleteResponseError] +type accountWorkerQueueDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueDeleteResponseMessageJSON `json:"-"` +} + +// accountWorkerQueueDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AccountWorkerQueueDeleteResponseMessage] +type accountWorkerQueueDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerQueueDeleteResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueDeleteResponseResultInfoJSON contains the JSON metadata for +// the struct [AccountWorkerQueueDeleteResponseResultInfo] +type accountWorkerQueueDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueDeleteResponseSuccess bool + +const ( + AccountWorkerQueueDeleteResponseSuccessTrue AccountWorkerQueueDeleteResponseSuccess = true +) + +type AccountWorkerQueueQueueNewQueueResponse struct { + Errors []AccountWorkerQueueQueueNewQueueResponseError `json:"errors"` + Messages []AccountWorkerQueueQueueNewQueueResponseMessage `json:"messages"` + Result AccountWorkerQueueQueueNewQueueResponseResult `json:"result"` + ResultInfo AccountWorkerQueueQueueNewQueueResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueQueueNewQueueResponseSuccess `json:"success"` + JSON accountWorkerQueueQueueNewQueueResponseJSON `json:"-"` +} + +// accountWorkerQueueQueueNewQueueResponseJSON contains the JSON metadata for the +// struct [AccountWorkerQueueQueueNewQueueResponse] +type accountWorkerQueueQueueNewQueueResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueQueueNewQueueResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueQueueNewQueueResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueQueueNewQueueResponseErrorJSON `json:"-"` +} + +// accountWorkerQueueQueueNewQueueResponseErrorJSON contains the JSON metadata for +// the struct [AccountWorkerQueueQueueNewQueueResponseError] +type accountWorkerQueueQueueNewQueueResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueQueueNewQueueResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueQueueNewQueueResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueQueueNewQueueResponseMessageJSON `json:"-"` +} + +// accountWorkerQueueQueueNewQueueResponseMessageJSON contains the JSON metadata +// for the struct [AccountWorkerQueueQueueNewQueueResponseMessage] +type accountWorkerQueueQueueNewQueueResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueQueueNewQueueResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueQueueNewQueueResponseResult struct { + CreatedOn interface{} `json:"created_on"` + ModifiedOn interface{} `json:"modified_on"` + QueueID interface{} `json:"queue_id"` + QueueName string `json:"queue_name"` + JSON accountWorkerQueueQueueNewQueueResponseResultJSON `json:"-"` +} + +// accountWorkerQueueQueueNewQueueResponseResultJSON contains the JSON metadata for +// the struct [AccountWorkerQueueQueueNewQueueResponseResult] +type accountWorkerQueueQueueNewQueueResponseResultJSON struct { + CreatedOn apijson.Field + ModifiedOn apijson.Field + QueueID apijson.Field + QueueName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueQueueNewQueueResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueQueueNewQueueResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerQueueQueueNewQueueResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueQueueNewQueueResponseResultInfoJSON contains the JSON metadata +// for the struct [AccountWorkerQueueQueueNewQueueResponseResultInfo] +type accountWorkerQueueQueueNewQueueResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueQueueNewQueueResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueQueueNewQueueResponseSuccess bool + +const ( + AccountWorkerQueueQueueNewQueueResponseSuccessTrue AccountWorkerQueueQueueNewQueueResponseSuccess = true +) + +type AccountWorkerQueueUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerQueueUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountWorkerQueueQueueNewQueueParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerQueueQueueNewQueueParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountworkerqueue_test.go b/accountworkerqueue_test.go new file mode 100644 index 00000000000..acc7c014b28 --- /dev/null +++ b/accountworkerqueue_test.go @@ -0,0 +1,169 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerQueueGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-queue", + ) + 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 TestAccountWorkerQueueUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-queue", + cloudflare.AccountWorkerQueueUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{ + "queue_name": "renamed-example-queue", + }), + }, + ) + 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 TestAccountWorkerQueueList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.List(context.TODO(), "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()) + } +} + +func TestAccountWorkerQueueDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-queue", + ) + 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 TestAccountWorkerQueueQueueNewQueue(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.QueueNewQueue( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountWorkerQueueQueueNewQueueParams{ + Body: cloudflare.F[any](map[string]interface{}{ + "queue_name": "example-queue", + }), + }, + ) + 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/accountworkerqueueconsumer.go b/accountworkerqueueconsumer.go new file mode 100644 index 00000000000..c4161dc2b76 --- /dev/null +++ b/accountworkerqueueconsumer.go @@ -0,0 +1,580 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerQueueConsumerService 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 +// [NewAccountWorkerQueueConsumerService] method instead. +type AccountWorkerQueueConsumerService struct { + Options []option.RequestOption +} + +// NewAccountWorkerQueueConsumerService 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 NewAccountWorkerQueueConsumerService(opts ...option.RequestOption) (r *AccountWorkerQueueConsumerService) { + r = &AccountWorkerQueueConsumerService{} + r.Options = opts + return +} + +// Updates the consumer for a queue, or creates one if it does not exist. +func (r *AccountWorkerQueueConsumerService) Update(ctx context.Context, accountIdentifier string, name string, consumerName string, body AccountWorkerQueueConsumerUpdateParams, opts ...option.RequestOption) (res *AccountWorkerQueueConsumerUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues/%s/consumers/%s", accountIdentifier, name, consumerName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Returns the consumers for a queue. +func (r *AccountWorkerQueueConsumerService) List(ctx context.Context, accountIdentifier string, name string, opts ...option.RequestOption) (res *AccountWorkerQueueConsumerListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues/%s/consumers", accountIdentifier, name) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes the consumer for a queue. +func (r *AccountWorkerQueueConsumerService) Delete(ctx context.Context, accountIdentifier string, name string, consumerName string, opts ...option.RequestOption) (res *AccountWorkerQueueConsumerDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues/%s/consumers/%s", accountIdentifier, name, consumerName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new consumer for a queue. +func (r *AccountWorkerQueueConsumerService) QueueNewQueueConsumer(ctx context.Context, accountIdentifier string, name string, body AccountWorkerQueueConsumerQueueNewQueueConsumerParams, opts ...option.RequestOption) (res *AccountWorkerQueueConsumerQueueNewQueueConsumerResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/queues/%s/consumers", accountIdentifier, name) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AccountWorkerQueueConsumerUpdateResponse struct { + Errors []AccountWorkerQueueConsumerUpdateResponseError `json:"errors"` + Messages []AccountWorkerQueueConsumerUpdateResponseMessage `json:"messages"` + Result AccountWorkerQueueConsumerUpdateResponseResult `json:"result"` + ResultInfo AccountWorkerQueueConsumerUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueConsumerUpdateResponseSuccess `json:"success"` + JSON accountWorkerQueueConsumerUpdateResponseJSON `json:"-"` +} + +// accountWorkerQueueConsumerUpdateResponseJSON contains the JSON metadata for the +// struct [AccountWorkerQueueConsumerUpdateResponse] +type accountWorkerQueueConsumerUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueConsumerUpdateResponseErrorJSON `json:"-"` +} + +// accountWorkerQueueConsumerUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AccountWorkerQueueConsumerUpdateResponseError] +type accountWorkerQueueConsumerUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueConsumerUpdateResponseMessageJSON `json:"-"` +} + +// accountWorkerQueueConsumerUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AccountWorkerQueueConsumerUpdateResponseMessage] +type accountWorkerQueueConsumerUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerUpdateResponseResult struct { + CreatedOn interface{} `json:"created_on"` + DeadLetterQueue interface{} `json:"dead_letter_queue"` + Environment interface{} `json:"environment"` + QueueName interface{} `json:"queue_name"` + ScriptName interface{} `json:"script_name"` + Settings AccountWorkerQueueConsumerUpdateResponseResultSettings `json:"settings"` + JSON accountWorkerQueueConsumerUpdateResponseResultJSON `json:"-"` +} + +// accountWorkerQueueConsumerUpdateResponseResultJSON contains the JSON metadata +// for the struct [AccountWorkerQueueConsumerUpdateResponseResult] +type accountWorkerQueueConsumerUpdateResponseResultJSON struct { + CreatedOn apijson.Field + DeadLetterQueue apijson.Field + Environment apijson.Field + QueueName apijson.Field + ScriptName apijson.Field + Settings apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerUpdateResponseResultSettings struct { + BatchSize float64 `json:"batch_size"` + MaxRetries float64 `json:"max_retries"` + MaxWaitTimeMs float64 `json:"max_wait_time_ms"` + JSON accountWorkerQueueConsumerUpdateResponseResultSettingsJSON `json:"-"` +} + +// accountWorkerQueueConsumerUpdateResponseResultSettingsJSON contains the JSON +// metadata for the struct [AccountWorkerQueueConsumerUpdateResponseResultSettings] +type accountWorkerQueueConsumerUpdateResponseResultSettingsJSON struct { + BatchSize apijson.Field + MaxRetries apijson.Field + MaxWaitTimeMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerUpdateResponseResultSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerQueueConsumerUpdateResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueConsumerUpdateResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountWorkerQueueConsumerUpdateResponseResultInfo] +type accountWorkerQueueConsumerUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueConsumerUpdateResponseSuccess bool + +const ( + AccountWorkerQueueConsumerUpdateResponseSuccessTrue AccountWorkerQueueConsumerUpdateResponseSuccess = true +) + +type AccountWorkerQueueConsumerListResponse struct { + Errors []interface{} `json:"errors,nullable"` + Messages []interface{} `json:"messages,nullable"` + Result []AccountWorkerQueueConsumerListResponseResult `json:"result"` + ResultInfo AccountWorkerQueueConsumerListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueConsumerListResponseSuccess `json:"success"` + JSON accountWorkerQueueConsumerListResponseJSON `json:"-"` +} + +// accountWorkerQueueConsumerListResponseJSON contains the JSON metadata for the +// struct [AccountWorkerQueueConsumerListResponse] +type accountWorkerQueueConsumerListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerListResponseResult struct { + CreatedOn interface{} `json:"created_on"` + Environment interface{} `json:"environment"` + QueueName interface{} `json:"queue_name"` + Service interface{} `json:"service"` + Settings AccountWorkerQueueConsumerListResponseResultSettings `json:"settings"` + JSON accountWorkerQueueConsumerListResponseResultJSON `json:"-"` +} + +// accountWorkerQueueConsumerListResponseResultJSON contains the JSON metadata for +// the struct [AccountWorkerQueueConsumerListResponseResult] +type accountWorkerQueueConsumerListResponseResultJSON struct { + CreatedOn apijson.Field + Environment apijson.Field + QueueName apijson.Field + Service apijson.Field + Settings apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerListResponseResultSettings struct { + BatchSize float64 `json:"batch_size"` + MaxRetries float64 `json:"max_retries"` + MaxWaitTimeMs float64 `json:"max_wait_time_ms"` + JSON accountWorkerQueueConsumerListResponseResultSettingsJSON `json:"-"` +} + +// accountWorkerQueueConsumerListResponseResultSettingsJSON contains the JSON +// metadata for the struct [AccountWorkerQueueConsumerListResponseResultSettings] +type accountWorkerQueueConsumerListResponseResultSettingsJSON struct { + BatchSize apijson.Field + MaxRetries apijson.Field + MaxWaitTimeMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerListResponseResultSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerListResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + TotalPages interface{} `json:"total_pages"` + JSON accountWorkerQueueConsumerListResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueConsumerListResponseResultInfoJSON contains the JSON metadata +// for the struct [AccountWorkerQueueConsumerListResponseResultInfo] +type accountWorkerQueueConsumerListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + TotalPages apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueConsumerListResponseSuccess bool + +const ( + AccountWorkerQueueConsumerListResponseSuccessTrue AccountWorkerQueueConsumerListResponseSuccess = true +) + +type AccountWorkerQueueConsumerDeleteResponse struct { + Errors []AccountWorkerQueueConsumerDeleteResponseError `json:"errors"` + Messages []AccountWorkerQueueConsumerDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AccountWorkerQueueConsumerDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueConsumerDeleteResponseSuccess `json:"success"` + JSON accountWorkerQueueConsumerDeleteResponseJSON `json:"-"` +} + +// accountWorkerQueueConsumerDeleteResponseJSON contains the JSON metadata for the +// struct [AccountWorkerQueueConsumerDeleteResponse] +type accountWorkerQueueConsumerDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueConsumerDeleteResponseErrorJSON `json:"-"` +} + +// accountWorkerQueueConsumerDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountWorkerQueueConsumerDeleteResponseError] +type accountWorkerQueueConsumerDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueConsumerDeleteResponseMessageJSON `json:"-"` +} + +// accountWorkerQueueConsumerDeleteResponseMessageJSON contains the JSON metadata +// for the struct [AccountWorkerQueueConsumerDeleteResponseMessage] +type accountWorkerQueueConsumerDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerQueueConsumerDeleteResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueConsumerDeleteResponseResultInfoJSON contains the JSON +// metadata for the struct [AccountWorkerQueueConsumerDeleteResponseResultInfo] +type accountWorkerQueueConsumerDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueConsumerDeleteResponseSuccess bool + +const ( + AccountWorkerQueueConsumerDeleteResponseSuccessTrue AccountWorkerQueueConsumerDeleteResponseSuccess = true +) + +type AccountWorkerQueueConsumerQueueNewQueueConsumerResponse struct { + Errors []AccountWorkerQueueConsumerQueueNewQueueConsumerResponseError `json:"errors"` + Messages []AccountWorkerQueueConsumerQueueNewQueueConsumerResponseMessage `json:"messages"` + Result AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResult `json:"result"` + ResultInfo AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AccountWorkerQueueConsumerQueueNewQueueConsumerResponseSuccess `json:"success"` + JSON accountWorkerQueueConsumerQueueNewQueueConsumerResponseJSON `json:"-"` +} + +// accountWorkerQueueConsumerQueueNewQueueConsumerResponseJSON contains the JSON +// metadata for the struct +// [AccountWorkerQueueConsumerQueueNewQueueConsumerResponse] +type accountWorkerQueueConsumerQueueNewQueueConsumerResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerQueueNewQueueConsumerResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerQueueNewQueueConsumerResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueConsumerQueueNewQueueConsumerResponseErrorJSON `json:"-"` +} + +// accountWorkerQueueConsumerQueueNewQueueConsumerResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountWorkerQueueConsumerQueueNewQueueConsumerResponseError] +type accountWorkerQueueConsumerQueueNewQueueConsumerResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerQueueNewQueueConsumerResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerQueueNewQueueConsumerResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerQueueConsumerQueueNewQueueConsumerResponseMessageJSON `json:"-"` +} + +// accountWorkerQueueConsumerQueueNewQueueConsumerResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountWorkerQueueConsumerQueueNewQueueConsumerResponseMessage] +type accountWorkerQueueConsumerQueueNewQueueConsumerResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerQueueNewQueueConsumerResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResult struct { + CreatedOn interface{} `json:"created_on"` + DeadLetterQueue string `json:"dead_letter_queue"` + Environment interface{} `json:"environment"` + QueueName interface{} `json:"queue_name"` + ScriptName interface{} `json:"script_name"` + Settings AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultSettings `json:"settings"` + JSON accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultJSON `json:"-"` +} + +// accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultJSON contains the +// JSON metadata for the struct +// [AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResult] +type accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultJSON struct { + CreatedOn apijson.Field + DeadLetterQueue apijson.Field + Environment apijson.Field + QueueName apijson.Field + ScriptName apijson.Field + Settings apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultSettings struct { + BatchSize float64 `json:"batch_size"` + MaxRetries float64 `json:"max_retries"` + MaxWaitTimeMs float64 `json:"max_wait_time_ms"` + JSON accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultSettingsJSON `json:"-"` +} + +// accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultSettingsJSON +// contains the JSON metadata for the struct +// [AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultSettings] +type accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultSettingsJSON struct { + BatchSize apijson.Field + MaxRetries apijson.Field + MaxWaitTimeMs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultInfoJSON `json:"-"` +} + +// accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultInfoJSON contains +// the JSON metadata for the struct +// [AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultInfo] +type accountWorkerQueueConsumerQueueNewQueueConsumerResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerQueueConsumerQueueNewQueueConsumerResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerQueueConsumerQueueNewQueueConsumerResponseSuccess bool + +const ( + AccountWorkerQueueConsumerQueueNewQueueConsumerResponseSuccessTrue AccountWorkerQueueConsumerQueueNewQueueConsumerResponseSuccess = true +) + +type AccountWorkerQueueConsumerUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerQueueConsumerUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AccountWorkerQueueConsumerQueueNewQueueConsumerParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerQueueConsumerQueueNewQueueConsumerParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountworkerqueueconsumer_test.go b/accountworkerqueueconsumer_test.go new file mode 100644 index 00000000000..45ec1002286 --- /dev/null +++ b/accountworkerqueueconsumer_test.go @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerQueueConsumerUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.Consumers.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-queue", + "example-consumer", + cloudflare.AccountWorkerQueueConsumerUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{ + "dead_letter_queue": "updated-example-dlq", + "environment": "production", + "script_name": "example-consumer", + "settings": map[string]interface{}{ + "batch_size": int64(100), + }, + }), + }, + ) + 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 TestAccountWorkerQueueConsumerList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.Consumers.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-queue", + ) + 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 TestAccountWorkerQueueConsumerDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.Consumers.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-queue", + "example-consumer", + ) + 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 TestAccountWorkerQueueConsumerQueueNewQueueConsumer(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Queues.Consumers.QueueNewQueueConsumer( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example-queue", + cloudflare.AccountWorkerQueueConsumerQueueNewQueueConsumerParams{ + Body: cloudflare.F[any](map[string]interface{}{ + "dead_letter_queue": "example-dlq", + "environment": "production", + "script_name": "example-consumer", + "settings": map[string]interface{}{ + "batch_size": int64(10), + "max_retries": int64(3), + "max_wait_time_ms": int64(5000), + }, + }), + }, + ) + 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/accountworkerscript.go b/accountworkerscript.go new file mode 100644 index 00000000000..d40eb13e6cf --- /dev/null +++ b/accountworkerscript.go @@ -0,0 +1,639 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "bytes" + "context" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiform" + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerScriptService 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 [NewAccountWorkerScriptService] +// method instead. +type AccountWorkerScriptService struct { + Options []option.RequestOption + Schedules *AccountWorkerScriptScheduleService + Tails *AccountWorkerScriptTailService + UsageModels *AccountWorkerScriptUsageModelService + Content *AccountWorkerScriptContentService + ContentV2 *AccountWorkerScriptContentV2Service + Settings *AccountWorkerScriptSettingService +} + +// NewAccountWorkerScriptService 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 NewAccountWorkerScriptService(opts ...option.RequestOption) (r *AccountWorkerScriptService) { + r = &AccountWorkerScriptService{} + r.Options = opts + r.Schedules = NewAccountWorkerScriptScheduleService(opts...) + r.Tails = NewAccountWorkerScriptTailService(opts...) + r.UsageModels = NewAccountWorkerScriptUsageModelService(opts...) + r.Content = NewAccountWorkerScriptContentService(opts...) + r.ContentV2 = NewAccountWorkerScriptContentV2Service(opts...) + r.Settings = NewAccountWorkerScriptSettingService(opts...) + return +} + +// Fetch raw script content for your worker. Note this is the original script +// content, not JSON encoded. +func (r *AccountWorkerScriptService) Get(ctx context.Context, accountIdentifier string, scriptName string, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "undefined")}, opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Upload a worker module. +func (r *AccountWorkerScriptService) Update(ctx context.Context, accountIdentifier string, scriptName string, params AccountWorkerScriptUpdateParams, opts ...option.RequestOption) (res *AccountWorkerScriptUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) + return +} + +// Delete your worker. This call has no response body on a successful delete. +func (r *AccountWorkerScriptService) Delete(ctx context.Context, accountIdentifier string, scriptName string, body AccountWorkerScriptDeleteParams, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, nil, opts...) + return +} + +// Fetch a list of uploaded workers. +func (r *AccountWorkerScriptService) WorkerScriptListWorkers(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountWorkerScriptWorkerScriptListWorkersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountWorkerScriptUpdateResponse struct { + Errors []AccountWorkerScriptUpdateResponseError `json:"errors"` + Messages []AccountWorkerScriptUpdateResponseMessage `json:"messages"` + Result AccountWorkerScriptUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptUpdateResponseSuccess `json:"success"` + JSON accountWorkerScriptUpdateResponseJSON `json:"-"` +} + +// accountWorkerScriptUpdateResponseJSON contains the JSON metadata for the struct +// [AccountWorkerScriptUpdateResponse] +type accountWorkerScriptUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptUpdateResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AccountWorkerScriptUpdateResponseError] +type accountWorkerScriptUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptUpdateResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AccountWorkerScriptUpdateResponseMessage] +type accountWorkerScriptUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUpdateResponseResult struct { + // The id of the script in the Workers system. Usually the script name. + ID string `json:"id"` + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Hashed script content, can be used in a If-None-Match header when updating. + Etag string `json:"etag"` + // Whether Logpush is turned on for the Worker. + Logpush bool `json:"logpush"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Deprecated. Deployment metadata for internal usage. + PipelineHash string `json:"pipeline_hash"` + // Specifies the placement mode for the Worker (e.g. 'smart'). + PlacementMode string `json:"placement_mode"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerScriptUpdateResponseResultTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerScriptUpdateResponseResultJSON `json:"-"` +} + +// accountWorkerScriptUpdateResponseResultJSON contains the JSON metadata for the +// struct [AccountWorkerScriptUpdateResponseResult] +type accountWorkerScriptUpdateResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Etag apijson.Field + Logpush apijson.Field + ModifiedOn apijson.Field + PipelineHash apijson.Field + PlacementMode apijson.Field + TailConsumers apijson.Field + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerScriptUpdateResponseResultTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerScriptUpdateResponseResultTailConsumerJSON `json:"-"` +} + +// accountWorkerScriptUpdateResponseResultTailConsumerJSON contains the JSON +// metadata for the struct [AccountWorkerScriptUpdateResponseResultTailConsumer] +type accountWorkerScriptUpdateResponseResultTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUpdateResponseResultTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptUpdateResponseSuccess bool + +const ( + AccountWorkerScriptUpdateResponseSuccessTrue AccountWorkerScriptUpdateResponseSuccess = true +) + +type AccountWorkerScriptWorkerScriptListWorkersResponse struct { + Errors []AccountWorkerScriptWorkerScriptListWorkersResponseError `json:"errors"` + Messages []AccountWorkerScriptWorkerScriptListWorkersResponseMessage `json:"messages"` + Result []AccountWorkerScriptWorkerScriptListWorkersResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptWorkerScriptListWorkersResponseSuccess `json:"success"` + JSON accountWorkerScriptWorkerScriptListWorkersResponseJSON `json:"-"` +} + +// accountWorkerScriptWorkerScriptListWorkersResponseJSON contains the JSON +// metadata for the struct [AccountWorkerScriptWorkerScriptListWorkersResponse] +type accountWorkerScriptWorkerScriptListWorkersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptWorkerScriptListWorkersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptWorkerScriptListWorkersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptWorkerScriptListWorkersResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptWorkerScriptListWorkersResponseErrorJSON contains the JSON +// metadata for the struct +// [AccountWorkerScriptWorkerScriptListWorkersResponseError] +type accountWorkerScriptWorkerScriptListWorkersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptWorkerScriptListWorkersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptWorkerScriptListWorkersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptWorkerScriptListWorkersResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptWorkerScriptListWorkersResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountWorkerScriptWorkerScriptListWorkersResponseMessage] +type accountWorkerScriptWorkerScriptListWorkersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptWorkerScriptListWorkersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptWorkerScriptListWorkersResponseResult struct { + // The id of the script in the Workers system. Usually the script name. + ID string `json:"id"` + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Hashed script content, can be used in a If-None-Match header when updating. + Etag string `json:"etag"` + // Whether Logpush is turned on for the Worker. + Logpush bool `json:"logpush"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Deprecated. Deployment metadata for internal usage. + PipelineHash string `json:"pipeline_hash"` + // Specifies the placement mode for the Worker (e.g. 'smart'). + PlacementMode string `json:"placement_mode"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerScriptWorkerScriptListWorkersResponseResultTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerScriptWorkerScriptListWorkersResponseResultJSON `json:"-"` +} + +// accountWorkerScriptWorkerScriptListWorkersResponseResultJSON contains the JSON +// metadata for the struct +// [AccountWorkerScriptWorkerScriptListWorkersResponseResult] +type accountWorkerScriptWorkerScriptListWorkersResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Etag apijson.Field + Logpush apijson.Field + ModifiedOn apijson.Field + PipelineHash apijson.Field + PlacementMode apijson.Field + TailConsumers apijson.Field + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptWorkerScriptListWorkersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerScriptWorkerScriptListWorkersResponseResultTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerScriptWorkerScriptListWorkersResponseResultTailConsumerJSON `json:"-"` +} + +// accountWorkerScriptWorkerScriptListWorkersResponseResultTailConsumerJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptWorkerScriptListWorkersResponseResultTailConsumer] +type accountWorkerScriptWorkerScriptListWorkersResponseResultTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptWorkerScriptListWorkersResponseResultTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptWorkerScriptListWorkersResponseSuccess bool + +const ( + AccountWorkerScriptWorkerScriptListWorkersResponseSuccessTrue AccountWorkerScriptWorkerScriptListWorkersResponseSuccess = true +) + +// This interface is a union satisfied by one of the following: +// [AccountWorkerScriptUpdateParamsVariant0], +// [AccountWorkerScriptUpdateParamsVariant1]. +type AccountWorkerScriptUpdateParams interface { + ImplementsAccountWorkerScriptUpdateParams() +} + +type AccountWorkerScriptUpdateParamsVariant0 struct { + // Rollback to provided deployment based on deployment ID. Request body will only + // parse a "message" part. You can learn more about deployments + // [here](https://developers.cloudflare.com/workers/platform/deployments/). + RollbackTo param.Field[string] `query:"rollback_to"` + // A module comprising a Worker script, often a javascript file. Multiple modules + // may be provided as separate named parts, but at least one module must be present + // and referenced in the metadata as `main_module` or `body_part` by part name. + AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` + // JSON encoded metadata about the uploaded parts and Worker configuration. + Metadata param.Field[AccountWorkerScriptUpdateParamsVariant0Metadata] `json:"metadata"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} + +// URLQuery serializes [AccountWorkerScriptUpdateParamsVariant0]'s query parameters +// as `url.Values`. +func (r AccountWorkerScriptUpdateParamsVariant0) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +func (AccountWorkerScriptUpdateParamsVariant0) ImplementsAccountWorkerScriptUpdateParams() { + +} + +// JSON encoded metadata about the uploaded parts and Worker configuration. +type AccountWorkerScriptUpdateParamsVariant0Metadata struct { + // List of bindings available to the worker. + Bindings param.Field[[]interface{}] `json:"bindings"` + // Name of the part in the multipart request that contains the script (e.g. the + // file adding a listener to the `fetch` event). Indicates a + // `service worker syntax` Worker. + BodyPart param.Field[string] `json:"body_part"` + // Date indicating targeted support in the Workers runtime. Backwards incompatible + // fixes to the runtime following this date will not affect this Worker. + CompatibilityDate param.Field[string] `json:"compatibility_date"` + // Flags that enable or disable certain features in the Workers runtime. Used to + // enable upcoming features or opt in or out of specific changes not included in a + // `compatibility_date`. + CompatibilityFlags param.Field[[]string] `json:"compatibility_flags"` + // List of binding types to keep from previous_upload. + KeepBindings param.Field[[]string] `json:"keep_bindings"` + // Whether Logpush is turned on for the Worker. + Logpush param.Field[bool] `json:"logpush"` + // Name of the part in the multipart request that contains the main module (e.g. + // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. + MainModule param.Field[string] `json:"main_module"` + // Migrations to apply for Durable Objects associated with this Worker. + Migrations param.Field[AccountWorkerScriptUpdateParamsVariant0MetadataMigrations] `json:"migrations"` + Placement param.Field[AccountWorkerScriptUpdateParamsVariant0MetadataPlacement] `json:"placement"` + // List of strings to use as tags for this Worker + Tags param.Field[[]string] `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers param.Field[[]AccountWorkerScriptUpdateParamsVariant0MetadataTailConsumer] `json:"tail_consumers"` + // Usage model to apply to invocations. + UsageModel param.Field[AccountWorkerScriptUpdateParamsVariant0MetadataUsageModel] `json:"usage_model"` + // Key-value pairs to use as tags for this version of this Worker + VersionTags param.Field[interface{}] `json:"version_tags"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0Metadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Satisfied by +// [AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations], +// [AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrations interface { + implementsAccountWorkerScriptUpdateParamsVariant0MetadataMigrations() +} + +// A single set of migrations to apply. +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // 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"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] `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 param.Field[[]AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerScriptUpdateParamsVariant0MetadataMigrations() { +} + +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations 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"` + // Migrations to apply in order. + Steps param.Field[[]AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStep] `json:"steps"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerScriptUpdateParamsVariant0MetadataMigrations() { +} + +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStep struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] `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 param.Field[[]AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptUpdateParamsVariant0MetadataPlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode param.Field[AccountWorkerScriptUpdateParamsVariant0MetadataPlacementMode] `json:"mode"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataPlacement) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerScriptUpdateParamsVariant0MetadataPlacementMode string + +const ( + AccountWorkerScriptUpdateParamsVariant0MetadataPlacementModeSmart AccountWorkerScriptUpdateParamsVariant0MetadataPlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerScriptUpdateParamsVariant0MetadataTailConsumer struct { + // Name of Worker that is to be the consumer. + Service param.Field[string] `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment param.Field[string] `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace param.Field[string] `json:"namespace"` +} + +func (r AccountWorkerScriptUpdateParamsVariant0MetadataTailConsumer) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Usage model to apply to invocations. +type AccountWorkerScriptUpdateParamsVariant0MetadataUsageModel string + +const ( + AccountWorkerScriptUpdateParamsVariant0MetadataUsageModelBundled AccountWorkerScriptUpdateParamsVariant0MetadataUsageModel = "bundled" + AccountWorkerScriptUpdateParamsVariant0MetadataUsageModelUnbound AccountWorkerScriptUpdateParamsVariant0MetadataUsageModel = "unbound" +) + +type AccountWorkerScriptUpdateParamsVariant1 struct { + // Rollback to provided deployment based on deployment ID. Request body will only + // parse a "message" part. You can learn more about deployments + // [here](https://developers.cloudflare.com/workers/platform/deployments/). + RollbackTo param.Field[string] `query:"rollback_to"` + // Rollback message to be associated with this deployment. Only parsed when query + // param `"rollback_to"` is present. + Message param.Field[string] `json:"message"` +} + +func (r AccountWorkerScriptUpdateParamsVariant1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// URLQuery serializes [AccountWorkerScriptUpdateParamsVariant1]'s query parameters +// as `url.Values`. +func (r AccountWorkerScriptUpdateParamsVariant1) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +func (AccountWorkerScriptUpdateParamsVariant1) ImplementsAccountWorkerScriptUpdateParams() { + +} + +type AccountWorkerScriptDeleteParams struct { + // If set to true, delete will not be stopped by associated service binding, + // durable object, or other binding. Any of these associated bindings/durable + // objects will be deleted along with the script. + Force param.Field[bool] `query:"force"` +} + +// URLQuery serializes [AccountWorkerScriptDeleteParams]'s query parameters as +// `url.Values`. +func (r AccountWorkerScriptDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/accountworkerscript_test.go b/accountworkerscript_test.go new file mode 100644 index 00000000000..14a28afe43c --- /dev/null +++ b/accountworkerscript_test.go @@ -0,0 +1,210 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerScriptGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Accounts.Workers.Scripts.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + ) + 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) + } +} + +func TestAccountWorkerScriptUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + cloudflare.AccountWorkerScriptUpdateParamsVariant0{ + RollbackTo: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + AnyPartName: cloudflare.F([]io.Reader{io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents")))}), + Metadata: cloudflare.F(cloudflare.AccountWorkerScriptUpdateParamsVariant0Metadata{ + Bindings: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), + BodyPart: cloudflare.F("worker.js"), + CompatibilityDate: cloudflare.F("2023-07-25"), + CompatibilityFlags: cloudflare.F([]string{"string", "string", "string"}), + KeepBindings: cloudflare.F([]string{"string", "string", "string"}), + Logpush: cloudflare.F(false), + MainModule: cloudflare.F("worker.js"), + Migrations: cloudflare.F[cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataMigrations](cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations(cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrations{ + 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([]cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsRenamedClass{{ + 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([]cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataMigrationsAvYbsl2uSingleStepMigrationsTransferredClass{{ + 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(cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataPlacement{ + Mode: cloudflare.F(cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataPlacementModeSmart), + }), + Tags: cloudflare.F([]string{"string", "string", "string"}), + TailConsumers: cloudflare.F([]cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataTailConsumer{{ + 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(cloudflare.AccountWorkerScriptUpdateParamsVariant0MetadataUsageModelBundled), + VersionTags: cloudflare.F[any](map[string]interface{}{}), + }), + }, + ) + 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 TestAccountWorkerScriptDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Accounts.Workers.Scripts.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + cloudflare.AccountWorkerScriptDeleteParams{ + Force: cloudflare.F(true), + }, + ) + 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 TestAccountWorkerScriptWorkerScriptListWorkers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.WorkerScriptListWorkers(context.TODO(), "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/accountworkerscriptcontent.go b/accountworkerscriptcontent.go new file mode 100644 index 00000000000..14a2802a87c --- /dev/null +++ b/accountworkerscriptcontent.go @@ -0,0 +1,155 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "bytes" + "context" + "fmt" + "io" + "mime/multipart" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiform" + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerScriptContentService 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 +// [NewAccountWorkerScriptContentService] method instead. +type AccountWorkerScriptContentService struct { + Options []option.RequestOption +} + +// NewAccountWorkerScriptContentService 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 NewAccountWorkerScriptContentService(opts ...option.RequestOption) (r *AccountWorkerScriptContentService) { + r = &AccountWorkerScriptContentService{} + r.Options = opts + return +} + +// Put script content without touching config or metadata +func (r *AccountWorkerScriptContentService) Update(ctx context.Context, accountIdentifier string, scriptName string, params AccountWorkerScriptContentUpdateParams, opts ...option.RequestOption) (res *AccountWorkerScriptContentUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/content", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) + return +} + +type AccountWorkerScriptContentUpdateResponse struct { + // The id of the script in the Workers system. Usually the script name. + ID string `json:"id"` + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Hashed script content, can be used in a If-None-Match header when updating. + Etag string `json:"etag"` + // Whether Logpush is turned on for the Worker. + Logpush bool `json:"logpush"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Deprecated. Deployment metadata for internal usage. + PipelineHash string `json:"pipeline_hash"` + // Specifies the placement mode for the Worker (e.g. 'smart'). + PlacementMode string `json:"placement_mode"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerScriptContentUpdateResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerScriptContentUpdateResponseJSON `json:"-"` +} + +// accountWorkerScriptContentUpdateResponseJSON contains the JSON metadata for the +// struct [AccountWorkerScriptContentUpdateResponse] +type accountWorkerScriptContentUpdateResponseJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Etag apijson.Field + Logpush apijson.Field + ModifiedOn apijson.Field + PipelineHash apijson.Field + PlacementMode apijson.Field + TailConsumers apijson.Field + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptContentUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerScriptContentUpdateResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerScriptContentUpdateResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerScriptContentUpdateResponseTailConsumerJSON contains the JSON +// metadata for the struct [AccountWorkerScriptContentUpdateResponseTailConsumer] +type accountWorkerScriptContentUpdateResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptContentUpdateResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptContentUpdateParams struct { + // A module comprising a Worker script, often a javascript file. Multiple modules + // may be provided as separate named parts, but at least one module must be + // present. This should be referenced either in the metadata as `main_module` + // (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` + // (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. + AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` + // JSON encoded metadata about the uploaded parts and Worker configuration. + Metadata param.Field[AccountWorkerScriptContentUpdateParamsMetadata] `json:"metadata"` + CfWorkerBodyPart param.Field[string] `header:"CF-WORKER-BODY-PART"` + CfWorkerMainModulePart param.Field[string] `header:"CF-WORKER-MAIN-MODULE-PART"` +} + +func (r AccountWorkerScriptContentUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} + +// JSON encoded metadata about the uploaded parts and Worker configuration. +type AccountWorkerScriptContentUpdateParamsMetadata struct { + // Name of the part in the multipart request that contains the script (e.g. the + // file adding a listener to the `fetch` event). Indicates a + // `service worker syntax` Worker. + BodyPart param.Field[string] `json:"body_part"` + // Name of the part in the multipart request that contains the main module (e.g. + // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. + MainModule param.Field[string] `json:"main_module"` +} + +func (r AccountWorkerScriptContentUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountworkerscriptcontent_test.go b/accountworkerscriptcontent_test.go new file mode 100644 index 00000000000..6db83940191 --- /dev/null +++ b/accountworkerscriptcontent_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerScriptContentUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.Content.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + cloudflare.AccountWorkerScriptContentUpdateParams{ + AnyPartName: cloudflare.F([]io.Reader{io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents")))}), + Metadata: cloudflare.F(cloudflare.AccountWorkerScriptContentUpdateParamsMetadata{ + BodyPart: cloudflare.F("worker.js"), + MainModule: cloudflare.F("worker.js"), + }), + CfWorkerBodyPart: cloudflare.F("string"), + CfWorkerMainModulePart: cloudflare.F("string"), + }, + ) + 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/accountworkerscriptcontentv2.go b/accountworkerscriptcontentv2.go new file mode 100644 index 00000000000..37693359e81 --- /dev/null +++ b/accountworkerscriptcontentv2.go @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerScriptContentV2Service 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 +// [NewAccountWorkerScriptContentV2Service] method instead. +type AccountWorkerScriptContentV2Service struct { + Options []option.RequestOption +} + +// NewAccountWorkerScriptContentV2Service 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 NewAccountWorkerScriptContentV2Service(opts ...option.RequestOption) (r *AccountWorkerScriptContentV2Service) { + r = &AccountWorkerScriptContentV2Service{} + r.Options = opts + return +} + +// Fetch script content only +func (r *AccountWorkerScriptContentV2Service) List(ctx context.Context, accountIdentifier string, scriptName string, 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", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} diff --git a/accountworkerscriptcontentv2_test.go b/accountworkerscriptcontentv2_test.go new file mode 100644 index 00000000000..07e5c340a3c --- /dev/null +++ b/accountworkerscriptcontentv2_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerScriptContentV2List(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Accounts.Workers.Scripts.ContentV2.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + ) + 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/accountworkerscriptschedule.go b/accountworkerscriptschedule.go new file mode 100644 index 00000000000..b37927c9b63 --- /dev/null +++ b/accountworkerscriptschedule.go @@ -0,0 +1,280 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerScriptScheduleService 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 +// [NewAccountWorkerScriptScheduleService] method instead. +type AccountWorkerScriptScheduleService struct { + Options []option.RequestOption +} + +// NewAccountWorkerScriptScheduleService 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 NewAccountWorkerScriptScheduleService(opts ...option.RequestOption) (r *AccountWorkerScriptScheduleService) { + r = &AccountWorkerScriptScheduleService{} + r.Options = opts + return +} + +// Fetches Cron Triggers for a Worker. +func (r *AccountWorkerScriptScheduleService) WorkerCronTriggerGetCronTriggers(ctx context.Context, accountIdentifier string, scriptName string, opts ...option.RequestOption) (res *AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/schedules", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates Cron Triggers for a Worker. +func (r *AccountWorkerScriptScheduleService) WorkerCronTriggerUpdateCronTriggers(ctx context.Context, accountIdentifier string, scriptName string, body AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersParams, opts ...option.RequestOption) (res *AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/schedules", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponse struct { + Errors []AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseError `json:"errors"` + Messages []AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseMessage `json:"messages"` + Result AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseSuccess `json:"success"` + JSON accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponse] +type accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseError] +type accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseMessage] +type accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResult struct { + Schedules []AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultSchedule `json:"schedules"` + JSON accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResult] +type accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultJSON struct { + Schedules apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultSchedule struct { + CreatedOn interface{} `json:"created_on"` + Cron interface{} `json:"cron"` + ModifiedOn interface{} `json:"modified_on"` + JSON accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultScheduleJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultScheduleJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultSchedule] +type accountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultScheduleJSON struct { + CreatedOn apijson.Field + Cron apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseResultSchedule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseSuccess bool + +const ( + AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseSuccessTrue AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponseSuccess = true +) + +type AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponse struct { + Errors []AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseError `json:"errors"` + Messages []AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseMessage `json:"messages"` + Result AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseSuccess `json:"success"` + JSON accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponse] +type accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseError] +type accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseMessage] +type accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResult struct { + Schedules []AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultSchedule `json:"schedules"` + JSON accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResult] +type accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultJSON struct { + Schedules apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultSchedule struct { + CreatedOn interface{} `json:"created_on"` + Cron interface{} `json:"cron"` + ModifiedOn interface{} `json:"modified_on"` + JSON accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultScheduleJSON `json:"-"` +} + +// accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultScheduleJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultSchedule] +type accountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultScheduleJSON struct { + CreatedOn apijson.Field + Cron apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseResultSchedule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseSuccess bool + +const ( + AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseSuccessTrue AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponseSuccess = true +) + +type AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountworkerscriptschedule_test.go b/accountworkerscriptschedule_test.go new file mode 100644 index 00000000000..08955d25cec --- /dev/null +++ b/accountworkerscriptschedule_test.go @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.Schedules.WorkerCronTriggerGetCronTriggers( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + ) + 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 TestAccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.Schedules.WorkerCronTriggerUpdateCronTriggers( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + cloudflare.AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersParams{ + Body: cloudflare.F[any]("[{'cron': '*/30 * * * *'}]"), + }, + ) + 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/accountworkerscriptsetting.go b/accountworkerscriptsetting.go new file mode 100644 index 00000000000..3ea49abad67 --- /dev/null +++ b/accountworkerscriptsetting.go @@ -0,0 +1,1745 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerScriptSettingService 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 +// [NewAccountWorkerScriptSettingService] method instead. +type AccountWorkerScriptSettingService struct { + Options []option.RequestOption +} + +// NewAccountWorkerScriptSettingService 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 NewAccountWorkerScriptSettingService(opts ...option.RequestOption) (r *AccountWorkerScriptSettingService) { + r = &AccountWorkerScriptSettingService{} + r.Options = opts + return +} + +// Get script metadata and config, such as bindings or usage model +func (r *AccountWorkerScriptSettingService) Get(ctx context.Context, accountIdentifier string, scriptName string, opts ...option.RequestOption) (res *AccountWorkerScriptSettingGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/settings", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Patch script metadata or config, such as bindings or usage model +func (r *AccountWorkerScriptSettingService) Update(ctx context.Context, accountIdentifier string, scriptName string, body AccountWorkerScriptSettingUpdateParams, opts ...option.RequestOption) (res *AccountWorkerScriptSettingUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/settings", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type AccountWorkerScriptSettingGetResponse struct { + // List of bindings attached to this Worker + Bindings []AccountWorkerScriptSettingGetResponseBinding `json:"bindings"` + // Opt your Worker into changes after this date + CompatibilityDate string `json:"compatibility_date"` + // Opt your Worker into specific changes + CompatibilityFlags []string `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 AccountWorkerScriptSettingGetResponseMigrations `json:"migrations"` + Placement AccountWorkerScriptSettingGetResponsePlacement `json:"placement"` + // Tags to help you manage your Workers + Tags []string `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerScriptSettingGetResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerScriptSettingGetResponseJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseJSON contains the JSON metadata for the +// struct [AccountWorkerScriptSettingGetResponse] +type accountWorkerScriptSettingGetResponseJSON 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 *AccountWorkerScriptSettingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A binding to allow the Worker to communicate with resources +// +// Union satisfied by +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBinding], +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBinding], +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2Binding], +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBinding], +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1Binding], +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding] +// or [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerScriptSettingGetResponseBinding interface { + implementsAccountWorkerScriptSettingGetResponseBinding() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerScriptSettingGetResponseBinding)(nil)).Elem(), "") +} + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType `json:"type,required"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON struct { + Name apijson.Field + NamespaceID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBinding struct { + // Optional environment if the Worker utilizes one. + Environment string `json:"environment,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Name of Worker to bind to + Service string `json:"service,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBindingType `json:"type,required"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBindingJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBinding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBindingJSON struct { + Environment apijson.Field + Name apijson.Field + Service apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBinding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBindingTypeService AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBinding struct { + // The exported class name of the Durable Object + ClassName string `json:"class_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBindingType `json:"type,required"` + // The environment of the script_name to bind to + Environment string `json:"environment"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id"` + // The script where the Durable Object is defined, if it is external to this Worker + ScriptName string `json:"script_name"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBindingJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBinding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBindingJSON struct { + ClassName apijson.Field + Name apijson.Field + Type apijson.Field + Environment apijson.Field + NamespaceID apijson.Field + ScriptName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBinding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2Binding struct { + // R2 bucket to bind to + BucketName string `json:"bucket_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2BindingType `json:"type,required"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2BindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2BindingJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2Binding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2BindingJSON struct { + BucketName apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2Binding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBinding 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 AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBindingType `json:"type,required"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBindingJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBinding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBindingJSON struct { + Name apijson.Field + QueueName apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBinding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1Binding struct { + // ID of the D1 database to bind to + ID string `json:"id,required"` + // A JavaScript variable name for the binding. + Binding string `json:"binding,required"` + // The name of the D1 database associated with the 'id' provided. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1BindingType `json:"type,required"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1BindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1BindingJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1Binding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1BindingJSON struct { + ID apijson.Field + Binding apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1Binding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace to bind to + Namespace string `json:"namespace,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType `json:"type,required"` + // Outbound worker + Outbound AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound `json:"outbound"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON struct { + Name apijson.Field + Namespace apijson.Field + Type apijson.Field + Outbound apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound struct { + // Pass information from the Dispatch Worker to the Outbound Worker through the + // parameters + Params []string `json:"params"` + // Outbound worker + Worker AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker `json:"worker"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON struct { + Params apijson.Field + Worker apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Outbound worker +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker struct { + // Environment of the outbound worker + Environment string `json:"environment"` + // Name of the outbound worker + Service string `json:"service"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType `json:"type,required"` + // ID of the certificate to bind to + CertificateID string `json:"certificate_id"` + JSON accountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding] +type accountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON struct { + Name apijson.Field + Type apijson.Field + CertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerScriptSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerScriptSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Union satisfied by +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations] or +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerScriptSettingGetResponseMigrations interface { + implementsAccountWorkerScriptSettingGetResponseMigrations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerScriptSettingGetResponseMigrations)(nil)).Elem(), "") +} + +// A single set of migrations to apply. +type AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations 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 []AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass `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 []AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass `json:"transferred_classes"` + JSON accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations] +type accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON 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 *AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerScriptSettingGetResponseMigrations() { +} + +type AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] +type accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] +type accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations 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 []AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep `json:"steps"` + JSON accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations] +type accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON struct { + NewTag apijson.Field + OldTag apijson.Field + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerScriptSettingGetResponseMigrations() { +} + +type AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep 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 []AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass `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 []AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass `json:"transferred_classes"` + JSON accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep] +type accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON struct { + DeletedClasses apijson.Field + NewClasses apijson.Field + RenamedClasses apijson.Field + TransferredClasses apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] +type accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] +type accountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingGetResponsePlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode AccountWorkerScriptSettingGetResponsePlacementMode `json:"mode"` + JSON accountWorkerScriptSettingGetResponsePlacementJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponsePlacementJSON contains the JSON metadata +// for the struct [AccountWorkerScriptSettingGetResponsePlacement] +type accountWorkerScriptSettingGetResponsePlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponsePlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerScriptSettingGetResponsePlacementMode string + +const ( + AccountWorkerScriptSettingGetResponsePlacementModeSmart AccountWorkerScriptSettingGetResponsePlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerScriptSettingGetResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerScriptSettingGetResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerScriptSettingGetResponseTailConsumerJSON contains the JSON metadata +// for the struct [AccountWorkerScriptSettingGetResponseTailConsumer] +type accountWorkerScriptSettingGetResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingGetResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateResponse struct { + // List of bindings attached to this Worker + Bindings []AccountWorkerScriptSettingUpdateResponseBinding `json:"bindings"` + // Opt your Worker into changes after this date + CompatibilityDate string `json:"compatibility_date"` + // Opt your Worker into specific changes + CompatibilityFlags []string `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 AccountWorkerScriptSettingUpdateResponseMigrations `json:"migrations"` + Placement AccountWorkerScriptSettingUpdateResponsePlacement `json:"placement"` + // Tags to help you manage your Workers + Tags []string `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerScriptSettingUpdateResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerScriptSettingUpdateResponseJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseJSON contains the JSON metadata for the +// struct [AccountWorkerScriptSettingUpdateResponse] +type accountWorkerScriptSettingUpdateResponseJSON 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 *AccountWorkerScriptSettingUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A binding to allow the Worker to communicate with resources +// +// Union satisfied by +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding], +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding], +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding], +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding], +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding], +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding] +// or [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerScriptSettingUpdateResponseBinding interface { + implementsAccountWorkerScriptSettingUpdateResponseBinding() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerScriptSettingUpdateResponseBinding)(nil)).Elem(), "") +} + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType `json:"type,required"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON struct { + Name apijson.Field + NamespaceID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding struct { + // Optional environment if the Worker utilizes one. + Environment string `json:"environment,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Name of Worker to bind to + Service string `json:"service,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingType `json:"type,required"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON struct { + Environment apijson.Field + Name apijson.Field + Service apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBinding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingTypeService AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding struct { + // The exported class name of the Durable Object + ClassName string `json:"class_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingType `json:"type,required"` + // The environment of the script_name to bind to + Environment string `json:"environment"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id"` + // The script where the Durable Object is defined, if it is external to this Worker + ScriptName string `json:"script_name"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON struct { + ClassName apijson.Field + Name apijson.Field + Type apijson.Field + Environment apijson.Field + NamespaceID apijson.Field + ScriptName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBinding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding struct { + // R2 bucket to bind to + BucketName string `json:"bucket_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingType `json:"type,required"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON struct { + BucketName apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2Binding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding 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 AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingType `json:"type,required"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON struct { + Name apijson.Field + QueueName apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBinding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding struct { + // ID of the D1 database to bind to + ID string `json:"id,required"` + // A JavaScript variable name for the binding. + Binding string `json:"binding,required"` + // The name of the D1 database associated with the 'id' provided. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingType `json:"type,required"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON struct { + ID apijson.Field + Binding apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1Binding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace to bind to + Namespace string `json:"namespace,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType `json:"type,required"` + // Outbound worker + Outbound AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound `json:"outbound"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON struct { + Name apijson.Field + Namespace apijson.Field + Type apijson.Field + Outbound apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound struct { + // Pass information from the Dispatch Worker to the Outbound Worker through the + // parameters + Params []string `json:"params"` + // Outbound worker + Worker AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker `json:"worker"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON struct { + Params apijson.Field + Worker apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Outbound worker +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker struct { + // Environment of the outbound worker + Environment string `json:"environment"` + // Name of the outbound worker + Service string `json:"service"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType `json:"type,required"` + // ID of the certificate to bind to + CertificateID string `json:"certificate_id"` + JSON accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding] +type accountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON struct { + Name apijson.Field + Type apijson.Field + CertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerScriptSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerScriptSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Union satisfied by +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations] +// or +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerScriptSettingUpdateResponseMigrations interface { + implementsAccountWorkerScriptSettingUpdateResponseMigrations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerScriptSettingUpdateResponseMigrations)(nil)).Elem(), "") +} + +// A single set of migrations to apply. +type AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations 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 []AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass `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 []AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass `json:"transferred_classes"` + JSON accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations] +type accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON 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 *AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerScriptSettingUpdateResponseMigrations() { +} + +type AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] +type accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] +type accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations 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 []AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep `json:"steps"` + JSON accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations] +type accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON struct { + NewTag apijson.Field + OldTag apijson.Field + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerScriptSettingUpdateResponseMigrations() { +} + +type AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep 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 []AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass `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 []AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass `json:"transferred_classes"` + JSON accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep] +type accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON struct { + DeletedClasses apijson.Field + NewClasses apijson.Field + RenamedClasses apijson.Field + TransferredClasses apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] +type accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] +type accountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateResponsePlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode AccountWorkerScriptSettingUpdateResponsePlacementMode `json:"mode"` + JSON accountWorkerScriptSettingUpdateResponsePlacementJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponsePlacementJSON contains the JSON metadata +// for the struct [AccountWorkerScriptSettingUpdateResponsePlacement] +type accountWorkerScriptSettingUpdateResponsePlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponsePlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerScriptSettingUpdateResponsePlacementMode string + +const ( + AccountWorkerScriptSettingUpdateResponsePlacementModeSmart AccountWorkerScriptSettingUpdateResponsePlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerScriptSettingUpdateResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerScriptSettingUpdateResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerScriptSettingUpdateResponseTailConsumerJSON contains the JSON +// metadata for the struct [AccountWorkerScriptSettingUpdateResponseTailConsumer] +type accountWorkerScriptSettingUpdateResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptSettingUpdateResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptSettingUpdateParams struct { + Settings param.Field[AccountWorkerScriptSettingUpdateParamsSettings] `json:"settings"` +} + +func (r AccountWorkerScriptSettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptSettingUpdateParamsSettings struct { + // List of bindings attached to this Worker + Bindings param.Field[[]AccountWorkerScriptSettingUpdateParamsSettingsBinding] `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[[]string] `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[AccountWorkerScriptSettingUpdateParamsSettingsMigrations] `json:"migrations"` + Placement param.Field[AccountWorkerScriptSettingUpdateParamsSettingsPlacement] `json:"placement"` + // Tags to help you manage your Workers + Tags param.Field[[]string] `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers param.Field[[]AccountWorkerScriptSettingUpdateParamsSettingsTailConsumer] `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel param.Field[string] `json:"usage_model"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A binding to allow the Worker to communicate with resources +// +// Satisfied by +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBinding], +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBinding], +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2Binding], +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBinding], +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1Binding], +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBinding], +// [AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerScriptSettingUpdateParamsSettingsBinding interface { + implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() +} + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding struct { + // The class of resource that the binding provides. + Type param.Field[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBindingType] `json:"type,required"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBinding 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[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBindingType] `json:"type,required"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBinding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBindingTypeService AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBinding 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[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBindingType] `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 AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBinding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2Binding 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[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2BindingType] `json:"type,required"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2Binding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBinding 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[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBindingType] `json:"type,required"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBinding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1Binding 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[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1BindingType] `json:"type,required"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1Binding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBinding struct { + // Namespace to bind to + Namespace param.Field[string] `json:"namespace,required"` + // The class of resource that the binding provides. + Type param.Field[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingType] `json:"type,required"` + // Outbound worker + Outbound param.Field[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingOutbound] `json:"outbound"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingOutbound 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[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] `json:"worker"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingOutbound) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Outbound worker +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker 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 AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBinding struct { + // The class of resource that the binding provides. + Type param.Field[AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBindingType] `json:"type,required"` + // ID of the certificate to bind to + CertificateID param.Field[string] `json:"certificate_id"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerScriptSettingUpdateParamsSettingsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Satisfied by +// [AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrations], +// [AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerScriptSettingUpdateParamsSettingsMigrations interface { + implementsAccountWorkerScriptSettingUpdateParamsSettingsMigrations() +} + +// A single set of migrations to apply. +type AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrations struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // 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"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] `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 param.Field[[]AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerScriptSettingUpdateParamsSettingsMigrations() { +} + +type AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrations 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"` + // Migrations to apply in order. + Steps param.Field[[]AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStep] `json:"steps"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerScriptSettingUpdateParamsSettingsMigrations() { +} + +type AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStep struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] `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 param.Field[[]AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerScriptSettingUpdateParamsSettingsPlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode param.Field[AccountWorkerScriptSettingUpdateParamsSettingsPlacementMode] `json:"mode"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsPlacement) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerScriptSettingUpdateParamsSettingsPlacementMode string + +const ( + AccountWorkerScriptSettingUpdateParamsSettingsPlacementModeSmart AccountWorkerScriptSettingUpdateParamsSettingsPlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerScriptSettingUpdateParamsSettingsTailConsumer struct { + // Name of Worker that is to be the consumer. + Service param.Field[string] `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment param.Field[string] `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace param.Field[string] `json:"namespace"` +} + +func (r AccountWorkerScriptSettingUpdateParamsSettingsTailConsumer) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountworkerscriptsetting_test.go b/accountworkerscriptsetting_test.go new file mode 100644 index 00000000000..026e47e7422 --- /dev/null +++ b/accountworkerscriptsetting_test.go @@ -0,0 +1,135 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerScriptSettingGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.Settings.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + ) + 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 TestAccountWorkerScriptSettingUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.Settings.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + cloudflare.AccountWorkerScriptSettingUpdateParams{ + Settings: cloudflare.F(cloudflare.AccountWorkerScriptSettingUpdateParamsSettings{ + Bindings: cloudflare.F([]cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBinding{cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + }), cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + }), cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + })}), + CompatibilityDate: cloudflare.F("2022-04-05"), + CompatibilityFlags: cloudflare.F([]string{"formdata_parser_supports_files", "formdata_parser_supports_files", "formdata_parser_supports_files"}), + Logpush: cloudflare.F(false), + Migrations: cloudflare.F[cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsMigrations](cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrations(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrations{ + 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([]cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass{{ + 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([]cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass{{ + 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(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsPlacement{ + Mode: cloudflare.F(cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsPlacementModeSmart), + }), + Tags: cloudflare.F([]string{"my-tag", "my-tag", "my-tag"}), + TailConsumers: cloudflare.F([]cloudflare.AccountWorkerScriptSettingUpdateParamsSettingsTailConsumer{{ + 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()) + } +} diff --git a/accountworkerscripttail.go b/accountworkerscripttail.go new file mode 100644 index 00000000000..1036028644f --- /dev/null +++ b/accountworkerscripttail.go @@ -0,0 +1,336 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AccountWorkerScriptTailService 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 +// [NewAccountWorkerScriptTailService] method instead. +type AccountWorkerScriptTailService struct { + Options []option.RequestOption +} + +// NewAccountWorkerScriptTailService 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 NewAccountWorkerScriptTailService(opts ...option.RequestOption) (r *AccountWorkerScriptTailService) { + r = &AccountWorkerScriptTailService{} + r.Options = opts + return +} + +// Deletes a tail from a Worker. +func (r *AccountWorkerScriptTailService) Delete(ctx context.Context, accountIdentifier string, scriptName string, id string, opts ...option.RequestOption) (res *AccountWorkerScriptTailDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/tails/%s", accountIdentifier, scriptName, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Get list of tails currently deployed on a Worker. +func (r *AccountWorkerScriptTailService) WorkerTailLogsListTails(ctx context.Context, accountIdentifier string, scriptName string, opts ...option.RequestOption) (res *AccountWorkerScriptTailWorkerTailLogsListTailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/tails", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Starts a tail that receives logs and exception from a Worker. +func (r *AccountWorkerScriptTailService) WorkerTailLogsStartTail(ctx context.Context, accountIdentifier string, scriptName string, opts ...option.RequestOption) (res *AccountWorkerScriptTailWorkerTailLogsStartTailResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/tails", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AccountWorkerScriptTailDeleteResponse struct { + Errors []AccountWorkerScriptTailDeleteResponseError `json:"errors,required"` + Messages []AccountWorkerScriptTailDeleteResponseMessage `json:"messages,required"` + Result AccountWorkerScriptTailDeleteResponseResult `json:"result,required"` + // Whether the API call was successful + Success AccountWorkerScriptTailDeleteResponseSuccess `json:"success,required"` + JSON accountWorkerScriptTailDeleteResponseJSON `json:"-"` +} + +// accountWorkerScriptTailDeleteResponseJSON contains the JSON metadata for the +// struct [AccountWorkerScriptTailDeleteResponse] +type accountWorkerScriptTailDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptTailDeleteResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptTailDeleteResponseErrorJSON contains the JSON metadata for +// the struct [AccountWorkerScriptTailDeleteResponseError] +type accountWorkerScriptTailDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptTailDeleteResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptTailDeleteResponseMessageJSON contains the JSON metadata for +// the struct [AccountWorkerScriptTailDeleteResponseMessage] +type accountWorkerScriptTailDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [AccountWorkerScriptTailDeleteResponseResultUnknown], +// [AccountWorkerScriptTailDeleteResponseResultArray] or [shared.UnionString]. +type AccountWorkerScriptTailDeleteResponseResult interface { + ImplementsAccountWorkerScriptTailDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountWorkerScriptTailDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AccountWorkerScriptTailDeleteResponseResultArray []interface{} + +func (r AccountWorkerScriptTailDeleteResponseResultArray) ImplementsAccountWorkerScriptTailDeleteResponseResult() { +} + +// Whether the API call was successful +type AccountWorkerScriptTailDeleteResponseSuccess bool + +const ( + AccountWorkerScriptTailDeleteResponseSuccessTrue AccountWorkerScriptTailDeleteResponseSuccess = true +) + +type AccountWorkerScriptTailWorkerTailLogsListTailsResponse struct { + Errors []AccountWorkerScriptTailWorkerTailLogsListTailsResponseError `json:"errors"` + Messages []AccountWorkerScriptTailWorkerTailLogsListTailsResponseMessage `json:"messages"` + Result AccountWorkerScriptTailWorkerTailLogsListTailsResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptTailWorkerTailLogsListTailsResponseSuccess `json:"success"` + JSON accountWorkerScriptTailWorkerTailLogsListTailsResponseJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsListTailsResponseJSON contains the JSON +// metadata for the struct [AccountWorkerScriptTailWorkerTailLogsListTailsResponse] +type accountWorkerScriptTailWorkerTailLogsListTailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsListTailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailWorkerTailLogsListTailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptTailWorkerTailLogsListTailsResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsListTailsResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptTailWorkerTailLogsListTailsResponseError] +type accountWorkerScriptTailWorkerTailLogsListTailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsListTailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailWorkerTailLogsListTailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptTailWorkerTailLogsListTailsResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsListTailsResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptTailWorkerTailLogsListTailsResponseMessage] +type accountWorkerScriptTailWorkerTailLogsListTailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsListTailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailWorkerTailLogsListTailsResponseResult struct { + ID interface{} `json:"id"` + ExpiresAt interface{} `json:"expires_at"` + URL interface{} `json:"url"` + JSON accountWorkerScriptTailWorkerTailLogsListTailsResponseResultJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsListTailsResponseResultJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptTailWorkerTailLogsListTailsResponseResult] +type accountWorkerScriptTailWorkerTailLogsListTailsResponseResultJSON struct { + ID apijson.Field + ExpiresAt apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsListTailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptTailWorkerTailLogsListTailsResponseSuccess bool + +const ( + AccountWorkerScriptTailWorkerTailLogsListTailsResponseSuccessTrue AccountWorkerScriptTailWorkerTailLogsListTailsResponseSuccess = true +) + +type AccountWorkerScriptTailWorkerTailLogsStartTailResponse struct { + Errors []AccountWorkerScriptTailWorkerTailLogsStartTailResponseError `json:"errors"` + Messages []AccountWorkerScriptTailWorkerTailLogsStartTailResponseMessage `json:"messages"` + Result AccountWorkerScriptTailWorkerTailLogsStartTailResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptTailWorkerTailLogsStartTailResponseSuccess `json:"success"` + JSON accountWorkerScriptTailWorkerTailLogsStartTailResponseJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsStartTailResponseJSON contains the JSON +// metadata for the struct [AccountWorkerScriptTailWorkerTailLogsStartTailResponse] +type accountWorkerScriptTailWorkerTailLogsStartTailResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsStartTailResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailWorkerTailLogsStartTailResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptTailWorkerTailLogsStartTailResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsStartTailResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptTailWorkerTailLogsStartTailResponseError] +type accountWorkerScriptTailWorkerTailLogsStartTailResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsStartTailResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailWorkerTailLogsStartTailResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptTailWorkerTailLogsStartTailResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsStartTailResponseMessageJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptTailWorkerTailLogsStartTailResponseMessage] +type accountWorkerScriptTailWorkerTailLogsStartTailResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsStartTailResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptTailWorkerTailLogsStartTailResponseResult struct { + ID interface{} `json:"id"` + ExpiresAt interface{} `json:"expires_at"` + URL interface{} `json:"url"` + JSON accountWorkerScriptTailWorkerTailLogsStartTailResponseResultJSON `json:"-"` +} + +// accountWorkerScriptTailWorkerTailLogsStartTailResponseResultJSON contains the +// JSON metadata for the struct +// [AccountWorkerScriptTailWorkerTailLogsStartTailResponseResult] +type accountWorkerScriptTailWorkerTailLogsStartTailResponseResultJSON struct { + ID apijson.Field + ExpiresAt apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptTailWorkerTailLogsStartTailResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptTailWorkerTailLogsStartTailResponseSuccess bool + +const ( + AccountWorkerScriptTailWorkerTailLogsStartTailResponseSuccessTrue AccountWorkerScriptTailWorkerTailLogsStartTailResponseSuccess = true +) diff --git a/aibaai_test.go b/accountworkerscripttail_test.go similarity index 61% rename from aibaai_test.go rename to accountworkerscripttail_test.go index 9915bee4182..7fdd1fc7aa9 100644 --- a/aibaai_test.go +++ b/accountworkerscripttail_test.go @@ -9,12 +9,12 @@ import ( "testing" "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/shared" "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAIBaaiBgeBaseEnV1_5(t *testing.T) { +func TestAccountWorkerScriptTailDelete(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 @@ -24,15 +24,16 @@ func TestAIBaaiBgeBaseEnV1_5(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Baai.BgeBaseEnV1_5( + _, err := client.Accounts.Workers.Scripts.Tails.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIBaaiBgeBaseEnV1_5Params{ - Text: cloudflare.F[cloudflare.AIBaaiBgeBaseEnV1_5ParamsText](shared.UnionString("string")), - }, + "this-is_my_script-01", + "03dc9f77817b488fb26c5861ec18f791", ) if err != nil { var apierr *cloudflare.Error @@ -43,7 +44,8 @@ func TestAIBaaiBgeBaseEnV1_5(t *testing.T) { } } -func TestAIBaaiBgeLargeEnV1_5(t *testing.T) { +func TestAccountWorkerScriptTailWorkerTailLogsListTails(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 @@ -53,15 +55,15 @@ func TestAIBaaiBgeLargeEnV1_5(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Baai.BgeLargeEnV1_5( + _, err := client.Accounts.Workers.Scripts.Tails.WorkerTailLogsListTails( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIBaaiBgeLargeEnV1_5Params{ - Text: cloudflare.F[cloudflare.AIBaaiBgeLargeEnV1_5ParamsText](shared.UnionString("string")), - }, + "this-is_my_script-01", ) if err != nil { var apierr *cloudflare.Error @@ -72,7 +74,8 @@ func TestAIBaaiBgeLargeEnV1_5(t *testing.T) { } } -func TestAIBaaiBgeSmallEnV1_5(t *testing.T) { +func TestAccountWorkerScriptTailWorkerTailLogsStartTail(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 @@ -82,15 +85,15 @@ func TestAIBaaiBgeSmallEnV1_5(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Baai.BgeSmallEnV1_5( + _, err := client.Accounts.Workers.Scripts.Tails.WorkerTailLogsStartTail( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIBaaiBgeSmallEnV1_5Params{ - Text: cloudflare.F[cloudflare.AIBaaiBgeSmallEnV1_5ParamsText](shared.UnionString("string")), - }, + "this-is_my_script-01", ) if err != nil { var apierr *cloudflare.Error diff --git a/accountworkerscriptusagemodel.go b/accountworkerscriptusagemodel.go new file mode 100644 index 00000000000..9f79538c2fb --- /dev/null +++ b/accountworkerscriptusagemodel.go @@ -0,0 +1,237 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerScriptUsageModelService 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 +// [NewAccountWorkerScriptUsageModelService] method instead. +type AccountWorkerScriptUsageModelService struct { + Options []option.RequestOption +} + +// NewAccountWorkerScriptUsageModelService 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 NewAccountWorkerScriptUsageModelService(opts ...option.RequestOption) (r *AccountWorkerScriptUsageModelService) { + r = &AccountWorkerScriptUsageModelService{} + r.Options = opts + return +} + +// Fetches the Usage Model for a given Worker. +func (r *AccountWorkerScriptUsageModelService) WorkerScriptFetchUsageModel(ctx context.Context, accountIdentifier string, scriptName string, opts ...option.RequestOption) (res *AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/usage-model", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the Usage Model for a given Worker. Requires a Workers Paid +// subscription. +func (r *AccountWorkerScriptUsageModelService) WorkerScriptUpdateUsageModel(ctx context.Context, accountIdentifier string, scriptName string, body AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelParams, opts ...option.RequestOption) (res *AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/usage-model", accountIdentifier, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponse struct { + Errors []AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseError `json:"errors"` + Messages []AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseMessage `json:"messages"` + Result AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseSuccess `json:"success"` + JSON accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponse] +type accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseError] +type accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseMessage] +type accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseResult struct { + UsageModel interface{} `json:"usage_model"` + JSON accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseResultJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseResultJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseResult] +type accountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseResultJSON struct { + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseSuccess bool + +const ( + AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseSuccessTrue AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponseSuccess = true +) + +type AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponse struct { + Errors []AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseError `json:"errors"` + Messages []AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseMessage `json:"messages"` + Result AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseSuccess `json:"success"` + JSON accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseJSON contains +// the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponse] +type accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseErrorJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseErrorJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseError] +type accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseMessageJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseMessageJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseMessage] +type accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseResult struct { + UsageModel interface{} `json:"usage_model"` + JSON accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseResultJSON `json:"-"` +} + +// accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseResultJSON +// contains the JSON metadata for the struct +// [AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseResult] +type accountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseResultJSON struct { + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseSuccess bool + +const ( + AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseSuccessTrue AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponseSuccess = true +) + +type AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountworkerscriptusagemodel_test.go b/accountworkerscriptusagemodel_test.go new file mode 100644 index 00000000000..702321ff77d --- /dev/null +++ b/accountworkerscriptusagemodel_test.go @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerScriptUsageModelWorkerScriptFetchUsageModel(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.UsageModels.WorkerScriptFetchUsageModel( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + ) + 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 TestAccountWorkerScriptUsageModelWorkerScriptUpdateUsageModel(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Scripts.UsageModels.WorkerScriptUpdateUsageModel( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "this-is_my_script-01", + cloudflare.AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelParams{ + Body: cloudflare.F[any]("{'usage_model': '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()) + } +} diff --git a/accountworkerservice.go b/accountworkerservice.go new file mode 100644 index 00000000000..8ae67980f19 --- /dev/null +++ b/accountworkerservice.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerServiceService 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 [NewAccountWorkerServiceService] +// method instead. +type AccountWorkerServiceService struct { + Options []option.RequestOption + Environments *AccountWorkerServiceEnvironmentService +} + +// NewAccountWorkerServiceService 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 NewAccountWorkerServiceService(opts ...option.RequestOption) (r *AccountWorkerServiceService) { + r = &AccountWorkerServiceService{} + r.Options = opts + r.Environments = NewAccountWorkerServiceEnvironmentService(opts...) + return +} diff --git a/accountworkerserviceenvironment.go b/accountworkerserviceenvironment.go new file mode 100644 index 00000000000..93d3b14ac83 --- /dev/null +++ b/accountworkerserviceenvironment.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerServiceEnvironmentService 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 +// [NewAccountWorkerServiceEnvironmentService] method instead. +type AccountWorkerServiceEnvironmentService struct { + Options []option.RequestOption + Content *AccountWorkerServiceEnvironmentContentService + Settings *AccountWorkerServiceEnvironmentSettingService +} + +// NewAccountWorkerServiceEnvironmentService 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 NewAccountWorkerServiceEnvironmentService(opts ...option.RequestOption) (r *AccountWorkerServiceEnvironmentService) { + r = &AccountWorkerServiceEnvironmentService{} + r.Options = opts + r.Content = NewAccountWorkerServiceEnvironmentContentService(opts...) + r.Settings = NewAccountWorkerServiceEnvironmentSettingService(opts...) + return +} diff --git a/accountworkerserviceenvironmentcontent.go b/accountworkerserviceenvironmentcontent.go new file mode 100644 index 00000000000..a04e16ea433 --- /dev/null +++ b/accountworkerserviceenvironmentcontent.go @@ -0,0 +1,166 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "bytes" + "context" + "fmt" + "io" + "mime/multipart" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiform" + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerServiceEnvironmentContentService 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 [NewAccountWorkerServiceEnvironmentContentService] method instead. +type AccountWorkerServiceEnvironmentContentService struct { + Options []option.RequestOption +} + +// NewAccountWorkerServiceEnvironmentContentService 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 NewAccountWorkerServiceEnvironmentContentService(opts ...option.RequestOption) (r *AccountWorkerServiceEnvironmentContentService) { + r = &AccountWorkerServiceEnvironmentContentService{} + r.Options = opts + return +} + +// Get script content from a worker with an environment +func (r *AccountWorkerServiceEnvironmentContentService) Get(ctx context.Context, accountIdentifier string, serviceName string, environmentName string, 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/services/%s/environments/%s/content", accountIdentifier, serviceName, environmentName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Put script content from a worker with an environment +func (r *AccountWorkerServiceEnvironmentContentService) Update(ctx context.Context, accountIdentifier string, serviceName string, environmentName string, params AccountWorkerServiceEnvironmentContentUpdateParams, opts ...option.RequestOption) (res *AccountWorkerServiceEnvironmentContentUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/services/%s/environments/%s/content", accountIdentifier, serviceName, environmentName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) + return +} + +type AccountWorkerServiceEnvironmentContentUpdateResponse struct { + // The id of the script in the Workers system. Usually the script name. + ID string `json:"id"` + // When the script was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Hashed script content, can be used in a If-None-Match header when updating. + Etag string `json:"etag"` + // Whether Logpush is turned on for the Worker. + Logpush bool `json:"logpush"` + // When the script was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Deprecated. Deployment metadata for internal usage. + PipelineHash string `json:"pipeline_hash"` + // Specifies the placement mode for the Worker (e.g. 'smart'). + PlacementMode string `json:"placement_mode"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerServiceEnvironmentContentUpdateResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerServiceEnvironmentContentUpdateResponseJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentContentUpdateResponseJSON contains the JSON +// metadata for the struct [AccountWorkerServiceEnvironmentContentUpdateResponse] +type accountWorkerServiceEnvironmentContentUpdateResponseJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Etag apijson.Field + Logpush apijson.Field + ModifiedOn apijson.Field + PipelineHash apijson.Field + PlacementMode apijson.Field + TailConsumers apijson.Field + UsageModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentContentUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerServiceEnvironmentContentUpdateResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerServiceEnvironmentContentUpdateResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentContentUpdateResponseTailConsumerJSON contains +// the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentContentUpdateResponseTailConsumer] +type accountWorkerServiceEnvironmentContentUpdateResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentContentUpdateResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentContentUpdateParams struct { + // A module comprising a Worker script, often a javascript file. Multiple modules + // may be provided as separate named parts, but at least one module must be + // present. This should be referenced either in the metadata as `main_module` + // (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` + // (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. + AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` + // JSON encoded metadata about the uploaded parts and Worker configuration. + Metadata param.Field[AccountWorkerServiceEnvironmentContentUpdateParamsMetadata] `json:"metadata"` + CfWorkerBodyPart param.Field[string] `header:"CF-WORKER-BODY-PART"` + CfWorkerMainModulePart param.Field[string] `header:"CF-WORKER-MAIN-MODULE-PART"` +} + +func (r AccountWorkerServiceEnvironmentContentUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} + +// JSON encoded metadata about the uploaded parts and Worker configuration. +type AccountWorkerServiceEnvironmentContentUpdateParamsMetadata struct { + // Name of the part in the multipart request that contains the script (e.g. the + // file adding a listener to the `fetch` event). Indicates a + // `service worker syntax` Worker. + BodyPart param.Field[string] `json:"body_part"` + // Name of the part in the multipart request that contains the main module (e.g. + // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. + MainModule param.Field[string] `json:"main_module"` +} + +func (r AccountWorkerServiceEnvironmentContentUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountworkerserviceenvironmentcontent_test.go b/accountworkerserviceenvironmentcontent_test.go new file mode 100644 index 00000000000..7754961bdaa --- /dev/null +++ b/accountworkerserviceenvironmentcontent_test.go @@ -0,0 +1,101 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerServiceEnvironmentContentGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Accounts.Workers.Services.Environments.Content.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-worker", + "production", + ) + 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) + } +} + +func TestAccountWorkerServiceEnvironmentContentUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Services.Environments.Content.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-worker", + "production", + cloudflare.AccountWorkerServiceEnvironmentContentUpdateParams{ + AnyPartName: cloudflare.F([]io.Reader{io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents")))}), + Metadata: cloudflare.F(cloudflare.AccountWorkerServiceEnvironmentContentUpdateParamsMetadata{ + BodyPart: cloudflare.F("worker.js"), + MainModule: cloudflare.F("worker.js"), + }), + CfWorkerBodyPart: cloudflare.F("string"), + CfWorkerMainModulePart: cloudflare.F("string"), + }, + ) + 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/accountworkerserviceenvironmentsetting.go b/accountworkerserviceenvironmentsetting.go new file mode 100644 index 00000000000..518067661fe --- /dev/null +++ b/accountworkerserviceenvironmentsetting.go @@ -0,0 +1,1745 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerServiceEnvironmentSettingService 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 [NewAccountWorkerServiceEnvironmentSettingService] method instead. +type AccountWorkerServiceEnvironmentSettingService struct { + Options []option.RequestOption +} + +// NewAccountWorkerServiceEnvironmentSettingService 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 NewAccountWorkerServiceEnvironmentSettingService(opts ...option.RequestOption) (r *AccountWorkerServiceEnvironmentSettingService) { + r = &AccountWorkerServiceEnvironmentSettingService{} + r.Options = opts + return +} + +// Get script settings from a worker with an environment +func (r *AccountWorkerServiceEnvironmentSettingService) Get(ctx context.Context, accountIdentifier string, serviceName string, environmentName string, opts ...option.RequestOption) (res *AccountWorkerServiceEnvironmentSettingGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/services/%s/environments/%s/settings", accountIdentifier, serviceName, environmentName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Patch script metadata, such as bindings +func (r *AccountWorkerServiceEnvironmentSettingService) Update(ctx context.Context, accountIdentifier string, serviceName string, environmentName string, body AccountWorkerServiceEnvironmentSettingUpdateParams, opts ...option.RequestOption) (res *AccountWorkerServiceEnvironmentSettingUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/services/%s/environments/%s/settings", accountIdentifier, serviceName, environmentName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type AccountWorkerServiceEnvironmentSettingGetResponse struct { + // List of bindings attached to this Worker + Bindings []AccountWorkerServiceEnvironmentSettingGetResponseBinding `json:"bindings"` + // Opt your Worker into changes after this date + CompatibilityDate string `json:"compatibility_date"` + // Opt your Worker into specific changes + CompatibilityFlags []string `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 AccountWorkerServiceEnvironmentSettingGetResponseMigrations `json:"migrations"` + Placement AccountWorkerServiceEnvironmentSettingGetResponsePlacement `json:"placement"` + // Tags to help you manage your Workers + Tags []string `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerServiceEnvironmentSettingGetResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerServiceEnvironmentSettingGetResponseJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseJSON contains the JSON metadata +// for the struct [AccountWorkerServiceEnvironmentSettingGetResponse] +type accountWorkerServiceEnvironmentSettingGetResponseJSON 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 *AccountWorkerServiceEnvironmentSettingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A binding to allow the Worker to communicate with resources +// +// Union satisfied by +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBinding], +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBinding], +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2Binding], +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBinding], +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1Binding], +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding] +// or +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerServiceEnvironmentSettingGetResponseBinding interface { + implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerServiceEnvironmentSettingGetResponseBinding)(nil)).Elem(), "") +} + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingJSON struct { + Name apijson.Field + NamespaceID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBinding struct { + // Optional environment if the Worker utilizes one. + Environment string `json:"environment,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Name of Worker to bind to + Service string `json:"service,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBinding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBindingJSON struct { + Environment apijson.Field + Name apijson.Field + Service apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBinding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBindingTypeService AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBinding struct { + // The exported class name of the Durable Object + ClassName string `json:"class_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBindingType `json:"type,required"` + // The environment of the script_name to bind to + Environment string `json:"environment"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id"` + // The script where the Durable Object is defined, if it is external to this Worker + ScriptName string `json:"script_name"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBinding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBindingJSON struct { + ClassName apijson.Field + Name apijson.Field + Type apijson.Field + Environment apijson.Field + NamespaceID apijson.Field + ScriptName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBinding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2Binding struct { + // R2 bucket to bind to + BucketName string `json:"bucket_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2BindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2BindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2Binding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2BindingJSON struct { + BucketName apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2Binding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBinding 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 AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBinding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBindingJSON struct { + Name apijson.Field + QueueName apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBinding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1Binding struct { + // ID of the D1 database to bind to + ID string `json:"id,required"` + // A JavaScript variable name for the binding. + Binding string `json:"binding,required"` + // The name of the D1 database associated with the 'id' provided. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1BindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1BindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1Binding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1BindingJSON struct { + ID apijson.Field + Binding apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1Binding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace to bind to + Namespace string `json:"namespace,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType `json:"type,required"` + // Outbound worker + Outbound AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound `json:"outbound"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON struct { + Name apijson.Field + Namespace apijson.Field + Type apijson.Field + Outbound apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound struct { + // Pass information from the Dispatch Worker to the Outbound Worker through the + // parameters + Params []string `json:"params"` + // Outbound worker + Worker AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker `json:"worker"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON struct { + Params apijson.Field + Worker apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Outbound worker +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker struct { + // Environment of the outbound worker + Environment string `json:"environment"` + // Name of the outbound worker + Service string `json:"service"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType `json:"type,required"` + // ID of the certificate to bind to + CertificateID string `json:"certificate_id"` + JSON accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBinding] +type accountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBindingJSON struct { + Name apijson.Field + Type apijson.Field + CertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerServiceEnvironmentSettingGetResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerServiceEnvironmentSettingGetResponseBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Union satisfied by +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations] +// or +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerServiceEnvironmentSettingGetResponseMigrations interface { + implementsAccountWorkerServiceEnvironmentSettingGetResponseMigrations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerServiceEnvironmentSettingGetResponseMigrations)(nil)).Elem(), "") +} + +// A single set of migrations to apply. +type AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations 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 []AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass `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 []AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass `json:"transferred_classes"` + JSON accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations] +type accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsJSON 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 *AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerServiceEnvironmentSettingGetResponseMigrations() { +} + +type AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] +type accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] +type accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrations 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 []AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep `json:"steps"` + JSON accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrations] +type accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsJSON struct { + NewTag apijson.Field + OldTag apijson.Field + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerServiceEnvironmentSettingGetResponseMigrations() { +} + +type AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep 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 []AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass `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 []AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass `json:"transferred_classes"` + JSON accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep] +type accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON struct { + DeletedClasses apijson.Field + NewClasses apijson.Field + RenamedClasses apijson.Field + TransferredClasses apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] +type accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] +type accountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingGetResponsePlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode AccountWorkerServiceEnvironmentSettingGetResponsePlacementMode `json:"mode"` + JSON accountWorkerServiceEnvironmentSettingGetResponsePlacementJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponsePlacementJSON contains the JSON +// metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponsePlacement] +type accountWorkerServiceEnvironmentSettingGetResponsePlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponsePlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerServiceEnvironmentSettingGetResponsePlacementMode string + +const ( + AccountWorkerServiceEnvironmentSettingGetResponsePlacementModeSmart AccountWorkerServiceEnvironmentSettingGetResponsePlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerServiceEnvironmentSettingGetResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerServiceEnvironmentSettingGetResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingGetResponseTailConsumerJSON contains the +// JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingGetResponseTailConsumer] +type accountWorkerServiceEnvironmentSettingGetResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingGetResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponse struct { + // List of bindings attached to this Worker + Bindings []AccountWorkerServiceEnvironmentSettingUpdateResponseBinding `json:"bindings"` + // Opt your Worker into changes after this date + CompatibilityDate string `json:"compatibility_date"` + // Opt your Worker into specific changes + CompatibilityFlags []string `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 AccountWorkerServiceEnvironmentSettingUpdateResponseMigrations `json:"migrations"` + Placement AccountWorkerServiceEnvironmentSettingUpdateResponsePlacement `json:"placement"` + // Tags to help you manage your Workers + Tags []string `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers []AccountWorkerServiceEnvironmentSettingUpdateResponseTailConsumer `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel string `json:"usage_model"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseJSON contains the JSON +// metadata for the struct [AccountWorkerServiceEnvironmentSettingUpdateResponse] +type accountWorkerServiceEnvironmentSettingUpdateResponseJSON 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 *AccountWorkerServiceEnvironmentSettingUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A binding to allow the Worker to communicate with resources +// +// Union satisfied by +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2Binding], +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1Binding], +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding] +// or +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBinding interface { + implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerServiceEnvironmentSettingUpdateResponseBinding)(nil)).Elem(), "") +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingJSON struct { + Name apijson.Field + NamespaceID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBinding struct { + // Optional environment if the Worker utilizes one. + Environment string `json:"environment,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Name of Worker to bind to + Service string `json:"service,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBinding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBindingJSON struct { + Environment apijson.Field + Name apijson.Field + Service apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBindingTypeService AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBinding struct { + // The exported class name of the Durable Object + ClassName string `json:"class_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBindingType `json:"type,required"` + // The environment of the script_name to bind to + Environment string `json:"environment"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id"` + // The script where the Durable Object is defined, if it is external to this Worker + ScriptName string `json:"script_name"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBinding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBindingJSON struct { + ClassName apijson.Field + Name apijson.Field + Type apijson.Field + Environment apijson.Field + NamespaceID apijson.Field + ScriptName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2Binding struct { + // R2 bucket to bind to + BucketName string `json:"bucket_name,required"` + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2BindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2Binding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2BindingJSON struct { + BucketName apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2Binding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBinding 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 AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBinding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBindingJSON struct { + Name apijson.Field + QueueName apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1Binding struct { + // ID of the D1 database to bind to + ID string `json:"id,required"` + // A JavaScript variable name for the binding. + Binding string `json:"binding,required"` + // The name of the D1 database associated with the 'id' provided. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1BindingType `json:"type,required"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1Binding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1BindingJSON struct { + ID apijson.Field + Binding apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1Binding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1Binding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace to bind to + Namespace string `json:"namespace,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType `json:"type,required"` + // Outbound worker + Outbound AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound `json:"outbound"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingJSON struct { + Name apijson.Field + Namespace apijson.Field + Type apijson.Field + Outbound apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound struct { + // Pass information from the Dispatch Worker to the Outbound Worker through the + // parameters + Params []string `json:"params"` + // Outbound worker + Worker AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker `json:"worker"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundJSON struct { + Params apijson.Field + Worker apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutbound) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Outbound worker +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker struct { + // Environment of the outbound worker + Environment string `json:"environment"` + // Name of the outbound worker + Service string `json:"service"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorkerJSON struct { + Environment apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType `json:"type,required"` + // ID of the certificate to bind to + CertificateID string `json:"certificate_id"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding] +type accountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingJSON struct { + Name apijson.Field + Type apijson.Field + CertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerServiceEnvironmentSettingUpdateResponseBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Union satisfied by +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations] +// or +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrations interface { + implementsAccountWorkerServiceEnvironmentSettingUpdateResponseMigrations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*AccountWorkerServiceEnvironmentSettingUpdateResponseMigrations)(nil)).Elem(), "") +} + +// A single set of migrations to apply. +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations 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 []AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass `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 []AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass `json:"transferred_classes"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations] +type accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsJSON 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 *AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseMigrations() { +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] +type accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] +type accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations 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 []AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep `json:"steps"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations] +type accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsJSON struct { + NewTag apijson.Field + OldTag apijson.Field + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerServiceEnvironmentSettingUpdateResponseMigrations() { +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep 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 []AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass `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 []AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass `json:"transferred_classes"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep] +type accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepJSON struct { + DeletedClasses apijson.Field + NewClasses apijson.Field + RenamedClasses apijson.Field + TransferredClasses apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From string `json:"from"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] +type accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClassJSON struct { + From apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From string `json:"from"` + FromScript string `json:"from_script"` + To string `json:"to"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON +// contains the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] +type accountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClassJSON struct { + From apijson.Field + FromScript apijson.Field + To apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateResponsePlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode AccountWorkerServiceEnvironmentSettingUpdateResponsePlacementMode `json:"mode"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponsePlacementJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponsePlacementJSON contains the +// JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponsePlacement] +type accountWorkerServiceEnvironmentSettingUpdateResponsePlacementJSON struct { + Mode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponsePlacement) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerServiceEnvironmentSettingUpdateResponsePlacementMode string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateResponsePlacementModeSmart AccountWorkerServiceEnvironmentSettingUpdateResponsePlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerServiceEnvironmentSettingUpdateResponseTailConsumer struct { + // Name of Worker that is to be the consumer. + Service string `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment string `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace string `json:"namespace"` + JSON accountWorkerServiceEnvironmentSettingUpdateResponseTailConsumerJSON `json:"-"` +} + +// accountWorkerServiceEnvironmentSettingUpdateResponseTailConsumerJSON contains +// the JSON metadata for the struct +// [AccountWorkerServiceEnvironmentSettingUpdateResponseTailConsumer] +type accountWorkerServiceEnvironmentSettingUpdateResponseTailConsumerJSON struct { + Service apijson.Field + Environment apijson.Field + Namespace apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerServiceEnvironmentSettingUpdateResponseTailConsumer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateParams struct { + // List of bindings attached to this Worker + Bindings param.Field[[]AccountWorkerServiceEnvironmentSettingUpdateParamsBinding] `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[[]string] `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[AccountWorkerServiceEnvironmentSettingUpdateParamsMigrations] `json:"migrations"` + Placement param.Field[AccountWorkerServiceEnvironmentSettingUpdateParamsPlacement] `json:"placement"` + // Tags to help you manage your Workers + Tags param.Field[[]string] `json:"tags"` + // List of Workers that will consume logs from the attached Worker. + TailConsumers param.Field[[]AccountWorkerServiceEnvironmentSettingUpdateParamsTailConsumer] `json:"tail_consumers"` + // Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound'). + UsageModel param.Field[string] `json:"usage_model"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A binding to allow the Worker to communicate with resources +// +// Satisfied by +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2Binding], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1Binding], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding]. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBinding interface { + implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding struct { + // The class of resource that the binding provides. + Type param.Field[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingType] `json:"type,required"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBinding 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[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBindingType] `json:"type,required"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBindingTypeService AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uServiceBindingType = "service" +) + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBinding 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[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBindingType] `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 AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBindingTypeDurableObjectNamespace AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDoBindingType = "durable_object_namespace" +) + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2Binding 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[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2BindingType] `json:"type,required"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2Binding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2BindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2BindingTypeR2Bucket AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uR2BindingType = "r2_bucket" +) + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBinding 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[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBindingType] `json:"type,required"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBindingTypeQueue AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uQueueBindingType = "queue" +) + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1Binding 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[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1BindingType] `json:"type,required"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1Binding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1Binding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1BindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1BindingTypeD1 AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uD1BindingType = "d1" +) + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding struct { + // Namespace to bind to + Namespace param.Field[string] `json:"namespace,required"` + // The class of resource that the binding provides. + Type param.Field[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingType] `json:"type,required"` + // Outbound worker + Outbound param.Field[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutbound] `json:"outbound"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingTypeDispatchNamespace AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingType = "dispatch_namespace" +) + +// Outbound worker +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutbound 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[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker] `json:"worker"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutbound) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Outbound worker +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker 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 AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uDispatchNamespaceBindingOutboundWorker) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding struct { + // The class of resource that the binding provides. + Type param.Field[AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingType] `json:"type,required"` + // ID of the certificate to bind to + CertificateID param.Field[string] `json:"certificate_id"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBinding) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsBinding() { +} + +// The class of resource that the binding provides. +type AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingType string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingTypeMtlsCertificate AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uMtlsCertBindingType = "mtls_certificate" +) + +// Migrations to apply for Durable Objects associated with this Worker. +// +// Satisfied by +// [AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations], +// [AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations]. +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrations interface { + implementsAccountWorkerServiceEnvironmentSettingUpdateParamsMigrations() +} + +// A single set of migrations to apply. +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // 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"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass] `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 param.Field[[]AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsMigrations() { +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations 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"` + // Migrations to apply in order. + Steps param.Field[[]AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStep] `json:"steps"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrations) implementsAccountWorkerServiceEnvironmentSettingUpdateParamsMigrations() { +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStep struct { + // A list of classes to delete Durable Object namespaces from. + DeletedClasses param.Field[[]string] `json:"deleted_classes"` + // A list of classes to create Durable Object namespaces from. + NewClasses param.Field[[]string] `json:"new_classes"` + // A list of classes with Durable Object namespaces that were renamed. + RenamedClasses param.Field[[]AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass] `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 param.Field[[]AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass struct { + From param.Field[string] `json:"from"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass struct { + From param.Field[string] `json:"from"` + FromScript param.Field[string] `json:"from_script"` + To param.Field[string] `json:"to"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccountWorkerServiceEnvironmentSettingUpdateParamsPlacement struct { + // Enables + // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). + // Only `"smart"` is currently supported + Mode param.Field[AccountWorkerServiceEnvironmentSettingUpdateParamsPlacementMode] `json:"mode"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsPlacement) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables +// [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). +// Only `"smart"` is currently supported +type AccountWorkerServiceEnvironmentSettingUpdateParamsPlacementMode string + +const ( + AccountWorkerServiceEnvironmentSettingUpdateParamsPlacementModeSmart AccountWorkerServiceEnvironmentSettingUpdateParamsPlacementMode = "smart" +) + +// A reference to a script that will consume logs from the attached Worker. +type AccountWorkerServiceEnvironmentSettingUpdateParamsTailConsumer struct { + // Name of Worker that is to be the consumer. + Service param.Field[string] `json:"service,required"` + // Optional environment if the Worker utilizes one. + Environment param.Field[string] `json:"environment"` + // Optional dispatch namespace the script belongs to. + Namespace param.Field[string] `json:"namespace"` +} + +func (r AccountWorkerServiceEnvironmentSettingUpdateParamsTailConsumer) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountworkerserviceenvironmentsetting_test.go b/accountworkerserviceenvironmentsetting_test.go new file mode 100644 index 00000000000..788b0687a10 --- /dev/null +++ b/accountworkerserviceenvironmentsetting_test.go @@ -0,0 +1,135 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerServiceEnvironmentSettingGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Services.Environments.Settings.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-worker", + "production", + ) + 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 TestAccountWorkerServiceEnvironmentSettingUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Services.Environments.Settings.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "my-worker", + "production", + cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParams{ + Bindings: cloudflare.F([]cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBinding{cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + }), cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + }), cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBinding{ + Type: cloudflare.F(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsBindingsAvYbsl2uKvNamespaceBindingTypeKvNamespace), + })}), + CompatibilityDate: cloudflare.F("2022-04-05"), + CompatibilityFlags: cloudflare.F([]string{"formdata_parser_supports_files", "formdata_parser_supports_files", "formdata_parser_supports_files"}), + Logpush: cloudflare.F(false), + Migrations: cloudflare.F[cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsMigrations](cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrations{ + 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([]cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsRenamedClass{{ + 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([]cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsMigrationsAvYbsl2uSingleStepMigrationsTransferredClass{{ + 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(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsPlacement{ + Mode: cloudflare.F(cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsPlacementModeSmart), + }), + Tags: cloudflare.F([]string{"my-tag", "my-tag", "my-tag"}), + TailConsumers: cloudflare.F([]cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParamsTailConsumer{{ + 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()) + } +} diff --git a/accountworkersubdomain.go b/accountworkersubdomain.go new file mode 100644 index 00000000000..50169115f68 --- /dev/null +++ b/accountworkersubdomain.go @@ -0,0 +1,236 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountWorkerSubdomainService 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 [NewAccountWorkerSubdomainService] +// method instead. +type AccountWorkerSubdomainService struct { + Options []option.RequestOption +} + +// NewAccountWorkerSubdomainService 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 NewAccountWorkerSubdomainService(opts ...option.RequestOption) (r *AccountWorkerSubdomainService) { + r = &AccountWorkerSubdomainService{} + r.Options = opts + return +} + +// Creates a Workers subdomain for an account. +func (r *AccountWorkerSubdomainService) WorkerSubdomainNewSubdomain(ctx context.Context, accountIdentifier string, body AccountWorkerSubdomainWorkerSubdomainNewSubdomainParams, opts ...option.RequestOption) (res *AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/subdomain", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Returns a Workers subdomain for an account. +func (r *AccountWorkerSubdomainService) WorkerSubdomainGetSubdomain(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/workers/subdomain", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponse struct { + Errors []AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseError `json:"errors"` + Messages []AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseMessage `json:"messages"` + Result AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseSuccess `json:"success"` + JSON accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseJSON contains the JSON +// metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponse] +type accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseErrorJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseError] +type accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseMessageJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseMessage] +type accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseResult struct { + Name interface{} `json:"name"` + JSON accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseResultJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseResultJSON contains the +// JSON metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseResult] +type accountWorkerSubdomainWorkerSubdomainNewSubdomainResponseResultJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseSuccess bool + +const ( + AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseSuccessTrue AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponseSuccess = true +) + +type AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponse struct { + Errors []AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseError `json:"errors"` + Messages []AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseMessage `json:"messages"` + Result AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseResult `json:"result"` + // Whether the API call was successful + Success AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseSuccess `json:"success"` + JSON accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseJSON contains the JSON +// metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponse] +type accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseErrorJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseErrorJSON contains the +// JSON metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseError] +type accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseMessageJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseMessageJSON contains +// the JSON metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseMessage] +type accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseResult struct { + Name interface{} `json:"name"` + JSON accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseResultJSON `json:"-"` +} + +// accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseResultJSON contains the +// JSON metadata for the struct +// [AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseResult] +type accountWorkerSubdomainWorkerSubdomainGetSubdomainResponseResultJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseSuccess bool + +const ( + AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseSuccessTrue AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponseSuccess = true +) + +type AccountWorkerSubdomainWorkerSubdomainNewSubdomainParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r AccountWorkerSubdomainWorkerSubdomainNewSubdomainParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/accountworkersubdomain_test.go b/accountworkersubdomain_test.go new file mode 100644 index 00000000000..2c82da35240 --- /dev/null +++ b/accountworkersubdomain_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountWorkerSubdomainWorkerSubdomainNewSubdomain(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Subdomains.WorkerSubdomainNewSubdomain( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AccountWorkerSubdomainWorkerSubdomainNewSubdomainParams{ + Body: cloudflare.F[any]("{'subdomain': 'example-subdomain'}"), + }, + ) + 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 TestAccountWorkerSubdomainWorkerSubdomainGetSubdomain(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Workers.Subdomains.WorkerSubdomainGetSubdomain(context.TODO(), "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/accountzerotrust.go b/accountzerotrust.go new file mode 100644 index 00000000000..5e3c578b37a --- /dev/null +++ b/accountzerotrust.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountZerotrustService 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 [NewAccountZerotrustService] method +// instead. +type AccountZerotrustService struct { + Options []option.RequestOption + ConnectivitySettings *AccountZerotrustConnectivitySettingService +} + +// NewAccountZerotrustService 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 NewAccountZerotrustService(opts ...option.RequestOption) (r *AccountZerotrustService) { + r = &AccountZerotrustService{} + r.Options = opts + r.ConnectivitySettings = NewAccountZerotrustConnectivitySettingService(opts...) + return +} diff --git a/accountzerotrustconnectivitysetting.go b/accountzerotrustconnectivitysetting.go new file mode 100644 index 00000000000..42ec4432712 --- /dev/null +++ b/accountzerotrustconnectivitysetting.go @@ -0,0 +1,242 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AccountZerotrustConnectivitySettingService 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 +// [NewAccountZerotrustConnectivitySettingService] method instead. +type AccountZerotrustConnectivitySettingService struct { + Options []option.RequestOption +} + +// NewAccountZerotrustConnectivitySettingService 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 NewAccountZerotrustConnectivitySettingService(opts ...option.RequestOption) (r *AccountZerotrustConnectivitySettingService) { + r = &AccountZerotrustConnectivitySettingService{} + r.Options = opts + return +} + +// Updates the Zero Trust Connectivity Settings for the given account. +func (r *AccountZerotrustConnectivitySettingService) Update(ctx context.Context, accountIdentifier string, body AccountZerotrustConnectivitySettingUpdateParams, opts ...option.RequestOption) (res *AccountZerotrustConnectivitySettingUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/zerotrust/connectivity_settings", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Gets the Zero Trust Connectivity Settings for the given account. +func (r *AccountZerotrustConnectivitySettingService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AccountZerotrustConnectivitySettingListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/zerotrust/connectivity_settings", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AccountZerotrustConnectivitySettingUpdateResponse struct { + Errors []AccountZerotrustConnectivitySettingUpdateResponseError `json:"errors"` + Messages []AccountZerotrustConnectivitySettingUpdateResponseMessage `json:"messages"` + Result AccountZerotrustConnectivitySettingUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AccountZerotrustConnectivitySettingUpdateResponseSuccess `json:"success"` + JSON accountZerotrustConnectivitySettingUpdateResponseJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingUpdateResponseJSON contains the JSON metadata +// for the struct [AccountZerotrustConnectivitySettingUpdateResponse] +type accountZerotrustConnectivitySettingUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountZerotrustConnectivitySettingUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountZerotrustConnectivitySettingUpdateResponseErrorJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingUpdateResponseErrorJSON contains the JSON +// metadata for the struct [AccountZerotrustConnectivitySettingUpdateResponseError] +type accountZerotrustConnectivitySettingUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountZerotrustConnectivitySettingUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountZerotrustConnectivitySettingUpdateResponseMessageJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingUpdateResponseMessageJSON contains the JSON +// metadata for the struct +// [AccountZerotrustConnectivitySettingUpdateResponseMessage] +type accountZerotrustConnectivitySettingUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountZerotrustConnectivitySettingUpdateResponseResult struct { + // A flag to enable the ICMP proxy for the account network. + IcmpProxyEnabled bool `json:"icmp_proxy_enabled"` + // A flag to enable WARP to WARP traffic. + OfframpWarpEnabled bool `json:"offramp_warp_enabled"` + JSON accountZerotrustConnectivitySettingUpdateResponseResultJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingUpdateResponseResultJSON contains the JSON +// metadata for the struct +// [AccountZerotrustConnectivitySettingUpdateResponseResult] +type accountZerotrustConnectivitySettingUpdateResponseResultJSON struct { + IcmpProxyEnabled apijson.Field + OfframpWarpEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountZerotrustConnectivitySettingUpdateResponseSuccess bool + +const ( + AccountZerotrustConnectivitySettingUpdateResponseSuccessTrue AccountZerotrustConnectivitySettingUpdateResponseSuccess = true +) + +type AccountZerotrustConnectivitySettingListResponse struct { + Errors []AccountZerotrustConnectivitySettingListResponseError `json:"errors"` + Messages []AccountZerotrustConnectivitySettingListResponseMessage `json:"messages"` + Result AccountZerotrustConnectivitySettingListResponseResult `json:"result"` + // Whether the API call was successful + Success AccountZerotrustConnectivitySettingListResponseSuccess `json:"success"` + JSON accountZerotrustConnectivitySettingListResponseJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingListResponseJSON contains the JSON metadata +// for the struct [AccountZerotrustConnectivitySettingListResponse] +type accountZerotrustConnectivitySettingListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountZerotrustConnectivitySettingListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountZerotrustConnectivitySettingListResponseErrorJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingListResponseErrorJSON contains the JSON +// metadata for the struct [AccountZerotrustConnectivitySettingListResponseError] +type accountZerotrustConnectivitySettingListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountZerotrustConnectivitySettingListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accountZerotrustConnectivitySettingListResponseMessageJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingListResponseMessageJSON contains the JSON +// metadata for the struct [AccountZerotrustConnectivitySettingListResponseMessage] +type accountZerotrustConnectivitySettingListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AccountZerotrustConnectivitySettingListResponseResult struct { + // A flag to enable the ICMP proxy for the account network. + IcmpProxyEnabled bool `json:"icmp_proxy_enabled"` + // A flag to enable WARP to WARP traffic. + OfframpWarpEnabled bool `json:"offramp_warp_enabled"` + JSON accountZerotrustConnectivitySettingListResponseResultJSON `json:"-"` +} + +// accountZerotrustConnectivitySettingListResponseResultJSON contains the JSON +// metadata for the struct [AccountZerotrustConnectivitySettingListResponseResult] +type accountZerotrustConnectivitySettingListResponseResultJSON struct { + IcmpProxyEnabled apijson.Field + OfframpWarpEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountZerotrustConnectivitySettingListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AccountZerotrustConnectivitySettingListResponseSuccess bool + +const ( + AccountZerotrustConnectivitySettingListResponseSuccessTrue AccountZerotrustConnectivitySettingListResponseSuccess = true +) + +type AccountZerotrustConnectivitySettingUpdateParams struct { + // A flag to enable the ICMP proxy for the account network. + IcmpProxyEnabled param.Field[bool] `json:"icmp_proxy_enabled"` + // A flag to enable WARP to WARP traffic. + OfframpWarpEnabled param.Field[bool] `json:"offramp_warp_enabled"` +} + +func (r AccountZerotrustConnectivitySettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/accountzerotrustconnectivitysetting_test.go b/accountzerotrustconnectivitysetting_test.go new file mode 100644 index 00000000000..3e7fc5150f8 --- /dev/null +++ b/accountzerotrustconnectivitysetting_test.go @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAccountZerotrustConnectivitySettingUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Zerotrust.ConnectivitySettings.Update( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.AccountZerotrustConnectivitySettingUpdateParams{ + IcmpProxyEnabled: cloudflare.F(true), + OfframpWarpEnabled: cloudflare.F(true), + }, + ) + 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 TestAccountZerotrustConnectivitySettingList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Accounts.Zerotrust.ConnectivitySettings.List(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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.go b/addressing.go new file mode 100644 index 00000000000..d8605c58163 --- /dev/null +++ b/addressing.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AddressingService 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 [NewAddressingService] method instead. +type AddressingService struct { + Options []option.RequestOption + Prefixes *AddressingPrefixService +} + +// NewAddressingService 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 NewAddressingService(opts ...option.RequestOption) (r *AddressingService) { + r = &AddressingService{} + r.Options = opts + r.Prefixes = NewAddressingPrefixService(opts...) + return +} diff --git a/addressingprefix.go b/addressingprefix.go new file mode 100644 index 00000000000..884db03b4b1 --- /dev/null +++ b/addressingprefix.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AddressingPrefixService 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 [NewAddressingPrefixService] method +// instead. +type AddressingPrefixService struct { + Options []option.RequestOption + Bgp *AddressingPrefixBgpService +} + +// NewAddressingPrefixService 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 NewAddressingPrefixService(opts ...option.RequestOption) (r *AddressingPrefixService) { + r = &AddressingPrefixService{} + r.Options = opts + r.Bgp = NewAddressingPrefixBgpService(opts...) + return +} diff --git a/addressingprefixbgp.go b/addressingprefixbgp.go new file mode 100644 index 00000000000..61dca751aff --- /dev/null +++ b/addressingprefixbgp.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AddressingPrefixBgpService 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 [NewAddressingPrefixBgpService] +// method instead. +type AddressingPrefixBgpService struct { + Options []option.RequestOption + Prefixes *AddressingPrefixBgpPrefixService +} + +// NewAddressingPrefixBgpService 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 NewAddressingPrefixBgpService(opts ...option.RequestOption) (r *AddressingPrefixBgpService) { + r = &AddressingPrefixBgpService{} + r.Options = opts + r.Prefixes = NewAddressingPrefixBgpPrefixService(opts...) + return +} diff --git a/addressingprefixbgpprefix.go b/addressingprefixbgpprefix.go new file mode 100644 index 00000000000..be5ef7d5ccd --- /dev/null +++ b/addressingprefixbgpprefix.go @@ -0,0 +1,574 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AddressingPrefixBgpPrefixService 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 +// [NewAddressingPrefixBgpPrefixService] method instead. +type AddressingPrefixBgpPrefixService struct { + Options []option.RequestOption +} + +// NewAddressingPrefixBgpPrefixService 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 NewAddressingPrefixBgpPrefixService(opts ...option.RequestOption) (r *AddressingPrefixBgpPrefixService) { + r = &AddressingPrefixBgpPrefixService{} + r.Options = opts + return +} + +// Retrieve a single BGP Prefix according to its identifier +func (r *AddressingPrefixBgpPrefixService) Get(ctx context.Context, accountIdentifier string, prefixIdentifier string, bgpPrefixIdentifier string, opts ...option.RequestOption) (res *AddressingPrefixBgpPrefixGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes/%s", accountIdentifier, prefixIdentifier, bgpPrefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update the properties of a BGP Prefix, such as the on demand advertisement +// status (advertised or withdrawn). +func (r *AddressingPrefixBgpPrefixService) Update(ctx context.Context, accountIdentifier string, prefixIdentifier string, bgpPrefixIdentifier string, body AddressingPrefixBgpPrefixUpdateParams, opts ...option.RequestOption) (res *AddressingPrefixBgpPrefixUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes/%s", accountIdentifier, prefixIdentifier, bgpPrefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to +// control which specific subnets are advertised to the Internet. It is possible to +// advertise subnets more specific than an IP Prefix by creating more specific BGP +// Prefixes. +func (r *AddressingPrefixBgpPrefixService) List(ctx context.Context, accountIdentifier string, prefixIdentifier string, opts ...option.RequestOption) (res *AddressingPrefixBgpPrefixListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes", accountIdentifier, prefixIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type AddressingPrefixBgpPrefixGetResponse struct { + Errors []AddressingPrefixBgpPrefixGetResponseError `json:"errors"` + Messages []AddressingPrefixBgpPrefixGetResponseMessage `json:"messages"` + Result AddressingPrefixBgpPrefixGetResponseResult `json:"result"` + // Whether the API call was successful + Success AddressingPrefixBgpPrefixGetResponseSuccess `json:"success"` + JSON addressingPrefixBgpPrefixGetResponseJSON `json:"-"` +} + +// addressingPrefixBgpPrefixGetResponseJSON contains the JSON metadata for the +// struct [AddressingPrefixBgpPrefixGetResponse] +type addressingPrefixBgpPrefixGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressingPrefixBgpPrefixGetResponseErrorJSON `json:"-"` +} + +// addressingPrefixBgpPrefixGetResponseErrorJSON contains the JSON metadata for the +// struct [AddressingPrefixBgpPrefixGetResponseError] +type addressingPrefixBgpPrefixGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressingPrefixBgpPrefixGetResponseMessageJSON `json:"-"` +} + +// addressingPrefixBgpPrefixGetResponseMessageJSON contains the JSON metadata for +// the struct [AddressingPrefixBgpPrefixGetResponseMessage] +type addressingPrefixBgpPrefixGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixGetResponseResult struct { + // Identifier + ID string `json:"id"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + BgpSignalOpts AddressingPrefixBgpPrefixGetResponseResultBgpSignalOpts `json:"bgp_signal_opts"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + OnDemand AddressingPrefixBgpPrefixGetResponseResultOnDemand `json:"on_demand"` + JSON addressingPrefixBgpPrefixGetResponseResultJSON `json:"-"` +} + +// addressingPrefixBgpPrefixGetResponseResultJSON contains the JSON metadata for +// the struct [AddressingPrefixBgpPrefixGetResponseResult] +type addressingPrefixBgpPrefixGetResponseResultJSON struct { + ID apijson.Field + ASN apijson.Field + BgpSignalOpts apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + OnDemand apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixGetResponseResultBgpSignalOpts struct { + // Whether control of advertisement of the prefix to the Internet is enabled to be + // performed via BGP signal + Enabled bool `json:"enabled"` + // Last time BGP signaling control was toggled. This field is null if BGP signaling + // has never been enabled. + ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` + JSON addressingPrefixBgpPrefixGetResponseResultBgpSignalOptsJSON `json:"-"` +} + +// addressingPrefixBgpPrefixGetResponseResultBgpSignalOptsJSON contains the JSON +// metadata for the struct +// [AddressingPrefixBgpPrefixGetResponseResultBgpSignalOpts] +type addressingPrefixBgpPrefixGetResponseResultBgpSignalOptsJSON struct { + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixGetResponseResultBgpSignalOpts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixGetResponseResultOnDemand struct { + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON addressingPrefixBgpPrefixGetResponseResultOnDemandJSON `json:"-"` +} + +// addressingPrefixBgpPrefixGetResponseResultOnDemandJSON contains the JSON +// metadata for the struct [AddressingPrefixBgpPrefixGetResponseResultOnDemand] +type addressingPrefixBgpPrefixGetResponseResultOnDemandJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixGetResponseResultOnDemand) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AddressingPrefixBgpPrefixGetResponseSuccess bool + +const ( + AddressingPrefixBgpPrefixGetResponseSuccessTrue AddressingPrefixBgpPrefixGetResponseSuccess = true +) + +type AddressingPrefixBgpPrefixUpdateResponse struct { + Errors []AddressingPrefixBgpPrefixUpdateResponseError `json:"errors"` + Messages []AddressingPrefixBgpPrefixUpdateResponseMessage `json:"messages"` + Result AddressingPrefixBgpPrefixUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AddressingPrefixBgpPrefixUpdateResponseSuccess `json:"success"` + JSON addressingPrefixBgpPrefixUpdateResponseJSON `json:"-"` +} + +// addressingPrefixBgpPrefixUpdateResponseJSON contains the JSON metadata for the +// struct [AddressingPrefixBgpPrefixUpdateResponse] +type addressingPrefixBgpPrefixUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressingPrefixBgpPrefixUpdateResponseErrorJSON `json:"-"` +} + +// addressingPrefixBgpPrefixUpdateResponseErrorJSON contains the JSON metadata for +// the struct [AddressingPrefixBgpPrefixUpdateResponseError] +type addressingPrefixBgpPrefixUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressingPrefixBgpPrefixUpdateResponseMessageJSON `json:"-"` +} + +// addressingPrefixBgpPrefixUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AddressingPrefixBgpPrefixUpdateResponseMessage] +type addressingPrefixBgpPrefixUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixUpdateResponseResult struct { + // Identifier + ID string `json:"id"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + BgpSignalOpts AddressingPrefixBgpPrefixUpdateResponseResultBgpSignalOpts `json:"bgp_signal_opts"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + OnDemand AddressingPrefixBgpPrefixUpdateResponseResultOnDemand `json:"on_demand"` + JSON addressingPrefixBgpPrefixUpdateResponseResultJSON `json:"-"` +} + +// addressingPrefixBgpPrefixUpdateResponseResultJSON contains the JSON metadata for +// the struct [AddressingPrefixBgpPrefixUpdateResponseResult] +type addressingPrefixBgpPrefixUpdateResponseResultJSON struct { + ID apijson.Field + ASN apijson.Field + BgpSignalOpts apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + OnDemand apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixUpdateResponseResultBgpSignalOpts struct { + // Whether control of advertisement of the prefix to the Internet is enabled to be + // performed via BGP signal + Enabled bool `json:"enabled"` + // Last time BGP signaling control was toggled. This field is null if BGP signaling + // has never been enabled. + ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` + JSON addressingPrefixBgpPrefixUpdateResponseResultBgpSignalOptsJSON `json:"-"` +} + +// addressingPrefixBgpPrefixUpdateResponseResultBgpSignalOptsJSON contains the JSON +// metadata for the struct +// [AddressingPrefixBgpPrefixUpdateResponseResultBgpSignalOpts] +type addressingPrefixBgpPrefixUpdateResponseResultBgpSignalOptsJSON struct { + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixUpdateResponseResultBgpSignalOpts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixUpdateResponseResultOnDemand struct { + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON addressingPrefixBgpPrefixUpdateResponseResultOnDemandJSON `json:"-"` +} + +// addressingPrefixBgpPrefixUpdateResponseResultOnDemandJSON contains the JSON +// metadata for the struct [AddressingPrefixBgpPrefixUpdateResponseResultOnDemand] +type addressingPrefixBgpPrefixUpdateResponseResultOnDemandJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixUpdateResponseResultOnDemand) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AddressingPrefixBgpPrefixUpdateResponseSuccess bool + +const ( + AddressingPrefixBgpPrefixUpdateResponseSuccessTrue AddressingPrefixBgpPrefixUpdateResponseSuccess = true +) + +type AddressingPrefixBgpPrefixListResponse struct { + Errors []AddressingPrefixBgpPrefixListResponseError `json:"errors"` + Messages []AddressingPrefixBgpPrefixListResponseMessage `json:"messages"` + Result []AddressingPrefixBgpPrefixListResponseResult `json:"result"` + ResultInfo AddressingPrefixBgpPrefixListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AddressingPrefixBgpPrefixListResponseSuccess `json:"success"` + JSON addressingPrefixBgpPrefixListResponseJSON `json:"-"` +} + +// addressingPrefixBgpPrefixListResponseJSON contains the JSON metadata for the +// struct [AddressingPrefixBgpPrefixListResponse] +type addressingPrefixBgpPrefixListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressingPrefixBgpPrefixListResponseErrorJSON `json:"-"` +} + +// addressingPrefixBgpPrefixListResponseErrorJSON contains the JSON metadata for +// the struct [AddressingPrefixBgpPrefixListResponseError] +type addressingPrefixBgpPrefixListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressingPrefixBgpPrefixListResponseMessageJSON `json:"-"` +} + +// addressingPrefixBgpPrefixListResponseMessageJSON contains the JSON metadata for +// the struct [AddressingPrefixBgpPrefixListResponseMessage] +type addressingPrefixBgpPrefixListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixListResponseResult struct { + // Identifier + ID string `json:"id"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + BgpSignalOpts AddressingPrefixBgpPrefixListResponseResultBgpSignalOpts `json:"bgp_signal_opts"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + OnDemand AddressingPrefixBgpPrefixListResponseResultOnDemand `json:"on_demand"` + JSON addressingPrefixBgpPrefixListResponseResultJSON `json:"-"` +} + +// addressingPrefixBgpPrefixListResponseResultJSON contains the JSON metadata for +// the struct [AddressingPrefixBgpPrefixListResponseResult] +type addressingPrefixBgpPrefixListResponseResultJSON struct { + ID apijson.Field + ASN apijson.Field + BgpSignalOpts apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + OnDemand apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixListResponseResultBgpSignalOpts struct { + // Whether control of advertisement of the prefix to the Internet is enabled to be + // performed via BGP signal + Enabled bool `json:"enabled"` + // Last time BGP signaling control was toggled. This field is null if BGP signaling + // has never been enabled. + ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` + JSON addressingPrefixBgpPrefixListResponseResultBgpSignalOptsJSON `json:"-"` +} + +// addressingPrefixBgpPrefixListResponseResultBgpSignalOptsJSON contains the JSON +// metadata for the struct +// [AddressingPrefixBgpPrefixListResponseResultBgpSignalOpts] +type addressingPrefixBgpPrefixListResponseResultBgpSignalOptsJSON struct { + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixListResponseResultBgpSignalOpts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixListResponseResultOnDemand struct { + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON addressingPrefixBgpPrefixListResponseResultOnDemandJSON `json:"-"` +} + +// addressingPrefixBgpPrefixListResponseResultOnDemandJSON contains the JSON +// metadata for the struct [AddressingPrefixBgpPrefixListResponseResultOnDemand] +type addressingPrefixBgpPrefixListResponseResultOnDemandJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixListResponseResultOnDemand) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressingPrefixBgpPrefixListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON addressingPrefixBgpPrefixListResponseResultInfoJSON `json:"-"` +} + +// addressingPrefixBgpPrefixListResponseResultInfoJSON contains the JSON metadata +// for the struct [AddressingPrefixBgpPrefixListResponseResultInfo] +type addressingPrefixBgpPrefixListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressingPrefixBgpPrefixListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AddressingPrefixBgpPrefixListResponseSuccess bool + +const ( + AddressingPrefixBgpPrefixListResponseSuccessTrue AddressingPrefixBgpPrefixListResponseSuccess = true +) + +type AddressingPrefixBgpPrefixUpdateParams struct { + OnDemand param.Field[AddressingPrefixBgpPrefixUpdateParamsOnDemand] `json:"on_demand"` +} + +func (r AddressingPrefixBgpPrefixUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AddressingPrefixBgpPrefixUpdateParamsOnDemand struct { + Advertised param.Field[bool] `json:"advertised"` +} + +func (r AddressingPrefixBgpPrefixUpdateParamsOnDemand) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/addressingprefixbgpprefix_test.go b/addressingprefixbgpprefix_test.go new file mode 100644 index 00000000000..e42533c429a --- /dev/null +++ b/addressingprefixbgpprefix_test.go @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAddressingPrefixBgpPrefixGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Addressing.Prefixes.Bgp.Prefixes.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestAddressingPrefixBgpPrefixUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Addressing.Prefixes.Bgp.Prefixes.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AddressingPrefixBgpPrefixUpdateParams{ + OnDemand: cloudflare.F(cloudflare.AddressingPrefixBgpPrefixUpdateParamsOnDemand{ + Advertised: cloudflare.F(true), + }), + }, + ) + 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 TestAddressingPrefixBgpPrefixList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Addressing.Prefixes.Bgp.Prefixes.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/ai.go b/ai.go index 80da6e5420f..0e3bde7e1dc 100644 --- a/ai.go +++ b/ai.go @@ -17,13 +17,8 @@ import ( // from the environment automatically. You should not instantiate this service // directly, and instead use the [NewAIService] method instead. type AIService struct { - Options []option.RequestOption - Huggingface *AIHuggingfaceService - Baai *AIBaaiService - OpenAI *AIOpenAIService - Microsoft *AIMicrosoftService - Meta *AIMetaService - Mistral *AIMistralService + Options []option.RequestOption + Model *AIModelService } // NewAIService generates a new service that applies the given options to each @@ -32,12 +27,7 @@ type AIService struct { func NewAIService(opts ...option.RequestOption) (r *AIService) { r = &AIService{} r.Options = opts - r.Huggingface = NewAIHuggingfaceService(opts...) - r.Baai = NewAIBaaiService(opts...) - r.OpenAI = NewAIOpenAIService(opts...) - r.Microsoft = NewAIMicrosoftService(opts...) - r.Meta = NewAIMetaService(opts...) - r.Mistral = NewAIMistralService(opts...) + r.Model = NewAIModelService(opts...) return } diff --git a/ai_test.go b/ai_test.go index 38f6681d26e..a4ab0a90077 100644 --- a/ai_test.go +++ b/ai_test.go @@ -14,6 +14,7 @@ import ( ) func TestAIRun(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 @@ -23,8 +24,10 @@ func TestAIRun(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.AI.Run( context.TODO(), diff --git a/aibaai.go b/aibaai.go deleted file mode 100644 index a97aa9fecac..00000000000 --- a/aibaai.go +++ /dev/null @@ -1,163 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AIBaaiService 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 [NewAIBaaiService] method instead. -type AIBaaiService struct { - Options []option.RequestOption -} - -// NewAIBaaiService 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 NewAIBaaiService(opts ...option.RequestOption) (r *AIBaaiService) { - r = &AIBaaiService{} - r.Options = opts - return -} - -// Execute @cf/baai/bge-base-en-v1.5 model. -func (r *AIBaaiService) BgeBaseEnV1_5(ctx context.Context, accountIdentifier string, body AIBaaiBgeBaseEnV1_5Params, opts ...option.RequestOption) (res *AIBaaiBgeBaseEnV1_5Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/baai/bge-base-en-v1.5", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -// Execute @cf/baai/bge-large-en-v1.5 model. -func (r *AIBaaiService) BgeLargeEnV1_5(ctx context.Context, accountIdentifier string, body AIBaaiBgeLargeEnV1_5Params, opts ...option.RequestOption) (res *AIBaaiBgeLargeEnV1_5Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/baai/bge-large-en-v1.5", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -// Execute @cf/baai/bge-small-en-v1.5 model. -func (r *AIBaaiService) BgeSmallEnV1_5(ctx context.Context, accountIdentifier string, body AIBaaiBgeSmallEnV1_5Params, opts ...option.RequestOption) (res *AIBaaiBgeSmallEnV1_5Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/baai/bge-small-en-v1.5", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -type AIBaaiBgeBaseEnV1_5Response struct { - Data [][]float64 `json:"data"` - Shape []float64 `json:"shape"` - JSON aiBaaiBgeBaseEnV1_5ResponseJSON `json:"-"` -} - -// aiBaaiBgeBaseEnV1_5ResponseJSON contains the JSON metadata for the struct -// [AIBaaiBgeBaseEnV1_5Response] -type aiBaaiBgeBaseEnV1_5ResponseJSON struct { - Data apijson.Field - Shape apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIBaaiBgeBaseEnV1_5Response) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AIBaaiBgeLargeEnV1_5Response struct { - Data [][]float64 `json:"data"` - Shape []float64 `json:"shape"` - JSON aiBaaiBgeLargeEnV1_5ResponseJSON `json:"-"` -} - -// aiBaaiBgeLargeEnV1_5ResponseJSON contains the JSON metadata for the struct -// [AIBaaiBgeLargeEnV1_5Response] -type aiBaaiBgeLargeEnV1_5ResponseJSON struct { - Data apijson.Field - Shape apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIBaaiBgeLargeEnV1_5Response) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AIBaaiBgeSmallEnV1_5Response struct { - Data [][]float64 `json:"data"` - Shape []float64 `json:"shape"` - JSON aiBaaiBgeSmallEnV1_5ResponseJSON `json:"-"` -} - -// aiBaaiBgeSmallEnV1_5ResponseJSON contains the JSON metadata for the struct -// [AIBaaiBgeSmallEnV1_5Response] -type aiBaaiBgeSmallEnV1_5ResponseJSON struct { - Data apijson.Field - Shape apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIBaaiBgeSmallEnV1_5Response) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AIBaaiBgeBaseEnV1_5Params struct { - Text param.Field[AIBaaiBgeBaseEnV1_5ParamsText] `json:"text,required"` -} - -func (r AIBaaiBgeBaseEnV1_5Params) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Satisfied by [shared.UnionString], [AIBaaiBgeBaseEnV1_5ParamsTextArray]. -type AIBaaiBgeBaseEnV1_5ParamsText interface { - ImplementsAIBaaiBgeBaseEnV1_5ParamsText() -} - -type AIBaaiBgeBaseEnV1_5ParamsTextArray []string - -func (r AIBaaiBgeBaseEnV1_5ParamsTextArray) ImplementsAIBaaiBgeBaseEnV1_5ParamsText() {} - -type AIBaaiBgeLargeEnV1_5Params struct { - Text param.Field[AIBaaiBgeLargeEnV1_5ParamsText] `json:"text,required"` -} - -func (r AIBaaiBgeLargeEnV1_5Params) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Satisfied by [shared.UnionString], [AIBaaiBgeLargeEnV1_5ParamsTextArray]. -type AIBaaiBgeLargeEnV1_5ParamsText interface { - ImplementsAIBaaiBgeLargeEnV1_5ParamsText() -} - -type AIBaaiBgeLargeEnV1_5ParamsTextArray []string - -func (r AIBaaiBgeLargeEnV1_5ParamsTextArray) ImplementsAIBaaiBgeLargeEnV1_5ParamsText() {} - -type AIBaaiBgeSmallEnV1_5Params struct { - Text param.Field[AIBaaiBgeSmallEnV1_5ParamsText] `json:"text,required"` -} - -func (r AIBaaiBgeSmallEnV1_5Params) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Satisfied by [shared.UnionString], [AIBaaiBgeSmallEnV1_5ParamsTextArray]. -type AIBaaiBgeSmallEnV1_5ParamsText interface { - ImplementsAIBaaiBgeSmallEnV1_5ParamsText() -} - -type AIBaaiBgeSmallEnV1_5ParamsTextArray []string - -func (r AIBaaiBgeSmallEnV1_5ParamsTextArray) ImplementsAIBaaiBgeSmallEnV1_5ParamsText() {} diff --git a/aihuggingface.go b/aihuggingface.go deleted file mode 100644 index b7553d9b8fc..00000000000 --- a/aihuggingface.go +++ /dev/null @@ -1,67 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AIHuggingfaceService 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 [NewAIHuggingfaceService] method -// instead. -type AIHuggingfaceService struct { - Options []option.RequestOption -} - -// NewAIHuggingfaceService 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 NewAIHuggingfaceService(opts ...option.RequestOption) (r *AIHuggingfaceService) { - r = &AIHuggingfaceService{} - r.Options = opts - return -} - -// Execute @cf/huggingface/distilbert-sst-2-int8 model. -func (r *AIHuggingfaceService) DistilbertSst2Int8(ctx context.Context, accountIdentifier string, body AIHuggingfaceDistilbertSst2Int8Params, opts ...option.RequestOption) (res *[]AIHuggingfaceDistilbertSst2Int8Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/huggingface/distilbert-sst-2-int8", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -type AIHuggingfaceDistilbertSst2Int8Response struct { - Label string `json:"label"` - Score float64 `json:"score"` - JSON aiHuggingfaceDistilbertSst2Int8ResponseJSON `json:"-"` -} - -// aiHuggingfaceDistilbertSst2Int8ResponseJSON contains the JSON metadata for the -// struct [AIHuggingfaceDistilbertSst2Int8Response] -type aiHuggingfaceDistilbertSst2Int8ResponseJSON struct { - Label apijson.Field - Score apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIHuggingfaceDistilbertSst2Int8Response) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AIHuggingfaceDistilbertSst2Int8Params struct { - Text param.Field[string] `json:"text,required"` -} - -func (r AIHuggingfaceDistilbertSst2Int8Params) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} diff --git a/aimeta.go b/aimeta.go deleted file mode 100644 index 665403a9611..00000000000 --- a/aimeta.go +++ /dev/null @@ -1,241 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "reflect" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/internal/shared" - "github.com/cloudflare/cloudflare-sdk-go/option" - "github.com/tidwall/gjson" -) - -// AIMetaService 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 [NewAIMetaService] method instead. -type AIMetaService struct { - Options []option.RequestOption -} - -// NewAIMetaService 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 NewAIMetaService(opts ...option.RequestOption) (r *AIMetaService) { - r = &AIMetaService{} - r.Options = opts - return -} - -// Execute @cf/meta/llama-2-7b-chat-fp16 model. -func (r *AIMetaService) Llama2_7bChatFp16(ctx context.Context, accountIdentifier string, body AIMetaLlama2_7bChatFp16Params, opts ...option.RequestOption) (res *AIMetaLlama2_7bChatFp16Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/meta/llama-2-7b-chat-fp16", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -// Execute @cf/meta/llama-2-7b-chat-int8 model. -func (r *AIMetaService) Llama2_7bChatInt8(ctx context.Context, accountIdentifier string, body AIMetaLlama2_7bChatInt8Params, opts ...option.RequestOption) (res *AIMetaLlama2_7bChatInt8Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/meta/llama-2-7b-chat-int8", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -// Execute @cf/meta/m2m100-1.2b model. -func (r *AIMetaService) M2m100_1_2b(ctx context.Context, accountIdentifier string, body AIMetaM2m100_1_2bParams, opts ...option.RequestOption) (res *AIMetaM2m100_1_2bResponse, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/meta/m2m100-1.2b", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -// Union satisfied by [AIMetaLlama2_7bChatFp16ResponseObject] or -// [shared.UnionString]. -type AIMetaLlama2_7bChatFp16Response interface { - ImplementsAIMetaLlama2_7bChatFp16Response() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*AIMetaLlama2_7bChatFp16Response)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - DiscriminatorValue: "", - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type AIMetaLlama2_7bChatFp16ResponseObject struct { - Response string `json:"response"` - JSON aiMetaLlama2_7bChatFp16ResponseObjectJSON `json:"-"` -} - -// aiMetaLlama2_7bChatFp16ResponseObjectJSON contains the JSON metadata for the -// struct [AIMetaLlama2_7bChatFp16ResponseObject] -type aiMetaLlama2_7bChatFp16ResponseObjectJSON struct { - Response apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIMetaLlama2_7bChatFp16ResponseObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r AIMetaLlama2_7bChatFp16ResponseObject) ImplementsAIMetaLlama2_7bChatFp16Response() {} - -// Union satisfied by [AIMetaLlama2_7bChatInt8ResponseObject] or -// [shared.UnionString]. -type AIMetaLlama2_7bChatInt8Response interface { - ImplementsAIMetaLlama2_7bChatInt8Response() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*AIMetaLlama2_7bChatInt8Response)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - DiscriminatorValue: "", - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type AIMetaLlama2_7bChatInt8ResponseObject struct { - Response string `json:"response"` - JSON aiMetaLlama2_7bChatInt8ResponseObjectJSON `json:"-"` -} - -// aiMetaLlama2_7bChatInt8ResponseObjectJSON contains the JSON metadata for the -// struct [AIMetaLlama2_7bChatInt8ResponseObject] -type aiMetaLlama2_7bChatInt8ResponseObjectJSON struct { - Response apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIMetaLlama2_7bChatInt8ResponseObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r AIMetaLlama2_7bChatInt8ResponseObject) ImplementsAIMetaLlama2_7bChatInt8Response() {} - -type AIMetaM2m100_1_2bResponse struct { - TranslatedText string `json:"translated_text"` - JSON aiMetaM2m100_1_2bResponseJSON `json:"-"` -} - -// aiMetaM2m100_1_2bResponseJSON contains the JSON metadata for the struct -// [AIMetaM2m100_1_2bResponse] -type aiMetaM2m100_1_2bResponseJSON struct { - TranslatedText apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIMetaM2m100_1_2bResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// This interface is a union satisfied by one of the following: -// [AIMetaLlama2_7bChatFp16ParamsVariant0], -// [AIMetaLlama2_7bChatFp16ParamsVariant1]. -type AIMetaLlama2_7bChatFp16Params interface { - ImplementsAIMetaLlama2_7bChatFp16Params() -} - -type AIMetaLlama2_7bChatFp16ParamsVariant0 struct { - Prompt param.Field[string] `json:"prompt,required"` - Stream param.Field[bool] `json:"stream"` -} - -func (r AIMetaLlama2_7bChatFp16ParamsVariant0) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (AIMetaLlama2_7bChatFp16ParamsVariant0) ImplementsAIMetaLlama2_7bChatFp16Params() { - -} - -type AIMetaLlama2_7bChatFp16ParamsVariant1 struct { - Messages param.Field[[]AIMetaLlama2_7bChatFp16ParamsVariant1Message] `json:"messages,required"` -} - -func (r AIMetaLlama2_7bChatFp16ParamsVariant1) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (AIMetaLlama2_7bChatFp16ParamsVariant1) ImplementsAIMetaLlama2_7bChatFp16Params() { - -} - -type AIMetaLlama2_7bChatFp16ParamsVariant1Message struct { - Content param.Field[string] `json:"content,required"` - Role param.Field[string] `json:"role,required"` -} - -func (r AIMetaLlama2_7bChatFp16ParamsVariant1Message) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// This interface is a union satisfied by one of the following: -// [AIMetaLlama2_7bChatInt8ParamsVariant0], -// [AIMetaLlama2_7bChatInt8ParamsVariant1]. -type AIMetaLlama2_7bChatInt8Params interface { - ImplementsAIMetaLlama2_7bChatInt8Params() -} - -type AIMetaLlama2_7bChatInt8ParamsVariant0 struct { - Prompt param.Field[string] `json:"prompt,required"` - Stream param.Field[bool] `json:"stream"` -} - -func (r AIMetaLlama2_7bChatInt8ParamsVariant0) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (AIMetaLlama2_7bChatInt8ParamsVariant0) ImplementsAIMetaLlama2_7bChatInt8Params() { - -} - -type AIMetaLlama2_7bChatInt8ParamsVariant1 struct { - Messages param.Field[[]AIMetaLlama2_7bChatInt8ParamsVariant1Message] `json:"messages,required"` -} - -func (r AIMetaLlama2_7bChatInt8ParamsVariant1) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (AIMetaLlama2_7bChatInt8ParamsVariant1) ImplementsAIMetaLlama2_7bChatInt8Params() { - -} - -type AIMetaLlama2_7bChatInt8ParamsVariant1Message struct { - Content param.Field[string] `json:"content,required"` - Role param.Field[string] `json:"role,required"` -} - -func (r AIMetaLlama2_7bChatInt8ParamsVariant1Message) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type AIMetaM2m100_1_2bParams struct { - TargetLang param.Field[string] `json:"target_lang,required"` - Text param.Field[string] `json:"text,required"` - SourceLang param.Field[string] `json:"source_lang"` -} - -func (r AIMetaM2m100_1_2bParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} diff --git a/aimicrosoft.go b/aimicrosoft.go deleted file mode 100644 index db6178834cf..00000000000 --- a/aimicrosoft.go +++ /dev/null @@ -1,58 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AIMicrosoftService 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 [NewAIMicrosoftService] method -// instead. -type AIMicrosoftService struct { - Options []option.RequestOption -} - -// NewAIMicrosoftService 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 NewAIMicrosoftService(opts ...option.RequestOption) (r *AIMicrosoftService) { - r = &AIMicrosoftService{} - r.Options = opts - return -} - -// Execute @cf/microsoft/resnet-50 model. -func (r *AIMicrosoftService) Resnet50(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *[]AIMicrosoftResnet50Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/microsoft/resnet-50", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) - return -} - -type AIMicrosoftResnet50Response struct { - Label string `json:"label"` - Score float64 `json:"score"` - JSON aiMicrosoftResnet50ResponseJSON `json:"-"` -} - -// aiMicrosoftResnet50ResponseJSON contains the JSON metadata for the struct -// [AIMicrosoftResnet50Response] -type aiMicrosoftResnet50ResponseJSON struct { - Label apijson.Field - Score apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIMicrosoftResnet50Response) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/aimistral.go b/aimistral.go deleted file mode 100644 index fe962bb4e0a..00000000000 --- a/aimistral.go +++ /dev/null @@ -1,121 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "reflect" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/internal/shared" - "github.com/cloudflare/cloudflare-sdk-go/option" - "github.com/tidwall/gjson" -) - -// AIMistralService 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 [NewAIMistralService] method instead. -type AIMistralService struct { - Options []option.RequestOption -} - -// NewAIMistralService 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 NewAIMistralService(opts ...option.RequestOption) (r *AIMistralService) { - r = &AIMistralService{} - r.Options = opts - return -} - -// Execute @cf/mistral/mistral-7b-instruct-v0.1 model. -func (r *AIMistralService) Mistral7bInstructV0_1(ctx context.Context, accountIdentifier string, body AIMistralMistral7bInstructV0_1Params, opts ...option.RequestOption) (res *AIMistralMistral7bInstructV0_1Response, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/mistral/mistral-7b-instruct-v0.1", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return -} - -// Union satisfied by [AIMistralMistral7bInstructV0_1ResponseObject] or -// [shared.UnionString]. -type AIMistralMistral7bInstructV0_1Response interface { - ImplementsAIMistralMistral7bInstructV0_1Response() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*AIMistralMistral7bInstructV0_1Response)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - DiscriminatorValue: "", - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type AIMistralMistral7bInstructV0_1ResponseObject struct { - Response string `json:"response"` - JSON aiMistralMistral7bInstructV0_1ResponseObjectJSON `json:"-"` -} - -// aiMistralMistral7bInstructV0_1ResponseObjectJSON contains the JSON metadata for -// the struct [AIMistralMistral7bInstructV0_1ResponseObject] -type aiMistralMistral7bInstructV0_1ResponseObjectJSON struct { - Response apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIMistralMistral7bInstructV0_1ResponseObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r AIMistralMistral7bInstructV0_1ResponseObject) ImplementsAIMistralMistral7bInstructV0_1Response() { -} - -// This interface is a union satisfied by one of the following: -// [AIMistralMistral7bInstructV0_1ParamsVariant0], -// [AIMistralMistral7bInstructV0_1ParamsVariant1]. -type AIMistralMistral7bInstructV0_1Params interface { - ImplementsAIMistralMistral7bInstructV0_1Params() -} - -type AIMistralMistral7bInstructV0_1ParamsVariant0 struct { - Prompt param.Field[string] `json:"prompt,required"` - Stream param.Field[bool] `json:"stream"` -} - -func (r AIMistralMistral7bInstructV0_1ParamsVariant0) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (AIMistralMistral7bInstructV0_1ParamsVariant0) ImplementsAIMistralMistral7bInstructV0_1Params() { - -} - -type AIMistralMistral7bInstructV0_1ParamsVariant1 struct { - Messages param.Field[[]AIMistralMistral7bInstructV0_1ParamsVariant1Message] `json:"messages,required"` -} - -func (r AIMistralMistral7bInstructV0_1ParamsVariant1) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (AIMistralMistral7bInstructV0_1ParamsVariant1) ImplementsAIMistralMistral7bInstructV0_1Params() { - -} - -type AIMistralMistral7bInstructV0_1ParamsVariant1Message struct { - Content param.Field[string] `json:"content,required"` - Role param.Field[string] `json:"role,required"` -} - -func (r AIMistralMistral7bInstructV0_1ParamsVariant1Message) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} diff --git a/aimodel.go b/aimodel.go new file mode 100644 index 00000000000..f163aa5e2b8 --- /dev/null +++ b/aimodel.go @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelService 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 [NewAIModelService] method instead. +type AIModelService struct { + Options []option.RequestOption + ImageClassification *AIModelImageClassificationService + SpeechRecognition *AIModelSpeechRecognitionService + TextClassification *AIModelTextClassificationService + TextEmbeddings *AIModelTextEmbeddingService + TextGeneration *AIModelTextGenerationService + Translation *AIModelTranslationService +} + +// NewAIModelService 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 NewAIModelService(opts ...option.RequestOption) (r *AIModelService) { + r = &AIModelService{} + r.Options = opts + r.ImageClassification = NewAIModelImageClassificationService(opts...) + r.SpeechRecognition = NewAIModelSpeechRecognitionService(opts...) + r.TextClassification = NewAIModelTextClassificationService(opts...) + r.TextEmbeddings = NewAIModelTextEmbeddingService(opts...) + r.TextGeneration = NewAIModelTextGenerationService(opts...) + r.Translation = NewAIModelTranslationService(opts...) + return +} diff --git a/aimodelimageclassification.go b/aimodelimageclassification.go new file mode 100644 index 00000000000..c42b467ae4e --- /dev/null +++ b/aimodelimageclassification.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelImageClassificationService 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 +// [NewAIModelImageClassificationService] method instead. +type AIModelImageClassificationService struct { + Options []option.RequestOption + Resnet50 *AIModelImageClassificationResnet50Service +} + +// NewAIModelImageClassificationService 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 NewAIModelImageClassificationService(opts ...option.RequestOption) (r *AIModelImageClassificationService) { + r = &AIModelImageClassificationService{} + r.Options = opts + r.Resnet50 = NewAIModelImageClassificationResnet50Service(opts...) + return +} diff --git a/aimodelimageclassificationresnet50.go b/aimodelimageclassificationresnet50.go new file mode 100644 index 00000000000..7bbb71d002e --- /dev/null +++ b/aimodelimageclassificationresnet50.go @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelImageClassificationResnet50Service 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 +// [NewAIModelImageClassificationResnet50Service] method instead. +type AIModelImageClassificationResnet50Service struct { + Options []option.RequestOption +} + +// NewAIModelImageClassificationResnet50Service 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 NewAIModelImageClassificationResnet50Service(opts ...option.RequestOption) (r *AIModelImageClassificationResnet50Service) { + r = &AIModelImageClassificationResnet50Service{} + r.Options = opts + return +} + +// Execute @cf/microsoft/resnet-50 model. +func (r *AIModelImageClassificationResnet50Service) Run(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *[]AIModelImageClassificationResnet50RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/microsoft/resnet-50", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AIModelImageClassificationResnet50RunResponse struct { + Label string `json:"label"` + Score float64 `json:"score"` + JSON aiModelImageClassificationResnet50RunResponseJSON `json:"-"` +} + +// aiModelImageClassificationResnet50RunResponseJSON contains the JSON metadata for +// the struct [AIModelImageClassificationResnet50RunResponse] +type aiModelImageClassificationResnet50RunResponseJSON struct { + Label apijson.Field + Score apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelImageClassificationResnet50RunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/aimodelimageclassificationresnet50_test.go b/aimodelimageclassificationresnet50_test.go new file mode 100644 index 00000000000..62985a9e828 --- /dev/null +++ b/aimodelimageclassificationresnet50_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelImageClassificationResnet50Run(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.ImageClassification.Resnet50.Run(context.TODO(), "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/aimodelspeechrecognition.go b/aimodelspeechrecognition.go new file mode 100644 index 00000000000..e543c3d2c25 --- /dev/null +++ b/aimodelspeechrecognition.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelSpeechRecognitionService 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 +// [NewAIModelSpeechRecognitionService] method instead. +type AIModelSpeechRecognitionService struct { + Options []option.RequestOption + Whisper *AIModelSpeechRecognitionWhisperService +} + +// NewAIModelSpeechRecognitionService 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 NewAIModelSpeechRecognitionService(opts ...option.RequestOption) (r *AIModelSpeechRecognitionService) { + r = &AIModelSpeechRecognitionService{} + r.Options = opts + r.Whisper = NewAIModelSpeechRecognitionWhisperService(opts...) + return +} diff --git a/aimodelspeechrecognitionwhisper.go b/aimodelspeechrecognitionwhisper.go new file mode 100644 index 00000000000..0bf712c520d --- /dev/null +++ b/aimodelspeechrecognitionwhisper.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelSpeechRecognitionWhisperService 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 +// [NewAIModelSpeechRecognitionWhisperService] method instead. +type AIModelSpeechRecognitionWhisperService struct { + Options []option.RequestOption +} + +// NewAIModelSpeechRecognitionWhisperService 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 NewAIModelSpeechRecognitionWhisperService(opts ...option.RequestOption) (r *AIModelSpeechRecognitionWhisperService) { + r = &AIModelSpeechRecognitionWhisperService{} + r.Options = opts + return +} + +// Execute @cf/openai/whisper model. +func (r *AIModelSpeechRecognitionWhisperService) Run(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AIModelSpeechRecognitionWhisperRunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/openai/whisper", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type AIModelSpeechRecognitionWhisperRunResponse struct { + Text string `json:"text"` + JSON aiModelSpeechRecognitionWhisperRunResponseJSON `json:"-"` +} + +// aiModelSpeechRecognitionWhisperRunResponseJSON contains the JSON metadata for +// the struct [AIModelSpeechRecognitionWhisperRunResponse] +type aiModelSpeechRecognitionWhisperRunResponseJSON struct { + Text apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelSpeechRecognitionWhisperRunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/aimodelspeechrecognitionwhisper_test.go b/aimodelspeechrecognitionwhisper_test.go new file mode 100644 index 00000000000..5e4bdb632ab --- /dev/null +++ b/aimodelspeechrecognitionwhisper_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelSpeechRecognitionWhisperRun(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.SpeechRecognition.Whisper.Run(context.TODO(), "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/aimodeltextclassification.go b/aimodeltextclassification.go new file mode 100644 index 00000000000..a3306769bd9 --- /dev/null +++ b/aimodeltextclassification.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTextClassificationService 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 +// [NewAIModelTextClassificationService] method instead. +type AIModelTextClassificationService struct { + Options []option.RequestOption + DistilbertSst2Int8 *AIModelTextClassificationDistilbertSst2Int8Service +} + +// NewAIModelTextClassificationService 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 NewAIModelTextClassificationService(opts ...option.RequestOption) (r *AIModelTextClassificationService) { + r = &AIModelTextClassificationService{} + r.Options = opts + r.DistilbertSst2Int8 = NewAIModelTextClassificationDistilbertSst2Int8Service(opts...) + return +} diff --git a/aimodeltextclassificationdistilbertsst2int8.go b/aimodeltextclassificationdistilbertsst2int8.go new file mode 100644 index 00000000000..d7e3d340305 --- /dev/null +++ b/aimodeltextclassificationdistilbertsst2int8.go @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTextClassificationDistilbertSst2Int8Service 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 [NewAIModelTextClassificationDistilbertSst2Int8Service] method instead. +type AIModelTextClassificationDistilbertSst2Int8Service struct { + Options []option.RequestOption +} + +// NewAIModelTextClassificationDistilbertSst2Int8Service 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 NewAIModelTextClassificationDistilbertSst2Int8Service(opts ...option.RequestOption) (r *AIModelTextClassificationDistilbertSst2Int8Service) { + r = &AIModelTextClassificationDistilbertSst2Int8Service{} + r.Options = opts + return +} + +// Execute @cf/huggingface/distilbert-sst-2-int8 model. +func (r *AIModelTextClassificationDistilbertSst2Int8Service) Run(ctx context.Context, accountIdentifier string, body AIModelTextClassificationDistilbertSst2Int8RunParams, opts ...option.RequestOption) (res *[]AIModelTextClassificationDistilbertSst2Int8RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/huggingface/distilbert-sst-2-int8", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AIModelTextClassificationDistilbertSst2Int8RunResponse struct { + Label string `json:"label"` + Score float64 `json:"score"` + JSON aiModelTextClassificationDistilbertSst2Int8RunResponseJSON `json:"-"` +} + +// aiModelTextClassificationDistilbertSst2Int8RunResponseJSON contains the JSON +// metadata for the struct [AIModelTextClassificationDistilbertSst2Int8RunResponse] +type aiModelTextClassificationDistilbertSst2Int8RunResponseJSON struct { + Label apijson.Field + Score apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTextClassificationDistilbertSst2Int8RunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AIModelTextClassificationDistilbertSst2Int8RunParams struct { + Text param.Field[string] `json:"text,required"` +} + +func (r AIModelTextClassificationDistilbertSst2Int8RunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/aimodeltextclassificationdistilbertsst2int8_test.go b/aimodeltextclassificationdistilbertsst2int8_test.go new file mode 100644 index 00000000000..8f21233bb69 --- /dev/null +++ b/aimodeltextclassificationdistilbertsst2int8_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTextClassificationDistilbertSst2Int8Run(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.TextClassification.DistilbertSst2Int8.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTextClassificationDistilbertSst2Int8RunParams{ + Text: cloudflare.F("string"), + }, + ) + 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/aimodeltextembedding.go b/aimodeltextembedding.go new file mode 100644 index 00000000000..adb87be62a4 --- /dev/null +++ b/aimodeltextembedding.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTextEmbeddingService 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 [NewAIModelTextEmbeddingService] +// method instead. +type AIModelTextEmbeddingService struct { + Options []option.RequestOption + BgeSmallEnV1_5 *AIModelTextEmbeddingBgeSmallEnV1_5Service + BgeBaseEnV1_5 *AIModelTextEmbeddingBgeBaseEnV1_5Service + BgeLargeEnV1_5 *AIModelTextEmbeddingBgeLargeEnV1_5Service +} + +// NewAIModelTextEmbeddingService 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 NewAIModelTextEmbeddingService(opts ...option.RequestOption) (r *AIModelTextEmbeddingService) { + r = &AIModelTextEmbeddingService{} + r.Options = opts + r.BgeSmallEnV1_5 = NewAIModelTextEmbeddingBgeSmallEnV1_5Service(opts...) + r.BgeBaseEnV1_5 = NewAIModelTextEmbeddingBgeBaseEnV1_5Service(opts...) + r.BgeLargeEnV1_5 = NewAIModelTextEmbeddingBgeLargeEnV1_5Service(opts...) + return +} diff --git a/aimodeltextembeddingbgebaseenv15.go b/aimodeltextembeddingbgebaseenv15.go new file mode 100644 index 00000000000..dc36f055e24 --- /dev/null +++ b/aimodeltextembeddingbgebaseenv15.go @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTextEmbeddingBgeBaseEnV1_5Service 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 +// [NewAIModelTextEmbeddingBgeBaseEnV1_5Service] method instead. +type AIModelTextEmbeddingBgeBaseEnV1_5Service struct { + Options []option.RequestOption +} + +// NewAIModelTextEmbeddingBgeBaseEnV1_5Service 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 NewAIModelTextEmbeddingBgeBaseEnV1_5Service(opts ...option.RequestOption) (r *AIModelTextEmbeddingBgeBaseEnV1_5Service) { + r = &AIModelTextEmbeddingBgeBaseEnV1_5Service{} + r.Options = opts + return +} + +// Execute @cf/baai/bge-base-en-v1.5 model. +func (r *AIModelTextEmbeddingBgeBaseEnV1_5Service) Run(ctx context.Context, accountIdentifier string, body AIModelTextEmbeddingBgeBaseEnV1_5RunParams, opts ...option.RequestOption) (res *AIModelTextEmbeddingBgeBaseEnV1_5RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/baai/bge-base-en-v1.5", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AIModelTextEmbeddingBgeBaseEnV1_5RunResponse struct { + Data [][]float64 `json:"data"` + Shape []float64 `json:"shape"` + JSON aiModelTextEmbeddingBgeBaseEnV1_5RunResponseJSON `json:"-"` +} + +// aiModelTextEmbeddingBgeBaseEnV1_5RunResponseJSON contains the JSON metadata for +// the struct [AIModelTextEmbeddingBgeBaseEnV1_5RunResponse] +type aiModelTextEmbeddingBgeBaseEnV1_5RunResponseJSON struct { + Data apijson.Field + Shape apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTextEmbeddingBgeBaseEnV1_5RunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AIModelTextEmbeddingBgeBaseEnV1_5RunParams struct { + Text param.Field[AIModelTextEmbeddingBgeBaseEnV1_5RunParamsText] `json:"text,required"` +} + +func (r AIModelTextEmbeddingBgeBaseEnV1_5RunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Satisfied by [shared.UnionString], +// [AIModelTextEmbeddingBgeBaseEnV1_5RunParamsTextArray]. +type AIModelTextEmbeddingBgeBaseEnV1_5RunParamsText interface { + ImplementsAIModelTextEmbeddingBgeBaseEnV1_5RunParamsText() +} + +type AIModelTextEmbeddingBgeBaseEnV1_5RunParamsTextArray []string + +func (r AIModelTextEmbeddingBgeBaseEnV1_5RunParamsTextArray) ImplementsAIModelTextEmbeddingBgeBaseEnV1_5RunParamsText() { +} diff --git a/aimodeltextembeddingbgebaseenv15_test.go b/aimodeltextembeddingbgebaseenv15_test.go new file mode 100644 index 00000000000..227e0da6da7 --- /dev/null +++ b/aimodeltextembeddingbgebaseenv15_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTextEmbeddingBgeBaseEnV1_5Run(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.TextEmbeddings.BgeBaseEnV1_5.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTextEmbeddingBgeBaseEnV1_5RunParams{ + Text: cloudflare.F[cloudflare.AIModelTextEmbeddingBgeBaseEnV1_5RunParamsText](shared.UnionString("string")), + }, + ) + 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/aimodeltextembeddingbgelargeenv15.go b/aimodeltextembeddingbgelargeenv15.go new file mode 100644 index 00000000000..1ba5dad8165 --- /dev/null +++ b/aimodeltextembeddingbgelargeenv15.go @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTextEmbeddingBgeLargeEnV1_5Service 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 +// [NewAIModelTextEmbeddingBgeLargeEnV1_5Service] method instead. +type AIModelTextEmbeddingBgeLargeEnV1_5Service struct { + Options []option.RequestOption +} + +// NewAIModelTextEmbeddingBgeLargeEnV1_5Service 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 NewAIModelTextEmbeddingBgeLargeEnV1_5Service(opts ...option.RequestOption) (r *AIModelTextEmbeddingBgeLargeEnV1_5Service) { + r = &AIModelTextEmbeddingBgeLargeEnV1_5Service{} + r.Options = opts + return +} + +// Execute @cf/baai/bge-large-en-v1.5 model. +func (r *AIModelTextEmbeddingBgeLargeEnV1_5Service) Run(ctx context.Context, accountIdentifier string, body AIModelTextEmbeddingBgeLargeEnV1_5RunParams, opts ...option.RequestOption) (res *AIModelTextEmbeddingBgeLargeEnV1_5RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/baai/bge-large-en-v1.5", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AIModelTextEmbeddingBgeLargeEnV1_5RunResponse struct { + Data [][]float64 `json:"data"` + Shape []float64 `json:"shape"` + JSON aiModelTextEmbeddingBgeLargeEnV1_5RunResponseJSON `json:"-"` +} + +// aiModelTextEmbeddingBgeLargeEnV1_5RunResponseJSON contains the JSON metadata for +// the struct [AIModelTextEmbeddingBgeLargeEnV1_5RunResponse] +type aiModelTextEmbeddingBgeLargeEnV1_5RunResponseJSON struct { + Data apijson.Field + Shape apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTextEmbeddingBgeLargeEnV1_5RunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AIModelTextEmbeddingBgeLargeEnV1_5RunParams struct { + Text param.Field[AIModelTextEmbeddingBgeLargeEnV1_5RunParamsText] `json:"text,required"` +} + +func (r AIModelTextEmbeddingBgeLargeEnV1_5RunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Satisfied by [shared.UnionString], +// [AIModelTextEmbeddingBgeLargeEnV1_5RunParamsTextArray]. +type AIModelTextEmbeddingBgeLargeEnV1_5RunParamsText interface { + ImplementsAIModelTextEmbeddingBgeLargeEnV1_5RunParamsText() +} + +type AIModelTextEmbeddingBgeLargeEnV1_5RunParamsTextArray []string + +func (r AIModelTextEmbeddingBgeLargeEnV1_5RunParamsTextArray) ImplementsAIModelTextEmbeddingBgeLargeEnV1_5RunParamsText() { +} diff --git a/aimodeltextembeddingbgelargeenv15_test.go b/aimodeltextembeddingbgelargeenv15_test.go new file mode 100644 index 00000000000..1398b015f8d --- /dev/null +++ b/aimodeltextembeddingbgelargeenv15_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTextEmbeddingBgeLargeEnV1_5Run(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.TextEmbeddings.BgeLargeEnV1_5.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTextEmbeddingBgeLargeEnV1_5RunParams{ + Text: cloudflare.F[cloudflare.AIModelTextEmbeddingBgeLargeEnV1_5RunParamsText](shared.UnionString("string")), + }, + ) + 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/aimodeltextembeddingbgesmallenv15.go b/aimodeltextembeddingbgesmallenv15.go new file mode 100644 index 00000000000..9df8ef0b520 --- /dev/null +++ b/aimodeltextembeddingbgesmallenv15.go @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTextEmbeddingBgeSmallEnV1_5Service 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 +// [NewAIModelTextEmbeddingBgeSmallEnV1_5Service] method instead. +type AIModelTextEmbeddingBgeSmallEnV1_5Service struct { + Options []option.RequestOption +} + +// NewAIModelTextEmbeddingBgeSmallEnV1_5Service 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 NewAIModelTextEmbeddingBgeSmallEnV1_5Service(opts ...option.RequestOption) (r *AIModelTextEmbeddingBgeSmallEnV1_5Service) { + r = &AIModelTextEmbeddingBgeSmallEnV1_5Service{} + r.Options = opts + return +} + +// Execute @cf/baai/bge-small-en-v1.5 model. +func (r *AIModelTextEmbeddingBgeSmallEnV1_5Service) Run(ctx context.Context, accountIdentifier string, body AIModelTextEmbeddingBgeSmallEnV1_5RunParams, opts ...option.RequestOption) (res *AIModelTextEmbeddingBgeSmallEnV1_5RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/baai/bge-small-en-v1.5", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AIModelTextEmbeddingBgeSmallEnV1_5RunResponse struct { + Data [][]float64 `json:"data"` + Shape []float64 `json:"shape"` + JSON aiModelTextEmbeddingBgeSmallEnV1_5RunResponseJSON `json:"-"` +} + +// aiModelTextEmbeddingBgeSmallEnV1_5RunResponseJSON contains the JSON metadata for +// the struct [AIModelTextEmbeddingBgeSmallEnV1_5RunResponse] +type aiModelTextEmbeddingBgeSmallEnV1_5RunResponseJSON struct { + Data apijson.Field + Shape apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTextEmbeddingBgeSmallEnV1_5RunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AIModelTextEmbeddingBgeSmallEnV1_5RunParams struct { + Text param.Field[AIModelTextEmbeddingBgeSmallEnV1_5RunParamsText] `json:"text,required"` +} + +func (r AIModelTextEmbeddingBgeSmallEnV1_5RunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Satisfied by [shared.UnionString], +// [AIModelTextEmbeddingBgeSmallEnV1_5RunParamsTextArray]. +type AIModelTextEmbeddingBgeSmallEnV1_5RunParamsText interface { + ImplementsAIModelTextEmbeddingBgeSmallEnV1_5RunParamsText() +} + +type AIModelTextEmbeddingBgeSmallEnV1_5RunParamsTextArray []string + +func (r AIModelTextEmbeddingBgeSmallEnV1_5RunParamsTextArray) ImplementsAIModelTextEmbeddingBgeSmallEnV1_5RunParamsText() { +} diff --git a/aimodeltextembeddingbgesmallenv15_test.go b/aimodeltextembeddingbgesmallenv15_test.go new file mode 100644 index 00000000000..2d8e91f9820 --- /dev/null +++ b/aimodeltextembeddingbgesmallenv15_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTextEmbeddingBgeSmallEnV1_5Run(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.TextEmbeddings.BgeSmallEnV1_5.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTextEmbeddingBgeSmallEnV1_5RunParams{ + Text: cloudflare.F[cloudflare.AIModelTextEmbeddingBgeSmallEnV1_5RunParamsText](shared.UnionString("string")), + }, + ) + 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/aimodeltextgeneration.go b/aimodeltextgeneration.go new file mode 100644 index 00000000000..4991fe98eec --- /dev/null +++ b/aimodeltextgeneration.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTextGenerationService 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 [NewAIModelTextGenerationService] +// method instead. +type AIModelTextGenerationService struct { + Options []option.RequestOption + Llama2_7bChatInt8 *AIModelTextGenerationLlama2_7bChatInt8Service + Llama2_7bChatFp16 *AIModelTextGenerationLlama2_7bChatFp16Service + Mistral7bInstructV0_1 *AIModelTextGenerationMistral7bInstructV0_1Service +} + +// NewAIModelTextGenerationService 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 NewAIModelTextGenerationService(opts ...option.RequestOption) (r *AIModelTextGenerationService) { + r = &AIModelTextGenerationService{} + r.Options = opts + r.Llama2_7bChatInt8 = NewAIModelTextGenerationLlama2_7bChatInt8Service(opts...) + r.Llama2_7bChatFp16 = NewAIModelTextGenerationLlama2_7bChatFp16Service(opts...) + r.Mistral7bInstructV0_1 = NewAIModelTextGenerationMistral7bInstructV0_1Service(opts...) + return +} diff --git a/aimodeltextgenerationllama27bchatfp16.go b/aimodeltextgenerationllama27bchatfp16.go new file mode 100644 index 00000000000..9c7547d2133 --- /dev/null +++ b/aimodeltextgenerationllama27bchatfp16.go @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AIModelTextGenerationLlama2_7bChatFp16Service 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 [NewAIModelTextGenerationLlama2_7bChatFp16Service] method instead. +type AIModelTextGenerationLlama2_7bChatFp16Service struct { + Options []option.RequestOption +} + +// NewAIModelTextGenerationLlama2_7bChatFp16Service 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 NewAIModelTextGenerationLlama2_7bChatFp16Service(opts ...option.RequestOption) (r *AIModelTextGenerationLlama2_7bChatFp16Service) { + r = &AIModelTextGenerationLlama2_7bChatFp16Service{} + r.Options = opts + return +} + +// Execute @cf/meta/llama-2-7b-chat-fp16 model. +func (r *AIModelTextGenerationLlama2_7bChatFp16Service) Run(ctx context.Context, accountIdentifier string, body AIModelTextGenerationLlama2_7bChatFp16RunParams, opts ...option.RequestOption) (res *AIModelTextGenerationLlama2_7bChatFp16RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/meta/llama-2-7b-chat-fp16", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Union satisfied by [AIModelTextGenerationLlama2_7bChatFp16RunResponseObject] or +// [shared.UnionString]. +type AIModelTextGenerationLlama2_7bChatFp16RunResponse interface { + ImplementsAIModelTextGenerationLlama2_7bChatFp16RunResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AIModelTextGenerationLlama2_7bChatFp16RunResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AIModelTextGenerationLlama2_7bChatFp16RunResponseObject struct { + Response string `json:"response"` + JSON aiModelTextGenerationLlama2_7bChatFp16RunResponseObjectJSON `json:"-"` +} + +// aiModelTextGenerationLlama2_7bChatFp16RunResponseObjectJSON contains the JSON +// metadata for the struct +// [AIModelTextGenerationLlama2_7bChatFp16RunResponseObject] +type aiModelTextGenerationLlama2_7bChatFp16RunResponseObjectJSON struct { + Response apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTextGenerationLlama2_7bChatFp16RunResponseObject) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AIModelTextGenerationLlama2_7bChatFp16RunResponseObject) ImplementsAIModelTextGenerationLlama2_7bChatFp16RunResponse() { +} + +// This interface is a union satisfied by one of the following: +// [AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant0], +// [AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant1]. +type AIModelTextGenerationLlama2_7bChatFp16RunParams interface { + ImplementsAIModelTextGenerationLlama2_7bChatFp16RunParams() +} + +type AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant0 struct { + Prompt param.Field[string] `json:"prompt,required"` + Stream param.Field[bool] `json:"stream"` +} + +func (r AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant0) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant0) ImplementsAIModelTextGenerationLlama2_7bChatFp16RunParams() { + +} + +type AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant1 struct { + Messages param.Field[[]AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant1Message] `json:"messages,required"` +} + +func (r AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant1) ImplementsAIModelTextGenerationLlama2_7bChatFp16RunParams() { + +} + +type AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant1Message struct { + Content param.Field[string] `json:"content,required"` + Role param.Field[string] `json:"role,required"` +} + +func (r AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant1Message) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/aimodeltextgenerationllama27bchatfp16_test.go b/aimodeltextgenerationllama27bchatfp16_test.go new file mode 100644 index 00000000000..4f2021f3d0f --- /dev/null +++ b/aimodeltextgenerationllama27bchatfp16_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTextGenerationLlama2_7bChatFp16RunWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.TextGeneration.Llama2_7bChatFp16.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTextGenerationLlama2_7bChatFp16RunParamsVariant0{ + Prompt: cloudflare.F("string"), + Stream: cloudflare.F(true), + }, + ) + 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/aimodeltextgenerationllama27bchatint8.go b/aimodeltextgenerationllama27bchatint8.go new file mode 100644 index 00000000000..4582364fdee --- /dev/null +++ b/aimodeltextgenerationllama27bchatint8.go @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AIModelTextGenerationLlama2_7bChatInt8Service 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 [NewAIModelTextGenerationLlama2_7bChatInt8Service] method instead. +type AIModelTextGenerationLlama2_7bChatInt8Service struct { + Options []option.RequestOption +} + +// NewAIModelTextGenerationLlama2_7bChatInt8Service 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 NewAIModelTextGenerationLlama2_7bChatInt8Service(opts ...option.RequestOption) (r *AIModelTextGenerationLlama2_7bChatInt8Service) { + r = &AIModelTextGenerationLlama2_7bChatInt8Service{} + r.Options = opts + return +} + +// Execute @cf/meta/llama-2-7b-chat-int8 model. +func (r *AIModelTextGenerationLlama2_7bChatInt8Service) Run(ctx context.Context, accountIdentifier string, body AIModelTextGenerationLlama2_7bChatInt8RunParams, opts ...option.RequestOption) (res *AIModelTextGenerationLlama2_7bChatInt8RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/meta/llama-2-7b-chat-int8", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Union satisfied by [AIModelTextGenerationLlama2_7bChatInt8RunResponseObject] or +// [shared.UnionString]. +type AIModelTextGenerationLlama2_7bChatInt8RunResponse interface { + ImplementsAIModelTextGenerationLlama2_7bChatInt8RunResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AIModelTextGenerationLlama2_7bChatInt8RunResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AIModelTextGenerationLlama2_7bChatInt8RunResponseObject struct { + Response string `json:"response"` + JSON aiModelTextGenerationLlama2_7bChatInt8RunResponseObjectJSON `json:"-"` +} + +// aiModelTextGenerationLlama2_7bChatInt8RunResponseObjectJSON contains the JSON +// metadata for the struct +// [AIModelTextGenerationLlama2_7bChatInt8RunResponseObject] +type aiModelTextGenerationLlama2_7bChatInt8RunResponseObjectJSON struct { + Response apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTextGenerationLlama2_7bChatInt8RunResponseObject) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AIModelTextGenerationLlama2_7bChatInt8RunResponseObject) ImplementsAIModelTextGenerationLlama2_7bChatInt8RunResponse() { +} + +// This interface is a union satisfied by one of the following: +// [AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant0], +// [AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant1]. +type AIModelTextGenerationLlama2_7bChatInt8RunParams interface { + ImplementsAIModelTextGenerationLlama2_7bChatInt8RunParams() +} + +type AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant0 struct { + Prompt param.Field[string] `json:"prompt,required"` + Stream param.Field[bool] `json:"stream"` +} + +func (r AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant0) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant0) ImplementsAIModelTextGenerationLlama2_7bChatInt8RunParams() { + +} + +type AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant1 struct { + Messages param.Field[[]AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant1Message] `json:"messages,required"` +} + +func (r AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant1) ImplementsAIModelTextGenerationLlama2_7bChatInt8RunParams() { + +} + +type AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant1Message struct { + Content param.Field[string] `json:"content,required"` + Role param.Field[string] `json:"role,required"` +} + +func (r AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant1Message) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/aimodeltextgenerationllama27bchatint8_test.go b/aimodeltextgenerationllama27bchatint8_test.go new file mode 100644 index 00000000000..635f847f664 --- /dev/null +++ b/aimodeltextgenerationllama27bchatint8_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTextGenerationLlama2_7bChatInt8RunWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.TextGeneration.Llama2_7bChatInt8.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTextGenerationLlama2_7bChatInt8RunParamsVariant0{ + Prompt: cloudflare.F("string"), + Stream: cloudflare.F(true), + }, + ) + 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/aimodeltextgenerationmistral7binstructv01.go b/aimodeltextgenerationmistral7binstructv01.go new file mode 100644 index 00000000000..5d2a022bdcc --- /dev/null +++ b/aimodeltextgenerationmistral7binstructv01.go @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// AIModelTextGenerationMistral7bInstructV0_1Service 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 [NewAIModelTextGenerationMistral7bInstructV0_1Service] method instead. +type AIModelTextGenerationMistral7bInstructV0_1Service struct { + Options []option.RequestOption +} + +// NewAIModelTextGenerationMistral7bInstructV0_1Service 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 NewAIModelTextGenerationMistral7bInstructV0_1Service(opts ...option.RequestOption) (r *AIModelTextGenerationMistral7bInstructV0_1Service) { + r = &AIModelTextGenerationMistral7bInstructV0_1Service{} + r.Options = opts + return +} + +// Execute @cf/mistral/mistral-7b-instruct-v0.1 model. +func (r *AIModelTextGenerationMistral7bInstructV0_1Service) Run(ctx context.Context, accountIdentifier string, body AIModelTextGenerationMistral7bInstructV0_1RunParams, opts ...option.RequestOption) (res *AIModelTextGenerationMistral7bInstructV0_1RunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/mistral/mistral-7b-instruct-v0.1", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Union satisfied by [AIModelTextGenerationMistral7bInstructV0_1RunResponseObject] +// or [shared.UnionString]. +type AIModelTextGenerationMistral7bInstructV0_1RunResponse interface { + ImplementsAIModelTextGenerationMistral7bInstructV0_1RunResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AIModelTextGenerationMistral7bInstructV0_1RunResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AIModelTextGenerationMistral7bInstructV0_1RunResponseObject struct { + Response string `json:"response"` + JSON aiModelTextGenerationMistral7bInstructV0_1RunResponseObjectJSON `json:"-"` +} + +// aiModelTextGenerationMistral7bInstructV0_1RunResponseObjectJSON contains the +// JSON metadata for the struct +// [AIModelTextGenerationMistral7bInstructV0_1RunResponseObject] +type aiModelTextGenerationMistral7bInstructV0_1RunResponseObjectJSON struct { + Response apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTextGenerationMistral7bInstructV0_1RunResponseObject) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r AIModelTextGenerationMistral7bInstructV0_1RunResponseObject) ImplementsAIModelTextGenerationMistral7bInstructV0_1RunResponse() { +} + +// This interface is a union satisfied by one of the following: +// [AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant0], +// [AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant1]. +type AIModelTextGenerationMistral7bInstructV0_1RunParams interface { + ImplementsAIModelTextGenerationMistral7bInstructV0_1RunParams() +} + +type AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant0 struct { + Prompt param.Field[string] `json:"prompt,required"` + Stream param.Field[bool] `json:"stream"` +} + +func (r AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant0) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant0) ImplementsAIModelTextGenerationMistral7bInstructV0_1RunParams() { + +} + +type AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant1 struct { + Messages param.Field[[]AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant1Message] `json:"messages,required"` +} + +func (r AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant1) ImplementsAIModelTextGenerationMistral7bInstructV0_1RunParams() { + +} + +type AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant1Message struct { + Content param.Field[string] `json:"content,required"` + Role param.Field[string] `json:"role,required"` +} + +func (r AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant1Message) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/aimodeltextgenerationmistral7binstructv01_test.go b/aimodeltextgenerationmistral7binstructv01_test.go new file mode 100644 index 00000000000..1b6864f7aab --- /dev/null +++ b/aimodeltextgenerationmistral7binstructv01_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTextGenerationMistral7bInstructV0_1RunWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.TextGeneration.Mistral7bInstructV0_1.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTextGenerationMistral7bInstructV0_1RunParamsVariant0{ + Prompt: cloudflare.F("string"), + Stream: cloudflare.F(true), + }, + ) + 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/aimodeltranslation.go b/aimodeltranslation.go new file mode 100644 index 00000000000..e6d6b521ad0 --- /dev/null +++ b/aimodeltranslation.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTranslationService 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 [NewAIModelTranslationService] method +// instead. +type AIModelTranslationService struct { + Options []option.RequestOption + M2m100_1_2b *AIModelTranslationM2m100_1_2bService +} + +// NewAIModelTranslationService 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 NewAIModelTranslationService(opts ...option.RequestOption) (r *AIModelTranslationService) { + r = &AIModelTranslationService{} + r.Options = opts + r.M2m100_1_2b = NewAIModelTranslationM2m100_1_2bService(opts...) + return +} diff --git a/aimodeltranslationm2m10012b.go b/aimodeltranslationm2m10012b.go new file mode 100644 index 00000000000..02612ca6925 --- /dev/null +++ b/aimodeltranslationm2m10012b.go @@ -0,0 +1,67 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AIModelTranslationM2m100_1_2bService 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 +// [NewAIModelTranslationM2m100_1_2bService] method instead. +type AIModelTranslationM2m100_1_2bService struct { + Options []option.RequestOption +} + +// NewAIModelTranslationM2m100_1_2bService 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 NewAIModelTranslationM2m100_1_2bService(opts ...option.RequestOption) (r *AIModelTranslationM2m100_1_2bService) { + r = &AIModelTranslationM2m100_1_2bService{} + r.Options = opts + return +} + +// Execute @cf/meta/m2m100-1.2b model. +func (r *AIModelTranslationM2m100_1_2bService) Run(ctx context.Context, accountIdentifier string, body AIModelTranslationM2m100_1_2bRunParams, opts ...option.RequestOption) (res *AIModelTranslationM2m100_1_2bRunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/meta/m2m100-1.2b", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type AIModelTranslationM2m100_1_2bRunResponse struct { + TranslatedText string `json:"translated_text"` + JSON aiModelTranslationM2m100_1_2bRunResponseJSON `json:"-"` +} + +// aiModelTranslationM2m100_1_2bRunResponseJSON contains the JSON metadata for the +// struct [AIModelTranslationM2m100_1_2bRunResponse] +type aiModelTranslationM2m100_1_2bRunResponseJSON struct { + TranslatedText apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIModelTranslationM2m100_1_2bRunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AIModelTranslationM2m100_1_2bRunParams struct { + TargetLang param.Field[string] `json:"target_lang,required"` + Text param.Field[string] `json:"text,required"` + SourceLang param.Field[string] `json:"source_lang"` +} + +func (r AIModelTranslationM2m100_1_2bRunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/aimodeltranslationm2m10012b_test.go b/aimodeltranslationm2m10012b_test.go new file mode 100644 index 00000000000..453f79a9653 --- /dev/null +++ b/aimodeltranslationm2m10012b_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAIModelTranslationM2m100_1_2bRunWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.AI.Model.Translation.M2m100_1_2b.Run( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AIModelTranslationM2m100_1_2bRunParams{ + TargetLang: cloudflare.F("string"), + Text: cloudflare.F("string"), + SourceLang: cloudflare.F("string"), + }, + ) + 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/aiopenai.go b/aiopenai.go deleted file mode 100644 index def81484546..00000000000 --- a/aiopenai.go +++ /dev/null @@ -1,55 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AIOpenAIService 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 [NewAIOpenAIService] method instead. -type AIOpenAIService struct { - Options []option.RequestOption -} - -// NewAIOpenAIService 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 NewAIOpenAIService(opts ...option.RequestOption) (r *AIOpenAIService) { - r = &AIOpenAIService{} - r.Options = opts - return -} - -// Execute @cf/openai/whisper model. -func (r *AIOpenAIService) Whisper(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *AIOpenAIWhisperResponse, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("apiv4/accounts/%s/ai/run/@cf/openai/whisper", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) - return -} - -type AIOpenAIWhisperResponse struct { - Text string `json:"text"` - JSON aiOpenAIWhisperResponseJSON `json:"-"` -} - -// aiOpenAIWhisperResponseJSON contains the JSON metadata for the struct -// [AIOpenAIWhisperResponse] -type aiOpenAIWhisperResponseJSON struct { - Text apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AIOpenAIWhisperResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/alerting.go b/alerting.go new file mode 100644 index 00000000000..d9b06a6e2ba --- /dev/null +++ b/alerting.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AlertingService 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 [NewAlertingService] method instead. +type AlertingService struct { + Options []option.RequestOption + V3 *AlertingV3Service +} + +// NewAlertingService 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 NewAlertingService(opts ...option.RequestOption) (r *AlertingService) { + r = &AlertingService{} + r.Options = opts + r.V3 = NewAlertingV3Service(opts...) + return +} diff --git a/alertingv3.go b/alertingv3.go new file mode 100644 index 00000000000..a24a22bc2cd --- /dev/null +++ b/alertingv3.go @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AlertingV3Service 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 [NewAlertingV3Service] method instead. +type AlertingV3Service struct { + Options []option.RequestOption + Destinations *AlertingV3DestinationService + History *AlertingV3HistoryService + Policies *AlertingV3PolicyService +} + +// NewAlertingV3Service 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 NewAlertingV3Service(opts ...option.RequestOption) (r *AlertingV3Service) { + r = &AlertingV3Service{} + r.Options = opts + r.Destinations = NewAlertingV3DestinationService(opts...) + r.History = NewAlertingV3HistoryService(opts...) + r.Policies = NewAlertingV3PolicyService(opts...) + return +} diff --git a/alertingv3destination.go b/alertingv3destination.go new file mode 100644 index 00000000000..e26819d8552 --- /dev/null +++ b/alertingv3destination.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AlertingV3DestinationService 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 [NewAlertingV3DestinationService] +// method instead. +type AlertingV3DestinationService struct { + Options []option.RequestOption + Webhooks *AlertingV3DestinationWebhookService +} + +// NewAlertingV3DestinationService 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 NewAlertingV3DestinationService(opts ...option.RequestOption) (r *AlertingV3DestinationService) { + r = &AlertingV3DestinationService{} + r.Options = opts + r.Webhooks = NewAlertingV3DestinationWebhookService(opts...) + return +} diff --git a/alertingv3destinationwebhook.go b/alertingv3destinationwebhook.go new file mode 100644 index 00000000000..6f0a0db04e6 --- /dev/null +++ b/alertingv3destinationwebhook.go @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AlertingV3DestinationWebhookService 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 +// [NewAlertingV3DestinationWebhookService] method instead. +type AlertingV3DestinationWebhookService struct { + Options []option.RequestOption +} + +// NewAlertingV3DestinationWebhookService 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 NewAlertingV3DestinationWebhookService(opts ...option.RequestOption) (r *AlertingV3DestinationWebhookService) { + r = &AlertingV3DestinationWebhookService{} + r.Options = opts + return +} + +// Update a webhook destination. +func (r *AlertingV3DestinationWebhookService) Update(ctx context.Context, accountID string, webhookID string, body AlertingV3DestinationWebhookUpdateParams, opts ...option.RequestOption) (res *AlertingV3DestinationWebhookUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks/%s", accountID, webhookID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type AlertingV3DestinationWebhookUpdateResponse struct { + Errors []AlertingV3DestinationWebhookUpdateResponseError `json:"errors"` + Messages []AlertingV3DestinationWebhookUpdateResponseMessage `json:"messages"` + Result AlertingV3DestinationWebhookUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AlertingV3DestinationWebhookUpdateResponseSuccess `json:"success"` + JSON alertingV3DestinationWebhookUpdateResponseJSON `json:"-"` +} + +// alertingV3DestinationWebhookUpdateResponseJSON contains the JSON metadata for +// the struct [AlertingV3DestinationWebhookUpdateResponse] +type alertingV3DestinationWebhookUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3DestinationWebhookUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3DestinationWebhookUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3DestinationWebhookUpdateResponseErrorJSON `json:"-"` +} + +// alertingV3DestinationWebhookUpdateResponseErrorJSON contains the JSON metadata +// for the struct [AlertingV3DestinationWebhookUpdateResponseError] +type alertingV3DestinationWebhookUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3DestinationWebhookUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3DestinationWebhookUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3DestinationWebhookUpdateResponseMessageJSON `json:"-"` +} + +// alertingV3DestinationWebhookUpdateResponseMessageJSON contains the JSON metadata +// for the struct [AlertingV3DestinationWebhookUpdateResponseMessage] +type alertingV3DestinationWebhookUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3DestinationWebhookUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3DestinationWebhookUpdateResponseResult struct { + // UUID + ID string `json:"id"` + JSON alertingV3DestinationWebhookUpdateResponseResultJSON `json:"-"` +} + +// alertingV3DestinationWebhookUpdateResponseResultJSON contains the JSON metadata +// for the struct [AlertingV3DestinationWebhookUpdateResponseResult] +type alertingV3DestinationWebhookUpdateResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3DestinationWebhookUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AlertingV3DestinationWebhookUpdateResponseSuccess bool + +const ( + AlertingV3DestinationWebhookUpdateResponseSuccessTrue AlertingV3DestinationWebhookUpdateResponseSuccess = true +) + +type AlertingV3DestinationWebhookUpdateParams struct { + // The name of the webhook destination. This will be included in the request body + // when you receive a webhook notification. + Name param.Field[string] `json:"name,required"` + // The POST endpoint to call when dispatching a notification. + URL param.Field[string] `json:"url,required"` + // Optional secret that will be passed in the `cf-webhook-auth` header when + // dispatching generic webhook notifications or formatted for supported + // destinations. Secrets are not returned in any API response body. + Secret param.Field[string] `json:"secret"` +} + +func (r AlertingV3DestinationWebhookUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/alertingv3destinationwebhook_test.go b/alertingv3destinationwebhook_test.go new file mode 100644 index 00000000000..a59acfc3e4e --- /dev/null +++ b/alertingv3destinationwebhook_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAlertingV3DestinationWebhookUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Alerting.V3.Destinations.Webhooks.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "b115d5ec-15c6-41ee-8b76-92c449b5227b", + cloudflare.AlertingV3DestinationWebhookUpdateParams{ + Name: cloudflare.F("Slack Webhook"), + URL: cloudflare.F("https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd"), + Secret: cloudflare.F("string"), + }, + ) + 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/alertingv3history.go b/alertingv3history.go new file mode 100644 index 00000000000..6b00070fe5e --- /dev/null +++ b/alertingv3history.go @@ -0,0 +1,131 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AlertingV3HistoryService 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 [NewAlertingV3HistoryService] method +// instead. +type AlertingV3HistoryService struct { + Options []option.RequestOption +} + +// NewAlertingV3HistoryService 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 NewAlertingV3HistoryService(opts ...option.RequestOption) (r *AlertingV3HistoryService) { + r = &AlertingV3HistoryService{} + r.Options = opts + return +} + +// Gets a list of history records for notifications sent to an account. The records +// are displayed for last `x` number of days based on the zone plan (free = 30, pro +// = 30, biz = 30, ent = 90). +func (r *AlertingV3HistoryService) List(ctx context.Context, accountID string, query AlertingV3HistoryListParams, opts ...option.RequestOption) (res *shared.Page[AlertingV3HistoryListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/history", accountID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type AlertingV3HistoryListResponse struct { + // UUID + ID string `json:"id"` + // Message body included in the notification sent. + AlertBody string `json:"alert_body"` + // Type of notification that has been dispatched. + AlertType string `json:"alert_type"` + // Description of the notification policy (if present). + Description string `json:"description"` + // The mechanism to which the notification has been dispatched. + Mechanism string `json:"mechanism"` + // The type of mechanism to which the notification has been dispatched. This can be + // email/pagerduty/webhook based on the mechanism configured. + MechanismType AlertingV3HistoryListResponseMechanismType `json:"mechanism_type"` + // Name of the policy. + Name string `json:"name"` + // The unique identifier of a notification policy + PolicyID string `json:"policy_id"` + // Timestamp of when the notification was dispatched in ISO 8601 format. + Sent time.Time `json:"sent" format:"date-time"` + JSON alertingV3HistoryListResponseJSON `json:"-"` +} + +// alertingV3HistoryListResponseJSON contains the JSON metadata for the struct +// [AlertingV3HistoryListResponse] +type alertingV3HistoryListResponseJSON struct { + ID apijson.Field + AlertBody apijson.Field + AlertType apijson.Field + Description apijson.Field + Mechanism apijson.Field + MechanismType apijson.Field + Name apijson.Field + PolicyID apijson.Field + Sent apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3HistoryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of mechanism to which the notification has been dispatched. This can be +// email/pagerduty/webhook based on the mechanism configured. +type AlertingV3HistoryListResponseMechanismType string + +const ( + AlertingV3HistoryListResponseMechanismTypeEmail AlertingV3HistoryListResponseMechanismType = "email" + AlertingV3HistoryListResponseMechanismTypePagerduty AlertingV3HistoryListResponseMechanismType = "pagerduty" + AlertingV3HistoryListResponseMechanismTypeWebhook AlertingV3HistoryListResponseMechanismType = "webhook" +) + +type AlertingV3HistoryListParams struct { + // Limit the returned results to history records older than the specified date. + // This must be a timestamp that conforms to RFC3339. + Before param.Field[time.Time] `query:"before" format:"date-time"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` + // Limit the returned results to history records newer than the specified date. + // This must be a timestamp that conforms to RFC3339. + Since param.Field[time.Time] `query:"since" format:"date-time"` +} + +// URLQuery serializes [AlertingV3HistoryListParams]'s query parameters as +// `url.Values`. +func (r AlertingV3HistoryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/alertingv3history_test.go b/alertingv3history_test.go new file mode 100644 index 00000000000..a75399e2c69 --- /dev/null +++ b/alertingv3history_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAlertingV3HistoryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Alerting.V3.History.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AlertingV3HistoryListParams{ + Before: cloudflare.F(time.Now()), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Since: cloudflare.F(time.Now()), + }, + ) + 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/alertingv3policy.go b/alertingv3policy.go new file mode 100644 index 00000000000..55d2e06567d --- /dev/null +++ b/alertingv3policy.go @@ -0,0 +1,1446 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AlertingV3PolicyService 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 [NewAlertingV3PolicyService] method +// instead. +type AlertingV3PolicyService struct { + Options []option.RequestOption +} + +// NewAlertingV3PolicyService 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 NewAlertingV3PolicyService(opts ...option.RequestOption) (r *AlertingV3PolicyService) { + r = &AlertingV3PolicyService{} + r.Options = opts + return +} + +// Creates a new Notification policy. +func (r *AlertingV3PolicyService) New(ctx context.Context, accountID string, body AlertingV3PolicyNewParams, opts ...option.RequestOption) (res *AlertingV3PolicyNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/policies", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get details for a single policy. +func (r *AlertingV3PolicyService) Get(ctx context.Context, accountID string, policyID string, opts ...option.RequestOption) (res *AlertingV3PolicyGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/policies/%s", accountID, policyID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a Notification policy. +func (r *AlertingV3PolicyService) Update(ctx context.Context, accountID string, policyID string, body AlertingV3PolicyUpdateParams, opts ...option.RequestOption) (res *AlertingV3PolicyUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/policies/%s", accountID, policyID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Get a list of all Notification policies. +func (r *AlertingV3PolicyService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *AlertingV3PolicyListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/policies", accountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a Notification policy. +func (r *AlertingV3PolicyService) Delete(ctx context.Context, accountID string, policyID string, opts ...option.RequestOption) (res *AlertingV3PolicyDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/alerting/v3/policies/%s", accountID, policyID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type AlertingV3PolicyNewResponse struct { + Errors []AlertingV3PolicyNewResponseError `json:"errors"` + Messages []AlertingV3PolicyNewResponseMessage `json:"messages"` + Result AlertingV3PolicyNewResponseResult `json:"result"` + // Whether the API call was successful + Success AlertingV3PolicyNewResponseSuccess `json:"success"` + JSON alertingV3PolicyNewResponseJSON `json:"-"` +} + +// alertingV3PolicyNewResponseJSON contains the JSON metadata for the struct +// [AlertingV3PolicyNewResponse] +type alertingV3PolicyNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyNewResponseErrorJSON `json:"-"` +} + +// alertingV3PolicyNewResponseErrorJSON contains the JSON metadata for the struct +// [AlertingV3PolicyNewResponseError] +type alertingV3PolicyNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyNewResponseMessageJSON `json:"-"` +} + +// alertingV3PolicyNewResponseMessageJSON contains the JSON metadata for the struct +// [AlertingV3PolicyNewResponseMessage] +type alertingV3PolicyNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyNewResponseResult struct { + // UUID + ID string `json:"id"` + JSON alertingV3PolicyNewResponseResultJSON `json:"-"` +} + +// alertingV3PolicyNewResponseResultJSON contains the JSON metadata for the struct +// [AlertingV3PolicyNewResponseResult] +type alertingV3PolicyNewResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AlertingV3PolicyNewResponseSuccess bool + +const ( + AlertingV3PolicyNewResponseSuccessTrue AlertingV3PolicyNewResponseSuccess = true +) + +type AlertingV3PolicyGetResponse struct { + Errors []AlertingV3PolicyGetResponseError `json:"errors"` + Messages []AlertingV3PolicyGetResponseMessage `json:"messages"` + Result AlertingV3PolicyGetResponseResult `json:"result"` + // Whether the API call was successful + Success AlertingV3PolicyGetResponseSuccess `json:"success"` + JSON alertingV3PolicyGetResponseJSON `json:"-"` +} + +// alertingV3PolicyGetResponseJSON contains the JSON metadata for the struct +// [AlertingV3PolicyGetResponse] +type alertingV3PolicyGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyGetResponseErrorJSON `json:"-"` +} + +// alertingV3PolicyGetResponseErrorJSON contains the JSON metadata for the struct +// [AlertingV3PolicyGetResponseError] +type alertingV3PolicyGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyGetResponseMessageJSON `json:"-"` +} + +// alertingV3PolicyGetResponseMessageJSON contains the JSON metadata for the struct +// [AlertingV3PolicyGetResponseMessage] +type alertingV3PolicyGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyGetResponseResult struct { + // The unique identifier of a notification policy + ID string `json:"id"` + // Refers to which event will trigger a Notification dispatch. You can use the + // endpoint to get available alert types which then will give you a list of + // possible values. + AlertType AlertingV3PolicyGetResponseResultAlertType `json:"alert_type"` + Created time.Time `json:"created" format:"date-time"` + // Optional description for the Notification policy. + Description string `json:"description"` + // Whether or not the Notification policy is enabled. + Enabled bool `json:"enabled"` + // Optional filters that allow you to be alerted only on a subset of events for + // that alert type based on some criteria. This is only available for select alert + // types. See alert type documentation for more details. + Filters AlertingV3PolicyGetResponseResultFilters `json:"filters"` + // List of IDs that will be used when dispatching a notification. IDs for email + // type will be the email address. + Mechanisms interface{} `json:"mechanisms"` + Modified time.Time `json:"modified" format:"date-time"` + // Name of the policy. + Name string `json:"name"` + JSON alertingV3PolicyGetResponseResultJSON `json:"-"` +} + +// alertingV3PolicyGetResponseResultJSON contains the JSON metadata for the struct +// [AlertingV3PolicyGetResponseResult] +type alertingV3PolicyGetResponseResultJSON struct { + ID apijson.Field + AlertType apijson.Field + Created apijson.Field + Description apijson.Field + Enabled apijson.Field + Filters apijson.Field + Mechanisms apijson.Field + Modified apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Refers to which event will trigger a Notification dispatch. You can use the +// endpoint to get available alert types which then will give you a list of +// possible values. +type AlertingV3PolicyGetResponseResultAlertType string + +const ( + AlertingV3PolicyGetResponseResultAlertTypeAccessCustomCertificateExpirationType AlertingV3PolicyGetResponseResultAlertType = "access_custom_certificate_expiration_type" + AlertingV3PolicyGetResponseResultAlertTypeAdvancedDdosAttackL4Alert AlertingV3PolicyGetResponseResultAlertType = "advanced_ddos_attack_l4_alert" + AlertingV3PolicyGetResponseResultAlertTypeAdvancedDdosAttackL7Alert AlertingV3PolicyGetResponseResultAlertType = "advanced_ddos_attack_l7_alert" + AlertingV3PolicyGetResponseResultAlertTypeAdvancedHTTPAlertError AlertingV3PolicyGetResponseResultAlertType = "advanced_http_alert_error" + AlertingV3PolicyGetResponseResultAlertTypeBgpHijackNotification AlertingV3PolicyGetResponseResultAlertType = "bgp_hijack_notification" + AlertingV3PolicyGetResponseResultAlertTypeBillingUsageAlert AlertingV3PolicyGetResponseResultAlertType = "billing_usage_alert" + AlertingV3PolicyGetResponseResultAlertTypeBlockNotificationBlockRemoved AlertingV3PolicyGetResponseResultAlertType = "block_notification_block_removed" + AlertingV3PolicyGetResponseResultAlertTypeBlockNotificationNewBlock AlertingV3PolicyGetResponseResultAlertType = "block_notification_new_block" + AlertingV3PolicyGetResponseResultAlertTypeBlockNotificationReviewRejected AlertingV3PolicyGetResponseResultAlertType = "block_notification_review_rejected" + AlertingV3PolicyGetResponseResultAlertTypeBrandProtectionAlert AlertingV3PolicyGetResponseResultAlertType = "brand_protection_alert" + AlertingV3PolicyGetResponseResultAlertTypeBrandProtectionDigest AlertingV3PolicyGetResponseResultAlertType = "brand_protection_digest" + AlertingV3PolicyGetResponseResultAlertTypeClickhouseAlertFwAnomaly AlertingV3PolicyGetResponseResultAlertType = "clickhouse_alert_fw_anomaly" + AlertingV3PolicyGetResponseResultAlertTypeClickhouseAlertFwEntAnomaly AlertingV3PolicyGetResponseResultAlertType = "clickhouse_alert_fw_ent_anomaly" + AlertingV3PolicyGetResponseResultAlertTypeCustomSslCertificateEventType AlertingV3PolicyGetResponseResultAlertType = "custom_ssl_certificate_event_type" + AlertingV3PolicyGetResponseResultAlertTypeDedicatedSslCertificateEventType AlertingV3PolicyGetResponseResultAlertType = "dedicated_ssl_certificate_event_type" + AlertingV3PolicyGetResponseResultAlertTypeDosAttackL4 AlertingV3PolicyGetResponseResultAlertType = "dos_attack_l4" + AlertingV3PolicyGetResponseResultAlertTypeDosAttackL7 AlertingV3PolicyGetResponseResultAlertType = "dos_attack_l7" + AlertingV3PolicyGetResponseResultAlertTypeExpiringServiceTokenAlert AlertingV3PolicyGetResponseResultAlertType = "expiring_service_token_alert" + AlertingV3PolicyGetResponseResultAlertTypeFailingLogpushJobDisabledAlert AlertingV3PolicyGetResponseResultAlertType = "failing_logpush_job_disabled_alert" + AlertingV3PolicyGetResponseResultAlertTypeFbmAutoAdvertisement AlertingV3PolicyGetResponseResultAlertType = "fbm_auto_advertisement" + AlertingV3PolicyGetResponseResultAlertTypeFbmDosdAttack AlertingV3PolicyGetResponseResultAlertType = "fbm_dosd_attack" + AlertingV3PolicyGetResponseResultAlertTypeFbmVolumetricAttack AlertingV3PolicyGetResponseResultAlertType = "fbm_volumetric_attack" + AlertingV3PolicyGetResponseResultAlertTypeHealthCheckStatusNotification AlertingV3PolicyGetResponseResultAlertType = "health_check_status_notification" + AlertingV3PolicyGetResponseResultAlertTypeHostnameAopCustomCertificateExpirationType AlertingV3PolicyGetResponseResultAlertType = "hostname_aop_custom_certificate_expiration_type" + AlertingV3PolicyGetResponseResultAlertTypeHTTPAlertEdgeError AlertingV3PolicyGetResponseResultAlertType = "http_alert_edge_error" + AlertingV3PolicyGetResponseResultAlertTypeHTTPAlertOriginError AlertingV3PolicyGetResponseResultAlertType = "http_alert_origin_error" + AlertingV3PolicyGetResponseResultAlertTypeIncidentAlert AlertingV3PolicyGetResponseResultAlertType = "incident_alert" + AlertingV3PolicyGetResponseResultAlertTypeLoadBalancingHealthAlert AlertingV3PolicyGetResponseResultAlertType = "load_balancing_health_alert" + AlertingV3PolicyGetResponseResultAlertTypeLoadBalancingPoolEnablementAlert AlertingV3PolicyGetResponseResultAlertType = "load_balancing_pool_enablement_alert" + AlertingV3PolicyGetResponseResultAlertTypeLogoMatchAlert AlertingV3PolicyGetResponseResultAlertType = "logo_match_alert" + AlertingV3PolicyGetResponseResultAlertTypeMagicTunnelHealthCheckEvent AlertingV3PolicyGetResponseResultAlertType = "magic_tunnel_health_check_event" + AlertingV3PolicyGetResponseResultAlertTypeMaintenanceEventNotification AlertingV3PolicyGetResponseResultAlertType = "maintenance_event_notification" + AlertingV3PolicyGetResponseResultAlertTypeMtlsCertificateStoreCertificateExpirationType AlertingV3PolicyGetResponseResultAlertType = "mtls_certificate_store_certificate_expiration_type" + AlertingV3PolicyGetResponseResultAlertTypePagesEventAlert AlertingV3PolicyGetResponseResultAlertType = "pages_event_alert" + AlertingV3PolicyGetResponseResultAlertTypeRadarNotification AlertingV3PolicyGetResponseResultAlertType = "radar_notification" + AlertingV3PolicyGetResponseResultAlertTypeRealOriginMonitoring AlertingV3PolicyGetResponseResultAlertType = "real_origin_monitoring" + AlertingV3PolicyGetResponseResultAlertTypeScriptmonitorAlertNewCodeChangeDetections AlertingV3PolicyGetResponseResultAlertType = "scriptmonitor_alert_new_code_change_detections" + AlertingV3PolicyGetResponseResultAlertTypeScriptmonitorAlertNewHosts AlertingV3PolicyGetResponseResultAlertType = "scriptmonitor_alert_new_hosts" + AlertingV3PolicyGetResponseResultAlertTypeScriptmonitorAlertNewMaliciousHosts AlertingV3PolicyGetResponseResultAlertType = "scriptmonitor_alert_new_malicious_hosts" + AlertingV3PolicyGetResponseResultAlertTypeScriptmonitorAlertNewMaliciousScripts AlertingV3PolicyGetResponseResultAlertType = "scriptmonitor_alert_new_malicious_scripts" + AlertingV3PolicyGetResponseResultAlertTypeScriptmonitorAlertNewMaliciousURL AlertingV3PolicyGetResponseResultAlertType = "scriptmonitor_alert_new_malicious_url" + AlertingV3PolicyGetResponseResultAlertTypeScriptmonitorAlertNewMaxLengthResourceURL AlertingV3PolicyGetResponseResultAlertType = "scriptmonitor_alert_new_max_length_resource_url" + AlertingV3PolicyGetResponseResultAlertTypeScriptmonitorAlertNewResources AlertingV3PolicyGetResponseResultAlertType = "scriptmonitor_alert_new_resources" + AlertingV3PolicyGetResponseResultAlertTypeSecondaryDNSAllPrimariesFailing AlertingV3PolicyGetResponseResultAlertType = "secondary_dns_all_primaries_failing" + AlertingV3PolicyGetResponseResultAlertTypeSecondaryDNSPrimariesFailing AlertingV3PolicyGetResponseResultAlertType = "secondary_dns_primaries_failing" + AlertingV3PolicyGetResponseResultAlertTypeSecondaryDNSZoneSuccessfullyUpdated AlertingV3PolicyGetResponseResultAlertType = "secondary_dns_zone_successfully_updated" + AlertingV3PolicyGetResponseResultAlertTypeSecondaryDNSZoneValidationWarning AlertingV3PolicyGetResponseResultAlertType = "secondary_dns_zone_validation_warning" + AlertingV3PolicyGetResponseResultAlertTypeSentinelAlert AlertingV3PolicyGetResponseResultAlertType = "sentinel_alert" + AlertingV3PolicyGetResponseResultAlertTypeStreamLiveNotifications AlertingV3PolicyGetResponseResultAlertType = "stream_live_notifications" + AlertingV3PolicyGetResponseResultAlertTypeTunnelHealthEvent AlertingV3PolicyGetResponseResultAlertType = "tunnel_health_event" + AlertingV3PolicyGetResponseResultAlertTypeTunnelUpdateEvent AlertingV3PolicyGetResponseResultAlertType = "tunnel_update_event" + AlertingV3PolicyGetResponseResultAlertTypeUniversalSslEventType AlertingV3PolicyGetResponseResultAlertType = "universal_ssl_event_type" + AlertingV3PolicyGetResponseResultAlertTypeWebAnalyticsMetricsUpdate AlertingV3PolicyGetResponseResultAlertType = "web_analytics_metrics_update" + AlertingV3PolicyGetResponseResultAlertTypeZoneAopCustomCertificateExpirationType AlertingV3PolicyGetResponseResultAlertType = "zone_aop_custom_certificate_expiration_type" +) + +// Optional filters that allow you to be alerted only on a subset of events for +// that alert type based on some criteria. This is only available for select alert +// types. See alert type documentation for more details. +type AlertingV3PolicyGetResponseResultFilters struct { + // Usage depends on specific alert type + Actions []string `json:"actions"` + // Used for configuring radar_notification + AffectedASNs []string `json:"affected_asns"` + // Used for configuring incident_alert + AffectedComponents []string `json:"affected_components"` + // Used for configuring radar_notification + AffectedLocations []string `json:"affected_locations"` + // Used for configuring maintenance_event_notification + AirportCode []string `json:"airport_code"` + // Usage depends on specific alert type + AlertTriggerPreferences []string `json:"alert_trigger_preferences"` + // Used for configuring magic_tunnel_health_check_event + AlertTriggerPreferencesValue []AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue `json:"alert_trigger_preferences_value"` + // Used for configuring load_balancing_pool_enablement_alert + Enabled []string `json:"enabled"` + // Used for configuring pages_event_alert + Environment []string `json:"environment"` + // Used for configuring pages_event_alert + Event []string `json:"event"` + // Used for configuring load_balancing_health_alert + EventSource []string `json:"event_source"` + // Usage depends on specific alert type + EventType []string `json:"event_type"` + // Usage depends on specific alert type + GroupBy []string `json:"group_by"` + // Used for configuring health_check_status_notification + HealthCheckID []string `json:"health_check_id"` + // Used for configuring incident_alert + IncidentImpact []AlertingV3PolicyGetResponseResultFiltersIncidentImpact `json:"incident_impact"` + // Used for configuring stream_live_notifications + InputID []string `json:"input_id"` + // Used for configuring billing_usage_alert + Limit []string `json:"limit"` + // Used for configuring logo_match_alert + LogoTag []string `json:"logo_tag"` + // Used for configuring advanced_ddos_attack_l4_alert + MegabitsPerSecond []string `json:"megabits_per_second"` + // Used for configuring load_balancing_health_alert + NewHealth []string `json:"new_health"` + // Used for configuring tunnel_health_event + NewStatus []string `json:"new_status"` + // Used for configuring advanced_ddos_attack_l4_alert + PacketsPerSecond []string `json:"packets_per_second"` + // Usage depends on specific alert type + PoolID []string `json:"pool_id"` + // Used for configuring billing_usage_alert + Product []string `json:"product"` + // Used for configuring pages_event_alert + ProjectID []string `json:"project_id"` + // Used for configuring advanced_ddos_attack_l4_alert + Protocol []string `json:"protocol"` + // Usage depends on specific alert type + QueryTag []string `json:"query_tag"` + // Used for configuring advanced_ddos_attack_l7_alert + RequestsPerSecond []string `json:"requests_per_second"` + // Usage depends on specific alert type + Selectors []string `json:"selectors"` + // Used for configuring clickhouse_alert_fw_ent_anomaly + Services []string `json:"services"` + // Usage depends on specific alert type + Slo []string `json:"slo"` + // Used for configuring health_check_status_notification + Status []string `json:"status"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetHostname []string `json:"target_hostname"` + // Used for configuring advanced_ddos_attack_l4_alert + TargetIP []string `json:"target_ip"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetZoneName []string `json:"target_zone_name"` + // Used for configuring traffic_anomalies_alert + TrafficExclusions []AlertingV3PolicyGetResponseResultFiltersTrafficExclusion `json:"traffic_exclusions"` + // Used for configuring tunnel_health_event + TunnelID []string `json:"tunnel_id"` + // Used for configuring magic_tunnel_health_check_event + TunnelName []string `json:"tunnel_name"` + // Usage depends on specific alert type + Where []string `json:"where"` + // Usage depends on specific alert type + Zones []string `json:"zones"` + JSON alertingV3PolicyGetResponseResultFiltersJSON `json:"-"` +} + +// alertingV3PolicyGetResponseResultFiltersJSON contains the JSON metadata for the +// struct [AlertingV3PolicyGetResponseResultFilters] +type alertingV3PolicyGetResponseResultFiltersJSON struct { + Actions apijson.Field + AffectedASNs apijson.Field + AffectedComponents apijson.Field + AffectedLocations apijson.Field + AirportCode apijson.Field + AlertTriggerPreferences apijson.Field + AlertTriggerPreferencesValue apijson.Field + Enabled apijson.Field + Environment apijson.Field + Event apijson.Field + EventSource apijson.Field + EventType apijson.Field + GroupBy apijson.Field + HealthCheckID apijson.Field + IncidentImpact apijson.Field + InputID apijson.Field + Limit apijson.Field + LogoTag apijson.Field + MegabitsPerSecond apijson.Field + NewHealth apijson.Field + NewStatus apijson.Field + PacketsPerSecond apijson.Field + PoolID apijson.Field + Product apijson.Field + ProjectID apijson.Field + Protocol apijson.Field + QueryTag apijson.Field + RequestsPerSecond apijson.Field + Selectors apijson.Field + Services apijson.Field + Slo apijson.Field + Status apijson.Field + TargetHostname apijson.Field + TargetIP apijson.Field + TargetZoneName apijson.Field + TrafficExclusions apijson.Field + TunnelID apijson.Field + TunnelName apijson.Field + Where apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyGetResponseResultFilters) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue string + +const ( + AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue99_0 AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue = "99.0" + AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue98_0 AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue = "98.0" + AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue97_0 AlertingV3PolicyGetResponseResultFiltersAlertTriggerPreferencesValue = "97.0" +) + +type AlertingV3PolicyGetResponseResultFiltersIncidentImpact string + +const ( + AlertingV3PolicyGetResponseResultFiltersIncidentImpactIncidentImpactNone AlertingV3PolicyGetResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_NONE" + AlertingV3PolicyGetResponseResultFiltersIncidentImpactIncidentImpactMinor AlertingV3PolicyGetResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_MINOR" + AlertingV3PolicyGetResponseResultFiltersIncidentImpactIncidentImpactMajor AlertingV3PolicyGetResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_MAJOR" + AlertingV3PolicyGetResponseResultFiltersIncidentImpactIncidentImpactCritical AlertingV3PolicyGetResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_CRITICAL" +) + +type AlertingV3PolicyGetResponseResultFiltersTrafficExclusion string + +const ( + AlertingV3PolicyGetResponseResultFiltersTrafficExclusionSecurityEvents AlertingV3PolicyGetResponseResultFiltersTrafficExclusion = "security_events" +) + +// Whether the API call was successful +type AlertingV3PolicyGetResponseSuccess bool + +const ( + AlertingV3PolicyGetResponseSuccessTrue AlertingV3PolicyGetResponseSuccess = true +) + +type AlertingV3PolicyUpdateResponse struct { + Errors []AlertingV3PolicyUpdateResponseError `json:"errors"` + Messages []AlertingV3PolicyUpdateResponseMessage `json:"messages"` + Result AlertingV3PolicyUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success AlertingV3PolicyUpdateResponseSuccess `json:"success"` + JSON alertingV3PolicyUpdateResponseJSON `json:"-"` +} + +// alertingV3PolicyUpdateResponseJSON contains the JSON metadata for the struct +// [AlertingV3PolicyUpdateResponse] +type alertingV3PolicyUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyUpdateResponseErrorJSON `json:"-"` +} + +// alertingV3PolicyUpdateResponseErrorJSON contains the JSON metadata for the +// struct [AlertingV3PolicyUpdateResponseError] +type alertingV3PolicyUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyUpdateResponseMessageJSON `json:"-"` +} + +// alertingV3PolicyUpdateResponseMessageJSON contains the JSON metadata for the +// struct [AlertingV3PolicyUpdateResponseMessage] +type alertingV3PolicyUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyUpdateResponseResult struct { + // UUID + ID string `json:"id"` + JSON alertingV3PolicyUpdateResponseResultJSON `json:"-"` +} + +// alertingV3PolicyUpdateResponseResultJSON contains the JSON metadata for the +// struct [AlertingV3PolicyUpdateResponseResult] +type alertingV3PolicyUpdateResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AlertingV3PolicyUpdateResponseSuccess bool + +const ( + AlertingV3PolicyUpdateResponseSuccessTrue AlertingV3PolicyUpdateResponseSuccess = true +) + +type AlertingV3PolicyListResponse struct { + Errors []AlertingV3PolicyListResponseError `json:"errors"` + Messages []AlertingV3PolicyListResponseMessage `json:"messages"` + Result []AlertingV3PolicyListResponseResult `json:"result"` + ResultInfo AlertingV3PolicyListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AlertingV3PolicyListResponseSuccess `json:"success"` + JSON alertingV3PolicyListResponseJSON `json:"-"` +} + +// alertingV3PolicyListResponseJSON contains the JSON metadata for the struct +// [AlertingV3PolicyListResponse] +type alertingV3PolicyListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyListResponseErrorJSON `json:"-"` +} + +// alertingV3PolicyListResponseErrorJSON contains the JSON metadata for the struct +// [AlertingV3PolicyListResponseError] +type alertingV3PolicyListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyListResponseMessageJSON `json:"-"` +} + +// alertingV3PolicyListResponseMessageJSON contains the JSON metadata for the +// struct [AlertingV3PolicyListResponseMessage] +type alertingV3PolicyListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyListResponseResult struct { + // The unique identifier of a notification policy + ID string `json:"id"` + // Refers to which event will trigger a Notification dispatch. You can use the + // endpoint to get available alert types which then will give you a list of + // possible values. + AlertType AlertingV3PolicyListResponseResultAlertType `json:"alert_type"` + Created time.Time `json:"created" format:"date-time"` + // Optional description for the Notification policy. + Description string `json:"description"` + // Whether or not the Notification policy is enabled. + Enabled bool `json:"enabled"` + // Optional filters that allow you to be alerted only on a subset of events for + // that alert type based on some criteria. This is only available for select alert + // types. See alert type documentation for more details. + Filters AlertingV3PolicyListResponseResultFilters `json:"filters"` + // List of IDs that will be used when dispatching a notification. IDs for email + // type will be the email address. + Mechanisms interface{} `json:"mechanisms"` + Modified time.Time `json:"modified" format:"date-time"` + // Name of the policy. + Name string `json:"name"` + JSON alertingV3PolicyListResponseResultJSON `json:"-"` +} + +// alertingV3PolicyListResponseResultJSON contains the JSON metadata for the struct +// [AlertingV3PolicyListResponseResult] +type alertingV3PolicyListResponseResultJSON struct { + ID apijson.Field + AlertType apijson.Field + Created apijson.Field + Description apijson.Field + Enabled apijson.Field + Filters apijson.Field + Mechanisms apijson.Field + Modified apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Refers to which event will trigger a Notification dispatch. You can use the +// endpoint to get available alert types which then will give you a list of +// possible values. +type AlertingV3PolicyListResponseResultAlertType string + +const ( + AlertingV3PolicyListResponseResultAlertTypeAccessCustomCertificateExpirationType AlertingV3PolicyListResponseResultAlertType = "access_custom_certificate_expiration_type" + AlertingV3PolicyListResponseResultAlertTypeAdvancedDdosAttackL4Alert AlertingV3PolicyListResponseResultAlertType = "advanced_ddos_attack_l4_alert" + AlertingV3PolicyListResponseResultAlertTypeAdvancedDdosAttackL7Alert AlertingV3PolicyListResponseResultAlertType = "advanced_ddos_attack_l7_alert" + AlertingV3PolicyListResponseResultAlertTypeAdvancedHTTPAlertError AlertingV3PolicyListResponseResultAlertType = "advanced_http_alert_error" + AlertingV3PolicyListResponseResultAlertTypeBgpHijackNotification AlertingV3PolicyListResponseResultAlertType = "bgp_hijack_notification" + AlertingV3PolicyListResponseResultAlertTypeBillingUsageAlert AlertingV3PolicyListResponseResultAlertType = "billing_usage_alert" + AlertingV3PolicyListResponseResultAlertTypeBlockNotificationBlockRemoved AlertingV3PolicyListResponseResultAlertType = "block_notification_block_removed" + AlertingV3PolicyListResponseResultAlertTypeBlockNotificationNewBlock AlertingV3PolicyListResponseResultAlertType = "block_notification_new_block" + AlertingV3PolicyListResponseResultAlertTypeBlockNotificationReviewRejected AlertingV3PolicyListResponseResultAlertType = "block_notification_review_rejected" + AlertingV3PolicyListResponseResultAlertTypeBrandProtectionAlert AlertingV3PolicyListResponseResultAlertType = "brand_protection_alert" + AlertingV3PolicyListResponseResultAlertTypeBrandProtectionDigest AlertingV3PolicyListResponseResultAlertType = "brand_protection_digest" + AlertingV3PolicyListResponseResultAlertTypeClickhouseAlertFwAnomaly AlertingV3PolicyListResponseResultAlertType = "clickhouse_alert_fw_anomaly" + AlertingV3PolicyListResponseResultAlertTypeClickhouseAlertFwEntAnomaly AlertingV3PolicyListResponseResultAlertType = "clickhouse_alert_fw_ent_anomaly" + AlertingV3PolicyListResponseResultAlertTypeCustomSslCertificateEventType AlertingV3PolicyListResponseResultAlertType = "custom_ssl_certificate_event_type" + AlertingV3PolicyListResponseResultAlertTypeDedicatedSslCertificateEventType AlertingV3PolicyListResponseResultAlertType = "dedicated_ssl_certificate_event_type" + AlertingV3PolicyListResponseResultAlertTypeDosAttackL4 AlertingV3PolicyListResponseResultAlertType = "dos_attack_l4" + AlertingV3PolicyListResponseResultAlertTypeDosAttackL7 AlertingV3PolicyListResponseResultAlertType = "dos_attack_l7" + AlertingV3PolicyListResponseResultAlertTypeExpiringServiceTokenAlert AlertingV3PolicyListResponseResultAlertType = "expiring_service_token_alert" + AlertingV3PolicyListResponseResultAlertTypeFailingLogpushJobDisabledAlert AlertingV3PolicyListResponseResultAlertType = "failing_logpush_job_disabled_alert" + AlertingV3PolicyListResponseResultAlertTypeFbmAutoAdvertisement AlertingV3PolicyListResponseResultAlertType = "fbm_auto_advertisement" + AlertingV3PolicyListResponseResultAlertTypeFbmDosdAttack AlertingV3PolicyListResponseResultAlertType = "fbm_dosd_attack" + AlertingV3PolicyListResponseResultAlertTypeFbmVolumetricAttack AlertingV3PolicyListResponseResultAlertType = "fbm_volumetric_attack" + AlertingV3PolicyListResponseResultAlertTypeHealthCheckStatusNotification AlertingV3PolicyListResponseResultAlertType = "health_check_status_notification" + AlertingV3PolicyListResponseResultAlertTypeHostnameAopCustomCertificateExpirationType AlertingV3PolicyListResponseResultAlertType = "hostname_aop_custom_certificate_expiration_type" + AlertingV3PolicyListResponseResultAlertTypeHTTPAlertEdgeError AlertingV3PolicyListResponseResultAlertType = "http_alert_edge_error" + AlertingV3PolicyListResponseResultAlertTypeHTTPAlertOriginError AlertingV3PolicyListResponseResultAlertType = "http_alert_origin_error" + AlertingV3PolicyListResponseResultAlertTypeIncidentAlert AlertingV3PolicyListResponseResultAlertType = "incident_alert" + AlertingV3PolicyListResponseResultAlertTypeLoadBalancingHealthAlert AlertingV3PolicyListResponseResultAlertType = "load_balancing_health_alert" + AlertingV3PolicyListResponseResultAlertTypeLoadBalancingPoolEnablementAlert AlertingV3PolicyListResponseResultAlertType = "load_balancing_pool_enablement_alert" + AlertingV3PolicyListResponseResultAlertTypeLogoMatchAlert AlertingV3PolicyListResponseResultAlertType = "logo_match_alert" + AlertingV3PolicyListResponseResultAlertTypeMagicTunnelHealthCheckEvent AlertingV3PolicyListResponseResultAlertType = "magic_tunnel_health_check_event" + AlertingV3PolicyListResponseResultAlertTypeMaintenanceEventNotification AlertingV3PolicyListResponseResultAlertType = "maintenance_event_notification" + AlertingV3PolicyListResponseResultAlertTypeMtlsCertificateStoreCertificateExpirationType AlertingV3PolicyListResponseResultAlertType = "mtls_certificate_store_certificate_expiration_type" + AlertingV3PolicyListResponseResultAlertTypePagesEventAlert AlertingV3PolicyListResponseResultAlertType = "pages_event_alert" + AlertingV3PolicyListResponseResultAlertTypeRadarNotification AlertingV3PolicyListResponseResultAlertType = "radar_notification" + AlertingV3PolicyListResponseResultAlertTypeRealOriginMonitoring AlertingV3PolicyListResponseResultAlertType = "real_origin_monitoring" + AlertingV3PolicyListResponseResultAlertTypeScriptmonitorAlertNewCodeChangeDetections AlertingV3PolicyListResponseResultAlertType = "scriptmonitor_alert_new_code_change_detections" + AlertingV3PolicyListResponseResultAlertTypeScriptmonitorAlertNewHosts AlertingV3PolicyListResponseResultAlertType = "scriptmonitor_alert_new_hosts" + AlertingV3PolicyListResponseResultAlertTypeScriptmonitorAlertNewMaliciousHosts AlertingV3PolicyListResponseResultAlertType = "scriptmonitor_alert_new_malicious_hosts" + AlertingV3PolicyListResponseResultAlertTypeScriptmonitorAlertNewMaliciousScripts AlertingV3PolicyListResponseResultAlertType = "scriptmonitor_alert_new_malicious_scripts" + AlertingV3PolicyListResponseResultAlertTypeScriptmonitorAlertNewMaliciousURL AlertingV3PolicyListResponseResultAlertType = "scriptmonitor_alert_new_malicious_url" + AlertingV3PolicyListResponseResultAlertTypeScriptmonitorAlertNewMaxLengthResourceURL AlertingV3PolicyListResponseResultAlertType = "scriptmonitor_alert_new_max_length_resource_url" + AlertingV3PolicyListResponseResultAlertTypeScriptmonitorAlertNewResources AlertingV3PolicyListResponseResultAlertType = "scriptmonitor_alert_new_resources" + AlertingV3PolicyListResponseResultAlertTypeSecondaryDNSAllPrimariesFailing AlertingV3PolicyListResponseResultAlertType = "secondary_dns_all_primaries_failing" + AlertingV3PolicyListResponseResultAlertTypeSecondaryDNSPrimariesFailing AlertingV3PolicyListResponseResultAlertType = "secondary_dns_primaries_failing" + AlertingV3PolicyListResponseResultAlertTypeSecondaryDNSZoneSuccessfullyUpdated AlertingV3PolicyListResponseResultAlertType = "secondary_dns_zone_successfully_updated" + AlertingV3PolicyListResponseResultAlertTypeSecondaryDNSZoneValidationWarning AlertingV3PolicyListResponseResultAlertType = "secondary_dns_zone_validation_warning" + AlertingV3PolicyListResponseResultAlertTypeSentinelAlert AlertingV3PolicyListResponseResultAlertType = "sentinel_alert" + AlertingV3PolicyListResponseResultAlertTypeStreamLiveNotifications AlertingV3PolicyListResponseResultAlertType = "stream_live_notifications" + AlertingV3PolicyListResponseResultAlertTypeTunnelHealthEvent AlertingV3PolicyListResponseResultAlertType = "tunnel_health_event" + AlertingV3PolicyListResponseResultAlertTypeTunnelUpdateEvent AlertingV3PolicyListResponseResultAlertType = "tunnel_update_event" + AlertingV3PolicyListResponseResultAlertTypeUniversalSslEventType AlertingV3PolicyListResponseResultAlertType = "universal_ssl_event_type" + AlertingV3PolicyListResponseResultAlertTypeWebAnalyticsMetricsUpdate AlertingV3PolicyListResponseResultAlertType = "web_analytics_metrics_update" + AlertingV3PolicyListResponseResultAlertTypeZoneAopCustomCertificateExpirationType AlertingV3PolicyListResponseResultAlertType = "zone_aop_custom_certificate_expiration_type" +) + +// Optional filters that allow you to be alerted only on a subset of events for +// that alert type based on some criteria. This is only available for select alert +// types. See alert type documentation for more details. +type AlertingV3PolicyListResponseResultFilters struct { + // Usage depends on specific alert type + Actions []string `json:"actions"` + // Used for configuring radar_notification + AffectedASNs []string `json:"affected_asns"` + // Used for configuring incident_alert + AffectedComponents []string `json:"affected_components"` + // Used for configuring radar_notification + AffectedLocations []string `json:"affected_locations"` + // Used for configuring maintenance_event_notification + AirportCode []string `json:"airport_code"` + // Usage depends on specific alert type + AlertTriggerPreferences []string `json:"alert_trigger_preferences"` + // Used for configuring magic_tunnel_health_check_event + AlertTriggerPreferencesValue []AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue `json:"alert_trigger_preferences_value"` + // Used for configuring load_balancing_pool_enablement_alert + Enabled []string `json:"enabled"` + // Used for configuring pages_event_alert + Environment []string `json:"environment"` + // Used for configuring pages_event_alert + Event []string `json:"event"` + // Used for configuring load_balancing_health_alert + EventSource []string `json:"event_source"` + // Usage depends on specific alert type + EventType []string `json:"event_type"` + // Usage depends on specific alert type + GroupBy []string `json:"group_by"` + // Used for configuring health_check_status_notification + HealthCheckID []string `json:"health_check_id"` + // Used for configuring incident_alert + IncidentImpact []AlertingV3PolicyListResponseResultFiltersIncidentImpact `json:"incident_impact"` + // Used for configuring stream_live_notifications + InputID []string `json:"input_id"` + // Used for configuring billing_usage_alert + Limit []string `json:"limit"` + // Used for configuring logo_match_alert + LogoTag []string `json:"logo_tag"` + // Used for configuring advanced_ddos_attack_l4_alert + MegabitsPerSecond []string `json:"megabits_per_second"` + // Used for configuring load_balancing_health_alert + NewHealth []string `json:"new_health"` + // Used for configuring tunnel_health_event + NewStatus []string `json:"new_status"` + // Used for configuring advanced_ddos_attack_l4_alert + PacketsPerSecond []string `json:"packets_per_second"` + // Usage depends on specific alert type + PoolID []string `json:"pool_id"` + // Used for configuring billing_usage_alert + Product []string `json:"product"` + // Used for configuring pages_event_alert + ProjectID []string `json:"project_id"` + // Used for configuring advanced_ddos_attack_l4_alert + Protocol []string `json:"protocol"` + // Usage depends on specific alert type + QueryTag []string `json:"query_tag"` + // Used for configuring advanced_ddos_attack_l7_alert + RequestsPerSecond []string `json:"requests_per_second"` + // Usage depends on specific alert type + Selectors []string `json:"selectors"` + // Used for configuring clickhouse_alert_fw_ent_anomaly + Services []string `json:"services"` + // Usage depends on specific alert type + Slo []string `json:"slo"` + // Used for configuring health_check_status_notification + Status []string `json:"status"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetHostname []string `json:"target_hostname"` + // Used for configuring advanced_ddos_attack_l4_alert + TargetIP []string `json:"target_ip"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetZoneName []string `json:"target_zone_name"` + // Used for configuring traffic_anomalies_alert + TrafficExclusions []AlertingV3PolicyListResponseResultFiltersTrafficExclusion `json:"traffic_exclusions"` + // Used for configuring tunnel_health_event + TunnelID []string `json:"tunnel_id"` + // Used for configuring magic_tunnel_health_check_event + TunnelName []string `json:"tunnel_name"` + // Usage depends on specific alert type + Where []string `json:"where"` + // Usage depends on specific alert type + Zones []string `json:"zones"` + JSON alertingV3PolicyListResponseResultFiltersJSON `json:"-"` +} + +// alertingV3PolicyListResponseResultFiltersJSON contains the JSON metadata for the +// struct [AlertingV3PolicyListResponseResultFilters] +type alertingV3PolicyListResponseResultFiltersJSON struct { + Actions apijson.Field + AffectedASNs apijson.Field + AffectedComponents apijson.Field + AffectedLocations apijson.Field + AirportCode apijson.Field + AlertTriggerPreferences apijson.Field + AlertTriggerPreferencesValue apijson.Field + Enabled apijson.Field + Environment apijson.Field + Event apijson.Field + EventSource apijson.Field + EventType apijson.Field + GroupBy apijson.Field + HealthCheckID apijson.Field + IncidentImpact apijson.Field + InputID apijson.Field + Limit apijson.Field + LogoTag apijson.Field + MegabitsPerSecond apijson.Field + NewHealth apijson.Field + NewStatus apijson.Field + PacketsPerSecond apijson.Field + PoolID apijson.Field + Product apijson.Field + ProjectID apijson.Field + Protocol apijson.Field + QueryTag apijson.Field + RequestsPerSecond apijson.Field + Selectors apijson.Field + Services apijson.Field + Slo apijson.Field + Status apijson.Field + TargetHostname apijson.Field + TargetIP apijson.Field + TargetZoneName apijson.Field + TrafficExclusions apijson.Field + TunnelID apijson.Field + TunnelName apijson.Field + Where apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyListResponseResultFilters) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue string + +const ( + AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue99_0 AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue = "99.0" + AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue98_0 AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue = "98.0" + AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue97_0 AlertingV3PolicyListResponseResultFiltersAlertTriggerPreferencesValue = "97.0" +) + +type AlertingV3PolicyListResponseResultFiltersIncidentImpact string + +const ( + AlertingV3PolicyListResponseResultFiltersIncidentImpactIncidentImpactNone AlertingV3PolicyListResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_NONE" + AlertingV3PolicyListResponseResultFiltersIncidentImpactIncidentImpactMinor AlertingV3PolicyListResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_MINOR" + AlertingV3PolicyListResponseResultFiltersIncidentImpactIncidentImpactMajor AlertingV3PolicyListResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_MAJOR" + AlertingV3PolicyListResponseResultFiltersIncidentImpactIncidentImpactCritical AlertingV3PolicyListResponseResultFiltersIncidentImpact = "INCIDENT_IMPACT_CRITICAL" +) + +type AlertingV3PolicyListResponseResultFiltersTrafficExclusion string + +const ( + AlertingV3PolicyListResponseResultFiltersTrafficExclusionSecurityEvents AlertingV3PolicyListResponseResultFiltersTrafficExclusion = "security_events" +) + +type AlertingV3PolicyListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON alertingV3PolicyListResponseResultInfoJSON `json:"-"` +} + +// alertingV3PolicyListResponseResultInfoJSON contains the JSON metadata for the +// struct [AlertingV3PolicyListResponseResultInfo] +type alertingV3PolicyListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AlertingV3PolicyListResponseSuccess bool + +const ( + AlertingV3PolicyListResponseSuccessTrue AlertingV3PolicyListResponseSuccess = true +) + +type AlertingV3PolicyDeleteResponse struct { + Errors []AlertingV3PolicyDeleteResponseError `json:"errors"` + Messages []AlertingV3PolicyDeleteResponseMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo AlertingV3PolicyDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success AlertingV3PolicyDeleteResponseSuccess `json:"success"` + JSON alertingV3PolicyDeleteResponseJSON `json:"-"` +} + +// alertingV3PolicyDeleteResponseJSON contains the JSON metadata for the struct +// [AlertingV3PolicyDeleteResponse] +type alertingV3PolicyDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyDeleteResponseErrorJSON `json:"-"` +} + +// alertingV3PolicyDeleteResponseErrorJSON contains the JSON metadata for the +// struct [AlertingV3PolicyDeleteResponseError] +type alertingV3PolicyDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON alertingV3PolicyDeleteResponseMessageJSON `json:"-"` +} + +// alertingV3PolicyDeleteResponseMessageJSON contains the JSON metadata for the +// struct [AlertingV3PolicyDeleteResponseMessage] +type alertingV3PolicyDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AlertingV3PolicyDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON alertingV3PolicyDeleteResponseResultInfoJSON `json:"-"` +} + +// alertingV3PolicyDeleteResponseResultInfoJSON contains the JSON metadata for the +// struct [AlertingV3PolicyDeleteResponseResultInfo] +type alertingV3PolicyDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AlertingV3PolicyDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AlertingV3PolicyDeleteResponseSuccess bool + +const ( + AlertingV3PolicyDeleteResponseSuccessTrue AlertingV3PolicyDeleteResponseSuccess = true +) + +type AlertingV3PolicyNewParams struct { + // Refers to which event will trigger a Notification dispatch. You can use the + // endpoint to get available alert types which then will give you a list of + // possible values. + AlertType param.Field[AlertingV3PolicyNewParamsAlertType] `json:"alert_type,required"` + // Whether or not the Notification policy is enabled. + Enabled param.Field[bool] `json:"enabled,required"` + // List of IDs that will be used when dispatching a notification. IDs for email + // type will be the email address. + Mechanisms param.Field[interface{}] `json:"mechanisms,required"` + // Name of the policy. + Name param.Field[string] `json:"name,required"` + // Optional description for the Notification policy. + Description param.Field[string] `json:"description"` + // Optional filters that allow you to be alerted only on a subset of events for + // that alert type based on some criteria. This is only available for select alert + // types. See alert type documentation for more details. + Filters param.Field[AlertingV3PolicyNewParamsFilters] `json:"filters"` +} + +func (r AlertingV3PolicyNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Refers to which event will trigger a Notification dispatch. You can use the +// endpoint to get available alert types which then will give you a list of +// possible values. +type AlertingV3PolicyNewParamsAlertType string + +const ( + AlertingV3PolicyNewParamsAlertTypeAccessCustomCertificateExpirationType AlertingV3PolicyNewParamsAlertType = "access_custom_certificate_expiration_type" + AlertingV3PolicyNewParamsAlertTypeAdvancedDdosAttackL4Alert AlertingV3PolicyNewParamsAlertType = "advanced_ddos_attack_l4_alert" + AlertingV3PolicyNewParamsAlertTypeAdvancedDdosAttackL7Alert AlertingV3PolicyNewParamsAlertType = "advanced_ddos_attack_l7_alert" + AlertingV3PolicyNewParamsAlertTypeAdvancedHTTPAlertError AlertingV3PolicyNewParamsAlertType = "advanced_http_alert_error" + AlertingV3PolicyNewParamsAlertTypeBgpHijackNotification AlertingV3PolicyNewParamsAlertType = "bgp_hijack_notification" + AlertingV3PolicyNewParamsAlertTypeBillingUsageAlert AlertingV3PolicyNewParamsAlertType = "billing_usage_alert" + AlertingV3PolicyNewParamsAlertTypeBlockNotificationBlockRemoved AlertingV3PolicyNewParamsAlertType = "block_notification_block_removed" + AlertingV3PolicyNewParamsAlertTypeBlockNotificationNewBlock AlertingV3PolicyNewParamsAlertType = "block_notification_new_block" + AlertingV3PolicyNewParamsAlertTypeBlockNotificationReviewRejected AlertingV3PolicyNewParamsAlertType = "block_notification_review_rejected" + AlertingV3PolicyNewParamsAlertTypeBrandProtectionAlert AlertingV3PolicyNewParamsAlertType = "brand_protection_alert" + AlertingV3PolicyNewParamsAlertTypeBrandProtectionDigest AlertingV3PolicyNewParamsAlertType = "brand_protection_digest" + AlertingV3PolicyNewParamsAlertTypeClickhouseAlertFwAnomaly AlertingV3PolicyNewParamsAlertType = "clickhouse_alert_fw_anomaly" + AlertingV3PolicyNewParamsAlertTypeClickhouseAlertFwEntAnomaly AlertingV3PolicyNewParamsAlertType = "clickhouse_alert_fw_ent_anomaly" + AlertingV3PolicyNewParamsAlertTypeCustomSslCertificateEventType AlertingV3PolicyNewParamsAlertType = "custom_ssl_certificate_event_type" + AlertingV3PolicyNewParamsAlertTypeDedicatedSslCertificateEventType AlertingV3PolicyNewParamsAlertType = "dedicated_ssl_certificate_event_type" + AlertingV3PolicyNewParamsAlertTypeDosAttackL4 AlertingV3PolicyNewParamsAlertType = "dos_attack_l4" + AlertingV3PolicyNewParamsAlertTypeDosAttackL7 AlertingV3PolicyNewParamsAlertType = "dos_attack_l7" + AlertingV3PolicyNewParamsAlertTypeExpiringServiceTokenAlert AlertingV3PolicyNewParamsAlertType = "expiring_service_token_alert" + AlertingV3PolicyNewParamsAlertTypeFailingLogpushJobDisabledAlert AlertingV3PolicyNewParamsAlertType = "failing_logpush_job_disabled_alert" + AlertingV3PolicyNewParamsAlertTypeFbmAutoAdvertisement AlertingV3PolicyNewParamsAlertType = "fbm_auto_advertisement" + AlertingV3PolicyNewParamsAlertTypeFbmDosdAttack AlertingV3PolicyNewParamsAlertType = "fbm_dosd_attack" + AlertingV3PolicyNewParamsAlertTypeFbmVolumetricAttack AlertingV3PolicyNewParamsAlertType = "fbm_volumetric_attack" + AlertingV3PolicyNewParamsAlertTypeHealthCheckStatusNotification AlertingV3PolicyNewParamsAlertType = "health_check_status_notification" + AlertingV3PolicyNewParamsAlertTypeHostnameAopCustomCertificateExpirationType AlertingV3PolicyNewParamsAlertType = "hostname_aop_custom_certificate_expiration_type" + AlertingV3PolicyNewParamsAlertTypeHTTPAlertEdgeError AlertingV3PolicyNewParamsAlertType = "http_alert_edge_error" + AlertingV3PolicyNewParamsAlertTypeHTTPAlertOriginError AlertingV3PolicyNewParamsAlertType = "http_alert_origin_error" + AlertingV3PolicyNewParamsAlertTypeIncidentAlert AlertingV3PolicyNewParamsAlertType = "incident_alert" + AlertingV3PolicyNewParamsAlertTypeLoadBalancingHealthAlert AlertingV3PolicyNewParamsAlertType = "load_balancing_health_alert" + AlertingV3PolicyNewParamsAlertTypeLoadBalancingPoolEnablementAlert AlertingV3PolicyNewParamsAlertType = "load_balancing_pool_enablement_alert" + AlertingV3PolicyNewParamsAlertTypeLogoMatchAlert AlertingV3PolicyNewParamsAlertType = "logo_match_alert" + AlertingV3PolicyNewParamsAlertTypeMagicTunnelHealthCheckEvent AlertingV3PolicyNewParamsAlertType = "magic_tunnel_health_check_event" + AlertingV3PolicyNewParamsAlertTypeMaintenanceEventNotification AlertingV3PolicyNewParamsAlertType = "maintenance_event_notification" + AlertingV3PolicyNewParamsAlertTypeMtlsCertificateStoreCertificateExpirationType AlertingV3PolicyNewParamsAlertType = "mtls_certificate_store_certificate_expiration_type" + AlertingV3PolicyNewParamsAlertTypePagesEventAlert AlertingV3PolicyNewParamsAlertType = "pages_event_alert" + AlertingV3PolicyNewParamsAlertTypeRadarNotification AlertingV3PolicyNewParamsAlertType = "radar_notification" + AlertingV3PolicyNewParamsAlertTypeRealOriginMonitoring AlertingV3PolicyNewParamsAlertType = "real_origin_monitoring" + AlertingV3PolicyNewParamsAlertTypeScriptmonitorAlertNewCodeChangeDetections AlertingV3PolicyNewParamsAlertType = "scriptmonitor_alert_new_code_change_detections" + AlertingV3PolicyNewParamsAlertTypeScriptmonitorAlertNewHosts AlertingV3PolicyNewParamsAlertType = "scriptmonitor_alert_new_hosts" + AlertingV3PolicyNewParamsAlertTypeScriptmonitorAlertNewMaliciousHosts AlertingV3PolicyNewParamsAlertType = "scriptmonitor_alert_new_malicious_hosts" + AlertingV3PolicyNewParamsAlertTypeScriptmonitorAlertNewMaliciousScripts AlertingV3PolicyNewParamsAlertType = "scriptmonitor_alert_new_malicious_scripts" + AlertingV3PolicyNewParamsAlertTypeScriptmonitorAlertNewMaliciousURL AlertingV3PolicyNewParamsAlertType = "scriptmonitor_alert_new_malicious_url" + AlertingV3PolicyNewParamsAlertTypeScriptmonitorAlertNewMaxLengthResourceURL AlertingV3PolicyNewParamsAlertType = "scriptmonitor_alert_new_max_length_resource_url" + AlertingV3PolicyNewParamsAlertTypeScriptmonitorAlertNewResources AlertingV3PolicyNewParamsAlertType = "scriptmonitor_alert_new_resources" + AlertingV3PolicyNewParamsAlertTypeSecondaryDNSAllPrimariesFailing AlertingV3PolicyNewParamsAlertType = "secondary_dns_all_primaries_failing" + AlertingV3PolicyNewParamsAlertTypeSecondaryDNSPrimariesFailing AlertingV3PolicyNewParamsAlertType = "secondary_dns_primaries_failing" + AlertingV3PolicyNewParamsAlertTypeSecondaryDNSZoneSuccessfullyUpdated AlertingV3PolicyNewParamsAlertType = "secondary_dns_zone_successfully_updated" + AlertingV3PolicyNewParamsAlertTypeSecondaryDNSZoneValidationWarning AlertingV3PolicyNewParamsAlertType = "secondary_dns_zone_validation_warning" + AlertingV3PolicyNewParamsAlertTypeSentinelAlert AlertingV3PolicyNewParamsAlertType = "sentinel_alert" + AlertingV3PolicyNewParamsAlertTypeStreamLiveNotifications AlertingV3PolicyNewParamsAlertType = "stream_live_notifications" + AlertingV3PolicyNewParamsAlertTypeTunnelHealthEvent AlertingV3PolicyNewParamsAlertType = "tunnel_health_event" + AlertingV3PolicyNewParamsAlertTypeTunnelUpdateEvent AlertingV3PolicyNewParamsAlertType = "tunnel_update_event" + AlertingV3PolicyNewParamsAlertTypeUniversalSslEventType AlertingV3PolicyNewParamsAlertType = "universal_ssl_event_type" + AlertingV3PolicyNewParamsAlertTypeWebAnalyticsMetricsUpdate AlertingV3PolicyNewParamsAlertType = "web_analytics_metrics_update" + AlertingV3PolicyNewParamsAlertTypeZoneAopCustomCertificateExpirationType AlertingV3PolicyNewParamsAlertType = "zone_aop_custom_certificate_expiration_type" +) + +// Optional filters that allow you to be alerted only on a subset of events for +// that alert type based on some criteria. This is only available for select alert +// types. See alert type documentation for more details. +type AlertingV3PolicyNewParamsFilters struct { + // Usage depends on specific alert type + Actions param.Field[[]string] `json:"actions"` + // Used for configuring radar_notification + AffectedASNs param.Field[[]string] `json:"affected_asns"` + // Used for configuring incident_alert + AffectedComponents param.Field[[]string] `json:"affected_components"` + // Used for configuring radar_notification + AffectedLocations param.Field[[]string] `json:"affected_locations"` + // Used for configuring maintenance_event_notification + AirportCode param.Field[[]string] `json:"airport_code"` + // Usage depends on specific alert type + AlertTriggerPreferences param.Field[[]string] `json:"alert_trigger_preferences"` + // Used for configuring magic_tunnel_health_check_event + AlertTriggerPreferencesValue param.Field[[]AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue] `json:"alert_trigger_preferences_value"` + // Used for configuring load_balancing_pool_enablement_alert + Enabled param.Field[[]string] `json:"enabled"` + // Used for configuring pages_event_alert + Environment param.Field[[]string] `json:"environment"` + // Used for configuring pages_event_alert + Event param.Field[[]string] `json:"event"` + // Used for configuring load_balancing_health_alert + EventSource param.Field[[]string] `json:"event_source"` + // Usage depends on specific alert type + EventType param.Field[[]string] `json:"event_type"` + // Usage depends on specific alert type + GroupBy param.Field[[]string] `json:"group_by"` + // Used for configuring health_check_status_notification + HealthCheckID param.Field[[]string] `json:"health_check_id"` + // Used for configuring incident_alert + IncidentImpact param.Field[[]AlertingV3PolicyNewParamsFiltersIncidentImpact] `json:"incident_impact"` + // Used for configuring stream_live_notifications + InputID param.Field[[]string] `json:"input_id"` + // Used for configuring billing_usage_alert + Limit param.Field[[]string] `json:"limit"` + // Used for configuring logo_match_alert + LogoTag param.Field[[]string] `json:"logo_tag"` + // Used for configuring advanced_ddos_attack_l4_alert + MegabitsPerSecond param.Field[[]string] `json:"megabits_per_second"` + // Used for configuring load_balancing_health_alert + NewHealth param.Field[[]string] `json:"new_health"` + // Used for configuring tunnel_health_event + NewStatus param.Field[[]string] `json:"new_status"` + // Used for configuring advanced_ddos_attack_l4_alert + PacketsPerSecond param.Field[[]string] `json:"packets_per_second"` + // Usage depends on specific alert type + PoolID param.Field[[]string] `json:"pool_id"` + // Used for configuring billing_usage_alert + Product param.Field[[]string] `json:"product"` + // Used for configuring pages_event_alert + ProjectID param.Field[[]string] `json:"project_id"` + // Used for configuring advanced_ddos_attack_l4_alert + Protocol param.Field[[]string] `json:"protocol"` + // Usage depends on specific alert type + QueryTag param.Field[[]string] `json:"query_tag"` + // Used for configuring advanced_ddos_attack_l7_alert + RequestsPerSecond param.Field[[]string] `json:"requests_per_second"` + // Usage depends on specific alert type + Selectors param.Field[[]string] `json:"selectors"` + // Used for configuring clickhouse_alert_fw_ent_anomaly + Services param.Field[[]string] `json:"services"` + // Usage depends on specific alert type + Slo param.Field[[]string] `json:"slo"` + // Used for configuring health_check_status_notification + Status param.Field[[]string] `json:"status"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetHostname param.Field[[]string] `json:"target_hostname"` + // Used for configuring advanced_ddos_attack_l4_alert + TargetIP param.Field[[]string] `json:"target_ip"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetZoneName param.Field[[]string] `json:"target_zone_name"` + // Used for configuring traffic_anomalies_alert + TrafficExclusions param.Field[[]AlertingV3PolicyNewParamsFiltersTrafficExclusion] `json:"traffic_exclusions"` + // Used for configuring tunnel_health_event + TunnelID param.Field[[]string] `json:"tunnel_id"` + // Used for configuring magic_tunnel_health_check_event + TunnelName param.Field[[]string] `json:"tunnel_name"` + // Usage depends on specific alert type + Where param.Field[[]string] `json:"where"` + // Usage depends on specific alert type + Zones param.Field[[]string] `json:"zones"` +} + +func (r AlertingV3PolicyNewParamsFilters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue string + +const ( + AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue99_0 AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue = "99.0" + AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue98_0 AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue = "98.0" + AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue97_0 AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue = "97.0" +) + +type AlertingV3PolicyNewParamsFiltersIncidentImpact string + +const ( + AlertingV3PolicyNewParamsFiltersIncidentImpactIncidentImpactNone AlertingV3PolicyNewParamsFiltersIncidentImpact = "INCIDENT_IMPACT_NONE" + AlertingV3PolicyNewParamsFiltersIncidentImpactIncidentImpactMinor AlertingV3PolicyNewParamsFiltersIncidentImpact = "INCIDENT_IMPACT_MINOR" + AlertingV3PolicyNewParamsFiltersIncidentImpactIncidentImpactMajor AlertingV3PolicyNewParamsFiltersIncidentImpact = "INCIDENT_IMPACT_MAJOR" + AlertingV3PolicyNewParamsFiltersIncidentImpactIncidentImpactCritical AlertingV3PolicyNewParamsFiltersIncidentImpact = "INCIDENT_IMPACT_CRITICAL" +) + +type AlertingV3PolicyNewParamsFiltersTrafficExclusion string + +const ( + AlertingV3PolicyNewParamsFiltersTrafficExclusionSecurityEvents AlertingV3PolicyNewParamsFiltersTrafficExclusion = "security_events" +) + +type AlertingV3PolicyUpdateParams struct { + // Refers to which event will trigger a Notification dispatch. You can use the + // endpoint to get available alert types which then will give you a list of + // possible values. + AlertType param.Field[AlertingV3PolicyUpdateParamsAlertType] `json:"alert_type"` + // Optional description for the Notification policy. + Description param.Field[string] `json:"description"` + // Whether or not the Notification policy is enabled. + Enabled param.Field[bool] `json:"enabled"` + // Optional filters that allow you to be alerted only on a subset of events for + // that alert type based on some criteria. This is only available for select alert + // types. See alert type documentation for more details. + Filters param.Field[AlertingV3PolicyUpdateParamsFilters] `json:"filters"` + // List of IDs that will be used when dispatching a notification. IDs for email + // type will be the email address. + Mechanisms param.Field[interface{}] `json:"mechanisms"` + // Name of the policy. + Name param.Field[string] `json:"name"` +} + +func (r AlertingV3PolicyUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Refers to which event will trigger a Notification dispatch. You can use the +// endpoint to get available alert types which then will give you a list of +// possible values. +type AlertingV3PolicyUpdateParamsAlertType string + +const ( + AlertingV3PolicyUpdateParamsAlertTypeAccessCustomCertificateExpirationType AlertingV3PolicyUpdateParamsAlertType = "access_custom_certificate_expiration_type" + AlertingV3PolicyUpdateParamsAlertTypeAdvancedDdosAttackL4Alert AlertingV3PolicyUpdateParamsAlertType = "advanced_ddos_attack_l4_alert" + AlertingV3PolicyUpdateParamsAlertTypeAdvancedDdosAttackL7Alert AlertingV3PolicyUpdateParamsAlertType = "advanced_ddos_attack_l7_alert" + AlertingV3PolicyUpdateParamsAlertTypeAdvancedHTTPAlertError AlertingV3PolicyUpdateParamsAlertType = "advanced_http_alert_error" + AlertingV3PolicyUpdateParamsAlertTypeBgpHijackNotification AlertingV3PolicyUpdateParamsAlertType = "bgp_hijack_notification" + AlertingV3PolicyUpdateParamsAlertTypeBillingUsageAlert AlertingV3PolicyUpdateParamsAlertType = "billing_usage_alert" + AlertingV3PolicyUpdateParamsAlertTypeBlockNotificationBlockRemoved AlertingV3PolicyUpdateParamsAlertType = "block_notification_block_removed" + AlertingV3PolicyUpdateParamsAlertTypeBlockNotificationNewBlock AlertingV3PolicyUpdateParamsAlertType = "block_notification_new_block" + AlertingV3PolicyUpdateParamsAlertTypeBlockNotificationReviewRejected AlertingV3PolicyUpdateParamsAlertType = "block_notification_review_rejected" + AlertingV3PolicyUpdateParamsAlertTypeBrandProtectionAlert AlertingV3PolicyUpdateParamsAlertType = "brand_protection_alert" + AlertingV3PolicyUpdateParamsAlertTypeBrandProtectionDigest AlertingV3PolicyUpdateParamsAlertType = "brand_protection_digest" + AlertingV3PolicyUpdateParamsAlertTypeClickhouseAlertFwAnomaly AlertingV3PolicyUpdateParamsAlertType = "clickhouse_alert_fw_anomaly" + AlertingV3PolicyUpdateParamsAlertTypeClickhouseAlertFwEntAnomaly AlertingV3PolicyUpdateParamsAlertType = "clickhouse_alert_fw_ent_anomaly" + AlertingV3PolicyUpdateParamsAlertTypeCustomSslCertificateEventType AlertingV3PolicyUpdateParamsAlertType = "custom_ssl_certificate_event_type" + AlertingV3PolicyUpdateParamsAlertTypeDedicatedSslCertificateEventType AlertingV3PolicyUpdateParamsAlertType = "dedicated_ssl_certificate_event_type" + AlertingV3PolicyUpdateParamsAlertTypeDosAttackL4 AlertingV3PolicyUpdateParamsAlertType = "dos_attack_l4" + AlertingV3PolicyUpdateParamsAlertTypeDosAttackL7 AlertingV3PolicyUpdateParamsAlertType = "dos_attack_l7" + AlertingV3PolicyUpdateParamsAlertTypeExpiringServiceTokenAlert AlertingV3PolicyUpdateParamsAlertType = "expiring_service_token_alert" + AlertingV3PolicyUpdateParamsAlertTypeFailingLogpushJobDisabledAlert AlertingV3PolicyUpdateParamsAlertType = "failing_logpush_job_disabled_alert" + AlertingV3PolicyUpdateParamsAlertTypeFbmAutoAdvertisement AlertingV3PolicyUpdateParamsAlertType = "fbm_auto_advertisement" + AlertingV3PolicyUpdateParamsAlertTypeFbmDosdAttack AlertingV3PolicyUpdateParamsAlertType = "fbm_dosd_attack" + AlertingV3PolicyUpdateParamsAlertTypeFbmVolumetricAttack AlertingV3PolicyUpdateParamsAlertType = "fbm_volumetric_attack" + AlertingV3PolicyUpdateParamsAlertTypeHealthCheckStatusNotification AlertingV3PolicyUpdateParamsAlertType = "health_check_status_notification" + AlertingV3PolicyUpdateParamsAlertTypeHostnameAopCustomCertificateExpirationType AlertingV3PolicyUpdateParamsAlertType = "hostname_aop_custom_certificate_expiration_type" + AlertingV3PolicyUpdateParamsAlertTypeHTTPAlertEdgeError AlertingV3PolicyUpdateParamsAlertType = "http_alert_edge_error" + AlertingV3PolicyUpdateParamsAlertTypeHTTPAlertOriginError AlertingV3PolicyUpdateParamsAlertType = "http_alert_origin_error" + AlertingV3PolicyUpdateParamsAlertTypeIncidentAlert AlertingV3PolicyUpdateParamsAlertType = "incident_alert" + AlertingV3PolicyUpdateParamsAlertTypeLoadBalancingHealthAlert AlertingV3PolicyUpdateParamsAlertType = "load_balancing_health_alert" + AlertingV3PolicyUpdateParamsAlertTypeLoadBalancingPoolEnablementAlert AlertingV3PolicyUpdateParamsAlertType = "load_balancing_pool_enablement_alert" + AlertingV3PolicyUpdateParamsAlertTypeLogoMatchAlert AlertingV3PolicyUpdateParamsAlertType = "logo_match_alert" + AlertingV3PolicyUpdateParamsAlertTypeMagicTunnelHealthCheckEvent AlertingV3PolicyUpdateParamsAlertType = "magic_tunnel_health_check_event" + AlertingV3PolicyUpdateParamsAlertTypeMaintenanceEventNotification AlertingV3PolicyUpdateParamsAlertType = "maintenance_event_notification" + AlertingV3PolicyUpdateParamsAlertTypeMtlsCertificateStoreCertificateExpirationType AlertingV3PolicyUpdateParamsAlertType = "mtls_certificate_store_certificate_expiration_type" + AlertingV3PolicyUpdateParamsAlertTypePagesEventAlert AlertingV3PolicyUpdateParamsAlertType = "pages_event_alert" + AlertingV3PolicyUpdateParamsAlertTypeRadarNotification AlertingV3PolicyUpdateParamsAlertType = "radar_notification" + AlertingV3PolicyUpdateParamsAlertTypeRealOriginMonitoring AlertingV3PolicyUpdateParamsAlertType = "real_origin_monitoring" + AlertingV3PolicyUpdateParamsAlertTypeScriptmonitorAlertNewCodeChangeDetections AlertingV3PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_code_change_detections" + AlertingV3PolicyUpdateParamsAlertTypeScriptmonitorAlertNewHosts AlertingV3PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_hosts" + AlertingV3PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaliciousHosts AlertingV3PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_malicious_hosts" + AlertingV3PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaliciousScripts AlertingV3PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_malicious_scripts" + AlertingV3PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaliciousURL AlertingV3PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_malicious_url" + AlertingV3PolicyUpdateParamsAlertTypeScriptmonitorAlertNewMaxLengthResourceURL AlertingV3PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_max_length_resource_url" + AlertingV3PolicyUpdateParamsAlertTypeScriptmonitorAlertNewResources AlertingV3PolicyUpdateParamsAlertType = "scriptmonitor_alert_new_resources" + AlertingV3PolicyUpdateParamsAlertTypeSecondaryDNSAllPrimariesFailing AlertingV3PolicyUpdateParamsAlertType = "secondary_dns_all_primaries_failing" + AlertingV3PolicyUpdateParamsAlertTypeSecondaryDNSPrimariesFailing AlertingV3PolicyUpdateParamsAlertType = "secondary_dns_primaries_failing" + AlertingV3PolicyUpdateParamsAlertTypeSecondaryDNSZoneSuccessfullyUpdated AlertingV3PolicyUpdateParamsAlertType = "secondary_dns_zone_successfully_updated" + AlertingV3PolicyUpdateParamsAlertTypeSecondaryDNSZoneValidationWarning AlertingV3PolicyUpdateParamsAlertType = "secondary_dns_zone_validation_warning" + AlertingV3PolicyUpdateParamsAlertTypeSentinelAlert AlertingV3PolicyUpdateParamsAlertType = "sentinel_alert" + AlertingV3PolicyUpdateParamsAlertTypeStreamLiveNotifications AlertingV3PolicyUpdateParamsAlertType = "stream_live_notifications" + AlertingV3PolicyUpdateParamsAlertTypeTunnelHealthEvent AlertingV3PolicyUpdateParamsAlertType = "tunnel_health_event" + AlertingV3PolicyUpdateParamsAlertTypeTunnelUpdateEvent AlertingV3PolicyUpdateParamsAlertType = "tunnel_update_event" + AlertingV3PolicyUpdateParamsAlertTypeUniversalSslEventType AlertingV3PolicyUpdateParamsAlertType = "universal_ssl_event_type" + AlertingV3PolicyUpdateParamsAlertTypeWebAnalyticsMetricsUpdate AlertingV3PolicyUpdateParamsAlertType = "web_analytics_metrics_update" + AlertingV3PolicyUpdateParamsAlertTypeZoneAopCustomCertificateExpirationType AlertingV3PolicyUpdateParamsAlertType = "zone_aop_custom_certificate_expiration_type" +) + +// Optional filters that allow you to be alerted only on a subset of events for +// that alert type based on some criteria. This is only available for select alert +// types. See alert type documentation for more details. +type AlertingV3PolicyUpdateParamsFilters struct { + // Usage depends on specific alert type + Actions param.Field[[]string] `json:"actions"` + // Used for configuring radar_notification + AffectedASNs param.Field[[]string] `json:"affected_asns"` + // Used for configuring incident_alert + AffectedComponents param.Field[[]string] `json:"affected_components"` + // Used for configuring radar_notification + AffectedLocations param.Field[[]string] `json:"affected_locations"` + // Used for configuring maintenance_event_notification + AirportCode param.Field[[]string] `json:"airport_code"` + // Usage depends on specific alert type + AlertTriggerPreferences param.Field[[]string] `json:"alert_trigger_preferences"` + // Used for configuring magic_tunnel_health_check_event + AlertTriggerPreferencesValue param.Field[[]AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue] `json:"alert_trigger_preferences_value"` + // Used for configuring load_balancing_pool_enablement_alert + Enabled param.Field[[]string] `json:"enabled"` + // Used for configuring pages_event_alert + Environment param.Field[[]string] `json:"environment"` + // Used for configuring pages_event_alert + Event param.Field[[]string] `json:"event"` + // Used for configuring load_balancing_health_alert + EventSource param.Field[[]string] `json:"event_source"` + // Usage depends on specific alert type + EventType param.Field[[]string] `json:"event_type"` + // Usage depends on specific alert type + GroupBy param.Field[[]string] `json:"group_by"` + // Used for configuring health_check_status_notification + HealthCheckID param.Field[[]string] `json:"health_check_id"` + // Used for configuring incident_alert + IncidentImpact param.Field[[]AlertingV3PolicyUpdateParamsFiltersIncidentImpact] `json:"incident_impact"` + // Used for configuring stream_live_notifications + InputID param.Field[[]string] `json:"input_id"` + // Used for configuring billing_usage_alert + Limit param.Field[[]string] `json:"limit"` + // Used for configuring logo_match_alert + LogoTag param.Field[[]string] `json:"logo_tag"` + // Used for configuring advanced_ddos_attack_l4_alert + MegabitsPerSecond param.Field[[]string] `json:"megabits_per_second"` + // Used for configuring load_balancing_health_alert + NewHealth param.Field[[]string] `json:"new_health"` + // Used for configuring tunnel_health_event + NewStatus param.Field[[]string] `json:"new_status"` + // Used for configuring advanced_ddos_attack_l4_alert + PacketsPerSecond param.Field[[]string] `json:"packets_per_second"` + // Usage depends on specific alert type + PoolID param.Field[[]string] `json:"pool_id"` + // Used for configuring billing_usage_alert + Product param.Field[[]string] `json:"product"` + // Used for configuring pages_event_alert + ProjectID param.Field[[]string] `json:"project_id"` + // Used for configuring advanced_ddos_attack_l4_alert + Protocol param.Field[[]string] `json:"protocol"` + // Usage depends on specific alert type + QueryTag param.Field[[]string] `json:"query_tag"` + // Used for configuring advanced_ddos_attack_l7_alert + RequestsPerSecond param.Field[[]string] `json:"requests_per_second"` + // Usage depends on specific alert type + Selectors param.Field[[]string] `json:"selectors"` + // Used for configuring clickhouse_alert_fw_ent_anomaly + Services param.Field[[]string] `json:"services"` + // Usage depends on specific alert type + Slo param.Field[[]string] `json:"slo"` + // Used for configuring health_check_status_notification + Status param.Field[[]string] `json:"status"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetHostname param.Field[[]string] `json:"target_hostname"` + // Used for configuring advanced_ddos_attack_l4_alert + TargetIP param.Field[[]string] `json:"target_ip"` + // Used for configuring advanced_ddos_attack_l7_alert + TargetZoneName param.Field[[]string] `json:"target_zone_name"` + // Used for configuring traffic_anomalies_alert + TrafficExclusions param.Field[[]AlertingV3PolicyUpdateParamsFiltersTrafficExclusion] `json:"traffic_exclusions"` + // Used for configuring tunnel_health_event + TunnelID param.Field[[]string] `json:"tunnel_id"` + // Used for configuring magic_tunnel_health_check_event + TunnelName param.Field[[]string] `json:"tunnel_name"` + // Usage depends on specific alert type + Where param.Field[[]string] `json:"where"` + // Usage depends on specific alert type + Zones param.Field[[]string] `json:"zones"` +} + +func (r AlertingV3PolicyUpdateParamsFilters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue string + +const ( + AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue99_0 AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue = "99.0" + AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue98_0 AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue = "98.0" + AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue97_0 AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue = "97.0" +) + +type AlertingV3PolicyUpdateParamsFiltersIncidentImpact string + +const ( + AlertingV3PolicyUpdateParamsFiltersIncidentImpactIncidentImpactNone AlertingV3PolicyUpdateParamsFiltersIncidentImpact = "INCIDENT_IMPACT_NONE" + AlertingV3PolicyUpdateParamsFiltersIncidentImpactIncidentImpactMinor AlertingV3PolicyUpdateParamsFiltersIncidentImpact = "INCIDENT_IMPACT_MINOR" + AlertingV3PolicyUpdateParamsFiltersIncidentImpactIncidentImpactMajor AlertingV3PolicyUpdateParamsFiltersIncidentImpact = "INCIDENT_IMPACT_MAJOR" + AlertingV3PolicyUpdateParamsFiltersIncidentImpactIncidentImpactCritical AlertingV3PolicyUpdateParamsFiltersIncidentImpact = "INCIDENT_IMPACT_CRITICAL" +) + +type AlertingV3PolicyUpdateParamsFiltersTrafficExclusion string + +const ( + AlertingV3PolicyUpdateParamsFiltersTrafficExclusionSecurityEvents AlertingV3PolicyUpdateParamsFiltersTrafficExclusion = "security_events" +) diff --git a/alertingv3policy_test.go b/alertingv3policy_test.go new file mode 100644 index 00000000000..10d65706177 --- /dev/null +++ b/alertingv3policy_test.go @@ -0,0 +1,289 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestAlertingV3PolicyNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Alerting.V3.Policies.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.AlertingV3PolicyNewParams{ + AlertType: cloudflare.F(cloudflare.AlertingV3PolicyNewParamsAlertTypeUniversalSslEventType), + Enabled: cloudflare.F(true), + Mechanisms: cloudflare.F[any](map[string]interface{}{ + "email": map[string]interface{}{ + "0": map[string]interface{}{ + "id": "test@example.com", + }, + }, + "pagerduty": map[string]interface{}{ + "0": map[string]interface{}{ + "id": "e8133a15-00a4-4d69-aec1-32f70c51f6e5", + }, + }, + "webhooks": map[string]interface{}{ + "0": map[string]interface{}{ + "id": "14cc1190-5d2b-4b98-a696-c424cb2ad05f", + }, + }, + }), + Name: cloudflare.F("SSL Notification Event Policy"), + Description: cloudflare.F("Something describing the policy."), + Filters: cloudflare.F(cloudflare.AlertingV3PolicyNewParamsFilters{ + Actions: cloudflare.F([]string{"string", "string", "string"}), + AffectedASNs: cloudflare.F([]string{"string", "string", "string"}), + AffectedComponents: cloudflare.F([]string{"string", "string", "string"}), + AffectedLocations: cloudflare.F([]string{"string", "string", "string"}), + AirportCode: cloudflare.F([]string{"string", "string", "string"}), + AlertTriggerPreferences: cloudflare.F([]string{"string", "string", "string"}), + AlertTriggerPreferencesValue: cloudflare.F([]cloudflare.AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue{cloudflare.AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue99_0, cloudflare.AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue98_0, cloudflare.AlertingV3PolicyNewParamsFiltersAlertTriggerPreferencesValue97_0}), + Enabled: cloudflare.F([]string{"string", "string", "string"}), + Environment: cloudflare.F([]string{"string", "string", "string"}), + Event: cloudflare.F([]string{"string", "string", "string"}), + EventSource: cloudflare.F([]string{"string", "string", "string"}), + EventType: cloudflare.F([]string{"string", "string", "string"}), + GroupBy: cloudflare.F([]string{"string", "string", "string"}), + HealthCheckID: cloudflare.F([]string{"string", "string", "string"}), + IncidentImpact: cloudflare.F([]cloudflare.AlertingV3PolicyNewParamsFiltersIncidentImpact{cloudflare.AlertingV3PolicyNewParamsFiltersIncidentImpactIncidentImpactNone, cloudflare.AlertingV3PolicyNewParamsFiltersIncidentImpactIncidentImpactMinor, cloudflare.AlertingV3PolicyNewParamsFiltersIncidentImpactIncidentImpactMajor}), + InputID: cloudflare.F([]string{"string", "string", "string"}), + Limit: cloudflare.F([]string{"string", "string", "string"}), + LogoTag: cloudflare.F([]string{"string", "string", "string"}), + MegabitsPerSecond: cloudflare.F([]string{"string", "string", "string"}), + NewHealth: cloudflare.F([]string{"string", "string", "string"}), + NewStatus: cloudflare.F([]string{"string", "string", "string"}), + PacketsPerSecond: cloudflare.F([]string{"string", "string", "string"}), + PoolID: cloudflare.F([]string{"string", "string", "string"}), + Product: cloudflare.F([]string{"string", "string", "string"}), + ProjectID: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]string{"string", "string", "string"}), + QueryTag: cloudflare.F([]string{"string", "string", "string"}), + RequestsPerSecond: cloudflare.F([]string{"string", "string", "string"}), + Selectors: cloudflare.F([]string{"string", "string", "string"}), + Services: cloudflare.F([]string{"string", "string", "string"}), + Slo: cloudflare.F([]string{"99.9"}), + Status: cloudflare.F([]string{"string", "string", "string"}), + TargetHostname: cloudflare.F([]string{"string", "string", "string"}), + TargetIP: cloudflare.F([]string{"string", "string", "string"}), + TargetZoneName: cloudflare.F([]string{"string", "string", "string"}), + TrafficExclusions: cloudflare.F([]cloudflare.AlertingV3PolicyNewParamsFiltersTrafficExclusion{cloudflare.AlertingV3PolicyNewParamsFiltersTrafficExclusionSecurityEvents}), + TunnelID: cloudflare.F([]string{"string", "string", "string"}), + TunnelName: cloudflare.F([]string{"string", "string", "string"}), + Where: cloudflare.F([]string{"string", "string", "string"}), + Zones: cloudflare.F([]string{"string", "string", "string"}), + }), + }, + ) + 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 TestAlertingV3PolicyGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Alerting.V3.Policies.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0da2b59e-f118-439d-8097-bdfb215203c9", + ) + 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 TestAlertingV3PolicyUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Alerting.V3.Policies.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0da2b59e-f118-439d-8097-bdfb215203c9", + cloudflare.AlertingV3PolicyUpdateParams{ + AlertType: cloudflare.F(cloudflare.AlertingV3PolicyUpdateParamsAlertTypeUniversalSslEventType), + Description: cloudflare.F("Something describing the policy."), + Enabled: cloudflare.F(true), + Filters: cloudflare.F(cloudflare.AlertingV3PolicyUpdateParamsFilters{ + Actions: cloudflare.F([]string{"string", "string", "string"}), + AffectedASNs: cloudflare.F([]string{"string", "string", "string"}), + AffectedComponents: cloudflare.F([]string{"string", "string", "string"}), + AffectedLocations: cloudflare.F([]string{"string", "string", "string"}), + AirportCode: cloudflare.F([]string{"string", "string", "string"}), + AlertTriggerPreferences: cloudflare.F([]string{"string", "string", "string"}), + AlertTriggerPreferencesValue: cloudflare.F([]cloudflare.AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue{cloudflare.AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue99_0, cloudflare.AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue98_0, cloudflare.AlertingV3PolicyUpdateParamsFiltersAlertTriggerPreferencesValue97_0}), + Enabled: cloudflare.F([]string{"string", "string", "string"}), + Environment: cloudflare.F([]string{"string", "string", "string"}), + Event: cloudflare.F([]string{"string", "string", "string"}), + EventSource: cloudflare.F([]string{"string", "string", "string"}), + EventType: cloudflare.F([]string{"string", "string", "string"}), + GroupBy: cloudflare.F([]string{"string", "string", "string"}), + HealthCheckID: cloudflare.F([]string{"string", "string", "string"}), + IncidentImpact: cloudflare.F([]cloudflare.AlertingV3PolicyUpdateParamsFiltersIncidentImpact{cloudflare.AlertingV3PolicyUpdateParamsFiltersIncidentImpactIncidentImpactNone, cloudflare.AlertingV3PolicyUpdateParamsFiltersIncidentImpactIncidentImpactMinor, cloudflare.AlertingV3PolicyUpdateParamsFiltersIncidentImpactIncidentImpactMajor}), + InputID: cloudflare.F([]string{"string", "string", "string"}), + Limit: cloudflare.F([]string{"string", "string", "string"}), + LogoTag: cloudflare.F([]string{"string", "string", "string"}), + MegabitsPerSecond: cloudflare.F([]string{"string", "string", "string"}), + NewHealth: cloudflare.F([]string{"string", "string", "string"}), + NewStatus: cloudflare.F([]string{"string", "string", "string"}), + PacketsPerSecond: cloudflare.F([]string{"string", "string", "string"}), + PoolID: cloudflare.F([]string{"string", "string", "string"}), + Product: cloudflare.F([]string{"string", "string", "string"}), + ProjectID: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]string{"string", "string", "string"}), + QueryTag: cloudflare.F([]string{"string", "string", "string"}), + RequestsPerSecond: cloudflare.F([]string{"string", "string", "string"}), + Selectors: cloudflare.F([]string{"string", "string", "string"}), + Services: cloudflare.F([]string{"string", "string", "string"}), + Slo: cloudflare.F([]string{"99.9"}), + Status: cloudflare.F([]string{"string", "string", "string"}), + TargetHostname: cloudflare.F([]string{"string", "string", "string"}), + TargetIP: cloudflare.F([]string{"string", "string", "string"}), + TargetZoneName: cloudflare.F([]string{"string", "string", "string"}), + TrafficExclusions: cloudflare.F([]cloudflare.AlertingV3PolicyUpdateParamsFiltersTrafficExclusion{cloudflare.AlertingV3PolicyUpdateParamsFiltersTrafficExclusionSecurityEvents}), + TunnelID: cloudflare.F([]string{"string", "string", "string"}), + TunnelName: cloudflare.F([]string{"string", "string", "string"}), + Where: cloudflare.F([]string{"string", "string", "string"}), + Zones: cloudflare.F([]string{"string", "string", "string"}), + }), + Mechanisms: cloudflare.F[any](map[string]interface{}{ + "email": map[string]interface{}{ + "0": map[string]interface{}{ + "id": "test@example.com", + }, + }, + "pagerduty": map[string]interface{}{ + "0": map[string]interface{}{ + "id": "e8133a15-00a4-4d69-aec1-32f70c51f6e5", + }, + }, + "webhooks": map[string]interface{}{ + "0": map[string]interface{}{ + "id": "14cc1190-5d2b-4b98-a696-c424cb2ad05f", + }, + }, + }), + Name: cloudflare.F("SSL Notification Event Policy"), + }, + ) + 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 TestAlertingV3PolicyList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Alerting.V3.Policies.List(context.TODO(), "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()) + } +} + +func TestAlertingV3PolicyDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Alerting.V3.Policies.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0da2b59e-f118-439d-8097-bdfb215203c9", + ) + 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/aliases.go b/aliases.go index 5ebec7f6992..a7f3d5fbb65 100644 --- a/aliases.go +++ b/aliases.go @@ -4,6 +4,33 @@ package cloudflare import ( "github.com/cloudflare/cloudflare-sdk-go/internal/apierror" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" ) type Error = apierror.Error + +// This is an alias to an internal type. +type VectorizeCreateIndexResponse = shared.VectorizeCreateIndexResponse + +// This is an alias to an internal type. +type VectorizeCreateIndexResponseConfig = shared.VectorizeCreateIndexResponseConfig + +// Specifies the type of metric to use calculating distance. +// +// This is an alias to an internal type. +type VectorizeCreateIndexResponseConfigMetric = shared.VectorizeCreateIndexResponseConfigMetric + +// This is an alias to an internal value. +const VectorizeCreateIndexResponseConfigMetricCosine = shared.VectorizeCreateIndexResponseConfigMetricCosine + +// This is an alias to an internal value. +const VectorizeCreateIndexResponseConfigMetricEuclidean = shared.VectorizeCreateIndexResponseConfigMetricEuclidean + +// This is an alias to an internal value. +const VectorizeCreateIndexResponseConfigMetricDotProduct = shared.VectorizeCreateIndexResponseConfigMetricDotProduct + +// This is an alias to an internal type. +type WaitingRoomSettingsResponse = shared.WaitingRoomSettingsResponse + +// This is an alias to an internal type. +type WaitingRoomSettingsResponseResult = shared.WaitingRoomSettingsResponseResult diff --git a/api.md b/api.md index 611e1cdaecf..045623047c8 100644 --- a/api.md +++ b/api.md @@ -1,755 +1,8071 @@ +# Shared Response Types + +- shared.VectorizeCreateIndexResponse +- shared.WaitingRoomSettingsResponse + +# Accounts + +Response Types: + +- cloudflare.AccountGetResponse +- cloudflare.AccountUpdateResponse +- cloudflare.AccountAccountsListAccountsResponse + +Methods: + +- client.Accounts.Get(ctx context.Context, identifier interface{}) (cloudflare.AccountGetResponse, error) +- client.Accounts.Update(ctx context.Context, identifier interface{}, body cloudflare.AccountUpdateParams) (cloudflare.AccountUpdateResponse, error) +- client.Accounts.AccountsListAccounts(ctx context.Context, query cloudflare.AccountAccountsListAccountsParams) (cloudflare.AccountAccountsListAccountsResponse, error) + +## Addresses + +### AddressMaps + +Response Types: + +- cloudflare.AccountAddressAddressMapNewResponse +- cloudflare.AccountAddressAddressMapGetResponse +- cloudflare.AccountAddressAddressMapUpdateResponse +- cloudflare.AccountAddressAddressMapListResponse +- cloudflare.AccountAddressAddressMapDeleteResponse + +Methods: + +- client.Accounts.Addresses.AddressMaps.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountAddressAddressMapNewParams) (cloudflare.AccountAddressAddressMapNewResponse, error) +- client.Accounts.Addresses.AddressMaps.Get(ctx context.Context, accountIdentifier string, addressMapIdentifier string) (cloudflare.AccountAddressAddressMapGetResponse, error) +- client.Accounts.Addresses.AddressMaps.Update(ctx context.Context, accountIdentifier string, addressMapIdentifier string, body cloudflare.AccountAddressAddressMapUpdateParams) (cloudflare.AccountAddressAddressMapUpdateResponse, error) +- client.Accounts.Addresses.AddressMaps.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountAddressAddressMapListResponse, error) +- client.Accounts.Addresses.AddressMaps.Delete(ctx context.Context, accountIdentifier string, addressMapIdentifier string) (cloudflare.AccountAddressAddressMapDeleteResponse, error) + +#### Accounts + +Response Types: + +- cloudflare.AccountAddressAddressMapAccountUpdateResponse +- cloudflare.AccountAddressAddressMapAccountDeleteResponse + +Methods: + +- client.Accounts.Addresses.AddressMaps.Accounts.Update(ctx context.Context, accountIdentifier1 string, addressMapIdentifier string, accountIdentifier string) (cloudflare.AccountAddressAddressMapAccountUpdateResponse, error) +- client.Accounts.Addresses.AddressMaps.Accounts.Delete(ctx context.Context, accountIdentifier1 string, addressMapIdentifier string, accountIdentifier string) (cloudflare.AccountAddressAddressMapAccountDeleteResponse, error) + +#### IPs + +Response Types: + +- cloudflare.AccountAddressAddressMapIPUpdateResponse +- cloudflare.AccountAddressAddressMapIPDeleteResponse + +Methods: + +- client.Accounts.Addresses.AddressMaps.IPs.Update(ctx context.Context, accountIdentifier string, addressMapIdentifier string, ipAddress string) (cloudflare.AccountAddressAddressMapIPUpdateResponse, error) +- client.Accounts.Addresses.AddressMaps.IPs.Delete(ctx context.Context, accountIdentifier string, addressMapIdentifier string, ipAddress string) (cloudflare.AccountAddressAddressMapIPDeleteResponse, error) + +#### Zones + +Response Types: + +- cloudflare.AccountAddressAddressMapZoneUpdateResponse +- cloudflare.AccountAddressAddressMapZoneDeleteResponse + +Methods: + +- client.Accounts.Addresses.AddressMaps.Zones.Update(ctx context.Context, accountIdentifier string, addressMapIdentifier string, zoneIdentifier string) (cloudflare.AccountAddressAddressMapZoneUpdateResponse, error) +- client.Accounts.Addresses.AddressMaps.Zones.Delete(ctx context.Context, accountIdentifier string, addressMapIdentifier string, zoneIdentifier string) (cloudflare.AccountAddressAddressMapZoneDeleteResponse, error) + +### LoaDocuments + +Response Types: + +- cloudflare.AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponse + +Methods: + +- client.Accounts.Addresses.LoaDocuments.IPAddressManagementPrefixesUploadLoaDocument(ctx context.Context, accountIdentifier string, body cloudflare.AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentParams) (cloudflare.AccountAddressLoaDocumentIPAddressManagementPrefixesUploadLoaDocumentResponse, error) + +#### Downloads + +Response Types: + +- cloudflare.AccountAddressLoaDocumentDownloadListResponse + +Methods: + +- client.Accounts.Addresses.LoaDocuments.Downloads.List(ctx context.Context, accountIdentifier string, loaDocumentIdentifier string) (cloudflare.AccountAddressLoaDocumentDownloadListResponse, error) + +### Prefixes + +Response Types: + +- cloudflare.AccountAddressPrefixGetResponse +- cloudflare.AccountAddressPrefixUpdateResponse +- cloudflare.AccountAddressPrefixDeleteResponse +- cloudflare.AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponse +- cloudflare.AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponse + +Methods: + +- client.Accounts.Addresses.Prefixes.Get(ctx context.Context, accountIdentifier string, prefixIdentifier string) (cloudflare.AccountAddressPrefixGetResponse, error) +- client.Accounts.Addresses.Prefixes.Update(ctx context.Context, accountIdentifier string, prefixIdentifier string, body cloudflare.AccountAddressPrefixUpdateParams) (cloudflare.AccountAddressPrefixUpdateResponse, error) +- client.Accounts.Addresses.Prefixes.Delete(ctx context.Context, accountIdentifier string, prefixIdentifier string) (cloudflare.AccountAddressPrefixDeleteResponse, error) +- client.Accounts.Addresses.Prefixes.IPAddressManagementPrefixesAddPrefix(ctx context.Context, accountIdentifier string, body cloudflare.AccountAddressPrefixIPAddressManagementPrefixesAddPrefixParams) (cloudflare.AccountAddressPrefixIPAddressManagementPrefixesAddPrefixResponse, error) +- client.Accounts.Addresses.Prefixes.IPAddressManagementPrefixesListPrefixes(ctx context.Context, accountIdentifier string) (cloudflare.AccountAddressPrefixIPAddressManagementPrefixesListPrefixesResponse, error) + +#### Bgps + +##### Statuses + +Response Types: + +- cloudflare.AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponse +- cloudflare.AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponse + +Methods: + +- client.Accounts.Addresses.Prefixes.Bgps.Statuses.IPAddressManagementDynamicAdvertisementGetAdvertisementStatus(ctx context.Context, accountIdentifier string, prefixIdentifier string) (cloudflare.AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementGetAdvertisementStatusResponse, error) +- client.Accounts.Addresses.Prefixes.Bgps.Statuses.IPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatus(ctx context.Context, accountIdentifier string, prefixIdentifier string, body cloudflare.AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusParams) (cloudflare.AccountAddressPrefixBgpStatusIPAddressManagementDynamicAdvertisementUpdatePrefixDynamicAdvertisementStatusResponse, error) + +#### Delegations + +Response Types: + +- cloudflare.AccountAddressPrefixDelegationDeleteResponse +- cloudflare.AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponse +- cloudflare.AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponse + +Methods: + +- client.Accounts.Addresses.Prefixes.Delegations.Delete(ctx context.Context, accountIdentifier string, prefixIdentifier string, delegationIdentifier string) (cloudflare.AccountAddressPrefixDelegationDeleteResponse, error) +- client.Accounts.Addresses.Prefixes.Delegations.IPAddressManagementPrefixDelegationNewPrefixDelegation(ctx context.Context, accountIdentifier string, prefixIdentifier string, body cloudflare.AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationParams) (cloudflare.AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationNewPrefixDelegationResponse, error) +- client.Accounts.Addresses.Prefixes.Delegations.IPAddressManagementPrefixDelegationListPrefixDelegations(ctx context.Context, accountIdentifier string, prefixIdentifier string) (cloudflare.AccountAddressPrefixDelegationIPAddressManagementPrefixDelegationListPrefixDelegationsResponse, error) + +## Billings + +### Profiles + +Response Types: + +- cloudflare.AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponse + +Methods: + +- client.Accounts.Billings.Profiles.AccountBillingProfileBillingProfileDetails(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountBillingProfileAccountBillingProfileBillingProfileDetailsResponse, error) + +## BrandProtections + +### Submits + +Response Types: + +- cloudflare.AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponse + +Methods: + +- client.Accounts.BrandProtections.Submits.PhishingURLScannerSubmitSuspiciousURLForScanning(ctx context.Context, accountIdentifier string, body cloudflare.AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningParams) (cloudflare.AccountBrandProtectionSubmitPhishingURLScannerSubmitSuspiciousURLForScanningResponse, error) + +### URLInfos + +Response Types: + +- cloudflare.AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponse + +Methods: + +- client.Accounts.BrandProtections.URLInfos.PhishingURLInformationGetResultsForAURLScan(ctx context.Context, accountIdentifier string, query cloudflare.AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAURLScanParams) (cloudflare.AccountBrandProtectionURLInfoPhishingURLInformationGetResultsForAurlScanResponse, error) + +## CfdTunnels + +Response Types: + +- cloudflare.AccountCfdTunnelGetResponse +- cloudflare.AccountCfdTunnelUpdateResponse +- cloudflare.AccountCfdTunnelDeleteResponse +- cloudflare.AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponse +- cloudflare.AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse + +Methods: + +- client.Accounts.CfdTunnels.Get(ctx context.Context, accountIdentifier string, tunnelID string) (cloudflare.AccountCfdTunnelGetResponse, error) +- client.Accounts.CfdTunnels.Update(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountCfdTunnelUpdateParams) (cloudflare.AccountCfdTunnelUpdateResponse, error) +- client.Accounts.CfdTunnels.Delete(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountCfdTunnelDeleteParams) (cloudflare.AccountCfdTunnelDeleteResponse, error) +- client.Accounts.CfdTunnels.CloudflareTunnelNewACloudflareTunnel(ctx context.Context, accountIdentifier string, body cloudflare.AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelParams) (cloudflare.AccountCfdTunnelCloudflareTunnelNewACloudflareTunnelResponse, error) +- client.Accounts.CfdTunnels.CloudflareTunnelListCloudflareTunnels(ctx context.Context, accountIdentifier string, query cloudflare.AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsParams) (cloudflare.AccountCfdTunnelCloudflareTunnelListCloudflareTunnelsResponse, error) + +### Configurations + +Response Types: + +- cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponse +- cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponse + +Methods: + +- client.Accounts.CfdTunnels.Configurations.CloudflareTunnelConfigurationGetConfiguration(ctx context.Context, accountIdentifier string, tunnelID string) (cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationGetConfigurationResponse, error) +- client.Accounts.CfdTunnels.Configurations.CloudflareTunnelConfigurationPutConfiguration(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationParams) (cloudflare.AccountCfdTunnelConfigurationCloudflareTunnelConfigurationPutConfigurationResponse, error) + +### Connections + +Response Types: + +- cloudflare.AccountCfdTunnelConnectionDeleteResponse +- cloudflare.AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponse + +Methods: + +- client.Accounts.CfdTunnels.Connections.Delete(ctx context.Context, accountIdentifier string, tunnelID string, params cloudflare.AccountCfdTunnelConnectionDeleteParams) (cloudflare.AccountCfdTunnelConnectionDeleteResponse, error) +- client.Accounts.CfdTunnels.Connections.CloudflareTunnelListCloudflareTunnelConnections(ctx context.Context, accountIdentifier string, tunnelID string) (cloudflare.AccountCfdTunnelConnectionCloudflareTunnelListCloudflareTunnelConnectionsResponse, error) + +### Connectors + +Response Types: + +- cloudflare.AccountCfdTunnelConnectorGetResponse + +Methods: + +- client.Accounts.CfdTunnels.Connectors.Get(ctx context.Context, accountIdentifier string, tunnelID string, connectorID string) (cloudflare.AccountCfdTunnelConnectorGetResponse, error) + +### Management + +Response Types: + +- cloudflare.AccountCfdTunnelManagementListResponse + +Methods: + +- client.Accounts.CfdTunnels.Management.List(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountCfdTunnelManagementListParams) (cloudflare.AccountCfdTunnelManagementListResponse, error) + +### Tokens + +Response Types: + +- cloudflare.AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponse + +Methods: + +- client.Accounts.CfdTunnels.Tokens.CloudflareTunnelGetACloudflareTunnelToken(ctx context.Context, accountIdentifier string, tunnelID string) (cloudflare.AccountCfdTunnelTokenCloudflareTunnelGetACloudflareTunnelTokenResponse, error) + +## CustomPages + +Response Types: + +- cloudflare.AccountCustomPageGetResponse +- cloudflare.AccountCustomPageUpdateResponse +- cloudflare.AccountCustomPageCustomPagesForAnAccountListCustomPagesResponse + +Methods: + +- client.Accounts.CustomPages.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountCustomPageGetResponse, error) +- client.Accounts.CustomPages.Update(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountCustomPageUpdateParams) (cloudflare.AccountCustomPageUpdateResponse, error) +- client.Accounts.CustomPages.CustomPagesForAnAccountListCustomPages(ctx context.Context, accountIdentifier string) (cloudflare.AccountCustomPageCustomPagesForAnAccountListCustomPagesResponse, error) + +## Diagnostics + +### Traceroutes + +Response Types: + +- cloudflare.AccountDiagnosticTracerouteDiagnosticsTracerouteResponse + +Methods: + +- client.Accounts.Diagnostics.Traceroutes.DiagnosticsTraceroute(ctx context.Context, accountIdentifier string, body cloudflare.AccountDiagnosticTracerouteDiagnosticsTracerouteParams) (cloudflare.AccountDiagnosticTracerouteDiagnosticsTracerouteResponse, error) + +## Dlp + +### Datasets + +Response Types: + +- cloudflare.DlpDatasetArrayResponse +- cloudflare.DlpDatasetCreationResponse +- cloudflare.DlpDatasetNewVersionResponse +- cloudflare.DlpDatasetResponse + +Methods: + +- client.Accounts.Dlp.Datasets.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountDlpDatasetNewParams) (cloudflare.DlpDatasetCreationResponse, error) +- client.Accounts.Dlp.Datasets.Get(ctx context.Context, accountIdentifier string, datasetID string) (cloudflare.DlpDatasetResponse, error) +- client.Accounts.Dlp.Datasets.Update(ctx context.Context, accountIdentifier string, datasetID string, body cloudflare.AccountDlpDatasetUpdateParams) (cloudflare.DlpDatasetResponse, error) +- client.Accounts.Dlp.Datasets.List(ctx context.Context, accountIdentifier string) (cloudflare.DlpDatasetArrayResponse, error) +- client.Accounts.Dlp.Datasets.Delete(ctx context.Context, accountIdentifier string, datasetID string) error + +#### Upload + +Methods: + +- client.Accounts.Dlp.Datasets.Upload.Prepare(ctx context.Context, accountIdentifier string, datasetID string) (cloudflare.DlpDatasetNewVersionResponse, error) +- client.Accounts.Dlp.Datasets.Upload.Upload(ctx context.Context, accountIdentifier string, datasetID string, version int64) (cloudflare.DlpDatasetResponse, error) + +### Patterns + +#### Validates + +Response Types: + +- cloudflare.AccountDlpPatternValidateDlpPatternValidationValidatePatternResponse + +Methods: + +- client.Accounts.Dlp.Patterns.Validates.DlpPatternValidationValidatePattern(ctx context.Context, accountIdentifier string, body cloudflare.AccountDlpPatternValidateDlpPatternValidationValidatePatternParams) (cloudflare.AccountDlpPatternValidateDlpPatternValidationValidatePatternResponse, error) + +### PayloadLogs + +Response Types: + +- cloudflare.AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponse +- cloudflare.AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponse + +Methods: + +- client.Accounts.Dlp.PayloadLogs.DlpPayloadLogSettingsGetSettings(ctx context.Context, accountIdentifier string) (cloudflare.AccountDlpPayloadLogDlpPayloadLogSettingsGetSettingsResponse, error) +- client.Accounts.Dlp.PayloadLogs.DlpPayloadLogSettingsUpdateSettings(ctx context.Context, accountIdentifier string, body cloudflare.AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsParams) (cloudflare.AccountDlpPayloadLogDlpPayloadLogSettingsUpdateSettingsResponse, error) + +### Profiles + +Response Types: + +- cloudflare.AccountDlpProfileGetResponse +- cloudflare.AccountDlpProfileListResponse + +Methods: + +- client.Accounts.Dlp.Profiles.Get(ctx context.Context, accountIdentifier string, profileID string) (cloudflare.AccountDlpProfileGetResponse, error) +- client.Accounts.Dlp.Profiles.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountDlpProfileListResponse, error) + +#### Customs + +Response Types: + +- cloudflare.AccountDlpProfileCustomGetResponse +- cloudflare.AccountDlpProfileCustomUpdateResponse +- cloudflare.AccountDlpProfileCustomDeleteResponse +- cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponse + +Methods: + +- client.Accounts.Dlp.Profiles.Customs.Get(ctx context.Context, accountIdentifier string, profileID string) (cloudflare.AccountDlpProfileCustomGetResponse, error) +- client.Accounts.Dlp.Profiles.Customs.Update(ctx context.Context, accountIdentifier string, profileID string, body cloudflare.AccountDlpProfileCustomUpdateParams) (cloudflare.AccountDlpProfileCustomUpdateResponse, error) +- client.Accounts.Dlp.Profiles.Customs.Delete(ctx context.Context, accountIdentifier string, profileID string) (cloudflare.AccountDlpProfileCustomDeleteResponse, error) +- client.Accounts.Dlp.Profiles.Customs.DlpProfilesNewCustomProfiles(ctx context.Context, accountIdentifier string, body cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesParams) (cloudflare.AccountDlpProfileCustomDlpProfilesNewCustomProfilesResponse, error) + +#### Predefineds + +Response Types: + +- cloudflare.AccountDlpProfilePredefinedGetResponse +- cloudflare.AccountDlpProfilePredefinedUpdateResponse + +Methods: + +- client.Accounts.Dlp.Profiles.Predefineds.Get(ctx context.Context, accountIdentifier string, profileID string) (cloudflare.AccountDlpProfilePredefinedGetResponse, error) +- client.Accounts.Dlp.Profiles.Predefineds.Update(ctx context.Context, accountIdentifier string, profileID string, body cloudflare.AccountDlpProfilePredefinedUpdateParams) (cloudflare.AccountDlpProfilePredefinedUpdateResponse, error) + +## DNSFirewalls + +Response Types: + +- cloudflare.AccountDNSFirewallGetResponse +- cloudflare.AccountDNSFirewallUpdateResponse +- cloudflare.AccountDNSFirewallDeleteResponse +- cloudflare.AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponse +- cloudflare.AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponse + +Methods: + +- client.Accounts.DNSFirewalls.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountDNSFirewallGetResponse, error) +- client.Accounts.DNSFirewalls.Update(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountDNSFirewallUpdateParams) (cloudflare.AccountDNSFirewallUpdateResponse, error) +- client.Accounts.DNSFirewalls.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountDNSFirewallDeleteResponse, error) +- client.Accounts.DNSFirewalls.DNSFirewallNewDNSFirewallCluster(ctx context.Context, accountIdentifier string, body cloudflare.AccountDNSFirewallDNSFirewallNewDNSFirewallClusterParams) (cloudflare.AccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponse, error) +- client.Accounts.DNSFirewalls.DNSFirewallListDNSFirewallClusters(ctx context.Context, accountIdentifier string, query cloudflare.AccountDNSFirewallDNSFirewallListDNSFirewallClustersParams) (cloudflare.AccountDNSFirewallDNSFirewallListDNSFirewallClustersResponse, error) + +### DNSAnalytics + +#### Reports + +Response Types: + +- cloudflare.AccountDNSFirewallDNSAnalyticReportListResponse + +Methods: + +- client.Accounts.DNSFirewalls.DNSAnalytics.Reports.List(ctx context.Context, accountIdentifier string, identifier string, query cloudflare.AccountDNSFirewallDNSAnalyticReportListParams) (cloudflare.AccountDNSFirewallDNSAnalyticReportListResponse, error) + +##### Bytimes + +Response Types: + +- cloudflare.AccountDNSFirewallDNSAnalyticReportBytimeListResponse + +Methods: + +- client.Accounts.DNSFirewalls.DNSAnalytics.Reports.Bytimes.List(ctx context.Context, accountIdentifier string, identifier string, query cloudflare.AccountDNSFirewallDNSAnalyticReportBytimeListParams) (cloudflare.AccountDNSFirewallDNSAnalyticReportBytimeListResponse, error) + +## Emails + +### Routings + +#### Addresses + +Response Types: + +- cloudflare.AccountEmailRoutingAddressGetResponse +- cloudflare.AccountEmailRoutingAddressDeleteResponse +- cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponse +- cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse + +Methods: + +- client.Accounts.Emails.Routings.Addresses.Get(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string) (cloudflare.AccountEmailRoutingAddressGetResponse, error) +- client.Accounts.Emails.Routings.Addresses.Delete(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string) (cloudflare.AccountEmailRoutingAddressDeleteResponse, error) +- client.Accounts.Emails.Routings.Addresses.EmailRoutingDestinationAddressesNewADestinationAddress(ctx context.Context, accountIdentifier string, body cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressParams) (cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesNewADestinationAddressResponse, error) +- client.Accounts.Emails.Routings.Addresses.EmailRoutingDestinationAddressesListDestinationAddresses(ctx context.Context, accountIdentifier string, query cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams) (cloudflare.AccountEmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse, error) + +## Firewalls + +### AccessRules + +#### Rules + +Response Types: + +- cloudflare.AccountFirewallAccessRuleRuleGetResponse +- cloudflare.AccountFirewallAccessRuleRuleUpdateResponse +- cloudflare.AccountFirewallAccessRuleRuleDeleteResponse +- cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponse +- cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesResponse + +Methods: + +- client.Accounts.Firewalls.AccessRules.Rules.Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountFirewallAccessRuleRuleGetResponse, error) +- client.Accounts.Firewalls.AccessRules.Rules.Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body cloudflare.AccountFirewallAccessRuleRuleUpdateParams) (cloudflare.AccountFirewallAccessRuleRuleUpdateResponse, error) +- client.Accounts.Firewalls.AccessRules.Rules.Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountFirewallAccessRuleRuleDeleteResponse, error) +- client.Accounts.Firewalls.AccessRules.Rules.IPAccessRulesForAnAccountNewAnIPAccessRule(ctx context.Context, accountIdentifier interface{}, body cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleParams) (cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountNewAnIPAccessRuleResponse, error) +- client.Accounts.Firewalls.AccessRules.Rules.IPAccessRulesForAnAccountListIPAccessRules(ctx context.Context, accountIdentifier interface{}, query cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesParams) (cloudflare.AccountFirewallAccessRuleRuleIPAccessRulesForAnAccountListIPAccessRulesResponse, error) + +## Images + +### V1s + +Response Types: + +- cloudflare.AccountImageV1GetResponse +- cloudflare.AccountImageV1UpdateResponse +- cloudflare.AccountImageV1DeleteResponse +- cloudflare.AccountImageV1CloudflareImagesListImagesResponse +- cloudflare.AccountImageV1CloudflareImagesUploadAnImageViaURLResponse + +Methods: + +- client.Accounts.Images.V1s.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountImageV1GetResponse, error) +- client.Accounts.Images.V1s.Update(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountImageV1UpdateParams) (cloudflare.AccountImageV1UpdateResponse, error) +- client.Accounts.Images.V1s.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountImageV1DeleteResponse, error) +- client.Accounts.Images.V1s.CloudflareImagesListImages(ctx context.Context, accountIdentifier string, query cloudflare.AccountImageV1CloudflareImagesListImagesParams) (cloudflare.AccountImageV1CloudflareImagesListImagesResponse, error) +- client.Accounts.Images.V1s.CloudflareImagesUploadAnImageViaURL(ctx context.Context, accountIdentifier string, body cloudflare.AccountImageV1CloudflareImagesUploadAnImageViaURLParams) (cloudflare.AccountImageV1CloudflareImagesUploadAnImageViaURLResponse, error) + +#### Keys + +Response Types: + +- cloudflare.AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponse + +Methods: + +- client.Accounts.Images.V1s.Keys.CloudflareImagesKeysListSigningKeys(ctx context.Context, accountIdentifier string) (cloudflare.AccountImageV1KeyCloudflareImagesKeysListSigningKeysResponse, error) + +#### Stats + +Response Types: + +- cloudflare.AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponse + +Methods: + +- client.Accounts.Images.V1s.Stats.CloudflareImagesImagesUsageStatistics(ctx context.Context, accountIdentifier string) (cloudflare.AccountImageV1StatCloudflareImagesImagesUsageStatisticsResponse, error) + +#### Variants + +Response Types: + +- cloudflare.AccountImageV1VariantGetResponse +- cloudflare.AccountImageV1VariantUpdateResponse +- cloudflare.AccountImageV1VariantDeleteResponse +- cloudflare.AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponse +- cloudflare.AccountImageV1VariantCloudflareImagesVariantsListVariantsResponse + +Methods: + +- client.Accounts.Images.V1s.Variants.Get(ctx context.Context, accountIdentifier string, identifier interface{}) (cloudflare.AccountImageV1VariantGetResponse, error) +- client.Accounts.Images.V1s.Variants.Update(ctx context.Context, accountIdentifier string, identifier interface{}, body cloudflare.AccountImageV1VariantUpdateParams) (cloudflare.AccountImageV1VariantUpdateResponse, error) +- client.Accounts.Images.V1s.Variants.Delete(ctx context.Context, accountIdentifier string, identifier interface{}) (cloudflare.AccountImageV1VariantDeleteResponse, error) +- client.Accounts.Images.V1s.Variants.CloudflareImagesVariantsNewAVariant(ctx context.Context, accountIdentifier string, body cloudflare.AccountImageV1VariantCloudflareImagesVariantsNewAVariantParams) (cloudflare.AccountImageV1VariantCloudflareImagesVariantsNewAVariantResponse, error) +- client.Accounts.Images.V1s.Variants.CloudflareImagesVariantsListVariants(ctx context.Context, accountIdentifier string) (cloudflare.AccountImageV1VariantCloudflareImagesVariantsListVariantsResponse, error) + +#### Blobs + +Methods: + +- client.Accounts.Images.V1s.Blobs.CloudflareImagesBaseImage(ctx context.Context, accountIdentifier string, identifier string) (http.Response, error) + +### V2s + +#### DirectUploads + +Response Types: + +- cloudflare.AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2Response + +Methods: + +- client.Accounts.Images.V2s.DirectUploads.CloudflareImagesNewAuthenticatedDirectUploadURLV2(ctx context.Context, accountIdentifier string, body cloudflare.AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadURLV2Params) (cloudflare.AccountImageV2DirectUploadCloudflareImagesNewAuthenticatedDirectUploadUrlv2Response, error) + +## Intel + +### ASNs + +Response Types: + +- cloudflare.AccountIntelASNGetResponse + +Methods: + +- client.Accounts.Intel.ASNs.Get(ctx context.Context, accountIdentifier string, asn interface{}) (cloudflare.AccountIntelASNGetResponse, error) + +#### Subnets + +Response Types: + +- cloudflare.AccountIntelASNSubnetListResponse + +Methods: + +- client.Accounts.Intel.ASNs.Subnets.List(ctx context.Context, accountIdentifier string, asn int64) (cloudflare.AccountIntelASNSubnetListResponse, error) + +### DNS + +Response Types: + +- cloudflare.AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponse + +Methods: + +- client.Accounts.Intel.DNS.PassiveDNSByIPGetPassiveDNSByIP(ctx context.Context, accountIdentifier string, query cloudflare.AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPParams) (cloudflare.AccountIntelDNSPassiveDNSByIPGetPassiveDNSByIPResponse, error) + +### Domains + +Response Types: + +- cloudflare.AccountIntelDomainDomainIntelligenceGetDomainDetailsResponse + +Methods: + +- client.Accounts.Intel.Domains.DomainIntelligenceGetDomainDetails(ctx context.Context, accountIdentifier string, query cloudflare.AccountIntelDomainDomainIntelligenceGetDomainDetailsParams) (cloudflare.AccountIntelDomainDomainIntelligenceGetDomainDetailsResponse, error) + +#### Bulks + +Response Types: + +- cloudflare.AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponse + +Methods: + +- client.Accounts.Intel.Domains.Bulks.DomainIntelligenceGetMultipleDomainDetails(ctx context.Context, accountIdentifier string, query cloudflare.AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsParams) (cloudflare.AccountIntelDomainBulkDomainIntelligenceGetMultipleDomainDetailsResponse, error) + +### DomainHistories + +Response Types: + +- cloudflare.AccountIntelDomainHistoryListResponse + +Methods: + +- client.Accounts.Intel.DomainHistories.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountIntelDomainHistoryListParams) (cloudflare.AccountIntelDomainHistoryListResponse, error) + +### IndicatorFeeds + +#### Permissions + +Response Types: + +- cloudflare.AccountIntelIndicatorFeedPermissionRemoveResponse +- cloudflare.AccountIntelIndicatorFeedPermissionViewResponse + +Methods: + +- client.Accounts.Intel.IndicatorFeeds.Permissions.Remove(ctx context.Context, accountIdentifier string, body cloudflare.AccountIntelIndicatorFeedPermissionRemoveParams) (cloudflare.AccountIntelIndicatorFeedPermissionRemoveResponse, error) +- client.Accounts.Intel.IndicatorFeeds.Permissions.View(ctx context.Context, accountIdentifier string) (cloudflare.AccountIntelIndicatorFeedPermissionViewResponse, error) + +### IPs + +Response Types: + +- cloudflare.AccountIntelIpipIntelligenceGetIPOverviewResponse + +Methods: + +- client.Accounts.Intel.IPs.IPIntelligenceGetIPOverview(ctx context.Context, accountIdentifier string, query cloudflare.AccountIntelIPIPIntelligenceGetIPOverviewParams) (cloudflare.AccountIntelIpipIntelligenceGetIPOverviewResponse, error) + +### IPLists + +Response Types: + +- cloudflare.AccountIntelIPListIPListGetIPListsResponse + +Methods: + +- client.Accounts.Intel.IPLists.IPListGetIPLists(ctx context.Context, accountIdentifier string) (cloudflare.AccountIntelIPListIPListGetIPListsResponse, error) + +### Miscategorizations + +Response Types: + +- cloudflare.AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponse + +Methods: + +- client.Accounts.Intel.Miscategorizations.MiscategorizationNewMiscategorization(ctx context.Context, accountIdentifier string, body cloudflare.AccountIntelMiscategorizationMiscategorizationNewMiscategorizationParams) (cloudflare.AccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponse, error) + +### Sinkholes + +Response Types: + +- cloudflare.AccountIntelSinkholeListResponse + +Methods: + +- client.Accounts.Intel.Sinkholes.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountIntelSinkholeListResponse, error) + +### Whois + +Response Types: + +- cloudflare.AccountIntelWhoisWhoisRecordGetWhoisRecordResponse + +Methods: + +- client.Accounts.Intel.Whois.WhoisRecordGetWhoisRecord(ctx context.Context, accountIdentifier string, query cloudflare.AccountIntelWhoisWhoisRecordGetWhoisRecordParams) (cloudflare.AccountIntelWhoisWhoisRecordGetWhoisRecordResponse, error) + +## LoadBalancers + +### Monitors + +Response Types: + +- cloudflare.Monitor +- cloudflare.AccountLoadBalancerMonitorDeleteResponse +- cloudflare.AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponse + +Methods: + +- client.Accounts.LoadBalancers.Monitors.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.Monitor, error) +- client.Accounts.LoadBalancers.Monitors.Update(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountLoadBalancerMonitorUpdateParams) (cloudflare.Monitor, error) +- client.Accounts.LoadBalancers.Monitors.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountLoadBalancerMonitorDeleteResponse, error) +- client.Accounts.LoadBalancers.Monitors.AccountLoadBalancerMonitorsNewMonitor(ctx context.Context, accountIdentifier string, body cloudflare.AccountLoadBalancerMonitorAccountLoadBalancerMonitorsNewMonitorParams) (cloudflare.Monitor, error) +- client.Accounts.LoadBalancers.Monitors.AccountLoadBalancerMonitorsListMonitors(ctx context.Context, accountIdentifier string) (cloudflare.AccountLoadBalancerMonitorAccountLoadBalancerMonitorsListMonitorsResponse, error) +- client.Accounts.LoadBalancers.Monitors.Patch(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountLoadBalancerMonitorPatchParams) (cloudflare.Monitor, error) + +#### Previews + +Response Types: + +- cloudflare.AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponse + +Methods: + +- client.Accounts.LoadBalancers.Monitors.Previews.AccountLoadBalancerMonitorsPreviewMonitor(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorParams) (cloudflare.AccountLoadBalancerMonitorPreviewAccountLoadBalancerMonitorsPreviewMonitorResponse, error) + +#### References + +Response Types: + +- cloudflare.AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponse + +Methods: + +- client.Accounts.LoadBalancers.Monitors.References.AccountLoadBalancerMonitorsListMonitorReferences(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountLoadBalancerMonitorReferenceAccountLoadBalancerMonitorsListMonitorReferencesResponse, error) + +### Pools + +Response Types: + +- cloudflare.Pool +- cloudflare.AccountLoadBalancerPoolDeleteResponse +- cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponse +- cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponse + +Methods: + +- client.Accounts.LoadBalancers.Pools.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.Pool, error) +- client.Accounts.LoadBalancers.Pools.Update(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountLoadBalancerPoolUpdateParams) (cloudflare.Pool, error) +- client.Accounts.LoadBalancers.Pools.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountLoadBalancerPoolDeleteResponse, error) +- client.Accounts.LoadBalancers.Pools.AccountLoadBalancerPoolsNewPool(ctx context.Context, accountIdentifier string, body cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsNewPoolParams) (cloudflare.Pool, error) +- client.Accounts.LoadBalancers.Pools.AccountLoadBalancerPoolsListPools(ctx context.Context, accountIdentifier string, query cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsParams) (cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsListPoolsResponse, error) +- client.Accounts.LoadBalancers.Pools.AccountLoadBalancerPoolsPatchPools(ctx context.Context, accountIdentifier string, body cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsParams) (cloudflare.AccountLoadBalancerPoolAccountLoadBalancerPoolsPatchPoolsResponse, error) +- client.Accounts.LoadBalancers.Pools.Patch(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountLoadBalancerPoolPatchParams) (cloudflare.Pool, error) + +#### Health + +Response Types: + +- cloudflare.AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponse + +Methods: + +- client.Accounts.LoadBalancers.Pools.Health.AccountLoadBalancerPoolsPoolHealthDetails(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountLoadBalancerPoolHealthAccountLoadBalancerPoolsPoolHealthDetailsResponse, error) + +#### Previews + +Response Types: + +- cloudflare.AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponse + +Methods: + +- client.Accounts.LoadBalancers.Pools.Previews.AccountLoadBalancerPoolsPreviewPool(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolParams) (cloudflare.AccountLoadBalancerPoolPreviewAccountLoadBalancerPoolsPreviewPoolResponse, error) + +#### References + +Response Types: + +- cloudflare.AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponse + +Methods: + +- client.Accounts.LoadBalancers.Pools.References.AccountLoadBalancerPoolsListPoolReferences(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountLoadBalancerPoolReferenceAccountLoadBalancerPoolsListPoolReferencesResponse, error) + +### Previews + +Response Types: + +- cloudflare.AccountLoadBalancerPreviewGetResponse + +Methods: + +- client.Accounts.LoadBalancers.Previews.Get(ctx context.Context, accountIdentifier string, previewID interface{}) (cloudflare.AccountLoadBalancerPreviewGetResponse, error) + +### Regions + +Response Types: + +- cloudflare.AccountLoadBalancerRegionGetResponse +- cloudflare.AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponse + +Methods: + +- client.Accounts.LoadBalancers.Regions.Get(ctx context.Context, accountIdentifier string, regionCode cloudflare.AccountLoadBalancerRegionGetParamsRegionCode) (cloudflare.AccountLoadBalancerRegionGetResponse, error) +- client.Accounts.LoadBalancers.Regions.LoadBalancerRegionsListRegions(ctx context.Context, accountIdentifier string, query cloudflare.AccountLoadBalancerRegionLoadBalancerRegionsListRegionsParams) (cloudflare.AccountLoadBalancerRegionLoadBalancerRegionsListRegionsResponse, error) + +### Searches + +Response Types: + +- cloudflare.AccountLoadBalancerSearchListResponse + +Methods: + +- client.Accounts.LoadBalancers.Searches.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountLoadBalancerSearchListParams) (cloudflare.AccountLoadBalancerSearchListResponse, error) + +## Logpushes + +### Datasets + +#### Fields + +Response Types: + +- cloudflare.AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponse + +Methods: + +- client.Accounts.Logpushes.Datasets.Fields.GetAccountsAccountIdentifierLogpushDatasetsDatasetFields(ctx context.Context, accountIdentifier string, dataset string) (cloudflare.AccountLogpushDatasetFieldGetAccountsAccountIdentifierLogpushDatasetsDatasetFieldsResponse, error) + +#### Jobs + +Response Types: + +- cloudflare.AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponse + +Methods: + +- client.Accounts.Logpushes.Datasets.Jobs.GetAccountsAccountIdentifierLogpushDatasetsDatasetJobs(ctx context.Context, accountIdentifier string, dataset string) (cloudflare.AccountLogpushDatasetJobGetAccountsAccountIdentifierLogpushDatasetsDatasetJobsResponse, error) + +### Jobs + +Response Types: + +- cloudflare.AccountLogpushJobGetResponse +- cloudflare.AccountLogpushJobUpdateResponse +- cloudflare.AccountLogpushJobDeleteResponse +- cloudflare.AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponse +- cloudflare.AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponse + +Methods: + +- client.Accounts.Logpushes.Jobs.Get(ctx context.Context, accountIdentifier string, jobIdentifier int64) (cloudflare.AccountLogpushJobGetResponse, error) +- client.Accounts.Logpushes.Jobs.Update(ctx context.Context, accountIdentifier string, jobIdentifier int64, body cloudflare.AccountLogpushJobUpdateParams) (cloudflare.AccountLogpushJobUpdateResponse, error) +- client.Accounts.Logpushes.Jobs.Delete(ctx context.Context, accountIdentifier string, jobIdentifier int64) (cloudflare.AccountLogpushJobDeleteResponse, error) +- client.Accounts.Logpushes.Jobs.GetAccountsAccountIdentifierLogpushJobs(ctx context.Context, accountIdentifier string) (cloudflare.AccountLogpushJobGetAccountsAccountIdentifierLogpushJobsResponse, error) +- client.Accounts.Logpushes.Jobs.PostAccountsAccountIdentifierLogpushJobs(ctx context.Context, accountIdentifier string, body cloudflare.AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsParams) (cloudflare.AccountLogpushJobPostAccountsAccountIdentifierLogpushJobsResponse, error) + +### Ownerships + +Response Types: + +- cloudflare.AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponse + +Methods: + +- client.Accounts.Logpushes.Ownerships.PostAccountsAccountIdentifierLogpushOwnership(ctx context.Context, accountIdentifier string, body cloudflare.AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipParams) (cloudflare.AccountLogpushOwnershipPostAccountsAccountIdentifierLogpushOwnershipResponse, error) + +#### Validates + +Response Types: + +- cloudflare.AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponse + +Methods: + +- client.Accounts.Logpushes.Ownerships.Validates.PostAccountsAccountIdentifierLogpushOwnershipValidate(ctx context.Context, accountIdentifier string, body cloudflare.AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateParams) (cloudflare.AccountLogpushOwnershipValidatePostAccountsAccountIdentifierLogpushOwnershipValidateResponse, error) + +### Validates + +#### Destinations + +##### Exists + +Response Types: + +- cloudflare.AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponse + +Methods: + +- client.Accounts.Logpushes.Validates.Destinations.Exists.DeleteAccountsAccountIdentifierLogpushValidateDestinationExists(ctx context.Context, accountIdentifier string, body cloudflare.AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsParams) (cloudflare.AccountLogpushValidateDestinationExistDeleteAccountsAccountIdentifierLogpushValidateDestinationExistsResponse, error) + +#### Origins + +Response Types: + +- cloudflare.AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponse + +Methods: + +- client.Accounts.Logpushes.Validates.Origins.PostAccountsAccountIdentifierLogpushValidateOrigin(ctx context.Context, accountIdentifier string, body cloudflare.AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginParams) (cloudflare.AccountLogpushValidateOriginPostAccountsAccountIdentifierLogpushValidateOriginResponse, error) + +## Logs + +### Controls + +#### Cmb + +##### Configs + +Response Types: + +- cloudflare.AccountLogControlCmbConfigDeleteResponse +- cloudflare.AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponse +- cloudflare.AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponse + +Methods: + +- client.Accounts.Logs.Controls.Cmb.Configs.Delete(ctx context.Context, accountIdentifier string) (cloudflare.AccountLogControlCmbConfigDeleteResponse, error) +- client.Accounts.Logs.Controls.Cmb.Configs.GetAccountsAccountIdentifierLogsControlCmbConfig(ctx context.Context, accountIdentifier string) (cloudflare.AccountLogControlCmbConfigGetAccountsAccountIdentifierLogsControlCmbConfigResponse, error) +- client.Accounts.Logs.Controls.Cmb.Configs.PutAccountsAccountIdentifierLogsControlCmbConfig(ctx context.Context, accountIdentifier string, body cloudflare.AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigParams) (cloudflare.AccountLogControlCmbConfigPutAccountsAccountIdentifierLogsControlCmbConfigResponse, error) + +## Magic + +### CfInterconnects + +Response Types: + +- cloudflare.AccountMagicCfInterconnectGetResponse +- cloudflare.AccountMagicCfInterconnectUpdateResponse +- cloudflare.AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponse +- cloudflare.AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponse + +Methods: + +- client.Accounts.Magic.CfInterconnects.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.AccountMagicCfInterconnectGetResponse, error) +- client.Accounts.Magic.CfInterconnects.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.AccountMagicCfInterconnectUpdateParams) (cloudflare.AccountMagicCfInterconnectUpdateResponse, error) +- client.Accounts.Magic.CfInterconnects.MagicInterconnectsListInterconnects(ctx context.Context, accountIdentifier string) (cloudflare.AccountMagicCfInterconnectMagicInterconnectsListInterconnectsResponse, error) +- client.Accounts.Magic.CfInterconnects.MagicInterconnectsUpdateMultipleInterconnects(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsParams) (cloudflare.AccountMagicCfInterconnectMagicInterconnectsUpdateMultipleInterconnectsResponse, error) + +### GreTunnels + +Response Types: + +- cloudflare.AccountMagicGreTunnelGetResponse +- cloudflare.AccountMagicGreTunnelUpdateResponse +- cloudflare.AccountMagicGreTunnelDeleteResponse +- cloudflare.AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponse +- cloudflare.AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponse +- cloudflare.AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponse + +Methods: + +- client.Accounts.Magic.GreTunnels.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.AccountMagicGreTunnelGetResponse, error) +- client.Accounts.Magic.GreTunnels.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.AccountMagicGreTunnelUpdateParams) (cloudflare.AccountMagicGreTunnelUpdateResponse, error) +- client.Accounts.Magic.GreTunnels.Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.AccountMagicGreTunnelDeleteResponse, error) +- client.Accounts.Magic.GreTunnels.MagicGreTunnelsNewGreTunnels(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsParams) (cloudflare.AccountMagicGreTunnelMagicGreTunnelsNewGreTunnelsResponse, error) +- client.Accounts.Magic.GreTunnels.MagicGreTunnelsListGreTunnels(ctx context.Context, accountIdentifier string) (cloudflare.AccountMagicGreTunnelMagicGreTunnelsListGreTunnelsResponse, error) +- client.Accounts.Magic.GreTunnels.MagicGreTunnelsUpdateMultipleGreTunnels(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsParams) (cloudflare.AccountMagicGreTunnelMagicGreTunnelsUpdateMultipleGreTunnelsResponse, error) + +### IpsecTunnels + +Response Types: + +- cloudflare.AccountMagicIpsecTunnelGetResponse +- cloudflare.AccountMagicIpsecTunnelUpdateResponse +- cloudflare.AccountMagicIpsecTunnelDeleteResponse +- cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponse +- cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponse +- cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponse + +Methods: + +- client.Accounts.Magic.IpsecTunnels.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.AccountMagicIpsecTunnelGetResponse, error) +- client.Accounts.Magic.IpsecTunnels.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.AccountMagicIpsecTunnelUpdateParams) (cloudflare.AccountMagicIpsecTunnelUpdateResponse, error) +- client.Accounts.Magic.IpsecTunnels.Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.AccountMagicIpsecTunnelDeleteResponse, error) +- client.Accounts.Magic.IpsecTunnels.MagicIPsecTunnelsNewIPsecTunnels(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsParams) (cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsNewIPsecTunnelsResponse, error) +- client.Accounts.Magic.IpsecTunnels.MagicIPsecTunnelsListIPsecTunnels(ctx context.Context, accountIdentifier string) (cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsListIPsecTunnelsResponse, error) +- client.Accounts.Magic.IpsecTunnels.MagicIPsecTunnelsUpdateMultipleIPsecTunnels(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsParams) (cloudflare.AccountMagicIpsecTunnelMagicIPsecTunnelsUpdateMultipleIPsecTunnelsResponse, error) + +#### PskGenerates + +Response Types: + +- cloudflare.AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponse + +Methods: + +- client.Accounts.Magic.IpsecTunnels.PskGenerates.MagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnels(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.AccountMagicIpsecTunnelPskGenerateMagicIPsecTunnelsGeneratePreSharedKeyPskForIPsecTunnelsResponse, error) + +### Routes + +Response Types: + +- cloudflare.AccountMagicRouteGetResponse +- cloudflare.AccountMagicRouteUpdateResponse +- cloudflare.AccountMagicRouteDeleteResponse +- cloudflare.AccountMagicRouteDeleteManyResponse +- cloudflare.AccountMagicRouteMagicStaticRoutesNewRoutesResponse +- cloudflare.AccountMagicRouteMagicStaticRoutesListRoutesResponse +- cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponse + +Methods: + +- client.Accounts.Magic.Routes.Get(ctx context.Context, accountIdentifier string, routeIdentifier string) (cloudflare.AccountMagicRouteGetResponse, error) +- client.Accounts.Magic.Routes.Update(ctx context.Context, accountIdentifier string, routeIdentifier string, body cloudflare.AccountMagicRouteUpdateParams) (cloudflare.AccountMagicRouteUpdateResponse, error) +- client.Accounts.Magic.Routes.Delete(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicRouteDeleteParams) (cloudflare.AccountMagicRouteDeleteResponse, error) +- client.Accounts.Magic.Routes.DeleteMany(ctx context.Context, accountIdentifier string, routeIdentifier string) (cloudflare.AccountMagicRouteDeleteManyResponse, error) +- client.Accounts.Magic.Routes.MagicStaticRoutesNewRoutes(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicRouteMagicStaticRoutesNewRoutesParams) (cloudflare.AccountMagicRouteMagicStaticRoutesNewRoutesResponse, error) +- client.Accounts.Magic.Routes.MagicStaticRoutesListRoutes(ctx context.Context, accountIdentifier string) (cloudflare.AccountMagicRouteMagicStaticRoutesListRoutesResponse, error) +- client.Accounts.Magic.Routes.MagicStaticRoutesUpdateManyRoutes(ctx context.Context, accountIdentifier string, body cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesParams) (cloudflare.AccountMagicRouteMagicStaticRoutesUpdateManyRoutesResponse, error) + +## Members + +Response Types: + +- cloudflare.AccountMemberGetResponse +- cloudflare.AccountMemberUpdateResponse +- cloudflare.AccountMemberDeleteResponse +- cloudflare.AccountMemberAccountMembersAddMemberResponse +- cloudflare.AccountMemberAccountMembersListMembersResponse + +Methods: + +- client.Accounts.Members.Get(ctx context.Context, accountIdentifier interface{}, identifier string) (cloudflare.AccountMemberGetResponse, error) +- client.Accounts.Members.Update(ctx context.Context, accountIdentifier interface{}, identifier string, body cloudflare.AccountMemberUpdateParams) (cloudflare.AccountMemberUpdateResponse, error) +- client.Accounts.Members.Delete(ctx context.Context, accountIdentifier interface{}, identifier string) (cloudflare.AccountMemberDeleteResponse, error) +- client.Accounts.Members.AccountMembersAddMember(ctx context.Context, accountIdentifier interface{}, body cloudflare.AccountMemberAccountMembersAddMemberParams) (cloudflare.AccountMemberAccountMembersAddMemberResponse, error) +- client.Accounts.Members.AccountMembersListMembers(ctx context.Context, accountIdentifier interface{}, query cloudflare.AccountMemberAccountMembersListMembersParams) (cloudflare.AccountMemberAccountMembersListMembersResponse, error) + +## Mnms + +### Configs + +Response Types: + +- cloudflare.AccountMnmConfigDeleteResponse +- cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponse +- cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponse +- cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponse +- cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponse + +Methods: + +- client.Accounts.Mnms.Configs.Delete(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmConfigDeleteResponse, error) +- client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationNewAccountConfiguration(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationNewAccountConfigurationResponse, error) +- client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationListAccountConfiguration(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationListAccountConfigurationResponse, error) +- client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationUpdateAccountConfigurationFields(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAccountConfigurationFieldsResponse, error) +- client.Accounts.Mnms.Configs.MagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfiguration(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmConfigMagicNetworkMonitoringConfigurationUpdateAnEntireAccountConfigurationResponse, error) + +#### Fulls + +Response Types: + +- cloudflare.AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponse + +Methods: + +- client.Accounts.Mnms.Configs.Fulls.MagicNetworkMonitoringConfigurationListRulesAndAccountConfiguration(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmConfigFullMagicNetworkMonitoringConfigurationListRulesAndAccountConfigurationResponse, error) + +### Rules + +Response Types: + +- cloudflare.AccountMnmRuleGetResponse +- cloudflare.AccountMnmRuleUpdateResponse +- cloudflare.AccountMnmRuleDeleteResponse +- cloudflare.AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponse +- cloudflare.AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponse +- cloudflare.AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponse + +Methods: + +- client.Accounts.Mnms.Rules.Get(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}) (cloudflare.AccountMnmRuleGetResponse, error) +- client.Accounts.Mnms.Rules.Update(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}) (cloudflare.AccountMnmRuleUpdateResponse, error) +- client.Accounts.Mnms.Rules.Delete(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}) (cloudflare.AccountMnmRuleDeleteResponse, error) +- client.Accounts.Mnms.Rules.MagicNetworkMonitoringRulesNewRules(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmRuleMagicNetworkMonitoringRulesNewRulesResponse, error) +- client.Accounts.Mnms.Rules.MagicNetworkMonitoringRulesListRules(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmRuleMagicNetworkMonitoringRulesListRulesResponse, error) +- client.Accounts.Mnms.Rules.MagicNetworkMonitoringRulesUpdateRules(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountMnmRuleMagicNetworkMonitoringRulesUpdateRulesResponse, error) + +#### Advertisements + +Response Types: + +- cloudflare.AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponse + +Methods: + +- client.Accounts.Mnms.Rules.Advertisements.MagicNetworkMonitoringRulesUpdateAdvertisementForRule(ctx context.Context, accountIdentifier interface{}, ruleIdentifier interface{}) (cloudflare.AccountMnmRuleAdvertisementMagicNetworkMonitoringRulesUpdateAdvertisementForRuleResponse, error) + +## MtlsCertificates + +Response Types: + +- cloudflare.AccountMtlsCertificateGetResponse +- cloudflare.AccountMtlsCertificateDeleteResponse +- cloudflare.AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponse +- cloudflare.AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponse + +Methods: + +- client.Accounts.MtlsCertificates.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountMtlsCertificateGetResponse, error) +- client.Accounts.MtlsCertificates.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountMtlsCertificateDeleteResponse, error) +- client.Accounts.MtlsCertificates.MTlsCertificateManagementListMTlsCertificates(ctx context.Context, accountIdentifier string) (cloudflare.AccountMtlsCertificateMTlsCertificateManagementListMTlsCertificatesResponse, error) +- client.Accounts.MtlsCertificates.MTlsCertificateManagementUploadMTlsCertificate(ctx context.Context, accountIdentifier string, body cloudflare.AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateParams) (cloudflare.AccountMtlsCertificateMTlsCertificateManagementUploadMTlsCertificateResponse, error) + +### Associations + +Response Types: + +- cloudflare.AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponse + +Methods: + +- client.Accounts.MtlsCertificates.Associations.MTlsCertificateManagementListMTlsCertificateAssociations(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountMtlsCertificateAssociationMTlsCertificateManagementListMTlsCertificateAssociationsResponse, error) + +## Pages + +### Projects + +Response Types: + +- cloudflare.AccountPageProjectGetResponse +- cloudflare.AccountPageProjectUpdateResponse +- cloudflare.AccountPageProjectDeleteResponse +- cloudflare.AccountPageProjectPagesProjectNewProjectResponse +- cloudflare.AccountPageProjectPagesProjectGetProjectsResponse + +Methods: + +- client.Accounts.Pages.Projects.Get(ctx context.Context, accountIdentifier string, projectName string) (cloudflare.AccountPageProjectGetResponse, error) +- client.Accounts.Pages.Projects.Update(ctx context.Context, accountIdentifier string, projectName string, body cloudflare.AccountPageProjectUpdateParams) (cloudflare.AccountPageProjectUpdateResponse, error) +- client.Accounts.Pages.Projects.Delete(ctx context.Context, accountIdentifier string, projectName string) (cloudflare.AccountPageProjectDeleteResponse, error) +- client.Accounts.Pages.Projects.PagesProjectNewProject(ctx context.Context, accountIdentifier string, body cloudflare.AccountPageProjectPagesProjectNewProjectParams) (cloudflare.AccountPageProjectPagesProjectNewProjectResponse, error) +- client.Accounts.Pages.Projects.PagesProjectGetProjects(ctx context.Context, accountIdentifier string) (cloudflare.AccountPageProjectPagesProjectGetProjectsResponse, error) + +#### Deployments + +Response Types: + +- cloudflare.AccountPageProjectDeploymentGetResponse +- cloudflare.AccountPageProjectDeploymentDeleteResponse +- cloudflare.AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponse +- cloudflare.AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponse + +Methods: + +- client.Accounts.Pages.Projects.Deployments.Get(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string) (cloudflare.AccountPageProjectDeploymentGetResponse, error) +- client.Accounts.Pages.Projects.Deployments.Delete(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string) (cloudflare.AccountPageProjectDeploymentDeleteResponse, error) +- client.Accounts.Pages.Projects.Deployments.PagesDeploymentNewDeployment(ctx context.Context, accountIdentifier string, projectName string, body cloudflare.AccountPageProjectDeploymentPagesDeploymentNewDeploymentParams) (cloudflare.AccountPageProjectDeploymentPagesDeploymentNewDeploymentResponse, error) +- client.Accounts.Pages.Projects.Deployments.PagesDeploymentGetDeployments(ctx context.Context, accountIdentifier string, projectName string) (cloudflare.AccountPageProjectDeploymentPagesDeploymentGetDeploymentsResponse, error) + +##### Histories + +###### Logs + +Response Types: + +- cloudflare.AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponse + +Methods: + +- client.Accounts.Pages.Projects.Deployments.Histories.Logs.PagesDeploymentGetDeploymentLogs(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string) (cloudflare.AccountPageProjectDeploymentHistoryLogPagesDeploymentGetDeploymentLogsResponse, error) + +##### Retries + +Response Types: + +- cloudflare.AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponse + +Methods: + +- client.Accounts.Pages.Projects.Deployments.Retries.PagesDeploymentRetryDeployment(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string) (cloudflare.AccountPageProjectDeploymentRetryPagesDeploymentRetryDeploymentResponse, error) + +##### Rollbacks + +Response Types: + +- cloudflare.AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponse + +Methods: + +- client.Accounts.Pages.Projects.Deployments.Rollbacks.PagesDeploymentRollbackDeployment(ctx context.Context, accountIdentifier string, projectName string, deploymentIdentifier string) (cloudflare.AccountPageProjectDeploymentRollbackPagesDeploymentRollbackDeploymentResponse, error) + +#### Domains + +Response Types: + +- cloudflare.AccountPageProjectDomainGetResponse +- cloudflare.AccountPageProjectDomainUpdateResponse +- cloudflare.AccountPageProjectDomainDeleteResponse +- cloudflare.AccountPageProjectDomainPagesDomainsAddDomainResponse +- cloudflare.AccountPageProjectDomainPagesDomainsGetDomainsResponse + +Methods: + +- client.Accounts.Pages.Projects.Domains.Get(ctx context.Context, accountIdentifier string, projectName string, domainName string) (cloudflare.AccountPageProjectDomainGetResponse, error) +- client.Accounts.Pages.Projects.Domains.Update(ctx context.Context, accountIdentifier string, projectName string, domainName string) (cloudflare.AccountPageProjectDomainUpdateResponse, error) +- client.Accounts.Pages.Projects.Domains.Delete(ctx context.Context, accountIdentifier string, projectName string, domainName string) (cloudflare.AccountPageProjectDomainDeleteResponse, error) +- client.Accounts.Pages.Projects.Domains.PagesDomainsAddDomain(ctx context.Context, accountIdentifier string, projectName string, body cloudflare.AccountPageProjectDomainPagesDomainsAddDomainParams) (cloudflare.AccountPageProjectDomainPagesDomainsAddDomainResponse, error) +- client.Accounts.Pages.Projects.Domains.PagesDomainsGetDomains(ctx context.Context, accountIdentifier string, projectName string) (cloudflare.AccountPageProjectDomainPagesDomainsGetDomainsResponse, error) + +## Pcaps + +Response Types: + +- cloudflare.AccountPcapGetResponse +- cloudflare.AccountPcapMagicPcapCollectionNewPcapRequestResponse +- cloudflare.AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponse + +Methods: + +- client.Accounts.Pcaps.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountPcapGetResponse, error) +- client.Accounts.Pcaps.MagicPcapCollectionNewPcapRequest(ctx context.Context, accountIdentifier string, body cloudflare.AccountPcapMagicPcapCollectionNewPcapRequestParams) (cloudflare.AccountPcapMagicPcapCollectionNewPcapRequestResponse, error) +- client.Accounts.Pcaps.MagicPcapCollectionListPacketCaptureRequests(ctx context.Context, accountIdentifier string) (cloudflare.AccountPcapMagicPcapCollectionListPacketCaptureRequestsResponse, error) + +### Ownerships + +Response Types: + +- cloudflare.AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponse +- cloudflare.AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponse + +Methods: + +- client.Accounts.Pcaps.Ownerships.Delete(ctx context.Context, accountIdentifier string, identifier string) error +- client.Accounts.Pcaps.Ownerships.MagicPcapCollectionAddBucketsForFullPacketCaptures(ctx context.Context, accountIdentifier string, body cloudflare.AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesParams) (cloudflare.AccountPcapOwnershipMagicPcapCollectionAddBucketsForFullPacketCapturesResponse, error) +- client.Accounts.Pcaps.Ownerships.MagicPcapCollectionListPcaPsBucketOwnership(ctx context.Context, accountIdentifier string) (cloudflare.AccountPcapOwnershipMagicPcapCollectionListPcaPsBucketOwnershipResponse, error) + +#### Validates + +Response Types: + +- cloudflare.AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponse + +Methods: + +- client.Accounts.Pcaps.Ownerships.Validates.MagicPcapCollectionValidateBucketsForFullPacketCaptures(ctx context.Context, accountIdentifier string, body cloudflare.AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesParams) (cloudflare.AccountPcapOwnershipValidateMagicPcapCollectionValidateBucketsForFullPacketCapturesResponse, error) + +### Downloads + +Methods: + +- client.Accounts.Pcaps.Downloads.List(ctx context.Context, accountIdentifier string, identifier string) (http.Response, error) + +## R2 + +### Buckets + +Response Types: + +- cloudflare.AccountR2BucketGetResponse +- cloudflare.AccountR2BucketDeleteResponse +- cloudflare.AccountR2BucketR2BucketNewBucketResponse +- cloudflare.AccountR2BucketR2BucketListBucketsResponse + +Methods: + +- client.Accounts.R2.Buckets.Get(ctx context.Context, accountIdentifier string, bucketName string) (cloudflare.AccountR2BucketGetResponse, error) +- client.Accounts.R2.Buckets.Delete(ctx context.Context, accountIdentifier string, bucketName string) (cloudflare.AccountR2BucketDeleteResponse, error) +- client.Accounts.R2.Buckets.R2BucketNewBucket(ctx context.Context, accountIdentifier string, body cloudflare.AccountR2BucketR2BucketNewBucketParams) (cloudflare.AccountR2BucketR2BucketNewBucketResponse, error) +- client.Accounts.R2.Buckets.R2BucketListBuckets(ctx context.Context, accountIdentifier string, query cloudflare.AccountR2BucketR2BucketListBucketsParams) (cloudflare.AccountR2BucketR2BucketListBucketsResponse, error) + +## Railguns + +Response Types: + +- cloudflare.AccountRailgunGetResponse +- cloudflare.AccountRailgunUpdateResponse +- cloudflare.AccountRailgunDeleteResponse +- cloudflare.AccountRailgunAccountRailgunsNewRailgunResponse +- cloudflare.AccountRailgunAccountRailgunsListRailgunsResponse + +Methods: + +- client.Accounts.Railguns.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountRailgunGetResponse, error) +- client.Accounts.Railguns.Update(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountRailgunUpdateParams) (cloudflare.AccountRailgunUpdateResponse, error) +- client.Accounts.Railguns.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountRailgunDeleteResponse, error) +- client.Accounts.Railguns.AccountRailgunsNewRailgun(ctx context.Context, accountIdentifier string, body cloudflare.AccountRailgunAccountRailgunsNewRailgunParams) (cloudflare.AccountRailgunAccountRailgunsNewRailgunResponse, error) +- client.Accounts.Railguns.AccountRailgunsListRailguns(ctx context.Context, accountIdentifier string, query cloudflare.AccountRailgunAccountRailgunsListRailgunsParams) (cloudflare.AccountRailgunAccountRailgunsListRailgunsResponse, error) + +### Connections + +Response Types: + +- cloudflare.AccountRailgunConnectionGetResponse +- cloudflare.AccountRailgunConnectionUpdateResponse +- cloudflare.AccountRailgunConnectionDeleteResponse +- cloudflare.AccountRailgunConnectionRailgunConnectionsNewConnectionResponse +- cloudflare.AccountRailgunConnectionRailgunConnectionsListConnectionsResponse + +Methods: + +- client.Accounts.Railguns.Connections.Get(ctx context.Context, accountIdentifier string, railgunIdentifier string, identifier string) (cloudflare.AccountRailgunConnectionGetResponse, error) +- client.Accounts.Railguns.Connections.Update(ctx context.Context, accountIdentifier string, railgunIdentifier string, identifier string, body cloudflare.AccountRailgunConnectionUpdateParams) (cloudflare.AccountRailgunConnectionUpdateResponse, error) +- client.Accounts.Railguns.Connections.Delete(ctx context.Context, accountIdentifier string, railgunIdentifier string, identifier string) (cloudflare.AccountRailgunConnectionDeleteResponse, error) +- client.Accounts.Railguns.Connections.RailgunConnectionsNewConnection(ctx context.Context, accountIdentifier string, railgunIdentifier string, body cloudflare.AccountRailgunConnectionRailgunConnectionsNewConnectionParams) (cloudflare.AccountRailgunConnectionRailgunConnectionsNewConnectionResponse, error) +- client.Accounts.Railguns.Connections.RailgunConnectionsListConnections(ctx context.Context, accountIdentifier string, railgunIdentifier string, query cloudflare.AccountRailgunConnectionRailgunConnectionsListConnectionsParams) (cloudflare.AccountRailgunConnectionRailgunConnectionsListConnectionsResponse, error) + +## Registrar + +### Domains + +Response Types: + +- cloudflare.RegistrarAPIDomainResponseCollection +- cloudflare.AccountRegistrarDomainGetResponse +- cloudflare.AccountRegistrarDomainUpdateResponse + +Methods: + +- client.Accounts.Registrar.Domains.Get(ctx context.Context, accountIdentifier string, domainName string) (cloudflare.AccountRegistrarDomainGetResponse, error) +- client.Accounts.Registrar.Domains.Update(ctx context.Context, accountIdentifier string, domainName string, body cloudflare.AccountRegistrarDomainUpdateParams) (cloudflare.AccountRegistrarDomainUpdateResponse, error) +- client.Accounts.Registrar.Domains.List(ctx context.Context, accountIdentifier string) (cloudflare.RegistrarAPIDomainResponseCollection, error) + +## RequestTracers + +### Traces + +## Roles + +Response Types: + +- cloudflare.AccountRoleGetResponse +- cloudflare.AccountRoleAccountRolesListRolesResponse + +Methods: + +- client.Accounts.Roles.Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountRoleGetResponse, error) +- client.Accounts.Roles.AccountRolesListRoles(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountRoleAccountRolesListRolesResponse, error) + +## Rules + +### Lists + +Response Types: + +- cloudflare.AccountRuleListGetResponse +- cloudflare.AccountRuleListUpdateResponse +- cloudflare.AccountRuleListDeleteResponse +- cloudflare.AccountRuleListListsNewAListResponse +- cloudflare.AccountRuleListListsGetListsResponse + +Methods: + +- client.Accounts.Rules.Lists.Get(ctx context.Context, accountIdentifier string, listID string) (cloudflare.AccountRuleListGetResponse, error) +- client.Accounts.Rules.Lists.Update(ctx context.Context, accountIdentifier string, listID string, body cloudflare.AccountRuleListUpdateParams) (cloudflare.AccountRuleListUpdateResponse, error) +- client.Accounts.Rules.Lists.Delete(ctx context.Context, accountIdentifier string, listID string) (cloudflare.AccountRuleListDeleteResponse, error) +- client.Accounts.Rules.Lists.ListsNewAList(ctx context.Context, accountIdentifier string, body cloudflare.AccountRuleListListsNewAListParams) (cloudflare.AccountRuleListListsNewAListResponse, error) +- client.Accounts.Rules.Lists.ListsGetLists(ctx context.Context, accountIdentifier string) (cloudflare.AccountRuleListListsGetListsResponse, error) + +#### BulkOperations + +Response Types: + +- cloudflare.AccountRuleListBulkOperationGetResponse + +Methods: + +- client.Accounts.Rules.Lists.BulkOperations.Get(ctx context.Context, accountIdentifier string, operationID string) (cloudflare.AccountRuleListBulkOperationGetResponse, error) + +#### Items + +Response Types: + +- cloudflare.AccountRuleListItemGetResponse +- cloudflare.AccountRuleListItemDeleteResponse +- cloudflare.AccountRuleListItemListsNewListItemsResponse +- cloudflare.AccountRuleListItemListsGetListItemsResponse +- cloudflare.AccountRuleListItemListsUpdateAllListItemsResponse + +Methods: + +- client.Accounts.Rules.Lists.Items.Get(ctx context.Context, accountIdentifier string, listID string, itemID string) (cloudflare.AccountRuleListItemGetResponse, error) +- client.Accounts.Rules.Lists.Items.Delete(ctx context.Context, accountIdentifier string, listID string, body cloudflare.AccountRuleListItemDeleteParams) (cloudflare.AccountRuleListItemDeleteResponse, error) +- client.Accounts.Rules.Lists.Items.ListsNewListItems(ctx context.Context, accountIdentifier string, listID string, body cloudflare.AccountRuleListItemListsNewListItemsParams) (cloudflare.AccountRuleListItemListsNewListItemsResponse, error) +- client.Accounts.Rules.Lists.Items.ListsGetListItems(ctx context.Context, accountIdentifier string, listID string, query cloudflare.AccountRuleListItemListsGetListItemsParams) (cloudflare.AccountRuleListItemListsGetListItemsResponse, error) +- client.Accounts.Rules.Lists.Items.ListsUpdateAllListItems(ctx context.Context, accountIdentifier string, listID string, body cloudflare.AccountRuleListItemListsUpdateAllListItemsParams) (cloudflare.AccountRuleListItemListsUpdateAllListItemsResponse, error) + +## SecondaryDNS + +### ACLs + +Response Types: + +- cloudflare.AccountSecondaryDnsaclGetResponse +- cloudflare.AccountSecondaryDnsaclUpdateResponse +- cloudflare.AccountSecondaryDnsaclDeleteResponse +- cloudflare.AccountSecondaryDnsaclSecondaryDnsaclNewACLResponse +- cloudflare.AccountSecondaryDnsaclSecondaryDnsaclListACLsResponse + +Methods: + +- client.Accounts.SecondaryDNS.ACLs.Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountSecondaryDnsaclGetResponse, error) +- client.Accounts.SecondaryDNS.ACLs.Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body cloudflare.AccountSecondaryDNSACLUpdateParams) (cloudflare.AccountSecondaryDnsaclUpdateResponse, error) +- client.Accounts.SecondaryDNS.ACLs.Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountSecondaryDnsaclDeleteResponse, error) +- client.Accounts.SecondaryDNS.ACLs.SecondaryDNSACLNewACL(ctx context.Context, accountIdentifier interface{}, body cloudflare.AccountSecondaryDNSACLSecondaryDNSACLNewACLParams) (cloudflare.AccountSecondaryDnsaclSecondaryDnsaclNewACLResponse, error) +- client.Accounts.SecondaryDNS.ACLs.SecondaryDNSACLListACLs(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountSecondaryDnsaclSecondaryDnsaclListACLsResponse, error) + +### Peers + +Response Types: + +- cloudflare.AccountSecondaryDNSPeerGetResponse +- cloudflare.AccountSecondaryDNSPeerUpdateResponse +- cloudflare.AccountSecondaryDNSPeerDeleteResponse +- cloudflare.AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponse +- cloudflare.AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponse + +Methods: + +- client.Accounts.SecondaryDNS.Peers.Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountSecondaryDNSPeerGetResponse, error) +- client.Accounts.SecondaryDNS.Peers.Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body cloudflare.AccountSecondaryDNSPeerUpdateParams) (cloudflare.AccountSecondaryDNSPeerUpdateResponse, error) +- client.Accounts.SecondaryDNS.Peers.Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountSecondaryDNSPeerDeleteResponse, error) +- client.Accounts.SecondaryDNS.Peers.SecondaryDNSPeerNewPeer(ctx context.Context, accountIdentifier interface{}, body cloudflare.AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerParams) (cloudflare.AccountSecondaryDNSPeerSecondaryDNSPeerNewPeerResponse, error) +- client.Accounts.SecondaryDNS.Peers.SecondaryDNSPeerListPeers(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountSecondaryDNSPeerSecondaryDNSPeerListPeersResponse, error) + +### Tsigs + +Response Types: + +- cloudflare.AccountSecondaryDNSTsigGetResponse +- cloudflare.AccountSecondaryDNSTsigUpdateResponse +- cloudflare.AccountSecondaryDNSTsigDeleteResponse +- cloudflare.AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponse +- cloudflare.AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponse + +Methods: + +- client.Accounts.SecondaryDNS.Tsigs.Get(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountSecondaryDNSTsigGetResponse, error) +- client.Accounts.SecondaryDNS.Tsigs.Update(ctx context.Context, accountIdentifier interface{}, identifier interface{}, body cloudflare.AccountSecondaryDNSTsigUpdateParams) (cloudflare.AccountSecondaryDNSTsigUpdateResponse, error) +- client.Accounts.SecondaryDNS.Tsigs.Delete(ctx context.Context, accountIdentifier interface{}, identifier interface{}) (cloudflare.AccountSecondaryDNSTsigDeleteResponse, error) +- client.Accounts.SecondaryDNS.Tsigs.SecondaryDNSTsigNewTsig(ctx context.Context, accountIdentifier interface{}, body cloudflare.AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigParams) (cloudflare.AccountSecondaryDNSTsigSecondaryDNSTsigNewTsigResponse, error) +- client.Accounts.SecondaryDNS.Tsigs.SecondaryDNSTsigListTsiGs(ctx context.Context, accountIdentifier interface{}) (cloudflare.AccountSecondaryDNSTsigSecondaryDNSTsigListTsiGsResponse, error) + +## Storages + +### Analytics + +Response Types: + +- cloudflare.AccountStorageAnalyticsListResponse +- cloudflare.AccountStorageAnalyticsStoredResponse + +Methods: + +- client.Accounts.Storages.Analytics.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountStorageAnalyticsListParams) (cloudflare.AccountStorageAnalyticsListResponse, error) +- client.Accounts.Storages.Analytics.Stored(ctx context.Context, accountIdentifier string, query cloudflare.AccountStorageAnalyticsStoredParams) (cloudflare.AccountStorageAnalyticsStoredResponse, error) + +### Kvs + +#### Namespaces + +Response Types: + +- cloudflare.AccountStorageKvNamespaceUpdateResponse +- cloudflare.AccountStorageKvNamespaceListResponse +- cloudflare.AccountStorageKvNamespaceDeleteResponse +- cloudflare.AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponse + +Methods: + +- client.Accounts.Storages.Kvs.Namespaces.Update(ctx context.Context, accountIdentifier string, namespaceIdentifier string, body cloudflare.AccountStorageKvNamespaceUpdateParams) (cloudflare.AccountStorageKvNamespaceUpdateResponse, error) +- client.Accounts.Storages.Kvs.Namespaces.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountStorageKvNamespaceListParams) (cloudflare.AccountStorageKvNamespaceListResponse, error) +- client.Accounts.Storages.Kvs.Namespaces.Delete(ctx context.Context, accountIdentifier string, namespaceIdentifier string) (cloudflare.AccountStorageKvNamespaceDeleteResponse, error) +- client.Accounts.Storages.Kvs.Namespaces.WorkersKvNamespaceNewANamespace(ctx context.Context, accountIdentifier string, body cloudflare.AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceParams) (cloudflare.AccountStorageKvNamespaceWorkersKvNamespaceNewANamespaceResponse, error) + +##### Bulks + +Response Types: + +- cloudflare.AccountStorageKvNamespaceBulkDeleteResponse +- cloudflare.AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponse + +Methods: + +- client.Accounts.Storages.Kvs.Namespaces.Bulks.Delete(ctx context.Context, accountIdentifier string, namespaceIdentifier string, body cloudflare.AccountStorageKvNamespaceBulkDeleteParams) (cloudflare.AccountStorageKvNamespaceBulkDeleteResponse, error) +- client.Accounts.Storages.Kvs.Namespaces.Bulks.WorkersKvNamespaceWriteMultipleKeyValuePairs(ctx context.Context, accountIdentifier string, namespaceIdentifier string, body cloudflare.AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsParams) (cloudflare.AccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponse, error) + +##### Keys + +Response Types: + +- cloudflare.AccountStorageKvNamespaceKeyListResponse + +Methods: + +- client.Accounts.Storages.Kvs.Namespaces.Keys.List(ctx context.Context, accountIdentifier string, namespaceIdentifier string, query cloudflare.AccountStorageKvNamespaceKeyListParams) (cloudflare.AccountStorageKvNamespaceKeyListResponse, error) + +##### Metadata + +Response Types: + +- cloudflare.AccountStorageKvNamespaceMetadataGetResponse + +Methods: + +- client.Accounts.Storages.Kvs.Namespaces.Metadata.Get(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string) (cloudflare.AccountStorageKvNamespaceMetadataGetResponse, error) + +##### Values + +Response Types: + +- cloudflare.AccountStorageKvNamespaceValueUpdateResponse +- cloudflare.AccountStorageKvNamespaceValueDeleteResponse + +Methods: + +- client.Accounts.Storages.Kvs.Namespaces.Values.Get(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string) (string, error) +- client.Accounts.Storages.Kvs.Namespaces.Values.Update(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string, body cloudflare.AccountStorageKvNamespaceValueUpdateParams) (cloudflare.AccountStorageKvNamespaceValueUpdateResponse, error) +- client.Accounts.Storages.Kvs.Namespaces.Values.Delete(ctx context.Context, accountIdentifier string, namespaceIdentifier string, keyName string) (cloudflare.AccountStorageKvNamespaceValueDeleteResponse, error) + +## Streams + +Response Types: + +- cloudflare.AccountStreamGetResponse +- cloudflare.AccountStreamUpdateResponse +- cloudflare.AccountStreamStreamVideosListVideosResponse + +Methods: + +- client.Accounts.Streams.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamGetResponse, error) +- client.Accounts.Streams.Update(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountStreamUpdateParams) (cloudflare.AccountStreamUpdateResponse, error) +- client.Accounts.Streams.Delete(ctx context.Context, accountIdentifier string, identifier string) error +- client.Accounts.Streams.StreamVideosInitiateVideoUploadsUsingTus(ctx context.Context, accountIdentifier string, body cloudflare.AccountStreamStreamVideosInitiateVideoUploadsUsingTusParams) error +- client.Accounts.Streams.StreamVideosListVideos(ctx context.Context, accountIdentifier string, query cloudflare.AccountStreamStreamVideosListVideosParams) (cloudflare.AccountStreamStreamVideosListVideosResponse, error) + +### Clips + +Response Types: + +- cloudflare.AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponse + +Methods: + +- client.Accounts.Streams.Clips.StreamVideoClippingClipVideosGivenAStartAndEndTime(ctx context.Context, accountIdentifier string, body cloudflare.AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeParams) (cloudflare.AccountStreamClipStreamVideoClippingClipVideosGivenAStartAndEndTimeResponse, error) + +### Copies + +Response Types: + +- cloudflare.AccountStreamCopyStreamVideosUploadVideosFromAurlResponse + +Methods: + +- client.Accounts.Streams.Copies.StreamVideosUploadVideosFromAURL(ctx context.Context, accountIdentifier string, params cloudflare.AccountStreamCopyStreamVideosUploadVideosFromAURLParams) (cloudflare.AccountStreamCopyStreamVideosUploadVideosFromAurlResponse, error) + +### DirectUploads + +Response Types: + +- cloudflare.AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponse + +Methods: + +- client.Accounts.Streams.DirectUploads.StreamVideosUploadVideosViaDirectUploadURLs(ctx context.Context, accountIdentifier string, params cloudflare.AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsParams) (cloudflare.AccountStreamDirectUploadStreamVideosUploadVideosViaDirectUploadURLsResponse, error) + +### Keys + +Response Types: + +- cloudflare.AccountStreamKeyDeleteResponse +- cloudflare.AccountStreamKeyStreamSigningKeysNewSigningKeysResponse +- cloudflare.AccountStreamKeyStreamSigningKeysListSigningKeysResponse + +Methods: + +- client.Accounts.Streams.Keys.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamKeyDeleteResponse, error) +- client.Accounts.Streams.Keys.StreamSigningKeysNewSigningKeys(ctx context.Context, accountIdentifier string) (cloudflare.AccountStreamKeyStreamSigningKeysNewSigningKeysResponse, error) +- client.Accounts.Streams.Keys.StreamSigningKeysListSigningKeys(ctx context.Context, accountIdentifier string) (cloudflare.AccountStreamKeyStreamSigningKeysListSigningKeysResponse, error) + +### LiveInputs + +Response Types: + +- cloudflare.AccountStreamLiveInputGetResponse +- cloudflare.AccountStreamLiveInputUpdateResponse +- cloudflare.AccountStreamLiveInputStreamLiveInputsNewALiveInputResponse +- cloudflare.AccountStreamLiveInputStreamLiveInputsListLiveInputsResponse + +Methods: + +- client.Accounts.Streams.LiveInputs.Get(ctx context.Context, accountIdentifier string, liveInputIdentifier string) (cloudflare.AccountStreamLiveInputGetResponse, error) +- client.Accounts.Streams.LiveInputs.Update(ctx context.Context, accountIdentifier string, liveInputIdentifier string, body cloudflare.AccountStreamLiveInputUpdateParams) (cloudflare.AccountStreamLiveInputUpdateResponse, error) +- client.Accounts.Streams.LiveInputs.Delete(ctx context.Context, accountIdentifier string, liveInputIdentifier string) error +- client.Accounts.Streams.LiveInputs.StreamLiveInputsNewALiveInput(ctx context.Context, accountIdentifier string, body cloudflare.AccountStreamLiveInputStreamLiveInputsNewALiveInputParams) (cloudflare.AccountStreamLiveInputStreamLiveInputsNewALiveInputResponse, error) +- client.Accounts.Streams.LiveInputs.StreamLiveInputsListLiveInputs(ctx context.Context, accountIdentifier string, query cloudflare.AccountStreamLiveInputStreamLiveInputsListLiveInputsParams) (cloudflare.AccountStreamLiveInputStreamLiveInputsListLiveInputsResponse, error) + +#### Outputs + +Response Types: + +- cloudflare.AccountStreamLiveInputOutputUpdateResponse +- cloudflare.AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponse +- cloudflare.AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponse + +Methods: + +- client.Accounts.Streams.LiveInputs.Outputs.Update(ctx context.Context, accountIdentifier string, liveInputIdentifier string, outputIdentifier string, body cloudflare.AccountStreamLiveInputOutputUpdateParams) (cloudflare.AccountStreamLiveInputOutputUpdateResponse, error) +- client.Accounts.Streams.LiveInputs.Outputs.Delete(ctx context.Context, accountIdentifier string, liveInputIdentifier string, outputIdentifier string) error +- client.Accounts.Streams.LiveInputs.Outputs.StreamLiveInputsNewANewOutputConnectedToALiveInput(ctx context.Context, accountIdentifier string, liveInputIdentifier string, body cloudflare.AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputParams) (cloudflare.AccountStreamLiveInputOutputStreamLiveInputsNewANewOutputConnectedToALiveInputResponse, error) +- client.Accounts.Streams.LiveInputs.Outputs.StreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInput(ctx context.Context, accountIdentifier string, liveInputIdentifier string) (cloudflare.AccountStreamLiveInputOutputStreamLiveInputsListAllOutputsAssociatedWithASpecifiedLiveInputResponse, error) + +### Watermarks + +Response Types: + +- cloudflare.AccountStreamWatermarkGetResponse +- cloudflare.AccountStreamWatermarkDeleteResponse +- cloudflare.AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponse +- cloudflare.AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponse + +Methods: + +- client.Accounts.Streams.Watermarks.Get(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamWatermarkGetResponse, error) +- client.Accounts.Streams.Watermarks.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamWatermarkDeleteResponse, error) +- client.Accounts.Streams.Watermarks.StreamWatermarkProfileNewWatermarkProfilesViaBasicUpload(ctx context.Context, accountIdentifier string, body cloudflare.AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadParams) (cloudflare.AccountStreamWatermarkStreamWatermarkProfileNewWatermarkProfilesViaBasicUploadResponse, error) +- client.Accounts.Streams.Watermarks.StreamWatermarkProfileListWatermarkProfiles(ctx context.Context, accountIdentifier string) (cloudflare.AccountStreamWatermarkStreamWatermarkProfileListWatermarkProfilesResponse, error) + +### Webhooks + +Response Types: + +- cloudflare.AccountStreamWebhookDeleteResponse +- cloudflare.AccountStreamWebhookStreamWebhookNewWebhooksResponse +- cloudflare.AccountStreamWebhookStreamWebhookViewWebhooksResponse + +Methods: + +- client.Accounts.Streams.Webhooks.Delete(ctx context.Context, accountIdentifier string) (cloudflare.AccountStreamWebhookDeleteResponse, error) +- client.Accounts.Streams.Webhooks.StreamWebhookNewWebhooks(ctx context.Context, accountIdentifier string, body cloudflare.AccountStreamWebhookStreamWebhookNewWebhooksParams) (cloudflare.AccountStreamWebhookStreamWebhookNewWebhooksResponse, error) +- client.Accounts.Streams.Webhooks.StreamWebhookViewWebhooks(ctx context.Context, accountIdentifier string) (cloudflare.AccountStreamWebhookStreamWebhookViewWebhooksResponse, error) + +### Captions + +Response Types: + +- cloudflare.AccountStreamCaptionUpdateResponse +- cloudflare.AccountStreamCaptionDeleteResponse +- cloudflare.AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponse + +Methods: + +- client.Accounts.Streams.Captions.Update(ctx context.Context, accountIdentifier string, identifier string, language string, body cloudflare.AccountStreamCaptionUpdateParams) (cloudflare.AccountStreamCaptionUpdateResponse, error) +- client.Accounts.Streams.Captions.Delete(ctx context.Context, accountIdentifier string, identifier string, language string) (cloudflare.AccountStreamCaptionDeleteResponse, error) +- client.Accounts.Streams.Captions.StreamSubtitlesCaptionsListCaptionsOrSubtitles(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamCaptionStreamSubtitlesCaptionsListCaptionsOrSubtitlesResponse, error) + +### Downloads + +Response Types: + +- cloudflare.AccountStreamDownloadDeleteResponse +- cloudflare.AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponse +- cloudflare.AccountStreamDownloadStreamMP4DownloadsListDownloadsResponse + +Methods: + +- client.Accounts.Streams.Downloads.Delete(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamDownloadDeleteResponse, error) +- client.Accounts.Streams.Downloads.StreamMP4DownloadsNewDownloads(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamDownloadStreamMP4DownloadsNewDownloadsResponse, error) +- client.Accounts.Streams.Downloads.StreamMP4DownloadsListDownloads(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamDownloadStreamMP4DownloadsListDownloadsResponse, error) + +### Embeds + +Response Types: + +- cloudflare.AccountStreamEmbedListResponse + +Methods: + +- client.Accounts.Streams.Embeds.List(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.AccountStreamEmbedListResponse, error) + +### Tokens + +Response Types: + +- cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponse + +Methods: + +- client.Accounts.Streams.Tokens.StreamVideosNewSignedURLTokensForVideos(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosParams) (cloudflare.AccountStreamTokenStreamVideosNewSignedURLTokensForVideosResponse, error) + +### Audios + +Response Types: + +- cloudflare.AccountStreamAudioUpdateResponse +- cloudflare.AccountStreamAudioDeleteResponse +- cloudflare.AccountStreamAudioCopyResponse + +Methods: + +- client.Accounts.Streams.Audios.Update(ctx context.Context, accountIdentifier string, identifier string, audioIdentifier string, body cloudflare.AccountStreamAudioUpdateParams) (cloudflare.AccountStreamAudioUpdateResponse, error) +- client.Accounts.Streams.Audios.Delete(ctx context.Context, accountIdentifier string, identifier string, audioIdentifier string) (cloudflare.AccountStreamAudioDeleteResponse, error) +- client.Accounts.Streams.Audios.Copy(ctx context.Context, accountIdentifier string, identifier string, body cloudflare.AccountStreamAudioCopyParams) (cloudflare.AccountStreamAudioCopyResponse, error) + +### StorageUsages + +Response Types: + +- cloudflare.AccountStreamStorageUsageGetResponse + +Methods: + +- client.Accounts.Streams.StorageUsages.Get(ctx context.Context, accountIdentifier string, query cloudflare.AccountStreamStorageUsageGetParams) (cloudflare.AccountStreamStorageUsageGetResponse, error) + +## Subscriptions + +Response Types: + +- cloudflare.AccountSubscriptionUpdateResponse +- cloudflare.AccountSubscriptionDeleteResponse +- cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionResponse +- cloudflare.AccountSubscriptionAccountSubscriptionsListSubscriptionsResponse + +Methods: + +- client.Accounts.Subscriptions.Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body cloudflare.AccountSubscriptionUpdateParams) (cloudflare.AccountSubscriptionUpdateResponse, error) +- client.Accounts.Subscriptions.Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string) (cloudflare.AccountSubscriptionDeleteResponse, error) +- client.Accounts.Subscriptions.AccountSubscriptionsNewSubscription(ctx context.Context, accountIdentifier string, body cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionParams) (cloudflare.AccountSubscriptionAccountSubscriptionsNewSubscriptionResponse, error) +- client.Accounts.Subscriptions.AccountSubscriptionsListSubscriptions(ctx context.Context, accountIdentifier string) (cloudflare.AccountSubscriptionAccountSubscriptionsListSubscriptionsResponse, error) + +## Teamnet + +### Routes + +Response Types: + +- cloudflare.AccountTeamnetRouteNewResponse +- cloudflare.AccountTeamnetRouteUpdateResponse +- cloudflare.AccountTeamnetRouteDeleteResponse +- cloudflare.AccountTeamnetRouteTunnelRouteListTunnelRoutesResponse + +Methods: + +- client.Accounts.Teamnet.Routes.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountTeamnetRouteNewParams) (cloudflare.AccountTeamnetRouteNewResponse, error) +- client.Accounts.Teamnet.Routes.Update(ctx context.Context, accountIdentifier string, routeID string, body cloudflare.AccountTeamnetRouteUpdateParams) (cloudflare.AccountTeamnetRouteUpdateResponse, error) +- client.Accounts.Teamnet.Routes.Delete(ctx context.Context, accountIdentifier string, routeID string) (cloudflare.AccountTeamnetRouteDeleteResponse, error) +- client.Accounts.Teamnet.Routes.TunnelRouteListTunnelRoutes(ctx context.Context, accountIdentifier string, query cloudflare.AccountTeamnetRouteTunnelRouteListTunnelRoutesParams) (cloudflare.AccountTeamnetRouteTunnelRouteListTunnelRoutesResponse, error) + +#### IPs + +Response Types: + +- cloudflare.AccountTeamnetRouteIPGetResponse + +Methods: + +- client.Accounts.Teamnet.Routes.IPs.Get(ctx context.Context, accountIdentifier string, ip string, query cloudflare.AccountTeamnetRouteIPGetParams) (cloudflare.AccountTeamnetRouteIPGetResponse, error) + +#### Networks + +Response Types: + +- cloudflare.AccountTeamnetRouteNetworkUpdateResponse +- cloudflare.AccountTeamnetRouteNetworkDeleteResponse + +Methods: + +- client.Accounts.Teamnet.Routes.Networks.Update(ctx context.Context, accountIdentifier string, ipNetworkEncoded string, body cloudflare.AccountTeamnetRouteNetworkUpdateParams) (cloudflare.AccountTeamnetRouteNetworkUpdateResponse, error) +- client.Accounts.Teamnet.Routes.Networks.Delete(ctx context.Context, accountIdentifier string, ipNetworkEncoded string, body cloudflare.AccountTeamnetRouteNetworkDeleteParams) (cloudflare.AccountTeamnetRouteNetworkDeleteResponse, error) + +### VirtualNetworks + +Response Types: + +- cloudflare.AccountTeamnetVirtualNetworkUpdateResponse +- cloudflare.AccountTeamnetVirtualNetworkDeleteResponse +- cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponse +- cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponse + +Methods: + +- client.Accounts.Teamnet.VirtualNetworks.Update(ctx context.Context, accountIdentifier string, vnetID string, body cloudflare.AccountTeamnetVirtualNetworkUpdateParams) (cloudflare.AccountTeamnetVirtualNetworkUpdateResponse, error) +- client.Accounts.Teamnet.VirtualNetworks.Delete(ctx context.Context, accountIdentifier string, vnetID string) (cloudflare.AccountTeamnetVirtualNetworkDeleteResponse, error) +- client.Accounts.Teamnet.VirtualNetworks.TunnelVirtualNetworkNewAVirtualNetwork(ctx context.Context, accountIdentifier string, body cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkParams) (cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkNewAVirtualNetworkResponse, error) +- client.Accounts.Teamnet.VirtualNetworks.TunnelVirtualNetworkListVirtualNetworks(ctx context.Context, accountIdentifier string, query cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksParams) (cloudflare.AccountTeamnetVirtualNetworkTunnelVirtualNetworkListVirtualNetworksResponse, error) + +## Tunnels + +Response Types: + +- cloudflare.AccountTunnelGetResponse +- cloudflare.AccountTunnelDeleteResponse +- cloudflare.AccountTunnelArgoTunnelNewAnArgoTunnelResponse +- cloudflare.AccountTunnelArgoTunnelListArgoTunnelsResponse + +Methods: + +- client.Accounts.Tunnels.Get(ctx context.Context, accountIdentifier string, tunnelID string) (cloudflare.AccountTunnelGetResponse, error) +- client.Accounts.Tunnels.Delete(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountTunnelDeleteParams) (cloudflare.AccountTunnelDeleteResponse, error) +- client.Accounts.Tunnels.ArgoTunnelNewAnArgoTunnel(ctx context.Context, accountIdentifier string, body cloudflare.AccountTunnelArgoTunnelNewAnArgoTunnelParams) (cloudflare.AccountTunnelArgoTunnelNewAnArgoTunnelResponse, error) +- client.Accounts.Tunnels.ArgoTunnelListArgoTunnels(ctx context.Context, accountIdentifier string, query cloudflare.AccountTunnelArgoTunnelListArgoTunnelsParams) (cloudflare.AccountTunnelArgoTunnelListArgoTunnelsResponse, error) + +### Connections + +Response Types: + +- cloudflare.AccountTunnelConnectionDeleteResponse + +Methods: + +- client.Accounts.Tunnels.Connections.Delete(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountTunnelConnectionDeleteParams) (cloudflare.AccountTunnelConnectionDeleteResponse, error) + +## Workers + +### AccountSettings + +Response Types: + +- cloudflare.AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponse +- cloudflare.AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponse + +Methods: + +- client.Accounts.Workers.AccountSettings.WorkerAccountSettingsNewWorkerAccountSettings(ctx context.Context, accountIdentifier string, body cloudflare.AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsParams) (cloudflare.AccountWorkerAccountSettingWorkerAccountSettingsNewWorkerAccountSettingsResponse, error) +- client.Accounts.Workers.AccountSettings.WorkerAccountSettingsFetchWorkerAccountSettings(ctx context.Context, accountIdentifier string) (cloudflare.AccountWorkerAccountSettingWorkerAccountSettingsFetchWorkerAccountSettingsResponse, error) + +### Deployments + +#### ByScripts + +Response Types: + +- cloudflare.AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponse + +Methods: + +- client.Accounts.Workers.Deployments.ByScripts.WorkerDeploymentsListDeployments(ctx context.Context, accountIdentifier string, scriptIdentifier string) (cloudflare.AccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponse, error) + +##### Details + +Response Types: + +- cloudflare.AccountWorkerDeploymentByScriptDetailGetResponse + +Methods: + +- client.Accounts.Workers.Deployments.ByScripts.Details.Get(ctx context.Context, accountIdentifier string, scriptIdentifier string, deploymentIdentifier string) (cloudflare.AccountWorkerDeploymentByScriptDetailGetResponse, error) + +### Domains + +Response Types: + +- cloudflare.AccountWorkerDomainGetResponse +- cloudflare.AccountWorkerDomainWorkerDomainAttachToDomainResponse +- cloudflare.AccountWorkerDomainWorkerDomainListDomainsResponse + +Methods: + +- client.Accounts.Workers.Domains.Get(ctx context.Context, accountIdentifier interface{}, domainIdentifier interface{}) (cloudflare.AccountWorkerDomainGetResponse, error) +- client.Accounts.Workers.Domains.Delete(ctx context.Context, accountIdentifier interface{}, domainIdentifier interface{}) error +- client.Accounts.Workers.Domains.WorkerDomainAttachToDomain(ctx context.Context, accountIdentifier interface{}, body cloudflare.AccountWorkerDomainWorkerDomainAttachToDomainParams) (cloudflare.AccountWorkerDomainWorkerDomainAttachToDomainResponse, error) +- client.Accounts.Workers.Domains.WorkerDomainListDomains(ctx context.Context, accountIdentifier interface{}, query cloudflare.AccountWorkerDomainWorkerDomainListDomainsParams) (cloudflare.AccountWorkerDomainWorkerDomainListDomainsResponse, error) + +### DurableObjects + +#### Namespaces + +Response Types: + +- cloudflare.AccountWorkerDurableObjectNamespaceListResponse + +Methods: + +- client.Accounts.Workers.DurableObjects.Namespaces.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountWorkerDurableObjectNamespaceListResponse, error) + +##### Objects + +Response Types: + +- cloudflare.AccountWorkerDurableObjectNamespaceObjectListResponse + +Methods: + +- client.Accounts.Workers.DurableObjects.Namespaces.Objects.List(ctx context.Context, accountIdentifier string, id string, query cloudflare.AccountWorkerDurableObjectNamespaceObjectListParams) (cloudflare.AccountWorkerDurableObjectNamespaceObjectListResponse, error) + +### Queues + +Response Types: + +- cloudflare.AccountWorkerQueueGetResponse +- cloudflare.AccountWorkerQueueUpdateResponse +- cloudflare.AccountWorkerQueueListResponse +- cloudflare.AccountWorkerQueueDeleteResponse +- cloudflare.AccountWorkerQueueQueueNewQueueResponse + +Methods: + +- client.Accounts.Workers.Queues.Get(ctx context.Context, accountIdentifier string, name string) (cloudflare.AccountWorkerQueueGetResponse, error) +- client.Accounts.Workers.Queues.Update(ctx context.Context, accountIdentifier string, name string, body cloudflare.AccountWorkerQueueUpdateParams) (cloudflare.AccountWorkerQueueUpdateResponse, error) +- client.Accounts.Workers.Queues.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountWorkerQueueListResponse, error) +- client.Accounts.Workers.Queues.Delete(ctx context.Context, accountIdentifier string, name string) (cloudflare.AccountWorkerQueueDeleteResponse, error) +- client.Accounts.Workers.Queues.QueueNewQueue(ctx context.Context, accountIdentifier string, body cloudflare.AccountWorkerQueueQueueNewQueueParams) (cloudflare.AccountWorkerQueueQueueNewQueueResponse, error) + +#### Consumers + +Response Types: + +- cloudflare.AccountWorkerQueueConsumerUpdateResponse +- cloudflare.AccountWorkerQueueConsumerListResponse +- cloudflare.AccountWorkerQueueConsumerDeleteResponse +- cloudflare.AccountWorkerQueueConsumerQueueNewQueueConsumerResponse + +Methods: + +- client.Accounts.Workers.Queues.Consumers.Update(ctx context.Context, accountIdentifier string, name string, consumerName string, body cloudflare.AccountWorkerQueueConsumerUpdateParams) (cloudflare.AccountWorkerQueueConsumerUpdateResponse, error) +- client.Accounts.Workers.Queues.Consumers.List(ctx context.Context, accountIdentifier string, name string) (cloudflare.AccountWorkerQueueConsumerListResponse, error) +- client.Accounts.Workers.Queues.Consumers.Delete(ctx context.Context, accountIdentifier string, name string, consumerName string) (cloudflare.AccountWorkerQueueConsumerDeleteResponse, error) +- client.Accounts.Workers.Queues.Consumers.QueueNewQueueConsumer(ctx context.Context, accountIdentifier string, name string, body cloudflare.AccountWorkerQueueConsumerQueueNewQueueConsumerParams) (cloudflare.AccountWorkerQueueConsumerQueueNewQueueConsumerResponse, error) + +### Scripts + +Response Types: + +- cloudflare.AccountWorkerScriptUpdateResponse +- cloudflare.AccountWorkerScriptWorkerScriptListWorkersResponse + +Methods: + +- client.Accounts.Workers.Scripts.Get(ctx context.Context, accountIdentifier string, scriptName string) (http.Response, error) +- client.Accounts.Workers.Scripts.Update(ctx context.Context, accountIdentifier string, scriptName string, params cloudflare.AccountWorkerScriptUpdateParams) (cloudflare.AccountWorkerScriptUpdateResponse, error) +- client.Accounts.Workers.Scripts.Delete(ctx context.Context, accountIdentifier string, scriptName string, body cloudflare.AccountWorkerScriptDeleteParams) error +- client.Accounts.Workers.Scripts.WorkerScriptListWorkers(ctx context.Context, accountIdentifier string) (cloudflare.AccountWorkerScriptWorkerScriptListWorkersResponse, error) + +#### Schedules + +Response Types: + +- cloudflare.AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponse +- cloudflare.AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponse + +Methods: + +- client.Accounts.Workers.Scripts.Schedules.WorkerCronTriggerGetCronTriggers(ctx context.Context, accountIdentifier string, scriptName string) (cloudflare.AccountWorkerScriptScheduleWorkerCronTriggerGetCronTriggersResponse, error) +- client.Accounts.Workers.Scripts.Schedules.WorkerCronTriggerUpdateCronTriggers(ctx context.Context, accountIdentifier string, scriptName string, body cloudflare.AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersParams) (cloudflare.AccountWorkerScriptScheduleWorkerCronTriggerUpdateCronTriggersResponse, error) + +#### Tails + +Response Types: + +- cloudflare.AccountWorkerScriptTailDeleteResponse +- cloudflare.AccountWorkerScriptTailWorkerTailLogsListTailsResponse +- cloudflare.AccountWorkerScriptTailWorkerTailLogsStartTailResponse + +Methods: + +- client.Accounts.Workers.Scripts.Tails.Delete(ctx context.Context, accountIdentifier string, scriptName string, id string) (cloudflare.AccountWorkerScriptTailDeleteResponse, error) +- client.Accounts.Workers.Scripts.Tails.WorkerTailLogsListTails(ctx context.Context, accountIdentifier string, scriptName string) (cloudflare.AccountWorkerScriptTailWorkerTailLogsListTailsResponse, error) +- client.Accounts.Workers.Scripts.Tails.WorkerTailLogsStartTail(ctx context.Context, accountIdentifier string, scriptName string) (cloudflare.AccountWorkerScriptTailWorkerTailLogsStartTailResponse, error) + +#### UsageModels + +Response Types: + +- cloudflare.AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponse +- cloudflare.AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponse + +Methods: + +- client.Accounts.Workers.Scripts.UsageModels.WorkerScriptFetchUsageModel(ctx context.Context, accountIdentifier string, scriptName string) (cloudflare.AccountWorkerScriptUsageModelWorkerScriptFetchUsageModelResponse, error) +- client.Accounts.Workers.Scripts.UsageModels.WorkerScriptUpdateUsageModel(ctx context.Context, accountIdentifier string, scriptName string, body cloudflare.AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelParams) (cloudflare.AccountWorkerScriptUsageModelWorkerScriptUpdateUsageModelResponse, error) + +#### Content + +Response Types: + +- cloudflare.AccountWorkerScriptContentUpdateResponse + +Methods: + +- client.Accounts.Workers.Scripts.Content.Update(ctx context.Context, accountIdentifier string, scriptName string, params cloudflare.AccountWorkerScriptContentUpdateParams) (cloudflare.AccountWorkerScriptContentUpdateResponse, error) + +#### ContentV2 + +Methods: + +- client.Accounts.Workers.Scripts.ContentV2.List(ctx context.Context, accountIdentifier string, scriptName string) (http.Response, error) + +#### Settings + +Response Types: + +- cloudflare.AccountWorkerScriptSettingGetResponse +- cloudflare.AccountWorkerScriptSettingUpdateResponse + +Methods: + +- client.Accounts.Workers.Scripts.Settings.Get(ctx context.Context, accountIdentifier string, scriptName string) (cloudflare.AccountWorkerScriptSettingGetResponse, error) +- client.Accounts.Workers.Scripts.Settings.Update(ctx context.Context, accountIdentifier string, scriptName string, body cloudflare.AccountWorkerScriptSettingUpdateParams) (cloudflare.AccountWorkerScriptSettingUpdateResponse, error) + +### Subdomains + +Response Types: + +- cloudflare.AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponse +- cloudflare.AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponse + +Methods: + +- client.Accounts.Workers.Subdomains.WorkerSubdomainNewSubdomain(ctx context.Context, accountIdentifier string, body cloudflare.AccountWorkerSubdomainWorkerSubdomainNewSubdomainParams) (cloudflare.AccountWorkerSubdomainWorkerSubdomainNewSubdomainResponse, error) +- client.Accounts.Workers.Subdomains.WorkerSubdomainGetSubdomain(ctx context.Context, accountIdentifier string) (cloudflare.AccountWorkerSubdomainWorkerSubdomainGetSubdomainResponse, error) + +### Dispatch + +#### Namespaces + +##### Scripts + +Response Types: + +- cloudflare.AccountWorkerDispatchNamespaceScriptNewResponse +- cloudflare.AccountWorkerDispatchNamespaceScriptGetResponse + +Methods: + +- client.Accounts.Workers.Dispatch.Namespaces.Scripts.New(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, body cloudflare.AccountWorkerDispatchNamespaceScriptNewParams) (cloudflare.AccountWorkerDispatchNamespaceScriptNewResponse, error) +- client.Accounts.Workers.Dispatch.Namespaces.Scripts.Get(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string) (cloudflare.AccountWorkerDispatchNamespaceScriptGetResponse, error) +- client.Accounts.Workers.Dispatch.Namespaces.Scripts.Delete(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, body cloudflare.AccountWorkerDispatchNamespaceScriptDeleteParams) error + +###### Content + +Response Types: + +- cloudflare.AccountWorkerDispatchNamespaceScriptContentUpdateResponse + +Methods: + +- client.Accounts.Workers.Dispatch.Namespaces.Scripts.Content.Get(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string) (http.Response, error) +- client.Accounts.Workers.Dispatch.Namespaces.Scripts.Content.Update(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, params cloudflare.AccountWorkerDispatchNamespaceScriptContentUpdateParams) (cloudflare.AccountWorkerDispatchNamespaceScriptContentUpdateResponse, error) + +###### Settings + +Response Types: + +- cloudflare.AccountWorkerDispatchNamespaceScriptSettingGetResponse +- cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateResponse + +Methods: + +- client.Accounts.Workers.Dispatch.Namespaces.Scripts.Settings.Get(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string) (cloudflare.AccountWorkerDispatchNamespaceScriptSettingGetResponse, error) +- client.Accounts.Workers.Dispatch.Namespaces.Scripts.Settings.Update(ctx context.Context, accountIdentifier string, dispatchNamespace string, scriptName string, body cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateParams) (cloudflare.AccountWorkerDispatchNamespaceScriptSettingUpdateResponse, error) + +### Services + +#### Environments + +##### Content + +Response Types: + +- cloudflare.AccountWorkerServiceEnvironmentContentUpdateResponse + +Methods: + +- client.Accounts.Workers.Services.Environments.Content.Get(ctx context.Context, accountIdentifier string, serviceName string, environmentName string) (http.Response, error) +- client.Accounts.Workers.Services.Environments.Content.Update(ctx context.Context, accountIdentifier string, serviceName string, environmentName string, params cloudflare.AccountWorkerServiceEnvironmentContentUpdateParams) (cloudflare.AccountWorkerServiceEnvironmentContentUpdateResponse, error) + +##### Settings + +Response Types: + +- cloudflare.AccountWorkerServiceEnvironmentSettingGetResponse +- cloudflare.AccountWorkerServiceEnvironmentSettingUpdateResponse + +Methods: + +- client.Accounts.Workers.Services.Environments.Settings.Get(ctx context.Context, accountIdentifier string, serviceName string, environmentName string) (cloudflare.AccountWorkerServiceEnvironmentSettingGetResponse, error) +- client.Accounts.Workers.Services.Environments.Settings.Update(ctx context.Context, accountIdentifier string, serviceName string, environmentName string, body cloudflare.AccountWorkerServiceEnvironmentSettingUpdateParams) (cloudflare.AccountWorkerServiceEnvironmentSettingUpdateResponse, error) + +## Gateway + +Response Types: + +- cloudflare.AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponse +- cloudflare.AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponse + +Methods: + +- client.Accounts.Gateway.ZeroTrustAccountsNewZeroTrustAccount(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayZeroTrustAccountsNewZeroTrustAccountParams) (cloudflare.AccountGatewayZeroTrustAccountsNewZeroTrustAccountResponse, error) +- client.Accounts.Gateway.ZeroTrustAccountsGetZeroTrustAccountInformation(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayZeroTrustAccountsGetZeroTrustAccountInformationResponse, error) + +### AuditSSHSettings + +Response Types: + +- cloudflare.AccountGatewayAuditSSHSettingGetResponse +- cloudflare.AccountGatewayAuditSSHSettingUpdateResponse + +Methods: + +- client.Accounts.Gateway.AuditSSHSettings.Get(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayAuditSSHSettingGetResponse, error) +- client.Accounts.Gateway.AuditSSHSettings.Update(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayAuditSSHSettingUpdateParams) (cloudflare.AccountGatewayAuditSSHSettingUpdateResponse, error) + +### Categories + +Response Types: + +- cloudflare.AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponse + +Methods: + +- client.Accounts.Gateway.Categories.ZeroTrustGatewayCategoriesListCategories(ctx context.Context, accountID string) (cloudflare.AccountGatewayCategoryZeroTrustGatewayCategoriesListCategoriesResponse, error) + +### AppTypes + +Response Types: + +- cloudflare.AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponse + +Methods: + +- client.Accounts.Gateway.AppTypes.ZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappings(ctx context.Context, identifier string) (cloudflare.AccountGatewayAppTypeZeroTrustGatewayApplicationAndApplicationTypeMappingsListApplicationAndApplicationTypeMappingsResponse, error) + +### Configurations + +Response Types: + +- cloudflare.AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponse +- cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponse +- cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponse + +Methods: + +- client.Accounts.Gateway.Configurations.ZeroTrustAccountsGetZeroTrustAccountConfiguration(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayConfigurationZeroTrustAccountsGetZeroTrustAccountConfigurationResponse, error) +- client.Accounts.Gateway.Configurations.ZeroTrustAccountsPatchZeroTrustAccountConfiguration(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationParams) (cloudflare.AccountGatewayConfigurationZeroTrustAccountsPatchZeroTrustAccountConfigurationResponse, error) +- client.Accounts.Gateway.Configurations.ZeroTrustAccountsUpdateZeroTrustAccountConfiguration(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationParams) (cloudflare.AccountGatewayConfigurationZeroTrustAccountsUpdateZeroTrustAccountConfigurationResponse, error) + +### Lists + +Response Types: + +- cloudflare.AccountGatewayListGetResponse +- cloudflare.AccountGatewayListUpdateResponse +- cloudflare.AccountGatewayListDeleteResponse +- cloudflare.AccountGatewayListPatchResponse +- cloudflare.AccountGatewayListZeroTrustListsNewZeroTrustListResponse +- cloudflare.AccountGatewayListZeroTrustListsListZeroTrustListsResponse + +Methods: + +- client.Accounts.Gateway.Lists.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountGatewayListGetResponse, error) +- client.Accounts.Gateway.Lists.Update(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountGatewayListUpdateParams) (cloudflare.AccountGatewayListUpdateResponse, error) +- client.Accounts.Gateway.Lists.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountGatewayListDeleteResponse, error) +- client.Accounts.Gateway.Lists.Patch(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountGatewayListPatchParams) (cloudflare.AccountGatewayListPatchResponse, error) +- client.Accounts.Gateway.Lists.ZeroTrustListsNewZeroTrustList(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayListZeroTrustListsNewZeroTrustListParams) (cloudflare.AccountGatewayListZeroTrustListsNewZeroTrustListResponse, error) +- client.Accounts.Gateway.Lists.ZeroTrustListsListZeroTrustLists(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayListZeroTrustListsListZeroTrustListsResponse, error) + +#### Items + +Response Types: + +- cloudflare.AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponse + +Methods: + +- client.Accounts.Gateway.Lists.Items.ZeroTrustListsZeroTrustListItems(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountGatewayListItemZeroTrustListsZeroTrustListItemsResponse, error) + +### Locations + +Response Types: + +- cloudflare.AccountGatewayLocationGetResponse +- cloudflare.AccountGatewayLocationUpdateResponse +- cloudflare.AccountGatewayLocationDeleteResponse +- cloudflare.AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponse +- cloudflare.AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponse + +Methods: + +- client.Accounts.Gateway.Locations.Get(ctx context.Context, identifier interface{}, uuid interface{}) (cloudflare.AccountGatewayLocationGetResponse, error) +- client.Accounts.Gateway.Locations.Update(ctx context.Context, identifier interface{}, uuid interface{}, body cloudflare.AccountGatewayLocationUpdateParams) (cloudflare.AccountGatewayLocationUpdateResponse, error) +- client.Accounts.Gateway.Locations.Delete(ctx context.Context, identifier interface{}, uuid interface{}) (cloudflare.AccountGatewayLocationDeleteResponse, error) +- client.Accounts.Gateway.Locations.ZeroTrustGatewayLocationsNewZeroTrustGatewayLocation(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationParams) (cloudflare.AccountGatewayLocationZeroTrustGatewayLocationsNewZeroTrustGatewayLocationResponse, error) +- client.Accounts.Gateway.Locations.ZeroTrustGatewayLocationsListZeroTrustGatewayLocations(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayLocationZeroTrustGatewayLocationsListZeroTrustGatewayLocationsResponse, error) + +### Loggings + +Response Types: + +- cloudflare.AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponse +- cloudflare.AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponse + +Methods: + +- client.Accounts.Gateway.Loggings.ZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccount(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayLoggingZeroTrustAccountsGetLoggingSettingsForTheZeroTrustAccountResponse, error) +- client.Accounts.Gateway.Loggings.ZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccount(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountParams) (cloudflare.AccountGatewayLoggingZeroTrustAccountsUpdateLoggingSettingsForTheZeroTrustAccountResponse, error) + +### ProxyEndpoints + +Response Types: + +- cloudflare.AccountGatewayProxyEndpointGetResponse +- cloudflare.AccountGatewayProxyEndpointUpdateResponse +- cloudflare.AccountGatewayProxyEndpointDeleteResponse +- cloudflare.AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponse +- cloudflare.AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponse + +Methods: + +- client.Accounts.Gateway.ProxyEndpoints.Get(ctx context.Context, identifier interface{}, uuid interface{}) (cloudflare.AccountGatewayProxyEndpointGetResponse, error) +- client.Accounts.Gateway.ProxyEndpoints.Update(ctx context.Context, identifier interface{}, uuid interface{}, body cloudflare.AccountGatewayProxyEndpointUpdateParams) (cloudflare.AccountGatewayProxyEndpointUpdateResponse, error) +- client.Accounts.Gateway.ProxyEndpoints.Delete(ctx context.Context, identifier interface{}, uuid interface{}) (cloudflare.AccountGatewayProxyEndpointDeleteResponse, error) +- client.Accounts.Gateway.ProxyEndpoints.ZeroTrustGatewayProxyEndpointsNewProxyEndpoint(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointParams) (cloudflare.AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsNewProxyEndpointResponse, error) +- client.Accounts.Gateway.ProxyEndpoints.ZeroTrustGatewayProxyEndpointsListProxyEndpoints(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayProxyEndpointZeroTrustGatewayProxyEndpointsListProxyEndpointsResponse, error) + +### Rules + +Response Types: + +- cloudflare.AccountGatewayRuleGetResponse +- cloudflare.AccountGatewayRuleUpdateResponse +- cloudflare.AccountGatewayRuleDeleteResponse +- cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponse +- cloudflare.AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponse + +Methods: + +- client.Accounts.Gateway.Rules.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountGatewayRuleGetResponse, error) +- client.Accounts.Gateway.Rules.Update(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountGatewayRuleUpdateParams) (cloudflare.AccountGatewayRuleUpdateResponse, error) +- client.Accounts.Gateway.Rules.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountGatewayRuleDeleteResponse, error) +- client.Accounts.Gateway.Rules.ZeroTrustGatewayRulesNewZeroTrustGatewayRule(ctx context.Context, identifier interface{}, body cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleParams) (cloudflare.AccountGatewayRuleZeroTrustGatewayRulesNewZeroTrustGatewayRuleResponse, error) +- client.Accounts.Gateway.Rules.ZeroTrustGatewayRulesListZeroTrustGatewayRules(ctx context.Context, identifier interface{}) (cloudflare.AccountGatewayRuleZeroTrustGatewayRulesListZeroTrustGatewayRulesResponse, error) + +## Rulesets + +Response Types: + +- cloudflare.AccountRulesetGetResponse +- cloudflare.AccountRulesetUpdateResponse +- cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetResponse +- cloudflare.AccountRulesetAccountRulesetsListAccountRulesetsResponse + +Methods: + +- client.Accounts.Rulesets.Get(ctx context.Context, accountID string, rulesetID string) (cloudflare.AccountRulesetGetResponse, error) +- client.Accounts.Rulesets.Update(ctx context.Context, accountID string, rulesetID string, body cloudflare.AccountRulesetUpdateParams) (cloudflare.AccountRulesetUpdateResponse, error) +- client.Accounts.Rulesets.Delete(ctx context.Context, accountID string, rulesetID string) error +- client.Accounts.Rulesets.AccountRulesetsNewAnAccountRuleset(ctx context.Context, accountID string, body cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetParams) (cloudflare.AccountRulesetAccountRulesetsNewAnAccountRulesetResponse, error) +- client.Accounts.Rulesets.AccountRulesetsListAccountRulesets(ctx context.Context, accountID string) (cloudflare.AccountRulesetAccountRulesetsListAccountRulesetsResponse, error) + +### Phases + +#### Entrypoints + +Response Types: + +- cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponse +- cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponse + +Methods: + +- client.Accounts.Rulesets.Phases.Entrypoints.AccountRulesetsGetAnAccountEntryPointRuleset(ctx context.Context, accountID string, rulesetPhase cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetParamsRulesetPhase) (cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsGetAnAccountEntryPointRulesetResponse, error) +- client.Accounts.Rulesets.Phases.Entrypoints.AccountRulesetsUpdateAnAccountEntryPointRuleset(ctx context.Context, accountID string, rulesetPhase cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParamsRulesetPhase, body cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetParams) (cloudflare.AccountRulesetPhaseEntrypointAccountRulesetsUpdateAnAccountEntryPointRulesetResponse, error) + +##### Versions + +Response Types: + +- cloudflare.AccountRulesetPhaseEntrypointVersionGetResponse +- cloudflare.AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponse + +Methods: + +- client.Accounts.Rulesets.Phases.Entrypoints.Versions.Get(ctx context.Context, accountID string, rulesetPhase cloudflare.AccountRulesetPhaseEntrypointVersionGetParamsRulesetPhase, rulesetVersion string) (cloudflare.AccountRulesetPhaseEntrypointVersionGetResponse, error) +- client.Accounts.Rulesets.Phases.Entrypoints.Versions.AccountRulesetsListAnAccountEntryPointRulesetSVersions(ctx context.Context, accountID string, rulesetPhase cloudflare.AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsParamsRulesetPhase) (cloudflare.AccountRulesetPhaseEntrypointVersionAccountRulesetsListAnAccountEntryPointRulesetSVersionsResponse, error) + +### Rules + +Response Types: + +- cloudflare.AccountRulesetRuleUpdateResponse +- cloudflare.AccountRulesetRuleDeleteResponse +- cloudflare.AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponse + +Methods: + +- client.Accounts.Rulesets.Rules.Update(ctx context.Context, accountID string, rulesetID string, ruleID string, body cloudflare.AccountRulesetRuleUpdateParams) (cloudflare.AccountRulesetRuleUpdateResponse, error) +- client.Accounts.Rulesets.Rules.Delete(ctx context.Context, accountID string, rulesetID string, ruleID string) (cloudflare.AccountRulesetRuleDeleteResponse, error) +- client.Accounts.Rulesets.Rules.AccountRulesetsNewAnAccountRulesetRule(ctx context.Context, accountID string, rulesetID string, body cloudflare.AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleParams) (cloudflare.AccountRulesetRuleAccountRulesetsNewAnAccountRulesetRuleResponse, error) + +### Versions + +Response Types: + +- cloudflare.AccountRulesetVersionGetResponse +- cloudflare.AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponse + +Methods: + +- client.Accounts.Rulesets.Versions.Get(ctx context.Context, accountID string, rulesetID string, rulesetVersion string) (cloudflare.AccountRulesetVersionGetResponse, error) +- client.Accounts.Rulesets.Versions.Delete(ctx context.Context, accountID string, rulesetID string, rulesetVersion string) error +- client.Accounts.Rulesets.Versions.AccountRulesetsListAnAccountRulesetSVersions(ctx context.Context, accountID string, rulesetID string) (cloudflare.AccountRulesetVersionAccountRulesetsListAnAccountRulesetSVersionsResponse, error) + +#### ByTags + +Response Types: + +- cloudflare.AccountRulesetVersionByTagGetResponse + +Methods: + +- client.Accounts.Rulesets.Versions.ByTags.Get(ctx context.Context, accountID string, rulesetID string, rulesetVersion string, ruleTag string) (cloudflare.AccountRulesetVersionByTagGetResponse, error) + +## Access + +### Bookmarks + +Response Types: + +- cloudflare.AccountAccessBookmarkNewResponse +- cloudflare.AccountAccessBookmarkGetResponse +- cloudflare.AccountAccessBookmarkUpdateResponse +- cloudflare.AccountAccessBookmarkDeleteResponse +- cloudflare.AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponse + +Methods: + +- client.Accounts.Access.Bookmarks.New(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountAccessBookmarkNewResponse, error) +- client.Accounts.Access.Bookmarks.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountAccessBookmarkGetResponse, error) +- client.Accounts.Access.Bookmarks.Update(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountAccessBookmarkUpdateResponse, error) +- client.Accounts.Access.Bookmarks.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountAccessBookmarkDeleteResponse, error) +- client.Accounts.Access.Bookmarks.AccessBookmarkApplicationsDeprecatedListBookmarkApplications(ctx context.Context, identifier interface{}) (cloudflare.AccountAccessBookmarkAccessBookmarkApplicationsDeprecatedListBookmarkApplicationsResponse, error) + +### Certificates + +Response Types: + +- cloudflare.AccountAccessCertificateGetResponse +- cloudflare.AccountAccessCertificateUpdateResponse +- cloudflare.AccountAccessCertificateDeleteResponse +- cloudflare.AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponse +- cloudflare.AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponse + +Methods: + +- client.Accounts.Access.Certificates.Get(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessCertificateGetResponse, error) +- client.Accounts.Access.Certificates.Update(ctx context.Context, identifier string, uuid string, body cloudflare.AccountAccessCertificateUpdateParams) (cloudflare.AccountAccessCertificateUpdateResponse, error) +- client.Accounts.Access.Certificates.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessCertificateDeleteResponse, error) +- client.Accounts.Access.Certificates.AccessMTlsAuthenticationAddAnMTlsCertificate(ctx context.Context, identifier string, body cloudflare.AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateParams) (cloudflare.AccountAccessCertificateAccessMTlsAuthenticationAddAnMTlsCertificateResponse, error) +- client.Accounts.Access.Certificates.AccessMTlsAuthenticationListMTlsCertificates(ctx context.Context, identifier string) (cloudflare.AccountAccessCertificateAccessMTlsAuthenticationListMTlsCertificatesResponse, error) + +#### Settings + +Response Types: + +- cloudflare.AccountAccessCertificateSettingUpdateResponse +- cloudflare.AccountAccessCertificateSettingListResponse + +Methods: + +- client.Accounts.Access.Certificates.Settings.Update(ctx context.Context, identifier string, body cloudflare.AccountAccessCertificateSettingUpdateParams) (cloudflare.AccountAccessCertificateSettingUpdateResponse, error) +- client.Accounts.Access.Certificates.Settings.List(ctx context.Context, identifier string) (cloudflare.AccountAccessCertificateSettingListResponse, error) + +### CustomPages + +Response Types: + +- cloudflare.AccountAccessCustomPageNewResponse +- cloudflare.AccountAccessCustomPageListResponse +- cloudflare.AccountAccessCustomPageDeleteResponse +- cloudflare.AccountAccessCustomPageGetCustomPageResponse +- cloudflare.AccountAccessCustomPageUpdateCustomPageResponse + +Methods: + +- client.Accounts.Access.CustomPages.New(ctx context.Context, identifier string, body cloudflare.AccountAccessCustomPageNewParams) (cloudflare.AccountAccessCustomPageNewResponse, error) +- client.Accounts.Access.CustomPages.List(ctx context.Context, identifier string) (cloudflare.AccountAccessCustomPageListResponse, error) +- client.Accounts.Access.CustomPages.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessCustomPageDeleteResponse, error) +- client.Accounts.Access.CustomPages.GetCustomPage(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessCustomPageGetCustomPageResponse, error) +- client.Accounts.Access.CustomPages.UpdateCustomPage(ctx context.Context, identifier string, uuid string, body cloudflare.AccountAccessCustomPageUpdateCustomPageParams) (cloudflare.AccountAccessCustomPageUpdateCustomPageResponse, error) + +### Groups + +Response Types: + +- cloudflare.AccountAccessGroupGetResponse +- cloudflare.AccountAccessGroupUpdateResponse +- cloudflare.AccountAccessGroupDeleteResponse +- cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupResponse +- cloudflare.AccountAccessGroupAccessGroupsListAccessGroupsResponse + +Methods: + +- client.Accounts.Access.Groups.Get(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessGroupGetResponse, error) +- client.Accounts.Access.Groups.Update(ctx context.Context, identifier string, uuid string, body cloudflare.AccountAccessGroupUpdateParams) (cloudflare.AccountAccessGroupUpdateResponse, error) +- client.Accounts.Access.Groups.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessGroupDeleteResponse, error) +- client.Accounts.Access.Groups.AccessGroupsNewAnAccessGroup(ctx context.Context, identifier string, body cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupParams) (cloudflare.AccountAccessGroupAccessGroupsNewAnAccessGroupResponse, error) +- client.Accounts.Access.Groups.AccessGroupsListAccessGroups(ctx context.Context, identifier string) (cloudflare.AccountAccessGroupAccessGroupsListAccessGroupsResponse, error) + +### IdentityProviders + +Response Types: + +- cloudflare.AccountAccessIdentityProviderGetResponse +- cloudflare.AccountAccessIdentityProviderUpdateResponse +- cloudflare.AccountAccessIdentityProviderDeleteResponse +- cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponse +- cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponse + +Methods: + +- client.Accounts.Access.IdentityProviders.Get(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessIdentityProviderGetResponse, error) +- client.Accounts.Access.IdentityProviders.Update(ctx context.Context, identifier string, uuid string, body cloudflare.AccountAccessIdentityProviderUpdateParams) (cloudflare.AccountAccessIdentityProviderUpdateResponse, error) +- client.Accounts.Access.IdentityProviders.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessIdentityProviderDeleteResponse, error) +- client.Accounts.Access.IdentityProviders.AccessIdentityProvidersAddAnAccessIdentityProvider(ctx context.Context, identifier string, body cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderParams) (cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersAddAnAccessIdentityProviderResponse, error) +- client.Accounts.Access.IdentityProviders.AccessIdentityProvidersListAccessIdentityProviders(ctx context.Context, identifier string) (cloudflare.AccountAccessIdentityProviderAccessIdentityProvidersListAccessIdentityProvidersResponse, error) + +### Keys + +Response Types: + +- cloudflare.AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponse +- cloudflare.AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponse + +Methods: + +- client.Accounts.Access.Keys.AccessKeyConfigurationGetTheAccessKeyConfiguration(ctx context.Context, identifier string) (cloudflare.AccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponse, error) +- client.Accounts.Access.Keys.AccessKeyConfigurationUpdateTheAccessKeyConfiguration(ctx context.Context, identifier string, body cloudflare.AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationParams) (cloudflare.AccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponse, error) + +#### Rotates + +Response Types: + +- cloudflare.AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponse + +Methods: + +- client.Accounts.Access.Keys.Rotates.AccessKeyConfigurationRotateAccessKeys(ctx context.Context, identifier string) (cloudflare.AccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponse, error) + +### Logs + +#### AccessRequests + +Response Types: + +- cloudflare.AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponse + +Methods: + +- client.Accounts.Access.Logs.AccessRequests.AccessAuthenticationLogsGetAccessAuthenticationLogs(ctx context.Context, identifier string) (cloudflare.AccountAccessLogAccessRequestAccessAuthenticationLogsGetAccessAuthenticationLogsResponse, error) + +### Organizations + +Response Types: + +- cloudflare.AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponse +- cloudflare.AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponse +- cloudflare.AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse + +Methods: + +- client.Accounts.Access.Organizations.ZeroTrustOrganizationNewYourZeroTrustOrganization(ctx context.Context, identifier string, body cloudflare.AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationParams) (cloudflare.AccountAccessOrganizationZeroTrustOrganizationNewYourZeroTrustOrganizationResponse, error) +- client.Accounts.Access.Organizations.ZeroTrustOrganizationGetYourZeroTrustOrganization(ctx context.Context, identifier string) (cloudflare.AccountAccessOrganizationZeroTrustOrganizationGetYourZeroTrustOrganizationResponse, error) +- client.Accounts.Access.Organizations.ZeroTrustOrganizationUpdateYourZeroTrustOrganization(ctx context.Context, identifier string, body cloudflare.AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams) (cloudflare.AccountAccessOrganizationZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse, error) + +#### RevokeUsers + +Response Types: + +- cloudflare.AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponse + +Methods: + +- client.Accounts.Access.Organizations.RevokeUsers.ZeroTrustOrganizationRevokeAllAccessTokensForAUser(ctx context.Context, identifier string, body cloudflare.AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserParams) (cloudflare.AccountAccessOrganizationRevokeUserZeroTrustOrganizationRevokeAllAccessTokensForAUserResponse, error) + +### Seats + +Response Types: + +- cloudflare.AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponse + +Methods: + +- client.Accounts.Access.Seats.ZeroTrustSeatsUpdateAUserSeat(ctx context.Context, identifier string, body cloudflare.AccountAccessSeatZeroTrustSeatsUpdateAUserSeatParams) (cloudflare.AccountAccessSeatZeroTrustSeatsUpdateAUserSeatResponse, error) + +### ServiceTokens + +Response Types: + +- cloudflare.AccountAccessServiceTokenUpdateResponse +- cloudflare.AccountAccessServiceTokenDeleteResponse +- cloudflare.AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponse +- cloudflare.AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponse + +Methods: + +- client.Accounts.Access.ServiceTokens.Update(ctx context.Context, identifier string, uuid string, body cloudflare.AccountAccessServiceTokenUpdateParams) (cloudflare.AccountAccessServiceTokenUpdateResponse, error) +- client.Accounts.Access.ServiceTokens.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessServiceTokenDeleteResponse, error) +- client.Accounts.Access.ServiceTokens.AccessServiceTokensNewAServiceToken(ctx context.Context, identifier string, body cloudflare.AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenParams) (cloudflare.AccountAccessServiceTokenAccessServiceTokensNewAServiceTokenResponse, error) +- client.Accounts.Access.ServiceTokens.AccessServiceTokensListServiceTokens(ctx context.Context, identifier string) (cloudflare.AccountAccessServiceTokenAccessServiceTokensListServiceTokensResponse, error) + +#### Refreshes + +Response Types: + +- cloudflare.AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponse + +Methods: + +- client.Accounts.Access.ServiceTokens.Refreshes.AccessServiceTokensRefreshAServiceToken(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessServiceTokenRefreshAccessServiceTokensRefreshAServiceTokenResponse, error) + +#### Rotates + +Response Types: + +- cloudflare.AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponse + +Methods: + +- client.Accounts.Access.ServiceTokens.Rotates.AccessServiceTokensRotateAServiceToken(ctx context.Context, identifier string, uuid string) (cloudflare.AccountAccessServiceTokenRotateAccessServiceTokensRotateAServiceTokenResponse, error) + +### Tags + +Response Types: + +- cloudflare.AccountAccessTagNewTagResponse +- cloudflare.AccountAccessTagDeleteTagResponse +- cloudflare.AccountAccessTagGetTagResponse +- cloudflare.AccountAccessTagListTagsResponse +- cloudflare.AccountAccessTagUpdateTagResponse + +Methods: + +- client.Accounts.Access.Tags.NewTag(ctx context.Context, identifier string, body cloudflare.AccountAccessTagNewTagParams) (cloudflare.AccountAccessTagNewTagResponse, error) +- client.Accounts.Access.Tags.DeleteTag(ctx context.Context, identifier string, name string) (cloudflare.AccountAccessTagDeleteTagResponse, error) +- client.Accounts.Access.Tags.GetTag(ctx context.Context, identifier string, name string) (cloudflare.AccountAccessTagGetTagResponse, error) +- client.Accounts.Access.Tags.ListTags(ctx context.Context, identifier string) (cloudflare.AccountAccessTagListTagsResponse, error) +- client.Accounts.Access.Tags.UpdateTag(ctx context.Context, identifier string, params cloudflare.AccountAccessTagUpdateTagParams) (cloudflare.AccountAccessTagUpdateTagResponse, error) + +### Users + +Response Types: + +- cloudflare.AccountAccessUserZeroTrustUsersGetUsersResponse + +Methods: + +- client.Accounts.Access.Users.ZeroTrustUsersGetUsers(ctx context.Context, identifier string) (cloudflare.AccountAccessUserZeroTrustUsersGetUsersResponse, error) + +#### ActiveSessions + +Response Types: + +- cloudflare.AccountAccessUserActiveSessionListResponse +- cloudflare.AccountAccessUserActiveSessionGetActiveSessionResponse + +Methods: + +- client.Accounts.Access.Users.ActiveSessions.List(ctx context.Context, identifier string, id string) (cloudflare.AccountAccessUserActiveSessionListResponse, error) +- client.Accounts.Access.Users.ActiveSessions.GetActiveSession(ctx context.Context, identifier string, id string, nonce string) (cloudflare.AccountAccessUserActiveSessionGetActiveSessionResponse, error) + +#### LastSeenIdentity + +Response Types: + +- cloudflare.AccountAccessUserLastSeenIdentityGetResponse + +Methods: + +- client.Accounts.Access.Users.LastSeenIdentity.Get(ctx context.Context, identifier string, id string) (cloudflare.AccountAccessUserLastSeenIdentityGetResponse, error) + +#### FailedLogins + +Response Types: + +- cloudflare.AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponse + +Methods: + +- client.Accounts.Access.Users.FailedLogins.ZeroTrustUsersGetFailedLogins(ctx context.Context, identifier string, id string) (cloudflare.AccountAccessUserFailedLoginZeroTrustUsersGetFailedLoginsResponse, error) + +## Alerting + +### V3 + +#### AvailableAlerts + +Response Types: + +- cloudflare.AccountAlertingV3AvailableAlertListResponse + +Methods: + +- client.Accounts.Alerting.V3.AvailableAlerts.List(ctx context.Context, accountID string) (cloudflare.AccountAlertingV3AvailableAlertListResponse, error) + +#### Destinations + +##### Eligible + +Response Types: + +- cloudflare.AccountAlertingV3DestinationEligibleListResponse + +Methods: + +- client.Accounts.Alerting.V3.Destinations.Eligible.List(ctx context.Context, accountID string) (cloudflare.AccountAlertingV3DestinationEligibleListResponse, error) + +##### Pagerduty + +Response Types: + +- cloudflare.AccountAlertingV3DestinationPagerdutyListResponse +- cloudflare.AccountAlertingV3DestinationPagerdutyDeleteResponse +- cloudflare.AccountAlertingV3DestinationPagerdutyConnectResponse +- cloudflare.AccountAlertingV3DestinationPagerdutyLinkResponse + +Methods: + +- client.Accounts.Alerting.V3.Destinations.Pagerduty.List(ctx context.Context, accountID string) (cloudflare.AccountAlertingV3DestinationPagerdutyListResponse, error) +- client.Accounts.Alerting.V3.Destinations.Pagerduty.Delete(ctx context.Context, accountID string) (cloudflare.AccountAlertingV3DestinationPagerdutyDeleteResponse, error) +- client.Accounts.Alerting.V3.Destinations.Pagerduty.Connect(ctx context.Context, accountID string) (cloudflare.AccountAlertingV3DestinationPagerdutyConnectResponse, error) +- client.Accounts.Alerting.V3.Destinations.Pagerduty.Link(ctx context.Context, accountID string, tokenID string) (cloudflare.AccountAlertingV3DestinationPagerdutyLinkResponse, error) + +##### Webhooks + +Response Types: + +- cloudflare.AccountAlertingV3DestinationWebhookNewResponse +- cloudflare.AccountAlertingV3DestinationWebhookGetResponse +- cloudflare.AccountAlertingV3DestinationWebhookListResponse +- cloudflare.AccountAlertingV3DestinationWebhookDeleteResponse + +Methods: + +- client.Accounts.Alerting.V3.Destinations.Webhooks.New(ctx context.Context, accountID string, body cloudflare.AccountAlertingV3DestinationWebhookNewParams) (cloudflare.AccountAlertingV3DestinationWebhookNewResponse, error) +- client.Accounts.Alerting.V3.Destinations.Webhooks.Get(ctx context.Context, accountID string, webhookID string) (cloudflare.AccountAlertingV3DestinationWebhookGetResponse, error) +- client.Accounts.Alerting.V3.Destinations.Webhooks.List(ctx context.Context, accountID string) (cloudflare.AccountAlertingV3DestinationWebhookListResponse, error) +- client.Accounts.Alerting.V3.Destinations.Webhooks.Delete(ctx context.Context, accountID string, webhookID string) (cloudflare.AccountAlertingV3DestinationWebhookDeleteResponse, error) + +## CustomNs + +Response Types: + +- cloudflare.AccountCustomNDeleteResponse +- cloudflare.AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponse +- cloudflare.AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponse + +Methods: + +- client.Accounts.CustomNs.Delete(ctx context.Context, identifier string, nsName string) (cloudflare.AccountCustomNDeleteResponse, error) +- client.Accounts.CustomNs.AccountLevelCustomNameserversAddAccountCustomNameserver(ctx context.Context, identifier string, body cloudflare.AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverParams) (cloudflare.AccountCustomNAccountLevelCustomNameserversAddAccountCustomNameserverResponse, error) +- client.Accounts.CustomNs.AccountLevelCustomNameserversListAccountCustomNameservers(ctx context.Context, identifier string) (cloudflare.AccountCustomNAccountLevelCustomNameserversListAccountCustomNameserversResponse, error) + +### Availabilities + +Response Types: + +- cloudflare.AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponse + +Methods: + +- client.Accounts.CustomNs.Availabilities.AccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameservers(ctx context.Context, identifier string) (cloudflare.AccountCustomNAvailabilityAccountLevelCustomNameserversGetEligibleZonesForAccountCustomNameserversResponse, error) + +### Verifies + +Response Types: + +- cloudflare.AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponse + +Methods: + +- client.Accounts.CustomNs.Verifies.AccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecords(ctx context.Context, identifier string) (cloudflare.AccountCustomNVerifyAccountLevelCustomNameserversVerifyAccountCustomNameserverGlueRecordsResponse, error) + +## Devices + +Response Types: + +- cloudflare.AccountDeviceGetResponse +- cloudflare.AccountDeviceDevicesListDevicesResponse + +Methods: + +- client.Accounts.Devices.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDeviceGetResponse, error) +- client.Accounts.Devices.DevicesListDevices(ctx context.Context, identifier interface{}) (cloudflare.AccountDeviceDevicesListDevicesResponse, error) + +### DexTests + +Response Types: + +- cloudflare.AccountDeviceDexTestGetResponse +- cloudflare.AccountDeviceDexTestUpdateResponse +- cloudflare.AccountDeviceDexTestDeleteResponse +- cloudflare.AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponse +- cloudflare.AccountDeviceDexTestDeviceDexTestDetailsResponse + +Methods: + +- client.Accounts.Devices.DexTests.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDeviceDexTestGetResponse, error) +- client.Accounts.Devices.DexTests.Update(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDeviceDexTestUpdateParams) (cloudflare.AccountDeviceDexTestUpdateResponse, error) +- client.Accounts.Devices.DexTests.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDeviceDexTestDeleteResponse, error) +- client.Accounts.Devices.DexTests.DeviceDexTestNewDeviceDexTest(ctx context.Context, identifier interface{}, body cloudflare.AccountDeviceDexTestDeviceDexTestNewDeviceDexTestParams) (cloudflare.AccountDeviceDexTestDeviceDexTestNewDeviceDexTestResponse, error) +- client.Accounts.Devices.DexTests.DeviceDexTestDetails(ctx context.Context, identifier interface{}) (cloudflare.AccountDeviceDexTestDeviceDexTestDetailsResponse, error) + +### Networks + +Response Types: + +- cloudflare.AccountDeviceNetworkGetResponse +- cloudflare.AccountDeviceNetworkUpdateResponse +- cloudflare.AccountDeviceNetworkDeleteResponse +- cloudflare.AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponse +- cloudflare.AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponse + +Methods: + +- client.Accounts.Devices.Networks.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDeviceNetworkGetResponse, error) +- client.Accounts.Devices.Networks.Update(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDeviceNetworkUpdateParams) (cloudflare.AccountDeviceNetworkUpdateResponse, error) +- client.Accounts.Devices.Networks.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDeviceNetworkDeleteResponse, error) +- client.Accounts.Devices.Networks.DeviceManagedNetworksNewDeviceManagedNetwork(ctx context.Context, identifier interface{}, body cloudflare.AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkParams) (cloudflare.AccountDeviceNetworkDeviceManagedNetworksNewDeviceManagedNetworkResponse, error) +- client.Accounts.Devices.Networks.DeviceManagedNetworksListDeviceManagedNetworks(ctx context.Context, identifier interface{}) (cloudflare.AccountDeviceNetworkDeviceManagedNetworksListDeviceManagedNetworksResponse, error) + +### Policies + +Response Types: + +- cloudflare.AccountDevicePolicyGetResponse +- cloudflare.AccountDevicePolicyUpdateResponse +- cloudflare.AccountDevicePolicyDeleteResponse +- cloudflare.AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponse +- cloudflare.AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponse +- cloudflare.AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponse +- cloudflare.AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponse + +Methods: + +- client.Accounts.Devices.Policies.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePolicyGetResponse, error) +- client.Accounts.Devices.Policies.Update(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDevicePolicyUpdateParams) (cloudflare.AccountDevicePolicyUpdateResponse, error) +- client.Accounts.Devices.Policies.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePolicyDeleteResponse, error) +- client.Accounts.Devices.Policies.DevicesNewDeviceSettingsPolicy(ctx context.Context, identifier interface{}, body cloudflare.AccountDevicePolicyDevicesNewDeviceSettingsPolicyParams) (cloudflare.AccountDevicePolicyDevicesNewDeviceSettingsPolicyResponse, error) +- client.Accounts.Devices.Policies.DevicesGetDefaultDeviceSettingsPolicy(ctx context.Context, identifier interface{}) (cloudflare.AccountDevicePolicyDevicesGetDefaultDeviceSettingsPolicyResponse, error) +- client.Accounts.Devices.Policies.DevicesListDeviceSettingsPolicies(ctx context.Context, identifier interface{}) (cloudflare.AccountDevicePolicyDevicesListDeviceSettingsPoliciesResponse, error) +- client.Accounts.Devices.Policies.DevicesUpdateDefaultDeviceSettingsPolicy(ctx context.Context, identifier interface{}, body cloudflare.AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyParams) (cloudflare.AccountDevicePolicyDevicesUpdateDefaultDeviceSettingsPolicyResponse, error) + +#### Excludes + +Response Types: + +- cloudflare.AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponse +- cloudflare.AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponse +- cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponse +- cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponse + +Methods: + +- client.Accounts.Devices.Policies.Excludes.DevicesGetSplitTunnelExcludeList(ctx context.Context, identifier interface{}) (cloudflare.AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListResponse, error) +- client.Accounts.Devices.Policies.Excludes.DevicesGetSplitTunnelExcludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePolicyExcludeDevicesGetSplitTunnelExcludeListForADeviceSettingsPolicyResponse, error) +- client.Accounts.Devices.Policies.Excludes.DevicesSetSplitTunnelExcludeList(ctx context.Context, identifier interface{}, body cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListParams) (cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListResponse, error) +- client.Accounts.Devices.Policies.Excludes.DevicesSetSplitTunnelExcludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyParams) (cloudflare.AccountDevicePolicyExcludeDevicesSetSplitTunnelExcludeListForADeviceSettingsPolicyResponse, error) + +#### FallbackDomains + +Response Types: + +- cloudflare.AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponse +- cloudflare.AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponse +- cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponse +- cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponse + +Methods: + +- client.Accounts.Devices.Policies.FallbackDomains.DevicesGetLocalDomainFallbackList(ctx context.Context, identifier interface{}) (cloudflare.AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListResponse, error) +- client.Accounts.Devices.Policies.FallbackDomains.DevicesGetLocalDomainFallbackListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePolicyFallbackDomainDevicesGetLocalDomainFallbackListForADeviceSettingsPolicyResponse, error) +- client.Accounts.Devices.Policies.FallbackDomains.DevicesSetLocalDomainFallbackList(ctx context.Context, identifier interface{}, body cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListParams) (cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListResponse, error) +- client.Accounts.Devices.Policies.FallbackDomains.DevicesSetLocalDomainFallbackListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyParams) (cloudflare.AccountDevicePolicyFallbackDomainDevicesSetLocalDomainFallbackListForADeviceSettingsPolicyResponse, error) + +#### Includes + +Response Types: + +- cloudflare.AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponse +- cloudflare.AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponse +- cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponse +- cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponse + +Methods: + +- client.Accounts.Devices.Policies.Includes.DevicesGetSplitTunnelIncludeList(ctx context.Context, identifier interface{}) (cloudflare.AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListResponse, error) +- client.Accounts.Devices.Policies.Includes.DevicesGetSplitTunnelIncludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePolicyIncludeDevicesGetSplitTunnelIncludeListForADeviceSettingsPolicyResponse, error) +- client.Accounts.Devices.Policies.Includes.DevicesSetSplitTunnelIncludeList(ctx context.Context, identifier interface{}, body cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListParams) (cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListResponse, error) +- client.Accounts.Devices.Policies.Includes.DevicesSetSplitTunnelIncludeListForADeviceSettingsPolicy(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyParams) (cloudflare.AccountDevicePolicyIncludeDevicesSetSplitTunnelIncludeListForADeviceSettingsPolicyResponse, error) + +### Postures + +Response Types: + +- cloudflare.AccountDevicePostureGetResponse +- cloudflare.AccountDevicePostureUpdateResponse +- cloudflare.AccountDevicePostureDeleteResponse +- cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponse +- cloudflare.AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponse + +Methods: + +- client.Accounts.Devices.Postures.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePostureGetResponse, error) +- client.Accounts.Devices.Postures.Update(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDevicePostureUpdateParams) (cloudflare.AccountDevicePostureUpdateResponse, error) +- client.Accounts.Devices.Postures.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePostureDeleteResponse, error) +- client.Accounts.Devices.Postures.DevicePostureRulesNewDevicePostureRule(ctx context.Context, identifier interface{}, body cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleParams) (cloudflare.AccountDevicePostureDevicePostureRulesNewDevicePostureRuleResponse, error) +- client.Accounts.Devices.Postures.DevicePostureRulesListDevicePostureRules(ctx context.Context, identifier interface{}) (cloudflare.AccountDevicePostureDevicePostureRulesListDevicePostureRulesResponse, error) + +#### Integrations + +Response Types: + +- cloudflare.AccountDevicePostureIntegrationGetResponse +- cloudflare.AccountDevicePostureIntegrationUpdateResponse +- cloudflare.AccountDevicePostureIntegrationDeleteResponse +- cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponse +- cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponse + +Methods: + +- client.Accounts.Devices.Postures.Integrations.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePostureIntegrationGetResponse, error) +- client.Accounts.Devices.Postures.Integrations.Update(ctx context.Context, identifier interface{}, uuid string, body cloudflare.AccountDevicePostureIntegrationUpdateParams) (cloudflare.AccountDevicePostureIntegrationUpdateResponse, error) +- client.Accounts.Devices.Postures.Integrations.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDevicePostureIntegrationDeleteResponse, error) +- client.Accounts.Devices.Postures.Integrations.DevicePostureIntegrationsNewDevicePostureIntegration(ctx context.Context, identifier interface{}, body cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationParams) (cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsNewDevicePostureIntegrationResponse, error) +- client.Accounts.Devices.Postures.Integrations.DevicePostureIntegrationsListDevicePostureIntegrations(ctx context.Context, identifier interface{}) (cloudflare.AccountDevicePostureIntegrationDevicePostureIntegrationsListDevicePostureIntegrationsResponse, error) + +### Revokes + +Response Types: + +- cloudflare.AccountDeviceRevokeDevicesRevokeDevicesResponse + +Methods: + +- client.Accounts.Devices.Revokes.DevicesRevokeDevices(ctx context.Context, identifier interface{}, body cloudflare.AccountDeviceRevokeDevicesRevokeDevicesParams) (cloudflare.AccountDeviceRevokeDevicesRevokeDevicesResponse, error) + +### Settings + +Response Types: + +- cloudflare.AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponse +- cloudflare.AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponse + +Methods: + +- client.Accounts.Devices.Settings.ZeroTrustAccountsGetDeviceSettingsForZeroTrustAccount(ctx context.Context, identifier interface{}) (cloudflare.AccountDeviceSettingZeroTrustAccountsGetDeviceSettingsForZeroTrustAccountResponse, error) +- client.Accounts.Devices.Settings.ZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccount(ctx context.Context, identifier interface{}, body cloudflare.AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountParams) (cloudflare.AccountDeviceSettingZeroTrustAccountsUpdateDeviceSettingsForTheZeroTrustAccountResponse, error) + +### Unrevokes + +Response Types: + +- cloudflare.AccountDeviceUnrevokeDevicesUnrevokeDevicesResponse + +Methods: + +- client.Accounts.Devices.Unrevokes.DevicesUnrevokeDevices(ctx context.Context, identifier interface{}, body cloudflare.AccountDeviceUnrevokeDevicesUnrevokeDevicesParams) (cloudflare.AccountDeviceUnrevokeDevicesUnrevokeDevicesResponse, error) + +### OverrideCodes + +Response Types: + +- cloudflare.AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponse + +Methods: + +- client.Accounts.Devices.OverrideCodes.DevicesListAdminOverrideCodeForDevice(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccountDeviceOverrideCodeDevicesListAdminOverrideCodeForDeviceResponse, error) + +## Addressing + +### Prefixes + +#### Bindings + +Response Types: + +- cloudflare.AccountAddressingPrefixBindingNewResponse +- cloudflare.AccountAddressingPrefixBindingGetResponse +- cloudflare.AccountAddressingPrefixBindingListResponse +- cloudflare.AccountAddressingPrefixBindingDeleteResponse + +Methods: + +- client.Accounts.Addressing.Prefixes.Bindings.New(ctx context.Context, accountIdentifier string, prefixIdentifier string, body cloudflare.AccountAddressingPrefixBindingNewParams) (cloudflare.AccountAddressingPrefixBindingNewResponse, error) +- client.Accounts.Addressing.Prefixes.Bindings.Get(ctx context.Context, accountIdentifier string, prefixIdentifier string, bindingIdentifier string) (cloudflare.AccountAddressingPrefixBindingGetResponse, error) +- client.Accounts.Addressing.Prefixes.Bindings.List(ctx context.Context, accountIdentifier string, prefixIdentifier string) (cloudflare.AccountAddressingPrefixBindingListResponse, error) +- client.Accounts.Addressing.Prefixes.Bindings.Delete(ctx context.Context, accountIdentifier string, prefixIdentifier string, bindingIdentifier string) (cloudflare.AccountAddressingPrefixBindingDeleteResponse, error) + +### Services + +Response Types: + +- cloudflare.AccountAddressingServiceListResponse + +Methods: + +- client.Accounts.Addressing.Services.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountAddressingServiceListResponse, error) + +## AI + +Response Types: + +- cloudflare.AccountAIRunResponse + +Methods: + +- client.Accounts.AI.Run(ctx context.Context, accountIdentifier string, modelName string, body cloudflare.AccountAIRunParams) (cloudflare.AccountAIRunResponse, error) + +## Challenges + +### Widgets + +Response Types: + +- cloudflare.AccountChallengeWidgetNewResponse +- cloudflare.AccountChallengeWidgetGetResponse +- cloudflare.AccountChallengeWidgetUpdateResponse +- cloudflare.AccountChallengeWidgetListResponse +- cloudflare.AccountChallengeWidgetDeleteResponse +- cloudflare.AccountChallengeWidgetRotateSecretResponse + +Methods: + +- client.Accounts.Challenges.Widgets.New(ctx context.Context, accountIdentifier string, params cloudflare.AccountChallengeWidgetNewParams) (cloudflare.AccountChallengeWidgetNewResponse, error) +- client.Accounts.Challenges.Widgets.Get(ctx context.Context, accountIdentifier string, sitekey string) (cloudflare.AccountChallengeWidgetGetResponse, error) +- client.Accounts.Challenges.Widgets.Update(ctx context.Context, accountIdentifier string, sitekey string, body cloudflare.AccountChallengeWidgetUpdateParams) (cloudflare.AccountChallengeWidgetUpdateResponse, error) +- client.Accounts.Challenges.Widgets.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountChallengeWidgetListParams) (cloudflare.AccountChallengeWidgetListResponse, error) +- client.Accounts.Challenges.Widgets.Delete(ctx context.Context, accountIdentifier string, sitekey string) (cloudflare.AccountChallengeWidgetDeleteResponse, error) +- client.Accounts.Challenges.Widgets.RotateSecret(ctx context.Context, accountIdentifier string, sitekey string, body cloudflare.AccountChallengeWidgetRotateSecretParams) (cloudflare.AccountChallengeWidgetRotateSecretResponse, error) + +## D1 + +### Databases + +Response Types: + +- cloudflare.AccountD1DatabaseNewResponse +- cloudflare.AccountD1DatabaseGetResponse +- cloudflare.AccountD1DatabaseListResponse +- cloudflare.AccountD1DatabaseDeleteResponse +- cloudflare.AccountD1DatabaseQueryResponse + +Methods: + +- client.Accounts.D1.Databases.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountD1DatabaseNewParams) (cloudflare.AccountD1DatabaseNewResponse, error) +- client.Accounts.D1.Databases.Get(ctx context.Context, accountIdentifier string, databaseIdentifier string) (cloudflare.AccountD1DatabaseGetResponse, error) +- client.Accounts.D1.Databases.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountD1DatabaseListParams) (cloudflare.AccountD1DatabaseListResponse, error) +- client.Accounts.D1.Databases.Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string) (cloudflare.AccountD1DatabaseDeleteResponse, error) +- client.Accounts.D1.Databases.Query(ctx context.Context, accountIdentifier string, databaseIdentifier string, body cloudflare.AccountD1DatabaseQueryParams) (cloudflare.AccountD1DatabaseQueryResponse, error) + +## Dex + +### Colos + +Response Types: + +- cloudflare.AccountDexColoListResponse + +Methods: + +- client.Accounts.Dex.Colos.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountDexColoListParams) (cloudflare.AccountDexColoListResponse, error) + +### FleetStatusDevices + +Response Types: + +- cloudflare.AccountDexFleetStatusDeviceListResponse + +Methods: + +- client.Accounts.Dex.FleetStatusDevices.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountDexFleetStatusDeviceListParams) (cloudflare.AccountDexFleetStatusDeviceListResponse, error) + +### FleetStatusLive + +Response Types: + +- cloudflare.AccountDexFleetStatusLiveListResponse + +Methods: + +- client.Accounts.Dex.FleetStatusLive.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountDexFleetStatusLiveListParams) (cloudflare.AccountDexFleetStatusLiveListResponse, error) + +### FleetStatusOverTime + +Methods: + +- client.Accounts.Dex.FleetStatusOverTime.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountDexFleetStatusOverTimeListParams) error + +### HTTPTests + +Response Types: + +- cloudflare.AccountDexHTTPTestGetResponse + +Methods: + +- client.Accounts.Dex.HTTPTests.Get(ctx context.Context, accountIdentifier string, testID string, query cloudflare.AccountDexHTTPTestGetParams) (cloudflare.AccountDexHTTPTestGetResponse, error) + +#### Percentiles + +Response Types: + +- cloudflare.AccountDexHTTPTestPercentileListResponse + +Methods: + +- client.Accounts.Dex.HTTPTests.Percentiles.List(ctx context.Context, accountIdentifier string, testID string, query cloudflare.AccountDexHTTPTestPercentileListParams) (cloudflare.AccountDexHTTPTestPercentileListResponse, error) + +### Tests + +Response Types: + +- cloudflare.AccountDexTestListResponse + +Methods: + +- client.Accounts.Dex.Tests.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountDexTestListParams) (cloudflare.AccountDexTestListResponse, error) + +#### UniqueDevices + +Response Types: + +- cloudflare.AccountDexTestUniqueDeviceListResponse + +Methods: + +- client.Accounts.Dex.Tests.UniqueDevices.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountDexTestUniqueDeviceListParams) (cloudflare.AccountDexTestUniqueDeviceListResponse, error) + +### TracerouteTestResults + +#### NetworkPath + +Response Types: + +- cloudflare.AccountDexTracerouteTestResultNetworkPathListResponse + +Methods: + +- client.Accounts.Dex.TracerouteTestResults.NetworkPath.List(ctx context.Context, accountIdentifier string, testResultID string) (cloudflare.AccountDexTracerouteTestResultNetworkPathListResponse, error) + +### TracerouteTests + +Response Types: + +- cloudflare.AccountDexTracerouteTestGetResponse +- cloudflare.AccountDexTracerouteTestPercentilesResponse + +Methods: + +- client.Accounts.Dex.TracerouteTests.Get(ctx context.Context, accountIdentifier string, testID string, query cloudflare.AccountDexTracerouteTestGetParams) (cloudflare.AccountDexTracerouteTestGetResponse, error) +- client.Accounts.Dex.TracerouteTests.Percentiles(ctx context.Context, accountIdentifier string, testID string, query cloudflare.AccountDexTracerouteTestPercentilesParams) (cloudflare.AccountDexTracerouteTestPercentilesResponse, error) + +#### NetworkPath + +Response Types: + +- cloudflare.AccountDexTracerouteTestNetworkPathListResponse + +Methods: + +- client.Accounts.Dex.TracerouteTests.NetworkPath.List(ctx context.Context, accountIdentifier string, testID string, query cloudflare.AccountDexTracerouteTestNetworkPathListParams) (cloudflare.AccountDexTracerouteTestNetworkPathListResponse, error) + +## Hyperdrive + +### Configs + +Response Types: + +- cloudflare.AccountHyperdriveConfigNewResponse +- cloudflare.AccountHyperdriveConfigListResponse + +Methods: + +- client.Accounts.Hyperdrive.Configs.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountHyperdriveConfigNewParams) (cloudflare.AccountHyperdriveConfigNewResponse, error) +- client.Accounts.Hyperdrive.Configs.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountHyperdriveConfigListResponse, error) + +## PagesProjects + +Response Types: + +- cloudflare.AccountPagesProjectPurgeBuildCacheResponse + +Methods: + +- client.Accounts.PagesProjects.PurgeBuildCache(ctx context.Context, accountIdentifier string, projectName string) (cloudflare.AccountPagesProjectPurgeBuildCacheResponse, error) + +## Rum + +### SiteInfo + +Response Types: + +- cloudflare.AccountRumSiteInfoNewResponse + +Methods: + +- client.Accounts.Rum.SiteInfo.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountRumSiteInfoNewParams) (cloudflare.AccountRumSiteInfoNewResponse, error) + +### V2 + +#### Rule + +Response Types: + +- cloudflare.Rule + +Methods: + +- client.Accounts.Rum.V2.Rule.Update(ctx context.Context, accountIdentifier string, rulesetIdentifier string, ruleIdentifier string, body cloudflare.AccountRumV2RuleUpdateParams) (cloudflare.Rule, error) + +## VectorizeIndexes + +Response Types: + +- cloudflare.AccountVectorizeIndexNewResponse +- cloudflare.AccountVectorizeIndexGetResponse +- cloudflare.AccountVectorizeIndexUpdateResponse +- cloudflare.AccountVectorizeIndexListResponse +- cloudflare.AccountVectorizeIndexDeleteResponse +- cloudflare.AccountVectorizeIndexInsertResponse +- cloudflare.AccountVectorizeIndexQueryResponse +- cloudflare.AccountVectorizeIndexUpsertResponse + +Methods: + +- client.Accounts.VectorizeIndexes.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountVectorizeIndexNewParams) (cloudflare.AccountVectorizeIndexNewResponse, error) +- client.Accounts.VectorizeIndexes.Get(ctx context.Context, accountIdentifier string, indexName string) (cloudflare.AccountVectorizeIndexGetResponse, error) +- client.Accounts.VectorizeIndexes.Update(ctx context.Context, accountIdentifier string, indexName string, body cloudflare.AccountVectorizeIndexUpdateParams) (cloudflare.AccountVectorizeIndexUpdateResponse, error) +- client.Accounts.VectorizeIndexes.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountVectorizeIndexListResponse, error) +- client.Accounts.VectorizeIndexes.Delete(ctx context.Context, accountIdentifier string, indexName string) (cloudflare.AccountVectorizeIndexDeleteResponse, error) +- client.Accounts.VectorizeIndexes.Insert(ctx context.Context, accountIdentifier string, indexName string) (cloudflare.AccountVectorizeIndexInsertResponse, error) +- client.Accounts.VectorizeIndexes.Query(ctx context.Context, accountIdentifier string, indexName string, body cloudflare.AccountVectorizeIndexQueryParams) (cloudflare.AccountVectorizeIndexQueryResponse, error) +- client.Accounts.VectorizeIndexes.Upsert(ctx context.Context, accountIdentifier string, indexName string) (cloudflare.AccountVectorizeIndexUpsertResponse, error) + +## WarpConnector + +Response Types: + +- cloudflare.AccountWarpConnectorNewResponse +- cloudflare.AccountWarpConnectorGetResponse +- cloudflare.AccountWarpConnectorUpdateResponse +- cloudflare.AccountWarpConnectorListResponse +- cloudflare.AccountWarpConnectorDeleteResponse +- cloudflare.AccountWarpConnectorTokenResponse + +Methods: + +- client.Accounts.WarpConnector.New(ctx context.Context, accountIdentifier string, body cloudflare.AccountWarpConnectorNewParams) (cloudflare.AccountWarpConnectorNewResponse, error) +- client.Accounts.WarpConnector.Get(ctx context.Context, accountIdentifier string, tunnelID string) (cloudflare.AccountWarpConnectorGetResponse, error) +- client.Accounts.WarpConnector.Update(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountWarpConnectorUpdateParams) (cloudflare.AccountWarpConnectorUpdateResponse, error) +- client.Accounts.WarpConnector.List(ctx context.Context, accountIdentifier string, query cloudflare.AccountWarpConnectorListParams) (cloudflare.AccountWarpConnectorListResponse, error) +- client.Accounts.WarpConnector.Delete(ctx context.Context, accountIdentifier string, tunnelID string, body cloudflare.AccountWarpConnectorDeleteParams) (cloudflare.AccountWarpConnectorDeleteResponse, error) +- client.Accounts.WarpConnector.Token(ctx context.Context, accountIdentifier string, tunnelID string) (cloudflare.AccountWarpConnectorTokenResponse, error) + +## Zerotrust + +### ConnectivitySettings + +Response Types: + +- cloudflare.AccountZerotrustConnectivitySettingUpdateResponse +- cloudflare.AccountZerotrustConnectivitySettingListResponse + +Methods: + +- client.Accounts.Zerotrust.ConnectivitySettings.Update(ctx context.Context, accountIdentifier string, body cloudflare.AccountZerotrustConnectivitySettingUpdateParams) (cloudflare.AccountZerotrustConnectivitySettingUpdateResponse, error) +- client.Accounts.Zerotrust.ConnectivitySettings.List(ctx context.Context, accountIdentifier string) (cloudflare.AccountZerotrustConnectivitySettingListResponse, error) + +## Urlscanner + +### Scan + +Response Types: + +- cloudflare.AccountUrlscannerScanNewResponse +- cloudflare.AccountUrlscannerScanGetResponse +- cloudflare.AccountUrlscannerScanListResponse + +Methods: + +- client.Accounts.Urlscanner.Scan.New(ctx context.Context, accountID string, body cloudflare.AccountUrlscannerScanNewParams) (cloudflare.AccountUrlscannerScanNewResponse, error) +- client.Accounts.Urlscanner.Scan.Get(ctx context.Context, accountID string, scanID string) (cloudflare.AccountUrlscannerScanGetResponse, error) +- client.Accounts.Urlscanner.Scan.List(ctx context.Context, accountID string, query cloudflare.AccountUrlscannerScanListParams) (cloudflare.AccountUrlscannerScanListResponse, error) + +### Har + +Response Types: + +- cloudflare.AccountUrlscannerHarGetResponse + +Methods: + +- client.Accounts.Urlscanner.Har.Get(ctx context.Context, accountID string, scanID string) (cloudflare.AccountUrlscannerHarGetResponse, error) + +### Screenshot + +Methods: + +- client.Accounts.Urlscanner.Screenshot.Get(ctx context.Context, accountID string, scanID string, query cloudflare.AccountUrlscannerScreenshotGetParams) (http.Response, error) + +# Certificates + +Response Types: + +- cloudflare.CertificateNewResponse +- cloudflare.CertificateGetResponse +- cloudflare.CertificateListResponse +- cloudflare.CertificateDeleteResponse + +Methods: + +- client.Certificates.New(ctx context.Context, body cloudflare.CertificateNewParams) (cloudflare.CertificateNewResponse, error) +- client.Certificates.Get(ctx context.Context, identifier string) (cloudflare.CertificateGetResponse, error) +- client.Certificates.List(ctx context.Context, query cloudflare.CertificateListParams) (cloudflare.CertificateListResponse, error) +- client.Certificates.Delete(ctx context.Context, identifier string) (cloudflare.CertificateDeleteResponse, error) + +# IPs + +Response Types: + +- cloudflare.IPListResponse + +Methods: + +- client.IPs.List(ctx context.Context, query cloudflare.IPListParams) (cloudflare.IPListResponse, error) + +# Memberships + +Response Types: + +- cloudflare.MembershipGetResponse +- cloudflare.MembershipUpdateResponse +- cloudflare.MembershipDeleteResponse +- cloudflare.MembershipUserSAccountMembershipsListMembershipsResponse + +Methods: + +- client.Memberships.Get(ctx context.Context, identifier string) (cloudflare.MembershipGetResponse, error) +- client.Memberships.Update(ctx context.Context, identifier string, body cloudflare.MembershipUpdateParams) (cloudflare.MembershipUpdateResponse, error) +- client.Memberships.Delete(ctx context.Context, identifier string) (cloudflare.MembershipDeleteResponse, error) +- client.Memberships.UserSAccountMembershipsListMemberships(ctx context.Context, query cloudflare.MembershipUserSAccountMembershipsListMembershipsParams) (cloudflare.MembershipUserSAccountMembershipsListMembershipsResponse, error) + +# Organizations + +Response Types: + +- cloudflare.OrganizationGetResponse +- cloudflare.OrganizationUpdateResponse + +Methods: + +- client.Organizations.Get(ctx context.Context, identifier string) (cloudflare.OrganizationGetResponse, error) +- client.Organizations.Update(ctx context.Context, identifier string, body cloudflare.OrganizationUpdateParams) (cloudflare.OrganizationUpdateResponse, error) + +## Invites + +Response Types: + +- cloudflare.OrganizationInviteGetResponse +- cloudflare.OrganizationInviteUpdateResponse +- cloudflare.OrganizationInviteDeleteResponse +- cloudflare.OrganizationInviteOrganizationInvitesNewInvitationResponse +- cloudflare.OrganizationInviteOrganizationInvitesListInvitationsResponse + +Methods: + +- client.Organizations.Invites.Get(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationInviteGetResponse, error) +- client.Organizations.Invites.Update(ctx context.Context, organizationIdentifier string, identifier string, body cloudflare.OrganizationInviteUpdateParams) (cloudflare.OrganizationInviteUpdateResponse, error) +- client.Organizations.Invites.Delete(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationInviteDeleteResponse, error) +- client.Organizations.Invites.OrganizationInvitesNewInvitation(ctx context.Context, organizationIdentifier string, body cloudflare.OrganizationInviteOrganizationInvitesNewInvitationParams) (cloudflare.OrganizationInviteOrganizationInvitesNewInvitationResponse, error) +- client.Organizations.Invites.OrganizationInvitesListInvitations(ctx context.Context, organizationIdentifier string) (cloudflare.OrganizationInviteOrganizationInvitesListInvitationsResponse, error) + +## Members + +Response Types: + +- cloudflare.OrganizationMemberGetResponse +- cloudflare.OrganizationMemberUpdateResponse +- cloudflare.OrganizationMemberDeleteResponse +- cloudflare.OrganizationMemberOrganizationMembersListMembersResponse + +Methods: + +- client.Organizations.Members.Get(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationMemberGetResponse, error) +- client.Organizations.Members.Update(ctx context.Context, organizationIdentifier string, identifier string, body cloudflare.OrganizationMemberUpdateParams) (cloudflare.OrganizationMemberUpdateResponse, error) +- client.Organizations.Members.Delete(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationMemberDeleteResponse, error) +- client.Organizations.Members.OrganizationMembersListMembers(ctx context.Context, organizationIdentifier string) (cloudflare.OrganizationMemberOrganizationMembersListMembersResponse, error) + +## Railguns + +Response Types: + +- cloudflare.OrganizationRailgunGetResponse +- cloudflare.OrganizationRailgunUpdateResponse +- cloudflare.OrganizationRailgunDeleteResponse +- cloudflare.OrganizationRailgunOrganizationRailgunNewRailgunResponse +- cloudflare.OrganizationRailgunOrganizationRailgunListRailgunsResponse + +Methods: + +- client.Organizations.Railguns.Get(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationRailgunGetResponse, error) +- client.Organizations.Railguns.Update(ctx context.Context, organizationIdentifier string, identifier string, body cloudflare.OrganizationRailgunUpdateParams) (cloudflare.OrganizationRailgunUpdateResponse, error) +- client.Organizations.Railguns.Delete(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationRailgunDeleteResponse, error) +- client.Organizations.Railguns.OrganizationRailgunNewRailgun(ctx context.Context, organizationIdentifier string, body cloudflare.OrganizationRailgunOrganizationRailgunNewRailgunParams) (cloudflare.OrganizationRailgunOrganizationRailgunNewRailgunResponse, error) +- client.Organizations.Railguns.OrganizationRailgunListRailguns(ctx context.Context, organizationIdentifier string, query cloudflare.OrganizationRailgunOrganizationRailgunListRailgunsParams) (cloudflare.OrganizationRailgunOrganizationRailgunListRailgunsResponse, error) + +### Zones + +Response Types: + +- cloudflare.OrganizationRailgunZoneListResponse + +Methods: + +- client.Organizations.Railguns.Zones.List(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationRailgunZoneListResponse, error) + +## Roles + +Response Types: + +- cloudflare.OrganizationRoleGetResponse +- cloudflare.OrganizationRoleOrganizationRolesListRolesResponse + +Methods: + +- client.Organizations.Roles.Get(ctx context.Context, organizationIdentifier string, identifier string) (cloudflare.OrganizationRoleGetResponse, error) +- client.Organizations.Roles.OrganizationRolesListRoles(ctx context.Context, organizationIdentifier string) (cloudflare.OrganizationRoleOrganizationRolesListRolesResponse, error) + +# Radar + +## As112 + +### Summaries + +#### Dnssecs + +Response Types: + +- cloudflare.RadarAs112SummaryDnssecListResponse + +Methods: + +- client.Radar.As112.Summaries.Dnssecs.List(ctx context.Context, query cloudflare.RadarAs112SummaryDnssecListParams) (cloudflare.RadarAs112SummaryDnssecListResponse, error) + +#### Edns + +Response Types: + +- cloudflare.RadarAs112SummaryEdnListResponse + +Methods: + +- client.Radar.As112.Summaries.Edns.List(ctx context.Context, query cloudflare.RadarAs112SummaryEdnListParams) (cloudflare.RadarAs112SummaryEdnListResponse, error) + +#### IPVersions + +Response Types: + +- cloudflare.RadarAs112SummaryIPVersionListResponse + +Methods: + +- client.Radar.As112.Summaries.IPVersions.List(ctx context.Context, query cloudflare.RadarAs112SummaryIPVersionListParams) (cloudflare.RadarAs112SummaryIPVersionListResponse, error) + +#### Protocols + +Response Types: + +- cloudflare.RadarAs112SummaryProtocolListResponse + +Methods: + +- client.Radar.As112.Summaries.Protocols.List(ctx context.Context, query cloudflare.RadarAs112SummaryProtocolListParams) (cloudflare.RadarAs112SummaryProtocolListResponse, error) + +#### QueryTypes + +Response Types: + +- cloudflare.RadarAs112SummaryQueryTypeListResponse + +Methods: + +- client.Radar.As112.Summaries.QueryTypes.List(ctx context.Context, query cloudflare.RadarAs112SummaryQueryTypeListParams) (cloudflare.RadarAs112SummaryQueryTypeListResponse, error) + +#### ResponseCodes + +Response Types: + +- cloudflare.RadarAs112SummaryResponseCodeListResponse + +Methods: + +- client.Radar.As112.Summaries.ResponseCodes.List(ctx context.Context, query cloudflare.RadarAs112SummaryResponseCodeListParams) (cloudflare.RadarAs112SummaryResponseCodeListResponse, error) + +### Timeseries + +Response Types: + +- cloudflare.RadarAs112TimeseryListResponse + +Methods: + +- client.Radar.As112.Timeseries.List(ctx context.Context, query cloudflare.RadarAs112TimeseryListParams) (cloudflare.RadarAs112TimeseryListResponse, error) + +### Tops + +#### Locations + +Response Types: + +- cloudflare.RadarAs112TopLocationListResponse + +Methods: + +- client.Radar.As112.Tops.Locations.List(ctx context.Context, query cloudflare.RadarAs112TopLocationListParams) (cloudflare.RadarAs112TopLocationListResponse, error) + +##### Dnssecs + +Response Types: + +- cloudflare.RadarAs112TopLocationDnssecGetResponse + +Methods: + +- client.Radar.As112.Tops.Locations.Dnssecs.Get(ctx context.Context, dnssec cloudflare.RadarAs112TopLocationDnssecGetParamsDnssec, query cloudflare.RadarAs112TopLocationDnssecGetParams) (cloudflare.RadarAs112TopLocationDnssecGetResponse, error) + +##### Edns + +Response Types: + +- cloudflare.RadarAs112TopLocationEdnGetResponse + +Methods: + +- client.Radar.As112.Tops.Locations.Edns.Get(ctx context.Context, edns cloudflare.RadarAs112TopLocationEdnGetParamsEdns, query cloudflare.RadarAs112TopLocationEdnGetParams) (cloudflare.RadarAs112TopLocationEdnGetResponse, error) + +##### IPVersions + +Response Types: + +- cloudflare.RadarAs112TopLocationIPVersionGetResponse + +Methods: + +- client.Radar.As112.Tops.Locations.IPVersions.Get(ctx context.Context, ipVersion cloudflare.RadarAs112TopLocationIPVersionGetParamsIPVersion, query cloudflare.RadarAs112TopLocationIPVersionGetParams) (cloudflare.RadarAs112TopLocationIPVersionGetResponse, error) + +### TimeseriesGroups + +#### Dnssec + +Response Types: + +- cloudflare.RadarAs112TimeseriesGroupDnssecGetResponse + +Methods: + +- client.Radar.As112.TimeseriesGroups.Dnssec.Get(ctx context.Context, query cloudflare.RadarAs112TimeseriesGroupDnssecGetParams) (cloudflare.RadarAs112TimeseriesGroupDnssecGetResponse, error) + +#### Edns + +Response Types: + +- cloudflare.RadarAs112TimeseriesGroupEdnGetResponse + +Methods: + +- client.Radar.As112.TimeseriesGroups.Edns.Get(ctx context.Context, query cloudflare.RadarAs112TimeseriesGroupEdnGetParams) (cloudflare.RadarAs112TimeseriesGroupEdnGetResponse, error) + +#### IPVersion + +Response Types: + +- cloudflare.RadarAs112TimeseriesGroupIPVersionGetResponse + +Methods: + +- client.Radar.As112.TimeseriesGroups.IPVersion.Get(ctx context.Context, query cloudflare.RadarAs112TimeseriesGroupIPVersionGetParams) (cloudflare.RadarAs112TimeseriesGroupIPVersionGetResponse, error) + +#### Protocol + +Response Types: + +- cloudflare.RadarAs112TimeseriesGroupProtocolGetResponse + +Methods: + +- client.Radar.As112.TimeseriesGroups.Protocol.Get(ctx context.Context, query cloudflare.RadarAs112TimeseriesGroupProtocolGetParams) (cloudflare.RadarAs112TimeseriesGroupProtocolGetResponse, error) + +#### QueryType + +Response Types: + +- cloudflare.RadarAs112TimeseriesGroupQueryTypeGetResponse + +Methods: + +- client.Radar.As112.TimeseriesGroups.QueryType.Get(ctx context.Context, query cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParams) (cloudflare.RadarAs112TimeseriesGroupQueryTypeGetResponse, error) + +#### ResponseCodes + +Response Types: + +- cloudflare.RadarAs112TimeseriesGroupResponseCodeGetResponse + +Methods: + +- client.Radar.As112.TimeseriesGroups.ResponseCodes.Get(ctx context.Context, query cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParams) (cloudflare.RadarAs112TimeseriesGroupResponseCodeGetResponse, error) + +## Quality + +### Iqi + +#### Summary + +Response Types: + +- cloudflare.RadarQualityIqiSummaryGetResponse + +Methods: + +- client.Radar.Quality.Iqi.Summary.Get(ctx context.Context, query cloudflare.RadarQualityIqiSummaryGetParams) (cloudflare.RadarQualityIqiSummaryGetResponse, error) + +#### TimeseriesGroups + +Response Types: + +- cloudflare.RadarQualityIqiTimeseriesGroupListResponse + +Methods: + +- client.Radar.Quality.Iqi.TimeseriesGroups.List(ctx context.Context, query cloudflare.RadarQualityIqiTimeseriesGroupListParams) (cloudflare.RadarQualityIqiTimeseriesGroupListResponse, error) + +### Speed + +#### Histogram + +Response Types: + +- cloudflare.RadarQualitySpeedHistogramGetResponse + +Methods: + +- client.Radar.Quality.Speed.Histogram.Get(ctx context.Context, query cloudflare.RadarQualitySpeedHistogramGetParams) (cloudflare.RadarQualitySpeedHistogramGetResponse, error) + +#### Summary + +Response Types: + +- cloudflare.RadarQualitySpeedSummaryGetResponse + +Methods: + +- client.Radar.Quality.Speed.Summary.Get(ctx context.Context, query cloudflare.RadarQualitySpeedSummaryGetParams) (cloudflare.RadarQualitySpeedSummaryGetResponse, error) + +#### Top + +##### Ases + +Response Types: + +- cloudflare.RadarQualitySpeedTopAseListResponse + +Methods: + +- client.Radar.Quality.Speed.Top.Ases.List(ctx context.Context, query cloudflare.RadarQualitySpeedTopAseListParams) (cloudflare.RadarQualitySpeedTopAseListResponse, error) + +##### Locations + +Response Types: + +- cloudflare.RadarQualitySpeedTopLocationListResponse + +Methods: + +- client.Radar.Quality.Speed.Top.Locations.List(ctx context.Context, query cloudflare.RadarQualitySpeedTopLocationListParams) (cloudflare.RadarQualitySpeedTopLocationListResponse, error) + +## TrafficAnomalies + +Response Types: + +- cloudflare.RadarTrafficAnomalyListResponse + +Methods: + +- client.Radar.TrafficAnomalies.List(ctx context.Context, query cloudflare.RadarTrafficAnomalyListParams) (cloudflare.RadarTrafficAnomalyListResponse, error) + +### Locations + +Response Types: + +- cloudflare.RadarTrafficAnomalyLocationListResponse + +Methods: + +- client.Radar.TrafficAnomalies.Locations.List(ctx context.Context, query cloudflare.RadarTrafficAnomalyLocationListParams) (cloudflare.RadarTrafficAnomalyLocationListResponse, error) + +## Annotations + +### Outages + +Response Types: + +- cloudflare.RadarAnnotationOutageListResponse + +Methods: + +- client.Radar.Annotations.Outages.List(ctx context.Context, query cloudflare.RadarAnnotationOutageListParams) (cloudflare.RadarAnnotationOutageListResponse, error) + +#### Locations + +Response Types: + +- cloudflare.RadarAnnotationOutageLocationListResponse + +Methods: + +- client.Radar.Annotations.Outages.Locations.List(ctx context.Context, query cloudflare.RadarAnnotationOutageLocationListParams) (cloudflare.RadarAnnotationOutageLocationListResponse, error) + +## Attacks + +### Layer3 + +#### Attacks + +Response Types: + +- cloudflare.RadarAttackLayer3AttackListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Attacks.List(ctx context.Context, query cloudflare.RadarAttackLayer3AttackListParams) (cloudflare.RadarAttackLayer3AttackListResponse, error) + +#### Industries + +Response Types: + +- cloudflare.RadarAttackLayer3IndustryListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Industries.List(ctx context.Context, query cloudflare.RadarAttackLayer3IndustryListParams) (cloudflare.RadarAttackLayer3IndustryListResponse, error) + +#### Locations + +##### Origin + +Response Types: + +- cloudflare.RadarAttackLayer3LocationOriginListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Locations.Origin.List(ctx context.Context, query cloudflare.RadarAttackLayer3LocationOriginListParams) (cloudflare.RadarAttackLayer3LocationOriginListResponse, error) + +##### Target + +Response Types: + +- cloudflare.RadarAttackLayer3LocationTargetListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Locations.Target.List(ctx context.Context, query cloudflare.RadarAttackLayer3LocationTargetListParams) (cloudflare.RadarAttackLayer3LocationTargetListResponse, error) + +#### Verticals + +Response Types: + +- cloudflare.RadarAttackLayer3VerticalListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Verticals.List(ctx context.Context, query cloudflare.RadarAttackLayer3VerticalListParams) (cloudflare.RadarAttackLayer3VerticalListResponse, error) + +#### Summaries + +Response Types: + +- cloudflare.RadarAttackLayer3SummaryListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Summaries.List(ctx context.Context, query cloudflare.RadarAttackLayer3SummaryListParams) (cloudflare.RadarAttackLayer3SummaryListResponse, error) + +##### Bitrate + +Response Types: + +- cloudflare.RadarAttackLayer3SummaryBitrateGetResponse + +Methods: + +- client.Radar.Attacks.Layer3.Summaries.Bitrate.Get(ctx context.Context, query cloudflare.RadarAttackLayer3SummaryBitrateGetParams) (cloudflare.RadarAttackLayer3SummaryBitrateGetResponse, error) + +##### Durations + +Response Types: + +- cloudflare.RadarAttackLayer3SummaryDurationListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Summaries.Durations.List(ctx context.Context, query cloudflare.RadarAttackLayer3SummaryDurationListParams) (cloudflare.RadarAttackLayer3SummaryDurationListResponse, error) + +##### IPVersions + +Response Types: + +- cloudflare.RadarAttackLayer3SummaryIPVersionListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Summaries.IPVersions.List(ctx context.Context, query cloudflare.RadarAttackLayer3SummaryIPVersionListParams) (cloudflare.RadarAttackLayer3SummaryIPVersionListResponse, error) + +##### Protocols + +Response Types: + +- cloudflare.RadarAttackLayer3SummaryProtocolListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Summaries.Protocols.List(ctx context.Context, query cloudflare.RadarAttackLayer3SummaryProtocolListParams) (cloudflare.RadarAttackLayer3SummaryProtocolListResponse, error) + +##### Vectors + +Response Types: + +- cloudflare.RadarAttackLayer3SummaryVectorListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Summaries.Vectors.List(ctx context.Context, query cloudflare.RadarAttackLayer3SummaryVectorListParams) (cloudflare.RadarAttackLayer3SummaryVectorListResponse, error) + +#### Timeseries + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseryListResponse + +Methods: + +- client.Radar.Attacks.Layer3.Timeseries.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseryListParams) (cloudflare.RadarAttackLayer3TimeseryListResponse, error) + +#### TimeseriesGroups + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupListResponse, error) + +##### Bitrates + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.Bitrates.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListResponse, error) + +##### Durations + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupDurationListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.Durations.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupDurationListResponse, error) + +##### Industries + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.Industries.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListResponse, error) + +##### IPVersions + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.IPVersions.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListResponse, error) + +##### Protocols + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.Protocols.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListResponse, error) + +##### Vectors + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupVectorListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.Vectors.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupVectorListResponse, error) + +##### Vertical + +Response Types: + +- cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListResponse + +Methods: + +- client.Radar.Attacks.Layer3.TimeseriesGroups.Vertical.List(ctx context.Context, query cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParams) (cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListResponse, error) + +### Layer7 + +#### Summaries + +Response Types: + +- cloudflare.RadarAttackLayer7SummaryListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Summaries.List(ctx context.Context, query cloudflare.RadarAttackLayer7SummaryListParams) (cloudflare.RadarAttackLayer7SummaryListResponse, error) + +##### HTTPMethod + +Response Types: + +- cloudflare.RadarAttackLayer7SummaryHTTPMethodListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Summaries.HTTPMethod.List(ctx context.Context, query cloudflare.RadarAttackLayer7SummaryHTTPMethodListParams) (cloudflare.RadarAttackLayer7SummaryHTTPMethodListResponse, error) + +##### HTTPVersion + +Response Types: + +- cloudflare.RadarAttackLayer7SummaryHTTPVersionListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Summaries.HTTPVersion.List(ctx context.Context, query cloudflare.RadarAttackLayer7SummaryHTTPVersionListParams) (cloudflare.RadarAttackLayer7SummaryHTTPVersionListResponse, error) + +##### IPVersion + +Response Types: + +- cloudflare.RadarAttackLayer7SummaryIPVersionListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Summaries.IPVersion.List(ctx context.Context, query cloudflare.RadarAttackLayer7SummaryIPVersionListParams) (cloudflare.RadarAttackLayer7SummaryIPVersionListResponse, error) + +##### ManagedRules + +Response Types: + +- cloudflare.RadarAttackLayer7SummaryManagedRuleListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Summaries.ManagedRules.List(ctx context.Context, query cloudflare.RadarAttackLayer7SummaryManagedRuleListParams) (cloudflare.RadarAttackLayer7SummaryManagedRuleListResponse, error) + +#### MitigationProducts + +Response Types: + +- cloudflare.RadarAttackLayer7MitigationProductListResponse +- cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsResponse + +Methods: + +- client.Radar.Attacks.Layer7.MitigationProducts.List(ctx context.Context, query cloudflare.RadarAttackLayer7MitigationProductListParams) (cloudflare.RadarAttackLayer7MitigationProductListResponse, error) +- client.Radar.Attacks.Layer7.MitigationProducts.ListTimeseriesGroups(ctx context.Context, query cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParams) (cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsResponse, error) + +#### HTTPMethods + +Response Types: + +- cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponse + +Methods: + +- client.Radar.Attacks.Layer7.HTTPMethods.ListTimeseriesGroups(ctx context.Context, query cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParams) (cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponse, error) + +#### HTTPVersions + +Response Types: + +- cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponse + +Methods: + +- client.Radar.Attacks.Layer7.HTTPVersions.ListTimeseriesGroups(ctx context.Context, query cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParams) (cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponse, error) + +#### Industries + +Response Types: + +- cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsResponse +- cloudflare.RadarAttackLayer7IndustryListTopsResponse + +Methods: + +- client.Radar.Attacks.Layer7.Industries.ListTimeseriesGroups(ctx context.Context, query cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParams) (cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsResponse, error) +- client.Radar.Attacks.Layer7.Industries.ListTops(ctx context.Context, query cloudflare.RadarAttackLayer7IndustryListTopsParams) (cloudflare.RadarAttackLayer7IndustryListTopsResponse, error) + +#### IPVersions + +Response Types: + +- cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsResponse + +Methods: + +- client.Radar.Attacks.Layer7.IPVersions.ListTimeseriesGroups(ctx context.Context, query cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParams) (cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsResponse, error) + +#### ManagedRules + +Response Types: + +- cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponse + +Methods: + +- client.Radar.Attacks.Layer7.ManagedRules.ListTimeseriesGroups(ctx context.Context, query cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParams) (cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponse, error) + +#### Verticals + +Response Types: + +- cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsResponse +- cloudflare.RadarAttackLayer7VerticalListTopsResponse + +Methods: + +- client.Radar.Attacks.Layer7.Verticals.ListTimeseriesGroups(ctx context.Context, query cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParams) (cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsResponse, error) +- client.Radar.Attacks.Layer7.Verticals.ListTops(ctx context.Context, query cloudflare.RadarAttackLayer7VerticalListTopsParams) (cloudflare.RadarAttackLayer7VerticalListTopsResponse, error) + +#### Timeseries + +Response Types: + +- cloudflare.RadarAttackLayer7TimeseryListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Timeseries.List(ctx context.Context, query cloudflare.RadarAttackLayer7TimeseryListParams) (cloudflare.RadarAttackLayer7TimeseryListResponse, error) + +#### TimeseriesGroups + +Response Types: + +- cloudflare.RadarAttackLayer7TimeseriesGroupListResponse + +Methods: + +- client.Radar.Attacks.Layer7.TimeseriesGroups.List(ctx context.Context, query cloudflare.RadarAttackLayer7TimeseriesGroupListParams) (cloudflare.RadarAttackLayer7TimeseriesGroupListResponse, error) + +#### Tops + +##### Ases + +###### Origins + +Response Types: + +- cloudflare.RadarAttackLayer7TopAseOriginListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Tops.Ases.Origins.List(ctx context.Context, query cloudflare.RadarAttackLayer7TopAseOriginListParams) (cloudflare.RadarAttackLayer7TopAseOriginListResponse, error) + +##### Attacks + +Response Types: + +- cloudflare.RadarAttackLayer7TopAttackListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Tops.Attacks.List(ctx context.Context, query cloudflare.RadarAttackLayer7TopAttackListParams) (cloudflare.RadarAttackLayer7TopAttackListResponse, error) + +##### Locations + +###### Origins + +Response Types: + +- cloudflare.RadarAttackLayer7TopLocationOriginListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Tops.Locations.Origins.List(ctx context.Context, query cloudflare.RadarAttackLayer7TopLocationOriginListParams) (cloudflare.RadarAttackLayer7TopLocationOriginListResponse, error) + +###### Targets + +Response Types: + +- cloudflare.RadarAttackLayer7TopLocationTargetListResponse + +Methods: + +- client.Radar.Attacks.Layer7.Tops.Locations.Targets.List(ctx context.Context, query cloudflare.RadarAttackLayer7TopLocationTargetListParams) (cloudflare.RadarAttackLayer7TopLocationTargetListResponse, error) + +## Bgps + +### Leaks + +#### Events + +Response Types: + +- cloudflare.RadarBgpLeakEventListResponse + +Methods: + +- client.Radar.Bgps.Leaks.Events.List(ctx context.Context, query cloudflare.RadarBgpLeakEventListParams) (cloudflare.RadarBgpLeakEventListResponse, error) + +### Timeseries + +Response Types: + +- cloudflare.RadarBgpTimeseryListResponse + +Methods: + +- client.Radar.Bgps.Timeseries.List(ctx context.Context, query cloudflare.RadarBgpTimeseryListParams) (cloudflare.RadarBgpTimeseryListResponse, error) + +### Tops + +#### Ases + +Response Types: + +- cloudflare.RadarBgpTopAseListResponse + +Methods: + +- client.Radar.Bgps.Tops.Ases.List(ctx context.Context, query cloudflare.RadarBgpTopAseListParams) (cloudflare.RadarBgpTopAseListResponse, error) + +##### Prefixes + +Response Types: + +- cloudflare.RadarBgpTopAsePrefixListResponse + +Methods: + +- client.Radar.Bgps.Tops.Ases.Prefixes.List(ctx context.Context, query cloudflare.RadarBgpTopAsePrefixListParams) (cloudflare.RadarBgpTopAsePrefixListResponse, error) + +#### Prefixes + +Response Types: + +- cloudflare.RadarBgpTopPrefixListResponse + +Methods: + +- client.Radar.Bgps.Tops.Prefixes.List(ctx context.Context, query cloudflare.RadarBgpTopPrefixListParams) (cloudflare.RadarBgpTopPrefixListResponse, error) + +### HijacksEvents + +Response Types: + +- cloudflare.RadarBgpHijacksEventListResponse + +Methods: + +- client.Radar.Bgps.HijacksEvents.List(ctx context.Context, query cloudflare.RadarBgpHijacksEventListParams) (cloudflare.RadarBgpHijacksEventListResponse, error) + +### Routes + +#### Moas + +Response Types: + +- cloudflare.RadarBgpRouteMoaListResponse + +Methods: + +- client.Radar.Bgps.Routes.Moas.List(ctx context.Context, query cloudflare.RadarBgpRouteMoaListParams) (cloudflare.RadarBgpRouteMoaListResponse, error) + +#### Pfx2as + +Response Types: + +- cloudflare.RadarBgpRoutePfx2aListResponse + +Methods: + +- client.Radar.Bgps.Routes.Pfx2as.List(ctx context.Context, query cloudflare.RadarBgpRoutePfx2aListParams) (cloudflare.RadarBgpRoutePfx2aListResponse, error) + +#### Stats + +Response Types: + +- cloudflare.RadarBgpRouteStatListResponse + +Methods: + +- client.Radar.Bgps.Routes.Stats.List(ctx context.Context, query cloudflare.RadarBgpRouteStatListParams) (cloudflare.RadarBgpRouteStatListResponse, error) + +## Datasets + +Response Types: + +- cloudflare.RadarDatasetListResponse + +Methods: + +- client.Radar.Datasets.Get(ctx context.Context, alias string, query cloudflare.RadarDatasetGetParams) (string, error) +- client.Radar.Datasets.List(ctx context.Context, query cloudflare.RadarDatasetListParams) (cloudflare.RadarDatasetListResponse, error) + +### Downloads + +Response Types: + +- cloudflare.RadarDatasetDownloadRadarPostDatasetDownloadResponse + +Methods: + +- client.Radar.Datasets.Downloads.RadarPostDatasetDownload(ctx context.Context, params cloudflare.RadarDatasetDownloadRadarPostDatasetDownloadParams) (cloudflare.RadarDatasetDownloadRadarPostDatasetDownloadResponse, error) + +## DNS + +### Tops + +#### Ases + +Response Types: + +- cloudflare.RadarDNSTopAseListResponse + +Methods: + +- client.Radar.DNS.Tops.Ases.List(ctx context.Context, query cloudflare.RadarDNSTopAseListParams) (cloudflare.RadarDNSTopAseListResponse, error) + +#### Locations + +Response Types: + +- cloudflare.RadarDNSTopLocationListResponse + +Methods: + +- client.Radar.DNS.Tops.Locations.List(ctx context.Context, query cloudflare.RadarDNSTopLocationListParams) (cloudflare.RadarDNSTopLocationListResponse, error) + +## Email + +### Security + +#### ArcSummary + +Response Types: + +- cloudflare.RadarEmailSecurityArcSummaryListResponse + +Methods: + +- client.Radar.Email.Security.ArcSummary.List(ctx context.Context, query cloudflare.RadarEmailSecurityArcSummaryListParams) (cloudflare.RadarEmailSecurityArcSummaryListResponse, error) + +#### DkimSummary + +Response Types: + +- cloudflare.RadarEmailSecurityDkimSummaryListResponse + +Methods: + +- client.Radar.Email.Security.DkimSummary.List(ctx context.Context, query cloudflare.RadarEmailSecurityDkimSummaryListParams) (cloudflare.RadarEmailSecurityDkimSummaryListResponse, error) + +#### DmarcSummary + +Response Types: + +- cloudflare.RadarEmailSecurityDmarcSummaryListResponse + +Methods: + +- client.Radar.Email.Security.DmarcSummary.List(ctx context.Context, query cloudflare.RadarEmailSecurityDmarcSummaryListParams) (cloudflare.RadarEmailSecurityDmarcSummaryListResponse, error) + +#### MaliciousSummary + +Response Types: + +- cloudflare.RadarEmailSecurityMaliciousSummaryListResponse + +Methods: + +- client.Radar.Email.Security.MaliciousSummary.List(ctx context.Context, query cloudflare.RadarEmailSecurityMaliciousSummaryListParams) (cloudflare.RadarEmailSecurityMaliciousSummaryListResponse, error) + +#### SpamSummary + +Response Types: + +- cloudflare.RadarEmailSecuritySpamSummaryListResponse + +Methods: + +- client.Radar.Email.Security.SpamSummary.List(ctx context.Context, query cloudflare.RadarEmailSecuritySpamSummaryListParams) (cloudflare.RadarEmailSecuritySpamSummaryListResponse, error) + +#### SpfSummary + +Response Types: + +- cloudflare.RadarEmailSecuritySpfSummaryListResponse + +Methods: + +- client.Radar.Email.Security.SpfSummary.List(ctx context.Context, query cloudflare.RadarEmailSecuritySpfSummaryListParams) (cloudflare.RadarEmailSecuritySpfSummaryListResponse, error) + +#### ThreatCategorySummary + +Response Types: + +- cloudflare.RadarEmailSecurityThreatCategorySummaryListResponse + +Methods: + +- client.Radar.Email.Security.ThreatCategorySummary.List(ctx context.Context, query cloudflare.RadarEmailSecurityThreatCategorySummaryListParams) (cloudflare.RadarEmailSecurityThreatCategorySummaryListResponse, error) + +#### ArcTimeseries + +Response Types: + +- cloudflare.RadarEmailSecurityArcTimeseryListResponse + +Methods: + +- client.Radar.Email.Security.ArcTimeseries.List(ctx context.Context, query cloudflare.RadarEmailSecurityArcTimeseryListParams) (cloudflare.RadarEmailSecurityArcTimeseryListResponse, error) + +#### DkimTimeseries + +Response Types: + +- cloudflare.RadarEmailSecurityDkimTimeseryListResponse + +Methods: + +- client.Radar.Email.Security.DkimTimeseries.List(ctx context.Context, query cloudflare.RadarEmailSecurityDkimTimeseryListParams) (cloudflare.RadarEmailSecurityDkimTimeseryListResponse, error) + +#### DmarcTimeseries + +Response Types: + +- cloudflare.RadarEmailSecurityDmarcTimeseryListResponse + +Methods: + +- client.Radar.Email.Security.DmarcTimeseries.List(ctx context.Context, query cloudflare.RadarEmailSecurityDmarcTimeseryListParams) (cloudflare.RadarEmailSecurityDmarcTimeseryListResponse, error) + +#### MaliciousTimeseries + +Response Types: + +- cloudflare.RadarEmailSecurityMaliciousTimeseryListResponse + +Methods: + +- client.Radar.Email.Security.MaliciousTimeseries.List(ctx context.Context, query cloudflare.RadarEmailSecurityMaliciousTimeseryListParams) (cloudflare.RadarEmailSecurityMaliciousTimeseryListResponse, error) + +#### SpamTimeseries + +Response Types: + +- cloudflare.RadarEmailSecuritySpamTimeseryListResponse + +Methods: + +- client.Radar.Email.Security.SpamTimeseries.List(ctx context.Context, query cloudflare.RadarEmailSecuritySpamTimeseryListParams) (cloudflare.RadarEmailSecuritySpamTimeseryListResponse, error) + +#### SpfTimeseries + +Response Types: + +- cloudflare.RadarEmailSecuritySpfTimeseryListResponse + +Methods: + +- client.Radar.Email.Security.SpfTimeseries.List(ctx context.Context, query cloudflare.RadarEmailSecuritySpfTimeseryListParams) (cloudflare.RadarEmailSecuritySpfTimeseryListResponse, error) + +#### TmeseriesGroups + +##### ThreatCategories + +Response Types: + +- cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListResponse + +Methods: + +- client.Radar.Email.Security.TmeseriesGroups.ThreatCategories.List(ctx context.Context, query cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParams) (cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListResponse, error) + +#### Top + +##### Ases + +Response Types: + +- cloudflare.RadarEmailSecurityTopAseListResponse + +Methods: + +- client.Radar.Email.Security.Top.Ases.List(ctx context.Context, query cloudflare.RadarEmailSecurityTopAseListParams) (cloudflare.RadarEmailSecurityTopAseListResponse, error) + +###### Arc + +Response Types: + +- cloudflare.RadarEmailSecurityTopAseArcGetResponse + +Methods: + +- client.Radar.Email.Security.Top.Ases.Arc.Get(ctx context.Context, arc cloudflare.RadarEmailSecurityTopAseArcGetParamsArc, query cloudflare.RadarEmailSecurityTopAseArcGetParams) (cloudflare.RadarEmailSecurityTopAseArcGetResponse, error) + +###### Dkim + +Response Types: + +- cloudflare.RadarEmailSecurityTopAseDkimGetResponse + +Methods: + +- client.Radar.Email.Security.Top.Ases.Dkim.Get(ctx context.Context, dkim cloudflare.RadarEmailSecurityTopAseDkimGetParamsDkim, query cloudflare.RadarEmailSecurityTopAseDkimGetParams) (cloudflare.RadarEmailSecurityTopAseDkimGetResponse, error) + +###### Dmarc + +Response Types: + +- cloudflare.RadarEmailSecurityTopAseDmarcGetResponse + +Methods: + +- client.Radar.Email.Security.Top.Ases.Dmarc.Get(ctx context.Context, dmarc cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDmarc, query cloudflare.RadarEmailSecurityTopAseDmarcGetParams) (cloudflare.RadarEmailSecurityTopAseDmarcGetResponse, error) + +###### Malicious + +Response Types: + +- cloudflare.RadarEmailSecurityTopAseMaliciousGetResponse + +Methods: + +- client.Radar.Email.Security.Top.Ases.Malicious.Get(ctx context.Context, malicious cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsMalicious, query cloudflare.RadarEmailSecurityTopAseMaliciousGetParams) (cloudflare.RadarEmailSecurityTopAseMaliciousGetResponse, error) + +###### Spam + +Response Types: + +- cloudflare.RadarEmailSecurityTopAseSpamGetResponse + +Methods: + +- client.Radar.Email.Security.Top.Ases.Spam.Get(ctx context.Context, spam cloudflare.RadarEmailSecurityTopAseSpamGetParamsSpam, query cloudflare.RadarEmailSecurityTopAseSpamGetParams) (cloudflare.RadarEmailSecurityTopAseSpamGetResponse, error) + +###### Spf + +Response Types: + +- cloudflare.RadarEmailSecurityTopAseSpfGetResponse + +Methods: + +- client.Radar.Email.Security.Top.Ases.Spf.Get(ctx context.Context, spf cloudflare.RadarEmailSecurityTopAseSpfGetParamsSpf, query cloudflare.RadarEmailSecurityTopAseSpfGetParams) (cloudflare.RadarEmailSecurityTopAseSpfGetResponse, error) + +##### Locations + +Response Types: + +- cloudflare.RadarEmailSecurityTopLocationListResponse + +Methods: + +- client.Radar.Email.Security.Top.Locations.List(ctx context.Context, query cloudflare.RadarEmailSecurityTopLocationListParams) (cloudflare.RadarEmailSecurityTopLocationListResponse, error) + +###### Arc + +Response Types: + +- cloudflare.RadarEmailSecurityTopLocationArcGetResponse + +Methods: + +- client.Radar.Email.Security.Top.Locations.Arc.Get(ctx context.Context, arc cloudflare.RadarEmailSecurityTopLocationArcGetParamsArc, query cloudflare.RadarEmailSecurityTopLocationArcGetParams) (cloudflare.RadarEmailSecurityTopLocationArcGetResponse, error) + +###### ByDkim + +Response Types: + +- cloudflare.RadarEmailSecurityTopLocationByDkimListResponse + +Methods: + +- client.Radar.Email.Security.Top.Locations.ByDkim.List(ctx context.Context, dkim cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDkim, query cloudflare.RadarEmailSecurityTopLocationByDkimListParams) (cloudflare.RadarEmailSecurityTopLocationByDkimListResponse, error) + +###### ByDmarc + +Response Types: + +- cloudflare.RadarEmailSecurityTopLocationByDmarcListResponse + +Methods: + +- client.Radar.Email.Security.Top.Locations.ByDmarc.List(ctx context.Context, dmarc cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDmarc, query cloudflare.RadarEmailSecurityTopLocationByDmarcListParams) (cloudflare.RadarEmailSecurityTopLocationByDmarcListResponse, error) + +###### ByMalicious + +Response Types: + +- cloudflare.RadarEmailSecurityTopLocationByMaliciousListResponse + +Methods: + +- client.Radar.Email.Security.Top.Locations.ByMalicious.List(ctx context.Context, malicious cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsMalicious, query cloudflare.RadarEmailSecurityTopLocationByMaliciousListParams) (cloudflare.RadarEmailSecurityTopLocationByMaliciousListResponse, error) + +###### BySpam + +Response Types: + +- cloudflare.RadarEmailSecurityTopLocationBySpamListResponse + +Methods: + +- client.Radar.Email.Security.Top.Locations.BySpam.List(ctx context.Context, spam cloudflare.RadarEmailSecurityTopLocationBySpamListParamsSpam, query cloudflare.RadarEmailSecurityTopLocationBySpamListParams) (cloudflare.RadarEmailSecurityTopLocationBySpamListResponse, error) + +###### BySpf + +Response Types: + +- cloudflare.RadarEmailSecurityTopLocationBySpfListResponse + +Methods: + +- client.Radar.Email.Security.Top.Locations.BySpf.List(ctx context.Context, spf cloudflare.RadarEmailSecurityTopLocationBySpfListParamsSpf, query cloudflare.RadarEmailSecurityTopLocationBySpfListParams) (cloudflare.RadarEmailSecurityTopLocationBySpfListResponse, error) + +## Entities + +### ASNs + +Response Types: + +- cloudflare.RadarEntityASNGetResponse +- cloudflare.RadarEntityASNListResponse + +Methods: + +- client.Radar.Entities.ASNs.Get(ctx context.Context, asn int64, query cloudflare.RadarEntityASNGetParams) (cloudflare.RadarEntityASNGetResponse, error) +- client.Radar.Entities.ASNs.List(ctx context.Context, query cloudflare.RadarEntityASNListParams) (cloudflare.RadarEntityASNListResponse, error) + +#### IPs + +Response Types: + +- cloudflare.RadarEntityAsnipListResponse + +Methods: + +- client.Radar.Entities.ASNs.IPs.List(ctx context.Context, query cloudflare.RadarEntityASNIPListParams) (cloudflare.RadarEntityAsnipListResponse, error) + +#### Relationships + +Response Types: + +- cloudflare.RadarEntityASNRelationshipListResponse + +Methods: + +- client.Radar.Entities.ASNs.Relationships.List(ctx context.Context, asn int64, query cloudflare.RadarEntityASNRelationshipListParams) (cloudflare.RadarEntityASNRelationshipListResponse, error) + +### IPs + +Response Types: + +- cloudflare.RadarEntityIPListResponse + +Methods: + +- client.Radar.Entities.IPs.List(ctx context.Context, query cloudflare.RadarEntityIPListParams) (cloudflare.RadarEntityIPListResponse, error) + +### Locations + +Response Types: + +- cloudflare.RadarEntityLocationGetResponse +- cloudflare.RadarEntityLocationListResponse + +Methods: + +- client.Radar.Entities.Locations.Get(ctx context.Context, location string, query cloudflare.RadarEntityLocationGetParams) (cloudflare.RadarEntityLocationGetResponse, error) +- client.Radar.Entities.Locations.List(ctx context.Context, query cloudflare.RadarEntityLocationListParams) (cloudflare.RadarEntityLocationListResponse, error) + +## HTTP + +### Summaries + +#### BotClasses + +Response Types: + +- cloudflare.RadarHTTPSummaryBotClassListResponse + +Methods: + +- client.Radar.HTTP.Summaries.BotClasses.List(ctx context.Context, query cloudflare.RadarHTTPSummaryBotClassListParams) (cloudflare.RadarHTTPSummaryBotClassListResponse, error) + +#### DeviceTypes + +Response Types: + +- cloudflare.RadarHTTPSummaryDeviceTypeListResponse + +Methods: + +- client.Radar.HTTP.Summaries.DeviceTypes.List(ctx context.Context, query cloudflare.RadarHTTPSummaryDeviceTypeListParams) (cloudflare.RadarHTTPSummaryDeviceTypeListResponse, error) + +#### HTTPProtocols + +Response Types: + +- cloudflare.RadarHTTPSummaryHTTPProtocolListResponse + +Methods: + +- client.Radar.HTTP.Summaries.HTTPProtocols.List(ctx context.Context, query cloudflare.RadarHTTPSummaryHTTPProtocolListParams) (cloudflare.RadarHTTPSummaryHTTPProtocolListResponse, error) + +#### HTTPVersions + +Response Types: + +- cloudflare.RadarHTTPSummaryHTTPVersionListResponse + +Methods: + +- client.Radar.HTTP.Summaries.HTTPVersions.List(ctx context.Context, query cloudflare.RadarHTTPSummaryHTTPVersionListParams) (cloudflare.RadarHTTPSummaryHTTPVersionListResponse, error) + +#### IPVersions + +Response Types: + +- cloudflare.RadarHTTPSummaryIPVersionListResponse + +Methods: + +- client.Radar.HTTP.Summaries.IPVersions.List(ctx context.Context, query cloudflare.RadarHTTPSummaryIPVersionListParams) (cloudflare.RadarHTTPSummaryIPVersionListResponse, error) + +#### Os + +Response Types: + +- cloudflare.RadarHTTPSummaryOListResponse + +Methods: + +- client.Radar.HTTP.Summaries.Os.List(ctx context.Context, query cloudflare.RadarHTTPSummaryOListParams) (cloudflare.RadarHTTPSummaryOListResponse, error) + +#### TlsVersions + +Response Types: + +- cloudflare.RadarHTTPSummaryTlsVersionListResponse + +Methods: + +- client.Radar.HTTP.Summaries.TlsVersions.List(ctx context.Context, query cloudflare.RadarHTTPSummaryTlsVersionListParams) (cloudflare.RadarHTTPSummaryTlsVersionListResponse, error) + +### TimeseriesGroups + +#### ByBotClass + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByBotClassListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByBotClass.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByBotClassListParams) (cloudflare.RadarHTTPTimeseriesGroupByBotClassListResponse, error) + +#### ByBrowser + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByBrowserListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByBrowser.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByBrowserListParams) (cloudflare.RadarHTTPTimeseriesGroupByBrowserListResponse, error) + +#### ByBrowserFamily + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByBrowserFamily.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParams) (cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListResponse, error) + +#### ByDeviceType + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByDeviceType.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParams) (cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListResponse, error) + +#### ByHTTPProtocol + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByHTTPProtocol.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParams) (cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListResponse, error) + +#### ByHTTPVersion + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByHTTPVersion.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParams) (cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListResponse, error) + +#### ByIPVersion + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByIPVersionListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByIPVersion.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParams) (cloudflare.RadarHTTPTimeseriesGroupByIPVersionListResponse, error) + +#### ByOs + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByOListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByOs.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByOListParams) (cloudflare.RadarHTTPTimeseriesGroupByOListResponse, error) + +#### ByTlsVersion + +Response Types: + +- cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListResponse + +Methods: + +- client.Radar.HTTP.TimeseriesGroups.ByTlsVersion.List(ctx context.Context, query cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParams) (cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListResponse, error) + +### Tops + +#### Ases + +Response Types: + +- cloudflare.RadarHTTPTopAseListResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.List(ctx context.Context, query cloudflare.RadarHTTPTopAseListParams) (cloudflare.RadarHTTPTopAseListResponse, error) + +##### BotClasses + +Response Types: + +- cloudflare.RadarHTTPTopAseBotClassGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.BotClasses.Get(ctx context.Context, botClass cloudflare.RadarHTTPTopAseBotClassGetParamsBotClass, query cloudflare.RadarHTTPTopAseBotClassGetParams) (cloudflare.RadarHTTPTopAseBotClassGetResponse, error) + +##### DeviceTypes + +Response Types: + +- cloudflare.RadarHTTPTopAseDeviceTypeGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.DeviceTypes.Get(ctx context.Context, deviceType cloudflare.RadarHTTPTopAseDeviceTypeGetParamsDeviceType, query cloudflare.RadarHTTPTopAseDeviceTypeGetParams) (cloudflare.RadarHTTPTopAseDeviceTypeGetResponse, error) + +##### HTTPProtocols + +Response Types: + +- cloudflare.RadarHTTPTopAseHTTPProtocolGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.HTTPProtocols.Get(ctx context.Context, httpProtocol cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocol, query cloudflare.RadarHTTPTopAseHTTPProtocolGetParams) (cloudflare.RadarHTTPTopAseHTTPProtocolGetResponse, error) + +##### HTTPVersions + +Response Types: + +- cloudflare.RadarHTTPTopAseHTTPVersionGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.HTTPVersions.Get(ctx context.Context, httpVersion cloudflare.RadarHTTPTopAseHTTPVersionGetParamsHTTPVersion, query cloudflare.RadarHTTPTopAseHTTPVersionGetParams) (cloudflare.RadarHTTPTopAseHTTPVersionGetResponse, error) + +##### IPVersions + +Response Types: + +- cloudflare.RadarHTTPTopAseIPVersionGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.IPVersions.Get(ctx context.Context, ipVersion cloudflare.RadarHTTPTopAseIPVersionGetParamsIPVersion, query cloudflare.RadarHTTPTopAseIPVersionGetParams) (cloudflare.RadarHTTPTopAseIPVersionGetResponse, error) + +##### Os + +Response Types: + +- cloudflare.RadarHTTPTopAseOGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.Os.Get(ctx context.Context, os cloudflare.RadarHTTPTopAseOGetParamsOs, query cloudflare.RadarHTTPTopAseOGetParams) (cloudflare.RadarHTTPTopAseOGetResponse, error) + +##### TlsVersions + +Response Types: + +- cloudflare.RadarHTTPTopAseTlsVersionGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Ases.TlsVersions.Get(ctx context.Context, tlsVersion cloudflare.RadarHTTPTopAseTlsVersionGetParamsTlsVersion, query cloudflare.RadarHTTPTopAseTlsVersionGetParams) (cloudflare.RadarHTTPTopAseTlsVersionGetResponse, error) + +#### BrowserFamilies + +Response Types: + +- cloudflare.RadarHTTPTopBrowserFamilyListResponse + +Methods: + +- client.Radar.HTTP.Tops.BrowserFamilies.List(ctx context.Context, query cloudflare.RadarHTTPTopBrowserFamilyListParams) (cloudflare.RadarHTTPTopBrowserFamilyListResponse, error) + +#### Browsers + +Response Types: + +- cloudflare.RadarHTTPTopBrowserListResponse + +Methods: + +- client.Radar.HTTP.Tops.Browsers.List(ctx context.Context, query cloudflare.RadarHTTPTopBrowserListParams) (cloudflare.RadarHTTPTopBrowserListResponse, error) + +#### Locations + +Response Types: + +- cloudflare.RadarHTTPTopLocationListResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.List(ctx context.Context, query cloudflare.RadarHTTPTopLocationListParams) (cloudflare.RadarHTTPTopLocationListResponse, error) + +##### BotClasses + +Response Types: + +- cloudflare.RadarHTTPTopLocationBotClassGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.BotClasses.Get(ctx context.Context, botClass cloudflare.RadarHTTPTopLocationBotClassGetParamsBotClass, query cloudflare.RadarHTTPTopLocationBotClassGetParams) (cloudflare.RadarHTTPTopLocationBotClassGetResponse, error) + +##### DeviceTypes + +Response Types: + +- cloudflare.RadarHTTPTopLocationDeviceTypeGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.DeviceTypes.Get(ctx context.Context, deviceType cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsDeviceType, query cloudflare.RadarHTTPTopLocationDeviceTypeGetParams) (cloudflare.RadarHTTPTopLocationDeviceTypeGetResponse, error) + +##### HTTPProtocols + +Response Types: + +- cloudflare.RadarHTTPTopLocationHTTPProtocolGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.HTTPProtocols.Get(ctx context.Context, httpProtocol cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocol, query cloudflare.RadarHTTPTopLocationHTTPProtocolGetParams) (cloudflare.RadarHTTPTopLocationHTTPProtocolGetResponse, error) + +##### HTTPVersions + +Response Types: + +- cloudflare.RadarHTTPTopLocationHTTPVersionGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.HTTPVersions.Get(ctx context.Context, httpVersion cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersion, query cloudflare.RadarHTTPTopLocationHTTPVersionGetParams) (cloudflare.RadarHTTPTopLocationHTTPVersionGetResponse, error) + +##### IPVersions + +Response Types: + +- cloudflare.RadarHTTPTopLocationIPVersionGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.IPVersions.Get(ctx context.Context, ipVersion cloudflare.RadarHTTPTopLocationIPVersionGetParamsIPVersion, query cloudflare.RadarHTTPTopLocationIPVersionGetParams) (cloudflare.RadarHTTPTopLocationIPVersionGetResponse, error) + +##### Os + +Response Types: + +- cloudflare.RadarHTTPTopLocationOGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.Os.Get(ctx context.Context, os cloudflare.RadarHTTPTopLocationOGetParamsOs, query cloudflare.RadarHTTPTopLocationOGetParams) (cloudflare.RadarHTTPTopLocationOGetResponse, error) + +##### TlsVersions + +Response Types: + +- cloudflare.RadarHTTPTopLocationTlsVersionGetResponse + +Methods: + +- client.Radar.HTTP.Tops.Locations.TlsVersions.Get(ctx context.Context, tlsVersion cloudflare.RadarHTTPTopLocationTlsVersionGetParamsTlsVersion, query cloudflare.RadarHTTPTopLocationTlsVersionGetParams) (cloudflare.RadarHTTPTopLocationTlsVersionGetResponse, error) + +## Netflows + +### Timeseries + +Response Types: + +- cloudflare.RadarNetflowTimeseryListResponse + +Methods: + +- client.Radar.Netflows.Timeseries.List(ctx context.Context, query cloudflare.RadarNetflowTimeseryListParams) (cloudflare.RadarNetflowTimeseryListResponse, error) + +### Tops + +#### Ases + +Response Types: + +- cloudflare.RadarNetflowTopAseListResponse + +Methods: + +- client.Radar.Netflows.Tops.Ases.List(ctx context.Context, query cloudflare.RadarNetflowTopAseListParams) (cloudflare.RadarNetflowTopAseListResponse, error) + +#### Locations + +Response Types: + +- cloudflare.RadarNetflowTopLocationListResponse + +Methods: + +- client.Radar.Netflows.Tops.Locations.List(ctx context.Context, query cloudflare.RadarNetflowTopLocationListParams) (cloudflare.RadarNetflowTopLocationListResponse, error) + +## Ranking + +### Domains + +Response Types: + +- cloudflare.RadarRankingDomainGetResponse + +Methods: + +- client.Radar.Ranking.Domains.Get(ctx context.Context, domain string, query cloudflare.RadarRankingDomainGetParams) (cloudflare.RadarRankingDomainGetResponse, error) + +### TimeseriesGroups + +Response Types: + +- cloudflare.RadarRankingTimeseriesGroupListResponse + +Methods: + +- client.Radar.Ranking.TimeseriesGroups.List(ctx context.Context, query cloudflare.RadarRankingTimeseriesGroupListParams) (cloudflare.RadarRankingTimeseriesGroupListResponse, error) + +### Tops + +Response Types: + +- cloudflare.RadarRankingTopListResponse + +Methods: + +- client.Radar.Ranking.Tops.List(ctx context.Context, query cloudflare.RadarRankingTopListParams) (cloudflare.RadarRankingTopListResponse, error) + +## Searches + +### Globals + +Response Types: + +- cloudflare.RadarSearchGlobalListResponse + +Methods: + +- client.Radar.Searches.Globals.List(ctx context.Context, query cloudflare.RadarSearchGlobalListParams) (cloudflare.RadarSearchGlobalListResponse, error) + +## VerifiedBots + +### Tops + +#### Bots + +Response Types: + +- cloudflare.RadarVerifiedBotTopBotListResponse + +Methods: + +- client.Radar.VerifiedBots.Tops.Bots.List(ctx context.Context, query cloudflare.RadarVerifiedBotTopBotListParams) (cloudflare.RadarVerifiedBotTopBotListResponse, error) + +#### Categories + +Response Types: + +- cloudflare.RadarVerifiedBotTopCategoryListResponse + +Methods: + +- client.Radar.VerifiedBots.Tops.Categories.List(ctx context.Context, query cloudflare.RadarVerifiedBotTopCategoryListParams) (cloudflare.RadarVerifiedBotTopCategoryListResponse, error) + +## ConnectionTamperings + +### Summary + +Response Types: + +- cloudflare.RadarConnectionTamperingSummaryListResponse + +Methods: + +- client.Radar.ConnectionTamperings.Summary.List(ctx context.Context, query cloudflare.RadarConnectionTamperingSummaryListParams) (cloudflare.RadarConnectionTamperingSummaryListResponse, error) + +### TimeseriesGroups + +Response Types: + +- cloudflare.RadarConnectionTamperingTimeseriesGroupListResponse + +Methods: + +- client.Radar.ConnectionTamperings.TimeseriesGroups.List(ctx context.Context, query cloudflare.RadarConnectionTamperingTimeseriesGroupListParams) (cloudflare.RadarConnectionTamperingTimeseriesGroupListResponse, error) + +# Railguns + +Response Types: + +- cloudflare.RailgunGetResponse +- cloudflare.RailgunUpdateResponse +- cloudflare.RailgunDeleteResponse +- cloudflare.RailgunRailgunNewRailgunResponse +- cloudflare.RailgunRailgunListRailgunsResponse + +Methods: + +- client.Railguns.Get(ctx context.Context, identifier string) (cloudflare.RailgunGetResponse, error) +- client.Railguns.Update(ctx context.Context, identifier string, body cloudflare.RailgunUpdateParams) (cloudflare.RailgunUpdateResponse, error) +- client.Railguns.Delete(ctx context.Context, identifier string) (cloudflare.RailgunDeleteResponse, error) +- client.Railguns.RailgunNewRailgun(ctx context.Context, body cloudflare.RailgunRailgunNewRailgunParams) (cloudflare.RailgunRailgunNewRailgunResponse, error) +- client.Railguns.RailgunListRailguns(ctx context.Context, query cloudflare.RailgunRailgunListRailgunsParams) (cloudflare.RailgunRailgunListRailgunsResponse, error) + +## Zones + +Response Types: + +- cloudflare.RailgunZoneListResponse + +Methods: + +- client.Railguns.Zones.List(ctx context.Context, identifier string) (cloudflare.RailgunZoneListResponse, error) + +# User + +Response Types: + +- cloudflare.UserUserEditUserResponse +- cloudflare.UserUserUserDetailsResponse + +Methods: + +- client.User.UserEditUser(ctx context.Context, body cloudflare.UserUserEditUserParams) (cloudflare.UserUserEditUserResponse, error) +- client.User.UserUserDetails(ctx context.Context) (cloudflare.UserUserUserDetailsResponse, error) + +## Billings + +### Histories + +Response Types: + +- cloudflare.UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponse + +Methods: + +- client.User.Billings.Histories.UserBillingHistoryBillingHistoryDetails(ctx context.Context, query cloudflare.UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParams) (cloudflare.UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponse, error) + +### Profiles + +Response Types: + +- cloudflare.UserBillingProfileUserBillingProfileBillingProfileDetailsResponse + +Methods: + +- client.User.Billings.Profiles.UserBillingProfileBillingProfileDetails(ctx context.Context) (cloudflare.UserBillingProfileUserBillingProfileBillingProfileDetailsResponse, error) + +## Firewalls + +### AccessRules + +#### Rules + +Response Types: + +- cloudflare.UserFirewallAccessRuleRuleUpdateResponse +- cloudflare.UserFirewallAccessRuleRuleDeleteResponse +- cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponse +- cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponse + +Methods: + +- client.User.Firewalls.AccessRules.Rules.Update(ctx context.Context, identifier string, body cloudflare.UserFirewallAccessRuleRuleUpdateParams) (cloudflare.UserFirewallAccessRuleRuleUpdateResponse, error) +- client.User.Firewalls.AccessRules.Rules.Delete(ctx context.Context, identifier string) (cloudflare.UserFirewallAccessRuleRuleDeleteResponse, error) +- client.User.Firewalls.AccessRules.Rules.IPAccessRulesForAUserNewAnIPAccessRule(ctx context.Context, body cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParams) (cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponse, error) +- client.User.Firewalls.AccessRules.Rules.IPAccessRulesForAUserListIPAccessRules(ctx context.Context, query cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParams) (cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponse, error) + +## Invites + +Response Types: + +- cloudflare.UserInviteGetResponse +- cloudflare.UserInviteUpdateResponse +- cloudflare.UserInviteUserSInvitesListInvitationsResponse + +Methods: + +- client.User.Invites.Get(ctx context.Context, identifier string) (cloudflare.UserInviteGetResponse, error) +- client.User.Invites.Update(ctx context.Context, identifier string, body cloudflare.UserInviteUpdateParams) (cloudflare.UserInviteUpdateResponse, error) +- client.User.Invites.UserSInvitesListInvitations(ctx context.Context) (cloudflare.UserInviteUserSInvitesListInvitationsResponse, error) + +## LoadBalancers + +### Monitors + +Response Types: + +- cloudflare.UserLoadBalancerMonitorDeleteResponse +- cloudflare.UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponse + +Methods: + +- client.User.LoadBalancers.Monitors.Get(ctx context.Context, identifier string) (cloudflare.Monitor, error) +- client.User.LoadBalancers.Monitors.Update(ctx context.Context, identifier string, body cloudflare.UserLoadBalancerMonitorUpdateParams) (cloudflare.Monitor, error) +- client.User.LoadBalancers.Monitors.Delete(ctx context.Context, identifier string) (cloudflare.UserLoadBalancerMonitorDeleteResponse, error) +- client.User.LoadBalancers.Monitors.LoadBalancerMonitorsNewMonitor(ctx context.Context, body cloudflare.UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParams) (cloudflare.Monitor, error) +- client.User.LoadBalancers.Monitors.LoadBalancerMonitorsListMonitors(ctx context.Context) (cloudflare.UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponse, error) +- client.User.LoadBalancers.Monitors.Patch(ctx context.Context, identifier string, body cloudflare.UserLoadBalancerMonitorPatchParams) (cloudflare.Monitor, error) + +#### Previews + +Response Types: + +- cloudflare.UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponse + +Methods: + +- client.User.LoadBalancers.Monitors.Previews.LoadBalancerMonitorsPreviewMonitor(ctx context.Context, identifier string, body cloudflare.UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParams) (cloudflare.UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponse, error) + +#### References + +Response Types: + +- cloudflare.UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponse + +Methods: + +- client.User.LoadBalancers.Monitors.References.LoadBalancerMonitorsListMonitorReferences(ctx context.Context, identifier string) (cloudflare.UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponse, error) + +### Pools + +Response Types: + +- cloudflare.UserLoadBalancerPoolDeleteResponse +- cloudflare.UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponse +- cloudflare.UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponse + +Methods: + +- client.User.LoadBalancers.Pools.Get(ctx context.Context, identifier string) (cloudflare.Pool, error) +- client.User.LoadBalancers.Pools.Update(ctx context.Context, identifier string, body cloudflare.UserLoadBalancerPoolUpdateParams) (cloudflare.Pool, error) +- client.User.LoadBalancers.Pools.Delete(ctx context.Context, identifier string) (cloudflare.UserLoadBalancerPoolDeleteResponse, error) +- client.User.LoadBalancers.Pools.LoadBalancerPoolsNewPool(ctx context.Context, body cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParams) (cloudflare.Pool, error) +- client.User.LoadBalancers.Pools.LoadBalancerPoolsListPools(ctx context.Context, query cloudflare.UserLoadBalancerPoolLoadBalancerPoolsListPoolsParams) (cloudflare.UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponse, error) +- client.User.LoadBalancers.Pools.LoadBalancerPoolsPatchPools(ctx context.Context, body cloudflare.UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParams) (cloudflare.UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponse, error) +- client.User.LoadBalancers.Pools.Patch(ctx context.Context, identifier string, body cloudflare.UserLoadBalancerPoolPatchParams) (cloudflare.Pool, error) + +#### Health + +Response Types: + +- cloudflare.UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponse + +Methods: + +- client.User.LoadBalancers.Pools.Health.LoadBalancerPoolsPoolHealthDetails(ctx context.Context, identifier string) (cloudflare.UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponse, error) + +#### Previews + +Response Types: + +- cloudflare.UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponse + +Methods: + +- client.User.LoadBalancers.Pools.Previews.LoadBalancerPoolsPreviewPool(ctx context.Context, identifier string, body cloudflare.UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParams) (cloudflare.UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponse, error) + +#### References + +Response Types: + +- cloudflare.UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponse + +Methods: + +- client.User.LoadBalancers.Pools.References.LoadBalancerPoolsListPoolReferences(ctx context.Context, identifier string) (cloudflare.UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponse, error) + +### Previews + +Response Types: + +- cloudflare.UserLoadBalancerPreviewGetResponse + +Methods: + +- client.User.LoadBalancers.Previews.Get(ctx context.Context, previewID interface{}) (cloudflare.UserLoadBalancerPreviewGetResponse, error) + +## LoadBalancingAnalytics + +### Events + +Response Types: + +- cloudflare.UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponse + +Methods: + +- client.User.LoadBalancingAnalytics.Events.LoadBalancerHealthcheckEventsListHealthcheckEvents(ctx context.Context, query cloudflare.UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsParams) (cloudflare.UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponse, error) + +## Organizations + +Response Types: + +- cloudflare.UserOrganizationGetResponse +- cloudflare.UserOrganizationDeleteResponse +- cloudflare.UserOrganizationUserSOrganizationsListOrganizationsResponse + +Methods: + +- client.User.Organizations.Get(ctx context.Context, identifier string) (cloudflare.UserOrganizationGetResponse, error) +- client.User.Organizations.Delete(ctx context.Context, identifier string) (cloudflare.UserOrganizationDeleteResponse, error) +- client.User.Organizations.UserSOrganizationsListOrganizations(ctx context.Context, query cloudflare.UserOrganizationUserSOrganizationsListOrganizationsParams) (cloudflare.UserOrganizationUserSOrganizationsListOrganizationsResponse, error) + +## Subscriptions + +Response Types: + +- cloudflare.UserSubscriptionUpdateResponse +- cloudflare.UserSubscriptionDeleteResponse +- cloudflare.UserSubscriptionUserSubscriptionGetUserSubscriptionsResponse + +Methods: + +- client.User.Subscriptions.Update(ctx context.Context, identifier string, body cloudflare.UserSubscriptionUpdateParams) (cloudflare.UserSubscriptionUpdateResponse, error) +- client.User.Subscriptions.Delete(ctx context.Context, identifier string) (cloudflare.UserSubscriptionDeleteResponse, error) +- client.User.Subscriptions.UserSubscriptionGetUserSubscriptions(ctx context.Context) (cloudflare.UserSubscriptionUserSubscriptionGetUserSubscriptionsResponse, error) + +## Tokens + +Response Types: + +- cloudflare.UserTokenGetResponse +- cloudflare.UserTokenUpdateResponse +- cloudflare.UserTokenDeleteResponse +- cloudflare.UserTokenUserAPITokensNewTokenResponse +- cloudflare.UserTokenUserAPITokensListTokensResponse + +Methods: + +- client.User.Tokens.Get(ctx context.Context, identifier interface{}) (cloudflare.UserTokenGetResponse, error) +- client.User.Tokens.Update(ctx context.Context, identifier interface{}, body cloudflare.UserTokenUpdateParams) (cloudflare.UserTokenUpdateResponse, error) +- client.User.Tokens.Delete(ctx context.Context, identifier interface{}) (cloudflare.UserTokenDeleteResponse, error) +- client.User.Tokens.UserAPITokensNewToken(ctx context.Context, body cloudflare.UserTokenUserAPITokensNewTokenParams) (cloudflare.UserTokenUserAPITokensNewTokenResponse, error) +- client.User.Tokens.UserAPITokensListTokens(ctx context.Context, query cloudflare.UserTokenUserAPITokensListTokensParams) (cloudflare.UserTokenUserAPITokensListTokensResponse, error) + +### PermissionGroups + +Response Types: + +- cloudflare.UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponse + +Methods: + +- client.User.Tokens.PermissionGroups.PermissionGroupsListPermissionGroups(ctx context.Context) (cloudflare.UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponse, error) + +### Verifies + +Response Types: + +- cloudflare.UserTokenVerifyUserAPITokensVerifyTokenResponse + +Methods: + +- client.User.Tokens.Verifies.UserAPITokensVerifyToken(ctx context.Context) (cloudflare.UserTokenVerifyUserAPITokensVerifyTokenResponse, error) + +### Values + +Response Types: + +- cloudflare.UserTokenValueUserAPITokensRollTokenResponse + +Methods: + +- client.User.Tokens.Values.UserAPITokensRollToken(ctx context.Context, identifier interface{}, body cloudflare.UserTokenValueUserAPITokensRollTokenParams) (cloudflare.UserTokenValueUserAPITokensRollTokenResponse, error) + # Zones -Params Types: +Response Types: + +- cloudflare.ZoneNewResponse +- cloudflare.ZoneGetResponse +- cloudflare.ZoneUpdateResponse +- cloudflare.ZoneListResponse +- cloudflare.ZoneDeleteResponse + +Methods: + +- client.Zones.New(ctx context.Context, body cloudflare.ZoneNewParams) (cloudflare.ZoneNewResponse, error) +- client.Zones.Get(ctx context.Context, identifier string) (cloudflare.ZoneGetResponse, error) +- client.Zones.Update(ctx context.Context, identifier string, body cloudflare.ZoneUpdateParams) (cloudflare.ZoneUpdateResponse, error) +- client.Zones.List(ctx context.Context, query cloudflare.ZoneListParams) (cloudflare.ZoneListResponse, error) +- client.Zones.Delete(ctx context.Context, identifier string) (cloudflare.ZoneDeleteResponse, error) + +## LoadBalancers + +Response Types: + +- cloudflare.LoadBalancer +- cloudflare.ZoneLoadBalancerListResponse +- cloudflare.ZoneLoadBalancerDeleteResponse + +Methods: + +- client.Zones.LoadBalancers.New(ctx context.Context, identifier string, body cloudflare.ZoneLoadBalancerNewParams) (cloudflare.LoadBalancer, error) +- client.Zones.LoadBalancers.Get(ctx context.Context, identifier1 string, identifier string) (cloudflare.LoadBalancer, error) +- client.Zones.LoadBalancers.Update(ctx context.Context, identifier1 string, identifier string, body cloudflare.ZoneLoadBalancerUpdateParams) (cloudflare.LoadBalancer, error) +- client.Zones.LoadBalancers.List(ctx context.Context, identifier string) (cloudflare.ZoneLoadBalancerListResponse, error) +- client.Zones.LoadBalancers.Delete(ctx context.Context, identifier1 string, identifier string) (cloudflare.ZoneLoadBalancerDeleteResponse, error) +- client.Zones.LoadBalancers.Patch(ctx context.Context, identifier1 string, identifier string, body cloudflare.ZoneLoadBalancerPatchParams) (cloudflare.LoadBalancer, error) + +## Accesses + +### Certificates + +Response Types: + +- cloudflare.ZoneAccessCertificateGetResponse +- cloudflare.ZoneAccessCertificateUpdateResponse +- cloudflare.ZoneAccessCertificateListResponse +- cloudflare.ZoneAccessCertificateDeleteResponse +- cloudflare.ZoneAccessCertificateAddResponse + +Methods: + +- client.Zones.Accesses.Certificates.Get(ctx context.Context, identifier string, uuid string) (cloudflare.ZoneAccessCertificateGetResponse, error) +- client.Zones.Accesses.Certificates.Update(ctx context.Context, identifier string, uuid string, body cloudflare.ZoneAccessCertificateUpdateParams) (cloudflare.ZoneAccessCertificateUpdateResponse, error) +- client.Zones.Accesses.Certificates.List(ctx context.Context, identifier string) (cloudflare.ZoneAccessCertificateListResponse, error) +- client.Zones.Accesses.Certificates.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.ZoneAccessCertificateDeleteResponse, error) +- client.Zones.Accesses.Certificates.Add(ctx context.Context, identifier string, body cloudflare.ZoneAccessCertificateAddParams) (cloudflare.ZoneAccessCertificateAddResponse, error) + +#### Settings + +Response Types: + +- cloudflare.ZoneAccessCertificateSettingListResponse + +Methods: + +- client.Zones.Accesses.Certificates.Settings.List(ctx context.Context, identifier string) (cloudflare.ZoneAccessCertificateSettingListResponse, error) + +### Groups + +Response Types: + +- cloudflare.ZoneAccessGroupNewResponse +- cloudflare.ZoneAccessGroupGetResponse +- cloudflare.ZoneAccessGroupUpdateResponse +- cloudflare.ZoneAccessGroupListResponse +- cloudflare.ZoneAccessGroupDeleteResponse + +Methods: + +- client.Zones.Accesses.Groups.New(ctx context.Context, identifier string, body cloudflare.ZoneAccessGroupNewParams) (cloudflare.ZoneAccessGroupNewResponse, error) +- client.Zones.Accesses.Groups.Get(ctx context.Context, identifier string, uuid string) (cloudflare.ZoneAccessGroupGetResponse, error) +- client.Zones.Accesses.Groups.Update(ctx context.Context, identifier string, uuid string, body cloudflare.ZoneAccessGroupUpdateParams) (cloudflare.ZoneAccessGroupUpdateResponse, error) +- client.Zones.Accesses.Groups.List(ctx context.Context, identifier string) (cloudflare.ZoneAccessGroupListResponse, error) +- client.Zones.Accesses.Groups.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.ZoneAccessGroupDeleteResponse, error) + +### IdentityProviders + +Response Types: + +- cloudflare.ZoneAccessIdentityProviderGetResponse +- cloudflare.ZoneAccessIdentityProviderUpdateResponse +- cloudflare.ZoneAccessIdentityProviderListResponse +- cloudflare.ZoneAccessIdentityProviderDeleteResponse +- cloudflare.ZoneAccessIdentityProviderAddResponse + +Methods: + +- client.Zones.Accesses.IdentityProviders.Get(ctx context.Context, identifier string, uuid string) (cloudflare.ZoneAccessIdentityProviderGetResponse, error) +- client.Zones.Accesses.IdentityProviders.Update(ctx context.Context, identifier string, uuid string, body cloudflare.ZoneAccessIdentityProviderUpdateParams) (cloudflare.ZoneAccessIdentityProviderUpdateResponse, error) +- client.Zones.Accesses.IdentityProviders.List(ctx context.Context, identifier string) (cloudflare.ZoneAccessIdentityProviderListResponse, error) +- client.Zones.Accesses.IdentityProviders.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.ZoneAccessIdentityProviderDeleteResponse, error) +- client.Zones.Accesses.IdentityProviders.Add(ctx context.Context, identifier string, body cloudflare.ZoneAccessIdentityProviderAddParams) (cloudflare.ZoneAccessIdentityProviderAddResponse, error) + +### Organizations + +Response Types: + +- cloudflare.ZoneAccessOrganizationRevokeUserResponse +- cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponse +- cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponse +- cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse + +Methods: + +- client.Zones.Accesses.Organizations.RevokeUser(ctx context.Context, identifier interface{}, body cloudflare.ZoneAccessOrganizationRevokeUserParams) (cloudflare.ZoneAccessOrganizationRevokeUserResponse, error) +- client.Zones.Accesses.Organizations.ZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganization(ctx context.Context, identifier interface{}, body cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParams) (cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponse, error) +- client.Zones.Accesses.Organizations.ZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganization(ctx context.Context, identifier interface{}) (cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponse, error) +- client.Zones.Accesses.Organizations.ZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganization(ctx context.Context, identifier interface{}, body cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams) (cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse, error) + +### ServiceTokens + +Response Types: + +- cloudflare.ZoneAccessServiceTokenUpdateResponse +- cloudflare.ZoneAccessServiceTokenDeleteResponse +- cloudflare.ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponse +- cloudflare.ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponse + +Methods: + +- client.Zones.Accesses.ServiceTokens.Update(ctx context.Context, identifier string, uuid string, body cloudflare.ZoneAccessServiceTokenUpdateParams) (cloudflare.ZoneAccessServiceTokenUpdateResponse, error) +- client.Zones.Accesses.ServiceTokens.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.ZoneAccessServiceTokenDeleteResponse, error) +- client.Zones.Accesses.ServiceTokens.ZoneLevelAccessServiceTokensNewAServiceToken(ctx context.Context, identifier string, body cloudflare.ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenParams) (cloudflare.ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponse, error) +- client.Zones.Accesses.ServiceTokens.ZoneLevelAccessServiceTokensListServiceTokens(ctx context.Context, identifier string) (cloudflare.ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponse, error) + +## DNSAnalytics + +### Reports + +Response Types: + +- cloudflare.ZoneDNSAnalyticReportListResponse + +Methods: + +- client.Zones.DNSAnalytics.Reports.List(ctx context.Context, identifier string, query cloudflare.ZoneDNSAnalyticReportListParams) (cloudflare.ZoneDNSAnalyticReportListResponse, error) + +#### Bytimes + +Response Types: + +- cloudflare.ZoneDNSAnalyticReportBytimeListResponse + +Methods: + +- client.Zones.DNSAnalytics.Reports.Bytimes.List(ctx context.Context, identifier string, query cloudflare.ZoneDNSAnalyticReportBytimeListParams) (cloudflare.ZoneDNSAnalyticReportBytimeListResponse, error) + +## PurgeCaches + +Response Types: + +- cloudflare.ZonePurgeCachZonePurgeResponse + +Methods: + +- client.Zones.PurgeCaches.ZonePurge(ctx context.Context, identifier string, body cloudflare.ZonePurgeCachZonePurgeParams) (cloudflare.ZonePurgeCachZonePurgeResponse, error) + +## Ssls + +### Analyzes + +Response Types: + +- cloudflare.ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponse + +Methods: + +- client.Zones.Ssls.Analyzes.AnalyzeCertificateAnalyzeCertificate(ctx context.Context, identifier string, body cloudflare.ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParams) (cloudflare.ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponse, error) + +### CertificatePacks + +Response Types: + +- cloudflare.ZoneSslCertificatePackGetResponse +- cloudflare.ZoneSslCertificatePackUpdateResponse +- cloudflare.ZoneSslCertificatePackDeleteResponse +- cloudflare.ZoneSslCertificatePackCertificatePacksListCertificatePacksResponse + +Methods: + +- client.Zones.Ssls.CertificatePacks.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneSslCertificatePackGetResponse, error) +- client.Zones.Ssls.CertificatePacks.Update(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneSslCertificatePackUpdateResponse, error) +- client.Zones.Ssls.CertificatePacks.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneSslCertificatePackDeleteResponse, error) +- client.Zones.Ssls.CertificatePacks.CertificatePacksListCertificatePacks(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneSslCertificatePackCertificatePacksListCertificatePacksParams) (cloudflare.ZoneSslCertificatePackCertificatePacksListCertificatePacksResponse, error) + +#### Orders + +Response Types: + +- cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponse + +Methods: + +- client.Zones.Ssls.CertificatePacks.Orders.CertificatePacksOrderAdvancedCertificateManagerCertificatePack(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParams) (cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponse, error) + +#### Quotas + +Response Types: + +- cloudflare.ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponse + +Methods: + +- client.Zones.Ssls.CertificatePacks.Quotas.CertificatePacksGetCertificatePackQuotas(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponse, error) + +### Recommendations + +Response Types: + +- cloudflare.ZoneSslRecommendationListResponse + +Methods: + +- client.Zones.Ssls.Recommendations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSslRecommendationListResponse, error) + +### Universals + +#### Settings + +Response Types: + +- cloudflare.ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponse +- cloudflare.ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponse + +Methods: + +- client.Zones.Ssls.Universals.Settings.UniversalSslSettingsForAZoneEditUniversalSslSettings(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsParams) (cloudflare.ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponse, error) +- client.Zones.Ssls.Universals.Settings.UniversalSslSettingsForAZoneUniversalSslSettingsDetails(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponse, error) + +### Verifications + +Response Types: + +- cloudflare.ZoneSslVerificationUpdateResponse +- cloudflare.ZoneSslVerificationSslVerificationSslVerificationDetailsResponse + +Methods: + +- client.Zones.Ssls.Verifications.Update(ctx context.Context, zoneIdentifier string, certPackUuid string, body cloudflare.ZoneSslVerificationUpdateParams) (cloudflare.ZoneSslVerificationUpdateResponse, error) +- client.Zones.Ssls.Verifications.SslVerificationSslVerificationDetails(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneSslVerificationSslVerificationSslVerificationDetailsParams) (cloudflare.ZoneSslVerificationSslVerificationSslVerificationDetailsResponse, error) + +## Subscriptions + +Response Types: + +- cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponse +- cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponse +- cloudflare.ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponse + +Methods: + +- client.Zones.Subscriptions.ZoneSubscriptionNewZoneSubscription(ctx context.Context, identifier string, body cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParams) (cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponse, error) +- client.Zones.Subscriptions.ZoneSubscriptionUpdateZoneSubscription(ctx context.Context, identifier string, body cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParams) (cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponse, error) +- client.Zones.Subscriptions.ZoneSubscriptionZoneSubscriptionDetails(ctx context.Context, identifier string) (cloudflare.ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponse, error) + +## Acms + +### TotalTls + +Response Types: + +- cloudflare.ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponse +- cloudflare.ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponse + +Methods: + +- client.Zones.Acms.TotalTls.TotalTlsEnableOrDisableTotalTls(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParams) (cloudflare.ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponse, error) +- client.Zones.Acms.TotalTls.TotalTlsTotalTlsSettingsDetails(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponse, error) + +## Analytics + +### Colo + +Response Types: + +- cloudflare.ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse + +Methods: + +- client.Zones.Analytics.Colo.ZoneAnalyticsDeprecatedGetAnalyticsByCoLocations(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams) (cloudflare.ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse, error) + +### Dashboards + +Response Types: + +- cloudflare.ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponse + +Methods: + +- client.Zones.Analytics.Dashboards.ZoneAnalyticsDeprecatedGetDashboard(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParams) (cloudflare.ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponse, error) + +### Latencies + +Response Types: + +- cloudflare.ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponse + +Methods: + +- client.Zones.Analytics.Latencies.ArgoAnalyticsForZoneArgoAnalyticsForAZone(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneParams) (cloudflare.ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponse, error) + +#### Colos + +Response Types: + +- cloudflare.ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponse + +Methods: + +- client.Zones.Analytics.Latencies.Colos.ArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPs(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponse, error) + +## Argos + +### SmartRoutings + +Response Types: + +- cloudflare.ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponse +- cloudflare.ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponse + +Methods: + +- client.Zones.Argos.SmartRoutings.ArgoSmartRoutingGetArgoSmartRoutingSetting(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponse, error) +- client.Zones.Argos.SmartRoutings.ArgoSmartRoutingPatchArgoSmartRoutingSetting(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParams) (cloudflare.ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponse, error) + +### TieredCaching + +Response Types: + +- cloudflare.ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponse +- cloudflare.ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponse + +Methods: + +- client.Zones.Argos.TieredCaching.TieredCachingGetTieredCachingSetting(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponse, error) +- client.Zones.Argos.TieredCaching.TieredCachingPatchTieredCachingSetting(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParams) (cloudflare.ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponse, error) + +## AvailablePlans + +Response Types: + +- cloudflare.ZoneAvailablePlanGetResponse +- cloudflare.ZoneAvailablePlanListResponse + +Methods: + +- client.Zones.AvailablePlans.Get(ctx context.Context, zoneIdentifier string, planIdentifier string) (cloudflare.ZoneAvailablePlanGetResponse, error) +- client.Zones.AvailablePlans.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneAvailablePlanListResponse, error) + +## AvailableRatePlans + +Response Types: + +- cloudflare.ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponse + +Methods: + +- client.Zones.AvailableRatePlans.ZoneRatePlanListAvailableRatePlans(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponse, error) + +## Caches + +### CacheReserves + +Response Types: + +- cloudflare.ZoneCachCacheReserveListResponse +- cloudflare.ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponse + +Methods: + +- client.Zones.Caches.CacheReserves.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCachCacheReserveListResponse, error) +- client.Zones.Caches.CacheReserves.ZoneCacheSettingsChangeCacheReserveSetting(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParams) (cloudflare.ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponse, error) + +### TieredCacheSmartTopologyEnables + +Response Types: + +- cloudflare.ZoneCachTieredCacheSmartTopologyEnableDeleteResponse +- cloudflare.ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponse +- cloudflare.ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponse + +Methods: + +- client.Zones.Caches.TieredCacheSmartTopologyEnables.Delete(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCachTieredCacheSmartTopologyEnableDeleteResponse, error) +- client.Zones.Caches.TieredCacheSmartTopologyEnables.SmartTieredCacheGetSmartTieredCacheSetting(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponse, error) +- client.Zones.Caches.TieredCacheSmartTopologyEnables.SmartTieredCachePatchSmartTieredCacheSetting(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParams) (cloudflare.ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponse, error) + +### Variants + +Response Types: + +- cloudflare.ZoneCachVariantListResponse +- cloudflare.ZoneCachVariantDeleteResponse +- cloudflare.ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponse + +Methods: + +- client.Zones.Caches.Variants.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCachVariantListResponse, error) +- client.Zones.Caches.Variants.Delete(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCachVariantDeleteResponse, error) +- client.Zones.Caches.Variants.ZoneCacheSettingsChangeVariantsSetting(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParams) (cloudflare.ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponse, error) + +## CertificateAuthorities + +### HostnameAssociations + +Response Types: + +- cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponse +- cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponse + +Methods: + +- client.Zones.CertificateAuthorities.HostnameAssociations.ClientCertificateForAZoneListHostnameAssociations(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsParams) (cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponse, error) +- client.Zones.CertificateAuthorities.HostnameAssociations.ClientCertificateForAZonePutHostnameAssociations(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsParams) (cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponse, error) + +## ClientCertificates + +Response Types: + +- cloudflare.ZoneClientCertificateGetResponse +- cloudflare.ZoneClientCertificateUpdateResponse +- cloudflare.ZoneClientCertificateDeleteResponse +- cloudflare.ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponse +- cloudflare.ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponse + +Methods: + +- client.Zones.ClientCertificates.Get(ctx context.Context, zoneIdentifier string, clientCertificateIdentifier string) (cloudflare.ZoneClientCertificateGetResponse, error) +- client.Zones.ClientCertificates.Update(ctx context.Context, zoneIdentifier string, clientCertificateIdentifier string) (cloudflare.ZoneClientCertificateUpdateResponse, error) +- client.Zones.ClientCertificates.Delete(ctx context.Context, zoneIdentifier string, clientCertificateIdentifier string) (cloudflare.ZoneClientCertificateDeleteResponse, error) +- client.Zones.ClientCertificates.ClientCertificateForAZoneNewClientCertificate(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneClientCertificateClientCertificateForAZoneNewClientCertificateParams) (cloudflare.ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponse, error) +- client.Zones.ClientCertificates.ClientCertificateForAZoneListClientCertificates(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParams) (cloudflare.ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponse, error) + +## CustomCertificates + +Response Types: + +- cloudflare.ZoneCustomCertificateGetResponse +- cloudflare.ZoneCustomCertificateUpdateResponse +- cloudflare.ZoneCustomCertificateDeleteResponse +- cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponse +- cloudflare.ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponse + +Methods: + +- client.Zones.CustomCertificates.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneCustomCertificateGetResponse, error) +- client.Zones.CustomCertificates.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneCustomCertificateUpdateParams) (cloudflare.ZoneCustomCertificateUpdateResponse, error) +- client.Zones.CustomCertificates.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneCustomCertificateDeleteResponse, error) +- client.Zones.CustomCertificates.CustomSslForAZoneNewSslConfiguration(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParams) (cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponse, error) +- client.Zones.CustomCertificates.CustomSslForAZoneListSslConfigurations(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParams) (cloudflare.ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponse, error) + +### Prioritizes + +Response Types: + +- cloudflare.ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponse + +Methods: + +- client.Zones.CustomCertificates.Prioritizes.CustomSslForAZoneRePrioritizeSslCertificates(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParams) (cloudflare.ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponse, error) + +## CustomHostnames + +Response Types: + +- cloudflare.ZoneCustomHostnameGetResponse +- cloudflare.ZoneCustomHostnameUpdateResponse +- cloudflare.ZoneCustomHostnameDeleteResponse +- cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponse +- cloudflare.ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponse + +Methods: + +- client.Zones.CustomHostnames.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneCustomHostnameGetResponse, error) +- client.Zones.CustomHostnames.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneCustomHostnameUpdateParams) (cloudflare.ZoneCustomHostnameUpdateResponse, error) +- client.Zones.CustomHostnames.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneCustomHostnameDeleteResponse, error) +- client.Zones.CustomHostnames.CustomHostnameForAZoneNewCustomHostname(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParams) (cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponse, error) +- client.Zones.CustomHostnames.CustomHostnameForAZoneListCustomHostnames(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParams) (cloudflare.ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponse, error) + +### FallbackOrigins + +Response Types: + +- cloudflare.ZoneCustomHostnameFallbackOriginDeleteResponse +- cloudflare.ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponse +- cloudflare.ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponse + +Methods: + +- client.Zones.CustomHostnames.FallbackOrigins.Delete(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCustomHostnameFallbackOriginDeleteResponse, error) +- client.Zones.CustomHostnames.FallbackOrigins.CustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnames(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponse, error) +- client.Zones.CustomHostnames.FallbackOrigins.CustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnames(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesParams) (cloudflare.ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponse, error) + +## CustomNs + +Response Types: + +- cloudflare.ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponse +- cloudflare.ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponse + +Methods: + +- client.Zones.CustomNs.AccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadata(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponse, error) +- client.Zones.CustomNs.AccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadata(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataParams) (cloudflare.ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponse, error) + +## CustomPages + +Response Types: + +- cloudflare.ZoneCustomPageGetResponse +- cloudflare.ZoneCustomPageUpdateResponse +- cloudflare.ZoneCustomPageCustomPagesForAZoneListCustomPagesResponse + +Methods: + +- client.Zones.CustomPages.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneCustomPageGetResponse, error) +- client.Zones.CustomPages.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneCustomPageUpdateParams) (cloudflare.ZoneCustomPageUpdateResponse, error) +- client.Zones.CustomPages.CustomPagesForAZoneListCustomPages(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCustomPageCustomPagesForAZoneListCustomPagesResponse, error) + +## DNSRecords + +Response Types: + +- cloudflare.DNSRecord +- cloudflare.ZoneDNSRecordDeleteResponse +- cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse + +Methods: + +- client.Zones.DNSRecords.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.DNSRecord, error) +- client.Zones.DNSRecords.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneDNSRecordUpdateParams) (cloudflare.DNSRecord, error) +- client.Zones.DNSRecords.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneDNSRecordDeleteResponse, error) +- client.Zones.DNSRecords.DNSRecordsForAZoneNewDNSRecord(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams) (cloudflare.DNSRecord, error) +- client.Zones.DNSRecords.DNSRecordsForAZoneListDNSRecords(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParams) (cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse, error) +- client.Zones.DNSRecords.Patch(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneDNSRecordPatchParams) (cloudflare.DNSRecord, error) + +### Exports + +Methods: + +- client.Zones.DNSRecords.Exports.List(ctx context.Context, zoneIdentifier string) (string, error) + +### Imports + +Response Types: + +- cloudflare.ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponse + +Methods: + +- client.Zones.DNSRecords.Imports.DNSRecordsForAZoneImportDNSRecords(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsParams) (cloudflare.ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponse, error) + +### Scans + +Response Types: + +- cloudflare.ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponse + +Methods: + +- client.Zones.DNSRecords.Scans.DNSRecordsForAZoneScanDNSRecords(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponse, error) + +## Dnssecs + +Response Types: + +- cloudflare.ZoneDnssecGetResponse +- cloudflare.ZoneDnssecUpdateResponse +- cloudflare.ZoneDnssecDeleteResponse + +Methods: + +- client.Zones.Dnssecs.Get(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneDnssecGetResponse, error) +- client.Zones.Dnssecs.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneDnssecUpdateParams) (cloudflare.ZoneDnssecUpdateResponse, error) +- client.Zones.Dnssecs.Delete(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneDnssecDeleteResponse, error) + +## Emails + +### Routings + +Response Types: + +- cloudflare.ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponse + +Methods: + +- client.Zones.Emails.Routings.EmailRoutingSettingsGetEmailRoutingSettings(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponse, error) + +#### Disables + +Response Types: + +- cloudflare.ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponse + +Methods: + +- client.Zones.Emails.Routings.Disables.EmailRoutingSettingsDisableEmailRouting(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponse, error) + +#### DNS + +Response Types: + +- cloudflare.ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponse + +Methods: + +- client.Zones.Emails.Routings.DNS.EmailRoutingSettingsEmailRoutingDNSSettings(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponse, error) + +#### Enables + +Response Types: + +- cloudflare.ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponse + +Methods: + +- client.Zones.Emails.Routings.Enables.EmailRoutingSettingsEnableEmailRouting(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponse, error) + +#### Rules + +Response Types: + +- cloudflare.ZoneEmailRoutingRuleGetResponse +- cloudflare.ZoneEmailRoutingRuleUpdateResponse +- cloudflare.ZoneEmailRoutingRuleDeleteResponse +- cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponse +- cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponse + +Methods: + +- client.Zones.Emails.Routings.Rules.Get(ctx context.Context, zoneIdentifier string, ruleIdentifier string) (cloudflare.ZoneEmailRoutingRuleGetResponse, error) +- client.Zones.Emails.Routings.Rules.Update(ctx context.Context, zoneIdentifier string, ruleIdentifier string, body cloudflare.ZoneEmailRoutingRuleUpdateParams) (cloudflare.ZoneEmailRoutingRuleUpdateResponse, error) +- client.Zones.Emails.Routings.Rules.Delete(ctx context.Context, zoneIdentifier string, ruleIdentifier string) (cloudflare.ZoneEmailRoutingRuleDeleteResponse, error) +- client.Zones.Emails.Routings.Rules.EmailRoutingRoutingRulesNewRoutingRule(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParams) (cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponse, error) +- client.Zones.Emails.Routings.Rules.EmailRoutingRoutingRulesListRoutingRules(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParams) (cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponse, error) + +##### CatchAlls + +Response Types: + +- cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponse +- cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponse + +Methods: + +- client.Zones.Emails.Routings.Rules.CatchAlls.EmailRoutingRoutingRulesGetCatchAllRule(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponse, error) +- client.Zones.Emails.Routings.Rules.CatchAlls.EmailRoutingRoutingRulesUpdateCatchAllRule(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParams) (cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponse, error) + +## Filters + +Response Types: + +- cloudflare.ZoneFilterGetResponse +- cloudflare.ZoneFilterUpdateResponse +- cloudflare.ZoneFilterDeleteResponse +- cloudflare.ZoneFilterFiltersNewFiltersResponse +- cloudflare.ZoneFilterFiltersListFiltersResponse +- cloudflare.ZoneFilterFiltersUpdateFiltersResponse + +Methods: + +- client.Zones.Filters.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFilterGetResponse, error) +- client.Zones.Filters.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.ZoneFilterUpdateParams) (cloudflare.ZoneFilterUpdateResponse, error) +- client.Zones.Filters.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFilterDeleteResponse, error) +- client.Zones.Filters.FiltersNewFilters(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFilterFiltersNewFiltersParams) (cloudflare.ZoneFilterFiltersNewFiltersResponse, error) +- client.Zones.Filters.FiltersListFilters(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneFilterFiltersListFiltersParams) (cloudflare.ZoneFilterFiltersListFiltersResponse, error) +- client.Zones.Filters.FiltersUpdateFilters(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFilterFiltersUpdateFiltersParams) (cloudflare.ZoneFilterFiltersUpdateFiltersResponse, error) + +## Firewalls + +### Lockdowns + +Response Types: + +- cloudflare.ZoneFirewallLockdownGetResponse +- cloudflare.ZoneFirewallLockdownUpdateResponse +- cloudflare.ZoneFirewallLockdownDeleteResponse +- cloudflare.ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponse +- cloudflare.ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponse + +Methods: + +- client.Zones.Firewalls.Lockdowns.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFirewallLockdownGetResponse, error) +- client.Zones.Firewalls.Lockdowns.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.ZoneFirewallLockdownUpdateParams) (cloudflare.ZoneFirewallLockdownUpdateResponse, error) +- client.Zones.Firewalls.Lockdowns.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFirewallLockdownDeleteResponse, error) +- client.Zones.Firewalls.Lockdowns.ZoneLockdownNewAZoneLockdownRule(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleParams) (cloudflare.ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponse, error) +- client.Zones.Firewalls.Lockdowns.ZoneLockdownListZoneLockdownRules(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesParams) (cloudflare.ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponse, error) + +### Rules + +Response Types: + +- cloudflare.ZoneFirewallRuleGetResponse +- cloudflare.ZoneFirewallRuleUpdateResponse +- cloudflare.ZoneFirewallRuleDeleteResponse +- cloudflare.ZoneFirewallRuleFirewallRulesNewFirewallRulesResponse +- cloudflare.ZoneFirewallRuleFirewallRulesListFirewallRulesResponse +- cloudflare.ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponse +- cloudflare.ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponse + +Methods: + +- client.Zones.Firewalls.Rules.Get(ctx context.Context, zoneIdentifier string, id string, query cloudflare.ZoneFirewallRuleGetParams) (cloudflare.ZoneFirewallRuleGetResponse, error) +- client.Zones.Firewalls.Rules.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.ZoneFirewallRuleUpdateParams) (cloudflare.ZoneFirewallRuleUpdateResponse, error) +- client.Zones.Firewalls.Rules.Delete(ctx context.Context, zoneIdentifier string, id string, body cloudflare.ZoneFirewallRuleDeleteParams) (cloudflare.ZoneFirewallRuleDeleteResponse, error) +- client.Zones.Firewalls.Rules.FirewallRulesNewFirewallRules(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFirewallRuleFirewallRulesNewFirewallRulesParams) (cloudflare.ZoneFirewallRuleFirewallRulesNewFirewallRulesResponse, error) +- client.Zones.Firewalls.Rules.FirewallRulesListFirewallRules(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneFirewallRuleFirewallRulesListFirewallRulesParams) (cloudflare.ZoneFirewallRuleFirewallRulesListFirewallRulesResponse, error) +- client.Zones.Firewalls.Rules.FirewallRulesUpdateFirewallRules(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFirewallRuleFirewallRulesUpdateFirewallRulesParams) (cloudflare.ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponse, error) +- client.Zones.Firewalls.Rules.FirewallRulesUpdatePriorityOfFirewallRules(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesParams) (cloudflare.ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponse, error) + +### UaRules + +Response Types: + +- cloudflare.ZoneFirewallUaRuleGetResponse +- cloudflare.ZoneFirewallUaRuleUpdateResponse +- cloudflare.ZoneFirewallUaRuleDeleteResponse +- cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponse +- cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponse + +Methods: + +- client.Zones.Firewalls.UaRules.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFirewallUaRuleGetResponse, error) +- client.Zones.Firewalls.UaRules.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.ZoneFirewallUaRuleUpdateParams) (cloudflare.ZoneFirewallUaRuleUpdateResponse, error) +- client.Zones.Firewalls.UaRules.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFirewallUaRuleDeleteResponse, error) +- client.Zones.Firewalls.UaRules.UserAgentBlockingRulesNewAUserAgentBlockingRule(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleParams) (cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponse, error) +- client.Zones.Firewalls.UaRules.UserAgentBlockingRulesListUserAgentBlockingRules(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesParams) (cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponse, error) + +### Wafs + +#### Overrides + +Response Types: + +- cloudflare.ZoneFirewallWafOverrideGetResponse +- cloudflare.ZoneFirewallWafOverrideUpdateResponse +- cloudflare.ZoneFirewallWafOverrideDeleteResponse +- cloudflare.ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponse +- cloudflare.ZoneFirewallWafOverrideWafOverridesListWafOverridesResponse + +Methods: + +- client.Zones.Firewalls.Wafs.Overrides.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFirewallWafOverrideGetResponse, error) +- client.Zones.Firewalls.Wafs.Overrides.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.ZoneFirewallWafOverrideUpdateParams) (cloudflare.ZoneFirewallWafOverrideUpdateResponse, error) +- client.Zones.Firewalls.Wafs.Overrides.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneFirewallWafOverrideDeleteResponse, error) +- client.Zones.Firewalls.Wafs.Overrides.WafOverridesNewAWafOverride(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneFirewallWafOverrideWafOverridesNewAWafOverrideParams) (cloudflare.ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponse, error) +- client.Zones.Firewalls.Wafs.Overrides.WafOverridesListWafOverrides(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneFirewallWafOverrideWafOverridesListWafOverridesParams) (cloudflare.ZoneFirewallWafOverrideWafOverridesListWafOverridesResponse, error) + +#### Packages + +Response Types: + +- cloudflare.ZoneFirewallWafPackageGetResponse +- cloudflare.ZoneFirewallWafPackageUpdateResponse +- cloudflare.ZoneFirewallWafPackageWafPackagesListWafPackagesResponse + +Methods: + +- client.Zones.Firewalls.Wafs.Packages.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneFirewallWafPackageGetResponse, error) +- client.Zones.Firewalls.Wafs.Packages.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneFirewallWafPackageUpdateParams) (cloudflare.ZoneFirewallWafPackageUpdateResponse, error) +- client.Zones.Firewalls.Wafs.Packages.WafPackagesListWafPackages(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneFirewallWafPackageWafPackagesListWafPackagesParams) (cloudflare.ZoneFirewallWafPackageWafPackagesListWafPackagesResponse, error) + +##### Groups + +Response Types: + +- cloudflare.ZoneFirewallWafPackageGroupGetResponse +- cloudflare.ZoneFirewallWafPackageGroupUpdateResponse +- cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponse + +Methods: + +- client.Zones.Firewalls.Wafs.Packages.Groups.Get(ctx context.Context, zoneIdentifier string, packageIdentifier string, identifier string) (cloudflare.ZoneFirewallWafPackageGroupGetResponse, error) +- client.Zones.Firewalls.Wafs.Packages.Groups.Update(ctx context.Context, zoneIdentifier string, packageIdentifier string, identifier string, body cloudflare.ZoneFirewallWafPackageGroupUpdateParams) (cloudflare.ZoneFirewallWafPackageGroupUpdateResponse, error) +- client.Zones.Firewalls.Wafs.Packages.Groups.WafRuleGroupsListWafRuleGroups(ctx context.Context, zoneIdentifier string, packageIdentifier string, query cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParams) (cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponse, error) + +##### Rules + +Response Types: + +- cloudflare.ZoneFirewallWafPackageRuleGetResponse +- cloudflare.ZoneFirewallWafPackageRuleUpdateResponse +- cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesResponse + +Methods: + +- client.Zones.Firewalls.Wafs.Packages.Rules.Get(ctx context.Context, zoneID string, packageID string, identifier string) (cloudflare.ZoneFirewallWafPackageRuleGetResponse, error) +- client.Zones.Firewalls.Wafs.Packages.Rules.Update(ctx context.Context, zoneID string, packageID string, identifier string, body cloudflare.ZoneFirewallWafPackageRuleUpdateParams) (cloudflare.ZoneFirewallWafPackageRuleUpdateResponse, error) +- client.Zones.Firewalls.Wafs.Packages.Rules.WafRulesListWafRules(ctx context.Context, zoneID string, packageID string, query cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesParams) (cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesResponse, error) + +### AccessRules + +#### Rules + +Response Types: + +- cloudflare.ZoneFirewallAccessRuleRuleUpdateResponse +- cloudflare.ZoneFirewallAccessRuleRuleDeleteResponse +- cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponse +- cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponse + +Methods: + +- client.Zones.Firewalls.AccessRules.Rules.Update(ctx context.Context, zoneID string, identifier string, body cloudflare.ZoneFirewallAccessRuleRuleUpdateParams) (cloudflare.ZoneFirewallAccessRuleRuleUpdateResponse, error) +- client.Zones.Firewalls.AccessRules.Rules.Delete(ctx context.Context, zoneID string, identifier string, body cloudflare.ZoneFirewallAccessRuleRuleDeleteParams) (cloudflare.ZoneFirewallAccessRuleRuleDeleteResponse, error) +- client.Zones.Firewalls.AccessRules.Rules.IPAccessRulesForAZoneNewAnIPAccessRule(ctx context.Context, zoneID string, body cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParams) (cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponse, error) +- client.Zones.Firewalls.AccessRules.Rules.IPAccessRulesForAZoneListIPAccessRules(ctx context.Context, zoneID string, query cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParams) (cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponse, error) + +## Healthchecks + +Response Types: + +- cloudflare.HealthchecksSingleResponse +- cloudflare.ZoneHealthcheckDeleteResponse +- cloudflare.ZoneHealthcheckHealthChecksListHealthChecksResponse + +Methods: + +- client.Zones.Healthchecks.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthchecksSingleResponse, error) +- client.Zones.Healthchecks.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneHealthcheckUpdateParams) (cloudflare.HealthchecksSingleResponse, error) +- client.Zones.Healthchecks.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneHealthcheckDeleteResponse, error) +- client.Zones.Healthchecks.HealthChecksNewHealthCheck(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParams) (cloudflare.HealthchecksSingleResponse, error) +- client.Zones.Healthchecks.HealthChecksListHealthChecks(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneHealthcheckHealthChecksListHealthChecksResponse, error) + +### Previews + +Response Types: + +- cloudflare.ZoneHealthcheckPreviewDeleteResponse + +Methods: + +- client.Zones.Healthchecks.Previews.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthchecksSingleResponse, error) +- client.Zones.Healthchecks.Previews.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneHealthcheckPreviewDeleteResponse, error) +- client.Zones.Healthchecks.Previews.HealthChecksNewPreviewHealthCheck(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParams) (cloudflare.HealthchecksSingleResponse, error) + +## KeylessCertificates + +Response Types: + +- cloudflare.ZoneKeylessCertificateGetResponse +- cloudflare.ZoneKeylessCertificateUpdateResponse +- cloudflare.ZoneKeylessCertificateDeleteResponse +- cloudflare.ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponse +- cloudflare.ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponse + +Methods: + +- client.Zones.KeylessCertificates.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneKeylessCertificateGetResponse, error) +- client.Zones.KeylessCertificates.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneKeylessCertificateUpdateParams) (cloudflare.ZoneKeylessCertificateUpdateResponse, error) +- client.Zones.KeylessCertificates.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneKeylessCertificateDeleteResponse, error) +- client.Zones.KeylessCertificates.KeylessSslForAZoneNewKeylessSslConfiguration(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParams) (cloudflare.ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponse, error) +- client.Zones.KeylessCertificates.KeylessSslForAZoneListKeylessSslConfigurations(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponse, error) + +## Logpushes + +### Datasets + +#### Fields + +Response Types: + +- cloudflare.ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponse + +Methods: + +- client.Zones.Logpushes.Datasets.Fields.GetZonesZoneIdentifierLogpushDatasetsDatasetFields(ctx context.Context, zoneIdentifier string, dataset string) (cloudflare.ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponse, error) + +#### Jobs + +Response Types: + +- cloudflare.ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponse + +Methods: + +- client.Zones.Logpushes.Datasets.Jobs.GetZonesZoneIdentifierLogpushDatasetsDatasetJobs(ctx context.Context, zoneIdentifier string, dataset string) (cloudflare.ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponse, error) + +### Edges + +Response Types: + +- cloudflare.ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponse +- cloudflare.ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponse + +Methods: + +- client.Zones.Logpushes.Edges.GetZonesZoneIdentifierLogpushEdgeJobs(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponse, error) +- client.Zones.Logpushes.Edges.PostZonesZoneIdentifierLogpushEdgeJobs(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsParams) (cloudflare.ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponse, error) + +### Jobs + +Response Types: + +- cloudflare.ZoneLogpushJobGetResponse +- cloudflare.ZoneLogpushJobUpdateResponse +- cloudflare.ZoneLogpushJobDeleteResponse +- cloudflare.ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponse +- cloudflare.ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponse + +Methods: + +- client.Zones.Logpushes.Jobs.Get(ctx context.Context, zoneIdentifier string, jobIdentifier int64) (cloudflare.ZoneLogpushJobGetResponse, error) +- client.Zones.Logpushes.Jobs.Update(ctx context.Context, zoneIdentifier string, jobIdentifier int64, body cloudflare.ZoneLogpushJobUpdateParams) (cloudflare.ZoneLogpushJobUpdateResponse, error) +- client.Zones.Logpushes.Jobs.Delete(ctx context.Context, zoneIdentifier string, jobIdentifier int64) (cloudflare.ZoneLogpushJobDeleteResponse, error) +- client.Zones.Logpushes.Jobs.GetZonesZoneIdentifierLogpushJobs(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponse, error) +- client.Zones.Logpushes.Jobs.PostZonesZoneIdentifierLogpushJobs(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParams) (cloudflare.ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponse, error) + +### Ownerships + +Response Types: + +- cloudflare.ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponse + +Methods: + +- client.Zones.Logpushes.Ownerships.PostZonesZoneIdentifierLogpushOwnership(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipParams) (cloudflare.ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponse, error) + +#### Validates + +Response Types: + +- cloudflare.ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponse + +Methods: + +- client.Zones.Logpushes.Ownerships.Validates.PostZonesZoneIdentifierLogpushOwnershipValidate(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateParams) (cloudflare.ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponse, error) + +### Validates + +#### Destinations + +##### Exists + +Response Types: + +- cloudflare.ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponse + +Methods: + +- client.Zones.Logpushes.Validates.Destinations.Exists.PostZonesZoneIdentifierLogpushValidateDestinationExists(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsParams) (cloudflare.ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponse, error) + +#### Origins + +Response Types: + +- cloudflare.ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponse + +Methods: + +- client.Zones.Logpushes.Validates.Origins.PostZonesZoneIdentifierLogpushValidateOrigin(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginParams) (cloudflare.ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponse, error) + +## Logs + +### Controls + +#### Retentions + +##### Flags + +Response Types: + +- cloudflare.ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse +- cloudflare.ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponse + +Methods: + +- client.Zones.Logs.Controls.Retentions.Flags.LogsReceivedGetLogRetentionFlag(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse, error) +- client.Zones.Logs.Controls.Retentions.Flags.LogsReceivedUpdateLogRetentionFlag(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagParams) (cloudflare.ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponse, error) + +### Rayids + +Response Types: + +- cloudflare.ZoneLogRayidGetResponse + +Methods: + +- client.Zones.Logs.Rayids.Get(ctx context.Context, zoneIdentifier string, rayIdentifier string, query cloudflare.ZoneLogRayidGetParams) (cloudflare.ZoneLogRayidGetResponse, error) + +### Receiveds + +Response Types: + +- cloudflare.ZoneLogReceivedReceivedGetLogsReceivedResponse + +Methods: + +- client.Zones.Logs.Receiveds.ReceivedGetLogsReceived(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneLogReceivedReceivedGetLogsReceivedParams) (cloudflare.ZoneLogReceivedReceivedGetLogsReceivedResponse, error) + +#### Fields + +Response Types: + +- cloudflare.ZoneLogReceivedFieldLogsReceivedListFieldsResponse + +Methods: + +- client.Zones.Logs.Receiveds.Fields.LogsReceivedListFields(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneLogReceivedFieldLogsReceivedListFieldsResponse, error) + +## OriginTlsClientAuths + +Response Types: + +- cloudflare.ZoneOriginTlsClientAuthGetResponse +- cloudflare.ZoneOriginTlsClientAuthDeleteResponse +- cloudflare.ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponse +- cloudflare.ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponse + +Methods: + +- client.Zones.OriginTlsClientAuths.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneOriginTlsClientAuthGetResponse, error) +- client.Zones.OriginTlsClientAuths.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneOriginTlsClientAuthDeleteResponse, error) +- client.Zones.OriginTlsClientAuths.ZoneLevelAuthenticatedOriginPullsListCertificates(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponse, error) +- client.Zones.OriginTlsClientAuths.ZoneLevelAuthenticatedOriginPullsUploadCertificate(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateParams) (cloudflare.ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponse, error) + +### Hostnames + +Response Types: + +- cloudflare.ZoneOriginTlsClientAuthHostnameGetResponse +- cloudflare.ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponse + +Methods: + +- client.Zones.OriginTlsClientAuths.Hostnames.Get(ctx context.Context, zoneIdentifier string, hostname string) (cloudflare.ZoneOriginTlsClientAuthHostnameGetResponse, error) +- client.Zones.OriginTlsClientAuths.Hostnames.PerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthentication(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParams) (cloudflare.ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponse, error) + +#### Certificates + +Response Types: + +- cloudflare.ZoneOriginTlsClientAuthHostnameCertificateGetResponse +- cloudflare.ZoneOriginTlsClientAuthHostnameCertificateDeleteResponse +- cloudflare.ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponse +- cloudflare.ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponse + +Methods: + +- client.Zones.OriginTlsClientAuths.Hostnames.Certificates.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneOriginTlsClientAuthHostnameCertificateGetResponse, error) +- client.Zones.OriginTlsClientAuths.Hostnames.Certificates.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneOriginTlsClientAuthHostnameCertificateDeleteResponse, error) +- client.Zones.OriginTlsClientAuths.Hostnames.Certificates.PerHostnameAuthenticatedOriginPullListCertificates(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponse, error) +- client.Zones.OriginTlsClientAuths.Hostnames.Certificates.PerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificate(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateParams) (cloudflare.ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponse, error) + +### Settings + +Response Types: + +- cloudflare.ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponse +- cloudflare.ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponse + +Methods: + +- client.Zones.OriginTlsClientAuths.Settings.ZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZone(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponse, error) +- client.Zones.OriginTlsClientAuths.Settings.ZoneLevelAuthenticatedOriginPullsSetEnablementForZone(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneParams) (cloudflare.ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponse, error) + +## Pagerules + +Response Types: + +- cloudflare.PageruleResponseSingle +- cloudflare.ZonePageruleDeleteResponse +- cloudflare.ZonePagerulePageRulesListPageRulesResponse + +Methods: + +- client.Zones.Pagerules.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.PageruleResponseSingle, error) +- client.Zones.Pagerules.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZonePageruleUpdateParams) (cloudflare.PageruleResponseSingle, error) +- client.Zones.Pagerules.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZonePageruleDeleteResponse, error) +- client.Zones.Pagerules.PageRulesNewAPageRule(ctx context.Context, zoneIdentifier string, body cloudflare.ZonePagerulePageRulesNewAPageRuleParams) (cloudflare.PageruleResponseSingle, error) +- client.Zones.Pagerules.PageRulesListPageRules(ctx context.Context, zoneIdentifier string, query cloudflare.ZonePagerulePageRulesListPageRulesParams) (cloudflare.ZonePagerulePageRulesListPageRulesResponse, error) + +### Settings + +Response Types: + +- cloudflare.ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponse + +Methods: + +- client.Zones.Pagerules.Settings.AvailablePageRulesSettingsListAvailablePageRulesSettings(ctx context.Context, zoneIdentifier string) (cloudflare.ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponse, error) + +## Railguns + +Response Types: + +- cloudflare.ZoneRailgunGetResponse +- cloudflare.ZoneRailgunUpdateResponse +- cloudflare.ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponse + +Methods: + +- client.Zones.Railguns.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneRailgunGetResponse, error) +- client.Zones.Railguns.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneRailgunUpdateParams) (cloudflare.ZoneRailgunUpdateResponse, error) +- client.Zones.Railguns.RailgunConnectionsForAZoneListAvailableRailguns(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponse, error) + +### Diagnoses + +Response Types: + +- cloudflare.ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponse + +Methods: + +- client.Zones.Railguns.Diagnoses.RailgunConnectionsForAZoneTestRailgunConnection(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponse, error) + +## RateLimits + +Response Types: + +- cloudflare.ZoneRateLimitNewResponse +- cloudflare.ZoneRateLimitGetResponse +- cloudflare.ZoneRateLimitUpdateResponse +- cloudflare.ZoneRateLimitListResponse +- cloudflare.ZoneRateLimitDeleteResponse + +Methods: + +- client.Zones.RateLimits.New(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneRateLimitNewParams) (cloudflare.ZoneRateLimitNewResponse, error) +- client.Zones.RateLimits.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneRateLimitGetResponse, error) +- client.Zones.RateLimits.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.ZoneRateLimitUpdateParams) (cloudflare.ZoneRateLimitUpdateResponse, error) +- client.Zones.RateLimits.List(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneRateLimitListParams) (cloudflare.ZoneRateLimitListResponse, error) +- client.Zones.RateLimits.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.ZoneRateLimitDeleteResponse, error) + +## SecondaryDNS + +### ForceAxfrs + +Response Types: + +- cloudflare.ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponse + +Methods: + +- client.Zones.SecondaryDNS.ForceAxfrs.SecondaryDNSSecondaryZoneForceAxfr(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponse, error) + +### Incomings + +Response Types: + +- cloudflare.ZoneSecondaryDNSIncomingDeleteResponse +- cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponse +- cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponse +- cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponse + +Methods: + +- client.Zones.SecondaryDNS.Incomings.Delete(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSIncomingDeleteResponse, error) +- client.Zones.SecondaryDNS.Incomings.SecondaryDNSSecondaryZoneNewSecondaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationParams) (cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponse, error) +- client.Zones.SecondaryDNS.Incomings.SecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetails(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponse, error) +- client.Zones.SecondaryDNS.Incomings.SecondaryDNSSecondaryZoneUpdateSecondaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationParams) (cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponse, error) + +### Outgoings + +Response Types: + +- cloudflare.ZoneSecondaryDNSOutgoingDeleteResponse +- cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponse +- cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponse +- cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponse + +Methods: + +- client.Zones.SecondaryDNS.Outgoings.Delete(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSOutgoingDeleteResponse, error) +- client.Zones.SecondaryDNS.Outgoings.SecondaryDNSPrimaryZoneNewPrimaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationParams) (cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponse, error) +- client.Zones.SecondaryDNS.Outgoings.SecondaryDNSPrimaryZonePrimaryZoneConfigurationDetails(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponse, error) +- client.Zones.SecondaryDNS.Outgoings.SecondaryDNSPrimaryZoneUpdatePrimaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationParams) (cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponse, error) + +#### Disables + +Response Types: + +- cloudflare.ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponse + +Methods: + +- client.Zones.SecondaryDNS.Outgoings.Disables.SecondaryDNSPrimaryZoneDisableOutgoingZoneTransfers(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponse, error) + +#### Enables + +Response Types: + +- cloudflare.ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponse + +Methods: + +- client.Zones.SecondaryDNS.Outgoings.Enables.SecondaryDNSPrimaryZoneEnableOutgoingZoneTransfers(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponse, error) + +#### ForceNotifies + +Response Types: + +- cloudflare.ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponse + +Methods: + +- client.Zones.SecondaryDNS.Outgoings.ForceNotifies.SecondaryDNSPrimaryZoneForceDNSNotify(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponse, error) + +#### Statuses + +Response Types: + +- cloudflare.ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponse + +Methods: + +- client.Zones.SecondaryDNS.Outgoings.Statuses.SecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatus(ctx context.Context, zoneIdentifier interface{}) (cloudflare.ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponse, error) + +## Settings + +Response Types: + +- cloudflare.ZoneSettingListResponse +- cloudflare.ZoneSettingEditResponse + +Methods: + +- client.Zones.Settings.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingListResponse, error) +- client.Zones.Settings.Edit(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingEditParams) (cloudflare.ZoneSettingEditResponse, error) + +### ZeroRtts + +Response Types: + +- cloudflare.ZoneSettingZeroRttListResponse +- cloudflare.ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponse + +Methods: + +- client.Zones.Settings.ZeroRtts.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingZeroRttListResponse, error) +- client.Zones.Settings.ZeroRtts.ZoneSettingsChange0RttSessionResumptionSetting(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParams) (cloudflare.ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponse, error) + +### AdvancedDdos + +Response Types: + +- cloudflare.ZoneSettingAdvancedDdoListResponse + +Methods: + +- client.Zones.Settings.AdvancedDdos.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAdvancedDdoListResponse, error) + +### AlwaysOnlines + +Response Types: + +- cloudflare.ZoneSettingAlwaysOnlineUpdateResponse +- cloudflare.ZoneSettingAlwaysOnlineListResponse + +Methods: + +- client.Zones.Settings.AlwaysOnlines.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAlwaysOnlineUpdateParams) (cloudflare.ZoneSettingAlwaysOnlineUpdateResponse, error) +- client.Zones.Settings.AlwaysOnlines.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAlwaysOnlineListResponse, error) + +### AlwaysUseHTTPs + +Response Types: + +- cloudflare.ZoneSettingAlwaysUseHTTPUpdateResponse +- cloudflare.ZoneSettingAlwaysUseHTTPListResponse + +Methods: + +- client.Zones.Settings.AlwaysUseHTTPs.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAlwaysUseHTTPUpdateParams) (cloudflare.ZoneSettingAlwaysUseHTTPUpdateResponse, error) +- client.Zones.Settings.AlwaysUseHTTPs.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAlwaysUseHTTPListResponse, error) + +### AutomaticHTTPsRewrites + +Response Types: + +- cloudflare.ZoneSettingAutomaticHTTPsRewriteUpdateResponse +- cloudflare.ZoneSettingAutomaticHTTPsRewriteListResponse + +Methods: + +- client.Zones.Settings.AutomaticHTTPsRewrites.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAutomaticHTTPsRewriteUpdateParams) (cloudflare.ZoneSettingAutomaticHTTPsRewriteUpdateResponse, error) +- client.Zones.Settings.AutomaticHTTPsRewrites.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAutomaticHTTPsRewriteListResponse, error) + +### AutomaticPlatformOptimizations + +Response Types: + +- cloudflare.ZoneSettingAutomaticPlatformOptimizationUpdateResponse +- cloudflare.ZoneSettingAutomaticPlatformOptimizationListResponse + +Methods: + +- client.Zones.Settings.AutomaticPlatformOptimizations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAutomaticPlatformOptimizationUpdateParams) (cloudflare.ZoneSettingAutomaticPlatformOptimizationUpdateResponse, error) +- client.Zones.Settings.AutomaticPlatformOptimizations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAutomaticPlatformOptimizationListResponse, error) + +### Brotli + +Response Types: + +- cloudflare.ZoneSettingBrotliUpdateResponse +- cloudflare.ZoneSettingBrotliListResponse + +Methods: + +- client.Zones.Settings.Brotli.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingBrotliUpdateParams) (cloudflare.ZoneSettingBrotliUpdateResponse, error) +- client.Zones.Settings.Brotli.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingBrotliListResponse, error) + +### BrowserCacheTtls + +Response Types: + +- cloudflare.ZoneSettingBrowserCacheTtlUpdateResponse +- cloudflare.ZoneSettingBrowserCacheTtlListResponse + +Methods: + +- client.Zones.Settings.BrowserCacheTtls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingBrowserCacheTtlUpdateParams) (cloudflare.ZoneSettingBrowserCacheTtlUpdateResponse, error) +- client.Zones.Settings.BrowserCacheTtls.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingBrowserCacheTtlListResponse, error) + +### BrowserChecks + +Response Types: + +- cloudflare.ZoneSettingBrowserCheckUpdateResponse +- cloudflare.ZoneSettingBrowserCheckListResponse + +Methods: + +- client.Zones.Settings.BrowserChecks.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingBrowserCheckUpdateParams) (cloudflare.ZoneSettingBrowserCheckUpdateResponse, error) +- client.Zones.Settings.BrowserChecks.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingBrowserCheckListResponse, error) + +### CacheLevels + +Response Types: + +- cloudflare.ZoneSettingCacheLevelUpdateResponse +- cloudflare.ZoneSettingCacheLevelListResponse + +Methods: + +- client.Zones.Settings.CacheLevels.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingCacheLevelUpdateParams) (cloudflare.ZoneSettingCacheLevelUpdateResponse, error) +- client.Zones.Settings.CacheLevels.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingCacheLevelListResponse, error) + +### ChallengeTtls + +Response Types: + +- cloudflare.ZoneSettingChallengeTtlUpdateResponse +- cloudflare.ZoneSettingChallengeTtlListResponse + +Methods: + +- client.Zones.Settings.ChallengeTtls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingChallengeTtlUpdateParams) (cloudflare.ZoneSettingChallengeTtlUpdateResponse, error) +- client.Zones.Settings.ChallengeTtls.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingChallengeTtlListResponse, error) + +### Ciphers + +Response Types: + +- cloudflare.ZoneSettingCipherUpdateResponse +- cloudflare.ZoneSettingCipherListResponse + +Methods: + +- client.Zones.Settings.Ciphers.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingCipherUpdateParams) (cloudflare.ZoneSettingCipherUpdateResponse, error) +- client.Zones.Settings.Ciphers.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingCipherListResponse, error) + +### DevelopmentModes + +Response Types: + +- cloudflare.ZoneSettingDevelopmentModeUpdateResponse +- cloudflare.ZoneSettingDevelopmentModeListResponse + +Methods: + +- client.Zones.Settings.DevelopmentModes.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingDevelopmentModeUpdateParams) (cloudflare.ZoneSettingDevelopmentModeUpdateResponse, error) +- client.Zones.Settings.DevelopmentModes.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingDevelopmentModeListResponse, error) + +### EarlyHints + +Response Types: + +- cloudflare.ZoneSettingEarlyHintUpdateResponse +- cloudflare.ZoneSettingEarlyHintListResponse + +Methods: + +- client.Zones.Settings.EarlyHints.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingEarlyHintUpdateParams) (cloudflare.ZoneSettingEarlyHintUpdateResponse, error) +- client.Zones.Settings.EarlyHints.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingEarlyHintListResponse, error) + +### EmailObfuscations + +Response Types: + +- cloudflare.ZoneSettingEmailObfuscationUpdateResponse +- cloudflare.ZoneSettingEmailObfuscationListResponse + +Methods: + +- client.Zones.Settings.EmailObfuscations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingEmailObfuscationUpdateParams) (cloudflare.ZoneSettingEmailObfuscationUpdateResponse, error) +- client.Zones.Settings.EmailObfuscations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingEmailObfuscationListResponse, error) + +### H2Prioritizations + +Response Types: + +- cloudflare.ZoneSettingH2PrioritizationUpdateResponse +- cloudflare.ZoneSettingH2PrioritizationListResponse + +Methods: + +- client.Zones.Settings.H2Prioritizations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingH2PrioritizationUpdateParams) (cloudflare.ZoneSettingH2PrioritizationUpdateResponse, error) +- client.Zones.Settings.H2Prioritizations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingH2PrioritizationListResponse, error) + +### HotlinkProtections + +Response Types: + +- cloudflare.ZoneSettingHotlinkProtectionUpdateResponse +- cloudflare.ZoneSettingHotlinkProtectionListResponse + +Methods: + +- client.Zones.Settings.HotlinkProtections.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingHotlinkProtectionUpdateParams) (cloudflare.ZoneSettingHotlinkProtectionUpdateResponse, error) +- client.Zones.Settings.HotlinkProtections.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingHotlinkProtectionListResponse, error) + +### Http2s + +Response Types: + +- cloudflare.ZoneSettingHttp2UpdateResponse +- cloudflare.ZoneSettingHttp2ListResponse + +Methods: + +- client.Zones.Settings.Http2s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingHttp2UpdateParams) (cloudflare.ZoneSettingHttp2UpdateResponse, error) +- client.Zones.Settings.Http2s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingHttp2ListResponse, error) + +### Http3s + +Response Types: + +- cloudflare.ZoneSettingHttp3UpdateResponse +- cloudflare.ZoneSettingHttp3ListResponse + +Methods: + +- client.Zones.Settings.Http3s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingHttp3UpdateParams) (cloudflare.ZoneSettingHttp3UpdateResponse, error) +- client.Zones.Settings.Http3s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingHttp3ListResponse, error) + +### ImageResizings + +Response Types: + +- cloudflare.ZoneSettingImageResizingUpdateResponse +- cloudflare.ZoneSettingImageResizingListResponse + +Methods: + +- client.Zones.Settings.ImageResizings.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingImageResizingUpdateParams) (cloudflare.ZoneSettingImageResizingUpdateResponse, error) +- client.Zones.Settings.ImageResizings.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingImageResizingListResponse, error) + +### IPGeolocations + +Response Types: + +- cloudflare.ZoneSettingIPGeolocationUpdateResponse +- cloudflare.ZoneSettingIPGeolocationListResponse + +Methods: + +- client.Zones.Settings.IPGeolocations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingIPGeolocationUpdateParams) (cloudflare.ZoneSettingIPGeolocationUpdateResponse, error) +- client.Zones.Settings.IPGeolocations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingIPGeolocationListResponse, error) + +### Ipv6s + +Response Types: + +- cloudflare.ZoneSettingIpv6UpdateResponse +- cloudflare.ZoneSettingIpv6ListResponse + +Methods: + +- client.Zones.Settings.Ipv6s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingIpv6UpdateParams) (cloudflare.ZoneSettingIpv6UpdateResponse, error) +- client.Zones.Settings.Ipv6s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingIpv6ListResponse, error) + +### MinTlsVersions + +Response Types: + +- cloudflare.ZoneSettingMinTlsVersionUpdateResponse +- cloudflare.ZoneSettingMinTlsVersionListResponse + +Methods: + +- client.Zones.Settings.MinTlsVersions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMinTlsVersionUpdateParams) (cloudflare.ZoneSettingMinTlsVersionUpdateResponse, error) +- client.Zones.Settings.MinTlsVersions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMinTlsVersionListResponse, error) + +### Minifies + +Response Types: + +- cloudflare.ZoneSettingMinifyUpdateResponse +- cloudflare.ZoneSettingMinifyListResponse + +Methods: + +- client.Zones.Settings.Minifies.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMinifyUpdateParams) (cloudflare.ZoneSettingMinifyUpdateResponse, error) +- client.Zones.Settings.Minifies.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMinifyListResponse, error) + +### Mirages + +Response Types: + +- cloudflare.ZoneSettingMirageUpdateResponse +- cloudflare.ZoneSettingMirageListResponse + +Methods: + +- client.Zones.Settings.Mirages.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMirageUpdateParams) (cloudflare.ZoneSettingMirageUpdateResponse, error) +- client.Zones.Settings.Mirages.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMirageListResponse, error) + +### MobileRedirects + +Response Types: + +- cloudflare.ZoneSettingMobileRedirectUpdateResponse +- cloudflare.ZoneSettingMobileRedirectListResponse + +Methods: + +- client.Zones.Settings.MobileRedirects.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMobileRedirectUpdateParams) (cloudflare.ZoneSettingMobileRedirectUpdateResponse, error) +- client.Zones.Settings.MobileRedirects.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMobileRedirectListResponse, error) + +### Nels + +Response Types: + +- cloudflare.ZoneSettingNelUpdateResponse +- cloudflare.ZoneSettingNelListResponse + +Methods: + +- client.Zones.Settings.Nels.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingNelUpdateParams) (cloudflare.ZoneSettingNelUpdateResponse, error) +- client.Zones.Settings.Nels.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingNelListResponse, error) + +### OpportunisticEncryptions + +Response Types: + +- cloudflare.ZoneSettingOpportunisticEncryptionUpdateResponse +- cloudflare.ZoneSettingOpportunisticEncryptionListResponse + +Methods: + +- client.Zones.Settings.OpportunisticEncryptions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOpportunisticEncryptionUpdateParams) (cloudflare.ZoneSettingOpportunisticEncryptionUpdateResponse, error) +- client.Zones.Settings.OpportunisticEncryptions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOpportunisticEncryptionListResponse, error) + +### OpportunisticOnions + +Response Types: + +- cloudflare.ZoneSettingOpportunisticOnionUpdateResponse +- cloudflare.ZoneSettingOpportunisticOnionListResponse + +Methods: + +- client.Zones.Settings.OpportunisticOnions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOpportunisticOnionUpdateParams) (cloudflare.ZoneSettingOpportunisticOnionUpdateResponse, error) +- client.Zones.Settings.OpportunisticOnions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOpportunisticOnionListResponse, error) + +### OrangeToOranges + +Response Types: + +- cloudflare.ZoneSettingOrangeToOrangeUpdateResponse +- cloudflare.ZoneSettingOrangeToOrangeListResponse + +Methods: + +- client.Zones.Settings.OrangeToOranges.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOrangeToOrangeUpdateParams) (cloudflare.ZoneSettingOrangeToOrangeUpdateResponse, error) +- client.Zones.Settings.OrangeToOranges.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOrangeToOrangeListResponse, error) + +### OriginErrorPagePassThrus + +Response Types: + +- cloudflare.ZoneSettingOriginErrorPagePassThrusUpdateResponse +- cloudflare.ZoneSettingOriginErrorPagePassThrusListResponse + +Methods: + +- client.Zones.Settings.OriginErrorPagePassThrus.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOriginErrorPagePassThrusUpdateParams) (cloudflare.ZoneSettingOriginErrorPagePassThrusUpdateResponse, error) +- client.Zones.Settings.OriginErrorPagePassThrus.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOriginErrorPagePassThrusListResponse, error) + +### OriginMaxHTTPVersions + +Response Types: + +- cloudflare.ZoneSettingOriginMaxHTTPVersionUpdateResponse +- cloudflare.ZoneSettingOriginMaxHTTPVersionListResponse + +Methods: + +- client.Zones.Settings.OriginMaxHTTPVersions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOriginMaxHTTPVersionUpdateParams) (cloudflare.ZoneSettingOriginMaxHTTPVersionUpdateResponse, error) +- client.Zones.Settings.OriginMaxHTTPVersions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOriginMaxHTTPVersionListResponse, error) + +### Polishes + +Response Types: + +- cloudflare.ZoneSettingPolishUpdateResponse +- cloudflare.ZoneSettingPolishListResponse + +Methods: + +- client.Zones.Settings.Polishes.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingPolishUpdateParams) (cloudflare.ZoneSettingPolishUpdateResponse, error) +- client.Zones.Settings.Polishes.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingPolishListResponse, error) + +### PrefetchPreloads + +Response Types: + +- cloudflare.ZoneSettingPrefetchPreloadUpdateResponse +- cloudflare.ZoneSettingPrefetchPreloadListResponse + +Methods: + +- client.Zones.Settings.PrefetchPreloads.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingPrefetchPreloadUpdateParams) (cloudflare.ZoneSettingPrefetchPreloadUpdateResponse, error) +- client.Zones.Settings.PrefetchPreloads.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingPrefetchPreloadListResponse, error) + +### ProxyReadTimeouts + +Response Types: + +- cloudflare.ZoneSettingProxyReadTimeoutUpdateResponse +- cloudflare.ZoneSettingProxyReadTimeoutListResponse + +Methods: + +- client.Zones.Settings.ProxyReadTimeouts.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingProxyReadTimeoutUpdateParams) (cloudflare.ZoneSettingProxyReadTimeoutUpdateResponse, error) +- client.Zones.Settings.ProxyReadTimeouts.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingProxyReadTimeoutListResponse, error) + +### PseudoIpv4s + +Response Types: + +- cloudflare.ZoneSettingPseudoIpv4UpdateResponse +- cloudflare.ZoneSettingPseudoIpv4ListResponse + +Methods: + +- client.Zones.Settings.PseudoIpv4s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingPseudoIpv4UpdateParams) (cloudflare.ZoneSettingPseudoIpv4UpdateResponse, error) +- client.Zones.Settings.PseudoIpv4s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingPseudoIpv4ListResponse, error) + +### ResponseBufferings + +Response Types: + +- cloudflare.ZoneSettingResponseBufferingUpdateResponse +- cloudflare.ZoneSettingResponseBufferingListResponse + +Methods: + +- client.Zones.Settings.ResponseBufferings.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingResponseBufferingUpdateParams) (cloudflare.ZoneSettingResponseBufferingUpdateResponse, error) +- client.Zones.Settings.ResponseBufferings.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingResponseBufferingListResponse, error) + +### RocketLoaders + +Response Types: + +- cloudflare.ZoneSettingRocketLoaderUpdateResponse +- cloudflare.ZoneSettingRocketLoaderListResponse + +Methods: + +- client.Zones.Settings.RocketLoaders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingRocketLoaderUpdateParams) (cloudflare.ZoneSettingRocketLoaderUpdateResponse, error) +- client.Zones.Settings.RocketLoaders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingRocketLoaderListResponse, error) + +### SecurityHeaders + +Response Types: + +- cloudflare.ZoneSettingSecurityHeaderUpdateResponse +- cloudflare.ZoneSettingSecurityHeaderListResponse + +Methods: + +- client.Zones.Settings.SecurityHeaders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSecurityHeaderUpdateParams) (cloudflare.ZoneSettingSecurityHeaderUpdateResponse, error) +- client.Zones.Settings.SecurityHeaders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSecurityHeaderListResponse, error) + +### SecurityLevels + +Response Types: + +- cloudflare.ZoneSettingSecurityLevelUpdateResponse +- cloudflare.ZoneSettingSecurityLevelListResponse + +Methods: + +- client.Zones.Settings.SecurityLevels.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSecurityLevelUpdateParams) (cloudflare.ZoneSettingSecurityLevelUpdateResponse, error) +- client.Zones.Settings.SecurityLevels.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSecurityLevelListResponse, error) + +### ServerSideExcludes + +Response Types: + +- cloudflare.ZoneSettingServerSideExcludeUpdateResponse +- cloudflare.ZoneSettingServerSideExcludeListResponse + +Methods: + +- client.Zones.Settings.ServerSideExcludes.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingServerSideExcludeUpdateParams) (cloudflare.ZoneSettingServerSideExcludeUpdateResponse, error) +- client.Zones.Settings.ServerSideExcludes.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingServerSideExcludeListResponse, error) + +### SortQueryStringForCaches + +Response Types: + +- cloudflare.ZoneSettingSortQueryStringForCachUpdateResponse +- cloudflare.ZoneSettingSortQueryStringForCachListResponse + +Methods: + +- client.Zones.Settings.SortQueryStringForCaches.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSortQueryStringForCachUpdateParams) (cloudflare.ZoneSettingSortQueryStringForCachUpdateResponse, error) +- client.Zones.Settings.SortQueryStringForCaches.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSortQueryStringForCachListResponse, error) -- cloudflare.SessionAffinity +### Ssls Response Types: -- cloudflare.SessionAffinity -- cloudflare.ZoneAPIResponseSingleID -- cloudflare.ZoneNewResponse -- cloudflare.ZoneGetResponse -- cloudflare.ZoneUpdateResponse -- cloudflare.ZoneListResponse +- cloudflare.ZoneSettingSslUpdateResponse +- cloudflare.ZoneSettingSslListResponse Methods: -- client.Zones.New(ctx context.Context, body cloudflare.ZoneNewParams) (cloudflare.ZoneNewResponse, error) -- client.Zones.Get(ctx context.Context, identifier string) (cloudflare.ZoneGetResponse, error) -- client.Zones.Update(ctx context.Context, identifier string, body cloudflare.ZoneUpdateParams) (cloudflare.ZoneUpdateResponse, error) -- client.Zones.List(ctx context.Context, query cloudflare.ZoneListParams) (cloudflare.ZoneListResponse, error) -- client.Zones.Delete(ctx context.Context, identifier string) (cloudflare.ZoneAPIResponseSingleID, error) +- client.Zones.Settings.Ssls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSslUpdateParams) (cloudflare.ZoneSettingSslUpdateResponse, error) +- client.Zones.Settings.Ssls.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSslListResponse, error) -## LoadBalancers +### SslRecommenders Response Types: -- cloudflare.IDResponseZtdTboH6 -- cloudflare.LoadBalancer -- cloudflare.LoadBalancerCollection +- cloudflare.ZoneSettingSslRecommenderUpdateResponse +- cloudflare.ZoneSettingSslRecommenderListResponse Methods: -- client.Zones.LoadBalancers.New(ctx context.Context, identifier interface{}, body cloudflare.ZoneLoadBalancerNewParams) (cloudflare.LoadBalancer, error) -- client.Zones.LoadBalancers.Get(ctx context.Context, identifier1 interface{}, identifier interface{}) (cloudflare.LoadBalancer, error) -- client.Zones.LoadBalancers.Update(ctx context.Context, identifier1 interface{}, identifier interface{}, body cloudflare.ZoneLoadBalancerUpdateParams) (cloudflare.LoadBalancer, error) -- client.Zones.LoadBalancers.List(ctx context.Context, identifier interface{}) (cloudflare.LoadBalancerCollection, error) -- client.Zones.LoadBalancers.Delete(ctx context.Context, identifier1 interface{}, identifier interface{}) (cloudflare.IDResponseZtdTboH6, error) +- client.Zones.Settings.SslRecommenders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSslRecommenderUpdateParams) (cloudflare.ZoneSettingSslRecommenderUpdateResponse, error) +- client.Zones.Settings.SslRecommenders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSslRecommenderListResponse, error) -## Dnssecs +### Tls1_3s Response Types: -- cloudflare.DnssecSingle +- cloudflare.ZoneSettingTls1_3UpdateResponse +- cloudflare.ZoneSettingTls1_3ListResponse Methods: -- client.Zones.Dnssecs.Get(ctx context.Context, zoneIdentifier string) (cloudflare.DnssecSingle, error) -- client.Zones.Dnssecs.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneDnssecUpdateParams) (cloudflare.DnssecSingle, error) +- client.Zones.Settings.Tls1_3s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingTls1_3UpdateParams) (cloudflare.ZoneSettingTls1_3UpdateResponse, error) +- client.Zones.Settings.Tls1_3s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingTls1_3ListResponse, error) -## RateLimits +### TlsClientAuths Response Types: -- cloudflare.RatelimitCollection -- cloudflare.RatelimitSingle +- cloudflare.ZoneSettingTlsClientAuthUpdateResponse +- cloudflare.ZoneSettingTlsClientAuthListResponse Methods: -- client.Zones.RateLimits.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.RatelimitSingle, error) -- client.Zones.RateLimits.List(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneRateLimitListParams) (cloudflare.RatelimitCollection, error) +- client.Zones.Settings.TlsClientAuths.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingTlsClientAuthUpdateParams) (cloudflare.ZoneSettingTlsClientAuthUpdateResponse, error) +- client.Zones.Settings.TlsClientAuths.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingTlsClientAuthListResponse, error) + +### TrueClientIPHeaders -## Settings +Response Types: + +- cloudflare.ZoneSettingTrueClientIPHeaderUpdateResponse +- cloudflare.ZoneSettingTrueClientIPHeaderListResponse -Params Types: +Methods: + +- client.Zones.Settings.TrueClientIPHeaders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingTrueClientIPHeaderUpdateParams) (cloudflare.ZoneSettingTrueClientIPHeaderUpdateResponse, error) +- client.Zones.Settings.TrueClientIPHeaders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingTrueClientIPHeaderListResponse, error) -- cloudflare.ZeroRttParam -- cloudflare.ZeroRttValue +### Wafs Response Types: -- cloudflare.ZeroRtt -- cloudflare.ZeroRttValue -- cloudflare.ZoneSettingsCollection +- cloudflare.ZoneSettingWafUpdateResponse +- cloudflare.ZoneSettingWafListResponse Methods: -- client.Zones.Settings.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingsCollection, error) -- client.Zones.Settings.Edit(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingEditParams) (cloudflare.ZoneSettingsCollection, error) +- client.Zones.Settings.Wafs.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingWafUpdateParams) (cloudflare.ZoneSettingWafUpdateResponse, error) +- client.Zones.Settings.Wafs.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingWafListResponse, error) -### AdvancedDdos +### Webps Response Types: -- cloudflare.ZoneSettingAdvancedDdoListResponse +- cloudflare.ZoneSettingWebpUpdateResponse +- cloudflare.ZoneSettingWebpListResponse Methods: -- client.Zones.Settings.AdvancedDdos.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAdvancedDdoListResponse, error) +- client.Zones.Settings.Webps.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingWebpUpdateParams) (cloudflare.ZoneSettingWebpUpdateResponse, error) +- client.Zones.Settings.Webps.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingWebpListResponse, error) -### AlwaysOnlines +### Websockets Response Types: -- cloudflare.ZoneSettingAlwaysOnlineUpdateResponse -- cloudflare.ZoneSettingAlwaysOnlineListResponse +- cloudflare.ZoneSettingWebsocketUpdateResponse +- cloudflare.ZoneSettingWebsocketListResponse Methods: -- client.Zones.Settings.AlwaysOnlines.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAlwaysOnlineUpdateParams) (cloudflare.ZoneSettingAlwaysOnlineUpdateResponse, error) -- client.Zones.Settings.AlwaysOnlines.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAlwaysOnlineListResponse, error) +- client.Zones.Settings.Websockets.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingWebsocketUpdateParams) (cloudflare.ZoneSettingWebsocketUpdateResponse, error) +- client.Zones.Settings.Websockets.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingWebsocketListResponse, error) -### AlwaysUseHTTPs +### Fonts Response Types: -- cloudflare.ZoneSettingAlwaysUseHTTPUpdateResponse -- cloudflare.ZoneSettingAlwaysUseHTTPListResponse +- cloudflare.CloudflareFonts +- cloudflare.ZoneSettingFontGetResponse +- cloudflare.ZoneSettingFontUpdateResponse Methods: -- client.Zones.Settings.AlwaysUseHTTPs.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAlwaysUseHTTPUpdateParams) (cloudflare.ZoneSettingAlwaysUseHTTPUpdateResponse, error) -- client.Zones.Settings.AlwaysUseHTTPs.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAlwaysUseHTTPListResponse, error) +- client.Zones.Settings.Fonts.Get(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingFontGetResponse, error) +- client.Zones.Settings.Fonts.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingFontUpdateParams) (cloudflare.ZoneSettingFontUpdateResponse, error) -### AutomaticHTTPsRewrites +### Zaraz + +#### Config Response Types: -- cloudflare.ZoneSettingAutomaticHTTPsRewriteUpdateResponse -- cloudflare.ZoneSettingAutomaticHTTPsRewriteListResponse +- cloudflare.ZarazConfigResponse Methods: -- client.Zones.Settings.AutomaticHTTPsRewrites.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAutomaticHTTPsRewriteUpdateParams) (cloudflare.ZoneSettingAutomaticHTTPsRewriteUpdateResponse, error) -- client.Zones.Settings.AutomaticHTTPsRewrites.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAutomaticHTTPsRewriteListResponse, error) +- client.Zones.Settings.Zaraz.Config.Get(ctx context.Context, zoneIdentifier string) (cloudflare.ZarazConfigResponse, error) +- client.Zones.Settings.Zaraz.Config.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingZarazConfigUpdateParams) (cloudflare.ZarazConfigResponse, error) -### AutomaticPlatformOptimizations +#### Default + +Methods: + +- client.Zones.Settings.Zaraz.Default.Get(ctx context.Context, zoneIdentifier string) (cloudflare.ZarazConfigResponse, error) + +#### Export Response Types: -- cloudflare.ZoneSettingAutomaticPlatformOptimizationUpdateResponse -- cloudflare.ZoneSettingAutomaticPlatformOptimizationListResponse +- cloudflare.ZoneSettingZarazExportGetResponse Methods: -- client.Zones.Settings.AutomaticPlatformOptimizations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingAutomaticPlatformOptimizationUpdateParams) (cloudflare.ZoneSettingAutomaticPlatformOptimizationUpdateResponse, error) -- client.Zones.Settings.AutomaticPlatformOptimizations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingAutomaticPlatformOptimizationListResponse, error) +- client.Zones.Settings.Zaraz.Export.Get(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingZarazExportGetResponse, error) -### Brotli +#### History Response Types: -- cloudflare.ZoneSettingBrotliUpdateResponse -- cloudflare.ZoneSettingBrotliListResponse +- cloudflare.ZoneSettingZarazHistoryListResponse + +Methods: + +- client.Zones.Settings.Zaraz.History.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingZarazHistoryUpdateParams) (cloudflare.ZarazConfigResponse, error) +- client.Zones.Settings.Zaraz.History.List(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneSettingZarazHistoryListParams) (cloudflare.ZoneSettingZarazHistoryListResponse, error) + +#### ConfigHistory + +Response Types: + +- cloudflare.ZoneSettingZarazConfigHistoryGetResponse + +Methods: + +- client.Zones.Settings.Zaraz.ConfigHistory.Get(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneSettingZarazConfigHistoryGetParams) (cloudflare.ZoneSettingZarazConfigHistoryGetResponse, error) + +#### Publish + +Response Types: + +- cloudflare.ZoneSettingZarazPublishNewResponse + +Methods: + +- client.Zones.Settings.Zaraz.Publish.New(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingZarazPublishNewParams) (cloudflare.ZoneSettingZarazPublishNewResponse, error) + +## WaitingRooms + +Response Types: + +- cloudflare.SingleWaitingRoomResponse +- cloudflare.ZoneWaitingRoomDeleteResponse +- cloudflare.ZoneWaitingRoomWaitingRoomListWaitingRoomsResponse + +Methods: + +- client.Zones.WaitingRooms.Get(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}) (cloudflare.SingleWaitingRoomResponse, error) +- client.Zones.WaitingRooms.Update(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body cloudflare.ZoneWaitingRoomUpdateParams) (cloudflare.SingleWaitingRoomResponse, error) +- client.Zones.WaitingRooms.Delete(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}) (cloudflare.ZoneWaitingRoomDeleteResponse, error) +- client.Zones.WaitingRooms.Patch(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body cloudflare.ZoneWaitingRoomPatchParams) (cloudflare.SingleWaitingRoomResponse, error) +- client.Zones.WaitingRooms.WaitingRoomNewWaitingRoom(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParams) (cloudflare.SingleWaitingRoomResponse, error) +- client.Zones.WaitingRooms.WaitingRoomListWaitingRooms(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneWaitingRoomWaitingRoomListWaitingRoomsResponse, error) + +### Previews + +Response Types: + +- cloudflare.ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponse + +Methods: + +- client.Zones.WaitingRooms.Previews.WaitingRoomNewACustomWaitingRoomPagePreview(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewParams) (cloudflare.ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponse, error) + +### Events + +Response Types: + +- cloudflare.EventResponse +- cloudflare.ZoneWaitingRoomEventDeleteResponse +- cloudflare.ZoneWaitingRoomEventWaitingRoomListEventsResponse + +Methods: + +- client.Zones.WaitingRooms.Events.Get(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}) (cloudflare.EventResponse, error) +- client.Zones.WaitingRooms.Events.Update(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}, body cloudflare.ZoneWaitingRoomEventUpdateParams) (cloudflare.EventResponse, error) +- client.Zones.WaitingRooms.Events.Delete(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}) (cloudflare.ZoneWaitingRoomEventDeleteResponse, error) +- client.Zones.WaitingRooms.Events.Patch(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}, body cloudflare.ZoneWaitingRoomEventPatchParams) (cloudflare.EventResponse, error) +- client.Zones.WaitingRooms.Events.WaitingRoomNewEvent(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body cloudflare.ZoneWaitingRoomEventWaitingRoomNewEventParams) (cloudflare.EventResponse, error) +- client.Zones.WaitingRooms.Events.WaitingRoomListEvents(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}) (cloudflare.ZoneWaitingRoomEventWaitingRoomListEventsResponse, error) + +#### Details + +Response Types: + +- cloudflare.ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponse + +Methods: + +- client.Zones.WaitingRooms.Events.Details.WaitingRoomPreviewActiveEventDetails(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}) (cloudflare.ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponse, error) + +### Rules + +Response Types: + +- cloudflare.ZoneWaitingRoomRuleUpdateResponse +- cloudflare.ZoneWaitingRoomRuleDeleteResponse +- cloudflare.ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponse +- cloudflare.ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponse +- cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponse + +Methods: + +- client.Zones.WaitingRooms.Rules.Update(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, ruleID string, body cloudflare.ZoneWaitingRoomRuleUpdateParams) (cloudflare.ZoneWaitingRoomRuleUpdateResponse, error) +- client.Zones.WaitingRooms.Rules.Delete(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, ruleID string) (cloudflare.ZoneWaitingRoomRuleDeleteResponse, error) +- client.Zones.WaitingRooms.Rules.WaitingRoomNewWaitingRoomRule(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body cloudflare.ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParams) (cloudflare.ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponse, error) +- client.Zones.WaitingRooms.Rules.WaitingRoomListWaitingRoomRules(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}) (cloudflare.ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponse, error) +- client.Zones.WaitingRooms.Rules.WaitingRoomReplaceWaitingRoomRules(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParams) (cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponse, error) + +### Statuses + +Response Types: + +- cloudflare.ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponse + +Methods: + +- client.Zones.WaitingRooms.Statuses.WaitingRoomGetWaitingRoomStatus(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}) (cloudflare.ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponse, error) + +### Settings + +Methods: + +- client.Zones.WaitingRooms.Settings.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneWaitingRoomSettingUpdateParams) (shared.WaitingRoomSettingsResponse, error) +- client.Zones.WaitingRooms.Settings.List(ctx context.Context, zoneIdentifier string) (shared.WaitingRoomSettingsResponse, error) +- client.Zones.WaitingRooms.Settings.Patch(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneWaitingRoomSettingPatchParams) (shared.WaitingRoomSettingsResponse, error) + +## Web3s + +### Hostnames + +Response Types: + +- cloudflare.ZoneWeb3HostnameGetResponse +- cloudflare.ZoneWeb3HostnameUpdateResponse +- cloudflare.ZoneWeb3HostnameDeleteResponse +- cloudflare.ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponse +- cloudflare.ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponse + +Methods: + +- client.Zones.Web3s.Hostnames.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneWeb3HostnameGetResponse, error) +- client.Zones.Web3s.Hostnames.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneWeb3HostnameUpdateParams) (cloudflare.ZoneWeb3HostnameUpdateResponse, error) +- client.Zones.Web3s.Hostnames.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneWeb3HostnameDeleteResponse, error) +- client.Zones.Web3s.Hostnames.Web3HostnameNewWeb3Hostname(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParams) (cloudflare.ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponse, error) +- client.Zones.Web3s.Hostnames.Web3HostnameListWeb3Hostnames(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponse, error) + +#### IpfsUniversalPaths + +##### ContentLists + +Response Types: + +- cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponse +- cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponse + +Methods: + +- client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Web3HostnameIpfsUniversalPathGatewayContentListDetails(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponse, error) +- client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Web3HostnameUpdateIpfsUniversalPathGatewayContentList(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParams) (cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponse, error) + +###### Entries + +Response Types: + +- cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponse +- cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponse +- cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponse +- cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponse +- cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponse + +Methods: + +- client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Get(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string) (cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponse, error) +- client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Update(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, body cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParams) (cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponse, error) +- client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Delete(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string) (cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponse, error) +- client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Web3HostnameNewIpfsUniversalPathGatewayContentListEntry(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParams) (cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponse, error) +- client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Web3HostnameListIpfsUniversalPathGatewayContentListEntries(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponse, error) + +## Workers + +### Scripts + +Response Types: + +- cloudflare.ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponse + +Methods: + +- client.Zones.Workers.Scripts.List(ctx context.Context, zoneIdentifier string) (http.Response, error) +- client.Zones.Workers.Scripts.Delete(ctx context.Context, zoneIdentifier string) error +- client.Zones.Workers.Scripts.WorkerScriptDeprecatedUploadWorker(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponse, error) + +#### Bindings + +Response Types: + +- cloudflare.ZoneWorkerScriptBindingListResponse + +Methods: + +- client.Zones.Workers.Scripts.Bindings.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneWorkerScriptBindingListResponse, error) + +### Filters + +Response Types: + +- cloudflare.ZoneWorkerFilterUpdateResponse +- cloudflare.ZoneWorkerFilterDeleteResponse +- cloudflare.ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponse +- cloudflare.ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponse + +Methods: + +- client.Zones.Workers.Filters.Update(ctx context.Context, zoneID string, filterID string, body cloudflare.ZoneWorkerFilterUpdateParams) (cloudflare.ZoneWorkerFilterUpdateResponse, error) +- client.Zones.Workers.Filters.Delete(ctx context.Context, zoneID string, filterID string) (cloudflare.ZoneWorkerFilterDeleteResponse, error) +- client.Zones.Workers.Filters.WorkerFiltersDeprecatedNewFilter(ctx context.Context, zoneID string, body cloudflare.ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterParams) (cloudflare.ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponse, error) +- client.Zones.Workers.Filters.WorkerFiltersDeprecatedListFilters(ctx context.Context, zoneID string) (cloudflare.ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponse, error) + +### Routes + +Response Types: + +- cloudflare.ZoneWorkerRouteGetResponse +- cloudflare.ZoneWorkerRouteUpdateResponse +- cloudflare.ZoneWorkerRouteDeleteResponse +- cloudflare.ZoneWorkerRouteWorkerRoutesNewRouteResponse +- cloudflare.ZoneWorkerRouteWorkerRoutesListRoutesResponse + +Methods: + +- client.Zones.Workers.Routes.Get(ctx context.Context, zoneID string, routeID string) (cloudflare.ZoneWorkerRouteGetResponse, error) +- client.Zones.Workers.Routes.Update(ctx context.Context, zoneID string, routeID string, body cloudflare.ZoneWorkerRouteUpdateParams) (cloudflare.ZoneWorkerRouteUpdateResponse, error) +- client.Zones.Workers.Routes.Delete(ctx context.Context, zoneID string, routeID string) (cloudflare.ZoneWorkerRouteDeleteResponse, error) +- client.Zones.Workers.Routes.WorkerRoutesNewRoute(ctx context.Context, zoneID string, body cloudflare.ZoneWorkerRouteWorkerRoutesNewRouteParams) (cloudflare.ZoneWorkerRouteWorkerRoutesNewRouteResponse, error) +- client.Zones.Workers.Routes.WorkerRoutesListRoutes(ctx context.Context, zoneID string) (cloudflare.ZoneWorkerRouteWorkerRoutesListRoutesResponse, error) + +## ActivationChecks + +Response Types: + +- cloudflare.ZoneActivationCheckPutZonesZoneIDActivationCheckResponse + +Methods: + +- client.Zones.ActivationChecks.PutZonesZoneIDActivationCheck(ctx context.Context, zoneID string) (cloudflare.ZoneActivationCheckPutZonesZoneIDActivationCheckResponse, error) + +## APIGateway + +### Configurations + +Response Types: + +- cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponse +- cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponse + +Methods: + +- client.Zones.APIGateway.Configurations.APIShieldSettingsGetInformationAboutSpecificConfigurationProperties(ctx context.Context, zoneID string, query cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParams) (cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponse, error) +- client.Zones.APIGateway.Configurations.APIShieldSettingsSetConfigurationProperties(ctx context.Context, zoneID string, body cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParams) (cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponse, error) + +### Discovery + +Response Types: + +- cloudflare.ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponse + +Methods: + +- client.Zones.APIGateway.Discovery.APIShieldEndpointManagementGetAPIDiscoveryResultsForAZone(ctx context.Context, zoneID string) (cloudflare.ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponse, error) + +#### Operations + +Response Types: + +- cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateResponse +- cloudflare.ZoneAPIGatewayDiscoveryOperationListResponse +- cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateStateResponse + +Methods: + +- client.Zones.APIGateway.Discovery.Operations.Update(ctx context.Context, zoneID string, body cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateParams) (cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateResponse, error) +- client.Zones.APIGateway.Discovery.Operations.List(ctx context.Context, zoneID string, query cloudflare.ZoneAPIGatewayDiscoveryOperationListParams) (cloudflare.ZoneAPIGatewayDiscoveryOperationListResponse, error) +- client.Zones.APIGateway.Discovery.Operations.UpdateState(ctx context.Context, zoneID string, operationID string, body cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateStateParams) (cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateStateResponse, error) + +### Schemas + +Response Types: + +- cloudflare.ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponse + +Methods: + +- client.Zones.APIGateway.Schemas.APIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemas(ctx context.Context, zoneID string, query cloudflare.ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParams) (cloudflare.ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponse, error) + +### Settings + +#### SchemaValidations + +Response Types: + +- cloudflare.ZoneAPIGatewaySettingSchemaValidationGetResponse +- cloudflare.ZoneAPIGatewaySettingSchemaValidationUpdateResponse +- cloudflare.ZoneAPIGatewaySettingSchemaValidationPatchResponse + +Methods: + +- client.Zones.APIGateway.Settings.SchemaValidations.Get(ctx context.Context, zoneID string) (cloudflare.ZoneAPIGatewaySettingSchemaValidationGetResponse, error) +- client.Zones.APIGateway.Settings.SchemaValidations.Update(ctx context.Context, zoneID string, body cloudflare.ZoneAPIGatewaySettingSchemaValidationUpdateParams) (cloudflare.ZoneAPIGatewaySettingSchemaValidationUpdateResponse, error) +- client.Zones.APIGateway.Settings.SchemaValidations.Patch(ctx context.Context, zoneID string, body cloudflare.ZoneAPIGatewaySettingSchemaValidationPatchParams) (cloudflare.ZoneAPIGatewaySettingSchemaValidationPatchResponse, error) + +### UserSchemas + +Response Types: + +- cloudflare.ZoneAPIGatewayUserSchemaNewResponse +- cloudflare.ZoneAPIGatewayUserSchemaGetResponse +- cloudflare.ZoneAPIGatewayUserSchemaUpdateResponse +- cloudflare.ZoneAPIGatewayUserSchemaListResponse +- cloudflare.ZoneAPIGatewayUserSchemaDeleteResponse Methods: -- client.Zones.Settings.Brotli.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingBrotliUpdateParams) (cloudflare.ZoneSettingBrotliUpdateResponse, error) -- client.Zones.Settings.Brotli.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingBrotliListResponse, error) +- client.Zones.APIGateway.UserSchemas.New(ctx context.Context, zoneID string, body cloudflare.ZoneAPIGatewayUserSchemaNewParams) (cloudflare.ZoneAPIGatewayUserSchemaNewResponse, error) +- client.Zones.APIGateway.UserSchemas.Get(ctx context.Context, zoneID string, schemaID string, query cloudflare.ZoneAPIGatewayUserSchemaGetParams) (cloudflare.ZoneAPIGatewayUserSchemaGetResponse, error) +- client.Zones.APIGateway.UserSchemas.Update(ctx context.Context, zoneID string, schemaID string, body cloudflare.ZoneAPIGatewayUserSchemaUpdateParams) (cloudflare.ZoneAPIGatewayUserSchemaUpdateResponse, error) +- client.Zones.APIGateway.UserSchemas.List(ctx context.Context, zoneID string, query cloudflare.ZoneAPIGatewayUserSchemaListParams) (cloudflare.ZoneAPIGatewayUserSchemaListResponse, error) +- client.Zones.APIGateway.UserSchemas.Delete(ctx context.Context, zoneID string, schemaID string) (cloudflare.ZoneAPIGatewayUserSchemaDeleteResponse, error) -### BrowserCacheTtls +#### Operations Response Types: -- cloudflare.ZoneSettingBrowserCacheTtlUpdateResponse -- cloudflare.ZoneSettingBrowserCacheTtlListResponse +- cloudflare.ZoneAPIGatewayUserSchemaOperationListResponse Methods: -- client.Zones.Settings.BrowserCacheTtls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingBrowserCacheTtlUpdateParams) (cloudflare.ZoneSettingBrowserCacheTtlUpdateResponse, error) -- client.Zones.Settings.BrowserCacheTtls.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingBrowserCacheTtlListResponse, error) +- client.Zones.APIGateway.UserSchemas.Operations.List(ctx context.Context, zoneID string, schemaID string, query cloudflare.ZoneAPIGatewayUserSchemaOperationListParams) (cloudflare.ZoneAPIGatewayUserSchemaOperationListResponse, error) -### BrowserChecks +## ManagedHeaders Response Types: -- cloudflare.ZoneSettingBrowserCheckUpdateResponse -- cloudflare.ZoneSettingBrowserCheckListResponse +- cloudflare.ZoneManagedHeaderListResponse +- cloudflare.ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponse Methods: -- client.Zones.Settings.BrowserChecks.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingBrowserCheckUpdateParams) (cloudflare.ZoneSettingBrowserCheckUpdateResponse, error) -- client.Zones.Settings.BrowserChecks.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingBrowserCheckListResponse, error) +- client.Zones.ManagedHeaders.List(ctx context.Context, zoneID string) (cloudflare.ZoneManagedHeaderListResponse, error) +- client.Zones.ManagedHeaders.ManagedTransformsUpdateStatusOfManagedTransforms(ctx context.Context, zoneID string, body cloudflare.ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParams) (cloudflare.ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponse, error) -### CacheLevels +## Rulesets Response Types: -- cloudflare.ZoneSettingCacheLevelUpdateResponse -- cloudflare.ZoneSettingCacheLevelListResponse +- cloudflare.ZoneRulesetGetResponse +- cloudflare.ZoneRulesetUpdateResponse +- cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetResponse +- cloudflare.ZoneRulesetZoneRulesetsListZoneRulesetsResponse Methods: -- client.Zones.Settings.CacheLevels.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingCacheLevelUpdateParams) (cloudflare.ZoneSettingCacheLevelUpdateResponse, error) -- client.Zones.Settings.CacheLevels.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingCacheLevelListResponse, error) +- client.Zones.Rulesets.Get(ctx context.Context, zoneID string, rulesetID string) (cloudflare.ZoneRulesetGetResponse, error) +- client.Zones.Rulesets.Update(ctx context.Context, zoneID string, rulesetID string, body cloudflare.ZoneRulesetUpdateParams) (cloudflare.ZoneRulesetUpdateResponse, error) +- client.Zones.Rulesets.Delete(ctx context.Context, zoneID string, rulesetID string) error +- client.Zones.Rulesets.ZoneRulesetsNewAZoneRuleset(ctx context.Context, zoneID string, body cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParams) (cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetResponse, error) +- client.Zones.Rulesets.ZoneRulesetsListZoneRulesets(ctx context.Context, zoneID string) (cloudflare.ZoneRulesetZoneRulesetsListZoneRulesetsResponse, error) -### ChallengeTtls +### Phases + +#### Entrypoints Response Types: -- cloudflare.ZoneSettingChallengeTtlUpdateResponse -- cloudflare.ZoneSettingChallengeTtlListResponse +- cloudflare.ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponse +- cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponse Methods: -- client.Zones.Settings.ChallengeTtls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingChallengeTtlUpdateParams) (cloudflare.ZoneSettingChallengeTtlUpdateResponse, error) -- client.Zones.Settings.ChallengeTtls.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingChallengeTtlListResponse, error) +- client.Zones.Rulesets.Phases.Entrypoints.TransformRulesListTransformRules(ctx context.Context, zoneID string, rulesetPhase cloudflare.ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase) (cloudflare.ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponse, error) +- client.Zones.Rulesets.Phases.Entrypoints.TransformRulesUpdateTransformRules(ctx context.Context, zoneID string, rulesetPhase cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase, body cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParams) (cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponse, error) -### Ciphers +##### Versions Response Types: -- cloudflare.ZoneSettingCipherUpdateResponse -- cloudflare.ZoneSettingCipherListResponse +- cloudflare.ZoneRulesetPhaseEntrypointVersionGetResponse +- cloudflare.ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponse Methods: -- client.Zones.Settings.Ciphers.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingCipherUpdateParams) (cloudflare.ZoneSettingCipherUpdateResponse, error) -- client.Zones.Settings.Ciphers.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingCipherListResponse, error) +- client.Zones.Rulesets.Phases.Entrypoints.Versions.Get(ctx context.Context, zoneID string, rulesetPhase cloudflare.ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase, rulesetVersion string) (cloudflare.ZoneRulesetPhaseEntrypointVersionGetResponse, error) +- client.Zones.Rulesets.Phases.Entrypoints.Versions.ZoneRulesetsListAZoneEntryPointRulesetSVersions(ctx context.Context, zoneID string, rulesetPhase cloudflare.ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase) (cloudflare.ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponse, error) -### DevelopmentModes +### Rules Response Types: -- cloudflare.ZoneSettingDevelopmentModeUpdateResponse -- cloudflare.ZoneSettingDevelopmentModeListResponse +- cloudflare.ZoneRulesetRuleUpdateResponse +- cloudflare.ZoneRulesetRuleDeleteResponse +- cloudflare.ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponse Methods: -- client.Zones.Settings.DevelopmentModes.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingDevelopmentModeUpdateParams) (cloudflare.ZoneSettingDevelopmentModeUpdateResponse, error) -- client.Zones.Settings.DevelopmentModes.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingDevelopmentModeListResponse, error) +- client.Zones.Rulesets.Rules.Update(ctx context.Context, zoneID string, rulesetID string, ruleID string, body cloudflare.ZoneRulesetRuleUpdateParams) (cloudflare.ZoneRulesetRuleUpdateResponse, error) +- client.Zones.Rulesets.Rules.Delete(ctx context.Context, zoneID string, rulesetID string, ruleID string) (cloudflare.ZoneRulesetRuleDeleteResponse, error) +- client.Zones.Rulesets.Rules.ZoneRulesetsNewAZoneRulesetRule(ctx context.Context, zoneID string, rulesetID string, body cloudflare.ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParams) (cloudflare.ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponse, error) -### EarlyHints +### Versions Response Types: -- cloudflare.ZoneSettingEarlyHintUpdateResponse -- cloudflare.ZoneSettingEarlyHintListResponse +- cloudflare.ZoneRulesetVersionGetResponse +- cloudflare.ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponse Methods: -- client.Zones.Settings.EarlyHints.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingEarlyHintUpdateParams) (cloudflare.ZoneSettingEarlyHintUpdateResponse, error) -- client.Zones.Settings.EarlyHints.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingEarlyHintListResponse, error) +- client.Zones.Rulesets.Versions.Get(ctx context.Context, zoneID string, rulesetID string, rulesetVersion string) (cloudflare.ZoneRulesetVersionGetResponse, error) +- client.Zones.Rulesets.Versions.Delete(ctx context.Context, zoneID string, rulesetID string, rulesetVersion string) error +- client.Zones.Rulesets.Versions.ZoneRulesetsListAZoneRulesetSVersions(ctx context.Context, zoneID string, rulesetID string) (cloudflare.ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponse, error) -### EmailObfuscations +## URLNormalizations Response Types: -- cloudflare.ZoneSettingEmailObfuscationUpdateResponse -- cloudflare.ZoneSettingEmailObfuscationListResponse +- cloudflare.ZoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponse +- cloudflare.ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponse Methods: -- client.Zones.Settings.EmailObfuscations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingEmailObfuscationUpdateParams) (cloudflare.ZoneSettingEmailObfuscationUpdateResponse, error) -- client.Zones.Settings.EmailObfuscations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingEmailObfuscationListResponse, error) +- client.Zones.URLNormalizations.URLNormalizationGetURLNormalizationSettings(ctx context.Context, zoneID string) (cloudflare.ZoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponse, error) +- client.Zones.URLNormalizations.URLNormalizationUpdateURLNormalizationSettings(ctx context.Context, zoneID string, body cloudflare.ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsParams) (cloudflare.ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponse, error) -### H2Prioritizations +## Spectrums + +### Analytics + +#### Aggregates + +##### Currents Response Types: -- cloudflare.ZoneSettingH2PrioritizationUpdateResponse -- cloudflare.ZoneSettingH2PrioritizationListResponse +- cloudflare.ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponse Methods: -- client.Zones.Settings.H2Prioritizations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingH2PrioritizationUpdateParams) (cloudflare.ZoneSettingH2PrioritizationUpdateResponse, error) -- client.Zones.Settings.H2Prioritizations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingH2PrioritizationListResponse, error) +- client.Zones.Spectrums.Analytics.Aggregates.Currents.SpectrumAggregateAnalyticsGetCurrentAggregatedAnalytics(ctx context.Context, zone string, query cloudflare.ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsParams) (cloudflare.ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponse, error) -### HotlinkProtections +#### Events + +##### Bytimes Response Types: -- cloudflare.ZoneSettingHotlinkProtectionUpdateResponse -- cloudflare.ZoneSettingHotlinkProtectionListResponse +- cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponse Methods: -- client.Zones.Settings.HotlinkProtections.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingHotlinkProtectionUpdateParams) (cloudflare.ZoneSettingHotlinkProtectionUpdateResponse, error) -- client.Zones.Settings.HotlinkProtections.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingHotlinkProtectionListResponse, error) +- client.Zones.Spectrums.Analytics.Events.Bytimes.SpectrumAnalyticsByTimeGetAnalyticsByTime(ctx context.Context, zone string, query cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParams) (cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponse, error) -### Http2s +##### Summaries Response Types: -- cloudflare.ZoneSettingHttp2UpdateResponse -- cloudflare.ZoneSettingHttp2ListResponse +- cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponse Methods: -- client.Zones.Settings.Http2s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingHttp2UpdateParams) (cloudflare.ZoneSettingHttp2UpdateResponse, error) -- client.Zones.Settings.Http2s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingHttp2ListResponse, error) +- client.Zones.Spectrums.Analytics.Events.Summaries.SpectrumAnalyticsSummaryGetAnalyticsSummary(ctx context.Context, zone string, query cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParams) (cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponse, error) -### Http3s +## Holds Response Types: -- cloudflare.ZoneSettingHttp3UpdateResponse -- cloudflare.ZoneSettingHttp3ListResponse +- cloudflare.ZoneHoldNewResponse +- cloudflare.ZoneHoldGetResponse +- cloudflare.ZoneHoldDeleteResponse Methods: -- client.Zones.Settings.Http3s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingHttp3UpdateParams) (cloudflare.ZoneSettingHttp3UpdateResponse, error) -- client.Zones.Settings.Http3s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingHttp3ListResponse, error) +- client.Zones.Holds.New(ctx context.Context, zoneID string, body cloudflare.ZoneHoldNewParams) (cloudflare.ZoneHoldNewResponse, error) +- client.Zones.Holds.Get(ctx context.Context, zoneID string) (cloudflare.ZoneHoldGetResponse, error) +- client.Zones.Holds.Delete(ctx context.Context, zoneID string, body cloudflare.ZoneHoldDeleteParams) (cloudflare.ZoneHoldDeleteResponse, error) -### ImageResizings +## PageShield Response Types: -- cloudflare.ZoneSettingImageResizingUpdateResponse -- cloudflare.ZoneSettingImageResizingListResponse +- cloudflare.ZonePageShieldListResponse +- cloudflare.ZonePageShieldPageShieldUpdatePageShieldSettingsResponse Methods: -- client.Zones.Settings.ImageResizings.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingImageResizingUpdateParams) (cloudflare.ZoneSettingImageResizingUpdateResponse, error) -- client.Zones.Settings.ImageResizings.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingImageResizingListResponse, error) +- client.Zones.PageShield.List(ctx context.Context, zoneID string) (cloudflare.ZonePageShieldListResponse, error) +- client.Zones.PageShield.PageShieldUpdatePageShieldSettings(ctx context.Context, zoneID string, body cloudflare.ZonePageShieldPageShieldUpdatePageShieldSettingsParams) (cloudflare.ZonePageShieldPageShieldUpdatePageShieldSettingsResponse, error) -### IPGeolocations +### Connections Response Types: -- cloudflare.ZoneSettingIPGeolocationUpdateResponse -- cloudflare.ZoneSettingIPGeolocationListResponse +- cloudflare.ZonePageShieldConnectionGetResponse +- cloudflare.ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponse Methods: -- client.Zones.Settings.IPGeolocations.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingIPGeolocationUpdateParams) (cloudflare.ZoneSettingIPGeolocationUpdateResponse, error) -- client.Zones.Settings.IPGeolocations.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingIPGeolocationListResponse, error) +- client.Zones.PageShield.Connections.Get(ctx context.Context, zoneID string, connectionID string) (cloudflare.ZonePageShieldConnectionGetResponse, error) +- client.Zones.PageShield.Connections.PageShieldListPageShieldConnections(ctx context.Context, zoneID string, query cloudflare.ZonePageShieldConnectionPageShieldListPageShieldConnectionsParams) (cloudflare.ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponse, error) -### Ipv6s +### Scripts Response Types: -- cloudflare.ZoneSettingIpv6UpdateResponse -- cloudflare.ZoneSettingIpv6ListResponse +- cloudflare.ZonePageShieldScriptGetResponse +- cloudflare.ZonePageShieldScriptPageShieldListPageShieldScriptsResponse Methods: -- client.Zones.Settings.Ipv6s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingIpv6UpdateParams) (cloudflare.ZoneSettingIpv6UpdateResponse, error) -- client.Zones.Settings.Ipv6s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingIpv6ListResponse, error) +- client.Zones.PageShield.Scripts.Get(ctx context.Context, zoneID string, scriptID string) (cloudflare.ZonePageShieldScriptGetResponse, error) +- client.Zones.PageShield.Scripts.PageShieldListPageShieldScripts(ctx context.Context, zoneID string, query cloudflare.ZonePageShieldScriptPageShieldListPageShieldScriptsParams) (cloudflare.ZonePageShieldScriptPageShieldListPageShieldScriptsResponse, error) -### MinTlsVersions +### Policies Response Types: -- cloudflare.ZoneSettingMinTlsVersionUpdateResponse -- cloudflare.ZoneSettingMinTlsVersionListResponse +- cloudflare.ZonePageShieldPolicyNewResponse +- cloudflare.ZonePageShieldPolicyGetResponse +- cloudflare.ZonePageShieldPolicyUpdateResponse +- cloudflare.ZonePageShieldPolicyListResponse Methods: -- client.Zones.Settings.MinTlsVersions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMinTlsVersionUpdateParams) (cloudflare.ZoneSettingMinTlsVersionUpdateResponse, error) -- client.Zones.Settings.MinTlsVersions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMinTlsVersionListResponse, error) +- client.Zones.PageShield.Policies.New(ctx context.Context, zoneID string, body cloudflare.ZonePageShieldPolicyNewParams) (cloudflare.ZonePageShieldPolicyNewResponse, error) +- client.Zones.PageShield.Policies.Get(ctx context.Context, zoneID string, policyID string) (cloudflare.ZonePageShieldPolicyGetResponse, error) +- client.Zones.PageShield.Policies.Update(ctx context.Context, zoneID string, policyID string, body cloudflare.ZonePageShieldPolicyUpdateParams) (cloudflare.ZonePageShieldPolicyUpdateResponse, error) +- client.Zones.PageShield.Policies.List(ctx context.Context, zoneID string) (cloudflare.ZonePageShieldPolicyListResponse, error) +- client.Zones.PageShield.Policies.Delete(ctx context.Context, zoneID string, policyID string) error -### Minifies +## BotManagement Response Types: -- cloudflare.ZoneSettingMinifyUpdateResponse -- cloudflare.ZoneSettingMinifyListResponse +- cloudflare.ZoneBotManagementGetResponse +- cloudflare.ZoneBotManagementUpdateResponse Methods: -- client.Zones.Settings.Minifies.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMinifyUpdateParams) (cloudflare.ZoneSettingMinifyUpdateResponse, error) -- client.Zones.Settings.Minifies.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMinifyListResponse, error) +- client.Zones.BotManagement.Get(ctx context.Context, zoneIdentifier string, query cloudflare.ZoneBotManagementGetParams) (cloudflare.ZoneBotManagementGetResponse, error) +- client.Zones.BotManagement.Update(ctx context.Context, zoneIdentifier string, params cloudflare.ZoneBotManagementUpdateParams) (cloudflare.ZoneBotManagementUpdateResponse, error) -### Mirages +## Cache Response Types: -- cloudflare.ZoneSettingMirageUpdateResponse -- cloudflare.ZoneSettingMirageListResponse +- cloudflare.ZoneCacheGetCacheReserveClearResponse +- cloudflare.ZoneCacheGetOriginPostQuantumEncryptionResponse +- cloudflare.ZoneCacheGetRegionalTieredCacheResponse +- cloudflare.ZoneCachePatchRegionalTieredCacheResponse +- cloudflare.ZoneCachePostCacheReserveClearResponse +- cloudflare.ZoneCachePutOriginPostQuantumEncryptionResponse Methods: -- client.Zones.Settings.Mirages.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMirageUpdateParams) (cloudflare.ZoneSettingMirageUpdateResponse, error) -- client.Zones.Settings.Mirages.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMirageListResponse, error) +- client.Zones.Cache.GetCacheReserveClear(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCacheGetCacheReserveClearResponse, error) +- client.Zones.Cache.GetOriginPostQuantumEncryption(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCacheGetOriginPostQuantumEncryptionResponse, error) +- client.Zones.Cache.GetRegionalTieredCache(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCacheGetRegionalTieredCacheResponse, error) +- client.Zones.Cache.PatchRegionalTieredCache(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCachePatchRegionalTieredCacheParams) (cloudflare.ZoneCachePatchRegionalTieredCacheResponse, error) +- client.Zones.Cache.PostCacheReserveClear(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneCachePostCacheReserveClearResponse, error) +- client.Zones.Cache.PutOriginPostQuantumEncryption(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneCachePutOriginPostQuantumEncryptionParams) (cloudflare.ZoneCachePutOriginPostQuantumEncryptionResponse, error) -### MobileRedirects +## DcvDelegations Response Types: -- cloudflare.ZoneSettingMobileRedirectUpdateResponse -- cloudflare.ZoneSettingMobileRedirectListResponse +- cloudflare.ZoneDcvDelegationUuidResponse Methods: -- client.Zones.Settings.MobileRedirects.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingMobileRedirectUpdateParams) (cloudflare.ZoneSettingMobileRedirectUpdateResponse, error) -- client.Zones.Settings.MobileRedirects.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingMobileRedirectListResponse, error) +- client.Zones.DcvDelegations.Uuid(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneDcvDelegationUuidResponse, error) -### Nels +## Zarazs + +### Workflow Response Types: -- cloudflare.ZoneSettingNelUpdateResponse -- cloudflare.ZoneSettingNelListResponse +- cloudflare.ZarazWorkflow Methods: -- client.Zones.Settings.Nels.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingNelUpdateParams) (cloudflare.ZoneSettingNelUpdateResponse, error) -- client.Zones.Settings.Nels.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingNelListResponse, error) +- client.Zones.Zarazs.Workflow.Get(ctx context.Context, zoneIdentifier string) (cloudflare.ZarazWorkflow, error) +- client.Zones.Zarazs.Workflow.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneZarazWorkflowUpdateParams) (cloudflare.ZarazWorkflow, error) -### OpportunisticEncryptions +## Snippets Response Types: -- cloudflare.ZoneSettingOpportunisticEncryptionUpdateResponse -- cloudflare.ZoneSettingOpportunisticEncryptionListResponse +- cloudflare.ZoneSnippetGetResponse +- cloudflare.ZoneSnippetUpdateResponse +- cloudflare.ZoneSnippetListResponse +- cloudflare.ZoneSnippetDeleteResponse Methods: -- client.Zones.Settings.OpportunisticEncryptions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOpportunisticEncryptionUpdateParams) (cloudflare.ZoneSettingOpportunisticEncryptionUpdateResponse, error) -- client.Zones.Settings.OpportunisticEncryptions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOpportunisticEncryptionListResponse, error) +- client.Zones.Snippets.Get(ctx context.Context, zoneIdentifier string, snippetName string) (cloudflare.ZoneSnippetGetResponse, error) +- client.Zones.Snippets.Update(ctx context.Context, zoneIdentifier string, snippetName string, body cloudflare.ZoneSnippetUpdateParams) (cloudflare.ZoneSnippetUpdateResponse, error) +- client.Zones.Snippets.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSnippetListResponse, error) +- client.Zones.Snippets.Delete(ctx context.Context, zoneIdentifier string, snippetName string) (cloudflare.ZoneSnippetDeleteResponse, error) +- client.Zones.Snippets.Content(ctx context.Context, zoneIdentifier string, snippetName string) (http.Response, error) -### OpportunisticOnions +## SnippetsRules Response Types: -- cloudflare.ZoneSettingOpportunisticOnionUpdateResponse -- cloudflare.ZoneSettingOpportunisticOnionListResponse +- cloudflare.ZoneSnippetsRuleUpdateResponse +- cloudflare.ZoneSnippetsRuleListResponse Methods: -- client.Zones.Settings.OpportunisticOnions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOpportunisticOnionUpdateParams) (cloudflare.ZoneSettingOpportunisticOnionUpdateResponse, error) -- client.Zones.Settings.OpportunisticOnions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOpportunisticOnionListResponse, error) +- client.Zones.SnippetsRules.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSnippetsRuleUpdateParams) (cloudflare.ZoneSnippetsRuleUpdateResponse, error) +- client.Zones.SnippetsRules.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSnippetsRuleListResponse, error) -### OrangeToOranges +## SpeedAPI Response Types: -- cloudflare.ZoneSettingOrangeToOrangeUpdateResponse -- cloudflare.ZoneSettingOrangeToOrangeListResponse +- cloudflare.ZoneSpeedAPIAvailabilitiesResponse Methods: -- client.Zones.Settings.OrangeToOranges.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOrangeToOrangeUpdateParams) (cloudflare.ZoneSettingOrangeToOrangeUpdateResponse, error) -- client.Zones.Settings.OrangeToOranges.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOrangeToOrangeListResponse, error) +- client.Zones.SpeedAPI.Availabilities(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSpeedAPIAvailabilitiesResponse, error) -### OriginErrorPagePassThrus +### Pages Response Types: -- cloudflare.ZoneSettingOriginErrorPagePassThrusUpdateResponse -- cloudflare.ZoneSettingOriginErrorPagePassThrusListResponse +- cloudflare.ZoneSpeedAPIPageListResponse +- cloudflare.ZoneSpeedAPIPageTrendResponse Methods: -- client.Zones.Settings.OriginErrorPagePassThrus.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOriginErrorPagePassThrusUpdateParams) (cloudflare.ZoneSettingOriginErrorPagePassThrusUpdateResponse, error) -- client.Zones.Settings.OriginErrorPagePassThrus.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOriginErrorPagePassThrusListResponse, error) +- client.Zones.SpeedAPI.Pages.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSpeedAPIPageListResponse, error) +- client.Zones.SpeedAPI.Pages.Trend(ctx context.Context, zoneIdentifier string, url string, query cloudflare.ZoneSpeedAPIPageTrendParams) (cloudflare.ZoneSpeedAPIPageTrendResponse, error) -### OriginMaxHTTPVersions +#### Tests Response Types: -- cloudflare.ZoneSettingOriginMaxHTTPVersionUpdateResponse -- cloudflare.ZoneSettingOriginMaxHTTPVersionListResponse +- cloudflare.ZoneSpeedAPIPageTestNewResponse +- cloudflare.ZoneSpeedAPIPageTestGetResponse +- cloudflare.ZoneSpeedAPIPageTestListResponse +- cloudflare.ZoneSpeedAPIPageTestDeleteResponse Methods: -- client.Zones.Settings.OriginMaxHTTPVersions.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingOriginMaxHTTPVersionUpdateParams) (cloudflare.ZoneSettingOriginMaxHTTPVersionUpdateResponse, error) -- client.Zones.Settings.OriginMaxHTTPVersions.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingOriginMaxHTTPVersionListResponse, error) +- client.Zones.SpeedAPI.Pages.Tests.New(ctx context.Context, zoneIdentifier string, url string, body cloudflare.ZoneSpeedAPIPageTestNewParams) (cloudflare.ZoneSpeedAPIPageTestNewResponse, error) +- client.Zones.SpeedAPI.Pages.Tests.Get(ctx context.Context, zoneIdentifier string, url string, testIdentifier string) (cloudflare.ZoneSpeedAPIPageTestGetResponse, error) +- client.Zones.SpeedAPI.Pages.Tests.List(ctx context.Context, zoneIdentifier string, url string, query cloudflare.ZoneSpeedAPIPageTestListParams) (cloudflare.ZoneSpeedAPIPageTestListResponse, error) +- client.Zones.SpeedAPI.Pages.Tests.Delete(ctx context.Context, zoneIdentifier string, url string, body cloudflare.ZoneSpeedAPIPageTestDeleteParams) (cloudflare.ZoneSpeedAPIPageTestDeleteResponse, error) -### Polishes +### Schedule Response Types: -- cloudflare.ZoneSettingPolishUpdateResponse -- cloudflare.ZoneSettingPolishListResponse +- cloudflare.ZoneSpeedAPIScheduleNewResponse +- cloudflare.ZoneSpeedAPIScheduleGetResponse +- cloudflare.ZoneSpeedAPIScheduleDeleteResponse Methods: -- client.Zones.Settings.Polishes.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingPolishUpdateParams) (cloudflare.ZoneSettingPolishUpdateResponse, error) -- client.Zones.Settings.Polishes.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingPolishListResponse, error) +- client.Zones.SpeedAPI.Schedule.New(ctx context.Context, zoneIdentifier string, url string, body cloudflare.ZoneSpeedAPIScheduleNewParams) (cloudflare.ZoneSpeedAPIScheduleNewResponse, error) +- client.Zones.SpeedAPI.Schedule.Get(ctx context.Context, zoneIdentifier string, url string, query cloudflare.ZoneSpeedAPIScheduleGetParams) (cloudflare.ZoneSpeedAPIScheduleGetResponse, error) +- client.Zones.SpeedAPI.Schedule.Delete(ctx context.Context, zoneIdentifier string, url string, body cloudflare.ZoneSpeedAPIScheduleDeleteParams) (cloudflare.ZoneSpeedAPIScheduleDeleteResponse, error) -### PrefetchPreloads +# AI Response Types: -- cloudflare.ZoneSettingPrefetchPreloadUpdateResponse -- cloudflare.ZoneSettingPrefetchPreloadListResponse +- cloudflare.AIRunResponse Methods: -- client.Zones.Settings.PrefetchPreloads.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingPrefetchPreloadUpdateParams) (cloudflare.ZoneSettingPrefetchPreloadUpdateResponse, error) -- client.Zones.Settings.PrefetchPreloads.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingPrefetchPreloadListResponse, error) +- client.AI.Run(ctx context.Context, accountIdentifier string, modelName string, body cloudflare.AIRunParams) (cloudflare.AIRunResponse, error) + +## Model -### PrivacyPasses +### ImageClassification + +#### Resnet50 Response Types: -- cloudflare.ZoneSettingPrivacyPassUpdateResponse -- cloudflare.ZoneSettingPrivacyPassListResponse +- cloudflare.AIModelImageClassificationResnet50RunResponse Methods: -- client.Zones.Settings.PrivacyPasses.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingPrivacyPassUpdateParams) (cloudflare.ZoneSettingPrivacyPassUpdateResponse, error) -- client.Zones.Settings.PrivacyPasses.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingPrivacyPassListResponse, error) +- client.AI.Model.ImageClassification.Resnet50.Run(ctx context.Context, accountIdentifier string) ([]cloudflare.AIModelImageClassificationResnet50RunResponse, error) -### ProxyReadTimeouts +### SpeechRecognition + +#### Whisper Response Types: -- cloudflare.ZoneSettingProxyReadTimeoutUpdateResponse -- cloudflare.ZoneSettingProxyReadTimeoutListResponse +- cloudflare.AIModelSpeechRecognitionWhisperRunResponse Methods: -- client.Zones.Settings.ProxyReadTimeouts.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingProxyReadTimeoutUpdateParams) (cloudflare.ZoneSettingProxyReadTimeoutUpdateResponse, error) -- client.Zones.Settings.ProxyReadTimeouts.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingProxyReadTimeoutListResponse, error) +- client.AI.Model.SpeechRecognition.Whisper.Run(ctx context.Context, accountIdentifier string) (cloudflare.AIModelSpeechRecognitionWhisperRunResponse, error) -### PseudoIpv4s +### TextClassification + +#### DistilbertSst2Int8 Response Types: -- cloudflare.ZoneSettingPseudoIpv4UpdateResponse -- cloudflare.ZoneSettingPseudoIpv4ListResponse +- cloudflare.AIModelTextClassificationDistilbertSst2Int8RunResponse Methods: -- client.Zones.Settings.PseudoIpv4s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingPseudoIpv4UpdateParams) (cloudflare.ZoneSettingPseudoIpv4UpdateResponse, error) -- client.Zones.Settings.PseudoIpv4s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingPseudoIpv4ListResponse, error) +- client.AI.Model.TextClassification.DistilbertSst2Int8.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTextClassificationDistilbertSst2Int8RunParams) ([]cloudflare.AIModelTextClassificationDistilbertSst2Int8RunResponse, error) -### ResponseBufferings +### TextEmbeddings + +#### BgeSmallEnV1_5 Response Types: -- cloudflare.ZoneSettingResponseBufferingUpdateResponse -- cloudflare.ZoneSettingResponseBufferingListResponse +- cloudflare.AIModelTextEmbeddingBgeSmallEnV1_5RunResponse Methods: -- client.Zones.Settings.ResponseBufferings.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingResponseBufferingUpdateParams) (cloudflare.ZoneSettingResponseBufferingUpdateResponse, error) -- client.Zones.Settings.ResponseBufferings.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingResponseBufferingListResponse, error) +- client.AI.Model.TextEmbeddings.BgeSmallEnV1_5.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTextEmbeddingBgeSmallEnV1_5RunParams) (cloudflare.AIModelTextEmbeddingBgeSmallEnV1_5RunResponse, error) -### RocketLoaders +#### BgeBaseEnV1_5 Response Types: -- cloudflare.ZoneSettingRocketLoaderUpdateResponse -- cloudflare.ZoneSettingRocketLoaderListResponse +- cloudflare.AIModelTextEmbeddingBgeBaseEnV1_5RunResponse Methods: -- client.Zones.Settings.RocketLoaders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingRocketLoaderUpdateParams) (cloudflare.ZoneSettingRocketLoaderUpdateResponse, error) -- client.Zones.Settings.RocketLoaders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingRocketLoaderListResponse, error) +- client.AI.Model.TextEmbeddings.BgeBaseEnV1_5.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTextEmbeddingBgeBaseEnV1_5RunParams) (cloudflare.AIModelTextEmbeddingBgeBaseEnV1_5RunResponse, error) -### SecurityHeaders +#### BgeLargeEnV1_5 Response Types: -- cloudflare.ZoneSettingSecurityHeaderUpdateResponse -- cloudflare.ZoneSettingSecurityHeaderListResponse +- cloudflare.AIModelTextEmbeddingBgeLargeEnV1_5RunResponse Methods: -- client.Zones.Settings.SecurityHeaders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSecurityHeaderUpdateParams) (cloudflare.ZoneSettingSecurityHeaderUpdateResponse, error) -- client.Zones.Settings.SecurityHeaders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSecurityHeaderListResponse, error) +- client.AI.Model.TextEmbeddings.BgeLargeEnV1_5.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTextEmbeddingBgeLargeEnV1_5RunParams) (cloudflare.AIModelTextEmbeddingBgeLargeEnV1_5RunResponse, error) -### SecurityLevels +### TextGeneration + +#### Llama2_7bChatInt8 Response Types: -- cloudflare.ZoneSettingSecurityLevelUpdateResponse -- cloudflare.ZoneSettingSecurityLevelListResponse +- cloudflare.AIModelTextGenerationLlama2_7bChatInt8RunResponse Methods: -- client.Zones.Settings.SecurityLevels.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSecurityLevelUpdateParams) (cloudflare.ZoneSettingSecurityLevelUpdateResponse, error) -- client.Zones.Settings.SecurityLevels.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSecurityLevelListResponse, error) +- client.AI.Model.TextGeneration.Llama2_7bChatInt8.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTextGenerationLlama2_7bChatInt8RunParams) (cloudflare.AIModelTextGenerationLlama2_7bChatInt8RunResponse, error) -### ServerSideExcludes +#### Llama2_7bChatFp16 Response Types: -- cloudflare.ZoneSettingServerSideExcludeUpdateResponse -- cloudflare.ZoneSettingServerSideExcludeListResponse +- cloudflare.AIModelTextGenerationLlama2_7bChatFp16RunResponse Methods: -- client.Zones.Settings.ServerSideExcludes.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingServerSideExcludeUpdateParams) (cloudflare.ZoneSettingServerSideExcludeUpdateResponse, error) -- client.Zones.Settings.ServerSideExcludes.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingServerSideExcludeListResponse, error) +- client.AI.Model.TextGeneration.Llama2_7bChatFp16.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTextGenerationLlama2_7bChatFp16RunParams) (cloudflare.AIModelTextGenerationLlama2_7bChatFp16RunResponse, error) -### SortQueryStringForCaches +#### Mistral7bInstructV0_1 Response Types: -- cloudflare.ZoneSettingSortQueryStringForCachUpdateResponse -- cloudflare.ZoneSettingSortQueryStringForCachListResponse +- cloudflare.AIModelTextGenerationMistral7bInstructV0_1RunResponse Methods: -- client.Zones.Settings.SortQueryStringForCaches.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSortQueryStringForCachUpdateParams) (cloudflare.ZoneSettingSortQueryStringForCachUpdateResponse, error) -- client.Zones.Settings.SortQueryStringForCaches.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSortQueryStringForCachListResponse, error) +- client.AI.Model.TextGeneration.Mistral7bInstructV0_1.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTextGenerationMistral7bInstructV0_1RunParams) (cloudflare.AIModelTextGenerationMistral7bInstructV0_1RunResponse, error) -### Ssls +### Translation + +#### M2m100_1_2b Response Types: -- cloudflare.ZoneSettingSslUpdateResponse -- cloudflare.ZoneSettingSslListResponse +- cloudflare.AIModelTranslationM2m100_1_2bRunResponse Methods: -- client.Zones.Settings.Ssls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSslUpdateParams) (cloudflare.ZoneSettingSslUpdateResponse, error) -- client.Zones.Settings.Ssls.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSslListResponse, error) +- client.AI.Model.Translation.M2m100_1_2b.Run(ctx context.Context, accountIdentifier string, body cloudflare.AIModelTranslationM2m100_1_2bRunParams) (cloudflare.AIModelTranslationM2m100_1_2bRunResponse, error) -### SslRecommenders +# Alerting + +## V3 + +### Destinations + +#### Webhooks Response Types: -- cloudflare.ZoneSettingSslRecommenderUpdateResponse -- cloudflare.ZoneSettingSslRecommenderListResponse +- cloudflare.AlertingV3DestinationWebhookUpdateResponse Methods: -- client.Zones.Settings.SslRecommenders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingSslRecommenderUpdateParams) (cloudflare.ZoneSettingSslRecommenderUpdateResponse, error) -- client.Zones.Settings.SslRecommenders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingSslRecommenderListResponse, error) +- client.Alerting.V3.Destinations.Webhooks.Update(ctx context.Context, accountID string, webhookID string, body cloudflare.AlertingV3DestinationWebhookUpdateParams) (cloudflare.AlertingV3DestinationWebhookUpdateResponse, error) -### Tls1_3s +### History Response Types: -- cloudflare.ZoneSettingTls1_3UpdateResponse -- cloudflare.ZoneSettingTls1_3ListResponse +- cloudflare.AlertingV3HistoryListResponse Methods: -- client.Zones.Settings.Tls1_3s.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingTls1_3UpdateParams) (cloudflare.ZoneSettingTls1_3UpdateResponse, error) -- client.Zones.Settings.Tls1_3s.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingTls1_3ListResponse, error) +- client.Alerting.V3.History.List(ctx context.Context, accountID string, query cloudflare.AlertingV3HistoryListParams) (cloudflare.AlertingV3HistoryListResponse, error) -### TlsClientAuths +### Policies Response Types: -- cloudflare.ZoneSettingTlsClientAuthUpdateResponse -- cloudflare.ZoneSettingTlsClientAuthListResponse +- cloudflare.AlertingV3PolicyNewResponse +- cloudflare.AlertingV3PolicyGetResponse +- cloudflare.AlertingV3PolicyUpdateResponse +- cloudflare.AlertingV3PolicyListResponse +- cloudflare.AlertingV3PolicyDeleteResponse Methods: -- client.Zones.Settings.TlsClientAuths.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingTlsClientAuthUpdateParams) (cloudflare.ZoneSettingTlsClientAuthUpdateResponse, error) -- client.Zones.Settings.TlsClientAuths.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingTlsClientAuthListResponse, error) +- client.Alerting.V3.Policies.New(ctx context.Context, accountID string, body cloudflare.AlertingV3PolicyNewParams) (cloudflare.AlertingV3PolicyNewResponse, error) +- client.Alerting.V3.Policies.Get(ctx context.Context, accountID string, policyID string) (cloudflare.AlertingV3PolicyGetResponse, error) +- client.Alerting.V3.Policies.Update(ctx context.Context, accountID string, policyID string, body cloudflare.AlertingV3PolicyUpdateParams) (cloudflare.AlertingV3PolicyUpdateResponse, error) +- client.Alerting.V3.Policies.List(ctx context.Context, accountID string) (cloudflare.AlertingV3PolicyListResponse, error) +- client.Alerting.V3.Policies.Delete(ctx context.Context, accountID string, policyID string) (cloudflare.AlertingV3PolicyDeleteResponse, error) -### TrueClientIPHeaders +# Addressing + +## Prefixes + +### Bgp + +#### Prefixes Response Types: -- cloudflare.ZoneSettingTrueClientIPHeaderUpdateResponse -- cloudflare.ZoneSettingTrueClientIPHeaderListResponse +- cloudflare.AddressingPrefixBgpPrefixGetResponse +- cloudflare.AddressingPrefixBgpPrefixUpdateResponse +- cloudflare.AddressingPrefixBgpPrefixListResponse Methods: -- client.Zones.Settings.TrueClientIPHeaders.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingTrueClientIPHeaderUpdateParams) (cloudflare.ZoneSettingTrueClientIPHeaderUpdateResponse, error) -- client.Zones.Settings.TrueClientIPHeaders.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingTrueClientIPHeaderListResponse, error) +- client.Addressing.Prefixes.Bgp.Prefixes.Get(ctx context.Context, accountIdentifier string, prefixIdentifier string, bgpPrefixIdentifier string) (cloudflare.AddressingPrefixBgpPrefixGetResponse, error) +- client.Addressing.Prefixes.Bgp.Prefixes.Update(ctx context.Context, accountIdentifier string, prefixIdentifier string, bgpPrefixIdentifier string, body cloudflare.AddressingPrefixBgpPrefixUpdateParams) (cloudflare.AddressingPrefixBgpPrefixUpdateResponse, error) +- client.Addressing.Prefixes.Bgp.Prefixes.List(ctx context.Context, accountIdentifier string, prefixIdentifier string) (cloudflare.AddressingPrefixBgpPrefixListResponse, error) -### Wafs +# HyperdriveConfigs Response Types: -- cloudflare.ZoneSettingWafUpdateResponse -- cloudflare.ZoneSettingWafListResponse +- cloudflare.HyperdriveConfigGetResponse +- cloudflare.HyperdriveConfigUpdateResponse +- cloudflare.HyperdriveConfigDeleteResponse Methods: -- client.Zones.Settings.Wafs.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingWafUpdateParams) (cloudflare.ZoneSettingWafUpdateResponse, error) -- client.Zones.Settings.Wafs.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingWafListResponse, error) +- client.HyperdriveConfigs.Get(ctx context.Context, accountIdentifier string, hyperdriveIdentifier string) (cloudflare.HyperdriveConfigGetResponse, error) +- client.HyperdriveConfigs.Update(ctx context.Context, accountIdentifier string, hyperdriveIdentifier string, body cloudflare.HyperdriveConfigUpdateParams) (cloudflare.HyperdriveConfigUpdateResponse, error) +- client.HyperdriveConfigs.Delete(ctx context.Context, accountIdentifier string, hyperdriveIdentifier string) (cloudflare.HyperdriveConfigDeleteResponse, error) -### Webps +# ImagesV2s Response Types: -- cloudflare.ZoneSettingWebpUpdateResponse -- cloudflare.ZoneSettingWebpListResponse +- cloudflare.ImagesImagesListResponseV2 Methods: -- client.Zones.Settings.Webps.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingWebpUpdateParams) (cloudflare.ZoneSettingWebpUpdateResponse, error) -- client.Zones.Settings.Webps.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingWebpListResponse, error) +- client.ImagesV2s.List(ctx context.Context, accountIdentifier string, query cloudflare.ImagesV2ListParams) (cloudflare.ImagesImagesListResponseV2, error) -### Websockets +# Intel + +## IndicatorFeeds Response Types: -- cloudflare.ZoneSettingWebsocketUpdateResponse -- cloudflare.ZoneSettingWebsocketListResponse +- cloudflare.IntelIndicatorFeedNewResponse +- cloudflare.IntelIndicatorFeedGetResponse +- cloudflare.IntelIndicatorFeedListResponse +- cloudflare.IntelIndicatorFeedSnapshotResponse Methods: -- client.Zones.Settings.Websockets.Update(ctx context.Context, zoneIdentifier string, body cloudflare.ZoneSettingWebsocketUpdateParams) (cloudflare.ZoneSettingWebsocketUpdateResponse, error) -- client.Zones.Settings.Websockets.List(ctx context.Context, zoneIdentifier string) (cloudflare.ZoneSettingWebsocketListResponse, error) +- client.Intel.IndicatorFeeds.New(ctx context.Context, accountIdentifier string, body cloudflare.IntelIndicatorFeedNewParams) (cloudflare.IntelIndicatorFeedNewResponse, error) +- client.Intel.IndicatorFeeds.Get(ctx context.Context, accountIdentifier string, feedID int64) (cloudflare.IntelIndicatorFeedGetResponse, error) +- client.Intel.IndicatorFeeds.List(ctx context.Context, accountIdentifier string) (cloudflare.IntelIndicatorFeedListResponse, error) +- client.Intel.IndicatorFeeds.Data(ctx context.Context, accountIdentifier string, feedID int64) (string, error) +- client.Intel.IndicatorFeeds.Snapshot(ctx context.Context, accountIdentifier string, feedID int64, body cloudflare.IntelIndicatorFeedSnapshotParams) (cloudflare.IntelIndicatorFeedSnapshotResponse, error) -# AI +### Permissions Response Types: -- cloudflare.AIRunResponse +- cloudflare.IntelIndicatorFeedPermissionAddResponse Methods: -- client.AI.Run(ctx context.Context, accountIdentifier string, modelName string, body cloudflare.AIRunParams) (cloudflare.AIRunResponse, error) +- client.Intel.IndicatorFeeds.Permissions.Add(ctx context.Context, accountIdentifier string, body cloudflare.IntelIndicatorFeedPermissionAddParams) (cloudflare.IntelIndicatorFeedPermissionAddResponse, error) -## Huggingface +# WebAnalytics + +## SiteInfo Response Types: -- cloudflare.AIHuggingfaceDistilbertSst2Int8Response +- cloudflare.WebAnalyticSiteInfoGetResponse +- cloudflare.WebAnalyticSiteInfoUpdateResponse +- cloudflare.WebAnalyticSiteInfoListResponse +- cloudflare.WebAnalyticSiteInfoDeleteResponse Methods: -- client.AI.Huggingface.DistilbertSst2Int8(ctx context.Context, accountIdentifier string, body cloudflare.AIHuggingfaceDistilbertSst2Int8Params) ([]cloudflare.AIHuggingfaceDistilbertSst2Int8Response, error) +- client.WebAnalytics.SiteInfo.Get(ctx context.Context, accountIdentifier string, siteIdentifier string) (cloudflare.WebAnalyticSiteInfoGetResponse, error) +- client.WebAnalytics.SiteInfo.Update(ctx context.Context, accountIdentifier string, siteIdentifier string, body cloudflare.WebAnalyticSiteInfoUpdateParams) (cloudflare.WebAnalyticSiteInfoUpdateResponse, error) +- client.WebAnalytics.SiteInfo.List(ctx context.Context, accountIdentifier string, query cloudflare.WebAnalyticSiteInfoListParams) (cloudflare.WebAnalyticSiteInfoListResponse, error) +- client.WebAnalytics.SiteInfo.Delete(ctx context.Context, accountIdentifier string, siteIdentifier string) (cloudflare.WebAnalyticSiteInfoDeleteResponse, error) -## Baai +## Rules Response Types: -- cloudflare.AIBaaiBgeBaseEnV1_5Response -- cloudflare.AIBaaiBgeLargeEnV1_5Response -- cloudflare.AIBaaiBgeSmallEnV1_5Response +- cloudflare.WebAnalyticRuleUpdateResponse +- cloudflare.WebAnalyticRuleListResponse +- cloudflare.WebAnalyticRuleDeleteResponse Methods: -- client.AI.Baai.BgeBaseEnV1_5(ctx context.Context, accountIdentifier string, body cloudflare.AIBaaiBgeBaseEnV1_5Params) (cloudflare.AIBaaiBgeBaseEnV1_5Response, error) -- client.AI.Baai.BgeLargeEnV1_5(ctx context.Context, accountIdentifier string, body cloudflare.AIBaaiBgeLargeEnV1_5Params) (cloudflare.AIBaaiBgeLargeEnV1_5Response, error) -- client.AI.Baai.BgeSmallEnV1_5(ctx context.Context, accountIdentifier string, body cloudflare.AIBaaiBgeSmallEnV1_5Params) (cloudflare.AIBaaiBgeSmallEnV1_5Response, error) +- client.WebAnalytics.Rules.New(ctx context.Context, accountIdentifier string, rulesetIdentifier string, body cloudflare.WebAnalyticRuleNewParams) (cloudflare.Rule, error) +- client.WebAnalytics.Rules.Update(ctx context.Context, accountIdentifier string, rulesetIdentifier string, body cloudflare.WebAnalyticRuleUpdateParams) (cloudflare.WebAnalyticRuleUpdateResponse, error) +- client.WebAnalytics.Rules.List(ctx context.Context, accountIdentifier string, rulesetIdentifier string) (cloudflare.WebAnalyticRuleListResponse, error) +- client.WebAnalytics.Rules.Delete(ctx context.Context, accountIdentifier string, rulesetIdentifier string, ruleIdentifier string) (cloudflare.WebAnalyticRuleDeleteResponse, error) + +# Stream -## OpenAI +## AudioTracks Response Types: -- cloudflare.AIOpenAIWhisperResponse +- cloudflare.StreamAudioTrackListResponse Methods: -- client.AI.OpenAI.Whisper(ctx context.Context, accountIdentifier string) (cloudflare.AIOpenAIWhisperResponse, error) +- client.Stream.AudioTracks.List(ctx context.Context, accountIdentifier string, identifier string) (cloudflare.StreamAudioTrackListResponse, error) -## Microsoft +# Filters Response Types: -- cloudflare.AIMicrosoftResnet50Response +- cloudflare.FilterDeleteResponse Methods: -- client.AI.Microsoft.Resnet50(ctx context.Context, accountIdentifier string) ([]cloudflare.AIMicrosoftResnet50Response, error) +- client.Filters.Delete(ctx context.Context, zoneIdentifier string, body cloudflare.FilterDeleteParams) (cloudflare.FilterDeleteResponse, error) -## Meta +# FirewallRules Response Types: -- cloudflare.AIMetaLlama2_7bChatFp16Response -- cloudflare.AIMetaLlama2_7bChatInt8Response -- cloudflare.AIMetaM2m100_1_2bResponse +- cloudflare.FirewallRuleUpdateResponse +- cloudflare.FirewallRuleDeleteResponse + +Methods: + +- client.FirewallRules.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallRuleUpdateParams) (cloudflare.FirewallRuleUpdateResponse, error) +- client.FirewallRules.Delete(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallRuleDeleteParams) (cloudflare.FirewallRuleDeleteResponse, error) + +# Healthchecks Methods: -- client.AI.Meta.Llama2_7bChatFp16(ctx context.Context, accountIdentifier string, body cloudflare.AIMetaLlama2_7bChatFp16Params) (cloudflare.AIMetaLlama2_7bChatFp16Response, error) -- client.AI.Meta.Llama2_7bChatInt8(ctx context.Context, accountIdentifier string, body cloudflare.AIMetaLlama2_7bChatInt8Params) (cloudflare.AIMetaLlama2_7bChatInt8Response, error) -- client.AI.Meta.M2m100_1_2b(ctx context.Context, accountIdentifier string, body cloudflare.AIMetaM2m100_1_2bParams) (cloudflare.AIMetaM2m100_1_2bResponse, error) +- client.Healthchecks.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.HealthcheckUpdateParams) (cloudflare.HealthchecksSingleResponse, error) -## Mistral +# Hostnames + +## Settings Response Types: -- cloudflare.AIMistralMistral7bInstructV0_1Response +- cloudflare.HostnameSettingListResponse +- cloudflare.HostnameSettingDeleteResponse +- cloudflare.HostnameSettingAddResponse + +Methods: + +- client.Hostnames.Settings.List(ctx context.Context, zoneIdentifier string, tlsSetting cloudflare.HostnameSettingListParamsTlsSetting) (cloudflare.HostnameSettingListResponse, error) +- client.Hostnames.Settings.Delete(ctx context.Context, zoneIdentifier string, tlsSetting cloudflare.HostnameSettingDeleteParamsTlsSetting, hostname string) (cloudflare.HostnameSettingDeleteResponse, error) +- client.Hostnames.Settings.Add(ctx context.Context, zoneIdentifier string, tlsSetting cloudflare.HostnameSettingAddParamsTlsSetting, hostname string, body cloudflare.HostnameSettingAddParams) (cloudflare.HostnameSettingAddResponse, error) + +# Pagerules Methods: -- client.AI.Mistral.Mistral7bInstructV0_1(ctx context.Context, accountIdentifier string, body cloudflare.AIMistralMistral7bInstructV0_1Params) (cloudflare.AIMistralMistral7bInstructV0_1Response, error) +- client.Pagerules.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.PageruleUpdateParams) (cloudflare.PageruleResponseSingle, error) diff --git a/certificate.go b/certificate.go new file mode 100644 index 00000000000..525713f87cf --- /dev/null +++ b/certificate.go @@ -0,0 +1,499 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// CertificateService 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 [NewCertificateService] method +// instead. +type CertificateService struct { + Options []option.RequestOption +} + +// NewCertificateService 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 NewCertificateService(opts ...option.RequestOption) (r *CertificateService) { + r = &CertificateService{} + r.Options = opts + return +} + +// Create an Origin CA certificate. Use your Origin CA Key as your User Service Key +// when calling this endpoint ([see above](#requests)). +func (r *CertificateService) New(ctx context.Context, body CertificateNewParams, opts ...option.RequestOption) (res *CertificateNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := "certificates" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get an existing Origin CA certificate by its serial number. Use your Origin CA +// Key as your User Service Key when calling this endpoint +// ([see above](#requests)). +func (r *CertificateService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *CertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("certificates/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// List all existing Origin CA certificates for a given zone. Use your Origin CA +// Key as your User Service Key when calling this endpoint +// ([see above](#requests)). +func (r *CertificateService) List(ctx context.Context, query CertificateListParams, opts ...option.RequestOption) (res *CertificateListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "certificates" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Revoke an existing Origin CA certificate by its serial number. Use your Origin +// CA Key as your User Service Key when calling this endpoint +// ([see above](#requests)). +func (r *CertificateService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *CertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("certificates/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type CertificateNewResponse struct { + Errors []CertificateNewResponseError `json:"errors"` + Messages []CertificateNewResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success CertificateNewResponseSuccess `json:"success"` + JSON certificateNewResponseJSON `json:"-"` +} + +// certificateNewResponseJSON contains the JSON metadata for the struct +// [CertificateNewResponse] +type certificateNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateNewResponseErrorJSON `json:"-"` +} + +// certificateNewResponseErrorJSON contains the JSON metadata for the struct +// [CertificateNewResponseError] +type certificateNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateNewResponseMessageJSON `json:"-"` +} + +// certificateNewResponseMessageJSON contains the JSON metadata for the struct +// [CertificateNewResponseMessage] +type certificateNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type CertificateNewResponseSuccess bool + +const ( + CertificateNewResponseSuccessTrue CertificateNewResponseSuccess = true +) + +type CertificateGetResponse struct { + Errors []CertificateGetResponseError `json:"errors"` + Messages []CertificateGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success CertificateGetResponseSuccess `json:"success"` + JSON certificateGetResponseJSON `json:"-"` +} + +// certificateGetResponseJSON contains the JSON metadata for the struct +// [CertificateGetResponse] +type certificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateGetResponseErrorJSON `json:"-"` +} + +// certificateGetResponseErrorJSON contains the JSON metadata for the struct +// [CertificateGetResponseError] +type certificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateGetResponseMessageJSON `json:"-"` +} + +// certificateGetResponseMessageJSON contains the JSON metadata for the struct +// [CertificateGetResponseMessage] +type certificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type CertificateGetResponseSuccess bool + +const ( + CertificateGetResponseSuccessTrue CertificateGetResponseSuccess = true +) + +type CertificateListResponse struct { + Errors []CertificateListResponseError `json:"errors"` + Messages []CertificateListResponseMessage `json:"messages"` + Result []CertificateListResponseResult `json:"result"` + ResultInfo CertificateListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success CertificateListResponseSuccess `json:"success"` + JSON certificateListResponseJSON `json:"-"` +} + +// certificateListResponseJSON contains the JSON metadata for the struct +// [CertificateListResponse] +type certificateListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateListResponseErrorJSON `json:"-"` +} + +// certificateListResponseErrorJSON contains the JSON metadata for the struct +// [CertificateListResponseError] +type certificateListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateListResponseMessageJSON `json:"-"` +} + +// certificateListResponseMessageJSON contains the JSON metadata for the struct +// [CertificateListResponseMessage] +type certificateListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateListResponseResult struct { + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr string `json:"csr,required"` + // Array of hostnames or wildcard names (e.g., \*.example.com) bound to the + // certificate. + Hostnames []interface{} `json:"hostnames,required"` + // Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), + // or "keyless-certificate" (for Keyless SSL servers). + RequestType CertificateListResponseResultRequestType `json:"request_type,required"` + // The number of days for which the certificate should be valid. + RequestedValidity CertificateListResponseResultRequestedValidity `json:"requested_validity,required"` + // Identifier + ID string `json:"id"` + // The Origin CA certificate. Will be newline-encoded. + Certificate string `json:"certificate"` + // When the certificate will expire. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + JSON certificateListResponseResultJSON `json:"-"` +} + +// certificateListResponseResultJSON contains the JSON metadata for the struct +// [CertificateListResponseResult] +type certificateListResponseResultJSON struct { + Csr apijson.Field + Hostnames apijson.Field + RequestType apijson.Field + RequestedValidity apijson.Field + ID apijson.Field + Certificate apijson.Field + ExpiresOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +type CertificateListResponseResultRequestType string + +const ( + CertificateListResponseResultRequestTypeOriginRsa CertificateListResponseResultRequestType = "origin-rsa" + CertificateListResponseResultRequestTypeOriginEcc CertificateListResponseResultRequestType = "origin-ecc" + CertificateListResponseResultRequestTypeKeylessCertificate CertificateListResponseResultRequestType = "keyless-certificate" +) + +// The number of days for which the certificate should be valid. +type CertificateListResponseResultRequestedValidity float64 + +const ( + CertificateListResponseResultRequestedValidity7 CertificateListResponseResultRequestedValidity = 7 + CertificateListResponseResultRequestedValidity30 CertificateListResponseResultRequestedValidity = 30 + CertificateListResponseResultRequestedValidity90 CertificateListResponseResultRequestedValidity = 90 + CertificateListResponseResultRequestedValidity365 CertificateListResponseResultRequestedValidity = 365 + CertificateListResponseResultRequestedValidity730 CertificateListResponseResultRequestedValidity = 730 + CertificateListResponseResultRequestedValidity1095 CertificateListResponseResultRequestedValidity = 1095 + CertificateListResponseResultRequestedValidity5475 CertificateListResponseResultRequestedValidity = 5475 +) + +type CertificateListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON certificateListResponseResultInfoJSON `json:"-"` +} + +// certificateListResponseResultInfoJSON contains the JSON metadata for the struct +// [CertificateListResponseResultInfo] +type certificateListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type CertificateListResponseSuccess bool + +const ( + CertificateListResponseSuccessTrue CertificateListResponseSuccess = true +) + +type CertificateDeleteResponse struct { + Errors []CertificateDeleteResponseError `json:"errors"` + Messages []CertificateDeleteResponseMessage `json:"messages"` + Result CertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success CertificateDeleteResponseSuccess `json:"success"` + JSON certificateDeleteResponseJSON `json:"-"` +} + +// certificateDeleteResponseJSON contains the JSON metadata for the struct +// [CertificateDeleteResponse] +type certificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateDeleteResponseErrorJSON `json:"-"` +} + +// certificateDeleteResponseErrorJSON contains the JSON metadata for the struct +// [CertificateDeleteResponseError] +type certificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON certificateDeleteResponseMessageJSON `json:"-"` +} + +// certificateDeleteResponseMessageJSON contains the JSON metadata for the struct +// [CertificateDeleteResponseMessage] +type certificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type CertificateDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON certificateDeleteResponseResultJSON `json:"-"` +} + +// certificateDeleteResponseResultJSON contains the JSON metadata for the struct +// [CertificateDeleteResponseResult] +type certificateDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type CertificateDeleteResponseSuccess bool + +const ( + CertificateDeleteResponseSuccessTrue CertificateDeleteResponseSuccess = true +) + +type CertificateNewParams struct { + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr param.Field[string] `json:"csr"` + // Array of hostnames or wildcard names (e.g., \*.example.com) bound to the + // certificate. + Hostnames param.Field[[]interface{}] `json:"hostnames"` + // Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), + // or "keyless-certificate" (for Keyless SSL servers). + RequestType param.Field[CertificateNewParamsRequestType] `json:"request_type"` + // The number of days for which the certificate should be valid. + RequestedValidity param.Field[CertificateNewParamsRequestedValidity] `json:"requested_validity"` +} + +func (r CertificateNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +type CertificateNewParamsRequestType string + +const ( + CertificateNewParamsRequestTypeOriginRsa CertificateNewParamsRequestType = "origin-rsa" + CertificateNewParamsRequestTypeOriginEcc CertificateNewParamsRequestType = "origin-ecc" + CertificateNewParamsRequestTypeKeylessCertificate CertificateNewParamsRequestType = "keyless-certificate" +) + +// The number of days for which the certificate should be valid. +type CertificateNewParamsRequestedValidity float64 + +const ( + CertificateNewParamsRequestedValidity7 CertificateNewParamsRequestedValidity = 7 + CertificateNewParamsRequestedValidity30 CertificateNewParamsRequestedValidity = 30 + CertificateNewParamsRequestedValidity90 CertificateNewParamsRequestedValidity = 90 + CertificateNewParamsRequestedValidity365 CertificateNewParamsRequestedValidity = 365 + CertificateNewParamsRequestedValidity730 CertificateNewParamsRequestedValidity = 730 + CertificateNewParamsRequestedValidity1095 CertificateNewParamsRequestedValidity = 1095 + CertificateNewParamsRequestedValidity5475 CertificateNewParamsRequestedValidity = 5475 +) + +type CertificateListParams struct { +} diff --git a/certificate_test.go b/certificate_test.go new file mode 100644 index 00000000000..9436d6f79ed --- /dev/null +++ b/certificate_test.go @@ -0,0 +1,123 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestCertificateNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Certificates.New(context.TODO(), cloudflare.CertificateNewParams{ + Csr: cloudflare.F("-----BEGIN CERTIFICATE REQUEST-----\nMIICxzCCAa8CAQAwSDELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDVNhbiBGcmFuY2lz\nY28xCzAJBgNVBAcTAkNBMRQwEgYDVQQDEwtleGFtcGxlLm5ldDCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBALxejtu4b+jPdFeFi6OUsye8TYJQBm3WfCvL\nHu5EvijMO/4Z2TImwASbwUF7Ir8OLgH+mGlQZeqyNvGoSOMEaZVXcYfpR1hlVak8\n4GGVr+04IGfOCqaBokaBFIwzclGZbzKmLGwIQioNxGfqFm6RGYGA3be2Je2iseBc\nN8GV1wYmvYE0RR+yWweJCTJ157exyRzu7sVxaEW9F87zBQLyOnwXc64rflXslRqi\ng7F7w5IaQYOl8yvmk/jEPCAha7fkiUfEpj4N12+oPRiMvleJF98chxjD4MH39c5I\nuOslULhrWunfh7GB1jwWNA9y44H0snrf+xvoy2TcHmxvma9Eln8CAwEAAaA6MDgG\nCSqGSIb3DQEJDjErMCkwJwYDVR0RBCAwHoILZXhhbXBsZS5uZXSCD3d3dy5leGFt\ncGxlLm5ldDANBgkqhkiG9w0BAQsFAAOCAQEAcBaX6dOnI8ncARrI9ZSF2AJX+8mx\npTHY2+Y2C0VvrVDGMtbBRH8R9yMbqWtlxeeNGf//LeMkSKSFa4kbpdx226lfui8/\nauRDBTJGx2R1ccUxmLZXx4my0W5iIMxunu+kez+BDlu7bTT2io0uXMRHue4i6quH\nyc5ibxvbJMjR7dqbcanVE10/34oprzXQsJ/VmSuZNXtjbtSKDlmcpw6To/eeAJ+J\nhXykcUihvHyG4A1m2R6qpANBjnA0pHexfwM/SgfzvpbvUg0T1ubmer8BgTwCKIWs\ndcWYTthM51JIqRBfNqy4QcBnX+GY05yltEEswQI55wdiS3CjTTA67sdbcQ==\n-----END CERTIFICATE REQUEST-----"), + Hostnames: cloudflare.F([]interface{}{"example.com", "*.example.com"}), + RequestType: cloudflare.F(cloudflare.CertificateNewParamsRequestTypeOriginRsa), + RequestedValidity: cloudflare.F(cloudflare.CertificateNewParamsRequestedValidity5475), + }) + 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 TestCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Certificates.Get(context.TODO(), "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()) + } +} + +func TestCertificateList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Certificates.List(context.TODO(), cloudflare.CertificateListParams{}) + 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 TestCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Certificates.Delete(context.TODO(), "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/client.go b/client.go index ba19853dbf3..33ba0d30fe1 100644 --- a/client.go +++ b/client.go @@ -12,29 +12,76 @@ import ( // interacting with the cloudflare API. You should not instantiate this client // directly, and instead use the [NewClient] method instead. type Client struct { - Options []option.RequestOption - Zones *ZoneService - AI *AIService + Options []option.RequestOption + Accounts *AccountService + Certificates *CertificateService + IPs *IPService + Memberships *MembershipService + Organizations *OrganizationService + Radar *RadarService + Railguns *RailgunService + User *UserService + Zones *ZoneService + AI *AIService + Alerting *AlertingService + Addressing *AddressingService + HyperdriveConfigs *HyperdriveConfigService + ImagesV2s *ImagesV2Service + Intel *IntelService + WebAnalytics *WebAnalyticService + Stream *StreamService + Filters *FilterService + FirewallRules *FirewallRuleService + Healthchecks *HealthcheckService + Hostnames *HostnameService + Pagerules *PageruleService } // NewClient generates a new client with the default option read from the -// environment (CLOUDFLARE_API_KEY, CLOUDFLARE_EMAIL). The option passed in as -// arguments are applied after these default arguments, and all option will be -// passed down to the services and requests that this client makes. +// environment (CLOUDFLARE_API_EMAIL, CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, +// CLOUDFLARE_USER_SERVICE_KEY). The option passed in as arguments are applied +// after these default arguments, and all option will be passed down to the +// services and requests that this client makes. func NewClient(opts ...option.RequestOption) (r *Client) { defaults := []option.RequestOption{option.WithEnvironmentProduction()} + if o, ok := os.LookupEnv("CLOUDFLARE_API_EMAIL"); ok { + defaults = append(defaults, option.WithAPIEmail(o)) + } if o, ok := os.LookupEnv("CLOUDFLARE_API_KEY"); ok { defaults = append(defaults, option.WithAPIKey(o)) } - if o, ok := os.LookupEnv("CLOUDFLARE_EMAIL"); ok { - defaults = append(defaults, option.WithEmail(o)) + if o, ok := os.LookupEnv("CLOUDFLARE_API_TOKEN"); ok { + defaults = append(defaults, option.WithAPIToken(o)) + } + if o, ok := os.LookupEnv("CLOUDFLARE_USER_SERVICE_KEY"); ok { + defaults = append(defaults, option.WithUserServiceKey(o)) } opts = append(defaults, opts...) r = &Client{Options: opts} + r.Accounts = NewAccountService(opts...) + r.Certificates = NewCertificateService(opts...) + r.IPs = NewIPService(opts...) + r.Memberships = NewMembershipService(opts...) + r.Organizations = NewOrganizationService(opts...) + r.Radar = NewRadarService(opts...) + r.Railguns = NewRailgunService(opts...) + r.User = NewUserService(opts...) r.Zones = NewZoneService(opts...) r.AI = NewAIService(opts...) + r.Alerting = NewAlertingService(opts...) + r.Addressing = NewAddressingService(opts...) + r.HyperdriveConfigs = NewHyperdriveConfigService(opts...) + r.ImagesV2s = NewImagesV2Service(opts...) + r.Intel = NewIntelService(opts...) + r.WebAnalytics = NewWebAnalyticService(opts...) + r.Stream = NewStreamService(opts...) + r.Filters = NewFilterService(opts...) + r.FirewallRules = NewFirewallRuleService(opts...) + r.Healthchecks = NewHealthcheckService(opts...) + r.Hostnames = NewHostnameService(opts...) + r.Pagerules = NewPageruleService(opts...) return } diff --git a/filter.go b/filter.go new file mode 100644 index 00000000000..ced3d8f8432 --- /dev/null +++ b/filter.go @@ -0,0 +1,170 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// FilterService 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 [NewFilterService] method instead. +type FilterService struct { + Options []option.RequestOption +} + +// NewFilterService 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 NewFilterService(opts ...option.RequestOption) (r *FilterService) { + r = &FilterService{} + r.Options = opts + return +} + +// Deletes one or more existing filters. +func (r *FilterService) Delete(ctx context.Context, zoneIdentifier string, body FilterDeleteParams, opts ...option.RequestOption) (res *FilterDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/filters", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +type FilterDeleteResponse struct { + Errors []FilterDeleteResponseError `json:"errors"` + Messages []FilterDeleteResponseMessage `json:"messages"` + Result []FilterDeleteResponseResult `json:"result"` + ResultInfo FilterDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success FilterDeleteResponseSuccess `json:"success"` + JSON filterDeleteResponseJSON `json:"-"` +} + +// filterDeleteResponseJSON contains the JSON metadata for the struct +// [FilterDeleteResponse] +type filterDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FilterDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FilterDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON filterDeleteResponseErrorJSON `json:"-"` +} + +// filterDeleteResponseErrorJSON contains the JSON metadata for the struct +// [FilterDeleteResponseError] +type filterDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FilterDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FilterDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON filterDeleteResponseMessageJSON `json:"-"` +} + +// filterDeleteResponseMessageJSON contains the JSON metadata for the struct +// [FilterDeleteResponseMessage] +type filterDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FilterDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FilterDeleteResponseResult struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON filterDeleteResponseResultJSON `json:"-"` +} + +// filterDeleteResponseResultJSON contains the JSON metadata for the struct +// [FilterDeleteResponseResult] +type filterDeleteResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FilterDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FilterDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON filterDeleteResponseResultInfoJSON `json:"-"` +} + +// filterDeleteResponseResultInfoJSON contains the JSON metadata for the struct +// [FilterDeleteResponseResultInfo] +type filterDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FilterDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type FilterDeleteResponseSuccess bool + +const ( + FilterDeleteResponseSuccessTrue FilterDeleteResponseSuccess = true +) + +type FilterDeleteParams struct { +} diff --git a/aimistral_test.go b/filter_test.go similarity index 71% rename from aimistral_test.go rename to filter_test.go index 2ef43a5137d..b691de3ff8e 100644 --- a/aimistral_test.go +++ b/filter_test.go @@ -13,7 +13,8 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAIMistralMistral7bInstructV0_1WithOptionalParams(t *testing.T) { +func TestFilterDelete(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 @@ -23,16 +24,15 @@ func TestAIMistralMistral7bInstructV0_1WithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Mistral.Mistral7bInstructV0_1( + _, err := client.Filters.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIMistralMistral7bInstructV0_1ParamsVariant0{ - Prompt: cloudflare.F("string"), - Stream: cloudflare.F(true), - }, + cloudflare.FilterDeleteParams{}, ) if err != nil { var apierr *cloudflare.Error diff --git a/firewallrule.go b/firewallrule.go new file mode 100644 index 00000000000..30a62cd6b9b --- /dev/null +++ b/firewallrule.go @@ -0,0 +1,528 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// FirewallRuleService 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 [NewFirewallRuleService] method +// instead. +type FirewallRuleService struct { + Options []option.RequestOption +} + +// NewFirewallRuleService 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 NewFirewallRuleService(opts ...option.RequestOption) (r *FirewallRuleService) { + r = &FirewallRuleService{} + r.Options = opts + return +} + +// Updates the priority of an existing firewall rule. +func (r *FirewallRuleService) Update(ctx context.Context, zoneIdentifier string, id string, body FirewallRuleUpdateParams, opts ...option.RequestOption) (res *FirewallRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes existing firewall rules. +func (r *FirewallRuleService) Delete(ctx context.Context, zoneIdentifier string, body FirewallRuleDeleteParams, opts ...option.RequestOption) (res *FirewallRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +type FirewallRuleUpdateResponse struct { + Errors []FirewallRuleUpdateResponseError `json:"errors"` + Messages []FirewallRuleUpdateResponseMessage `json:"messages"` + Result []FirewallRuleUpdateResponseResult `json:"result"` + ResultInfo FirewallRuleUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success FirewallRuleUpdateResponseSuccess `json:"success"` + JSON firewallRuleUpdateResponseJSON `json:"-"` +} + +// firewallRuleUpdateResponseJSON contains the JSON metadata for the struct +// [FirewallRuleUpdateResponse] +type firewallRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FirewallRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON firewallRuleUpdateResponseErrorJSON `json:"-"` +} + +// firewallRuleUpdateResponseErrorJSON contains the JSON metadata for the struct +// [FirewallRuleUpdateResponseError] +type firewallRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FirewallRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON firewallRuleUpdateResponseMessageJSON `json:"-"` +} + +// firewallRuleUpdateResponseMessageJSON contains the JSON metadata for the struct +// [FirewallRuleUpdateResponseMessage] +type firewallRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FirewallRuleUpdateResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action FirewallRuleUpdateResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter FirewallRuleUpdateResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []FirewallRuleUpdateResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON firewallRuleUpdateResponseResultJSON `json:"-"` +} + +// firewallRuleUpdateResponseResultJSON contains the JSON metadata for the struct +// [FirewallRuleUpdateResponseResult] +type firewallRuleUpdateResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type FirewallRuleUpdateResponseResultAction string + +const ( + FirewallRuleUpdateResponseResultActionBlock FirewallRuleUpdateResponseResultAction = "block" + FirewallRuleUpdateResponseResultActionChallenge FirewallRuleUpdateResponseResultAction = "challenge" + FirewallRuleUpdateResponseResultActionJsChallenge FirewallRuleUpdateResponseResultAction = "js_challenge" + FirewallRuleUpdateResponseResultActionManagedChallenge FirewallRuleUpdateResponseResultAction = "managed_challenge" + FirewallRuleUpdateResponseResultActionAllow FirewallRuleUpdateResponseResultAction = "allow" + FirewallRuleUpdateResponseResultActionLog FirewallRuleUpdateResponseResultAction = "log" + FirewallRuleUpdateResponseResultActionBypass FirewallRuleUpdateResponseResultAction = "bypass" +) + +// Union satisfied by [FirewallRuleUpdateResponseResultFilterDZw70ubTFilter] or +// [FirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter]. +type FirewallRuleUpdateResponseResultFilter interface { + implementsFirewallRuleUpdateResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*FirewallRuleUpdateResponseResultFilter)(nil)).Elem(), "") +} + +type FirewallRuleUpdateResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON firewallRuleUpdateResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// firewallRuleUpdateResponseResultFilterDZw70ubTFilterJSON contains the JSON +// metadata for the struct [FirewallRuleUpdateResponseResultFilterDZw70ubTFilter] +type firewallRuleUpdateResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleUpdateResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r FirewallRuleUpdateResponseResultFilterDZw70ubTFilter) implementsFirewallRuleUpdateResponseResultFilter() { +} + +type FirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON firewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// firewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilterJSON contains the +// JSON metadata for the struct +// [FirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter] +type firewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r FirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter) implementsFirewallRuleUpdateResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type FirewallRuleUpdateResponseResultProduct string + +const ( + FirewallRuleUpdateResponseResultProductZoneLockdown FirewallRuleUpdateResponseResultProduct = "zoneLockdown" + FirewallRuleUpdateResponseResultProductUaBlock FirewallRuleUpdateResponseResultProduct = "uaBlock" + FirewallRuleUpdateResponseResultProductBic FirewallRuleUpdateResponseResultProduct = "bic" + FirewallRuleUpdateResponseResultProductHot FirewallRuleUpdateResponseResultProduct = "hot" + FirewallRuleUpdateResponseResultProductSecurityLevel FirewallRuleUpdateResponseResultProduct = "securityLevel" + FirewallRuleUpdateResponseResultProductRateLimit FirewallRuleUpdateResponseResultProduct = "rateLimit" + FirewallRuleUpdateResponseResultProductWaf FirewallRuleUpdateResponseResultProduct = "waf" +) + +type FirewallRuleUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON firewallRuleUpdateResponseResultInfoJSON `json:"-"` +} + +// firewallRuleUpdateResponseResultInfoJSON contains the JSON metadata for the +// struct [FirewallRuleUpdateResponseResultInfo] +type firewallRuleUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type FirewallRuleUpdateResponseSuccess bool + +const ( + FirewallRuleUpdateResponseSuccessTrue FirewallRuleUpdateResponseSuccess = true +) + +type FirewallRuleDeleteResponse struct { + Errors []FirewallRuleDeleteResponseError `json:"errors"` + Messages []FirewallRuleDeleteResponseMessage `json:"messages"` + Result []FirewallRuleDeleteResponseResult `json:"result"` + ResultInfo FirewallRuleDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success FirewallRuleDeleteResponseSuccess `json:"success"` + JSON firewallRuleDeleteResponseJSON `json:"-"` +} + +// firewallRuleDeleteResponseJSON contains the JSON metadata for the struct +// [FirewallRuleDeleteResponse] +type firewallRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FirewallRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON firewallRuleDeleteResponseErrorJSON `json:"-"` +} + +// firewallRuleDeleteResponseErrorJSON contains the JSON metadata for the struct +// [FirewallRuleDeleteResponseError] +type firewallRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FirewallRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON firewallRuleDeleteResponseMessageJSON `json:"-"` +} + +// firewallRuleDeleteResponseMessageJSON contains the JSON metadata for the struct +// [FirewallRuleDeleteResponseMessage] +type firewallRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type FirewallRuleDeleteResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action FirewallRuleDeleteResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter FirewallRuleDeleteResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []FirewallRuleDeleteResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON firewallRuleDeleteResponseResultJSON `json:"-"` +} + +// firewallRuleDeleteResponseResultJSON contains the JSON metadata for the struct +// [FirewallRuleDeleteResponseResult] +type firewallRuleDeleteResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type FirewallRuleDeleteResponseResultAction string + +const ( + FirewallRuleDeleteResponseResultActionBlock FirewallRuleDeleteResponseResultAction = "block" + FirewallRuleDeleteResponseResultActionChallenge FirewallRuleDeleteResponseResultAction = "challenge" + FirewallRuleDeleteResponseResultActionJsChallenge FirewallRuleDeleteResponseResultAction = "js_challenge" + FirewallRuleDeleteResponseResultActionManagedChallenge FirewallRuleDeleteResponseResultAction = "managed_challenge" + FirewallRuleDeleteResponseResultActionAllow FirewallRuleDeleteResponseResultAction = "allow" + FirewallRuleDeleteResponseResultActionLog FirewallRuleDeleteResponseResultAction = "log" + FirewallRuleDeleteResponseResultActionBypass FirewallRuleDeleteResponseResultAction = "bypass" +) + +// Union satisfied by [FirewallRuleDeleteResponseResultFilterDZw70ubTFilter] or +// [FirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter]. +type FirewallRuleDeleteResponseResultFilter interface { + implementsFirewallRuleDeleteResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*FirewallRuleDeleteResponseResultFilter)(nil)).Elem(), "") +} + +type FirewallRuleDeleteResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON firewallRuleDeleteResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// firewallRuleDeleteResponseResultFilterDZw70ubTFilterJSON contains the JSON +// metadata for the struct [FirewallRuleDeleteResponseResultFilterDZw70ubTFilter] +type firewallRuleDeleteResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleDeleteResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r FirewallRuleDeleteResponseResultFilterDZw70ubTFilter) implementsFirewallRuleDeleteResponseResultFilter() { +} + +type FirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON firewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// firewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilterJSON contains the +// JSON metadata for the struct +// [FirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter] +type firewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r FirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter) implementsFirewallRuleDeleteResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type FirewallRuleDeleteResponseResultProduct string + +const ( + FirewallRuleDeleteResponseResultProductZoneLockdown FirewallRuleDeleteResponseResultProduct = "zoneLockdown" + FirewallRuleDeleteResponseResultProductUaBlock FirewallRuleDeleteResponseResultProduct = "uaBlock" + FirewallRuleDeleteResponseResultProductBic FirewallRuleDeleteResponseResultProduct = "bic" + FirewallRuleDeleteResponseResultProductHot FirewallRuleDeleteResponseResultProduct = "hot" + FirewallRuleDeleteResponseResultProductSecurityLevel FirewallRuleDeleteResponseResultProduct = "securityLevel" + FirewallRuleDeleteResponseResultProductRateLimit FirewallRuleDeleteResponseResultProduct = "rateLimit" + FirewallRuleDeleteResponseResultProductWaf FirewallRuleDeleteResponseResultProduct = "waf" +) + +type FirewallRuleDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON firewallRuleDeleteResponseResultInfoJSON `json:"-"` +} + +// firewallRuleDeleteResponseResultInfoJSON contains the JSON metadata for the +// struct [FirewallRuleDeleteResponseResultInfo] +type firewallRuleDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FirewallRuleDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type FirewallRuleDeleteResponseSuccess bool + +const ( + FirewallRuleDeleteResponseSuccessTrue FirewallRuleDeleteResponseSuccess = true +) + +type FirewallRuleUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r FirewallRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type FirewallRuleDeleteParams struct { +} diff --git a/firewallrule_test.go b/firewallrule_test.go new file mode 100644 index 00000000000..30bffa20939 --- /dev/null +++ b/firewallrule_test.go @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestFirewallRuleUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.FirewallRules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b60", + cloudflare.FirewallRuleUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestFirewallRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.FirewallRules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.FirewallRuleDeleteParams{}, + ) + 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/healthcheck.go b/healthcheck.go new file mode 100644 index 00000000000..8318e165097 --- /dev/null +++ b/healthcheck.go @@ -0,0 +1,160 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// HealthcheckService 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 [NewHealthcheckService] method +// instead. +type HealthcheckService struct { + Options []option.RequestOption +} + +// NewHealthcheckService 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 NewHealthcheckService(opts ...option.RequestOption) (r *HealthcheckService) { + r = &HealthcheckService{} + r.Options = opts + return +} + +// Patch a configured health check. +func (r *HealthcheckService) Update(ctx context.Context, zoneIdentifier string, identifier string, body HealthcheckUpdateParams, opts ...option.RequestOption) (res *HealthchecksSingleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type HealthcheckUpdateParams struct { + // The hostname or IP address of the origin server to run health checks on. + Address param.Field[string] `json:"address,required"` + // A short name to identify the health check. Only alphanumeric characters, hyphens + // and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // A list of regions from which to run health checks. Null means Cloudflare will + // pick a default region. + CheckRegions param.Field[[]HealthcheckUpdateParamsCheckRegion] `json:"check_regions"` + // The number of consecutive fails required from a health check before changing the + // health to unhealthy. + ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` + // The number of consecutive successes required from a health check before changing + // the health to healthy. + ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` + // A human-readable description of the health check. + Description param.Field[string] `json:"description"` + // Parameters specific to an HTTP or HTTPS health check. + HTTPConfig param.Field[HealthcheckUpdateParamsHTTPConfig] `json:"http_config"` + // The interval between each health check. Shorter intervals may give quicker + // notifications if the origin status changes, but will increase load on the origin + // as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // If suspended, no health checks are sent to the origin. + Suspended param.Field[bool] `json:"suspended"` + // Parameters specific to TCP health check. + TcpConfig param.Field[HealthcheckUpdateParamsTcpConfig] `json:"tcp_config"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP', 'HTTPS' and 'TCP'. + Type param.Field[string] `json:"type"` +} + +func (r HealthcheckUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, IN: India, +// SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (BUSINESS +// and ENTERPRISE customers only). +type HealthcheckUpdateParamsCheckRegion string + +const ( + HealthcheckUpdateParamsCheckRegionWnam HealthcheckUpdateParamsCheckRegion = "WNAM" + HealthcheckUpdateParamsCheckRegionEnam HealthcheckUpdateParamsCheckRegion = "ENAM" + HealthcheckUpdateParamsCheckRegionWeu HealthcheckUpdateParamsCheckRegion = "WEU" + HealthcheckUpdateParamsCheckRegionEeu HealthcheckUpdateParamsCheckRegion = "EEU" + HealthcheckUpdateParamsCheckRegionNsam HealthcheckUpdateParamsCheckRegion = "NSAM" + HealthcheckUpdateParamsCheckRegionSsam HealthcheckUpdateParamsCheckRegion = "SSAM" + HealthcheckUpdateParamsCheckRegionOc HealthcheckUpdateParamsCheckRegion = "OC" + HealthcheckUpdateParamsCheckRegionMe HealthcheckUpdateParamsCheckRegion = "ME" + HealthcheckUpdateParamsCheckRegionNaf HealthcheckUpdateParamsCheckRegion = "NAF" + HealthcheckUpdateParamsCheckRegionSaf HealthcheckUpdateParamsCheckRegion = "SAF" + HealthcheckUpdateParamsCheckRegionIn HealthcheckUpdateParamsCheckRegion = "IN" + HealthcheckUpdateParamsCheckRegionSeas HealthcheckUpdateParamsCheckRegion = "SEAS" + HealthcheckUpdateParamsCheckRegionNeas HealthcheckUpdateParamsCheckRegion = "NEAS" + HealthcheckUpdateParamsCheckRegionAllRegions HealthcheckUpdateParamsCheckRegion = "ALL_REGIONS" +) + +// Parameters specific to an HTTP or HTTPS health check. +type HealthcheckUpdateParamsHTTPConfig struct { + // Do not validate the certificate when the health check uses HTTPS. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all + // codes starting with 2) of the health check. + ExpectedCodes param.Field[[]string] `json:"expected_codes"` + // Follow redirects if the origin returns a 3xx status code. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. + Header param.Field[interface{}] `json:"header"` + // The HTTP method to use for the health check. + Method param.Field[HealthcheckUpdateParamsHTTPConfigMethod] `json:"method"` + // The endpoint path to health check against. + Path param.Field[string] `json:"path"` + // Port number to connect to for the health check. Defaults to 80 if type is HTTP + // or 443 if type is HTTPS. + Port param.Field[int64] `json:"port"` +} + +func (r HealthcheckUpdateParamsHTTPConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The HTTP method to use for the health check. +type HealthcheckUpdateParamsHTTPConfigMethod string + +const ( + HealthcheckUpdateParamsHTTPConfigMethodGet HealthcheckUpdateParamsHTTPConfigMethod = "GET" + HealthcheckUpdateParamsHTTPConfigMethodHead HealthcheckUpdateParamsHTTPConfigMethod = "HEAD" +) + +// Parameters specific to TCP health check. +type HealthcheckUpdateParamsTcpConfig struct { + // The TCP connection method to use for the health check. + Method param.Field[HealthcheckUpdateParamsTcpConfigMethod] `json:"method"` + // Port number to connect to for the health check. Defaults to 80. + Port param.Field[int64] `json:"port"` +} + +func (r HealthcheckUpdateParamsTcpConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The TCP connection method to use for the health check. +type HealthcheckUpdateParamsTcpConfigMethod string + +const ( + HealthcheckUpdateParamsTcpConfigMethodConnectionEstablished HealthcheckUpdateParamsTcpConfigMethod = "connection_established" +) diff --git a/healthcheck_test.go b/healthcheck_test.go new file mode 100644 index 00000000000..57101d2c37b --- /dev/null +++ b/healthcheck_test.go @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestHealthcheckUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Healthchecks.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.HealthcheckUpdateParams{ + Address: cloudflare.F("www.example.com"), + Name: cloudflare.F("server-1"), + CheckRegions: cloudflare.F([]cloudflare.HealthcheckUpdateParamsCheckRegion{cloudflare.HealthcheckUpdateParamsCheckRegionWeu, cloudflare.HealthcheckUpdateParamsCheckRegionEnam}), + ConsecutiveFails: cloudflare.F(int64(0)), + ConsecutiveSuccesses: cloudflare.F(int64(0)), + Description: cloudflare.F("Health check for www.example.com"), + HTTPConfig: cloudflare.F(cloudflare.HealthcheckUpdateParamsHTTPConfig{ + AllowInsecure: cloudflare.F(true), + ExpectedBody: cloudflare.F("success"), + ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Method: cloudflare.F(cloudflare.HealthcheckUpdateParamsHTTPConfigMethodGet), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + }), + Interval: cloudflare.F(int64(0)), + Retries: cloudflare.F(int64(0)), + Suspended: cloudflare.F(true), + TcpConfig: cloudflare.F(cloudflare.HealthcheckUpdateParamsTcpConfig{ + Method: cloudflare.F(cloudflare.HealthcheckUpdateParamsTcpConfigMethodConnectionEstablished), + Port: cloudflare.F(int64(0)), + }), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F("HTTPS"), + }, + ) + 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/hostname.go b/hostname.go new file mode 100644 index 00000000000..310a2ddff6b --- /dev/null +++ b/hostname.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// HostnameService 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 [NewHostnameService] method instead. +type HostnameService struct { + Options []option.RequestOption + Settings *HostnameSettingService +} + +// NewHostnameService 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 NewHostnameService(opts ...option.RequestOption) (r *HostnameService) { + r = &HostnameService{} + r.Options = opts + r.Settings = NewHostnameSettingService(opts...) + return +} diff --git a/hostnamesetting.go b/hostnamesetting.go new file mode 100644 index 00000000000..5b08b8fb419 --- /dev/null +++ b/hostnamesetting.go @@ -0,0 +1,491 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// HostnameSettingService 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 [NewHostnameSettingService] method +// instead. +type HostnameSettingService struct { + Options []option.RequestOption +} + +// NewHostnameSettingService 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 NewHostnameSettingService(opts ...option.RequestOption) (r *HostnameSettingService) { + r = &HostnameSettingService{} + r.Options = opts + return +} + +// List the requested TLS setting for the hostnames under this zone. +func (r *HostnameSettingService) List(ctx context.Context, zoneIdentifier string, tlsSetting HostnameSettingListParamsTlsSetting, opts ...option.RequestOption) (res *HostnameSettingListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/hostnames/settings/%v", zoneIdentifier, tlsSetting) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete the tls setting value for the hostname. +func (r *HostnameSettingService) Delete(ctx context.Context, zoneIdentifier string, tlsSetting HostnameSettingDeleteParamsTlsSetting, hostname string, opts ...option.RequestOption) (res *HostnameSettingDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/hostnames/settings/%v/%s", zoneIdentifier, tlsSetting, hostname) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Update the tls setting value for the hostname. +func (r *HostnameSettingService) Add(ctx context.Context, zoneIdentifier string, tlsSetting HostnameSettingAddParamsTlsSetting, hostname string, body HostnameSettingAddParams, opts ...option.RequestOption) (res *HostnameSettingAddResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/hostnames/settings/%v/%s", zoneIdentifier, tlsSetting, hostname) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type HostnameSettingListResponse struct { + Errors []HostnameSettingListResponseError `json:"errors"` + Messages []HostnameSettingListResponseMessage `json:"messages"` + Result []HostnameSettingListResponseResult `json:"result"` + ResultInfo HostnameSettingListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success HostnameSettingListResponseSuccess `json:"success"` + JSON hostnameSettingListResponseJSON `json:"-"` +} + +// hostnameSettingListResponseJSON contains the JSON metadata for the struct +// [HostnameSettingListResponse] +type hostnameSettingListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hostnameSettingListResponseErrorJSON `json:"-"` +} + +// hostnameSettingListResponseErrorJSON contains the JSON metadata for the struct +// [HostnameSettingListResponseError] +type hostnameSettingListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hostnameSettingListResponseMessageJSON `json:"-"` +} + +// hostnameSettingListResponseMessageJSON contains the JSON metadata for the struct +// [HostnameSettingListResponseMessage] +type hostnameSettingListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingListResponseResult struct { + // This is the time the tls setting was originally created for this hostname. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The hostname for which the tls settings are set. + Hostname string `json:"hostname"` + // Deployment status for the given tls setting. + Status string `json:"status"` + // This is the time the tls setting was updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The tls setting value. + Value HostnameSettingListResponseResultValue `json:"value"` + JSON hostnameSettingListResponseResultJSON `json:"-"` +} + +// hostnameSettingListResponseResultJSON contains the JSON metadata for the struct +// [HostnameSettingListResponseResult] +type hostnameSettingListResponseResultJSON struct { + CreatedAt apijson.Field + Hostname apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The tls setting value. +// +// Union satisfied by [shared.UnionFloat], [shared.UnionString] or +// [HostnameSettingListResponseResultValueArray]. +type HostnameSettingListResponseResultValue interface { + ImplementsHostnameSettingListResponseResultValue() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*HostnameSettingListResponseResultValue)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type HostnameSettingListResponseResultValueArray []string + +func (r HostnameSettingListResponseResultValueArray) ImplementsHostnameSettingListResponseResultValue() { +} + +type HostnameSettingListResponseResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + // Total pages available of results + TotalPages float64 `json:"total_pages"` + JSON hostnameSettingListResponseResultInfoJSON `json:"-"` +} + +// hostnameSettingListResponseResultInfoJSON contains the JSON metadata for the +// struct [HostnameSettingListResponseResultInfo] +type hostnameSettingListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + TotalPages apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type HostnameSettingListResponseSuccess bool + +const ( + HostnameSettingListResponseSuccessTrue HostnameSettingListResponseSuccess = true +) + +type HostnameSettingDeleteResponse struct { + Errors []HostnameSettingDeleteResponseError `json:"errors"` + Messages []HostnameSettingDeleteResponseMessage `json:"messages"` + Result HostnameSettingDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success HostnameSettingDeleteResponseSuccess `json:"success"` + JSON hostnameSettingDeleteResponseJSON `json:"-"` +} + +// hostnameSettingDeleteResponseJSON contains the JSON metadata for the struct +// [HostnameSettingDeleteResponse] +type hostnameSettingDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hostnameSettingDeleteResponseErrorJSON `json:"-"` +} + +// hostnameSettingDeleteResponseErrorJSON contains the JSON metadata for the struct +// [HostnameSettingDeleteResponseError] +type hostnameSettingDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hostnameSettingDeleteResponseMessageJSON `json:"-"` +} + +// hostnameSettingDeleteResponseMessageJSON contains the JSON metadata for the +// struct [HostnameSettingDeleteResponseMessage] +type hostnameSettingDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingDeleteResponseResult struct { + // This is the time the tls setting was originally created for this hostname. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The hostname for which the tls settings are set. + Hostname string `json:"hostname"` + Status interface{} `json:"status"` + // This is the time the tls setting was updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + Value interface{} `json:"value"` + JSON hostnameSettingDeleteResponseResultJSON `json:"-"` +} + +// hostnameSettingDeleteResponseResultJSON contains the JSON metadata for the +// struct [HostnameSettingDeleteResponseResult] +type hostnameSettingDeleteResponseResultJSON struct { + CreatedAt apijson.Field + Hostname apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type HostnameSettingDeleteResponseSuccess bool + +const ( + HostnameSettingDeleteResponseSuccessTrue HostnameSettingDeleteResponseSuccess = true +) + +type HostnameSettingAddResponse struct { + Errors []HostnameSettingAddResponseError `json:"errors"` + Messages []HostnameSettingAddResponseMessage `json:"messages"` + Result HostnameSettingAddResponseResult `json:"result"` + // Whether the API call was successful + Success HostnameSettingAddResponseSuccess `json:"success"` + JSON hostnameSettingAddResponseJSON `json:"-"` +} + +// hostnameSettingAddResponseJSON contains the JSON metadata for the struct +// [HostnameSettingAddResponse] +type hostnameSettingAddResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingAddResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingAddResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hostnameSettingAddResponseErrorJSON `json:"-"` +} + +// hostnameSettingAddResponseErrorJSON contains the JSON metadata for the struct +// [HostnameSettingAddResponseError] +type hostnameSettingAddResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingAddResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingAddResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hostnameSettingAddResponseMessageJSON `json:"-"` +} + +// hostnameSettingAddResponseMessageJSON contains the JSON metadata for the struct +// [HostnameSettingAddResponseMessage] +type hostnameSettingAddResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingAddResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HostnameSettingAddResponseResult struct { + // This is the time the tls setting was originally created for this hostname. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The hostname for which the tls settings are set. + Hostname string `json:"hostname"` + // Deployment status for the given tls setting. + Status string `json:"status"` + // This is the time the tls setting was updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The tls setting value. + Value HostnameSettingAddResponseResultValue `json:"value"` + JSON hostnameSettingAddResponseResultJSON `json:"-"` +} + +// hostnameSettingAddResponseResultJSON contains the JSON metadata for the struct +// [HostnameSettingAddResponseResult] +type hostnameSettingAddResponseResultJSON struct { + CreatedAt apijson.Field + Hostname apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HostnameSettingAddResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The tls setting value. +// +// Union satisfied by [shared.UnionFloat], [shared.UnionString] or +// [HostnameSettingAddResponseResultValueArray]. +type HostnameSettingAddResponseResultValue interface { + ImplementsHostnameSettingAddResponseResultValue() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*HostnameSettingAddResponseResultValue)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type HostnameSettingAddResponseResultValueArray []string + +func (r HostnameSettingAddResponseResultValueArray) ImplementsHostnameSettingAddResponseResultValue() { +} + +// Whether the API call was successful +type HostnameSettingAddResponseSuccess bool + +const ( + HostnameSettingAddResponseSuccessTrue HostnameSettingAddResponseSuccess = true +) + +// The TLS Setting name. +type HostnameSettingListParamsTlsSetting string + +const ( + HostnameSettingListParamsTlsSettingCiphers HostnameSettingListParamsTlsSetting = "ciphers" + HostnameSettingListParamsTlsSettingMinTlsVersion HostnameSettingListParamsTlsSetting = "min_tls_version" + HostnameSettingListParamsTlsSettingHttp2 HostnameSettingListParamsTlsSetting = "http2" +) + +// The TLS Setting name. +type HostnameSettingDeleteParamsTlsSetting string + +const ( + HostnameSettingDeleteParamsTlsSettingCiphers HostnameSettingDeleteParamsTlsSetting = "ciphers" + HostnameSettingDeleteParamsTlsSettingMinTlsVersion HostnameSettingDeleteParamsTlsSetting = "min_tls_version" + HostnameSettingDeleteParamsTlsSettingHttp2 HostnameSettingDeleteParamsTlsSetting = "http2" +) + +type HostnameSettingAddParams struct { + // The tls setting value. + Value param.Field[HostnameSettingAddParamsValue] `json:"value,required"` +} + +func (r HostnameSettingAddParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The TLS Setting name. +type HostnameSettingAddParamsTlsSetting string + +const ( + HostnameSettingAddParamsTlsSettingCiphers HostnameSettingAddParamsTlsSetting = "ciphers" + HostnameSettingAddParamsTlsSettingMinTlsVersion HostnameSettingAddParamsTlsSetting = "min_tls_version" + HostnameSettingAddParamsTlsSettingHttp2 HostnameSettingAddParamsTlsSetting = "http2" +) + +// The tls setting value. +// +// Satisfied by [shared.UnionFloat], [shared.UnionString], +// [HostnameSettingAddParamsValueArray]. +type HostnameSettingAddParamsValue interface { + ImplementsHostnameSettingAddParamsValue() +} + +type HostnameSettingAddParamsValueArray []string + +func (r HostnameSettingAddParamsValueArray) ImplementsHostnameSettingAddParamsValue() {} diff --git a/hostnamesetting_test.go b/hostnamesetting_test.go new file mode 100644 index 00000000000..f6fcadf05dc --- /dev/null +++ b/hostnamesetting_test.go @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestHostnameSettingList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Hostnames.Settings.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.HostnameSettingListParamsTlsSettingCiphers, + ) + 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 TestHostnameSettingDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Hostnames.Settings.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.HostnameSettingDeleteParamsTlsSettingCiphers, + "app.example.com", + ) + 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 TestHostnameSettingAdd(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Hostnames.Settings.Add( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.HostnameSettingAddParamsTlsSettingCiphers, + "app.example.com", + cloudflare.HostnameSettingAddParams{ + Value: cloudflare.F[cloudflare.HostnameSettingAddParamsValue](cloudflare.HostnameSettingAddParamsValueArray([]string{"ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"})), + }, + ) + 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/hyperdriveconfig.go b/hyperdriveconfig.go new file mode 100644 index 00000000000..76ead9fcbd0 --- /dev/null +++ b/hyperdriveconfig.go @@ -0,0 +1,483 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// HyperdriveConfigService 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 [NewHyperdriveConfigService] method +// instead. +type HyperdriveConfigService struct { + Options []option.RequestOption +} + +// NewHyperdriveConfigService 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 NewHyperdriveConfigService(opts ...option.RequestOption) (r *HyperdriveConfigService) { + r = &HyperdriveConfigService{} + r.Options = opts + return +} + +// Returns the specified Hyperdrive configuration. +func (r *HyperdriveConfigService) Get(ctx context.Context, accountIdentifier string, hyperdriveIdentifier string, opts ...option.RequestOption) (res *HyperdriveConfigGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/hyperdrive/configs/%s", accountIdentifier, hyperdriveIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates and returns the specified Hyperdrive configuration. +func (r *HyperdriveConfigService) Update(ctx context.Context, accountIdentifier string, hyperdriveIdentifier string, body HyperdriveConfigUpdateParams, opts ...option.RequestOption) (res *HyperdriveConfigUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/hyperdrive/configs/%s", accountIdentifier, hyperdriveIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes the specified Hyperdrive. +func (r *HyperdriveConfigService) Delete(ctx context.Context, accountIdentifier string, hyperdriveIdentifier string, opts ...option.RequestOption) (res *HyperdriveConfigDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/hyperdrive/configs/%s", accountIdentifier, hyperdriveIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type HyperdriveConfigGetResponse struct { + Errors []HyperdriveConfigGetResponseError `json:"errors"` + Messages []HyperdriveConfigGetResponseMessage `json:"messages"` + Result HyperdriveConfigGetResponseResult `json:"result"` + // Whether the API call was successful + Success HyperdriveConfigGetResponseSuccess `json:"success"` + JSON hyperdriveConfigGetResponseJSON `json:"-"` +} + +// hyperdriveConfigGetResponseJSON contains the JSON metadata for the struct +// [HyperdriveConfigGetResponse] +type hyperdriveConfigGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hyperdriveConfigGetResponseErrorJSON `json:"-"` +} + +// hyperdriveConfigGetResponseErrorJSON contains the JSON metadata for the struct +// [HyperdriveConfigGetResponseError] +type hyperdriveConfigGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hyperdriveConfigGetResponseMessageJSON `json:"-"` +} + +// hyperdriveConfigGetResponseMessageJSON contains the JSON metadata for the struct +// [HyperdriveConfigGetResponseMessage] +type hyperdriveConfigGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigGetResponseResult struct { + Name string `json:"name,required"` + Origin HyperdriveConfigGetResponseResultOrigin `json:"origin,required"` + Caching HyperdriveConfigGetResponseResultCaching `json:"caching"` + JSON hyperdriveConfigGetResponseResultJSON `json:"-"` +} + +// hyperdriveConfigGetResponseResultJSON contains the JSON metadata for the struct +// [HyperdriveConfigGetResponseResult] +type hyperdriveConfigGetResponseResultJSON struct { + Name apijson.Field + Origin apijson.Field + Caching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigGetResponseResultOrigin struct { + // The name of your origin database. + Database string `json:"database"` + // The host (hostname or IP) of your origin database. + Host string `json:"host"` + // The port (default: 5432 for Postgres) of your origin database. + Port int64 `json:"port"` + // Specifies the URL scheme used to connect to your origin database. + Scheme HyperdriveConfigGetResponseResultOriginScheme `json:"scheme"` + // The user of your origin database. + User string `json:"user"` + JSON hyperdriveConfigGetResponseResultOriginJSON `json:"-"` +} + +// hyperdriveConfigGetResponseResultOriginJSON contains the JSON metadata for the +// struct [HyperdriveConfigGetResponseResultOrigin] +type hyperdriveConfigGetResponseResultOriginJSON struct { + Database apijson.Field + Host apijson.Field + Port apijson.Field + Scheme apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigGetResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the URL scheme used to connect to your origin database. +type HyperdriveConfigGetResponseResultOriginScheme string + +const ( + HyperdriveConfigGetResponseResultOriginSchemePostgres HyperdriveConfigGetResponseResultOriginScheme = "postgres" + HyperdriveConfigGetResponseResultOriginSchemePostgresql HyperdriveConfigGetResponseResultOriginScheme = "postgresql" +) + +type HyperdriveConfigGetResponseResultCaching struct { + // When set to true, disables the caching of SQL responses. (Default: false) + Disabled bool `json:"disabled"` + // When present, specifies max duration for which items should persist in the + // cache. (Default: 60) + MaxAge int64 `json:"max_age"` + // When present, indicates the number of seconds cache may serve the response after + // it becomes stale. (Default: 15) + StaleWhileRevalidate int64 `json:"stale_while_revalidate"` + JSON hyperdriveConfigGetResponseResultCachingJSON `json:"-"` +} + +// hyperdriveConfigGetResponseResultCachingJSON contains the JSON metadata for the +// struct [HyperdriveConfigGetResponseResultCaching] +type hyperdriveConfigGetResponseResultCachingJSON struct { + Disabled apijson.Field + MaxAge apijson.Field + StaleWhileRevalidate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigGetResponseResultCaching) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type HyperdriveConfigGetResponseSuccess bool + +const ( + HyperdriveConfigGetResponseSuccessTrue HyperdriveConfigGetResponseSuccess = true +) + +type HyperdriveConfigUpdateResponse struct { + Errors []HyperdriveConfigUpdateResponseError `json:"errors"` + Messages []HyperdriveConfigUpdateResponseMessage `json:"messages"` + Result HyperdriveConfigUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success HyperdriveConfigUpdateResponseSuccess `json:"success"` + JSON hyperdriveConfigUpdateResponseJSON `json:"-"` +} + +// hyperdriveConfigUpdateResponseJSON contains the JSON metadata for the struct +// [HyperdriveConfigUpdateResponse] +type hyperdriveConfigUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hyperdriveConfigUpdateResponseErrorJSON `json:"-"` +} + +// hyperdriveConfigUpdateResponseErrorJSON contains the JSON metadata for the +// struct [HyperdriveConfigUpdateResponseError] +type hyperdriveConfigUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hyperdriveConfigUpdateResponseMessageJSON `json:"-"` +} + +// hyperdriveConfigUpdateResponseMessageJSON contains the JSON metadata for the +// struct [HyperdriveConfigUpdateResponseMessage] +type hyperdriveConfigUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigUpdateResponseResult struct { + Name string `json:"name,required"` + Origin HyperdriveConfigUpdateResponseResultOrigin `json:"origin,required"` + Caching HyperdriveConfigUpdateResponseResultCaching `json:"caching"` + JSON hyperdriveConfigUpdateResponseResultJSON `json:"-"` +} + +// hyperdriveConfigUpdateResponseResultJSON contains the JSON metadata for the +// struct [HyperdriveConfigUpdateResponseResult] +type hyperdriveConfigUpdateResponseResultJSON struct { + Name apijson.Field + Origin apijson.Field + Caching apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigUpdateResponseResultOrigin struct { + // The name of your origin database. + Database string `json:"database"` + // The host (hostname or IP) of your origin database. + Host string `json:"host"` + // The port (default: 5432 for Postgres) of your origin database. + Port int64 `json:"port"` + // Specifies the URL scheme used to connect to your origin database. + Scheme HyperdriveConfigUpdateResponseResultOriginScheme `json:"scheme"` + // The user of your origin database. + User string `json:"user"` + JSON hyperdriveConfigUpdateResponseResultOriginJSON `json:"-"` +} + +// hyperdriveConfigUpdateResponseResultOriginJSON contains the JSON metadata for +// the struct [HyperdriveConfigUpdateResponseResultOrigin] +type hyperdriveConfigUpdateResponseResultOriginJSON struct { + Database apijson.Field + Host apijson.Field + Port apijson.Field + Scheme apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigUpdateResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the URL scheme used to connect to your origin database. +type HyperdriveConfigUpdateResponseResultOriginScheme string + +const ( + HyperdriveConfigUpdateResponseResultOriginSchemePostgres HyperdriveConfigUpdateResponseResultOriginScheme = "postgres" + HyperdriveConfigUpdateResponseResultOriginSchemePostgresql HyperdriveConfigUpdateResponseResultOriginScheme = "postgresql" +) + +type HyperdriveConfigUpdateResponseResultCaching struct { + // When set to true, disables the caching of SQL responses. (Default: false) + Disabled bool `json:"disabled"` + // When present, specifies max duration for which items should persist in the + // cache. (Default: 60) + MaxAge int64 `json:"max_age"` + // When present, indicates the number of seconds cache may serve the response after + // it becomes stale. (Default: 15) + StaleWhileRevalidate int64 `json:"stale_while_revalidate"` + JSON hyperdriveConfigUpdateResponseResultCachingJSON `json:"-"` +} + +// hyperdriveConfigUpdateResponseResultCachingJSON contains the JSON metadata for +// the struct [HyperdriveConfigUpdateResponseResultCaching] +type hyperdriveConfigUpdateResponseResultCachingJSON struct { + Disabled apijson.Field + MaxAge apijson.Field + StaleWhileRevalidate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigUpdateResponseResultCaching) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type HyperdriveConfigUpdateResponseSuccess bool + +const ( + HyperdriveConfigUpdateResponseSuccessTrue HyperdriveConfigUpdateResponseSuccess = true +) + +type HyperdriveConfigDeleteResponse struct { + Errors []HyperdriveConfigDeleteResponseError `json:"errors"` + Messages []HyperdriveConfigDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result,nullable"` + // Whether the API call was successful + Success HyperdriveConfigDeleteResponseSuccess `json:"success"` + JSON hyperdriveConfigDeleteResponseJSON `json:"-"` +} + +// hyperdriveConfigDeleteResponseJSON contains the JSON metadata for the struct +// [HyperdriveConfigDeleteResponse] +type hyperdriveConfigDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hyperdriveConfigDeleteResponseErrorJSON `json:"-"` +} + +// hyperdriveConfigDeleteResponseErrorJSON contains the JSON metadata for the +// struct [HyperdriveConfigDeleteResponseError] +type hyperdriveConfigDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HyperdriveConfigDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON hyperdriveConfigDeleteResponseMessageJSON `json:"-"` +} + +// hyperdriveConfigDeleteResponseMessageJSON contains the JSON metadata for the +// struct [HyperdriveConfigDeleteResponseMessage] +type hyperdriveConfigDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HyperdriveConfigDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type HyperdriveConfigDeleteResponseSuccess bool + +const ( + HyperdriveConfigDeleteResponseSuccessTrue HyperdriveConfigDeleteResponseSuccess = true +) + +type HyperdriveConfigUpdateParams struct { + Name param.Field[string] `json:"name,required"` + Origin param.Field[HyperdriveConfigUpdateParamsOrigin] `json:"origin,required"` + Caching param.Field[HyperdriveConfigUpdateParamsCaching] `json:"caching"` +} + +func (r HyperdriveConfigUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type HyperdriveConfigUpdateParamsOrigin struct { + // The name of your origin database. + Database param.Field[string] `json:"database"` + // The host (hostname or IP) of your origin database. + Host param.Field[string] `json:"host"` + // The port (default: 5432 for Postgres) of your origin database. + Port param.Field[int64] `json:"port"` + // Specifies the URL scheme used to connect to your origin database. + Scheme param.Field[HyperdriveConfigUpdateParamsOriginScheme] `json:"scheme"` + // The user of your origin database. + User param.Field[string] `json:"user"` +} + +func (r HyperdriveConfigUpdateParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Specifies the URL scheme used to connect to your origin database. +type HyperdriveConfigUpdateParamsOriginScheme string + +const ( + HyperdriveConfigUpdateParamsOriginSchemePostgres HyperdriveConfigUpdateParamsOriginScheme = "postgres" + HyperdriveConfigUpdateParamsOriginSchemePostgresql HyperdriveConfigUpdateParamsOriginScheme = "postgresql" +) + +type HyperdriveConfigUpdateParamsCaching struct { + // When set to true, disables the caching of SQL responses. (Default: false) + Disabled param.Field[bool] `json:"disabled"` + // When present, specifies max duration for which items should persist in the + // cache. (Default: 60) + MaxAge param.Field[int64] `json:"max_age"` + // When present, indicates the number of seconds cache may serve the response after + // it becomes stale. (Default: 15) + StaleWhileRevalidate param.Field[int64] `json:"stale_while_revalidate"` +} + +func (r HyperdriveConfigUpdateParamsCaching) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/hyperdriveconfig_test.go b/hyperdriveconfig_test.go new file mode 100644 index 00000000000..85e729de3dd --- /dev/null +++ b/hyperdriveconfig_test.go @@ -0,0 +1,119 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestHyperdriveConfigGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.HyperdriveConfigs.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestHyperdriveConfigUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.HyperdriveConfigs.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.HyperdriveConfigUpdateParams{ + Name: cloudflare.F("example-hyperdrive"), + Origin: cloudflare.F(cloudflare.HyperdriveConfigUpdateParamsOrigin{ + Database: cloudflare.F("postgres"), + Host: cloudflare.F("database.example.com"), + Port: cloudflare.F(int64(5432)), + Scheme: cloudflare.F(cloudflare.HyperdriveConfigUpdateParamsOriginSchemePostgres), + User: cloudflare.F("postgres"), + }), + Caching: cloudflare.F(cloudflare.HyperdriveConfigUpdateParamsCaching{ + Disabled: cloudflare.F(false), + MaxAge: cloudflare.F(int64(30)), + StaleWhileRevalidate: cloudflare.F(int64(15)), + }), + }, + ) + 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 TestHyperdriveConfigDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.HyperdriveConfigs.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/imagesv2.go b/imagesv2.go new file mode 100644 index 00000000000..8286398dcd8 --- /dev/null +++ b/imagesv2.go @@ -0,0 +1,223 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ImagesV2Service 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 [NewImagesV2Service] method instead. +type ImagesV2Service struct { + Options []option.RequestOption +} + +// NewImagesV2Service 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 NewImagesV2Service(opts ...option.RequestOption) (r *ImagesV2Service) { + r = &ImagesV2Service{} + r.Options = opts + return +} + +// List up to 10000 images with one request. Use the optional parameters below to +// get a specific range of images. Endpoint returns continuation_token if more +// images are present. +func (r *ImagesV2Service) List(ctx context.Context, accountIdentifier string, query ImagesV2ListParams, opts ...option.RequestOption) (res *ImagesImagesListResponseV2, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/images/v2", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ImagesImagesListResponseV2 struct { + Errors []ImagesImagesListResponseV2Error `json:"errors"` + Messages []ImagesImagesListResponseV2Message `json:"messages"` + Result ImagesImagesListResponseV2Result `json:"result"` + // Whether the API call was successful + Success ImagesImagesListResponseV2Success `json:"success"` + JSON imagesImagesListResponseV2JSON `json:"-"` +} + +// imagesImagesListResponseV2JSON contains the JSON metadata for the struct +// [ImagesImagesListResponseV2] +type imagesImagesListResponseV2JSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ImagesImagesListResponseV2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ImagesImagesListResponseV2Error struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON imagesImagesListResponseV2ErrorJSON `json:"-"` +} + +// imagesImagesListResponseV2ErrorJSON contains the JSON metadata for the struct +// [ImagesImagesListResponseV2Error] +type imagesImagesListResponseV2ErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ImagesImagesListResponseV2Error) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ImagesImagesListResponseV2Message struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON imagesImagesListResponseV2MessageJSON `json:"-"` +} + +// imagesImagesListResponseV2MessageJSON contains the JSON metadata for the struct +// [ImagesImagesListResponseV2Message] +type imagesImagesListResponseV2MessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ImagesImagesListResponseV2Message) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ImagesImagesListResponseV2Result struct { + Images []ImagesImagesListResponseV2ResultImage `json:"images"` + JSON imagesImagesListResponseV2ResultJSON `json:"-"` +} + +// imagesImagesListResponseV2ResultJSON contains the JSON metadata for the struct +// [ImagesImagesListResponseV2Result] +type imagesImagesListResponseV2ResultJSON struct { + Images apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ImagesImagesListResponseV2Result) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ImagesImagesListResponseV2ResultImage struct { + // Image unique identifier. + ID string `json:"id"` + // Image file name. + Filename string `json:"filename"` + // User modifiable key-value store. Can be used for keeping references to another + // system of record for managing images. Metadata must not exceed 1024 bytes. + Meta interface{} `json:"meta"` + // Indicates whether the image can be a accessed only using it's UID. If set to + // true, a signed token needs to be generated with a signing key to view the image. + RequireSignedURLs bool `json:"requireSignedURLs"` + // When the media item was uploaded. + Uploaded time.Time `json:"uploaded" format:"date-time"` + // Object specifying available variants for an image. + Variants []ImagesImagesListResponseV2ResultImagesVariant `json:"variants" format:"uri"` + JSON imagesImagesListResponseV2ResultImageJSON `json:"-"` +} + +// imagesImagesListResponseV2ResultImageJSON contains the JSON metadata for the +// struct [ImagesImagesListResponseV2ResultImage] +type imagesImagesListResponseV2ResultImageJSON struct { + ID apijson.Field + Filename apijson.Field + Meta apijson.Field + RequireSignedURLs apijson.Field + Uploaded apijson.Field + Variants apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ImagesImagesListResponseV2ResultImage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// URI to thumbnail variant for an image. +// +// Union satisfied by [shared.UnionString], [shared.UnionString] or +// [shared.UnionString]. +type ImagesImagesListResponseV2ResultImagesVariant interface { + ImplementsImagesImagesListResponseV2ResultImagesVariant() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ImagesImagesListResponseV2ResultImagesVariant)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type ImagesImagesListResponseV2Success bool + +const ( + ImagesImagesListResponseV2SuccessTrue ImagesImagesListResponseV2Success = true +) + +type ImagesV2ListParams struct { + // Continuation token for a next page. List images V2 returns continuation_token + ContinuationToken param.Field[string] `query:"continuation_token"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` + // Sorting order by upload time. + SortOrder param.Field[ImagesV2ListParamsSortOrder] `query:"sort_order"` +} + +// URLQuery serializes [ImagesV2ListParams]'s query parameters as `url.Values`. +func (r ImagesV2ListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Sorting order by upload time. +type ImagesV2ListParamsSortOrder string + +const ( + ImagesV2ListParamsSortOrderAsc ImagesV2ListParamsSortOrder = "asc" + ImagesV2ListParamsSortOrderDesc ImagesV2ListParamsSortOrder = "desc" +) diff --git a/imagesv2_test.go b/imagesv2_test.go new file mode 100644 index 00000000000..82d24b006f2 --- /dev/null +++ b/imagesv2_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestImagesV2ListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.ImagesV2s.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ImagesV2ListParams{ + ContinuationToken: cloudflare.F("string"), + PerPage: cloudflare.F(10.000000), + SortOrder: cloudflare.F(cloudflare.ImagesV2ListParamsSortOrderAsc), + }, + ) + 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/intel.go b/intel.go new file mode 100644 index 00000000000..3a9f05f5053 --- /dev/null +++ b/intel.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// IntelService 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 [NewIntelService] method instead. +type IntelService struct { + Options []option.RequestOption + IndicatorFeeds *IntelIndicatorFeedService +} + +// NewIntelService 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 NewIntelService(opts ...option.RequestOption) (r *IntelService) { + r = &IntelService{} + r.Options = opts + r.IndicatorFeeds = NewIntelIndicatorFeedService(opts...) + return +} diff --git a/intelindicatorfeed.go b/intelindicatorfeed.go new file mode 100644 index 00000000000..5611906c500 --- /dev/null +++ b/intelindicatorfeed.go @@ -0,0 +1,501 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// IntelIndicatorFeedService 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 [NewIntelIndicatorFeedService] method +// instead. +type IntelIndicatorFeedService struct { + Options []option.RequestOption + Permissions *IntelIndicatorFeedPermissionService +} + +// NewIntelIndicatorFeedService 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 NewIntelIndicatorFeedService(opts ...option.RequestOption) (r *IntelIndicatorFeedService) { + r = &IntelIndicatorFeedService{} + r.Options = opts + r.Permissions = NewIntelIndicatorFeedPermissionService(opts...) + return +} + +// Create new indicator feed +func (r *IntelIndicatorFeedService) New(ctx context.Context, accountIdentifier string, body IntelIndicatorFeedNewParams, opts ...option.RequestOption) (res *IntelIndicatorFeedNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get indicator feed metadata +func (r *IntelIndicatorFeedService) Get(ctx context.Context, accountIdentifier string, feedID int64, opts ...option.RequestOption) (res *IntelIndicatorFeedGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/%v", accountIdentifier, feedID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Get indicator feeds owned by this account +func (r *IntelIndicatorFeedService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *IntelIndicatorFeedListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Get indicator feed data +func (r *IntelIndicatorFeedService) Data(ctx context.Context, accountIdentifier string, feedID int64, opts ...option.RequestOption) (res *string, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "text/csv")}, opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/%v/data", accountIdentifier, feedID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update indicator feed data +func (r *IntelIndicatorFeedService) Snapshot(ctx context.Context, accountIdentifier string, feedID int64, body IntelIndicatorFeedSnapshotParams, opts ...option.RequestOption) (res *IntelIndicatorFeedSnapshotResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/%v/snapshot", accountIdentifier, feedID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type IntelIndicatorFeedNewResponse struct { + Errors []IntelIndicatorFeedNewResponseError `json:"errors"` + Messages []IntelIndicatorFeedNewResponseMessage `json:"messages"` + Result IntelIndicatorFeedNewResponseResult `json:"result"` + // Whether the API call was successful + Success IntelIndicatorFeedNewResponseSuccess `json:"success"` + JSON intelIndicatorFeedNewResponseJSON `json:"-"` +} + +// intelIndicatorFeedNewResponseJSON contains the JSON metadata for the struct +// [IntelIndicatorFeedNewResponse] +type intelIndicatorFeedNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedNewResponseErrorJSON `json:"-"` +} + +// intelIndicatorFeedNewResponseErrorJSON contains the JSON metadata for the struct +// [IntelIndicatorFeedNewResponseError] +type intelIndicatorFeedNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedNewResponseMessageJSON `json:"-"` +} + +// intelIndicatorFeedNewResponseMessageJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedNewResponseMessage] +type intelIndicatorFeedNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedNewResponseResult struct { + // The unique identifier for the indicator feed + ID int64 `json:"id"` + // The date and time when the data entry was created + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The description of the example test + Description string `json:"description"` + // The date and time when the data entry was last modified + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The name of the indicator feed + Name string `json:"name"` + JSON intelIndicatorFeedNewResponseResultJSON `json:"-"` +} + +// intelIndicatorFeedNewResponseResultJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedNewResponseResult] +type intelIndicatorFeedNewResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type IntelIndicatorFeedNewResponseSuccess bool + +const ( + IntelIndicatorFeedNewResponseSuccessTrue IntelIndicatorFeedNewResponseSuccess = true +) + +type IntelIndicatorFeedGetResponse struct { + Errors []IntelIndicatorFeedGetResponseError `json:"errors"` + Messages []IntelIndicatorFeedGetResponseMessage `json:"messages"` + Result IntelIndicatorFeedGetResponseResult `json:"result"` + // Whether the API call was successful + Success IntelIndicatorFeedGetResponseSuccess `json:"success"` + JSON intelIndicatorFeedGetResponseJSON `json:"-"` +} + +// intelIndicatorFeedGetResponseJSON contains the JSON metadata for the struct +// [IntelIndicatorFeedGetResponse] +type intelIndicatorFeedGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedGetResponseErrorJSON `json:"-"` +} + +// intelIndicatorFeedGetResponseErrorJSON contains the JSON metadata for the struct +// [IntelIndicatorFeedGetResponseError] +type intelIndicatorFeedGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedGetResponseMessageJSON `json:"-"` +} + +// intelIndicatorFeedGetResponseMessageJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedGetResponseMessage] +type intelIndicatorFeedGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedGetResponseResult struct { + // The unique identifier for the indicator feed + ID int64 `json:"id"` + // The date and time when the data entry was created + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The description of the example test + Description string `json:"description"` + // Status of the latest snapshot uploaded + LatestUploadStatus IntelIndicatorFeedGetResponseResultLatestUploadStatus `json:"latest_upload_status"` + // The date and time when the data entry was last modified + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The name of the indicator feed + Name string `json:"name"` + JSON intelIndicatorFeedGetResponseResultJSON `json:"-"` +} + +// intelIndicatorFeedGetResponseResultJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedGetResponseResult] +type intelIndicatorFeedGetResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + LatestUploadStatus apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the latest snapshot uploaded +type IntelIndicatorFeedGetResponseResultLatestUploadStatus string + +const ( + IntelIndicatorFeedGetResponseResultLatestUploadStatusMirroring IntelIndicatorFeedGetResponseResultLatestUploadStatus = "Mirroring" + IntelIndicatorFeedGetResponseResultLatestUploadStatusUnifying IntelIndicatorFeedGetResponseResultLatestUploadStatus = "Unifying" + IntelIndicatorFeedGetResponseResultLatestUploadStatusLoading IntelIndicatorFeedGetResponseResultLatestUploadStatus = "Loading" + IntelIndicatorFeedGetResponseResultLatestUploadStatusProvisioning IntelIndicatorFeedGetResponseResultLatestUploadStatus = "Provisioning" + IntelIndicatorFeedGetResponseResultLatestUploadStatusComplete IntelIndicatorFeedGetResponseResultLatestUploadStatus = "Complete" + IntelIndicatorFeedGetResponseResultLatestUploadStatusError IntelIndicatorFeedGetResponseResultLatestUploadStatus = "Error" +) + +// Whether the API call was successful +type IntelIndicatorFeedGetResponseSuccess bool + +const ( + IntelIndicatorFeedGetResponseSuccessTrue IntelIndicatorFeedGetResponseSuccess = true +) + +type IntelIndicatorFeedListResponse struct { + Errors []IntelIndicatorFeedListResponseError `json:"errors"` + Messages []IntelIndicatorFeedListResponseMessage `json:"messages"` + Result []IntelIndicatorFeedListResponseResult `json:"result"` + // Whether the API call was successful + Success IntelIndicatorFeedListResponseSuccess `json:"success"` + JSON intelIndicatorFeedListResponseJSON `json:"-"` +} + +// intelIndicatorFeedListResponseJSON contains the JSON metadata for the struct +// [IntelIndicatorFeedListResponse] +type intelIndicatorFeedListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedListResponseErrorJSON `json:"-"` +} + +// intelIndicatorFeedListResponseErrorJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedListResponseError] +type intelIndicatorFeedListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedListResponseMessageJSON `json:"-"` +} + +// intelIndicatorFeedListResponseMessageJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedListResponseMessage] +type intelIndicatorFeedListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedListResponseResult struct { + // The unique identifier for the indicator feed + ID int64 `json:"id"` + // The date and time when the data entry was created + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The description of the example test + Description string `json:"description"` + // The date and time when the data entry was last modified + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The name of the indicator feed + Name string `json:"name"` + JSON intelIndicatorFeedListResponseResultJSON `json:"-"` +} + +// intelIndicatorFeedListResponseResultJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedListResponseResult] +type intelIndicatorFeedListResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type IntelIndicatorFeedListResponseSuccess bool + +const ( + IntelIndicatorFeedListResponseSuccessTrue IntelIndicatorFeedListResponseSuccess = true +) + +type IntelIndicatorFeedSnapshotResponse struct { + Errors []IntelIndicatorFeedSnapshotResponseError `json:"errors"` + Messages []IntelIndicatorFeedSnapshotResponseMessage `json:"messages"` + Result IntelIndicatorFeedSnapshotResponseResult `json:"result"` + // Whether the API call was successful + Success IntelIndicatorFeedSnapshotResponseSuccess `json:"success"` + JSON intelIndicatorFeedSnapshotResponseJSON `json:"-"` +} + +// intelIndicatorFeedSnapshotResponseJSON contains the JSON metadata for the struct +// [IntelIndicatorFeedSnapshotResponse] +type intelIndicatorFeedSnapshotResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedSnapshotResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedSnapshotResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedSnapshotResponseErrorJSON `json:"-"` +} + +// intelIndicatorFeedSnapshotResponseErrorJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedSnapshotResponseError] +type intelIndicatorFeedSnapshotResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedSnapshotResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedSnapshotResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedSnapshotResponseMessageJSON `json:"-"` +} + +// intelIndicatorFeedSnapshotResponseMessageJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedSnapshotResponseMessage] +type intelIndicatorFeedSnapshotResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedSnapshotResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedSnapshotResponseResult struct { + // Feed id + FileID int64 `json:"file_id"` + // Name of the file unified in our system + Filename string `json:"filename"` + // Current status of upload, should be unified + Status string `json:"status"` + JSON intelIndicatorFeedSnapshotResponseResultJSON `json:"-"` +} + +// intelIndicatorFeedSnapshotResponseResultJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedSnapshotResponseResult] +type intelIndicatorFeedSnapshotResponseResultJSON struct { + FileID apijson.Field + Filename apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedSnapshotResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type IntelIndicatorFeedSnapshotResponseSuccess bool + +const ( + IntelIndicatorFeedSnapshotResponseSuccessTrue IntelIndicatorFeedSnapshotResponseSuccess = true +) + +type IntelIndicatorFeedNewParams struct { + // The description of the example test + Description param.Field[string] `json:"description"` + // The name of the indicator feed + Name param.Field[string] `json:"name"` +} + +func (r IntelIndicatorFeedNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IntelIndicatorFeedSnapshotParams struct { + // The file to upload + Source param.Field[string] `json:"source"` +} + +func (r IntelIndicatorFeedSnapshotParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/intelindicatorfeed_test.go b/intelindicatorfeed_test.go new file mode 100644 index 00000000000..22a4ebe73fd --- /dev/null +++ b/intelindicatorfeed_test.go @@ -0,0 +1,166 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestIntelIndicatorFeedNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Intel.IndicatorFeeds.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.IntelIndicatorFeedNewParams{ + Description: cloudflare.F("example feed description"), + Name: cloudflare.F("example_feed_1"), + }, + ) + 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 TestIntelIndicatorFeedGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Intel.IndicatorFeeds.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(12), + ) + 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 TestIntelIndicatorFeedList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Intel.IndicatorFeeds.List(context.TODO(), "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()) + } +} + +func TestIntelIndicatorFeedData(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Intel.IndicatorFeeds.Data( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(12), + ) + 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 TestIntelIndicatorFeedSnapshotWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Intel.IndicatorFeeds.Snapshot( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(12), + cloudflare.IntelIndicatorFeedSnapshotParams{ + Source: cloudflare.F("@/Users/me/test.stix2"), + }, + ) + 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/intelindicatorfeedpermission.go b/intelindicatorfeedpermission.go new file mode 100644 index 00000000000..d8df13b028c --- /dev/null +++ b/intelindicatorfeedpermission.go @@ -0,0 +1,138 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// IntelIndicatorFeedPermissionService 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 +// [NewIntelIndicatorFeedPermissionService] method instead. +type IntelIndicatorFeedPermissionService struct { + Options []option.RequestOption +} + +// NewIntelIndicatorFeedPermissionService 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 NewIntelIndicatorFeedPermissionService(opts ...option.RequestOption) (r *IntelIndicatorFeedPermissionService) { + r = &IntelIndicatorFeedPermissionService{} + r.Options = opts + return +} + +// Grant permission to indicator feed +func (r *IntelIndicatorFeedPermissionService) Add(ctx context.Context, accountIdentifier string, body IntelIndicatorFeedPermissionAddParams, opts ...option.RequestOption) (res *IntelIndicatorFeedPermissionAddResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/permissions/add", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type IntelIndicatorFeedPermissionAddResponse struct { + Errors []IntelIndicatorFeedPermissionAddResponseError `json:"errors"` + Messages []IntelIndicatorFeedPermissionAddResponseMessage `json:"messages"` + Result IntelIndicatorFeedPermissionAddResponseResult `json:"result"` + // Whether the API call was successful + Success IntelIndicatorFeedPermissionAddResponseSuccess `json:"success"` + JSON intelIndicatorFeedPermissionAddResponseJSON `json:"-"` +} + +// intelIndicatorFeedPermissionAddResponseJSON contains the JSON metadata for the +// struct [IntelIndicatorFeedPermissionAddResponse] +type intelIndicatorFeedPermissionAddResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedPermissionAddResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedPermissionAddResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedPermissionAddResponseErrorJSON `json:"-"` +} + +// intelIndicatorFeedPermissionAddResponseErrorJSON contains the JSON metadata for +// the struct [IntelIndicatorFeedPermissionAddResponseError] +type intelIndicatorFeedPermissionAddResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedPermissionAddResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedPermissionAddResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON intelIndicatorFeedPermissionAddResponseMessageJSON `json:"-"` +} + +// intelIndicatorFeedPermissionAddResponseMessageJSON contains the JSON metadata +// for the struct [IntelIndicatorFeedPermissionAddResponseMessage] +type intelIndicatorFeedPermissionAddResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedPermissionAddResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IntelIndicatorFeedPermissionAddResponseResult struct { + // Whether the update succeeded or not + Success bool `json:"success"` + JSON intelIndicatorFeedPermissionAddResponseResultJSON `json:"-"` +} + +// intelIndicatorFeedPermissionAddResponseResultJSON contains the JSON metadata for +// the struct [IntelIndicatorFeedPermissionAddResponseResult] +type intelIndicatorFeedPermissionAddResponseResultJSON struct { + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntelIndicatorFeedPermissionAddResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type IntelIndicatorFeedPermissionAddResponseSuccess bool + +const ( + IntelIndicatorFeedPermissionAddResponseSuccessTrue IntelIndicatorFeedPermissionAddResponseSuccess = true +) + +type IntelIndicatorFeedPermissionAddParams struct { + // The Cloudflare account tag of the account to change permissions on + AccountTag param.Field[string] `json:"account_tag"` + // The ID of the feed to add/remove permissions on + FeedID param.Field[int64] `json:"feed_id"` +} + +func (r IntelIndicatorFeedPermissionAddParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/intelindicatorfeedpermission_test.go b/intelindicatorfeedpermission_test.go new file mode 100644 index 00000000000..b6b6a3c5556 --- /dev/null +++ b/intelindicatorfeedpermission_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestIntelIndicatorFeedPermissionAddWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Intel.IndicatorFeeds.Permissions.Add( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.IntelIndicatorFeedPermissionAddParams{ + AccountTag: cloudflare.F("823f45f16fd2f7e21e1e054aga4d2859"), + FeedID: cloudflare.F(int64(1)), + }, + ) + 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/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index ba25cb13d85..3a3b6d795e0 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -146,8 +146,10 @@ type RequestConfig struct { BaseURL *url.URL HTTPClient *http.Client Middlewares []middleware + APIEmail string APIKey string - Email string + APIToken string + UserServiceKey string // If ResponseBodyInto not nil, then we will attempt to deserialize into // ResponseBodyInto. If Destination is a []byte, then it will return the body as // is. diff --git a/internal/shared/pagination.go b/internal/shared/pagination.go new file mode 100644 index 00000000000..1606f330d74 --- /dev/null +++ b/internal/shared/pagination.go @@ -0,0 +1,128 @@ +// File generated from our OpenAPI spec by Stainless. + +package shared + +import ( + "context" + "fmt" + "net/http" + "strconv" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" +) + +type PageResultInfo struct { + Count interface{} `json:"count"` + Page interface{} `json:"page"` + PerPage interface{} `json:"per_page"` + TotalCount interface{} `json:"total_count"` + JSON pageResultInfoJSON `json:"-"` +} + +// pageResultInfoJSON contains the JSON metadata for the struct [PageResultInfo] +type pageResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type Page[T any] struct { + Result []T `json:"result"` + ResultInfo PageResultInfo `json:"result_info"` + JSON pageJSON `json:"-"` + cfg *requestconfig.RequestConfig + res *http.Response +} + +// pageJSON contains the JSON metadata for the struct [Page[T]] +type pageJSON struct { + Result apijson.Field + ResultInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Page[T]) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// NextPage returns the next page as defined by this pagination style. When there +// is no next page, this function will return a 'nil' for the page value, but will +// not return an error +func (r *Page[T]) GetNextPage() (res *Page[T], err error) { + u := r.cfg.Request.URL + currentPage, err := strconv.Atoi(u.Query().Get("page")) + if err != nil { + currentPage = 1 + } + cfg := r.cfg.Clone(context.Background()) + query := cfg.Request.URL.Query() + query.Set("page", fmt.Sprintf("%d", currentPage+1)) + cfg.Request.URL.RawQuery = query.Encode() + var raw *http.Response + cfg.ResponseInto = &raw + cfg.ResponseBodyInto = &res + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +func (r *Page[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) { + r.cfg = cfg + r.res = res +} + +type PageAutoPager[T any] struct { + page *Page[T] + cur T + idx int + run int + err error +} + +func NewPageAutoPager[T any](page *Page[T], err error) *PageAutoPager[T] { + return &PageAutoPager[T]{ + page: page, + err: err, + } +} + +func (r *PageAutoPager[T]) Next() bool { + if r.page == nil || len(r.page.Result) == 0 { + return false + } + if r.idx >= len(r.page.Result) { + r.idx = 0 + r.page, r.err = r.page.GetNextPage() + if r.err != nil || r.page == nil || len(r.page.Result) == 0 { + return false + } + } + r.cur = r.page.Result[r.idx] + r.run += 1 + r.idx += 1 + return true +} + +func (r *PageAutoPager[T]) Current() T { + return r.cur +} + +func (r *PageAutoPager[T]) Err() error { + return r.err +} + +func (r *PageAutoPager[T]) Index() int { + return r.run +} diff --git a/internal/shared/shared.go b/internal/shared/shared.go new file mode 100644 index 00000000000..79cbdaacfe1 --- /dev/null +++ b/internal/shared/shared.go @@ -0,0 +1,102 @@ +// File generated from our OpenAPI spec by Stainless. + +package shared + +import ( + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" +) + +type VectorizeCreateIndexResponse struct { + Config VectorizeCreateIndexResponseConfig `json:"config"` + // Specifies the timestamp the resource was created as an ISO8601 string. + CreatedOn interface{} `json:"created_on"` + // Specifies the description of the index. + Description string `json:"description"` + // Specifies the timestamp the resource was modified as an ISO8601 string. + ModifiedOn interface{} `json:"modified_on"` + Name string `json:"name"` + JSON vectorizeCreateIndexResponseJSON `json:"-"` +} + +// vectorizeCreateIndexResponseJSON contains the JSON metadata for the struct +// [VectorizeCreateIndexResponse] +type vectorizeCreateIndexResponseJSON struct { + Config apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *VectorizeCreateIndexResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type VectorizeCreateIndexResponseConfig struct { + // Specifies the number of dimensions for the index + Dimensions int64 `json:"dimensions,required"` + // Specifies the type of metric to use calculating distance. + Metric VectorizeCreateIndexResponseConfigMetric `json:"metric,required"` + JSON vectorizeCreateIndexResponseConfigJSON `json:"-"` +} + +// vectorizeCreateIndexResponseConfigJSON contains the JSON metadata for the struct +// [VectorizeCreateIndexResponseConfig] +type vectorizeCreateIndexResponseConfigJSON struct { + Dimensions apijson.Field + Metric apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *VectorizeCreateIndexResponseConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the type of metric to use calculating distance. +type VectorizeCreateIndexResponseConfigMetric string + +const ( + VectorizeCreateIndexResponseConfigMetricCosine VectorizeCreateIndexResponseConfigMetric = "cosine" + VectorizeCreateIndexResponseConfigMetricEuclidean VectorizeCreateIndexResponseConfigMetric = "euclidean" + VectorizeCreateIndexResponseConfigMetricDotProduct VectorizeCreateIndexResponseConfigMetric = "dot-product" +) + +type WaitingRoomSettingsResponse struct { + Result WaitingRoomSettingsResponseResult `json:"result"` + JSON waitingRoomSettingsResponseJSON `json:"-"` +} + +// waitingRoomSettingsResponseJSON contains the JSON metadata for the struct +// [WaitingRoomSettingsResponse] +type waitingRoomSettingsResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WaitingRoomSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WaitingRoomSettingsResponseResult struct { + // Whether to allow verified search engine crawlers to bypass all waiting rooms on + // this zone. Verified search engine crawlers will not be tracked or counted by the + // waiting room system, and will not appear in waiting room analytics. + SearchEngineCrawlerBypass bool `json:"search_engine_crawler_bypass,required"` + JSON waitingRoomSettingsResponseResultJSON `json:"-"` +} + +// waitingRoomSettingsResponseResultJSON contains the JSON metadata for the struct +// [WaitingRoomSettingsResponseResult] +type waitingRoomSettingsResponseResultJSON struct { + SearchEngineCrawlerBypass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WaitingRoomSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/internal/shared/union.go b/internal/shared/union.go index 39cc9b4625a..ae23a18a26b 100644 --- a/internal/shared/union.go +++ b/internal/shared/union.go @@ -4,9 +4,276 @@ package shared type UnionString string -func (UnionString) ImplementsAIBaaiBgeBaseEnV1_5ParamsText() {} -func (UnionString) ImplementsAIBaaiBgeLargeEnV1_5ParamsText() {} -func (UnionString) ImplementsAIBaaiBgeSmallEnV1_5ParamsText() {} -func (UnionString) ImplementsAIMetaLlama2_7bChatFp16Response() {} -func (UnionString) ImplementsAIMetaLlama2_7bChatInt8Response() {} -func (UnionString) ImplementsAIMistralMistral7bInstructV0_1Response() {} +func (UnionString) ImplementsAccountDlpProfileCustomDeleteResponseResult() {} +func (UnionString) ImplementsAccountDNSFirewallGetResponseResultDNSFirewallIP() {} +func (UnionString) ImplementsAccountDNSFirewallGetResponseResultUpstreamIP() {} +func (UnionString) ImplementsAccountDNSFirewallUpdateResponseResultDNSFirewallIP() {} +func (UnionString) ImplementsAccountDNSFirewallUpdateResponseResultUpstreamIP() {} +func (UnionString) ImplementsAccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultDNSFirewallIP() { +} +func (UnionString) ImplementsAccountDNSFirewallDNSFirewallNewDNSFirewallClusterResponseResultUpstreamIP() { +} +func (UnionString) ImplementsAccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseDNSFirewallIP() { +} +func (UnionString) ImplementsAccountDNSFirewallDNSFirewallListDNSFirewallClustersResponseUpstreamIP() { +} +func (UnionString) ImplementsAccountDNSFirewallUpdateParamsDNSFirewallIP() {} +func (UnionString) ImplementsAccountDNSFirewallUpdateParamsUpstreamIP() {} +func (UnionString) ImplementsAccountDNSFirewallDNSFirewallNewDNSFirewallClusterParamsUpstreamIP() {} +func (UnionString) ImplementsAccountImageV1GetResponseResultVariant() {} +func (UnionString) ImplementsAccountImageV1UpdateResponseResultVariant() {} +func (UnionString) ImplementsAccountImageV1CloudflareImagesListImagesResponseResultImagesVariant() {} +func (UnionString) ImplementsAccountImageV1CloudflareImagesUploadAnImageViaURLResponseResultVariant() { +} +func (UnionString) ImplementsAccountIntelIpipIntelligenceGetIPOverviewResponseResultIP() {} +func (UnionString) ImplementsAccountIntelMiscategorizationMiscategorizationNewMiscategorizationResponseResult() { +} +func (UnionString) ImplementsAccountStorageKvNamespaceUpdateResponseResult() {} +func (UnionString) ImplementsAccountStorageKvNamespaceDeleteResponseResult() {} +func (UnionString) ImplementsAccountStorageKvNamespaceBulkDeleteResponseResult() {} +func (UnionString) ImplementsAccountStorageKvNamespaceBulkWorkersKvNamespaceWriteMultipleKeyValuePairsResponseResult() { +} +func (UnionString) ImplementsAccountStorageKvNamespaceValueUpdateResponseResult() {} +func (UnionString) ImplementsAccountStorageKvNamespaceValueDeleteResponseResult() {} +func (UnionString) ImplementsAccountWorkerDeploymentByScriptWorkerDeploymentsListDeploymentsResponseResult() { +} +func (UnionString) ImplementsAccountWorkerDeploymentByScriptDetailGetResponseResult() {} +func (UnionString) ImplementsAccountWorkerScriptTailDeleteResponseResult() {} +func (UnionString) ImplementsAccountAccessKeyAccessKeyConfigurationGetTheAccessKeyConfigurationResponseResult() { +} +func (UnionString) ImplementsAccountAccessKeyAccessKeyConfigurationUpdateTheAccessKeyConfigurationResponseResult() { +} +func (UnionString) ImplementsAccountAccessKeyRotateAccessKeyConfigurationRotateAccessKeysResponseResult() { +} +func (UnionString) ImplementsAccountDeviceRevokeDevicesRevokeDevicesResponseResult() {} +func (UnionString) ImplementsAccountDeviceUnrevokeDevicesUnrevokeDevicesResponseResult() {} +func (UnionString) ImplementsAccountAddressingPrefixBindingDeleteResponseResult() {} +func (UnionString) ImplementsZonePurgeCachZonePurgeParamsBssIfzalFilesFile() {} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuerySince() { +} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryUntil() { +} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesSince() { +} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesUntil() { +} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsSince() { +} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsUntil() { +} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsSince() { +} +func (UnionString) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsUntil() { +} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuerySince() { +} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryUntil() { +} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesSince() { +} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUntil() { +} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsSince() { +} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUntil() { +} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsSince() {} +func (UnionString) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsUntil() {} +func (UnionString) ImplementsZoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleResult() {} +func (UnionString) ImplementsZoneLogRayidGetResponse() {} +func (UnionString) ImplementsZoneLogReceivedReceivedGetLogsReceivedResponse() {} +func (UnionString) ImplementsZoneLogReceivedReceivedGetLogsReceivedParamsEnd() {} +func (UnionString) ImplementsZoneLogReceivedReceivedGetLogsReceivedParamsStart() {} +func (UnionString) ImplementsZoneWorkerRouteDeleteResponseResult() {} +func (UnionString) ImplementsZoneWorkerRouteWorkerRoutesNewRouteResponseResult() {} +func (UnionString) ImplementsZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseResult() { +} +func (UnionString) ImplementsZoneAPIGatewayUserSchemaDeleteResponseResult() {} +func (UnionString) ImplementsZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseResult() { +} +func (UnionString) ImplementsZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseResult() { +} +func (UnionString) ImplementsZoneSnippetDeleteResponseResult() {} +func (UnionString) ImplementsAIModelTextEmbeddingBgeSmallEnV1_5RunParamsText() {} +func (UnionString) ImplementsAIModelTextEmbeddingBgeBaseEnV1_5RunParamsText() {} +func (UnionString) ImplementsAIModelTextEmbeddingBgeLargeEnV1_5RunParamsText() {} +func (UnionString) ImplementsAIModelTextGenerationLlama2_7bChatInt8RunResponse() {} +func (UnionString) ImplementsAIModelTextGenerationLlama2_7bChatFp16RunResponse() {} +func (UnionString) ImplementsAIModelTextGenerationMistral7bInstructV0_1RunResponse() {} +func (UnionString) ImplementsImagesImagesListResponseV2ResultImagesVariant() {} +func (UnionString) ImplementsHostnameSettingListResponseResultValue() {} +func (UnionString) ImplementsHostnameSettingAddResponseResultValue() {} +func (UnionString) ImplementsHostnameSettingAddParamsValue() {} + +type UnionInt int64 + +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuerySince() { +} +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryUntil() { +} +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesSince() { +} +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesUntil() { +} +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsSince() { +} +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsUntil() { +} +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsSince() { +} +func (UnionInt) ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsUntil() { +} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuerySince() { +} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryUntil() { +} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesSince() { +} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUntil() { +} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsSince() { +} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUntil() { +} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsSince() {} +func (UnionInt) ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsUntil() {} +func (UnionInt) ImplementsZoneLogReceivedReceivedGetLogsReceivedParamsEnd() {} +func (UnionInt) ImplementsZoneLogReceivedReceivedGetLogsReceivedParamsStart() {} + +type UnionFloat float64 + +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95ARecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95AaaaRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95CaaRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95CertRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95CnameRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95DnskeyRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95DsRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95HTTPsRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95LocRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95MxRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95NaptrRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95NsRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95PtrRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95SmimeaRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95SrvRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95SshfpRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95SvcbRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95TlsaRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95TxtRecordTtl() {} +func (UnionFloat) ImplementsDNSRecordResultMpBuiT95UriRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95ARecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtl() { +} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95ARecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95CertRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95DsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95LocRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95MxRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95NsRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtl() {} +func (UnionFloat) ImplementsZoneDNSRecordPatchParamsMpBuiT95UriRecordTtl() {} +func (UnionFloat) ImplementsZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtl() { +} +func (UnionFloat) ImplementsHostnameSettingListResponseResultValue() {} +func (UnionFloat) ImplementsHostnameSettingAddResponseResultValue() {} +func (UnionFloat) ImplementsHostnameSettingAddParamsValue() {} diff --git a/ip.go b/ip.go new file mode 100644 index 00000000000..7752498d0f4 --- /dev/null +++ b/ip.go @@ -0,0 +1,190 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// IPService 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 [NewIPService] method instead. +type IPService struct { + Options []option.RequestOption +} + +// NewIPService 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 NewIPService(opts ...option.RequestOption) (r *IPService) { + r = &IPService{} + r.Options = opts + return +} + +// Get IPs used on the Cloudflare/JD Cloud network, see +// https://www.cloudflare.com/ips for Cloudflare IPs or +// https://developers.cloudflare.com/china-network/reference/infrastructure/ for JD +// Cloud IPs. +func (r *IPService) List(ctx context.Context, query IPListParams, opts ...option.RequestOption) (res *IPListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "ips" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type IPListResponse struct { + Errors []IPListResponseError `json:"errors"` + Messages []IPListResponseMessage `json:"messages"` + Result IPListResponseResult `json:"result"` + // Whether the API call was successful + Success IPListResponseSuccess `json:"success"` + JSON ipListResponseJSON `json:"-"` +} + +// ipListResponseJSON contains the JSON metadata for the struct [IPListResponse] +type ipListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IPListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IPListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON ipListResponseErrorJSON `json:"-"` +} + +// ipListResponseErrorJSON contains the JSON metadata for the struct +// [IPListResponseError] +type ipListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IPListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type IPListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON ipListResponseMessageJSON `json:"-"` +} + +// ipListResponseMessageJSON contains the JSON metadata for the struct +// [IPListResponseMessage] +type ipListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IPListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [IPListResponseResultIh4mwLmwIPs] or +// [IPListResponseResultIh4mwLmwIPsJdcloud]. +type IPListResponseResult interface { + implementsIPListResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*IPListResponseResult)(nil)).Elem(), "") +} + +type IPListResponseResultIh4mwLmwIPs struct { + // A digest of the IP data. Useful for determining if the data has changed. + Etag string `json:"etag"` + // List of Cloudflare IPv4 CIDR addresses. + Ipv4Cidrs []string `json:"ipv4_cidrs"` + // List of Cloudflare IPv6 CIDR addresses. + Ipv6Cidrs []string `json:"ipv6_cidrs"` + JSON ipListResponseResultIh4mwLmwIPsJSON `json:"-"` +} + +// ipListResponseResultIh4mwLmwIPsJSON contains the JSON metadata for the struct +// [IPListResponseResultIh4mwLmwIPs] +type ipListResponseResultIh4mwLmwIPsJSON struct { + Etag apijson.Field + Ipv4Cidrs apijson.Field + Ipv6Cidrs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IPListResponseResultIh4mwLmwIPs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r IPListResponseResultIh4mwLmwIPs) implementsIPListResponseResult() {} + +type IPListResponseResultIh4mwLmwIPsJdcloud struct { + // A digest of the IP data. Useful for determining if the data has changed. + Etag string `json:"etag"` + // List of Cloudflare IPv4 CIDR addresses. + Ipv4Cidrs []string `json:"ipv4_cidrs"` + // List of Cloudflare IPv6 CIDR addresses. + Ipv6Cidrs []string `json:"ipv6_cidrs"` + // List IPv4 and IPv6 CIDRs, only populated if `?networks=jdcloud` is used. + JdcloudCidrs []string `json:"jdcloud_cidrs"` + JSON ipListResponseResultIh4mwLmwIPsJdcloudJSON `json:"-"` +} + +// ipListResponseResultIh4mwLmwIPsJdcloudJSON contains the JSON metadata for the +// struct [IPListResponseResultIh4mwLmwIPsJdcloud] +type ipListResponseResultIh4mwLmwIPsJdcloudJSON struct { + Etag apijson.Field + Ipv4Cidrs apijson.Field + Ipv6Cidrs apijson.Field + JdcloudCidrs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IPListResponseResultIh4mwLmwIPsJdcloud) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r IPListResponseResultIh4mwLmwIPsJdcloud) implementsIPListResponseResult() {} + +// Whether the API call was successful +type IPListResponseSuccess bool + +const ( + IPListResponseSuccessTrue IPListResponseSuccess = true +) + +type IPListParams struct { + // Specified as `jdcloud` to list IPs used by JD Cloud data centers. + Networks param.Field[string] `query:"networks"` +} + +// URLQuery serializes [IPListParams]'s query parameters as `url.Values`. +func (r IPListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/ip_test.go b/ip_test.go new file mode 100644 index 00000000000..ae92f6c9dd7 --- /dev/null +++ b/ip_test.go @@ -0,0 +1,42 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestIPListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.IPs.List(context.TODO(), cloudflare.IPListParams{ + Networks: cloudflare.F("string"), + }) + 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/membership.go b/membership.go new file mode 100644 index 00000000000..9cdf9f27cba --- /dev/null +++ b/membership.go @@ -0,0 +1,793 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// MembershipService 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 [NewMembershipService] method instead. +type MembershipService struct { + Options []option.RequestOption +} + +// NewMembershipService 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 NewMembershipService(opts ...option.RequestOption) (r *MembershipService) { + r = &MembershipService{} + r.Options = opts + return +} + +// Get a specific membership. +func (r *MembershipService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *MembershipGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("memberships/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Accept or reject this account invitation. +func (r *MembershipService) Update(ctx context.Context, identifier string, body MembershipUpdateParams, opts ...option.RequestOption) (res *MembershipUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("memberships/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Remove the associated member from an account. +func (r *MembershipService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *MembershipDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("memberships/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// List memberships of accounts the user can access. +func (r *MembershipService) UserSAccountMembershipsListMemberships(ctx context.Context, query MembershipUserSAccountMembershipsListMembershipsParams, opts ...option.RequestOption) (res *shared.Page[MembershipUserSAccountMembershipsListMembershipsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "memberships" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type MembershipGetResponse struct { + Errors []MembershipGetResponseError `json:"errors"` + Messages []MembershipGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success MembershipGetResponseSuccess `json:"success"` + JSON membershipGetResponseJSON `json:"-"` +} + +// membershipGetResponseJSON contains the JSON metadata for the struct +// [MembershipGetResponse] +type membershipGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON membershipGetResponseErrorJSON `json:"-"` +} + +// membershipGetResponseErrorJSON contains the JSON metadata for the struct +// [MembershipGetResponseError] +type membershipGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON membershipGetResponseMessageJSON `json:"-"` +} + +// membershipGetResponseMessageJSON contains the JSON metadata for the struct +// [MembershipGetResponseMessage] +type membershipGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MembershipGetResponseSuccess bool + +const ( + MembershipGetResponseSuccessTrue MembershipGetResponseSuccess = true +) + +type MembershipUpdateResponse struct { + Errors []MembershipUpdateResponseError `json:"errors"` + Messages []MembershipUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success MembershipUpdateResponseSuccess `json:"success"` + JSON membershipUpdateResponseJSON `json:"-"` +} + +// membershipUpdateResponseJSON contains the JSON metadata for the struct +// [MembershipUpdateResponse] +type membershipUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON membershipUpdateResponseErrorJSON `json:"-"` +} + +// membershipUpdateResponseErrorJSON contains the JSON metadata for the struct +// [MembershipUpdateResponseError] +type membershipUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON membershipUpdateResponseMessageJSON `json:"-"` +} + +// membershipUpdateResponseMessageJSON contains the JSON metadata for the struct +// [MembershipUpdateResponseMessage] +type membershipUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MembershipUpdateResponseSuccess bool + +const ( + MembershipUpdateResponseSuccessTrue MembershipUpdateResponseSuccess = true +) + +type MembershipDeleteResponse struct { + Errors []MembershipDeleteResponseError `json:"errors"` + Messages []MembershipDeleteResponseMessage `json:"messages"` + Result MembershipDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success MembershipDeleteResponseSuccess `json:"success"` + JSON membershipDeleteResponseJSON `json:"-"` +} + +// membershipDeleteResponseJSON contains the JSON metadata for the struct +// [MembershipDeleteResponse] +type membershipDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON membershipDeleteResponseErrorJSON `json:"-"` +} + +// membershipDeleteResponseErrorJSON contains the JSON metadata for the struct +// [MembershipDeleteResponseError] +type membershipDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON membershipDeleteResponseMessageJSON `json:"-"` +} + +// membershipDeleteResponseMessageJSON contains the JSON metadata for the struct +// [MembershipDeleteResponseMessage] +type membershipDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipDeleteResponseResult struct { + // Membership identifier tag. + ID string `json:"id"` + JSON membershipDeleteResponseResultJSON `json:"-"` +} + +// membershipDeleteResponseResultJSON contains the JSON metadata for the struct +// [MembershipDeleteResponseResult] +type membershipDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MembershipDeleteResponseSuccess bool + +const ( + MembershipDeleteResponseSuccessTrue MembershipDeleteResponseSuccess = true +) + +type MembershipUserSAccountMembershipsListMembershipsResponse struct { + // Membership identifier tag. + ID string `json:"id"` + Account MembershipUserSAccountMembershipsListMembershipsResponseAccount `json:"account"` + // Enterprise only. Indicates whether or not API access is enabled specifically for + // this user on a given account. + APIAccessEnabled bool `json:"api_access_enabled,nullable"` + // The unique activation code for the account membership. + Code string `json:"code"` + Permissions MembershipUserSAccountMembershipsListMembershipsResponsePermissions `json:"permissions"` + // List of role names for the user at the account. + Roles []string `json:"roles"` + // Status of this membership. + Status MembershipUserSAccountMembershipsListMembershipsResponseStatus `json:"status"` + JSON membershipUserSAccountMembershipsListMembershipsResponseJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponseJSON contains the JSON +// metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponse] +type membershipUserSAccountMembershipsListMembershipsResponseJSON struct { + ID apijson.Field + Account apijson.Field + APIAccessEnabled apijson.Field + Code apijson.Field + Permissions apijson.Field + Roles apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponseAccount struct { + // Identifier + ID string `json:"id,required"` + // Account name + Name string `json:"name,required"` + // Timestamp for the creation of the account + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Account settings + Settings MembershipUserSAccountMembershipsListMembershipsResponseAccountSettings `json:"settings"` + JSON membershipUserSAccountMembershipsListMembershipsResponseAccountJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponseAccountJSON contains the +// JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponseAccount] +type membershipUserSAccountMembershipsListMembershipsResponseAccountJSON struct { + ID apijson.Field + Name apijson.Field + CreatedOn apijson.Field + Settings apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponseAccount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Account settings +type MembershipUserSAccountMembershipsListMembershipsResponseAccountSettings struct { + // Specifies the default nameservers to be used for new zones added to this + // account. + // + // - `cloudflare.standard` for Cloudflare-branded nameservers + // - `custom.account` for account custom nameservers + // - `custom.tenant` for tenant custom nameservers + // + // See + // [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) + // for more information. + DefaultNameservers MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameservers `json:"default_nameservers"` + // Indicates whether membership in this account requires that Two-Factor + // Authentication is enabled + EnforceTwofactor bool `json:"enforce_twofactor"` + // Indicates whether new zones should use the account-level custom nameservers by + // default + UseAccountCustomNsByDefault bool `json:"use_account_custom_ns_by_default"` + JSON membershipUserSAccountMembershipsListMembershipsResponseAccountSettingsJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponseAccountSettingsJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponseAccountSettings] +type membershipUserSAccountMembershipsListMembershipsResponseAccountSettingsJSON struct { + DefaultNameservers apijson.Field + EnforceTwofactor apijson.Field + UseAccountCustomNsByDefault apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponseAccountSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the default nameservers to be used for new zones added to this +// account. +// +// - `cloudflare.standard` for Cloudflare-branded nameservers +// - `custom.account` for account custom nameservers +// - `custom.tenant` for tenant custom nameservers +// +// See +// [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) +// for more information. +type MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameservers string + +const ( + MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameserversCloudflareStandard MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameservers = "cloudflare.standard" + MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameserversCustomAccount MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameservers = "custom.account" + MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameserversCustomTenant MembershipUserSAccountMembershipsListMembershipsResponseAccountSettingsDefaultNameservers = "custom.tenant" +) + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissions struct { + Analytics MembershipUserSAccountMembershipsListMembershipsResponsePermissionsAnalytics `json:"analytics"` + Billing MembershipUserSAccountMembershipsListMembershipsResponsePermissionsBilling `json:"billing"` + CachePurge MembershipUserSAccountMembershipsListMembershipsResponsePermissionsCachePurge `json:"cache_purge"` + DNS MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNS `json:"dns"` + DNSRecords MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSRecords `json:"dns_records"` + Lb MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLb `json:"lb"` + Logs MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLogs `json:"logs"` + Organization MembershipUserSAccountMembershipsListMembershipsResponsePermissionsOrganization `json:"organization"` + Ssl MembershipUserSAccountMembershipsListMembershipsResponsePermissionsSsl `json:"ssl"` + Waf MembershipUserSAccountMembershipsListMembershipsResponsePermissionsWaf `json:"waf"` + ZoneSettings MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZoneSettings `json:"zone_settings"` + Zones MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZones `json:"zones"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsJSON contains +// the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissions] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsJSON struct { + Analytics apijson.Field + Billing apijson.Field + CachePurge apijson.Field + DNS apijson.Field + DNSRecords apijson.Field + Lb apijson.Field + Logs apijson.Field + Organization apijson.Field + Ssl apijson.Field + Waf apijson.Field + ZoneSettings apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsAnalytics struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsAnalyticsJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsAnalyticsJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsAnalytics] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsAnalyticsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsAnalytics) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsBilling struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsBillingJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsBillingJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsBilling] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsBillingJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsBilling) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsCachePurge struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsCachePurgeJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsCachePurgeJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsCachePurge] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsCachePurgeJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsCachePurge) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNS struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNS] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSRecords struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSRecordsJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSRecordsJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSRecords] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSRecordsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsDNSRecords) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLb struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsLbJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsLbJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLb] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsLbJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLb) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLogs struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsLogsJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsLogsJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLogs] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsLogsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsLogs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsOrganization struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsOrganizationJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsOrganizationJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsOrganization] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsOrganizationJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsSsl struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsSslJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsSslJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsSsl] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsSslJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsWaf struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsWafJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsWafJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsWaf] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsWafJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsWaf) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZoneSettings struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsZoneSettingsJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsZoneSettingsJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZoneSettings] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsZoneSettingsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZoneSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZones struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON membershipUserSAccountMembershipsListMembershipsResponsePermissionsZonesJSON `json:"-"` +} + +// membershipUserSAccountMembershipsListMembershipsResponsePermissionsZonesJSON +// contains the JSON metadata for the struct +// [MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZones] +type membershipUserSAccountMembershipsListMembershipsResponsePermissionsZonesJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MembershipUserSAccountMembershipsListMembershipsResponsePermissionsZones) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of this membership. +type MembershipUserSAccountMembershipsListMembershipsResponseStatus string + +const ( + MembershipUserSAccountMembershipsListMembershipsResponseStatusAccepted MembershipUserSAccountMembershipsListMembershipsResponseStatus = "accepted" + MembershipUserSAccountMembershipsListMembershipsResponseStatusPending MembershipUserSAccountMembershipsListMembershipsResponseStatus = "pending" + MembershipUserSAccountMembershipsListMembershipsResponseStatusRejected MembershipUserSAccountMembershipsListMembershipsResponseStatus = "rejected" +) + +type MembershipUpdateParams struct { + // Whether to accept or reject this account invitation. + Status param.Field[MembershipUpdateParamsStatus] `json:"status,required"` +} + +func (r MembershipUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether to accept or reject this account invitation. +type MembershipUpdateParamsStatus string + +const ( + MembershipUpdateParamsStatusAccepted MembershipUpdateParamsStatus = "accepted" + MembershipUpdateParamsStatusRejected MembershipUpdateParamsStatus = "rejected" +) + +type MembershipUserSAccountMembershipsListMembershipsParams struct { + Account param.Field[MembershipUserSAccountMembershipsListMembershipsParamsAccount] `query:"account"` + // Direction to order memberships. + Direction param.Field[MembershipUserSAccountMembershipsListMembershipsParamsDirection] `query:"direction"` + // Account name + Name param.Field[string] `query:"name"` + // Field to order memberships by. + Order param.Field[MembershipUserSAccountMembershipsListMembershipsParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of memberships per page. + PerPage param.Field[float64] `query:"per_page"` + // Status of this membership. + Status param.Field[MembershipUserSAccountMembershipsListMembershipsParamsStatus] `query:"status"` +} + +// URLQuery serializes [MembershipUserSAccountMembershipsListMembershipsParams]'s +// query parameters as `url.Values`. +func (r MembershipUserSAccountMembershipsListMembershipsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type MembershipUserSAccountMembershipsListMembershipsParamsAccount struct { + // Account name + Name param.Field[string] `query:"name"` +} + +// URLQuery serializes +// [MembershipUserSAccountMembershipsListMembershipsParamsAccount]'s query +// parameters as `url.Values`. +func (r MembershipUserSAccountMembershipsListMembershipsParamsAccount) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order memberships. +type MembershipUserSAccountMembershipsListMembershipsParamsDirection string + +const ( + MembershipUserSAccountMembershipsListMembershipsParamsDirectionAsc MembershipUserSAccountMembershipsListMembershipsParamsDirection = "asc" + MembershipUserSAccountMembershipsListMembershipsParamsDirectionDesc MembershipUserSAccountMembershipsListMembershipsParamsDirection = "desc" +) + +// Field to order memberships by. +type MembershipUserSAccountMembershipsListMembershipsParamsOrder string + +const ( + MembershipUserSAccountMembershipsListMembershipsParamsOrderID MembershipUserSAccountMembershipsListMembershipsParamsOrder = "id" + MembershipUserSAccountMembershipsListMembershipsParamsOrderAccountName MembershipUserSAccountMembershipsListMembershipsParamsOrder = "account.name" + MembershipUserSAccountMembershipsListMembershipsParamsOrderStatus MembershipUserSAccountMembershipsListMembershipsParamsOrder = "status" +) + +// Status of this membership. +type MembershipUserSAccountMembershipsListMembershipsParamsStatus string + +const ( + MembershipUserSAccountMembershipsListMembershipsParamsStatusAccepted MembershipUserSAccountMembershipsListMembershipsParamsStatus = "accepted" + MembershipUserSAccountMembershipsListMembershipsParamsStatusPending MembershipUserSAccountMembershipsListMembershipsParamsStatus = "pending" + MembershipUserSAccountMembershipsListMembershipsParamsStatusRejected MembershipUserSAccountMembershipsListMembershipsParamsStatus = "rejected" +) diff --git a/membership_test.go b/membership_test.go new file mode 100644 index 00000000000..7c669b3b13a --- /dev/null +++ b/membership_test.go @@ -0,0 +1,134 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestMembershipGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Memberships.Get(context.TODO(), "4536bcfad5faccb111b47003c79917fa") + 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 TestMembershipUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Memberships.Update( + context.TODO(), + "4536bcfad5faccb111b47003c79917fa", + cloudflare.MembershipUpdateParams{ + Status: cloudflare.F(cloudflare.MembershipUpdateParamsStatusAccepted), + }, + ) + 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 TestMembershipDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Memberships.Delete(context.TODO(), "4536bcfad5faccb111b47003c79917fa") + 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 TestMembershipUserSAccountMembershipsListMembershipsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Memberships.UserSAccountMembershipsListMemberships(context.TODO(), cloudflare.MembershipUserSAccountMembershipsListMembershipsParams{ + Account: cloudflare.F(cloudflare.MembershipUserSAccountMembershipsListMembershipsParamsAccount{ + Name: cloudflare.F("Demo Account"), + }), + Direction: cloudflare.F(cloudflare.MembershipUserSAccountMembershipsListMembershipsParamsDirectionDesc), + Name: cloudflare.F("Demo Account"), + Order: cloudflare.F(cloudflare.MembershipUserSAccountMembershipsListMembershipsParamsOrderStatus), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Status: cloudflare.F(cloudflare.MembershipUserSAccountMembershipsListMembershipsParamsStatusAccepted), + }) + 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/option/requestoption.go b/option/requestoption.go index 11312f8de51..1b6c634471b 100644 --- a/option/requestoption.go +++ b/option/requestoption.go @@ -3,6 +3,7 @@ package option import ( + "fmt" "log" "net/http" "net/url" @@ -187,6 +188,14 @@ func WithEnvironmentProduction() RequestOption { return WithBaseURL("https://api.cloudflare.com/client/v4/") } +// WithAPIEmail returns a RequestOption that sets the client setting "api_email". +func WithAPIEmail(value string) RequestOption { + return func(r *requestconfig.RequestConfig) error { + r.APIEmail = value + return r.Apply(WithHeader("X-Auth-Email", r.APIEmail)) + } +} + // WithAPIKey returns a RequestOption that sets the client setting "api_key". func WithAPIKey(value string) RequestOption { return func(r *requestconfig.RequestConfig) error { @@ -195,10 +204,18 @@ func WithAPIKey(value string) RequestOption { } } -// WithEmail returns a RequestOption that sets the client setting "email". -func WithEmail(value string) RequestOption { +// WithAPIToken returns a RequestOption that sets the client setting "api_token". +func WithAPIToken(value string) RequestOption { + return func(r *requestconfig.RequestConfig) error { + r.APIToken = value + return r.Apply(WithHeader("authorization", fmt.Sprintf("Bearer %s", r.APIToken))) + } +} + +// WithUserServiceKey returns a RequestOption that sets the client setting "user_service_key". +func WithUserServiceKey(value string) RequestOption { return func(r *requestconfig.RequestConfig) error { - r.Email = value - return r.Apply(WithHeader("x-auth-email", value)) + r.UserServiceKey = value + return r.Apply(WithHeader("X-Auth-User-Service-Key", r.UserServiceKey)) } } diff --git a/organization.go b/organization.go new file mode 100644 index 00000000000..9053e45e4dd --- /dev/null +++ b/organization.go @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// OrganizationService 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 [NewOrganizationService] method +// instead. +type OrganizationService struct { + Options []option.RequestOption + Invites *OrganizationInviteService + Members *OrganizationMemberService + Railguns *OrganizationRailgunService + Roles *OrganizationRoleService +} + +// NewOrganizationService 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 NewOrganizationService(opts ...option.RequestOption) (r *OrganizationService) { + r = &OrganizationService{} + r.Options = opts + r.Invites = NewOrganizationInviteService(opts...) + r.Members = NewOrganizationMemberService(opts...) + r.Railguns = NewOrganizationRailgunService(opts...) + r.Roles = NewOrganizationRoleService(opts...) + return +} + +// Get information about a specific organization that you are a member of. +func (r *OrganizationService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *OrganizationGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update an existing Organization. +func (r *OrganizationService) Update(ctx context.Context, identifier string, body OrganizationUpdateParams, opts ...option.RequestOption) (res *OrganizationUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type OrganizationGetResponse struct { + Errors []OrganizationGetResponseError `json:"errors"` + Messages []OrganizationGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationGetResponseSuccess `json:"success"` + JSON organizationGetResponseJSON `json:"-"` +} + +// organizationGetResponseJSON contains the JSON metadata for the struct +// [OrganizationGetResponse] +type organizationGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationGetResponseErrorJSON `json:"-"` +} + +// organizationGetResponseErrorJSON contains the JSON metadata for the struct +// [OrganizationGetResponseError] +type organizationGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationGetResponseMessageJSON `json:"-"` +} + +// organizationGetResponseMessageJSON contains the JSON metadata for the struct +// [OrganizationGetResponseMessage] +type organizationGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationGetResponseSuccess bool + +const ( + OrganizationGetResponseSuccessTrue OrganizationGetResponseSuccess = true +) + +type OrganizationUpdateResponse struct { + Errors []OrganizationUpdateResponseError `json:"errors"` + Messages []OrganizationUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationUpdateResponseSuccess `json:"success"` + JSON organizationUpdateResponseJSON `json:"-"` +} + +// organizationUpdateResponseJSON contains the JSON metadata for the struct +// [OrganizationUpdateResponse] +type organizationUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationUpdateResponseErrorJSON `json:"-"` +} + +// organizationUpdateResponseErrorJSON contains the JSON metadata for the struct +// [OrganizationUpdateResponseError] +type organizationUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationUpdateResponseMessageJSON `json:"-"` +} + +// organizationUpdateResponseMessageJSON contains the JSON metadata for the struct +// [OrganizationUpdateResponseMessage] +type organizationUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationUpdateResponseSuccess bool + +const ( + OrganizationUpdateResponseSuccessTrue OrganizationUpdateResponseSuccess = true +) + +type OrganizationUpdateParams struct { + // Organization name. + Name param.Field[string] `json:"name"` +} + +func (r OrganizationUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/organization_test.go b/organization_test.go new file mode 100644 index 00000000000..110a7aaa8b2 --- /dev/null +++ b/organization_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestOrganizationGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Get(context.TODO(), "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()) + } +} + +func TestOrganizationUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.OrganizationUpdateParams{ + Name: cloudflare.F("Cloudflare, Inc."), + }, + ) + 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/organizationinvite.go b/organizationinvite.go new file mode 100644 index 00000000000..0ac7efbb1b8 --- /dev/null +++ b/organizationinvite.go @@ -0,0 +1,524 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// OrganizationInviteService 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 [NewOrganizationInviteService] method +// instead. +type OrganizationInviteService struct { + Options []option.RequestOption +} + +// NewOrganizationInviteService 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 NewOrganizationInviteService(opts ...option.RequestOption) (r *OrganizationInviteService) { + r = &OrganizationInviteService{} + r.Options = opts + return +} + +// Get the details of an invitation. +func (r *OrganizationInviteService) Get(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationInviteGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/invites/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Change the Roles of a Pending Invite. +func (r *OrganizationInviteService) Update(ctx context.Context, organizationIdentifier string, identifier string, body OrganizationInviteUpdateParams, opts ...option.RequestOption) (res *OrganizationInviteUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/invites/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Cancel an existing invitation. +func (r *OrganizationInviteService) Delete(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationInviteDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/invites/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Invite a User to become a Member of an Organization. +func (r *OrganizationInviteService) OrganizationInvitesNewInvitation(ctx context.Context, organizationIdentifier string, body OrganizationInviteOrganizationInvitesNewInvitationParams, opts ...option.RequestOption) (res *OrganizationInviteOrganizationInvitesNewInvitationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/invites", organizationIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all invitations associated with an organization. +func (r *OrganizationInviteService) OrganizationInvitesListInvitations(ctx context.Context, organizationIdentifier string, opts ...option.RequestOption) (res *OrganizationInviteOrganizationInvitesListInvitationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/invites", organizationIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type OrganizationInviteGetResponse struct { + Errors []OrganizationInviteGetResponseError `json:"errors"` + Messages []OrganizationInviteGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationInviteGetResponseSuccess `json:"success"` + JSON organizationInviteGetResponseJSON `json:"-"` +} + +// organizationInviteGetResponseJSON contains the JSON metadata for the struct +// [OrganizationInviteGetResponse] +type organizationInviteGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteGetResponseErrorJSON `json:"-"` +} + +// organizationInviteGetResponseErrorJSON contains the JSON metadata for the struct +// [OrganizationInviteGetResponseError] +type organizationInviteGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteGetResponseMessageJSON `json:"-"` +} + +// organizationInviteGetResponseMessageJSON contains the JSON metadata for the +// struct [OrganizationInviteGetResponseMessage] +type organizationInviteGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationInviteGetResponseSuccess bool + +const ( + OrganizationInviteGetResponseSuccessTrue OrganizationInviteGetResponseSuccess = true +) + +type OrganizationInviteUpdateResponse struct { + Errors []OrganizationInviteUpdateResponseError `json:"errors"` + Messages []OrganizationInviteUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationInviteUpdateResponseSuccess `json:"success"` + JSON organizationInviteUpdateResponseJSON `json:"-"` +} + +// organizationInviteUpdateResponseJSON contains the JSON metadata for the struct +// [OrganizationInviteUpdateResponse] +type organizationInviteUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteUpdateResponseErrorJSON `json:"-"` +} + +// organizationInviteUpdateResponseErrorJSON contains the JSON metadata for the +// struct [OrganizationInviteUpdateResponseError] +type organizationInviteUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteUpdateResponseMessageJSON `json:"-"` +} + +// organizationInviteUpdateResponseMessageJSON contains the JSON metadata for the +// struct [OrganizationInviteUpdateResponseMessage] +type organizationInviteUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationInviteUpdateResponseSuccess bool + +const ( + OrganizationInviteUpdateResponseSuccessTrue OrganizationInviteUpdateResponseSuccess = true +) + +type OrganizationInviteDeleteResponse struct { + // Invite identifier tag. + ID string `json:"id"` + JSON organizationInviteDeleteResponseJSON `json:"-"` +} + +// organizationInviteDeleteResponseJSON contains the JSON metadata for the struct +// [OrganizationInviteDeleteResponse] +type organizationInviteDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteOrganizationInvitesNewInvitationResponse struct { + Errors []OrganizationInviteOrganizationInvitesNewInvitationResponseError `json:"errors"` + Messages []OrganizationInviteOrganizationInvitesNewInvitationResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationInviteOrganizationInvitesNewInvitationResponseSuccess `json:"success"` + JSON organizationInviteOrganizationInvitesNewInvitationResponseJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesNewInvitationResponseJSON contains the JSON +// metadata for the struct +// [OrganizationInviteOrganizationInvitesNewInvitationResponse] +type organizationInviteOrganizationInvitesNewInvitationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesNewInvitationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteOrganizationInvitesNewInvitationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteOrganizationInvitesNewInvitationResponseErrorJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesNewInvitationResponseErrorJSON contains the +// JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesNewInvitationResponseError] +type organizationInviteOrganizationInvitesNewInvitationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesNewInvitationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteOrganizationInvitesNewInvitationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteOrganizationInvitesNewInvitationResponseMessageJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesNewInvitationResponseMessageJSON contains +// the JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesNewInvitationResponseMessage] +type organizationInviteOrganizationInvitesNewInvitationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesNewInvitationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationInviteOrganizationInvitesNewInvitationResponseSuccess bool + +const ( + OrganizationInviteOrganizationInvitesNewInvitationResponseSuccessTrue OrganizationInviteOrganizationInvitesNewInvitationResponseSuccess = true +) + +type OrganizationInviteOrganizationInvitesListInvitationsResponse struct { + Errors []OrganizationInviteOrganizationInvitesListInvitationsResponseError `json:"errors"` + Messages []OrganizationInviteOrganizationInvitesListInvitationsResponseMessage `json:"messages"` + Result []OrganizationInviteOrganizationInvitesListInvitationsResponseResult `json:"result"` + ResultInfo OrganizationInviteOrganizationInvitesListInvitationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success OrganizationInviteOrganizationInvitesListInvitationsResponseSuccess `json:"success"` + JSON organizationInviteOrganizationInvitesListInvitationsResponseJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesListInvitationsResponseJSON contains the +// JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesListInvitationsResponse] +type organizationInviteOrganizationInvitesListInvitationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesListInvitationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteOrganizationInvitesListInvitationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteOrganizationInvitesListInvitationsResponseErrorJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesListInvitationsResponseErrorJSON contains +// the JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesListInvitationsResponseError] +type organizationInviteOrganizationInvitesListInvitationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesListInvitationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteOrganizationInvitesListInvitationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationInviteOrganizationInvitesListInvitationsResponseMessageJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesListInvitationsResponseMessageJSON contains +// the JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesListInvitationsResponseMessage] +type organizationInviteOrganizationInvitesListInvitationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesListInvitationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteOrganizationInvitesListInvitationsResponseResult struct { + // Invite identifier tag. + ID string `json:"id"` + // When the invite is no longer active. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The email address of the user who created the invite. + InvitedBy string `json:"invited_by"` + // Email address of the user to add to the organization. + InvitedMemberEmail string `json:"invited_member_email"` + // ID of the user to add to the organization. + InvitedMemberID string `json:"invited_member_id,nullable"` + // When the invite was sent. + InvitedOn time.Time `json:"invited_on" format:"date-time"` + // ID of the organization the user will be added to. + OrganizationID string `json:"organization_id"` + // Current status of two-factor enforcement on the organization. + OrganizationIsEnforcingTwofactor bool `json:"organization_is_enforcing_twofactor"` + // Organization name. + OrganizationName string `json:"organization_name"` + // Roles to be assigned to this user. + Roles []OrganizationInviteOrganizationInvitesListInvitationsResponseResultRole `json:"roles"` + // Current status of the invitation. + Status OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus `json:"status"` + JSON organizationInviteOrganizationInvitesListInvitationsResponseResultJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesListInvitationsResponseResultJSON contains +// the JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesListInvitationsResponseResult] +type organizationInviteOrganizationInvitesListInvitationsResponseResultJSON struct { + ID apijson.Field + ExpiresOn apijson.Field + InvitedBy apijson.Field + InvitedMemberEmail apijson.Field + InvitedMemberID apijson.Field + InvitedOn apijson.Field + OrganizationID apijson.Field + OrganizationIsEnforcingTwofactor apijson.Field + OrganizationName apijson.Field + Roles apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesListInvitationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationInviteOrganizationInvitesListInvitationsResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role Name. + Name string `json:"name,required"` + // Access permissions for this User. + Permissions []string `json:"permissions,required"` + JSON organizationInviteOrganizationInvitesListInvitationsResponseResultRoleJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesListInvitationsResponseResultRoleJSON +// contains the JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesListInvitationsResponseResultRole] +type organizationInviteOrganizationInvitesListInvitationsResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesListInvitationsResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Current status of the invitation. +type OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus string + +const ( + OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatusPending OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus = "pending" + OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatusAccepted OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus = "accepted" + OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatusRejected OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus = "rejected" + OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatusCanceled OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus = "canceled" + OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatusLeft OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus = "left" + OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatusExpired OrganizationInviteOrganizationInvitesListInvitationsResponseResultStatus = "expired" +) + +type OrganizationInviteOrganizationInvitesListInvitationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON organizationInviteOrganizationInvitesListInvitationsResponseResultInfoJSON `json:"-"` +} + +// organizationInviteOrganizationInvitesListInvitationsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [OrganizationInviteOrganizationInvitesListInvitationsResponseResultInfo] +type organizationInviteOrganizationInvitesListInvitationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationInviteOrganizationInvitesListInvitationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationInviteOrganizationInvitesListInvitationsResponseSuccess bool + +const ( + OrganizationInviteOrganizationInvitesListInvitationsResponseSuccessTrue OrganizationInviteOrganizationInvitesListInvitationsResponseSuccess = true +) + +type OrganizationInviteUpdateParams struct { + // Array of Roles associated with the invited user. + Roles param.Field[[]string] `json:"roles"` +} + +func (r OrganizationInviteUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type OrganizationInviteOrganizationInvitesNewInvitationParams struct { + // Email address of the user to add to the organization. + InvitedMemberEmail param.Field[string] `json:"invited_member_email,required"` + // Array of Roles associated with the invited user. + Roles param.Field[[]OrganizationInviteOrganizationInvitesNewInvitationParamsRole] `json:"roles,required"` + // When present and set to true, allows for the invited user to be automatically + // accepted to the organization. No invitation is sent. + AutoAccept param.Field[bool] `json:"auto_accept"` +} + +func (r OrganizationInviteOrganizationInvitesNewInvitationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type OrganizationInviteOrganizationInvitesNewInvitationParamsRole struct { + // Role identifier tag. + ID param.Field[string] `json:"id,required"` +} + +func (r OrganizationInviteOrganizationInvitesNewInvitationParamsRole) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/organizationinvite_test.go b/organizationinvite_test.go new file mode 100644 index 00000000000..1c6fe708810 --- /dev/null +++ b/organizationinvite_test.go @@ -0,0 +1,171 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestOrganizationInviteGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Invites.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "4f5f0c14a2a41d5063dd301b2f829f04", + ) + 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 TestOrganizationInviteUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Invites.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "4f5f0c14a2a41d5063dd301b2f829f04", + cloudflare.OrganizationInviteUpdateParams{ + Roles: cloudflare.F([]string{"3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb"}), + }, + ) + 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 TestOrganizationInviteDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Invites.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "4f5f0c14a2a41d5063dd301b2f829f04", + ) + 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 TestOrganizationInviteOrganizationInvitesNewInvitationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Invites.OrganizationInvitesNewInvitation( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.OrganizationInviteOrganizationInvitesNewInvitationParams{ + InvitedMemberEmail: cloudflare.F("user@example.com"), + Roles: cloudflare.F([]cloudflare.OrganizationInviteOrganizationInvitesNewInvitationParamsRole{{ + ID: cloudflare.F("5a7805061c76ada191ed06f989cc3dac"), + }, { + ID: cloudflare.F("9a7806061c88ada191ed06f989cc3dac"), + }}), + AutoAccept: cloudflare.F(true), + }, + ) + 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 TestOrganizationInviteOrganizationInvitesListInvitations(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Invites.OrganizationInvitesListInvitations(context.TODO(), "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/organizationmember.go b/organizationmember.go new file mode 100644 index 00000000000..9406b0cd6e4 --- /dev/null +++ b/organizationmember.go @@ -0,0 +1,1116 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// OrganizationMemberService 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 [NewOrganizationMemberService] method +// instead. +type OrganizationMemberService struct { + Options []option.RequestOption +} + +// NewOrganizationMemberService 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 NewOrganizationMemberService(opts ...option.RequestOption) (r *OrganizationMemberService) { + r = &OrganizationMemberService{} + r.Options = opts + return +} + +// Get information about a specific member of an organization. +func (r *OrganizationMemberService) Get(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationMemberGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/members/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Change the Roles of an Organization's Member. +func (r *OrganizationMemberService) Update(ctx context.Context, organizationIdentifier string, identifier string, body OrganizationMemberUpdateParams, opts ...option.RequestOption) (res *OrganizationMemberUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/members/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Remove a member from an organization. +func (r *OrganizationMemberService) Delete(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationMemberDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/members/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// List all members of a organization. +func (r *OrganizationMemberService) OrganizationMembersListMembers(ctx context.Context, organizationIdentifier string, opts ...option.RequestOption) (res *OrganizationMemberOrganizationMembersListMembersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/members", organizationIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type OrganizationMemberGetResponse struct { + Errors []OrganizationMemberGetResponseError `json:"errors"` + Messages []OrganizationMemberGetResponseMessage `json:"messages"` + Result OrganizationMemberGetResponseResult `json:"result"` + // Whether the API call was successful + Success OrganizationMemberGetResponseSuccess `json:"success"` + JSON organizationMemberGetResponseJSON `json:"-"` +} + +// organizationMemberGetResponseJSON contains the JSON metadata for the struct +// [OrganizationMemberGetResponse] +type organizationMemberGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationMemberGetResponseErrorJSON `json:"-"` +} + +// organizationMemberGetResponseErrorJSON contains the JSON metadata for the struct +// [OrganizationMemberGetResponseError] +type organizationMemberGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationMemberGetResponseMessageJSON `json:"-"` +} + +// organizationMemberGetResponseMessageJSON contains the JSON metadata for the +// struct [OrganizationMemberGetResponseMessage] +type organizationMemberGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResult struct { + // Membership identifier tag. + ID string `json:"id,required"` + // Roles assigned to this member. + Roles []OrganizationMemberGetResponseResultRole `json:"roles,required"` + Status interface{} `json:"status,required"` + User OrganizationMemberGetResponseResultUser `json:"user,required"` + JSON organizationMemberGetResponseResultJSON `json:"-"` +} + +// organizationMemberGetResponseResultJSON contains the JSON metadata for the +// struct [OrganizationMemberGetResponseResult] +type organizationMemberGetResponseResultJSON struct { + ID apijson.Field + Roles apijson.Field + Status apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role name. + Name string `json:"name,required"` + Permissions OrganizationMemberGetResponseResultRolesPermissions `json:"permissions,required"` + JSON organizationMemberGetResponseResultRoleJSON `json:"-"` +} + +// organizationMemberGetResponseResultRoleJSON contains the JSON metadata for the +// struct [OrganizationMemberGetResponseResultRole] +type organizationMemberGetResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissions struct { + Analytics OrganizationMemberGetResponseResultRolesPermissionsAnalytics `json:"analytics"` + Billing OrganizationMemberGetResponseResultRolesPermissionsBilling `json:"billing"` + CachePurge OrganizationMemberGetResponseResultRolesPermissionsCachePurge `json:"cache_purge"` + DNS OrganizationMemberGetResponseResultRolesPermissionsDNS `json:"dns"` + DNSRecords OrganizationMemberGetResponseResultRolesPermissionsDNSRecords `json:"dns_records"` + Lb OrganizationMemberGetResponseResultRolesPermissionsLb `json:"lb"` + Logs OrganizationMemberGetResponseResultRolesPermissionsLogs `json:"logs"` + Organization OrganizationMemberGetResponseResultRolesPermissionsOrganization `json:"organization"` + Ssl OrganizationMemberGetResponseResultRolesPermissionsSsl `json:"ssl"` + Waf OrganizationMemberGetResponseResultRolesPermissionsWaf `json:"waf"` + ZoneSettings OrganizationMemberGetResponseResultRolesPermissionsZoneSettings `json:"zone_settings"` + Zones OrganizationMemberGetResponseResultRolesPermissionsZones `json:"zones"` + JSON organizationMemberGetResponseResultRolesPermissionsJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsJSON contains the JSON +// metadata for the struct [OrganizationMemberGetResponseResultRolesPermissions] +type organizationMemberGetResponseResultRolesPermissionsJSON struct { + Analytics apijson.Field + Billing apijson.Field + CachePurge apijson.Field + DNS apijson.Field + DNSRecords apijson.Field + Lb apijson.Field + Logs apijson.Field + Organization apijson.Field + Ssl apijson.Field + Waf apijson.Field + ZoneSettings apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsAnalytics struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsAnalyticsJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsAnalyticsJSON contains the +// JSON metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsAnalytics] +type organizationMemberGetResponseResultRolesPermissionsAnalyticsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsAnalytics) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsBilling struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsBillingJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsBillingJSON contains the JSON +// metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsBilling] +type organizationMemberGetResponseResultRolesPermissionsBillingJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsBilling) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsCachePurge struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsCachePurgeJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsCachePurgeJSON contains the +// JSON metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsCachePurge] +type organizationMemberGetResponseResultRolesPermissionsCachePurgeJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsCachePurge) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsDNS struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsDNSJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsDNSJSON contains the JSON +// metadata for the struct [OrganizationMemberGetResponseResultRolesPermissionsDNS] +type organizationMemberGetResponseResultRolesPermissionsDNSJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsDNS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsDNSRecords struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsDNSRecordsJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsDNSRecordsJSON contains the +// JSON metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsDNSRecords] +type organizationMemberGetResponseResultRolesPermissionsDNSRecordsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsDNSRecords) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsLb struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsLbJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsLbJSON contains the JSON +// metadata for the struct [OrganizationMemberGetResponseResultRolesPermissionsLb] +type organizationMemberGetResponseResultRolesPermissionsLbJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsLb) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsLogs struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsLogsJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsLogsJSON contains the JSON +// metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsLogs] +type organizationMemberGetResponseResultRolesPermissionsLogsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsLogs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsOrganization struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsOrganizationJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsOrganizationJSON contains the +// JSON metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsOrganization] +type organizationMemberGetResponseResultRolesPermissionsOrganizationJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsSsl struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsSslJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsSslJSON contains the JSON +// metadata for the struct [OrganizationMemberGetResponseResultRolesPermissionsSsl] +type organizationMemberGetResponseResultRolesPermissionsSslJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsWaf struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsWafJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsWafJSON contains the JSON +// metadata for the struct [OrganizationMemberGetResponseResultRolesPermissionsWaf] +type organizationMemberGetResponseResultRolesPermissionsWafJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsWaf) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsZoneSettings struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsZoneSettingsJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsZoneSettingsJSON contains the +// JSON metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsZoneSettings] +type organizationMemberGetResponseResultRolesPermissionsZoneSettingsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsZoneSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultRolesPermissionsZones struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberGetResponseResultRolesPermissionsZonesJSON `json:"-"` +} + +// organizationMemberGetResponseResultRolesPermissionsZonesJSON contains the JSON +// metadata for the struct +// [OrganizationMemberGetResponseResultRolesPermissionsZones] +type organizationMemberGetResponseResultRolesPermissionsZonesJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultRolesPermissionsZones) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberGetResponseResultUser struct { + // The contact email address of the user. + Email string `json:"email,required"` + // Identifier + ID string `json:"id"` + // User's first name + FirstName string `json:"first_name,nullable"` + // User's last name + LastName string `json:"last_name,nullable"` + // Indicates whether two-factor authentication is enabled for the user account. + // Does not apply to API authentication. + TwoFactorAuthenticationEnabled bool `json:"two_factor_authentication_enabled"` + JSON organizationMemberGetResponseResultUserJSON `json:"-"` +} + +// organizationMemberGetResponseResultUserJSON contains the JSON metadata for the +// struct [OrganizationMemberGetResponseResultUser] +type organizationMemberGetResponseResultUserJSON struct { + Email apijson.Field + ID apijson.Field + FirstName apijson.Field + LastName apijson.Field + TwoFactorAuthenticationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberGetResponseResultUser) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationMemberGetResponseSuccess bool + +const ( + OrganizationMemberGetResponseSuccessTrue OrganizationMemberGetResponseSuccess = true +) + +type OrganizationMemberUpdateResponse struct { + Errors []OrganizationMemberUpdateResponseError `json:"errors"` + Messages []OrganizationMemberUpdateResponseMessage `json:"messages"` + Result OrganizationMemberUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success OrganizationMemberUpdateResponseSuccess `json:"success"` + JSON organizationMemberUpdateResponseJSON `json:"-"` +} + +// organizationMemberUpdateResponseJSON contains the JSON metadata for the struct +// [OrganizationMemberUpdateResponse] +type organizationMemberUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationMemberUpdateResponseErrorJSON `json:"-"` +} + +// organizationMemberUpdateResponseErrorJSON contains the JSON metadata for the +// struct [OrganizationMemberUpdateResponseError] +type organizationMemberUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationMemberUpdateResponseMessageJSON `json:"-"` +} + +// organizationMemberUpdateResponseMessageJSON contains the JSON metadata for the +// struct [OrganizationMemberUpdateResponseMessage] +type organizationMemberUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResult struct { + // Membership identifier tag. + ID string `json:"id,required"` + // Roles assigned to this member. + Roles []OrganizationMemberUpdateResponseResultRole `json:"roles,required"` + Status interface{} `json:"status,required"` + User OrganizationMemberUpdateResponseResultUser `json:"user,required"` + JSON organizationMemberUpdateResponseResultJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultJSON contains the JSON metadata for the +// struct [OrganizationMemberUpdateResponseResult] +type organizationMemberUpdateResponseResultJSON struct { + ID apijson.Field + Roles apijson.Field + Status apijson.Field + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role name. + Name string `json:"name,required"` + Permissions OrganizationMemberUpdateResponseResultRolesPermissions `json:"permissions,required"` + JSON organizationMemberUpdateResponseResultRoleJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRoleJSON contains the JSON metadata for +// the struct [OrganizationMemberUpdateResponseResultRole] +type organizationMemberUpdateResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissions struct { + Analytics OrganizationMemberUpdateResponseResultRolesPermissionsAnalytics `json:"analytics"` + Billing OrganizationMemberUpdateResponseResultRolesPermissionsBilling `json:"billing"` + CachePurge OrganizationMemberUpdateResponseResultRolesPermissionsCachePurge `json:"cache_purge"` + DNS OrganizationMemberUpdateResponseResultRolesPermissionsDNS `json:"dns"` + DNSRecords OrganizationMemberUpdateResponseResultRolesPermissionsDNSRecords `json:"dns_records"` + Lb OrganizationMemberUpdateResponseResultRolesPermissionsLb `json:"lb"` + Logs OrganizationMemberUpdateResponseResultRolesPermissionsLogs `json:"logs"` + Organization OrganizationMemberUpdateResponseResultRolesPermissionsOrganization `json:"organization"` + Ssl OrganizationMemberUpdateResponseResultRolesPermissionsSsl `json:"ssl"` + Waf OrganizationMemberUpdateResponseResultRolesPermissionsWaf `json:"waf"` + ZoneSettings OrganizationMemberUpdateResponseResultRolesPermissionsZoneSettings `json:"zone_settings"` + Zones OrganizationMemberUpdateResponseResultRolesPermissionsZones `json:"zones"` + JSON organizationMemberUpdateResponseResultRolesPermissionsJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsJSON contains the JSON +// metadata for the struct [OrganizationMemberUpdateResponseResultRolesPermissions] +type organizationMemberUpdateResponseResultRolesPermissionsJSON struct { + Analytics apijson.Field + Billing apijson.Field + CachePurge apijson.Field + DNS apijson.Field + DNSRecords apijson.Field + Lb apijson.Field + Logs apijson.Field + Organization apijson.Field + Ssl apijson.Field + Waf apijson.Field + ZoneSettings apijson.Field + Zones apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsAnalytics struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsAnalyticsJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsAnalyticsJSON contains the +// JSON metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsAnalytics] +type organizationMemberUpdateResponseResultRolesPermissionsAnalyticsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsAnalytics) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsBilling struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsBillingJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsBillingJSON contains the +// JSON metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsBilling] +type organizationMemberUpdateResponseResultRolesPermissionsBillingJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsBilling) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsCachePurge struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsCachePurgeJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsCachePurgeJSON contains +// the JSON metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsCachePurge] +type organizationMemberUpdateResponseResultRolesPermissionsCachePurgeJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsCachePurge) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsDNS struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsDNSJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsDNSJSON contains the JSON +// metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsDNS] +type organizationMemberUpdateResponseResultRolesPermissionsDNSJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsDNS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsDNSRecords struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsDNSRecordsJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsDNSRecordsJSON contains +// the JSON metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsDNSRecords] +type organizationMemberUpdateResponseResultRolesPermissionsDNSRecordsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsDNSRecords) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsLb struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsLbJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsLbJSON contains the JSON +// metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsLb] +type organizationMemberUpdateResponseResultRolesPermissionsLbJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsLb) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsLogs struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsLogsJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsLogsJSON contains the JSON +// metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsLogs] +type organizationMemberUpdateResponseResultRolesPermissionsLogsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsLogs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsOrganization struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsOrganizationJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsOrganizationJSON contains +// the JSON metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsOrganization] +type organizationMemberUpdateResponseResultRolesPermissionsOrganizationJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsSsl struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsSslJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsSslJSON contains the JSON +// metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsSsl] +type organizationMemberUpdateResponseResultRolesPermissionsSslJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsWaf struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsWafJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsWafJSON contains the JSON +// metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsWaf] +type organizationMemberUpdateResponseResultRolesPermissionsWafJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsWaf) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsZoneSettings struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsZoneSettingsJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsZoneSettingsJSON contains +// the JSON metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsZoneSettings] +type organizationMemberUpdateResponseResultRolesPermissionsZoneSettingsJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsZoneSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultRolesPermissionsZones struct { + Read bool `json:"read"` + Write bool `json:"write"` + JSON organizationMemberUpdateResponseResultRolesPermissionsZonesJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultRolesPermissionsZonesJSON contains the +// JSON metadata for the struct +// [OrganizationMemberUpdateResponseResultRolesPermissionsZones] +type organizationMemberUpdateResponseResultRolesPermissionsZonesJSON struct { + Read apijson.Field + Write apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultRolesPermissionsZones) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberUpdateResponseResultUser struct { + // The contact email address of the user. + Email string `json:"email,required"` + // Identifier + ID string `json:"id"` + // User's first name + FirstName string `json:"first_name,nullable"` + // User's last name + LastName string `json:"last_name,nullable"` + // Indicates whether two-factor authentication is enabled for the user account. + // Does not apply to API authentication. + TwoFactorAuthenticationEnabled bool `json:"two_factor_authentication_enabled"` + JSON organizationMemberUpdateResponseResultUserJSON `json:"-"` +} + +// organizationMemberUpdateResponseResultUserJSON contains the JSON metadata for +// the struct [OrganizationMemberUpdateResponseResultUser] +type organizationMemberUpdateResponseResultUserJSON struct { + Email apijson.Field + ID apijson.Field + FirstName apijson.Field + LastName apijson.Field + TwoFactorAuthenticationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberUpdateResponseResultUser) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationMemberUpdateResponseSuccess bool + +const ( + OrganizationMemberUpdateResponseSuccessTrue OrganizationMemberUpdateResponseSuccess = true +) + +type OrganizationMemberDeleteResponse struct { + // Identifier + ID string `json:"id"` + JSON organizationMemberDeleteResponseJSON `json:"-"` +} + +// organizationMemberDeleteResponseJSON contains the JSON metadata for the struct +// [OrganizationMemberDeleteResponse] +type organizationMemberDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberOrganizationMembersListMembersResponse struct { + Errors []OrganizationMemberOrganizationMembersListMembersResponseError `json:"errors"` + Messages []OrganizationMemberOrganizationMembersListMembersResponseMessage `json:"messages"` + Result []OrganizationMemberOrganizationMembersListMembersResponseResult `json:"result"` + ResultInfo OrganizationMemberOrganizationMembersListMembersResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success OrganizationMemberOrganizationMembersListMembersResponseSuccess `json:"success"` + JSON organizationMemberOrganizationMembersListMembersResponseJSON `json:"-"` +} + +// organizationMemberOrganizationMembersListMembersResponseJSON contains the JSON +// metadata for the struct +// [OrganizationMemberOrganizationMembersListMembersResponse] +type organizationMemberOrganizationMembersListMembersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberOrganizationMembersListMembersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberOrganizationMembersListMembersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationMemberOrganizationMembersListMembersResponseErrorJSON `json:"-"` +} + +// organizationMemberOrganizationMembersListMembersResponseErrorJSON contains the +// JSON metadata for the struct +// [OrganizationMemberOrganizationMembersListMembersResponseError] +type organizationMemberOrganizationMembersListMembersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberOrganizationMembersListMembersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberOrganizationMembersListMembersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationMemberOrganizationMembersListMembersResponseMessageJSON `json:"-"` +} + +// organizationMemberOrganizationMembersListMembersResponseMessageJSON contains the +// JSON metadata for the struct +// [OrganizationMemberOrganizationMembersListMembersResponseMessage] +type organizationMemberOrganizationMembersListMembersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberOrganizationMembersListMembersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberOrganizationMembersListMembersResponseResult struct { + // Identifier + ID string `json:"id,required"` + // The contact email address of the user. + Email string `json:"email,required"` + // Member Name. + Name string `json:"name,required,nullable"` + // Roles assigned to this Member. + Roles []OrganizationMemberOrganizationMembersListMembersResponseResultRole `json:"roles,required"` + // A member's status in the organization. + Status OrganizationMemberOrganizationMembersListMembersResponseResultStatus `json:"status,required"` + JSON organizationMemberOrganizationMembersListMembersResponseResultJSON `json:"-"` +} + +// organizationMemberOrganizationMembersListMembersResponseResultJSON contains the +// JSON metadata for the struct +// [OrganizationMemberOrganizationMembersListMembersResponseResult] +type organizationMemberOrganizationMembersListMembersResponseResultJSON struct { + ID apijson.Field + Email apijson.Field + Name apijson.Field + Roles apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberOrganizationMembersListMembersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationMemberOrganizationMembersListMembersResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role Name. + Name string `json:"name,required"` + // Access permissions for this User. + Permissions []string `json:"permissions,required"` + JSON organizationMemberOrganizationMembersListMembersResponseResultRoleJSON `json:"-"` +} + +// organizationMemberOrganizationMembersListMembersResponseResultRoleJSON contains +// the JSON metadata for the struct +// [OrganizationMemberOrganizationMembersListMembersResponseResultRole] +type organizationMemberOrganizationMembersListMembersResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberOrganizationMembersListMembersResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A member's status in the organization. +type OrganizationMemberOrganizationMembersListMembersResponseResultStatus string + +const ( + OrganizationMemberOrganizationMembersListMembersResponseResultStatusAccepted OrganizationMemberOrganizationMembersListMembersResponseResultStatus = "accepted" + OrganizationMemberOrganizationMembersListMembersResponseResultStatusInvited OrganizationMemberOrganizationMembersListMembersResponseResultStatus = "invited" +) + +type OrganizationMemberOrganizationMembersListMembersResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON organizationMemberOrganizationMembersListMembersResponseResultInfoJSON `json:"-"` +} + +// organizationMemberOrganizationMembersListMembersResponseResultInfoJSON contains +// the JSON metadata for the struct +// [OrganizationMemberOrganizationMembersListMembersResponseResultInfo] +type organizationMemberOrganizationMembersListMembersResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationMemberOrganizationMembersListMembersResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationMemberOrganizationMembersListMembersResponseSuccess bool + +const ( + OrganizationMemberOrganizationMembersListMembersResponseSuccessTrue OrganizationMemberOrganizationMembersListMembersResponseSuccess = true +) + +type OrganizationMemberUpdateParams struct { + // Array of Roles associated with this Member. + Roles param.Field[[]string] `json:"roles"` +} + +func (r OrganizationMemberUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/organizationmember_test.go b/organizationmember_test.go new file mode 100644 index 00000000000..be0dcc8025a --- /dev/null +++ b/organizationmember_test.go @@ -0,0 +1,133 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestOrganizationMemberGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Members.Get( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "4536bcfad5faccb111b47003c79917fa", + ) + 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 TestOrganizationMemberUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Members.Update( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.OrganizationMemberUpdateParams{ + Roles: cloudflare.F([]string{"3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb"}), + }, + ) + 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 TestOrganizationMemberDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Members.Delete( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "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()) + } +} + +func TestOrganizationMemberOrganizationMembersListMembers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Members.OrganizationMembersListMembers(context.TODO(), "01a7362d577a6c3019a474fd6f485823") + 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/organizationrailgun.go b/organizationrailgun.go new file mode 100644 index 00000000000..7922a345822 --- /dev/null +++ b/organizationrailgun.go @@ -0,0 +1,517 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// OrganizationRailgunService 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 [NewOrganizationRailgunService] +// method instead. +type OrganizationRailgunService struct { + Options []option.RequestOption + Zones *OrganizationRailgunZoneService +} + +// NewOrganizationRailgunService 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 NewOrganizationRailgunService(opts ...option.RequestOption) (r *OrganizationRailgunService) { + r = &OrganizationRailgunService{} + r.Options = opts + r.Zones = NewOrganizationRailgunZoneService(opts...) + return +} + +// Railgun details +func (r *OrganizationRailgunService) Get(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationRailgunGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/railguns/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Enable or disable a Railgun for all zones connected to it. +func (r *OrganizationRailgunService) Update(ctx context.Context, organizationIdentifier string, identifier string, body OrganizationRailgunUpdateParams, opts ...option.RequestOption) (res *OrganizationRailgunUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/railguns/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Disable and delete a Railgun. This will immediately disable the Railgun for any +// connected zones. +func (r *OrganizationRailgunService) Delete(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationRailgunDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/railguns/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create Railgun +func (r *OrganizationRailgunService) OrganizationRailgunNewRailgun(ctx context.Context, organizationIdentifier string, body OrganizationRailgunOrganizationRailgunNewRailgunParams, opts ...option.RequestOption) (res *OrganizationRailgunOrganizationRailgunNewRailgunResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/railguns", organizationIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List, search, sort and filter your Railguns. +func (r *OrganizationRailgunService) OrganizationRailgunListRailguns(ctx context.Context, organizationIdentifier string, query OrganizationRailgunOrganizationRailgunListRailgunsParams, opts ...option.RequestOption) (res *shared.Page[OrganizationRailgunOrganizationRailgunListRailgunsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("organizations/%s/railguns", organizationIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type OrganizationRailgunGetResponse struct { + Errors []OrganizationRailgunGetResponseError `json:"errors"` + Messages []OrganizationRailgunGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationRailgunGetResponseSuccess `json:"success"` + JSON organizationRailgunGetResponseJSON `json:"-"` +} + +// organizationRailgunGetResponseJSON contains the JSON metadata for the struct +// [OrganizationRailgunGetResponse] +type organizationRailgunGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunGetResponseErrorJSON `json:"-"` +} + +// organizationRailgunGetResponseErrorJSON contains the JSON metadata for the +// struct [OrganizationRailgunGetResponseError] +type organizationRailgunGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunGetResponseMessageJSON `json:"-"` +} + +// organizationRailgunGetResponseMessageJSON contains the JSON metadata for the +// struct [OrganizationRailgunGetResponseMessage] +type organizationRailgunGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationRailgunGetResponseSuccess bool + +const ( + OrganizationRailgunGetResponseSuccessTrue OrganizationRailgunGetResponseSuccess = true +) + +type OrganizationRailgunUpdateResponse struct { + Errors []OrganizationRailgunUpdateResponseError `json:"errors"` + Messages []OrganizationRailgunUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationRailgunUpdateResponseSuccess `json:"success"` + JSON organizationRailgunUpdateResponseJSON `json:"-"` +} + +// organizationRailgunUpdateResponseJSON contains the JSON metadata for the struct +// [OrganizationRailgunUpdateResponse] +type organizationRailgunUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunUpdateResponseErrorJSON `json:"-"` +} + +// organizationRailgunUpdateResponseErrorJSON contains the JSON metadata for the +// struct [OrganizationRailgunUpdateResponseError] +type organizationRailgunUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunUpdateResponseMessageJSON `json:"-"` +} + +// organizationRailgunUpdateResponseMessageJSON contains the JSON metadata for the +// struct [OrganizationRailgunUpdateResponseMessage] +type organizationRailgunUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationRailgunUpdateResponseSuccess bool + +const ( + OrganizationRailgunUpdateResponseSuccessTrue OrganizationRailgunUpdateResponseSuccess = true +) + +type OrganizationRailgunDeleteResponse struct { + Errors []OrganizationRailgunDeleteResponseError `json:"errors"` + Messages []OrganizationRailgunDeleteResponseMessage `json:"messages"` + Result OrganizationRailgunDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success OrganizationRailgunDeleteResponseSuccess `json:"success"` + JSON organizationRailgunDeleteResponseJSON `json:"-"` +} + +// organizationRailgunDeleteResponseJSON contains the JSON metadata for the struct +// [OrganizationRailgunDeleteResponse] +type organizationRailgunDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunDeleteResponseErrorJSON `json:"-"` +} + +// organizationRailgunDeleteResponseErrorJSON contains the JSON metadata for the +// struct [OrganizationRailgunDeleteResponseError] +type organizationRailgunDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunDeleteResponseMessageJSON `json:"-"` +} + +// organizationRailgunDeleteResponseMessageJSON contains the JSON metadata for the +// struct [OrganizationRailgunDeleteResponseMessage] +type organizationRailgunDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunDeleteResponseResult struct { + // Railgun identifier tag. + ID string `json:"id"` + JSON organizationRailgunDeleteResponseResultJSON `json:"-"` +} + +// organizationRailgunDeleteResponseResultJSON contains the JSON metadata for the +// struct [OrganizationRailgunDeleteResponseResult] +type organizationRailgunDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationRailgunDeleteResponseSuccess bool + +const ( + OrganizationRailgunDeleteResponseSuccessTrue OrganizationRailgunDeleteResponseSuccess = true +) + +type OrganizationRailgunOrganizationRailgunNewRailgunResponse struct { + Errors []OrganizationRailgunOrganizationRailgunNewRailgunResponseError `json:"errors"` + Messages []OrganizationRailgunOrganizationRailgunNewRailgunResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationRailgunOrganizationRailgunNewRailgunResponseSuccess `json:"success"` + JSON organizationRailgunOrganizationRailgunNewRailgunResponseJSON `json:"-"` +} + +// organizationRailgunOrganizationRailgunNewRailgunResponseJSON contains the JSON +// metadata for the struct +// [OrganizationRailgunOrganizationRailgunNewRailgunResponse] +type organizationRailgunOrganizationRailgunNewRailgunResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunOrganizationRailgunNewRailgunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunOrganizationRailgunNewRailgunResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunOrganizationRailgunNewRailgunResponseErrorJSON `json:"-"` +} + +// organizationRailgunOrganizationRailgunNewRailgunResponseErrorJSON contains the +// JSON metadata for the struct +// [OrganizationRailgunOrganizationRailgunNewRailgunResponseError] +type organizationRailgunOrganizationRailgunNewRailgunResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunOrganizationRailgunNewRailgunResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunOrganizationRailgunNewRailgunResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunOrganizationRailgunNewRailgunResponseMessageJSON `json:"-"` +} + +// organizationRailgunOrganizationRailgunNewRailgunResponseMessageJSON contains the +// JSON metadata for the struct +// [OrganizationRailgunOrganizationRailgunNewRailgunResponseMessage] +type organizationRailgunOrganizationRailgunNewRailgunResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunOrganizationRailgunNewRailgunResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationRailgunOrganizationRailgunNewRailgunResponseSuccess bool + +const ( + OrganizationRailgunOrganizationRailgunNewRailgunResponseSuccessTrue OrganizationRailgunOrganizationRailgunNewRailgunResponseSuccess = true +) + +type OrganizationRailgunOrganizationRailgunListRailgunsResponse struct { + // Railgun identifier tag. + ID string `json:"id,required"` + // When the Railgun was activated. + ActivatedOn time.Time `json:"activated_on,required" format:"date-time"` + ActivationKey string `json:"activation_key,required"` + // The build identifier for the Railgun receiver. + Build string `json:"build,required"` + // When the Railgun was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Flag to determine if the Railgun is accepting connections. + Enabled bool `json:"enabled,required"` + // When the Railgun was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Readable identifier of the Railgun. + Name string `json:"name,required"` + // The revision of the Railgun receiver. + Revision string `json:"revision,required"` + // Status of the Railgun. + Status OrganizationRailgunOrganizationRailgunListRailgunsResponseStatus `json:"status,required"` + // The version of the Railgun receiver. + Version string `json:"version,required"` + // The number of zones using this Railgun. + ZonesConnected float64 `json:"zones_connected,required"` + // Defined when the Railgun version is out of date from the latest release from + // Cloudflare. + UpgradeInfo OrganizationRailgunOrganizationRailgunListRailgunsResponseUpgradeInfo `json:"upgrade_info"` + JSON organizationRailgunOrganizationRailgunListRailgunsResponseJSON `json:"-"` +} + +// organizationRailgunOrganizationRailgunListRailgunsResponseJSON contains the JSON +// metadata for the struct +// [OrganizationRailgunOrganizationRailgunListRailgunsResponse] +type organizationRailgunOrganizationRailgunListRailgunsResponseJSON struct { + ID apijson.Field + ActivatedOn apijson.Field + ActivationKey apijson.Field + Build apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Revision apijson.Field + Status apijson.Field + Version apijson.Field + ZonesConnected apijson.Field + UpgradeInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunOrganizationRailgunListRailgunsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Railgun. +type OrganizationRailgunOrganizationRailgunListRailgunsResponseStatus string + +const ( + OrganizationRailgunOrganizationRailgunListRailgunsResponseStatusInitializing OrganizationRailgunOrganizationRailgunListRailgunsResponseStatus = "initializing" + OrganizationRailgunOrganizationRailgunListRailgunsResponseStatusActive OrganizationRailgunOrganizationRailgunListRailgunsResponseStatus = "active" +) + +// Defined when the Railgun version is out of date from the latest release from +// Cloudflare. +type OrganizationRailgunOrganizationRailgunListRailgunsResponseUpgradeInfo struct { + // An HTTP link to download the latest Railgun binary. + DownloadLink string `json:"download_link"` + // Latest version of the Railgun receiver available to install. + LatestVersion string `json:"latest_version"` + JSON organizationRailgunOrganizationRailgunListRailgunsResponseUpgradeInfoJSON `json:"-"` +} + +// organizationRailgunOrganizationRailgunListRailgunsResponseUpgradeInfoJSON +// contains the JSON metadata for the struct +// [OrganizationRailgunOrganizationRailgunListRailgunsResponseUpgradeInfo] +type organizationRailgunOrganizationRailgunListRailgunsResponseUpgradeInfoJSON struct { + DownloadLink apijson.Field + LatestVersion apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunOrganizationRailgunListRailgunsResponseUpgradeInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunUpdateParams struct { + // Flag to determine if the Railgun is accepting connections. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r OrganizationRailgunUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type OrganizationRailgunOrganizationRailgunNewRailgunParams struct { + // Readable identifier of the Railgun. + Name param.Field[string] `json:"name,required"` +} + +func (r OrganizationRailgunOrganizationRailgunNewRailgunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type OrganizationRailgunOrganizationRailgunListRailgunsParams struct { + // Sort Railguns in ascending or descending order. + Direction param.Field[OrganizationRailgunOrganizationRailgunListRailgunsParamsDirection] `query:"direction"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [OrganizationRailgunOrganizationRailgunListRailgunsParams]'s +// query parameters as `url.Values`. +func (r OrganizationRailgunOrganizationRailgunListRailgunsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Sort Railguns in ascending or descending order. +type OrganizationRailgunOrganizationRailgunListRailgunsParamsDirection string + +const ( + OrganizationRailgunOrganizationRailgunListRailgunsParamsDirectionAsc OrganizationRailgunOrganizationRailgunListRailgunsParamsDirection = "asc" + OrganizationRailgunOrganizationRailgunListRailgunsParamsDirectionDesc OrganizationRailgunOrganizationRailgunListRailgunsParamsDirection = "desc" +) diff --git a/organizationrailgun_test.go b/organizationrailgun_test.go new file mode 100644 index 00000000000..00b19a676dd --- /dev/null +++ b/organizationrailgun_test.go @@ -0,0 +1,173 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestOrganizationRailgunGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Railguns.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + ) + 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 TestOrganizationRailgunUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Railguns.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + cloudflare.OrganizationRailgunUpdateParams{ + Enabled: cloudflare.F(true), + }, + ) + 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 TestOrganizationRailgunDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Railguns.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + ) + 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 TestOrganizationRailgunOrganizationRailgunNewRailgun(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Railguns.OrganizationRailgunNewRailgun( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.OrganizationRailgunOrganizationRailgunNewRailgunParams{ + Name: cloudflare.F("My Railgun."), + }, + ) + 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 TestOrganizationRailgunOrganizationRailgunListRailgunsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Railguns.OrganizationRailgunListRailguns( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.OrganizationRailgunOrganizationRailgunListRailgunsParams{ + Direction: cloudflare.F(cloudflare.OrganizationRailgunOrganizationRailgunListRailgunsParamsDirectionDesc), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/organizationrailgunzone.go b/organizationrailgunzone.go new file mode 100644 index 00000000000..ee56d0040a1 --- /dev/null +++ b/organizationrailgunzone.go @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// OrganizationRailgunZoneService 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 +// [NewOrganizationRailgunZoneService] method instead. +type OrganizationRailgunZoneService struct { + Options []option.RequestOption +} + +// NewOrganizationRailgunZoneService 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 NewOrganizationRailgunZoneService(opts ...option.RequestOption) (r *OrganizationRailgunZoneService) { + r = &OrganizationRailgunZoneService{} + r.Options = opts + return +} + +// Lists the zones that are currently using this Railgun. +func (r *OrganizationRailgunZoneService) List(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationRailgunZoneListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/railguns/%s/zones", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type OrganizationRailgunZoneListResponse struct { + Errors []OrganizationRailgunZoneListResponseError `json:"errors"` + Messages []OrganizationRailgunZoneListResponseMessage `json:"messages"` + Result []OrganizationRailgunZoneListResponseResult `json:"result"` + ResultInfo OrganizationRailgunZoneListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success OrganizationRailgunZoneListResponseSuccess `json:"success"` + JSON organizationRailgunZoneListResponseJSON `json:"-"` +} + +// organizationRailgunZoneListResponseJSON contains the JSON metadata for the +// struct [OrganizationRailgunZoneListResponse] +type organizationRailgunZoneListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunZoneListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunZoneListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunZoneListResponseErrorJSON `json:"-"` +} + +// organizationRailgunZoneListResponseErrorJSON contains the JSON metadata for the +// struct [OrganizationRailgunZoneListResponseError] +type organizationRailgunZoneListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunZoneListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunZoneListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRailgunZoneListResponseMessageJSON `json:"-"` +} + +// organizationRailgunZoneListResponseMessageJSON contains the JSON metadata for +// the struct [OrganizationRailgunZoneListResponseMessage] +type organizationRailgunZoneListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunZoneListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunZoneListResponseResult struct { + // Identifier + ID string `json:"id,required"` + // The last time proof of ownership was detected and the zone was made active + ActivatedOn time.Time `json:"activated_on,required,nullable" format:"date-time"` + // When the zone was created + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // The interval (in seconds) from when development mode expires (positive integer) + // or last expired (negative integer) for the domain. If development mode has never + // been enabled, this value is 0. + DevelopmentMode float64 `json:"development_mode,required"` + // When the zone was last modified + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The domain name + Name string `json:"name,required"` + // DNS host at the time of switching to Cloudflare + OriginalDnshost string `json:"original_dnshost,required,nullable"` + // Original name servers before moving to Cloudflare Notes: Is this only available + // for full zones? + OriginalNameServers []string `json:"original_name_servers,required,nullable" format:"hostname"` + // Registrar for the domain at the time of switching to Cloudflare + OriginalRegistrar string `json:"original_registrar,required,nullable"` + JSON organizationRailgunZoneListResponseResultJSON `json:"-"` +} + +// organizationRailgunZoneListResponseResultJSON contains the JSON metadata for the +// struct [OrganizationRailgunZoneListResponseResult] +type organizationRailgunZoneListResponseResultJSON struct { + ID apijson.Field + ActivatedOn apijson.Field + CreatedOn apijson.Field + DevelopmentMode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + OriginalDnshost apijson.Field + OriginalNameServers apijson.Field + OriginalRegistrar apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunZoneListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRailgunZoneListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON organizationRailgunZoneListResponseResultInfoJSON `json:"-"` +} + +// organizationRailgunZoneListResponseResultInfoJSON contains the JSON metadata for +// the struct [OrganizationRailgunZoneListResponseResultInfo] +type organizationRailgunZoneListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRailgunZoneListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationRailgunZoneListResponseSuccess bool + +const ( + OrganizationRailgunZoneListResponseSuccessTrue OrganizationRailgunZoneListResponseSuccess = true +) diff --git a/organizationrailgunzone_test.go b/organizationrailgunzone_test.go new file mode 100644 index 00000000000..f8f3b935e8f --- /dev/null +++ b/organizationrailgunzone_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestOrganizationRailgunZoneList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Railguns.Zones.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + ) + 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/organizationrole.go b/organizationrole.go new file mode 100644 index 00000000000..bcca79be15c --- /dev/null +++ b/organizationrole.go @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// OrganizationRoleService 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 [NewOrganizationRoleService] method +// instead. +type OrganizationRoleService struct { + Options []option.RequestOption +} + +// NewOrganizationRoleService 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 NewOrganizationRoleService(opts ...option.RequestOption) (r *OrganizationRoleService) { + r = &OrganizationRoleService{} + r.Options = opts + return +} + +// Get information about a specific role for an organization. +func (r *OrganizationRoleService) Get(ctx context.Context, organizationIdentifier string, identifier string, opts ...option.RequestOption) (res *OrganizationRoleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/roles/%s", organizationIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Get all available roles for an organization. +func (r *OrganizationRoleService) OrganizationRolesListRoles(ctx context.Context, organizationIdentifier string, opts ...option.RequestOption) (res *OrganizationRoleOrganizationRolesListRolesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("organizations/%s/roles", organizationIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type OrganizationRoleGetResponse struct { + Errors []OrganizationRoleGetResponseError `json:"errors"` + Messages []OrganizationRoleGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success OrganizationRoleGetResponseSuccess `json:"success"` + JSON organizationRoleGetResponseJSON `json:"-"` +} + +// organizationRoleGetResponseJSON contains the JSON metadata for the struct +// [OrganizationRoleGetResponse] +type organizationRoleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRoleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRoleGetResponseErrorJSON `json:"-"` +} + +// organizationRoleGetResponseErrorJSON contains the JSON metadata for the struct +// [OrganizationRoleGetResponseError] +type organizationRoleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRoleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRoleGetResponseMessageJSON `json:"-"` +} + +// organizationRoleGetResponseMessageJSON contains the JSON metadata for the struct +// [OrganizationRoleGetResponseMessage] +type organizationRoleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationRoleGetResponseSuccess bool + +const ( + OrganizationRoleGetResponseSuccessTrue OrganizationRoleGetResponseSuccess = true +) + +type OrganizationRoleOrganizationRolesListRolesResponse struct { + Errors []OrganizationRoleOrganizationRolesListRolesResponseError `json:"errors"` + Messages []OrganizationRoleOrganizationRolesListRolesResponseMessage `json:"messages"` + Result []OrganizationRoleOrganizationRolesListRolesResponseResult `json:"result"` + ResultInfo OrganizationRoleOrganizationRolesListRolesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success OrganizationRoleOrganizationRolesListRolesResponseSuccess `json:"success"` + JSON organizationRoleOrganizationRolesListRolesResponseJSON `json:"-"` +} + +// organizationRoleOrganizationRolesListRolesResponseJSON contains the JSON +// metadata for the struct [OrganizationRoleOrganizationRolesListRolesResponse] +type organizationRoleOrganizationRolesListRolesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleOrganizationRolesListRolesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRoleOrganizationRolesListRolesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRoleOrganizationRolesListRolesResponseErrorJSON `json:"-"` +} + +// organizationRoleOrganizationRolesListRolesResponseErrorJSON contains the JSON +// metadata for the struct +// [OrganizationRoleOrganizationRolesListRolesResponseError] +type organizationRoleOrganizationRolesListRolesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleOrganizationRolesListRolesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRoleOrganizationRolesListRolesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON organizationRoleOrganizationRolesListRolesResponseMessageJSON `json:"-"` +} + +// organizationRoleOrganizationRolesListRolesResponseMessageJSON contains the JSON +// metadata for the struct +// [OrganizationRoleOrganizationRolesListRolesResponseMessage] +type organizationRoleOrganizationRolesListRolesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleOrganizationRolesListRolesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRoleOrganizationRolesListRolesResponseResult struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role Name. + Name string `json:"name,required"` + // Access permissions for this User. + Permissions []string `json:"permissions,required"` + JSON organizationRoleOrganizationRolesListRolesResponseResultJSON `json:"-"` +} + +// organizationRoleOrganizationRolesListRolesResponseResultJSON contains the JSON +// metadata for the struct +// [OrganizationRoleOrganizationRolesListRolesResponseResult] +type organizationRoleOrganizationRolesListRolesResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleOrganizationRolesListRolesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type OrganizationRoleOrganizationRolesListRolesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON organizationRoleOrganizationRolesListRolesResponseResultInfoJSON `json:"-"` +} + +// organizationRoleOrganizationRolesListRolesResponseResultInfoJSON contains the +// JSON metadata for the struct +// [OrganizationRoleOrganizationRolesListRolesResponseResultInfo] +type organizationRoleOrganizationRolesListRolesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *OrganizationRoleOrganizationRolesListRolesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type OrganizationRoleOrganizationRolesListRolesResponseSuccess bool + +const ( + OrganizationRoleOrganizationRolesListRolesResponseSuccessTrue OrganizationRoleOrganizationRolesListRolesResponseSuccess = true +) diff --git a/organizationrole_test.go b/organizationrole_test.go new file mode 100644 index 00000000000..f7ca44aa78c --- /dev/null +++ b/organizationrole_test.go @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestOrganizationRoleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Roles.Get( + context.TODO(), + "01a7362d577a6c3019a474fd6f485823", + "3536bcfad5faccb999b47003c79917fb", + ) + 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 TestOrganizationRoleOrganizationRolesListRoles(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Organizations.Roles.OrganizationRolesListRoles(context.TODO(), "01a7362d577a6c3019a474fd6f485823") + 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/pagerule.go b/pagerule.go new file mode 100644 index 00000000000..b336e02dc64 --- /dev/null +++ b/pagerule.go @@ -0,0 +1,147 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// PageruleService 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 [NewPageruleService] method instead. +type PageruleService struct { + Options []option.RequestOption +} + +// NewPageruleService 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 NewPageruleService(opts ...option.RequestOption) (r *PageruleService) { + r = &PageruleService{} + r.Options = opts + return +} + +// Updates one or more fields of an existing Page Rule. +func (r *PageruleService) Update(ctx context.Context, zoneIdentifier string, identifier string, body PageruleUpdateParams, opts ...option.RequestOption) (res *PageruleResponseSingle, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/pagerules/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type PageruleUpdateParams struct { + // The set of actions to perform if the targets of this rule match the request. + // Actions can redirect to another URL or override settings, but not both. + Actions param.Field[[]PageruleUpdateParamsAction] `json:"actions"` + // The priority of the rule, used to define which Page Rule is processed over + // another. A higher number indicates a higher priority. For example, if you have a + // catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + // take precedence (rule B: `/images/special/*`), specify a higher priority for + // rule B so it overrides rule A. + Priority param.Field[int64] `json:"priority"` + // The status of the Page Rule. + Status param.Field[PageruleUpdateParamsStatus] `json:"status"` + // The rule targets to evaluate on each request. + Targets param.Field[[]PageruleUpdateParamsTarget] `json:"targets"` +} + +func (r PageruleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type PageruleUpdateParamsAction struct { + // The type of route. + Name param.Field[PageruleUpdateParamsActionsName] `json:"name"` + Value param.Field[PageruleUpdateParamsActionsValue] `json:"value"` +} + +func (r PageruleUpdateParamsAction) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of route. +type PageruleUpdateParamsActionsName string + +const ( + PageruleUpdateParamsActionsNameForwardURL PageruleUpdateParamsActionsName = "forward_url" +) + +type PageruleUpdateParamsActionsValue struct { + // The response type for the URL redirect. + Type param.Field[PageruleUpdateParamsActionsValueType] `json:"type"` + // The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + // in the constraint value. + URL param.Field[string] `json:"url"` +} + +func (r PageruleUpdateParamsActionsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response type for the URL redirect. +type PageruleUpdateParamsActionsValueType string + +const ( + PageruleUpdateParamsActionsValueTypeTemporary PageruleUpdateParamsActionsValueType = "temporary" + PageruleUpdateParamsActionsValueTypePermanent PageruleUpdateParamsActionsValueType = "permanent" +) + +// The status of the Page Rule. +type PageruleUpdateParamsStatus string + +const ( + PageruleUpdateParamsStatusActive PageruleUpdateParamsStatus = "active" + PageruleUpdateParamsStatusDisabled PageruleUpdateParamsStatus = "disabled" +) + +// A request condition target. +type PageruleUpdateParamsTarget struct { + // The constraint of a target. + Constraint param.Field[PageruleUpdateParamsTargetsConstraint] `json:"constraint,required"` + // A target based on the URL of the request. + Target param.Field[PageruleUpdateParamsTargetsTarget] `json:"target,required"` +} + +func (r PageruleUpdateParamsTarget) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The constraint of a target. +type PageruleUpdateParamsTargetsConstraint struct { + // The matches operator can use asterisks and pipes as wildcard and 'or' operators. + Operator param.Field[PageruleUpdateParamsTargetsConstraintOperator] `json:"operator"` + // The URL pattern to match against the current request. The pattern may contain up + // to four asterisks ('\*') as placeholders. + Value param.Field[string] `json:"value"` +} + +func (r PageruleUpdateParamsTargetsConstraint) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The matches operator can use asterisks and pipes as wildcard and 'or' operators. +type PageruleUpdateParamsTargetsConstraintOperator string + +const ( + PageruleUpdateParamsTargetsConstraintOperatorMatches PageruleUpdateParamsTargetsConstraintOperator = "matches" + PageruleUpdateParamsTargetsConstraintOperatorContains PageruleUpdateParamsTargetsConstraintOperator = "contains" + PageruleUpdateParamsTargetsConstraintOperatorEquals PageruleUpdateParamsTargetsConstraintOperator = "equals" + PageruleUpdateParamsTargetsConstraintOperatorNotEqual PageruleUpdateParamsTargetsConstraintOperator = "not_equal" + PageruleUpdateParamsTargetsConstraintOperatorNotContain PageruleUpdateParamsTargetsConstraintOperator = "not_contain" +) + +// A target based on the URL of the request. +type PageruleUpdateParamsTargetsTarget string + +const ( + PageruleUpdateParamsTargetsTargetURL PageruleUpdateParamsTargetsTarget = "url" +) diff --git a/pagerule_test.go b/pagerule_test.go new file mode 100644 index 00000000000..e07a24f2391 --- /dev/null +++ b/pagerule_test.go @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestPageruleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Pagerules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.PageruleUpdateParams{ + Actions: cloudflare.F([]cloudflare.PageruleUpdateParamsAction{{ + Name: cloudflare.F(cloudflare.PageruleUpdateParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.PageruleUpdateParamsActionsValue{ + Type: cloudflare.F(cloudflare.PageruleUpdateParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(cloudflare.PageruleUpdateParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.PageruleUpdateParamsActionsValue{ + Type: cloudflare.F(cloudflare.PageruleUpdateParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(cloudflare.PageruleUpdateParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.PageruleUpdateParamsActionsValue{ + Type: cloudflare.F(cloudflare.PageruleUpdateParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }}), + Priority: cloudflare.F(int64(0)), + Status: cloudflare.F(cloudflare.PageruleUpdateParamsStatusActive), + Targets: cloudflare.F([]cloudflare.PageruleUpdateParamsTarget{{ + Constraint: cloudflare.F(cloudflare.PageruleUpdateParamsTargetsConstraint{ + Operator: cloudflare.F(cloudflare.PageruleUpdateParamsTargetsConstraintOperatorMatches), + Value: cloudflare.F("*example.com/images/*"), + }), + Target: cloudflare.F(cloudflare.PageruleUpdateParamsTargetsTargetURL), + }}), + }, + ) + 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/radar.go b/radar.go new file mode 100644 index 00000000000..ca9121f9fa4 --- /dev/null +++ b/radar.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarService 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 [NewRadarService] method instead. +type RadarService struct { + Options []option.RequestOption + As112 *RadarAs112Service + Quality *RadarQualityService + TrafficAnomalies *RadarTrafficAnomalyService + Annotations *RadarAnnotationService + Attacks *RadarAttackService + Bgps *RadarBgpService + Datasets *RadarDatasetService + DNS *RadarDNSService + Email *RadarEmailService + Entities *RadarEntityService + HTTP *RadarHTTPService + Netflows *RadarNetflowService + Ranking *RadarRankingService + Searches *RadarSearchService + VerifiedBots *RadarVerifiedBotService + ConnectionTamperings *RadarConnectionTamperingService +} + +// NewRadarService 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 NewRadarService(opts ...option.RequestOption) (r *RadarService) { + r = &RadarService{} + r.Options = opts + r.As112 = NewRadarAs112Service(opts...) + r.Quality = NewRadarQualityService(opts...) + r.TrafficAnomalies = NewRadarTrafficAnomalyService(opts...) + r.Annotations = NewRadarAnnotationService(opts...) + r.Attacks = NewRadarAttackService(opts...) + r.Bgps = NewRadarBgpService(opts...) + r.Datasets = NewRadarDatasetService(opts...) + r.DNS = NewRadarDNSService(opts...) + r.Email = NewRadarEmailService(opts...) + r.Entities = NewRadarEntityService(opts...) + r.HTTP = NewRadarHTTPService(opts...) + r.Netflows = NewRadarNetflowService(opts...) + r.Ranking = NewRadarRankingService(opts...) + r.Searches = NewRadarSearchService(opts...) + r.VerifiedBots = NewRadarVerifiedBotService(opts...) + r.ConnectionTamperings = NewRadarConnectionTamperingService(opts...) + return +} diff --git a/radarannotation.go b/radarannotation.go new file mode 100644 index 00000000000..35159445a96 --- /dev/null +++ b/radarannotation.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAnnotationService 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 [NewRadarAnnotationService] method +// instead. +type RadarAnnotationService struct { + Options []option.RequestOption + Outages *RadarAnnotationOutageService +} + +// NewRadarAnnotationService 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 NewRadarAnnotationService(opts ...option.RequestOption) (r *RadarAnnotationService) { + r = &RadarAnnotationService{} + r.Options = opts + r.Outages = NewRadarAnnotationOutageService(opts...) + return +} diff --git a/radarannotationoutage.go b/radarannotationoutage.go new file mode 100644 index 00000000000..0fc8b8b63a0 --- /dev/null +++ b/radarannotationoutage.go @@ -0,0 +1,262 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAnnotationOutageService 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 [NewRadarAnnotationOutageService] +// method instead. +type RadarAnnotationOutageService struct { + Options []option.RequestOption + Locations *RadarAnnotationOutageLocationService +} + +// NewRadarAnnotationOutageService 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 NewRadarAnnotationOutageService(opts ...option.RequestOption) (r *RadarAnnotationOutageService) { + r = &RadarAnnotationOutageService{} + r.Options = opts + r.Locations = NewRadarAnnotationOutageLocationService(opts...) + return +} + +// Get latest Internet outages and anomalies. +func (r *RadarAnnotationOutageService) List(ctx context.Context, query RadarAnnotationOutageListParams, opts ...option.RequestOption) (res *RadarAnnotationOutageListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/annotations/outages" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAnnotationOutageListResponse struct { + Result RadarAnnotationOutageListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAnnotationOutageListResponseJSON `json:"-"` +} + +// radarAnnotationOutageListResponseJSON contains the JSON metadata for the struct +// [RadarAnnotationOutageListResponse] +type radarAnnotationOutageListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageListResponseResult struct { + Annotations []RadarAnnotationOutageListResponseResultAnnotation `json:"annotations,required"` + JSON radarAnnotationOutageListResponseResultJSON `json:"-"` +} + +// radarAnnotationOutageListResponseResultJSON contains the JSON metadata for the +// struct [RadarAnnotationOutageListResponseResult] +type radarAnnotationOutageListResponseResultJSON struct { + Annotations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageListResponseResultAnnotation struct { + ID string `json:"id,required"` + ASNs []int64 `json:"asns,required"` + ASNsDetails []RadarAnnotationOutageListResponseResultAnnotationsASNsDetail `json:"asnsDetails,required"` + DataSource string `json:"dataSource,required"` + EventType string `json:"eventType,required"` + Locations []string `json:"locations,required"` + LocationsDetails []RadarAnnotationOutageListResponseResultAnnotationsLocationsDetail `json:"locationsDetails,required"` + Outage RadarAnnotationOutageListResponseResultAnnotationsOutage `json:"outage,required"` + StartDate string `json:"startDate,required"` + Description string `json:"description"` + EndDate string `json:"endDate"` + LinkedURL string `json:"linkedUrl"` + Scope string `json:"scope"` + JSON radarAnnotationOutageListResponseResultAnnotationJSON `json:"-"` +} + +// radarAnnotationOutageListResponseResultAnnotationJSON contains the JSON metadata +// for the struct [RadarAnnotationOutageListResponseResultAnnotation] +type radarAnnotationOutageListResponseResultAnnotationJSON struct { + ID apijson.Field + ASNs apijson.Field + ASNsDetails apijson.Field + DataSource apijson.Field + EventType apijson.Field + Locations apijson.Field + LocationsDetails apijson.Field + Outage apijson.Field + StartDate apijson.Field + Description apijson.Field + EndDate apijson.Field + LinkedURL apijson.Field + Scope apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageListResponseResultAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageListResponseResultAnnotationsASNsDetail struct { + ASN string `json:"asn,required"` + Name string `json:"name,required"` + Locations RadarAnnotationOutageListResponseResultAnnotationsASNsDetailsLocations `json:"locations"` + JSON radarAnnotationOutageListResponseResultAnnotationsASNsDetailJSON `json:"-"` +} + +// radarAnnotationOutageListResponseResultAnnotationsASNsDetailJSON contains the +// JSON metadata for the struct +// [RadarAnnotationOutageListResponseResultAnnotationsASNsDetail] +type radarAnnotationOutageListResponseResultAnnotationsASNsDetailJSON struct { + ASN apijson.Field + Name apijson.Field + Locations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageListResponseResultAnnotationsASNsDetail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageListResponseResultAnnotationsASNsDetailsLocations struct { + Code string `json:"code,required"` + Name string `json:"name,required"` + JSON radarAnnotationOutageListResponseResultAnnotationsASNsDetailsLocationsJSON `json:"-"` +} + +// radarAnnotationOutageListResponseResultAnnotationsASNsDetailsLocationsJSON +// contains the JSON metadata for the struct +// [RadarAnnotationOutageListResponseResultAnnotationsASNsDetailsLocations] +type radarAnnotationOutageListResponseResultAnnotationsASNsDetailsLocationsJSON struct { + Code apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageListResponseResultAnnotationsASNsDetailsLocations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageListResponseResultAnnotationsLocationsDetail struct { + Code string `json:"code,required"` + Name string `json:"name,required"` + JSON radarAnnotationOutageListResponseResultAnnotationsLocationsDetailJSON `json:"-"` +} + +// radarAnnotationOutageListResponseResultAnnotationsLocationsDetailJSON contains +// the JSON metadata for the struct +// [RadarAnnotationOutageListResponseResultAnnotationsLocationsDetail] +type radarAnnotationOutageListResponseResultAnnotationsLocationsDetailJSON struct { + Code apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageListResponseResultAnnotationsLocationsDetail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageListResponseResultAnnotationsOutage struct { + OutageCause string `json:"outageCause,required"` + OutageType string `json:"outageType,required"` + JSON radarAnnotationOutageListResponseResultAnnotationsOutageJSON `json:"-"` +} + +// radarAnnotationOutageListResponseResultAnnotationsOutageJSON contains the JSON +// metadata for the struct +// [RadarAnnotationOutageListResponseResultAnnotationsOutage] +type radarAnnotationOutageListResponseResultAnnotationsOutageJSON struct { + OutageCause apijson.Field + OutageType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageListResponseResultAnnotationsOutage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageListParams struct { + // Single ASN as integer. + ASN param.Field[int64] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[time.Time] `query:"dateEnd" format:"date-time"` + // Shorthand date ranges for the last X days - use when you don't need specific + // start and end dates. + DateRange param.Field[RadarAnnotationOutageListParamsDateRange] `query:"dateRange"` + // Start of the date range (inclusive). + DateStart param.Field[time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAnnotationOutageListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Location Alpha2 code. + Location param.Field[string] `query:"location"` + // Number of objects to skip before grabbing results. + Offset param.Field[int64] `query:"offset"` +} + +// URLQuery serializes [RadarAnnotationOutageListParams]'s query parameters as +// `url.Values`. +func (r RadarAnnotationOutageListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Shorthand date ranges for the last X days - use when you don't need specific +// start and end dates. +type RadarAnnotationOutageListParamsDateRange string + +const ( + RadarAnnotationOutageListParamsDateRange1d RadarAnnotationOutageListParamsDateRange = "1d" + RadarAnnotationOutageListParamsDateRange2d RadarAnnotationOutageListParamsDateRange = "2d" + RadarAnnotationOutageListParamsDateRange7d RadarAnnotationOutageListParamsDateRange = "7d" + RadarAnnotationOutageListParamsDateRange14d RadarAnnotationOutageListParamsDateRange = "14d" + RadarAnnotationOutageListParamsDateRange28d RadarAnnotationOutageListParamsDateRange = "28d" + RadarAnnotationOutageListParamsDateRange12w RadarAnnotationOutageListParamsDateRange = "12w" + RadarAnnotationOutageListParamsDateRange24w RadarAnnotationOutageListParamsDateRange = "24w" + RadarAnnotationOutageListParamsDateRange52w RadarAnnotationOutageListParamsDateRange = "52w" + RadarAnnotationOutageListParamsDateRange1dControl RadarAnnotationOutageListParamsDateRange = "1dControl" + RadarAnnotationOutageListParamsDateRange2dControl RadarAnnotationOutageListParamsDateRange = "2dControl" + RadarAnnotationOutageListParamsDateRange7dControl RadarAnnotationOutageListParamsDateRange = "7dControl" + RadarAnnotationOutageListParamsDateRange14dControl RadarAnnotationOutageListParamsDateRange = "14dControl" + RadarAnnotationOutageListParamsDateRange28dControl RadarAnnotationOutageListParamsDateRange = "28dControl" + RadarAnnotationOutageListParamsDateRange12wControl RadarAnnotationOutageListParamsDateRange = "12wControl" + RadarAnnotationOutageListParamsDateRange24wControl RadarAnnotationOutageListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAnnotationOutageListParamsFormat string + +const ( + RadarAnnotationOutageListParamsFormatJson RadarAnnotationOutageListParamsFormat = "JSON" + RadarAnnotationOutageListParamsFormatCsv RadarAnnotationOutageListParamsFormat = "CSV" +) diff --git a/radarannotationoutage_test.go b/radarannotationoutage_test.go new file mode 100644 index 00000000000..c8bbd78a466 --- /dev/null +++ b/radarannotationoutage_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAnnotationOutageListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Annotations.Outages.List(context.TODO(), cloudflare.RadarAnnotationOutageListParams{ + ASN: cloudflare.F(int64(174)), + DateEnd: cloudflare.F(time.Now()), + DateRange: cloudflare.F(cloudflare.RadarAnnotationOutageListParamsDateRange7d), + DateStart: cloudflare.F(time.Now()), + Format: cloudflare.F(cloudflare.RadarAnnotationOutageListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F("US"), + Offset: cloudflare.F(int64(0)), + }) + 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/radarannotationoutagelocation.go b/radarannotationoutagelocation.go new file mode 100644 index 00000000000..339dd5a5a7a --- /dev/null +++ b/radarannotationoutagelocation.go @@ -0,0 +1,153 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAnnotationOutageLocationService 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 +// [NewRadarAnnotationOutageLocationService] method instead. +type RadarAnnotationOutageLocationService struct { + Options []option.RequestOption +} + +// NewRadarAnnotationOutageLocationService 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 NewRadarAnnotationOutageLocationService(opts ...option.RequestOption) (r *RadarAnnotationOutageLocationService) { + r = &RadarAnnotationOutageLocationService{} + r.Options = opts + return +} + +// Get the number of outages for locations. +func (r *RadarAnnotationOutageLocationService) List(ctx context.Context, query RadarAnnotationOutageLocationListParams, opts ...option.RequestOption) (res *RadarAnnotationOutageLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/annotations/outages/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAnnotationOutageLocationListResponse struct { + Result RadarAnnotationOutageLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAnnotationOutageLocationListResponseJSON `json:"-"` +} + +// radarAnnotationOutageLocationListResponseJSON contains the JSON metadata for the +// struct [RadarAnnotationOutageLocationListResponse] +type radarAnnotationOutageLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageLocationListResponseResult struct { + Annotations []RadarAnnotationOutageLocationListResponseResultAnnotation `json:"annotations,required"` + JSON radarAnnotationOutageLocationListResponseResultJSON `json:"-"` +} + +// radarAnnotationOutageLocationListResponseResultJSON contains the JSON metadata +// for the struct [RadarAnnotationOutageLocationListResponseResult] +type radarAnnotationOutageLocationListResponseResultJSON struct { + Annotations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageLocationListResponseResultAnnotation struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarAnnotationOutageLocationListResponseResultAnnotationJSON `json:"-"` +} + +// radarAnnotationOutageLocationListResponseResultAnnotationJSON contains the JSON +// metadata for the struct +// [RadarAnnotationOutageLocationListResponseResultAnnotation] +type radarAnnotationOutageLocationListResponseResultAnnotationJSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAnnotationOutageLocationListResponseResultAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAnnotationOutageLocationListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[time.Time] `query:"dateEnd" format:"date-time"` + // Shorthand date ranges for the last X days - use when you don't need specific + // start and end dates. + DateRange param.Field[RadarAnnotationOutageLocationListParamsDateRange] `query:"dateRange"` + // Start of the date range (inclusive). + DateStart param.Field[time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAnnotationOutageLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` +} + +// URLQuery serializes [RadarAnnotationOutageLocationListParams]'s query parameters +// as `url.Values`. +func (r RadarAnnotationOutageLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Shorthand date ranges for the last X days - use when you don't need specific +// start and end dates. +type RadarAnnotationOutageLocationListParamsDateRange string + +const ( + RadarAnnotationOutageLocationListParamsDateRange1d RadarAnnotationOutageLocationListParamsDateRange = "1d" + RadarAnnotationOutageLocationListParamsDateRange2d RadarAnnotationOutageLocationListParamsDateRange = "2d" + RadarAnnotationOutageLocationListParamsDateRange7d RadarAnnotationOutageLocationListParamsDateRange = "7d" + RadarAnnotationOutageLocationListParamsDateRange14d RadarAnnotationOutageLocationListParamsDateRange = "14d" + RadarAnnotationOutageLocationListParamsDateRange28d RadarAnnotationOutageLocationListParamsDateRange = "28d" + RadarAnnotationOutageLocationListParamsDateRange12w RadarAnnotationOutageLocationListParamsDateRange = "12w" + RadarAnnotationOutageLocationListParamsDateRange24w RadarAnnotationOutageLocationListParamsDateRange = "24w" + RadarAnnotationOutageLocationListParamsDateRange52w RadarAnnotationOutageLocationListParamsDateRange = "52w" + RadarAnnotationOutageLocationListParamsDateRange1dControl RadarAnnotationOutageLocationListParamsDateRange = "1dControl" + RadarAnnotationOutageLocationListParamsDateRange2dControl RadarAnnotationOutageLocationListParamsDateRange = "2dControl" + RadarAnnotationOutageLocationListParamsDateRange7dControl RadarAnnotationOutageLocationListParamsDateRange = "7dControl" + RadarAnnotationOutageLocationListParamsDateRange14dControl RadarAnnotationOutageLocationListParamsDateRange = "14dControl" + RadarAnnotationOutageLocationListParamsDateRange28dControl RadarAnnotationOutageLocationListParamsDateRange = "28dControl" + RadarAnnotationOutageLocationListParamsDateRange12wControl RadarAnnotationOutageLocationListParamsDateRange = "12wControl" + RadarAnnotationOutageLocationListParamsDateRange24wControl RadarAnnotationOutageLocationListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAnnotationOutageLocationListParamsFormat string + +const ( + RadarAnnotationOutageLocationListParamsFormatJson RadarAnnotationOutageLocationListParamsFormat = "JSON" + RadarAnnotationOutageLocationListParamsFormatCsv RadarAnnotationOutageLocationListParamsFormat = "CSV" +) diff --git a/radarannotationoutagelocation_test.go b/radarannotationoutagelocation_test.go new file mode 100644 index 00000000000..d78eb632b28 --- /dev/null +++ b/radarannotationoutagelocation_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAnnotationOutageLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Annotations.Outages.Locations.List(context.TODO(), cloudflare.RadarAnnotationOutageLocationListParams{ + DateEnd: cloudflare.F(time.Now()), + DateRange: cloudflare.F(cloudflare.RadarAnnotationOutageLocationListParamsDateRange7d), + DateStart: cloudflare.F(time.Now()), + Format: cloudflare.F(cloudflare.RadarAnnotationOutageLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + }) + 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/radaras112.go b/radaras112.go new file mode 100644 index 00000000000..f127dcc20f7 --- /dev/null +++ b/radaras112.go @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112Service 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 [NewRadarAs112Service] method instead. +type RadarAs112Service struct { + Options []option.RequestOption + Summaries *RadarAs112SummaryService + Timeseries *RadarAs112TimeseryService + Tops *RadarAs112TopService + TimeseriesGroups *RadarAs112TimeseriesGroupService +} + +// NewRadarAs112Service 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 NewRadarAs112Service(opts ...option.RequestOption) (r *RadarAs112Service) { + r = &RadarAs112Service{} + r.Options = opts + r.Summaries = NewRadarAs112SummaryService(opts...) + r.Timeseries = NewRadarAs112TimeseryService(opts...) + r.Tops = NewRadarAs112TopService(opts...) + r.TimeseriesGroups = NewRadarAs112TimeseriesGroupService(opts...) + return +} diff --git a/radaras112summary.go b/radaras112summary.go new file mode 100644 index 00000000000..148d7b2d717 --- /dev/null +++ b/radaras112summary.go @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112SummaryService 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 [NewRadarAs112SummaryService] method +// instead. +type RadarAs112SummaryService struct { + Options []option.RequestOption + Dnssecs *RadarAs112SummaryDnssecService + Edns *RadarAs112SummaryEdnService + IPVersions *RadarAs112SummaryIPVersionService + Protocols *RadarAs112SummaryProtocolService + QueryTypes *RadarAs112SummaryQueryTypeService + ResponseCodes *RadarAs112SummaryResponseCodeService +} + +// NewRadarAs112SummaryService 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 NewRadarAs112SummaryService(opts ...option.RequestOption) (r *RadarAs112SummaryService) { + r = &RadarAs112SummaryService{} + r.Options = opts + r.Dnssecs = NewRadarAs112SummaryDnssecService(opts...) + r.Edns = NewRadarAs112SummaryEdnService(opts...) + r.IPVersions = NewRadarAs112SummaryIPVersionService(opts...) + r.Protocols = NewRadarAs112SummaryProtocolService(opts...) + r.QueryTypes = NewRadarAs112SummaryQueryTypeService(opts...) + r.ResponseCodes = NewRadarAs112SummaryResponseCodeService(opts...) + return +} diff --git a/radaras112summarydnssec.go b/radaras112summarydnssec.go new file mode 100644 index 00000000000..82973198234 --- /dev/null +++ b/radaras112summarydnssec.go @@ -0,0 +1,253 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112SummaryDnssecService 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 +// [NewRadarAs112SummaryDnssecService] method instead. +type RadarAs112SummaryDnssecService struct { + Options []option.RequestOption +} + +// NewRadarAs112SummaryDnssecService 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 NewRadarAs112SummaryDnssecService(opts ...option.RequestOption) (r *RadarAs112SummaryDnssecService) { + r = &RadarAs112SummaryDnssecService{} + r.Options = opts + return +} + +// Percentage distribution of DNS queries to AS112 by DNSSEC support. +func (r *RadarAs112SummaryDnssecService) List(ctx context.Context, query RadarAs112SummaryDnssecListParams, opts ...option.RequestOption) (res *RadarAs112SummaryDnssecListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/summary/dnssec" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112SummaryDnssecListResponse struct { + Result RadarAs112SummaryDnssecListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112SummaryDnssecListResponseJSON `json:"-"` +} + +// radarAs112SummaryDnssecListResponseJSON contains the JSON metadata for the +// struct [RadarAs112SummaryDnssecListResponse] +type radarAs112SummaryDnssecListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryDnssecListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryDnssecListResponseResult struct { + Meta RadarAs112SummaryDnssecListResponseResultMeta `json:"meta,required"` + Summary0 RadarAs112SummaryDnssecListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAs112SummaryDnssecListResponseResultJSON `json:"-"` +} + +// radarAs112SummaryDnssecListResponseResultJSON contains the JSON metadata for the +// struct [RadarAs112SummaryDnssecListResponseResult] +type radarAs112SummaryDnssecListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryDnssecListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryDnssecListResponseResultMeta struct { + DateRange []RadarAs112SummaryDnssecListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112SummaryDnssecListResponseResultMetaJSON `json:"-"` +} + +// radarAs112SummaryDnssecListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarAs112SummaryDnssecListResponseResultMeta] +type radarAs112SummaryDnssecListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryDnssecListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryDnssecListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112SummaryDnssecListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112SummaryDnssecListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarAs112SummaryDnssecListResponseResultMetaDateRange] +type radarAs112SummaryDnssecListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryDnssecListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112SummaryDnssecListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112SummaryDnssecListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfo] +type radarAs112SummaryDnssecListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112SummaryDnssecListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112SummaryDnssecListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112SummaryDnssecListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryDnssecListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryDnssecListResponseResultSummary0 struct { + NotSupported string `json:"NOT_SUPPORTED,required"` + Supported string `json:"SUPPORTED,required"` + JSON radarAs112SummaryDnssecListResponseResultSummary0JSON `json:"-"` +} + +// radarAs112SummaryDnssecListResponseResultSummary0JSON contains the JSON metadata +// for the struct [RadarAs112SummaryDnssecListResponseResultSummary0] +type radarAs112SummaryDnssecListResponseResultSummary0JSON struct { + NotSupported apijson.Field + Supported apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryDnssecListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryDnssecListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112SummaryDnssecListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112SummaryDnssecListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112SummaryDnssecListParams]'s query parameters as +// `url.Values`. +func (r RadarAs112SummaryDnssecListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAs112SummaryDnssecListParamsDateRange string + +const ( + RadarAs112SummaryDnssecListParamsDateRange1d RadarAs112SummaryDnssecListParamsDateRange = "1d" + RadarAs112SummaryDnssecListParamsDateRange2d RadarAs112SummaryDnssecListParamsDateRange = "2d" + RadarAs112SummaryDnssecListParamsDateRange7d RadarAs112SummaryDnssecListParamsDateRange = "7d" + RadarAs112SummaryDnssecListParamsDateRange14d RadarAs112SummaryDnssecListParamsDateRange = "14d" + RadarAs112SummaryDnssecListParamsDateRange28d RadarAs112SummaryDnssecListParamsDateRange = "28d" + RadarAs112SummaryDnssecListParamsDateRange12w RadarAs112SummaryDnssecListParamsDateRange = "12w" + RadarAs112SummaryDnssecListParamsDateRange24w RadarAs112SummaryDnssecListParamsDateRange = "24w" + RadarAs112SummaryDnssecListParamsDateRange52w RadarAs112SummaryDnssecListParamsDateRange = "52w" + RadarAs112SummaryDnssecListParamsDateRange1dControl RadarAs112SummaryDnssecListParamsDateRange = "1dControl" + RadarAs112SummaryDnssecListParamsDateRange2dControl RadarAs112SummaryDnssecListParamsDateRange = "2dControl" + RadarAs112SummaryDnssecListParamsDateRange7dControl RadarAs112SummaryDnssecListParamsDateRange = "7dControl" + RadarAs112SummaryDnssecListParamsDateRange14dControl RadarAs112SummaryDnssecListParamsDateRange = "14dControl" + RadarAs112SummaryDnssecListParamsDateRange28dControl RadarAs112SummaryDnssecListParamsDateRange = "28dControl" + RadarAs112SummaryDnssecListParamsDateRange12wControl RadarAs112SummaryDnssecListParamsDateRange = "12wControl" + RadarAs112SummaryDnssecListParamsDateRange24wControl RadarAs112SummaryDnssecListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112SummaryDnssecListParamsFormat string + +const ( + RadarAs112SummaryDnssecListParamsFormatJson RadarAs112SummaryDnssecListParamsFormat = "JSON" + RadarAs112SummaryDnssecListParamsFormatCsv RadarAs112SummaryDnssecListParamsFormat = "CSV" +) diff --git a/radaras112summarydnssec_test.go b/radaras112summarydnssec_test.go new file mode 100644 index 00000000000..6dd97a8517f --- /dev/null +++ b/radaras112summarydnssec_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112SummaryDnssecListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Summaries.Dnssecs.List(context.TODO(), cloudflare.RadarAs112SummaryDnssecListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112SummaryDnssecListParamsDateRange{cloudflare.RadarAs112SummaryDnssecListParamsDateRange1d, cloudflare.RadarAs112SummaryDnssecListParamsDateRange2d, cloudflare.RadarAs112SummaryDnssecListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112SummaryDnssecListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112summaryedn.go b/radaras112summaryedn.go new file mode 100644 index 00000000000..89b54e918de --- /dev/null +++ b/radaras112summaryedn.go @@ -0,0 +1,253 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112SummaryEdnService 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 [NewRadarAs112SummaryEdnService] +// method instead. +type RadarAs112SummaryEdnService struct { + Options []option.RequestOption +} + +// NewRadarAs112SummaryEdnService 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 NewRadarAs112SummaryEdnService(opts ...option.RequestOption) (r *RadarAs112SummaryEdnService) { + r = &RadarAs112SummaryEdnService{} + r.Options = opts + return +} + +// Percentage distribution of DNS queries, to AS112, by EDNS support. +func (r *RadarAs112SummaryEdnService) List(ctx context.Context, query RadarAs112SummaryEdnListParams, opts ...option.RequestOption) (res *RadarAs112SummaryEdnListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/summary/edns" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112SummaryEdnListResponse struct { + Result RadarAs112SummaryEdnListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112SummaryEdnListResponseJSON `json:"-"` +} + +// radarAs112SummaryEdnListResponseJSON contains the JSON metadata for the struct +// [RadarAs112SummaryEdnListResponse] +type radarAs112SummaryEdnListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryEdnListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryEdnListResponseResult struct { + Meta RadarAs112SummaryEdnListResponseResultMeta `json:"meta,required"` + Summary0 RadarAs112SummaryEdnListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAs112SummaryEdnListResponseResultJSON `json:"-"` +} + +// radarAs112SummaryEdnListResponseResultJSON contains the JSON metadata for the +// struct [RadarAs112SummaryEdnListResponseResult] +type radarAs112SummaryEdnListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryEdnListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryEdnListResponseResultMeta struct { + DateRange []RadarAs112SummaryEdnListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAs112SummaryEdnListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112SummaryEdnListResponseResultMetaJSON `json:"-"` +} + +// radarAs112SummaryEdnListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarAs112SummaryEdnListResponseResultMeta] +type radarAs112SummaryEdnListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryEdnListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryEdnListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112SummaryEdnListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112SummaryEdnListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarAs112SummaryEdnListResponseResultMetaDateRange] +type radarAs112SummaryEdnListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryEdnListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryEdnListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112SummaryEdnListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112SummaryEdnListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112SummaryEdnListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarAs112SummaryEdnListResponseResultMetaConfidenceInfo] +type radarAs112SummaryEdnListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryEdnListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryEdnListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112SummaryEdnListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112SummaryEdnListResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarAs112SummaryEdnListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112SummaryEdnListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryEdnListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryEdnListResponseResultSummary0 struct { + NotSupported string `json:"NOT_SUPPORTED,required"` + Supported string `json:"SUPPORTED,required"` + JSON radarAs112SummaryEdnListResponseResultSummary0JSON `json:"-"` +} + +// radarAs112SummaryEdnListResponseResultSummary0JSON contains the JSON metadata +// for the struct [RadarAs112SummaryEdnListResponseResultSummary0] +type radarAs112SummaryEdnListResponseResultSummary0JSON struct { + NotSupported apijson.Field + Supported apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryEdnListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryEdnListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112SummaryEdnListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112SummaryEdnListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112SummaryEdnListParams]'s query parameters as +// `url.Values`. +func (r RadarAs112SummaryEdnListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAs112SummaryEdnListParamsDateRange string + +const ( + RadarAs112SummaryEdnListParamsDateRange1d RadarAs112SummaryEdnListParamsDateRange = "1d" + RadarAs112SummaryEdnListParamsDateRange2d RadarAs112SummaryEdnListParamsDateRange = "2d" + RadarAs112SummaryEdnListParamsDateRange7d RadarAs112SummaryEdnListParamsDateRange = "7d" + RadarAs112SummaryEdnListParamsDateRange14d RadarAs112SummaryEdnListParamsDateRange = "14d" + RadarAs112SummaryEdnListParamsDateRange28d RadarAs112SummaryEdnListParamsDateRange = "28d" + RadarAs112SummaryEdnListParamsDateRange12w RadarAs112SummaryEdnListParamsDateRange = "12w" + RadarAs112SummaryEdnListParamsDateRange24w RadarAs112SummaryEdnListParamsDateRange = "24w" + RadarAs112SummaryEdnListParamsDateRange52w RadarAs112SummaryEdnListParamsDateRange = "52w" + RadarAs112SummaryEdnListParamsDateRange1dControl RadarAs112SummaryEdnListParamsDateRange = "1dControl" + RadarAs112SummaryEdnListParamsDateRange2dControl RadarAs112SummaryEdnListParamsDateRange = "2dControl" + RadarAs112SummaryEdnListParamsDateRange7dControl RadarAs112SummaryEdnListParamsDateRange = "7dControl" + RadarAs112SummaryEdnListParamsDateRange14dControl RadarAs112SummaryEdnListParamsDateRange = "14dControl" + RadarAs112SummaryEdnListParamsDateRange28dControl RadarAs112SummaryEdnListParamsDateRange = "28dControl" + RadarAs112SummaryEdnListParamsDateRange12wControl RadarAs112SummaryEdnListParamsDateRange = "12wControl" + RadarAs112SummaryEdnListParamsDateRange24wControl RadarAs112SummaryEdnListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112SummaryEdnListParamsFormat string + +const ( + RadarAs112SummaryEdnListParamsFormatJson RadarAs112SummaryEdnListParamsFormat = "JSON" + RadarAs112SummaryEdnListParamsFormatCsv RadarAs112SummaryEdnListParamsFormat = "CSV" +) diff --git a/radaras112summaryedn_test.go b/radaras112summaryedn_test.go new file mode 100644 index 00000000000..0e4404c53a8 --- /dev/null +++ b/radaras112summaryedn_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112SummaryEdnListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Summaries.Edns.List(context.TODO(), cloudflare.RadarAs112SummaryEdnListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112SummaryEdnListParamsDateRange{cloudflare.RadarAs112SummaryEdnListParamsDateRange1d, cloudflare.RadarAs112SummaryEdnListParamsDateRange2d, cloudflare.RadarAs112SummaryEdnListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112SummaryEdnListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112summaryipversion.go b/radaras112summaryipversion.go new file mode 100644 index 00000000000..04e97acb4fe --- /dev/null +++ b/radaras112summaryipversion.go @@ -0,0 +1,254 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112SummaryIPVersionService 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 +// [NewRadarAs112SummaryIPVersionService] method instead. +type RadarAs112SummaryIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAs112SummaryIPVersionService 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 NewRadarAs112SummaryIPVersionService(opts ...option.RequestOption) (r *RadarAs112SummaryIPVersionService) { + r = &RadarAs112SummaryIPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of DNS queries to AS112 per IP Version. +func (r *RadarAs112SummaryIPVersionService) List(ctx context.Context, query RadarAs112SummaryIPVersionListParams, opts ...option.RequestOption) (res *RadarAs112SummaryIPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/summary/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112SummaryIPVersionListResponse struct { + Result RadarAs112SummaryIPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112SummaryIPVersionListResponseJSON `json:"-"` +} + +// radarAs112SummaryIPVersionListResponseJSON contains the JSON metadata for the +// struct [RadarAs112SummaryIPVersionListResponse] +type radarAs112SummaryIPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryIPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryIPVersionListResponseResult struct { + Meta RadarAs112SummaryIPVersionListResponseResultMeta `json:"meta,required"` + Summary0 RadarAs112SummaryIPVersionListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAs112SummaryIPVersionListResponseResultJSON `json:"-"` +} + +// radarAs112SummaryIPVersionListResponseResultJSON contains the JSON metadata for +// the struct [RadarAs112SummaryIPVersionListResponseResult] +type radarAs112SummaryIPVersionListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryIPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryIPVersionListResponseResultMeta struct { + DateRange []RadarAs112SummaryIPVersionListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112SummaryIPVersionListResponseResultMetaJSON `json:"-"` +} + +// radarAs112SummaryIPVersionListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAs112SummaryIPVersionListResponseResultMeta] +type radarAs112SummaryIPVersionListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryIPVersionListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryIPVersionListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112SummaryIPVersionListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112SummaryIPVersionListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAs112SummaryIPVersionListResponseResultMetaDateRange] +type radarAs112SummaryIPVersionListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryIPVersionListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfo] +type radarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryIPVersionListResponseResultSummary0 struct { + IPv4 string `json:"IPv4,required"` + IPv6 string `json:"IPv6,required"` + JSON radarAs112SummaryIPVersionListResponseResultSummary0JSON `json:"-"` +} + +// radarAs112SummaryIPVersionListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarAs112SummaryIPVersionListResponseResultSummary0] +type radarAs112SummaryIPVersionListResponseResultSummary0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryIPVersionListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryIPVersionListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112SummaryIPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112SummaryIPVersionListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112SummaryIPVersionListParams]'s query parameters as +// `url.Values`. +func (r RadarAs112SummaryIPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAs112SummaryIPVersionListParamsDateRange string + +const ( + RadarAs112SummaryIPVersionListParamsDateRange1d RadarAs112SummaryIPVersionListParamsDateRange = "1d" + RadarAs112SummaryIPVersionListParamsDateRange2d RadarAs112SummaryIPVersionListParamsDateRange = "2d" + RadarAs112SummaryIPVersionListParamsDateRange7d RadarAs112SummaryIPVersionListParamsDateRange = "7d" + RadarAs112SummaryIPVersionListParamsDateRange14d RadarAs112SummaryIPVersionListParamsDateRange = "14d" + RadarAs112SummaryIPVersionListParamsDateRange28d RadarAs112SummaryIPVersionListParamsDateRange = "28d" + RadarAs112SummaryIPVersionListParamsDateRange12w RadarAs112SummaryIPVersionListParamsDateRange = "12w" + RadarAs112SummaryIPVersionListParamsDateRange24w RadarAs112SummaryIPVersionListParamsDateRange = "24w" + RadarAs112SummaryIPVersionListParamsDateRange52w RadarAs112SummaryIPVersionListParamsDateRange = "52w" + RadarAs112SummaryIPVersionListParamsDateRange1dControl RadarAs112SummaryIPVersionListParamsDateRange = "1dControl" + RadarAs112SummaryIPVersionListParamsDateRange2dControl RadarAs112SummaryIPVersionListParamsDateRange = "2dControl" + RadarAs112SummaryIPVersionListParamsDateRange7dControl RadarAs112SummaryIPVersionListParamsDateRange = "7dControl" + RadarAs112SummaryIPVersionListParamsDateRange14dControl RadarAs112SummaryIPVersionListParamsDateRange = "14dControl" + RadarAs112SummaryIPVersionListParamsDateRange28dControl RadarAs112SummaryIPVersionListParamsDateRange = "28dControl" + RadarAs112SummaryIPVersionListParamsDateRange12wControl RadarAs112SummaryIPVersionListParamsDateRange = "12wControl" + RadarAs112SummaryIPVersionListParamsDateRange24wControl RadarAs112SummaryIPVersionListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112SummaryIPVersionListParamsFormat string + +const ( + RadarAs112SummaryIPVersionListParamsFormatJson RadarAs112SummaryIPVersionListParamsFormat = "JSON" + RadarAs112SummaryIPVersionListParamsFormatCsv RadarAs112SummaryIPVersionListParamsFormat = "CSV" +) diff --git a/radaras112summaryipversion_test.go b/radaras112summaryipversion_test.go new file mode 100644 index 00000000000..fef227f1361 --- /dev/null +++ b/radaras112summaryipversion_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112SummaryIPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Summaries.IPVersions.List(context.TODO(), cloudflare.RadarAs112SummaryIPVersionListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112SummaryIPVersionListParamsDateRange{cloudflare.RadarAs112SummaryIPVersionListParamsDateRange1d, cloudflare.RadarAs112SummaryIPVersionListParamsDateRange2d, cloudflare.RadarAs112SummaryIPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112SummaryIPVersionListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112summaryprotocol.go b/radaras112summaryprotocol.go new file mode 100644 index 00000000000..bb07273ec2c --- /dev/null +++ b/radaras112summaryprotocol.go @@ -0,0 +1,254 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112SummaryProtocolService 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 +// [NewRadarAs112SummaryProtocolService] method instead. +type RadarAs112SummaryProtocolService struct { + Options []option.RequestOption +} + +// NewRadarAs112SummaryProtocolService 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 NewRadarAs112SummaryProtocolService(opts ...option.RequestOption) (r *RadarAs112SummaryProtocolService) { + r = &RadarAs112SummaryProtocolService{} + r.Options = opts + return +} + +// Percentage distribution of DNS queries to AS112 per protocol. +func (r *RadarAs112SummaryProtocolService) List(ctx context.Context, query RadarAs112SummaryProtocolListParams, opts ...option.RequestOption) (res *RadarAs112SummaryProtocolListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/summary/protocol" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112SummaryProtocolListResponse struct { + Result RadarAs112SummaryProtocolListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112SummaryProtocolListResponseJSON `json:"-"` +} + +// radarAs112SummaryProtocolListResponseJSON contains the JSON metadata for the +// struct [RadarAs112SummaryProtocolListResponse] +type radarAs112SummaryProtocolListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryProtocolListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryProtocolListResponseResult struct { + Meta RadarAs112SummaryProtocolListResponseResultMeta `json:"meta,required"` + Summary0 RadarAs112SummaryProtocolListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAs112SummaryProtocolListResponseResultJSON `json:"-"` +} + +// radarAs112SummaryProtocolListResponseResultJSON contains the JSON metadata for +// the struct [RadarAs112SummaryProtocolListResponseResult] +type radarAs112SummaryProtocolListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryProtocolListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryProtocolListResponseResultMeta struct { + DateRange []RadarAs112SummaryProtocolListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112SummaryProtocolListResponseResultMetaJSON `json:"-"` +} + +// radarAs112SummaryProtocolListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAs112SummaryProtocolListResponseResultMeta] +type radarAs112SummaryProtocolListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryProtocolListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryProtocolListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112SummaryProtocolListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112SummaryProtocolListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAs112SummaryProtocolListResponseResultMetaDateRange] +type radarAs112SummaryProtocolListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryProtocolListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112SummaryProtocolListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112SummaryProtocolListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfo] +type radarAs112SummaryProtocolListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112SummaryProtocolListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112SummaryProtocolListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112SummaryProtocolListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryProtocolListResponseResultSummary0 struct { + Tcp string `json:"tcp,required"` + Udp string `json:"udp,required"` + JSON radarAs112SummaryProtocolListResponseResultSummary0JSON `json:"-"` +} + +// radarAs112SummaryProtocolListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarAs112SummaryProtocolListResponseResultSummary0] +type radarAs112SummaryProtocolListResponseResultSummary0JSON struct { + Tcp apijson.Field + Udp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryProtocolListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryProtocolListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112SummaryProtocolListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112SummaryProtocolListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112SummaryProtocolListParams]'s query parameters as +// `url.Values`. +func (r RadarAs112SummaryProtocolListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAs112SummaryProtocolListParamsDateRange string + +const ( + RadarAs112SummaryProtocolListParamsDateRange1d RadarAs112SummaryProtocolListParamsDateRange = "1d" + RadarAs112SummaryProtocolListParamsDateRange2d RadarAs112SummaryProtocolListParamsDateRange = "2d" + RadarAs112SummaryProtocolListParamsDateRange7d RadarAs112SummaryProtocolListParamsDateRange = "7d" + RadarAs112SummaryProtocolListParamsDateRange14d RadarAs112SummaryProtocolListParamsDateRange = "14d" + RadarAs112SummaryProtocolListParamsDateRange28d RadarAs112SummaryProtocolListParamsDateRange = "28d" + RadarAs112SummaryProtocolListParamsDateRange12w RadarAs112SummaryProtocolListParamsDateRange = "12w" + RadarAs112SummaryProtocolListParamsDateRange24w RadarAs112SummaryProtocolListParamsDateRange = "24w" + RadarAs112SummaryProtocolListParamsDateRange52w RadarAs112SummaryProtocolListParamsDateRange = "52w" + RadarAs112SummaryProtocolListParamsDateRange1dControl RadarAs112SummaryProtocolListParamsDateRange = "1dControl" + RadarAs112SummaryProtocolListParamsDateRange2dControl RadarAs112SummaryProtocolListParamsDateRange = "2dControl" + RadarAs112SummaryProtocolListParamsDateRange7dControl RadarAs112SummaryProtocolListParamsDateRange = "7dControl" + RadarAs112SummaryProtocolListParamsDateRange14dControl RadarAs112SummaryProtocolListParamsDateRange = "14dControl" + RadarAs112SummaryProtocolListParamsDateRange28dControl RadarAs112SummaryProtocolListParamsDateRange = "28dControl" + RadarAs112SummaryProtocolListParamsDateRange12wControl RadarAs112SummaryProtocolListParamsDateRange = "12wControl" + RadarAs112SummaryProtocolListParamsDateRange24wControl RadarAs112SummaryProtocolListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112SummaryProtocolListParamsFormat string + +const ( + RadarAs112SummaryProtocolListParamsFormatJson RadarAs112SummaryProtocolListParamsFormat = "JSON" + RadarAs112SummaryProtocolListParamsFormatCsv RadarAs112SummaryProtocolListParamsFormat = "CSV" +) diff --git a/radaras112summaryprotocol_test.go b/radaras112summaryprotocol_test.go new file mode 100644 index 00000000000..14645305ffa --- /dev/null +++ b/radaras112summaryprotocol_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112SummaryProtocolListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Summaries.Protocols.List(context.TODO(), cloudflare.RadarAs112SummaryProtocolListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112SummaryProtocolListParamsDateRange{cloudflare.RadarAs112SummaryProtocolListParamsDateRange1d, cloudflare.RadarAs112SummaryProtocolListParamsDateRange2d, cloudflare.RadarAs112SummaryProtocolListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112SummaryProtocolListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112summaryquerytype.go b/radaras112summaryquerytype.go new file mode 100644 index 00000000000..f84cc338dab --- /dev/null +++ b/radaras112summaryquerytype.go @@ -0,0 +1,260 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112SummaryQueryTypeService 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 +// [NewRadarAs112SummaryQueryTypeService] method instead. +type RadarAs112SummaryQueryTypeService struct { + Options []option.RequestOption +} + +// NewRadarAs112SummaryQueryTypeService 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 NewRadarAs112SummaryQueryTypeService(opts ...option.RequestOption) (r *RadarAs112SummaryQueryTypeService) { + r = &RadarAs112SummaryQueryTypeService{} + r.Options = opts + return +} + +// Percentage distribution of DNS queries to AS112 by Query Type. +func (r *RadarAs112SummaryQueryTypeService) List(ctx context.Context, query RadarAs112SummaryQueryTypeListParams, opts ...option.RequestOption) (res *RadarAs112SummaryQueryTypeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/summary/query_type" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112SummaryQueryTypeListResponse struct { + Result RadarAs112SummaryQueryTypeListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112SummaryQueryTypeListResponseJSON `json:"-"` +} + +// radarAs112SummaryQueryTypeListResponseJSON contains the JSON metadata for the +// struct [RadarAs112SummaryQueryTypeListResponse] +type radarAs112SummaryQueryTypeListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryQueryTypeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryQueryTypeListResponseResult struct { + Meta RadarAs112SummaryQueryTypeListResponseResultMeta `json:"meta,required"` + Summary0 RadarAs112SummaryQueryTypeListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAs112SummaryQueryTypeListResponseResultJSON `json:"-"` +} + +// radarAs112SummaryQueryTypeListResponseResultJSON contains the JSON metadata for +// the struct [RadarAs112SummaryQueryTypeListResponseResult] +type radarAs112SummaryQueryTypeListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryQueryTypeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryQueryTypeListResponseResultMeta struct { + DateRange []RadarAs112SummaryQueryTypeListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112SummaryQueryTypeListResponseResultMetaJSON `json:"-"` +} + +// radarAs112SummaryQueryTypeListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAs112SummaryQueryTypeListResponseResultMeta] +type radarAs112SummaryQueryTypeListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryQueryTypeListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryQueryTypeListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112SummaryQueryTypeListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112SummaryQueryTypeListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAs112SummaryQueryTypeListResponseResultMetaDateRange] +type radarAs112SummaryQueryTypeListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryQueryTypeListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfo] +type radarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryQueryTypeListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryQueryTypeListResponseResultSummary0 struct { + A string `json:"A,required"` + Aaaa string `json:"AAAA,required"` + Ptr string `json:"PTR,required"` + Soa string `json:"SOA,required"` + Srv string `json:"SRV,required"` + JSON radarAs112SummaryQueryTypeListResponseResultSummary0JSON `json:"-"` +} + +// radarAs112SummaryQueryTypeListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarAs112SummaryQueryTypeListResponseResultSummary0] +type radarAs112SummaryQueryTypeListResponseResultSummary0JSON struct { + A apijson.Field + Aaaa apijson.Field + Ptr apijson.Field + Soa apijson.Field + Srv apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryQueryTypeListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryQueryTypeListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112SummaryQueryTypeListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112SummaryQueryTypeListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112SummaryQueryTypeListParams]'s query parameters as +// `url.Values`. +func (r RadarAs112SummaryQueryTypeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAs112SummaryQueryTypeListParamsDateRange string + +const ( + RadarAs112SummaryQueryTypeListParamsDateRange1d RadarAs112SummaryQueryTypeListParamsDateRange = "1d" + RadarAs112SummaryQueryTypeListParamsDateRange2d RadarAs112SummaryQueryTypeListParamsDateRange = "2d" + RadarAs112SummaryQueryTypeListParamsDateRange7d RadarAs112SummaryQueryTypeListParamsDateRange = "7d" + RadarAs112SummaryQueryTypeListParamsDateRange14d RadarAs112SummaryQueryTypeListParamsDateRange = "14d" + RadarAs112SummaryQueryTypeListParamsDateRange28d RadarAs112SummaryQueryTypeListParamsDateRange = "28d" + RadarAs112SummaryQueryTypeListParamsDateRange12w RadarAs112SummaryQueryTypeListParamsDateRange = "12w" + RadarAs112SummaryQueryTypeListParamsDateRange24w RadarAs112SummaryQueryTypeListParamsDateRange = "24w" + RadarAs112SummaryQueryTypeListParamsDateRange52w RadarAs112SummaryQueryTypeListParamsDateRange = "52w" + RadarAs112SummaryQueryTypeListParamsDateRange1dControl RadarAs112SummaryQueryTypeListParamsDateRange = "1dControl" + RadarAs112SummaryQueryTypeListParamsDateRange2dControl RadarAs112SummaryQueryTypeListParamsDateRange = "2dControl" + RadarAs112SummaryQueryTypeListParamsDateRange7dControl RadarAs112SummaryQueryTypeListParamsDateRange = "7dControl" + RadarAs112SummaryQueryTypeListParamsDateRange14dControl RadarAs112SummaryQueryTypeListParamsDateRange = "14dControl" + RadarAs112SummaryQueryTypeListParamsDateRange28dControl RadarAs112SummaryQueryTypeListParamsDateRange = "28dControl" + RadarAs112SummaryQueryTypeListParamsDateRange12wControl RadarAs112SummaryQueryTypeListParamsDateRange = "12wControl" + RadarAs112SummaryQueryTypeListParamsDateRange24wControl RadarAs112SummaryQueryTypeListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112SummaryQueryTypeListParamsFormat string + +const ( + RadarAs112SummaryQueryTypeListParamsFormatJson RadarAs112SummaryQueryTypeListParamsFormat = "JSON" + RadarAs112SummaryQueryTypeListParamsFormatCsv RadarAs112SummaryQueryTypeListParamsFormat = "CSV" +) diff --git a/radaras112summaryquerytype_test.go b/radaras112summaryquerytype_test.go new file mode 100644 index 00000000000..13467e49281 --- /dev/null +++ b/radaras112summaryquerytype_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112SummaryQueryTypeListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Summaries.QueryTypes.List(context.TODO(), cloudflare.RadarAs112SummaryQueryTypeListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112SummaryQueryTypeListParamsDateRange{cloudflare.RadarAs112SummaryQueryTypeListParamsDateRange1d, cloudflare.RadarAs112SummaryQueryTypeListParamsDateRange2d, cloudflare.RadarAs112SummaryQueryTypeListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112SummaryQueryTypeListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112summaryresponsecode.go b/radaras112summaryresponsecode.go new file mode 100644 index 00000000000..5d69241c2dd --- /dev/null +++ b/radaras112summaryresponsecode.go @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112SummaryResponseCodeService 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 +// [NewRadarAs112SummaryResponseCodeService] method instead. +type RadarAs112SummaryResponseCodeService struct { + Options []option.RequestOption +} + +// NewRadarAs112SummaryResponseCodeService 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 NewRadarAs112SummaryResponseCodeService(opts ...option.RequestOption) (r *RadarAs112SummaryResponseCodeService) { + r = &RadarAs112SummaryResponseCodeService{} + r.Options = opts + return +} + +// Percentage distribution of AS112 dns requests classified per Response Codes. +func (r *RadarAs112SummaryResponseCodeService) List(ctx context.Context, query RadarAs112SummaryResponseCodeListParams, opts ...option.RequestOption) (res *RadarAs112SummaryResponseCodeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/summary/response_codes" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112SummaryResponseCodeListResponse struct { + Result RadarAs112SummaryResponseCodeListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112SummaryResponseCodeListResponseJSON `json:"-"` +} + +// radarAs112SummaryResponseCodeListResponseJSON contains the JSON metadata for the +// struct [RadarAs112SummaryResponseCodeListResponse] +type radarAs112SummaryResponseCodeListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryResponseCodeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryResponseCodeListResponseResult struct { + Meta RadarAs112SummaryResponseCodeListResponseResultMeta `json:"meta,required"` + Summary0 RadarAs112SummaryResponseCodeListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAs112SummaryResponseCodeListResponseResultJSON `json:"-"` +} + +// radarAs112SummaryResponseCodeListResponseResultJSON contains the JSON metadata +// for the struct [RadarAs112SummaryResponseCodeListResponseResult] +type radarAs112SummaryResponseCodeListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryResponseCodeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryResponseCodeListResponseResultMeta struct { + DateRange []RadarAs112SummaryResponseCodeListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112SummaryResponseCodeListResponseResultMetaJSON `json:"-"` +} + +// radarAs112SummaryResponseCodeListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAs112SummaryResponseCodeListResponseResultMeta] +type radarAs112SummaryResponseCodeListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryResponseCodeListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryResponseCodeListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112SummaryResponseCodeListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112SummaryResponseCodeListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAs112SummaryResponseCodeListResponseResultMetaDateRange] +type radarAs112SummaryResponseCodeListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryResponseCodeListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfo] +type radarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryResponseCodeListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryResponseCodeListResponseResultSummary0 struct { + Noerror string `json:"NOERROR,required"` + Nxdomain string `json:"NXDOMAIN,required"` + JSON radarAs112SummaryResponseCodeListResponseResultSummary0JSON `json:"-"` +} + +// radarAs112SummaryResponseCodeListResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarAs112SummaryResponseCodeListResponseResultSummary0] +type radarAs112SummaryResponseCodeListResponseResultSummary0JSON struct { + Noerror apijson.Field + Nxdomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112SummaryResponseCodeListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112SummaryResponseCodeListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112SummaryResponseCodeListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112SummaryResponseCodeListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112SummaryResponseCodeListParams]'s query parameters +// as `url.Values`. +func (r RadarAs112SummaryResponseCodeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAs112SummaryResponseCodeListParamsDateRange string + +const ( + RadarAs112SummaryResponseCodeListParamsDateRange1d RadarAs112SummaryResponseCodeListParamsDateRange = "1d" + RadarAs112SummaryResponseCodeListParamsDateRange2d RadarAs112SummaryResponseCodeListParamsDateRange = "2d" + RadarAs112SummaryResponseCodeListParamsDateRange7d RadarAs112SummaryResponseCodeListParamsDateRange = "7d" + RadarAs112SummaryResponseCodeListParamsDateRange14d RadarAs112SummaryResponseCodeListParamsDateRange = "14d" + RadarAs112SummaryResponseCodeListParamsDateRange28d RadarAs112SummaryResponseCodeListParamsDateRange = "28d" + RadarAs112SummaryResponseCodeListParamsDateRange12w RadarAs112SummaryResponseCodeListParamsDateRange = "12w" + RadarAs112SummaryResponseCodeListParamsDateRange24w RadarAs112SummaryResponseCodeListParamsDateRange = "24w" + RadarAs112SummaryResponseCodeListParamsDateRange52w RadarAs112SummaryResponseCodeListParamsDateRange = "52w" + RadarAs112SummaryResponseCodeListParamsDateRange1dControl RadarAs112SummaryResponseCodeListParamsDateRange = "1dControl" + RadarAs112SummaryResponseCodeListParamsDateRange2dControl RadarAs112SummaryResponseCodeListParamsDateRange = "2dControl" + RadarAs112SummaryResponseCodeListParamsDateRange7dControl RadarAs112SummaryResponseCodeListParamsDateRange = "7dControl" + RadarAs112SummaryResponseCodeListParamsDateRange14dControl RadarAs112SummaryResponseCodeListParamsDateRange = "14dControl" + RadarAs112SummaryResponseCodeListParamsDateRange28dControl RadarAs112SummaryResponseCodeListParamsDateRange = "28dControl" + RadarAs112SummaryResponseCodeListParamsDateRange12wControl RadarAs112SummaryResponseCodeListParamsDateRange = "12wControl" + RadarAs112SummaryResponseCodeListParamsDateRange24wControl RadarAs112SummaryResponseCodeListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112SummaryResponseCodeListParamsFormat string + +const ( + RadarAs112SummaryResponseCodeListParamsFormatJson RadarAs112SummaryResponseCodeListParamsFormat = "JSON" + RadarAs112SummaryResponseCodeListParamsFormatCsv RadarAs112SummaryResponseCodeListParamsFormat = "CSV" +) diff --git a/radaras112summaryresponsecode_test.go b/radaras112summaryresponsecode_test.go new file mode 100644 index 00000000000..e0eabab51cb --- /dev/null +++ b/radaras112summaryresponsecode_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112SummaryResponseCodeListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Summaries.ResponseCodes.List(context.TODO(), cloudflare.RadarAs112SummaryResponseCodeListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112SummaryResponseCodeListParamsDateRange{cloudflare.RadarAs112SummaryResponseCodeListParamsDateRange1d, cloudflare.RadarAs112SummaryResponseCodeListParamsDateRange2d, cloudflare.RadarAs112SummaryResponseCodeListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112SummaryResponseCodeListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112timeseriesgroup.go b/radaras112timeseriesgroup.go new file mode 100644 index 00000000000..b6e3eca2767 --- /dev/null +++ b/radaras112timeseriesgroup.go @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseriesGroupService 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 +// [NewRadarAs112TimeseriesGroupService] method instead. +type RadarAs112TimeseriesGroupService struct { + Options []option.RequestOption + Dnssec *RadarAs112TimeseriesGroupDnssecService + Edns *RadarAs112TimeseriesGroupEdnService + IPVersion *RadarAs112TimeseriesGroupIPVersionService + Protocol *RadarAs112TimeseriesGroupProtocolService + QueryType *RadarAs112TimeseriesGroupQueryTypeService + ResponseCodes *RadarAs112TimeseriesGroupResponseCodeService +} + +// NewRadarAs112TimeseriesGroupService 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 NewRadarAs112TimeseriesGroupService(opts ...option.RequestOption) (r *RadarAs112TimeseriesGroupService) { + r = &RadarAs112TimeseriesGroupService{} + r.Options = opts + r.Dnssec = NewRadarAs112TimeseriesGroupDnssecService(opts...) + r.Edns = NewRadarAs112TimeseriesGroupEdnService(opts...) + r.IPVersion = NewRadarAs112TimeseriesGroupIPVersionService(opts...) + r.Protocol = NewRadarAs112TimeseriesGroupProtocolService(opts...) + r.QueryType = NewRadarAs112TimeseriesGroupQueryTypeService(opts...) + r.ResponseCodes = NewRadarAs112TimeseriesGroupResponseCodeService(opts...) + return +} diff --git a/radaras112timeseriesgroupdnssec.go b/radaras112timeseriesgroupdnssec.go new file mode 100644 index 00000000000..3636f292c35 --- /dev/null +++ b/radaras112timeseriesgroupdnssec.go @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseriesGroupDnssecService 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 +// [NewRadarAs112TimeseriesGroupDnssecService] method instead. +type RadarAs112TimeseriesGroupDnssecService struct { + Options []option.RequestOption +} + +// NewRadarAs112TimeseriesGroupDnssecService 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 NewRadarAs112TimeseriesGroupDnssecService(opts ...option.RequestOption) (r *RadarAs112TimeseriesGroupDnssecService) { + r = &RadarAs112TimeseriesGroupDnssecService{} + r.Options = opts + return +} + +// Percentage distribution of DNS AS112 queries by DNSSEC support over time. +func (r *RadarAs112TimeseriesGroupDnssecService) Get(ctx context.Context, query RadarAs112TimeseriesGroupDnssecGetParams, opts ...option.RequestOption) (res *RadarAs112TimeseriesGroupDnssecGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/timeseries_groups/dnssec" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TimeseriesGroupDnssecGetResponse struct { + Result RadarAs112TimeseriesGroupDnssecGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TimeseriesGroupDnssecGetResponseJSON `json:"-"` +} + +// radarAs112TimeseriesGroupDnssecGetResponseJSON contains the JSON metadata for +// the struct [RadarAs112TimeseriesGroupDnssecGetResponse] +type radarAs112TimeseriesGroupDnssecGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupDnssecGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupDnssecGetResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAs112TimeseriesGroupDnssecGetResponseResultSerie0 `json:"serie_0,required"` + JSON radarAs112TimeseriesGroupDnssecGetResponseResultJSON `json:"-"` +} + +// radarAs112TimeseriesGroupDnssecGetResponseResultJSON contains the JSON metadata +// for the struct [RadarAs112TimeseriesGroupDnssecGetResponseResult] +type radarAs112TimeseriesGroupDnssecGetResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupDnssecGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupDnssecGetResponseResultSerie0 struct { + NotSupported []string `json:"NOT_SUPPORTED,required"` + Supported []string `json:"SUPPORTED,required"` + JSON radarAs112TimeseriesGroupDnssecGetResponseResultSerie0JSON `json:"-"` +} + +// radarAs112TimeseriesGroupDnssecGetResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarAs112TimeseriesGroupDnssecGetResponseResultSerie0] +type radarAs112TimeseriesGroupDnssecGetResponseResultSerie0JSON struct { + NotSupported apijson.Field + Supported apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupDnssecGetResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupDnssecGetParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAs112TimeseriesGroupDnssecGetParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TimeseriesGroupDnssecGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TimeseriesGroupDnssecGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TimeseriesGroupDnssecGetParams]'s query +// parameters as `url.Values`. +func (r RadarAs112TimeseriesGroupDnssecGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAs112TimeseriesGroupDnssecGetParamsAggInterval string + +const ( + RadarAs112TimeseriesGroupDnssecGetParamsAggInterval15m RadarAs112TimeseriesGroupDnssecGetParamsAggInterval = "15m" + RadarAs112TimeseriesGroupDnssecGetParamsAggInterval1h RadarAs112TimeseriesGroupDnssecGetParamsAggInterval = "1h" + RadarAs112TimeseriesGroupDnssecGetParamsAggInterval1d RadarAs112TimeseriesGroupDnssecGetParamsAggInterval = "1d" + RadarAs112TimeseriesGroupDnssecGetParamsAggInterval1w RadarAs112TimeseriesGroupDnssecGetParamsAggInterval = "1w" +) + +type RadarAs112TimeseriesGroupDnssecGetParamsDateRange string + +const ( + RadarAs112TimeseriesGroupDnssecGetParamsDateRange1d RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "1d" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange2d RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "2d" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange7d RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "7d" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange14d RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "14d" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange28d RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "28d" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange12w RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "12w" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange24w RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "24w" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange52w RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "52w" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange1dControl RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "1dControl" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange2dControl RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "2dControl" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange7dControl RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "7dControl" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange14dControl RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "14dControl" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange28dControl RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "28dControl" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange12wControl RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "12wControl" + RadarAs112TimeseriesGroupDnssecGetParamsDateRange24wControl RadarAs112TimeseriesGroupDnssecGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TimeseriesGroupDnssecGetParamsFormat string + +const ( + RadarAs112TimeseriesGroupDnssecGetParamsFormatJson RadarAs112TimeseriesGroupDnssecGetParamsFormat = "JSON" + RadarAs112TimeseriesGroupDnssecGetParamsFormatCsv RadarAs112TimeseriesGroupDnssecGetParamsFormat = "CSV" +) diff --git a/radaras112timeseriesgroupdnssec_test.go b/radaras112timeseriesgroupdnssec_test.go new file mode 100644 index 00000000000..4d19bda5a0b --- /dev/null +++ b/radaras112timeseriesgroupdnssec_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TimeseriesGroupDnssecGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.TimeseriesGroups.Dnssec.Get(context.TODO(), cloudflare.RadarAs112TimeseriesGroupDnssecGetParams{ + AggInterval: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupDnssecGetParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TimeseriesGroupDnssecGetParamsDateRange{cloudflare.RadarAs112TimeseriesGroupDnssecGetParamsDateRange1d, cloudflare.RadarAs112TimeseriesGroupDnssecGetParamsDateRange2d, cloudflare.RadarAs112TimeseriesGroupDnssecGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupDnssecGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112timeseriesgroupedn.go b/radaras112timeseriesgroupedn.go new file mode 100644 index 00000000000..a50e6362df1 --- /dev/null +++ b/radaras112timeseriesgroupedn.go @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseriesGroupEdnService 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 +// [NewRadarAs112TimeseriesGroupEdnService] method instead. +type RadarAs112TimeseriesGroupEdnService struct { + Options []option.RequestOption +} + +// NewRadarAs112TimeseriesGroupEdnService 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 NewRadarAs112TimeseriesGroupEdnService(opts ...option.RequestOption) (r *RadarAs112TimeseriesGroupEdnService) { + r = &RadarAs112TimeseriesGroupEdnService{} + r.Options = opts + return +} + +// Percentage distribution of AS112 DNS queries by EDNS support over time. +func (r *RadarAs112TimeseriesGroupEdnService) Get(ctx context.Context, query RadarAs112TimeseriesGroupEdnGetParams, opts ...option.RequestOption) (res *RadarAs112TimeseriesGroupEdnGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/timeseries_groups/edns" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TimeseriesGroupEdnGetResponse struct { + Result RadarAs112TimeseriesGroupEdnGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TimeseriesGroupEdnGetResponseJSON `json:"-"` +} + +// radarAs112TimeseriesGroupEdnGetResponseJSON contains the JSON metadata for the +// struct [RadarAs112TimeseriesGroupEdnGetResponse] +type radarAs112TimeseriesGroupEdnGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupEdnGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupEdnGetResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAs112TimeseriesGroupEdnGetResponseResultSerie0 `json:"serie_0,required"` + JSON radarAs112TimeseriesGroupEdnGetResponseResultJSON `json:"-"` +} + +// radarAs112TimeseriesGroupEdnGetResponseResultJSON contains the JSON metadata for +// the struct [RadarAs112TimeseriesGroupEdnGetResponseResult] +type radarAs112TimeseriesGroupEdnGetResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupEdnGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupEdnGetResponseResultSerie0 struct { + NotSupported []string `json:"NOT_SUPPORTED,required"` + Supported []string `json:"SUPPORTED,required"` + JSON radarAs112TimeseriesGroupEdnGetResponseResultSerie0JSON `json:"-"` +} + +// radarAs112TimeseriesGroupEdnGetResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarAs112TimeseriesGroupEdnGetResponseResultSerie0] +type radarAs112TimeseriesGroupEdnGetResponseResultSerie0JSON struct { + NotSupported apijson.Field + Supported apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupEdnGetResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupEdnGetParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAs112TimeseriesGroupEdnGetParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TimeseriesGroupEdnGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TimeseriesGroupEdnGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TimeseriesGroupEdnGetParams]'s query parameters +// as `url.Values`. +func (r RadarAs112TimeseriesGroupEdnGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAs112TimeseriesGroupEdnGetParamsAggInterval string + +const ( + RadarAs112TimeseriesGroupEdnGetParamsAggInterval15m RadarAs112TimeseriesGroupEdnGetParamsAggInterval = "15m" + RadarAs112TimeseriesGroupEdnGetParamsAggInterval1h RadarAs112TimeseriesGroupEdnGetParamsAggInterval = "1h" + RadarAs112TimeseriesGroupEdnGetParamsAggInterval1d RadarAs112TimeseriesGroupEdnGetParamsAggInterval = "1d" + RadarAs112TimeseriesGroupEdnGetParamsAggInterval1w RadarAs112TimeseriesGroupEdnGetParamsAggInterval = "1w" +) + +type RadarAs112TimeseriesGroupEdnGetParamsDateRange string + +const ( + RadarAs112TimeseriesGroupEdnGetParamsDateRange1d RadarAs112TimeseriesGroupEdnGetParamsDateRange = "1d" + RadarAs112TimeseriesGroupEdnGetParamsDateRange2d RadarAs112TimeseriesGroupEdnGetParamsDateRange = "2d" + RadarAs112TimeseriesGroupEdnGetParamsDateRange7d RadarAs112TimeseriesGroupEdnGetParamsDateRange = "7d" + RadarAs112TimeseriesGroupEdnGetParamsDateRange14d RadarAs112TimeseriesGroupEdnGetParamsDateRange = "14d" + RadarAs112TimeseriesGroupEdnGetParamsDateRange28d RadarAs112TimeseriesGroupEdnGetParamsDateRange = "28d" + RadarAs112TimeseriesGroupEdnGetParamsDateRange12w RadarAs112TimeseriesGroupEdnGetParamsDateRange = "12w" + RadarAs112TimeseriesGroupEdnGetParamsDateRange24w RadarAs112TimeseriesGroupEdnGetParamsDateRange = "24w" + RadarAs112TimeseriesGroupEdnGetParamsDateRange52w RadarAs112TimeseriesGroupEdnGetParamsDateRange = "52w" + RadarAs112TimeseriesGroupEdnGetParamsDateRange1dControl RadarAs112TimeseriesGroupEdnGetParamsDateRange = "1dControl" + RadarAs112TimeseriesGroupEdnGetParamsDateRange2dControl RadarAs112TimeseriesGroupEdnGetParamsDateRange = "2dControl" + RadarAs112TimeseriesGroupEdnGetParamsDateRange7dControl RadarAs112TimeseriesGroupEdnGetParamsDateRange = "7dControl" + RadarAs112TimeseriesGroupEdnGetParamsDateRange14dControl RadarAs112TimeseriesGroupEdnGetParamsDateRange = "14dControl" + RadarAs112TimeseriesGroupEdnGetParamsDateRange28dControl RadarAs112TimeseriesGroupEdnGetParamsDateRange = "28dControl" + RadarAs112TimeseriesGroupEdnGetParamsDateRange12wControl RadarAs112TimeseriesGroupEdnGetParamsDateRange = "12wControl" + RadarAs112TimeseriesGroupEdnGetParamsDateRange24wControl RadarAs112TimeseriesGroupEdnGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TimeseriesGroupEdnGetParamsFormat string + +const ( + RadarAs112TimeseriesGroupEdnGetParamsFormatJson RadarAs112TimeseriesGroupEdnGetParamsFormat = "JSON" + RadarAs112TimeseriesGroupEdnGetParamsFormatCsv RadarAs112TimeseriesGroupEdnGetParamsFormat = "CSV" +) diff --git a/radaras112timeseriesgroupedn_test.go b/radaras112timeseriesgroupedn_test.go new file mode 100644 index 00000000000..db15e2041e8 --- /dev/null +++ b/radaras112timeseriesgroupedn_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TimeseriesGroupEdnGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.TimeseriesGroups.Edns.Get(context.TODO(), cloudflare.RadarAs112TimeseriesGroupEdnGetParams{ + AggInterval: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupEdnGetParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TimeseriesGroupEdnGetParamsDateRange{cloudflare.RadarAs112TimeseriesGroupEdnGetParamsDateRange1d, cloudflare.RadarAs112TimeseriesGroupEdnGetParamsDateRange2d, cloudflare.RadarAs112TimeseriesGroupEdnGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupEdnGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112timeseriesgroupipversion.go b/radaras112timeseriesgroupipversion.go new file mode 100644 index 00000000000..150655e3caa --- /dev/null +++ b/radaras112timeseriesgroupipversion.go @@ -0,0 +1,177 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseriesGroupIPVersionService 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 +// [NewRadarAs112TimeseriesGroupIPVersionService] method instead. +type RadarAs112TimeseriesGroupIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAs112TimeseriesGroupIPVersionService 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 NewRadarAs112TimeseriesGroupIPVersionService(opts ...option.RequestOption) (r *RadarAs112TimeseriesGroupIPVersionService) { + r = &RadarAs112TimeseriesGroupIPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of AS112 DNS queries by IP Version over time. +func (r *RadarAs112TimeseriesGroupIPVersionService) Get(ctx context.Context, query RadarAs112TimeseriesGroupIPVersionGetParams, opts ...option.RequestOption) (res *RadarAs112TimeseriesGroupIPVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/timeseries_groups/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TimeseriesGroupIPVersionGetResponse struct { + Result RadarAs112TimeseriesGroupIPVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TimeseriesGroupIPVersionGetResponseJSON `json:"-"` +} + +// radarAs112TimeseriesGroupIPVersionGetResponseJSON contains the JSON metadata for +// the struct [RadarAs112TimeseriesGroupIPVersionGetResponse] +type radarAs112TimeseriesGroupIPVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupIPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupIPVersionGetResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAs112TimeseriesGroupIPVersionGetResponseResultSerie0 `json:"serie_0,required"` + JSON radarAs112TimeseriesGroupIPVersionGetResponseResultJSON `json:"-"` +} + +// radarAs112TimeseriesGroupIPVersionGetResponseResultJSON contains the JSON +// metadata for the struct [RadarAs112TimeseriesGroupIPVersionGetResponseResult] +type radarAs112TimeseriesGroupIPVersionGetResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupIPVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupIPVersionGetResponseResultSerie0 struct { + IPv4 []string `json:"IPv4,required"` + IPv6 []string `json:"IPv6,required"` + JSON radarAs112TimeseriesGroupIPVersionGetResponseResultSerie0JSON `json:"-"` +} + +// radarAs112TimeseriesGroupIPVersionGetResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarAs112TimeseriesGroupIPVersionGetResponseResultSerie0] +type radarAs112TimeseriesGroupIPVersionGetResponseResultSerie0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupIPVersionGetResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupIPVersionGetParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TimeseriesGroupIPVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TimeseriesGroupIPVersionGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TimeseriesGroupIPVersionGetParams]'s query +// parameters as `url.Values`. +func (r RadarAs112TimeseriesGroupIPVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval string + +const ( + RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval15m RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval = "15m" + RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval1h RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval = "1h" + RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval1d RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval = "1d" + RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval1w RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval = "1w" +) + +type RadarAs112TimeseriesGroupIPVersionGetParamsDateRange string + +const ( + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange1d RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "1d" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange2d RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "2d" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange7d RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "7d" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange14d RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "14d" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange28d RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "28d" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange12w RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "12w" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange24w RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "24w" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange52w RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "52w" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange1dControl RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "1dControl" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange2dControl RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "2dControl" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange7dControl RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "7dControl" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange14dControl RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "14dControl" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange28dControl RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "28dControl" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange12wControl RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "12wControl" + RadarAs112TimeseriesGroupIPVersionGetParamsDateRange24wControl RadarAs112TimeseriesGroupIPVersionGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TimeseriesGroupIPVersionGetParamsFormat string + +const ( + RadarAs112TimeseriesGroupIPVersionGetParamsFormatJson RadarAs112TimeseriesGroupIPVersionGetParamsFormat = "JSON" + RadarAs112TimeseriesGroupIPVersionGetParamsFormatCsv RadarAs112TimeseriesGroupIPVersionGetParamsFormat = "CSV" +) diff --git a/radaras112timeseriesgroupipversion_test.go b/radaras112timeseriesgroupipversion_test.go new file mode 100644 index 00000000000..8b4557df668 --- /dev/null +++ b/radaras112timeseriesgroupipversion_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TimeseriesGroupIPVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.TimeseriesGroups.IPVersion.Get(context.TODO(), cloudflare.RadarAs112TimeseriesGroupIPVersionGetParams{ + AggInterval: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupIPVersionGetParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TimeseriesGroupIPVersionGetParamsDateRange{cloudflare.RadarAs112TimeseriesGroupIPVersionGetParamsDateRange1d, cloudflare.RadarAs112TimeseriesGroupIPVersionGetParamsDateRange2d, cloudflare.RadarAs112TimeseriesGroupIPVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupIPVersionGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112timeseriesgroupprotocol.go b/radaras112timeseriesgroupprotocol.go new file mode 100644 index 00000000000..8bbf42f4393 --- /dev/null +++ b/radaras112timeseriesgroupprotocol.go @@ -0,0 +1,176 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseriesGroupProtocolService 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 +// [NewRadarAs112TimeseriesGroupProtocolService] method instead. +type RadarAs112TimeseriesGroupProtocolService struct { + Options []option.RequestOption +} + +// NewRadarAs112TimeseriesGroupProtocolService 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 NewRadarAs112TimeseriesGroupProtocolService(opts ...option.RequestOption) (r *RadarAs112TimeseriesGroupProtocolService) { + r = &RadarAs112TimeseriesGroupProtocolService{} + r.Options = opts + return +} + +// Percentage distribution of AS112 dns requests classified per Protocol over time. +func (r *RadarAs112TimeseriesGroupProtocolService) Get(ctx context.Context, query RadarAs112TimeseriesGroupProtocolGetParams, opts ...option.RequestOption) (res *RadarAs112TimeseriesGroupProtocolGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/timeseries_groups/protocol" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TimeseriesGroupProtocolGetResponse struct { + Result RadarAs112TimeseriesGroupProtocolGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TimeseriesGroupProtocolGetResponseJSON `json:"-"` +} + +// radarAs112TimeseriesGroupProtocolGetResponseJSON contains the JSON metadata for +// the struct [RadarAs112TimeseriesGroupProtocolGetResponse] +type radarAs112TimeseriesGroupProtocolGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupProtocolGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupProtocolGetResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAs112TimeseriesGroupProtocolGetResponseResultSerie0 `json:"serie_0,required"` + JSON radarAs112TimeseriesGroupProtocolGetResponseResultJSON `json:"-"` +} + +// radarAs112TimeseriesGroupProtocolGetResponseResultJSON contains the JSON +// metadata for the struct [RadarAs112TimeseriesGroupProtocolGetResponseResult] +type radarAs112TimeseriesGroupProtocolGetResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupProtocolGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupProtocolGetResponseResultSerie0 struct { + Tcp []string `json:"tcp,required"` + Udp []string `json:"udp,required"` + JSON radarAs112TimeseriesGroupProtocolGetResponseResultSerie0JSON `json:"-"` +} + +// radarAs112TimeseriesGroupProtocolGetResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarAs112TimeseriesGroupProtocolGetResponseResultSerie0] +type radarAs112TimeseriesGroupProtocolGetResponseResultSerie0JSON struct { + Tcp apijson.Field + Udp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupProtocolGetResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupProtocolGetParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAs112TimeseriesGroupProtocolGetParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TimeseriesGroupProtocolGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TimeseriesGroupProtocolGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TimeseriesGroupProtocolGetParams]'s query +// parameters as `url.Values`. +func (r RadarAs112TimeseriesGroupProtocolGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAs112TimeseriesGroupProtocolGetParamsAggInterval string + +const ( + RadarAs112TimeseriesGroupProtocolGetParamsAggInterval15m RadarAs112TimeseriesGroupProtocolGetParamsAggInterval = "15m" + RadarAs112TimeseriesGroupProtocolGetParamsAggInterval1h RadarAs112TimeseriesGroupProtocolGetParamsAggInterval = "1h" + RadarAs112TimeseriesGroupProtocolGetParamsAggInterval1d RadarAs112TimeseriesGroupProtocolGetParamsAggInterval = "1d" + RadarAs112TimeseriesGroupProtocolGetParamsAggInterval1w RadarAs112TimeseriesGroupProtocolGetParamsAggInterval = "1w" +) + +type RadarAs112TimeseriesGroupProtocolGetParamsDateRange string + +const ( + RadarAs112TimeseriesGroupProtocolGetParamsDateRange1d RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "1d" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange2d RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "2d" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange7d RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "7d" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange14d RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "14d" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange28d RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "28d" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange12w RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "12w" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange24w RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "24w" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange52w RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "52w" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange1dControl RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "1dControl" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange2dControl RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "2dControl" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange7dControl RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "7dControl" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange14dControl RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "14dControl" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange28dControl RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "28dControl" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange12wControl RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "12wControl" + RadarAs112TimeseriesGroupProtocolGetParamsDateRange24wControl RadarAs112TimeseriesGroupProtocolGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TimeseriesGroupProtocolGetParamsFormat string + +const ( + RadarAs112TimeseriesGroupProtocolGetParamsFormatJson RadarAs112TimeseriesGroupProtocolGetParamsFormat = "JSON" + RadarAs112TimeseriesGroupProtocolGetParamsFormatCsv RadarAs112TimeseriesGroupProtocolGetParamsFormat = "CSV" +) diff --git a/radaras112timeseriesgroupprotocol_test.go b/radaras112timeseriesgroupprotocol_test.go new file mode 100644 index 00000000000..3a2d9c7ba29 --- /dev/null +++ b/radaras112timeseriesgroupprotocol_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TimeseriesGroupProtocolGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.TimeseriesGroups.Protocol.Get(context.TODO(), cloudflare.RadarAs112TimeseriesGroupProtocolGetParams{ + AggInterval: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupProtocolGetParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TimeseriesGroupProtocolGetParamsDateRange{cloudflare.RadarAs112TimeseriesGroupProtocolGetParamsDateRange1d, cloudflare.RadarAs112TimeseriesGroupProtocolGetParamsDateRange2d, cloudflare.RadarAs112TimeseriesGroupProtocolGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupProtocolGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112timeseriesgroupquerytype.go b/radaras112timeseriesgroupquerytype.go new file mode 100644 index 00000000000..a80f1cc305b --- /dev/null +++ b/radaras112timeseriesgroupquerytype.go @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseriesGroupQueryTypeService 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 +// [NewRadarAs112TimeseriesGroupQueryTypeService] method instead. +type RadarAs112TimeseriesGroupQueryTypeService struct { + Options []option.RequestOption +} + +// NewRadarAs112TimeseriesGroupQueryTypeService 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 NewRadarAs112TimeseriesGroupQueryTypeService(opts ...option.RequestOption) (r *RadarAs112TimeseriesGroupQueryTypeService) { + r = &RadarAs112TimeseriesGroupQueryTypeService{} + r.Options = opts + return +} + +// Percentage distribution of AS112 DNS queries by Query Type over time. +func (r *RadarAs112TimeseriesGroupQueryTypeService) Get(ctx context.Context, query RadarAs112TimeseriesGroupQueryTypeGetParams, opts ...option.RequestOption) (res *RadarAs112TimeseriesGroupQueryTypeGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/timeseries_groups/query_type" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TimeseriesGroupQueryTypeGetResponse struct { + Result RadarAs112TimeseriesGroupQueryTypeGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TimeseriesGroupQueryTypeGetResponseJSON `json:"-"` +} + +// radarAs112TimeseriesGroupQueryTypeGetResponseJSON contains the JSON metadata for +// the struct [RadarAs112TimeseriesGroupQueryTypeGetResponse] +type radarAs112TimeseriesGroupQueryTypeGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupQueryTypeGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupQueryTypeGetResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAs112TimeseriesGroupQueryTypeGetResponseResultSerie0 `json:"serie_0,required"` + JSON radarAs112TimeseriesGroupQueryTypeGetResponseResultJSON `json:"-"` +} + +// radarAs112TimeseriesGroupQueryTypeGetResponseResultJSON contains the JSON +// metadata for the struct [RadarAs112TimeseriesGroupQueryTypeGetResponseResult] +type radarAs112TimeseriesGroupQueryTypeGetResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupQueryTypeGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupQueryTypeGetResponseResultSerie0 struct { + A []string `json:"A,required"` + Aaaa []string `json:"AAAA,required"` + Ptr []string `json:"PTR,required"` + Soa []string `json:"SOA,required"` + Srv []string `json:"SRV,required"` + JSON radarAs112TimeseriesGroupQueryTypeGetResponseResultSerie0JSON `json:"-"` +} + +// radarAs112TimeseriesGroupQueryTypeGetResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarAs112TimeseriesGroupQueryTypeGetResponseResultSerie0] +type radarAs112TimeseriesGroupQueryTypeGetResponseResultSerie0JSON struct { + A apijson.Field + Aaaa apijson.Field + Ptr apijson.Field + Soa apijson.Field + Srv apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupQueryTypeGetResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupQueryTypeGetParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TimeseriesGroupQueryTypeGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TimeseriesGroupQueryTypeGetParams]'s query +// parameters as `url.Values`. +func (r RadarAs112TimeseriesGroupQueryTypeGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval string + +const ( + RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval15m RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval = "15m" + RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval1h RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval = "1h" + RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval1d RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval = "1d" + RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval1w RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval = "1w" +) + +type RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange string + +const ( + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange1d RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "1d" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange2d RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "2d" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange7d RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "7d" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange14d RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "14d" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange28d RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "28d" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange12w RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "12w" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange24w RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "24w" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange52w RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "52w" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange1dControl RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "1dControl" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange2dControl RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "2dControl" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange7dControl RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "7dControl" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange14dControl RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "14dControl" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange28dControl RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "28dControl" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange12wControl RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "12wControl" + RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange24wControl RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TimeseriesGroupQueryTypeGetParamsFormat string + +const ( + RadarAs112TimeseriesGroupQueryTypeGetParamsFormatJson RadarAs112TimeseriesGroupQueryTypeGetParamsFormat = "JSON" + RadarAs112TimeseriesGroupQueryTypeGetParamsFormatCsv RadarAs112TimeseriesGroupQueryTypeGetParamsFormat = "CSV" +) diff --git a/radaras112timeseriesgroupquerytype_test.go b/radaras112timeseriesgroupquerytype_test.go new file mode 100644 index 00000000000..be893b63bbf --- /dev/null +++ b/radaras112timeseriesgroupquerytype_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TimeseriesGroupQueryTypeGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.TimeseriesGroups.QueryType.Get(context.TODO(), cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParams{ + AggInterval: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange{cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange1d, cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange2d, cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupQueryTypeGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112timeseriesgroupresponsecode.go b/radaras112timeseriesgroupresponsecode.go new file mode 100644 index 00000000000..c2a13df0897 --- /dev/null +++ b/radaras112timeseriesgroupresponsecode.go @@ -0,0 +1,178 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseriesGroupResponseCodeService 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 +// [NewRadarAs112TimeseriesGroupResponseCodeService] method instead. +type RadarAs112TimeseriesGroupResponseCodeService struct { + Options []option.RequestOption +} + +// NewRadarAs112TimeseriesGroupResponseCodeService 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 NewRadarAs112TimeseriesGroupResponseCodeService(opts ...option.RequestOption) (r *RadarAs112TimeseriesGroupResponseCodeService) { + r = &RadarAs112TimeseriesGroupResponseCodeService{} + r.Options = opts + return +} + +// Percentage distribution of AS112 dns requests classified per Response Codes over +// time. +func (r *RadarAs112TimeseriesGroupResponseCodeService) Get(ctx context.Context, query RadarAs112TimeseriesGroupResponseCodeGetParams, opts ...option.RequestOption) (res *RadarAs112TimeseriesGroupResponseCodeGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/timeseries_groups/response_codes" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TimeseriesGroupResponseCodeGetResponse struct { + Result RadarAs112TimeseriesGroupResponseCodeGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TimeseriesGroupResponseCodeGetResponseJSON `json:"-"` +} + +// radarAs112TimeseriesGroupResponseCodeGetResponseJSON contains the JSON metadata +// for the struct [RadarAs112TimeseriesGroupResponseCodeGetResponse] +type radarAs112TimeseriesGroupResponseCodeGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupResponseCodeGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupResponseCodeGetResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAs112TimeseriesGroupResponseCodeGetResponseResultSerie0 `json:"serie_0,required"` + JSON radarAs112TimeseriesGroupResponseCodeGetResponseResultJSON `json:"-"` +} + +// radarAs112TimeseriesGroupResponseCodeGetResponseResultJSON contains the JSON +// metadata for the struct [RadarAs112TimeseriesGroupResponseCodeGetResponseResult] +type radarAs112TimeseriesGroupResponseCodeGetResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupResponseCodeGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupResponseCodeGetResponseResultSerie0 struct { + Noerror []string `json:"NOERROR,required"` + Nxdomain []string `json:"NXDOMAIN,required"` + JSON radarAs112TimeseriesGroupResponseCodeGetResponseResultSerie0JSON `json:"-"` +} + +// radarAs112TimeseriesGroupResponseCodeGetResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarAs112TimeseriesGroupResponseCodeGetResponseResultSerie0] +type radarAs112TimeseriesGroupResponseCodeGetResponseResultSerie0JSON struct { + Noerror apijson.Field + Nxdomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseriesGroupResponseCodeGetResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseriesGroupResponseCodeGetParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TimeseriesGroupResponseCodeGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TimeseriesGroupResponseCodeGetParams]'s query +// parameters as `url.Values`. +func (r RadarAs112TimeseriesGroupResponseCodeGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval string + +const ( + RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval15m RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval = "15m" + RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval1h RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval = "1h" + RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval1d RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval = "1d" + RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval1w RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval = "1w" +) + +type RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange string + +const ( + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange1d RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "1d" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange2d RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "2d" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange7d RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "7d" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange14d RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "14d" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange28d RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "28d" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange12w RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "12w" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange24w RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "24w" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange52w RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "52w" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange1dControl RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "1dControl" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange2dControl RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "2dControl" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange7dControl RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "7dControl" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange14dControl RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "14dControl" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange28dControl RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "28dControl" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange12wControl RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "12wControl" + RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange24wControl RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TimeseriesGroupResponseCodeGetParamsFormat string + +const ( + RadarAs112TimeseriesGroupResponseCodeGetParamsFormatJson RadarAs112TimeseriesGroupResponseCodeGetParamsFormat = "JSON" + RadarAs112TimeseriesGroupResponseCodeGetParamsFormatCsv RadarAs112TimeseriesGroupResponseCodeGetParamsFormat = "CSV" +) diff --git a/radaras112timeseriesgroupresponsecode_test.go b/radaras112timeseriesgroupresponsecode_test.go new file mode 100644 index 00000000000..187c5417696 --- /dev/null +++ b/radaras112timeseriesgroupresponsecode_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TimeseriesGroupResponseCodeGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.TimeseriesGroups.ResponseCodes.Get(context.TODO(), cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParams{ + AggInterval: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange{cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange1d, cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange2d, cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TimeseriesGroupResponseCodeGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112timesery.go b/radaras112timesery.go new file mode 100644 index 00000000000..ce80edf3b39 --- /dev/null +++ b/radaras112timesery.go @@ -0,0 +1,268 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TimeseryService 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 [NewRadarAs112TimeseryService] method +// instead. +type RadarAs112TimeseryService struct { + Options []option.RequestOption +} + +// NewRadarAs112TimeseryService 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 NewRadarAs112TimeseryService(opts ...option.RequestOption) (r *RadarAs112TimeseryService) { + r = &RadarAs112TimeseryService{} + r.Options = opts + return +} + +// Get AS112 queries change over time. +func (r *RadarAs112TimeseryService) List(ctx context.Context, query RadarAs112TimeseryListParams, opts ...option.RequestOption) (res *RadarAs112TimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/timeseries" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TimeseryListResponse struct { + Result RadarAs112TimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TimeseryListResponseJSON `json:"-"` +} + +// radarAs112TimeseryListResponseJSON contains the JSON metadata for the struct +// [RadarAs112TimeseryListResponse] +type radarAs112TimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseryListResponseResult struct { + Meta RadarAs112TimeseryListResponseResultMeta `json:"meta,required"` + Serie0 RadarAs112TimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAs112TimeseryListResponseResultJSON `json:"-"` +} + +// radarAs112TimeseryListResponseResultJSON contains the JSON metadata for the +// struct [RadarAs112TimeseryListResponseResult] +type radarAs112TimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseryListResponseResultMeta struct { + AggInterval string `json:"aggInterval,required"` + DateRange []RadarAs112TimeseryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated time.Time `json:"lastUpdated,required" format:"date-time"` + ConfidenceInfo RadarAs112TimeseryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112TimeseryListResponseResultMetaJSON `json:"-"` +} + +// radarAs112TimeseryListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarAs112TimeseryListResponseResultMeta] +type radarAs112TimeseryListResponseResultMetaJSON struct { + AggInterval apijson.Field + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112TimeseryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112TimeseryListResponseResultMetaDateRangeJSON contains the JSON metadata +// for the struct [RadarAs112TimeseryListResponseResultMetaDateRange] +type radarAs112TimeseryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112TimeseryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112TimeseryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112TimeseryListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct [RadarAs112TimeseryListResponseResultMetaConfidenceInfo] +type radarAs112TimeseryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112TimeseryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112TimeseryListResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarAs112TimeseryListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112TimeseryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseryListResponseResultSerie0 struct { + Timestamps []time.Time `json:"timestamps,required" format:"date-time"` + Values []string `json:"values,required"` + JSON radarAs112TimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarAs112TimeseryListResponseResultSerie0JSON contains the JSON metadata for +// the struct [RadarAs112TimeseryListResponseResultSerie0] +type radarAs112TimeseryListResponseResultSerie0JSON struct { + Timestamps apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAs112TimeseryListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TimeseryListParams]'s query parameters as +// `url.Values`. +func (r RadarAs112TimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAs112TimeseryListParamsAggInterval string + +const ( + RadarAs112TimeseryListParamsAggInterval15m RadarAs112TimeseryListParamsAggInterval = "15m" + RadarAs112TimeseryListParamsAggInterval1h RadarAs112TimeseryListParamsAggInterval = "1h" + RadarAs112TimeseryListParamsAggInterval1d RadarAs112TimeseryListParamsAggInterval = "1d" + RadarAs112TimeseryListParamsAggInterval1w RadarAs112TimeseryListParamsAggInterval = "1w" +) + +type RadarAs112TimeseryListParamsDateRange string + +const ( + RadarAs112TimeseryListParamsDateRange1d RadarAs112TimeseryListParamsDateRange = "1d" + RadarAs112TimeseryListParamsDateRange2d RadarAs112TimeseryListParamsDateRange = "2d" + RadarAs112TimeseryListParamsDateRange7d RadarAs112TimeseryListParamsDateRange = "7d" + RadarAs112TimeseryListParamsDateRange14d RadarAs112TimeseryListParamsDateRange = "14d" + RadarAs112TimeseryListParamsDateRange28d RadarAs112TimeseryListParamsDateRange = "28d" + RadarAs112TimeseryListParamsDateRange12w RadarAs112TimeseryListParamsDateRange = "12w" + RadarAs112TimeseryListParamsDateRange24w RadarAs112TimeseryListParamsDateRange = "24w" + RadarAs112TimeseryListParamsDateRange52w RadarAs112TimeseryListParamsDateRange = "52w" + RadarAs112TimeseryListParamsDateRange1dControl RadarAs112TimeseryListParamsDateRange = "1dControl" + RadarAs112TimeseryListParamsDateRange2dControl RadarAs112TimeseryListParamsDateRange = "2dControl" + RadarAs112TimeseryListParamsDateRange7dControl RadarAs112TimeseryListParamsDateRange = "7dControl" + RadarAs112TimeseryListParamsDateRange14dControl RadarAs112TimeseryListParamsDateRange = "14dControl" + RadarAs112TimeseryListParamsDateRange28dControl RadarAs112TimeseryListParamsDateRange = "28dControl" + RadarAs112TimeseryListParamsDateRange12wControl RadarAs112TimeseryListParamsDateRange = "12wControl" + RadarAs112TimeseryListParamsDateRange24wControl RadarAs112TimeseryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TimeseryListParamsFormat string + +const ( + RadarAs112TimeseryListParamsFormatJson RadarAs112TimeseryListParamsFormat = "JSON" + RadarAs112TimeseryListParamsFormatCsv RadarAs112TimeseryListParamsFormat = "CSV" +) diff --git a/radaras112timesery_test.go b/radaras112timesery_test.go new file mode 100644 index 00000000000..95ba7aa20e4 --- /dev/null +++ b/radaras112timesery_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Timeseries.List(context.TODO(), cloudflare.RadarAs112TimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAs112TimeseryListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TimeseryListParamsDateRange{cloudflare.RadarAs112TimeseryListParamsDateRange1d, cloudflare.RadarAs112TimeseryListParamsDateRange2d, cloudflare.RadarAs112TimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112top.go b/radaras112top.go new file mode 100644 index 00000000000..9206fd8586e --- /dev/null +++ b/radaras112top.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TopService 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 [NewRadarAs112TopService] method +// instead. +type RadarAs112TopService struct { + Options []option.RequestOption + Locations *RadarAs112TopLocationService +} + +// NewRadarAs112TopService 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 NewRadarAs112TopService(opts ...option.RequestOption) (r *RadarAs112TopService) { + r = &RadarAs112TopService{} + r.Options = opts + r.Locations = NewRadarAs112TopLocationService(opts...) + return +} diff --git a/radaras112toplocation.go b/radaras112toplocation.go new file mode 100644 index 00000000000..5aa6b284cdd --- /dev/null +++ b/radaras112toplocation.go @@ -0,0 +1,262 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TopLocationService 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 [NewRadarAs112TopLocationService] +// method instead. +type RadarAs112TopLocationService struct { + Options []option.RequestOption + Dnssecs *RadarAs112TopLocationDnssecService + Edns *RadarAs112TopLocationEdnService + IPVersions *RadarAs112TopLocationIPVersionService +} + +// NewRadarAs112TopLocationService 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 NewRadarAs112TopLocationService(opts ...option.RequestOption) (r *RadarAs112TopLocationService) { + r = &RadarAs112TopLocationService{} + r.Options = opts + r.Dnssecs = NewRadarAs112TopLocationDnssecService(opts...) + r.Edns = NewRadarAs112TopLocationEdnService(opts...) + r.IPVersions = NewRadarAs112TopLocationIPVersionService(opts...) + return +} + +// Get the top locations by AS112 DNS queries. Values are a percentage out of the +// total queries. +func (r *RadarAs112TopLocationService) List(ctx context.Context, query RadarAs112TopLocationListParams, opts ...option.RequestOption) (res *RadarAs112TopLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/as112/top/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TopLocationListResponse struct { + Result RadarAs112TopLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TopLocationListResponseJSON `json:"-"` +} + +// radarAs112TopLocationListResponseJSON contains the JSON metadata for the struct +// [RadarAs112TopLocationListResponse] +type radarAs112TopLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationListResponseResult struct { + Meta RadarAs112TopLocationListResponseResultMeta `json:"meta,required"` + Top0 []RadarAs112TopLocationListResponseResultTop0 `json:"top_0,required"` + JSON radarAs112TopLocationListResponseResultJSON `json:"-"` +} + +// radarAs112TopLocationListResponseResultJSON contains the JSON metadata for the +// struct [RadarAs112TopLocationListResponseResult] +type radarAs112TopLocationListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationListResponseResultMeta struct { + DateRange []RadarAs112TopLocationListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAs112TopLocationListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112TopLocationListResponseResultMetaJSON `json:"-"` +} + +// radarAs112TopLocationListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarAs112TopLocationListResponseResultMeta] +type radarAs112TopLocationListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112TopLocationListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112TopLocationListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarAs112TopLocationListResponseResultMetaDateRange] +type radarAs112TopLocationListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112TopLocationListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112TopLocationListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112TopLocationListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarAs112TopLocationListResponseResultMetaConfidenceInfo] +type radarAs112TopLocationListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112TopLocationListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112TopLocationListResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarAs112TopLocationListResponseResultMetaConfidenceInfoAnnotation] +type radarAs112TopLocationListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarAs112TopLocationListResponseResultTop0JSON `json:"-"` +} + +// radarAs112TopLocationListResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarAs112TopLocationListResponseResultTop0] +type radarAs112TopLocationListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TopLocationListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TopLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TopLocationListParams]'s query parameters as +// `url.Values`. +func (r RadarAs112TopLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAs112TopLocationListParamsDateRange string + +const ( + RadarAs112TopLocationListParamsDateRange1d RadarAs112TopLocationListParamsDateRange = "1d" + RadarAs112TopLocationListParamsDateRange2d RadarAs112TopLocationListParamsDateRange = "2d" + RadarAs112TopLocationListParamsDateRange7d RadarAs112TopLocationListParamsDateRange = "7d" + RadarAs112TopLocationListParamsDateRange14d RadarAs112TopLocationListParamsDateRange = "14d" + RadarAs112TopLocationListParamsDateRange28d RadarAs112TopLocationListParamsDateRange = "28d" + RadarAs112TopLocationListParamsDateRange12w RadarAs112TopLocationListParamsDateRange = "12w" + RadarAs112TopLocationListParamsDateRange24w RadarAs112TopLocationListParamsDateRange = "24w" + RadarAs112TopLocationListParamsDateRange52w RadarAs112TopLocationListParamsDateRange = "52w" + RadarAs112TopLocationListParamsDateRange1dControl RadarAs112TopLocationListParamsDateRange = "1dControl" + RadarAs112TopLocationListParamsDateRange2dControl RadarAs112TopLocationListParamsDateRange = "2dControl" + RadarAs112TopLocationListParamsDateRange7dControl RadarAs112TopLocationListParamsDateRange = "7dControl" + RadarAs112TopLocationListParamsDateRange14dControl RadarAs112TopLocationListParamsDateRange = "14dControl" + RadarAs112TopLocationListParamsDateRange28dControl RadarAs112TopLocationListParamsDateRange = "28dControl" + RadarAs112TopLocationListParamsDateRange12wControl RadarAs112TopLocationListParamsDateRange = "12wControl" + RadarAs112TopLocationListParamsDateRange24wControl RadarAs112TopLocationListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TopLocationListParamsFormat string + +const ( + RadarAs112TopLocationListParamsFormatJson RadarAs112TopLocationListParamsFormat = "JSON" + RadarAs112TopLocationListParamsFormatCsv RadarAs112TopLocationListParamsFormat = "CSV" +) diff --git a/radaras112toplocation_test.go b/radaras112toplocation_test.go new file mode 100644 index 00000000000..3d64b58a593 --- /dev/null +++ b/radaras112toplocation_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TopLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Tops.Locations.List(context.TODO(), cloudflare.RadarAs112TopLocationListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TopLocationListParamsDateRange{cloudflare.RadarAs112TopLocationListParamsDateRange1d, cloudflare.RadarAs112TopLocationListParamsDateRange2d, cloudflare.RadarAs112TopLocationListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TopLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaras112toplocationdnssec.go b/radaras112toplocationdnssec.go new file mode 100644 index 00000000000..ba74f55af7a --- /dev/null +++ b/radaras112toplocationdnssec.go @@ -0,0 +1,265 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TopLocationDnssecService 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 +// [NewRadarAs112TopLocationDnssecService] method instead. +type RadarAs112TopLocationDnssecService struct { + Options []option.RequestOption +} + +// NewRadarAs112TopLocationDnssecService 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 NewRadarAs112TopLocationDnssecService(opts ...option.RequestOption) (r *RadarAs112TopLocationDnssecService) { + r = &RadarAs112TopLocationDnssecService{} + r.Options = opts + return +} + +// Get the top locations by DNS queries DNSSEC support to AS112. +func (r *RadarAs112TopLocationDnssecService) Get(ctx context.Context, dnssec RadarAs112TopLocationDnssecGetParamsDnssec, query RadarAs112TopLocationDnssecGetParams, opts ...option.RequestOption) (res *RadarAs112TopLocationDnssecGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/as112/top/locations/dnssec/%v", dnssec) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TopLocationDnssecGetResponse struct { + Result RadarAs112TopLocationDnssecGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TopLocationDnssecGetResponseJSON `json:"-"` +} + +// radarAs112TopLocationDnssecGetResponseJSON contains the JSON metadata for the +// struct [RadarAs112TopLocationDnssecGetResponse] +type radarAs112TopLocationDnssecGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationDnssecGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationDnssecGetResponseResult struct { + Meta RadarAs112TopLocationDnssecGetResponseResultMeta `json:"meta,required"` + Top0 []RadarAs112TopLocationDnssecGetResponseResultTop0 `json:"top_0,required"` + JSON radarAs112TopLocationDnssecGetResponseResultJSON `json:"-"` +} + +// radarAs112TopLocationDnssecGetResponseResultJSON contains the JSON metadata for +// the struct [RadarAs112TopLocationDnssecGetResponseResult] +type radarAs112TopLocationDnssecGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationDnssecGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationDnssecGetResponseResultMeta struct { + DateRange []RadarAs112TopLocationDnssecGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112TopLocationDnssecGetResponseResultMetaJSON `json:"-"` +} + +// radarAs112TopLocationDnssecGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAs112TopLocationDnssecGetResponseResultMeta] +type radarAs112TopLocationDnssecGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationDnssecGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationDnssecGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112TopLocationDnssecGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112TopLocationDnssecGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAs112TopLocationDnssecGetResponseResultMetaDateRange] +type radarAs112TopLocationDnssecGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationDnssecGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfo] +type radarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoAnnotation] +type radarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationDnssecGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationDnssecGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarAs112TopLocationDnssecGetResponseResultTop0JSON `json:"-"` +} + +// radarAs112TopLocationDnssecGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarAs112TopLocationDnssecGetResponseResultTop0] +type radarAs112TopLocationDnssecGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationDnssecGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationDnssecGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TopLocationDnssecGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TopLocationDnssecGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TopLocationDnssecGetParams]'s query parameters as +// `url.Values`. +func (r RadarAs112TopLocationDnssecGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// DNSSEC. +type RadarAs112TopLocationDnssecGetParamsDnssec string + +const ( + RadarAs112TopLocationDnssecGetParamsDnssecSupported RadarAs112TopLocationDnssecGetParamsDnssec = "SUPPORTED" + RadarAs112TopLocationDnssecGetParamsDnssecNotSupported RadarAs112TopLocationDnssecGetParamsDnssec = "NOT_SUPPORTED" +) + +type RadarAs112TopLocationDnssecGetParamsDateRange string + +const ( + RadarAs112TopLocationDnssecGetParamsDateRange1d RadarAs112TopLocationDnssecGetParamsDateRange = "1d" + RadarAs112TopLocationDnssecGetParamsDateRange2d RadarAs112TopLocationDnssecGetParamsDateRange = "2d" + RadarAs112TopLocationDnssecGetParamsDateRange7d RadarAs112TopLocationDnssecGetParamsDateRange = "7d" + RadarAs112TopLocationDnssecGetParamsDateRange14d RadarAs112TopLocationDnssecGetParamsDateRange = "14d" + RadarAs112TopLocationDnssecGetParamsDateRange28d RadarAs112TopLocationDnssecGetParamsDateRange = "28d" + RadarAs112TopLocationDnssecGetParamsDateRange12w RadarAs112TopLocationDnssecGetParamsDateRange = "12w" + RadarAs112TopLocationDnssecGetParamsDateRange24w RadarAs112TopLocationDnssecGetParamsDateRange = "24w" + RadarAs112TopLocationDnssecGetParamsDateRange52w RadarAs112TopLocationDnssecGetParamsDateRange = "52w" + RadarAs112TopLocationDnssecGetParamsDateRange1dControl RadarAs112TopLocationDnssecGetParamsDateRange = "1dControl" + RadarAs112TopLocationDnssecGetParamsDateRange2dControl RadarAs112TopLocationDnssecGetParamsDateRange = "2dControl" + RadarAs112TopLocationDnssecGetParamsDateRange7dControl RadarAs112TopLocationDnssecGetParamsDateRange = "7dControl" + RadarAs112TopLocationDnssecGetParamsDateRange14dControl RadarAs112TopLocationDnssecGetParamsDateRange = "14dControl" + RadarAs112TopLocationDnssecGetParamsDateRange28dControl RadarAs112TopLocationDnssecGetParamsDateRange = "28dControl" + RadarAs112TopLocationDnssecGetParamsDateRange12wControl RadarAs112TopLocationDnssecGetParamsDateRange = "12wControl" + RadarAs112TopLocationDnssecGetParamsDateRange24wControl RadarAs112TopLocationDnssecGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TopLocationDnssecGetParamsFormat string + +const ( + RadarAs112TopLocationDnssecGetParamsFormatJson RadarAs112TopLocationDnssecGetParamsFormat = "JSON" + RadarAs112TopLocationDnssecGetParamsFormatCsv RadarAs112TopLocationDnssecGetParamsFormat = "CSV" +) diff --git a/radaras112toplocationdnssec_test.go b/radaras112toplocationdnssec_test.go new file mode 100644 index 00000000000..384c7e75e5a --- /dev/null +++ b/radaras112toplocationdnssec_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TopLocationDnssecGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Tops.Locations.Dnssecs.Get( + context.TODO(), + cloudflare.RadarAs112TopLocationDnssecGetParamsDnssecSupported, + cloudflare.RadarAs112TopLocationDnssecGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TopLocationDnssecGetParamsDateRange{cloudflare.RadarAs112TopLocationDnssecGetParamsDateRange1d, cloudflare.RadarAs112TopLocationDnssecGetParamsDateRange2d, cloudflare.RadarAs112TopLocationDnssecGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TopLocationDnssecGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/radaras112toplocationedn.go b/radaras112toplocationedn.go new file mode 100644 index 00000000000..b7b3252b475 --- /dev/null +++ b/radaras112toplocationedn.go @@ -0,0 +1,264 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TopLocationEdnService 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 +// [NewRadarAs112TopLocationEdnService] method instead. +type RadarAs112TopLocationEdnService struct { + Options []option.RequestOption +} + +// NewRadarAs112TopLocationEdnService 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 NewRadarAs112TopLocationEdnService(opts ...option.RequestOption) (r *RadarAs112TopLocationEdnService) { + r = &RadarAs112TopLocationEdnService{} + r.Options = opts + return +} + +// Get the top locations, by DNS queries EDNS support to AS112. +func (r *RadarAs112TopLocationEdnService) Get(ctx context.Context, edns RadarAs112TopLocationEdnGetParamsEdns, query RadarAs112TopLocationEdnGetParams, opts ...option.RequestOption) (res *RadarAs112TopLocationEdnGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/as112/top/locations/edns/%v", edns) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TopLocationEdnGetResponse struct { + Result RadarAs112TopLocationEdnGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TopLocationEdnGetResponseJSON `json:"-"` +} + +// radarAs112TopLocationEdnGetResponseJSON contains the JSON metadata for the +// struct [RadarAs112TopLocationEdnGetResponse] +type radarAs112TopLocationEdnGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationEdnGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationEdnGetResponseResult struct { + Meta RadarAs112TopLocationEdnGetResponseResultMeta `json:"meta,required"` + Top0 []RadarAs112TopLocationEdnGetResponseResultTop0 `json:"top_0,required"` + JSON radarAs112TopLocationEdnGetResponseResultJSON `json:"-"` +} + +// radarAs112TopLocationEdnGetResponseResultJSON contains the JSON metadata for the +// struct [RadarAs112TopLocationEdnGetResponseResult] +type radarAs112TopLocationEdnGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationEdnGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationEdnGetResponseResultMeta struct { + DateRange []RadarAs112TopLocationEdnGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112TopLocationEdnGetResponseResultMetaJSON `json:"-"` +} + +// radarAs112TopLocationEdnGetResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarAs112TopLocationEdnGetResponseResultMeta] +type radarAs112TopLocationEdnGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationEdnGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationEdnGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112TopLocationEdnGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112TopLocationEdnGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarAs112TopLocationEdnGetResponseResultMetaDateRange] +type radarAs112TopLocationEdnGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationEdnGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfo] +type radarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoAnnotation] +type radarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationEdnGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationEdnGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarAs112TopLocationEdnGetResponseResultTop0JSON `json:"-"` +} + +// radarAs112TopLocationEdnGetResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarAs112TopLocationEdnGetResponseResultTop0] +type radarAs112TopLocationEdnGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationEdnGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationEdnGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TopLocationEdnGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TopLocationEdnGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TopLocationEdnGetParams]'s query parameters as +// `url.Values`. +func (r RadarAs112TopLocationEdnGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// EDNS. +type RadarAs112TopLocationEdnGetParamsEdns string + +const ( + RadarAs112TopLocationEdnGetParamsEdnsSupported RadarAs112TopLocationEdnGetParamsEdns = "SUPPORTED" + RadarAs112TopLocationEdnGetParamsEdnsNotSupported RadarAs112TopLocationEdnGetParamsEdns = "NOT_SUPPORTED" +) + +type RadarAs112TopLocationEdnGetParamsDateRange string + +const ( + RadarAs112TopLocationEdnGetParamsDateRange1d RadarAs112TopLocationEdnGetParamsDateRange = "1d" + RadarAs112TopLocationEdnGetParamsDateRange2d RadarAs112TopLocationEdnGetParamsDateRange = "2d" + RadarAs112TopLocationEdnGetParamsDateRange7d RadarAs112TopLocationEdnGetParamsDateRange = "7d" + RadarAs112TopLocationEdnGetParamsDateRange14d RadarAs112TopLocationEdnGetParamsDateRange = "14d" + RadarAs112TopLocationEdnGetParamsDateRange28d RadarAs112TopLocationEdnGetParamsDateRange = "28d" + RadarAs112TopLocationEdnGetParamsDateRange12w RadarAs112TopLocationEdnGetParamsDateRange = "12w" + RadarAs112TopLocationEdnGetParamsDateRange24w RadarAs112TopLocationEdnGetParamsDateRange = "24w" + RadarAs112TopLocationEdnGetParamsDateRange52w RadarAs112TopLocationEdnGetParamsDateRange = "52w" + RadarAs112TopLocationEdnGetParamsDateRange1dControl RadarAs112TopLocationEdnGetParamsDateRange = "1dControl" + RadarAs112TopLocationEdnGetParamsDateRange2dControl RadarAs112TopLocationEdnGetParamsDateRange = "2dControl" + RadarAs112TopLocationEdnGetParamsDateRange7dControl RadarAs112TopLocationEdnGetParamsDateRange = "7dControl" + RadarAs112TopLocationEdnGetParamsDateRange14dControl RadarAs112TopLocationEdnGetParamsDateRange = "14dControl" + RadarAs112TopLocationEdnGetParamsDateRange28dControl RadarAs112TopLocationEdnGetParamsDateRange = "28dControl" + RadarAs112TopLocationEdnGetParamsDateRange12wControl RadarAs112TopLocationEdnGetParamsDateRange = "12wControl" + RadarAs112TopLocationEdnGetParamsDateRange24wControl RadarAs112TopLocationEdnGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TopLocationEdnGetParamsFormat string + +const ( + RadarAs112TopLocationEdnGetParamsFormatJson RadarAs112TopLocationEdnGetParamsFormat = "JSON" + RadarAs112TopLocationEdnGetParamsFormatCsv RadarAs112TopLocationEdnGetParamsFormat = "CSV" +) diff --git a/radaras112toplocationedn_test.go b/radaras112toplocationedn_test.go new file mode 100644 index 00000000000..2b93cec68bc --- /dev/null +++ b/radaras112toplocationedn_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TopLocationEdnGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Tops.Locations.Edns.Get( + context.TODO(), + cloudflare.RadarAs112TopLocationEdnGetParamsEdnsSupported, + cloudflare.RadarAs112TopLocationEdnGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TopLocationEdnGetParamsDateRange{cloudflare.RadarAs112TopLocationEdnGetParamsDateRange1d, cloudflare.RadarAs112TopLocationEdnGetParamsDateRange2d, cloudflare.RadarAs112TopLocationEdnGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TopLocationEdnGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/radaras112toplocationipversion.go b/radaras112toplocationipversion.go new file mode 100644 index 00000000000..f60bb1cc368 --- /dev/null +++ b/radaras112toplocationipversion.go @@ -0,0 +1,265 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAs112TopLocationIPVersionService 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 +// [NewRadarAs112TopLocationIPVersionService] method instead. +type RadarAs112TopLocationIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAs112TopLocationIPVersionService 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 NewRadarAs112TopLocationIPVersionService(opts ...option.RequestOption) (r *RadarAs112TopLocationIPVersionService) { + r = &RadarAs112TopLocationIPVersionService{} + r.Options = opts + return +} + +// Get the top locations by DNS queries IP version to AS112. +func (r *RadarAs112TopLocationIPVersionService) Get(ctx context.Context, ipVersion RadarAs112TopLocationIPVersionGetParamsIPVersion, query RadarAs112TopLocationIPVersionGetParams, opts ...option.RequestOption) (res *RadarAs112TopLocationIPVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/as112/top/locations/ip_version/%v", ipVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAs112TopLocationIPVersionGetResponse struct { + Result RadarAs112TopLocationIPVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAs112TopLocationIPVersionGetResponseJSON `json:"-"` +} + +// radarAs112TopLocationIPVersionGetResponseJSON contains the JSON metadata for the +// struct [RadarAs112TopLocationIPVersionGetResponse] +type radarAs112TopLocationIPVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationIPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationIPVersionGetResponseResult struct { + Meta RadarAs112TopLocationIPVersionGetResponseResultMeta `json:"meta,required"` + Top0 []RadarAs112TopLocationIPVersionGetResponseResultTop0 `json:"top_0,required"` + JSON radarAs112TopLocationIPVersionGetResponseResultJSON `json:"-"` +} + +// radarAs112TopLocationIPVersionGetResponseResultJSON contains the JSON metadata +// for the struct [RadarAs112TopLocationIPVersionGetResponseResult] +type radarAs112TopLocationIPVersionGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationIPVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationIPVersionGetResponseResultMeta struct { + DateRange []RadarAs112TopLocationIPVersionGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAs112TopLocationIPVersionGetResponseResultMetaJSON `json:"-"` +} + +// radarAs112TopLocationIPVersionGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAs112TopLocationIPVersionGetResponseResultMeta] +type radarAs112TopLocationIPVersionGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationIPVersionGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationIPVersionGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAs112TopLocationIPVersionGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAs112TopLocationIPVersionGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAs112TopLocationIPVersionGetResponseResultMetaDateRange] +type radarAs112TopLocationIPVersionGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationIPVersionGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfo] +type radarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation] +type radarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationIPVersionGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarAs112TopLocationIPVersionGetResponseResultTop0JSON `json:"-"` +} + +// radarAs112TopLocationIPVersionGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarAs112TopLocationIPVersionGetResponseResultTop0] +type radarAs112TopLocationIPVersionGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAs112TopLocationIPVersionGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAs112TopLocationIPVersionGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAs112TopLocationIPVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAs112TopLocationIPVersionGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAs112TopLocationIPVersionGetParams]'s query parameters +// as `url.Values`. +func (r RadarAs112TopLocationIPVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// IP Version. +type RadarAs112TopLocationIPVersionGetParamsIPVersion string + +const ( + RadarAs112TopLocationIPVersionGetParamsIPVersionIPv4 RadarAs112TopLocationIPVersionGetParamsIPVersion = "IPv4" + RadarAs112TopLocationIPVersionGetParamsIPVersionIPv6 RadarAs112TopLocationIPVersionGetParamsIPVersion = "IPv6" +) + +type RadarAs112TopLocationIPVersionGetParamsDateRange string + +const ( + RadarAs112TopLocationIPVersionGetParamsDateRange1d RadarAs112TopLocationIPVersionGetParamsDateRange = "1d" + RadarAs112TopLocationIPVersionGetParamsDateRange2d RadarAs112TopLocationIPVersionGetParamsDateRange = "2d" + RadarAs112TopLocationIPVersionGetParamsDateRange7d RadarAs112TopLocationIPVersionGetParamsDateRange = "7d" + RadarAs112TopLocationIPVersionGetParamsDateRange14d RadarAs112TopLocationIPVersionGetParamsDateRange = "14d" + RadarAs112TopLocationIPVersionGetParamsDateRange28d RadarAs112TopLocationIPVersionGetParamsDateRange = "28d" + RadarAs112TopLocationIPVersionGetParamsDateRange12w RadarAs112TopLocationIPVersionGetParamsDateRange = "12w" + RadarAs112TopLocationIPVersionGetParamsDateRange24w RadarAs112TopLocationIPVersionGetParamsDateRange = "24w" + RadarAs112TopLocationIPVersionGetParamsDateRange52w RadarAs112TopLocationIPVersionGetParamsDateRange = "52w" + RadarAs112TopLocationIPVersionGetParamsDateRange1dControl RadarAs112TopLocationIPVersionGetParamsDateRange = "1dControl" + RadarAs112TopLocationIPVersionGetParamsDateRange2dControl RadarAs112TopLocationIPVersionGetParamsDateRange = "2dControl" + RadarAs112TopLocationIPVersionGetParamsDateRange7dControl RadarAs112TopLocationIPVersionGetParamsDateRange = "7dControl" + RadarAs112TopLocationIPVersionGetParamsDateRange14dControl RadarAs112TopLocationIPVersionGetParamsDateRange = "14dControl" + RadarAs112TopLocationIPVersionGetParamsDateRange28dControl RadarAs112TopLocationIPVersionGetParamsDateRange = "28dControl" + RadarAs112TopLocationIPVersionGetParamsDateRange12wControl RadarAs112TopLocationIPVersionGetParamsDateRange = "12wControl" + RadarAs112TopLocationIPVersionGetParamsDateRange24wControl RadarAs112TopLocationIPVersionGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAs112TopLocationIPVersionGetParamsFormat string + +const ( + RadarAs112TopLocationIPVersionGetParamsFormatJson RadarAs112TopLocationIPVersionGetParamsFormat = "JSON" + RadarAs112TopLocationIPVersionGetParamsFormatCsv RadarAs112TopLocationIPVersionGetParamsFormat = "CSV" +) diff --git a/radaras112toplocationipversion_test.go b/radaras112toplocationipversion_test.go new file mode 100644 index 00000000000..7b8b45a1763 --- /dev/null +++ b/radaras112toplocationipversion_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAs112TopLocationIPVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.As112.Tops.Locations.IPVersions.Get( + context.TODO(), + cloudflare.RadarAs112TopLocationIPVersionGetParamsIPVersionIPv4, + cloudflare.RadarAs112TopLocationIPVersionGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAs112TopLocationIPVersionGetParamsDateRange{cloudflare.RadarAs112TopLocationIPVersionGetParamsDateRange1d, cloudflare.RadarAs112TopLocationIPVersionGetParamsDateRange2d, cloudflare.RadarAs112TopLocationIPVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAs112TopLocationIPVersionGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/radarattack.go b/radarattack.go new file mode 100644 index 00000000000..2421848ba89 --- /dev/null +++ b/radarattack.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackService 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 [NewRadarAttackService] method +// instead. +type RadarAttackService struct { + Options []option.RequestOption + Layer3 *RadarAttackLayer3Service + Layer7 *RadarAttackLayer7Service +} + +// NewRadarAttackService 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 NewRadarAttackService(opts ...option.RequestOption) (r *RadarAttackService) { + r = &RadarAttackService{} + r.Options = opts + r.Layer3 = NewRadarAttackLayer3Service(opts...) + r.Layer7 = NewRadarAttackLayer7Service(opts...) + return +} diff --git a/radarattacklayer3.go b/radarattacklayer3.go new file mode 100644 index 00000000000..aa0e1645513 --- /dev/null +++ b/radarattacklayer3.go @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3Service 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 [NewRadarAttackLayer3Service] method +// instead. +type RadarAttackLayer3Service struct { + Options []option.RequestOption + Attacks *RadarAttackLayer3AttackService + Industries *RadarAttackLayer3IndustryService + Locations *RadarAttackLayer3LocationService + Verticals *RadarAttackLayer3VerticalService + Summaries *RadarAttackLayer3SummaryService + Timeseries *RadarAttackLayer3TimeseryService + TimeseriesGroups *RadarAttackLayer3TimeseriesGroupService +} + +// NewRadarAttackLayer3Service 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 NewRadarAttackLayer3Service(opts ...option.RequestOption) (r *RadarAttackLayer3Service) { + r = &RadarAttackLayer3Service{} + r.Options = opts + r.Attacks = NewRadarAttackLayer3AttackService(opts...) + r.Industries = NewRadarAttackLayer3IndustryService(opts...) + r.Locations = NewRadarAttackLayer3LocationService(opts...) + r.Verticals = NewRadarAttackLayer3VerticalService(opts...) + r.Summaries = NewRadarAttackLayer3SummaryService(opts...) + r.Timeseries = NewRadarAttackLayer3TimeseryService(opts...) + r.TimeseriesGroups = NewRadarAttackLayer3TimeseriesGroupService(opts...) + return +} diff --git a/radarattacklayer3attack.go b/radarattacklayer3attack.go new file mode 100644 index 00000000000..c2860499834 --- /dev/null +++ b/radarattacklayer3attack.go @@ -0,0 +1,291 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3AttackService 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 +// [NewRadarAttackLayer3AttackService] method instead. +type RadarAttackLayer3AttackService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3AttackService 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 NewRadarAttackLayer3AttackService(opts ...option.RequestOption) (r *RadarAttackLayer3AttackService) { + r = &RadarAttackLayer3AttackService{} + r.Options = opts + return +} + +// Get the top attacks from origin to target location. Values are a percentage out +// of the total layer 3 attacks (with billing country). You can optionally limit +// the number of attacks per origin/target location (useful if all the top attacks +// are from or to the same location). +func (r *RadarAttackLayer3AttackService) List(ctx context.Context, query RadarAttackLayer3AttackListParams, opts ...option.RequestOption) (res *RadarAttackLayer3AttackListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/top/attacks" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3AttackListResponse struct { + Result RadarAttackLayer3AttackListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3AttackListResponseJSON `json:"-"` +} + +// radarAttackLayer3AttackListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer3AttackListResponse] +type radarAttackLayer3AttackListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3AttackListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3AttackListResponseResult struct { + Meta RadarAttackLayer3AttackListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer3AttackListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer3AttackListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3AttackListResponseResultJSON contains the JSON metadata for the +// struct [RadarAttackLayer3AttackListResponseResult] +type radarAttackLayer3AttackListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3AttackListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3AttackListResponseResultMeta struct { + DateRange []RadarAttackLayer3AttackListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer3AttackListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3AttackListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3AttackListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarAttackLayer3AttackListResponseResultMeta] +type radarAttackLayer3AttackListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3AttackListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3AttackListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3AttackListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3AttackListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarAttackLayer3AttackListResponseResultMetaDateRange] +type radarAttackLayer3AttackListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3AttackListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3AttackListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3AttackListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3AttackListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3AttackListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3AttackListResponseResultMetaConfidenceInfo] +type radarAttackLayer3AttackListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3AttackListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3AttackListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3AttackListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3AttackListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3AttackListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3AttackListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3AttackListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3AttackListResponseResultTop0 struct { + OriginCountryAlpha2 string `json:"originCountryAlpha2,required"` + OriginCountryName string `json:"originCountryName,required"` + Value string `json:"value,required"` + JSON radarAttackLayer3AttackListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer3AttackListResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarAttackLayer3AttackListResponseResultTop0] +type radarAttackLayer3AttackListResponseResultTop0JSON struct { + OriginCountryAlpha2 apijson.Field + OriginCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3AttackListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3AttackListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3AttackListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3AttackListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3AttackListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of attack origin/target location attack limits. Together with + // `limitPerLocation`, limits how many objects will be fetched per origin/target + // location. + LimitDirection param.Field[RadarAttackLayer3AttackListParamsLimitDirection] `query:"limitDirection"` + // Limit the number of attacks per origin/target (refer to `limitDirection` + // parameter) location. + LimitPerLocation param.Field[int64] `query:"limitPerLocation"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3AttackListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3AttackListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer3AttackListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3AttackListParamsDateRange string + +const ( + RadarAttackLayer3AttackListParamsDateRange1d RadarAttackLayer3AttackListParamsDateRange = "1d" + RadarAttackLayer3AttackListParamsDateRange2d RadarAttackLayer3AttackListParamsDateRange = "2d" + RadarAttackLayer3AttackListParamsDateRange7d RadarAttackLayer3AttackListParamsDateRange = "7d" + RadarAttackLayer3AttackListParamsDateRange14d RadarAttackLayer3AttackListParamsDateRange = "14d" + RadarAttackLayer3AttackListParamsDateRange28d RadarAttackLayer3AttackListParamsDateRange = "28d" + RadarAttackLayer3AttackListParamsDateRange12w RadarAttackLayer3AttackListParamsDateRange = "12w" + RadarAttackLayer3AttackListParamsDateRange24w RadarAttackLayer3AttackListParamsDateRange = "24w" + RadarAttackLayer3AttackListParamsDateRange52w RadarAttackLayer3AttackListParamsDateRange = "52w" + RadarAttackLayer3AttackListParamsDateRange1dControl RadarAttackLayer3AttackListParamsDateRange = "1dControl" + RadarAttackLayer3AttackListParamsDateRange2dControl RadarAttackLayer3AttackListParamsDateRange = "2dControl" + RadarAttackLayer3AttackListParamsDateRange7dControl RadarAttackLayer3AttackListParamsDateRange = "7dControl" + RadarAttackLayer3AttackListParamsDateRange14dControl RadarAttackLayer3AttackListParamsDateRange = "14dControl" + RadarAttackLayer3AttackListParamsDateRange28dControl RadarAttackLayer3AttackListParamsDateRange = "28dControl" + RadarAttackLayer3AttackListParamsDateRange12wControl RadarAttackLayer3AttackListParamsDateRange = "12wControl" + RadarAttackLayer3AttackListParamsDateRange24wControl RadarAttackLayer3AttackListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer3AttackListParamsFormat string + +const ( + RadarAttackLayer3AttackListParamsFormatJson RadarAttackLayer3AttackListParamsFormat = "JSON" + RadarAttackLayer3AttackListParamsFormatCsv RadarAttackLayer3AttackListParamsFormat = "CSV" +) + +type RadarAttackLayer3AttackListParamsIPVersion string + +const ( + RadarAttackLayer3AttackListParamsIPVersionIPv4 RadarAttackLayer3AttackListParamsIPVersion = "IPv4" + RadarAttackLayer3AttackListParamsIPVersionIPv6 RadarAttackLayer3AttackListParamsIPVersion = "IPv6" +) + +// Array of attack origin/target location attack limits. Together with +// `limitPerLocation`, limits how many objects will be fetched per origin/target +// location. +type RadarAttackLayer3AttackListParamsLimitDirection string + +const ( + RadarAttackLayer3AttackListParamsLimitDirectionOrigin RadarAttackLayer3AttackListParamsLimitDirection = "ORIGIN" + RadarAttackLayer3AttackListParamsLimitDirectionTarget RadarAttackLayer3AttackListParamsLimitDirection = "TARGET" +) + +type RadarAttackLayer3AttackListParamsProtocol string + +const ( + RadarAttackLayer3AttackListParamsProtocolUdp RadarAttackLayer3AttackListParamsProtocol = "UDP" + RadarAttackLayer3AttackListParamsProtocolTcp RadarAttackLayer3AttackListParamsProtocol = "TCP" + RadarAttackLayer3AttackListParamsProtocolIcmp RadarAttackLayer3AttackListParamsProtocol = "ICMP" + RadarAttackLayer3AttackListParamsProtocolGre RadarAttackLayer3AttackListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3attack_test.go b/radarattacklayer3attack_test.go new file mode 100644 index 00000000000..bc5445a2a13 --- /dev/null +++ b/radarattacklayer3attack_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3AttackListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Attacks.List(context.TODO(), cloudflare.RadarAttackLayer3AttackListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3AttackListParamsDateRange{cloudflare.RadarAttackLayer3AttackListParamsDateRange1d, cloudflare.RadarAttackLayer3AttackListParamsDateRange2d, cloudflare.RadarAttackLayer3AttackListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer3AttackListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3AttackListParamsIPVersion{cloudflare.RadarAttackLayer3AttackListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3AttackListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + LimitDirection: cloudflare.F(cloudflare.RadarAttackLayer3AttackListParamsLimitDirectionOrigin), + LimitPerLocation: cloudflare.F(int64(10)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3AttackListParamsProtocol{cloudflare.RadarAttackLayer3AttackListParamsProtocolUdp, cloudflare.RadarAttackLayer3AttackListParamsProtocolTcp, cloudflare.RadarAttackLayer3AttackListParamsProtocolIcmp}), + }) + 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/radarattacklayer3industry.go b/radarattacklayer3industry.go new file mode 100644 index 00000000000..d22b8f073fa --- /dev/null +++ b/radarattacklayer3industry.go @@ -0,0 +1,270 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3IndustryService 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 +// [NewRadarAttackLayer3IndustryService] method instead. +type RadarAttackLayer3IndustryService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3IndustryService 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 NewRadarAttackLayer3IndustryService(opts ...option.RequestOption) (r *RadarAttackLayer3IndustryService) { + r = &RadarAttackLayer3IndustryService{} + r.Options = opts + return +} + +// Get the Industry of attacks. +func (r *RadarAttackLayer3IndustryService) List(ctx context.Context, query RadarAttackLayer3IndustryListParams, opts ...option.RequestOption) (res *RadarAttackLayer3IndustryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/top/industry" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3IndustryListResponse struct { + Result RadarAttackLayer3IndustryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3IndustryListResponseJSON `json:"-"` +} + +// radarAttackLayer3IndustryListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer3IndustryListResponse] +type radarAttackLayer3IndustryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3IndustryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3IndustryListResponseResult struct { + Meta RadarAttackLayer3IndustryListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer3IndustryListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer3IndustryListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3IndustryListResponseResultJSON contains the JSON metadata for +// the struct [RadarAttackLayer3IndustryListResponseResult] +type radarAttackLayer3IndustryListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3IndustryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3IndustryListResponseResultMeta struct { + DateRange []RadarAttackLayer3IndustryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3IndustryListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3IndustryListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAttackLayer3IndustryListResponseResultMeta] +type radarAttackLayer3IndustryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3IndustryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3IndustryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3IndustryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3IndustryListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3IndustryListResponseResultMetaDateRange] +type radarAttackLayer3IndustryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3IndustryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3IndustryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3IndustryListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfo] +type radarAttackLayer3IndustryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3IndustryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3IndustryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3IndustryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3IndustryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3IndustryListResponseResultTop0 struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON radarAttackLayer3IndustryListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer3IndustryListResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarAttackLayer3IndustryListResponseResultTop0] +type radarAttackLayer3IndustryListResponseResultTop0JSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3IndustryListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3IndustryListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3IndustryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3IndustryListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3IndustryListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3IndustryListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3IndustryListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer3IndustryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3IndustryListParamsDateRange string + +const ( + RadarAttackLayer3IndustryListParamsDateRange1d RadarAttackLayer3IndustryListParamsDateRange = "1d" + RadarAttackLayer3IndustryListParamsDateRange2d RadarAttackLayer3IndustryListParamsDateRange = "2d" + RadarAttackLayer3IndustryListParamsDateRange7d RadarAttackLayer3IndustryListParamsDateRange = "7d" + RadarAttackLayer3IndustryListParamsDateRange14d RadarAttackLayer3IndustryListParamsDateRange = "14d" + RadarAttackLayer3IndustryListParamsDateRange28d RadarAttackLayer3IndustryListParamsDateRange = "28d" + RadarAttackLayer3IndustryListParamsDateRange12w RadarAttackLayer3IndustryListParamsDateRange = "12w" + RadarAttackLayer3IndustryListParamsDateRange24w RadarAttackLayer3IndustryListParamsDateRange = "24w" + RadarAttackLayer3IndustryListParamsDateRange52w RadarAttackLayer3IndustryListParamsDateRange = "52w" + RadarAttackLayer3IndustryListParamsDateRange1dControl RadarAttackLayer3IndustryListParamsDateRange = "1dControl" + RadarAttackLayer3IndustryListParamsDateRange2dControl RadarAttackLayer3IndustryListParamsDateRange = "2dControl" + RadarAttackLayer3IndustryListParamsDateRange7dControl RadarAttackLayer3IndustryListParamsDateRange = "7dControl" + RadarAttackLayer3IndustryListParamsDateRange14dControl RadarAttackLayer3IndustryListParamsDateRange = "14dControl" + RadarAttackLayer3IndustryListParamsDateRange28dControl RadarAttackLayer3IndustryListParamsDateRange = "28dControl" + RadarAttackLayer3IndustryListParamsDateRange12wControl RadarAttackLayer3IndustryListParamsDateRange = "12wControl" + RadarAttackLayer3IndustryListParamsDateRange24wControl RadarAttackLayer3IndustryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer3IndustryListParamsFormat string + +const ( + RadarAttackLayer3IndustryListParamsFormatJson RadarAttackLayer3IndustryListParamsFormat = "JSON" + RadarAttackLayer3IndustryListParamsFormatCsv RadarAttackLayer3IndustryListParamsFormat = "CSV" +) + +type RadarAttackLayer3IndustryListParamsIPVersion string + +const ( + RadarAttackLayer3IndustryListParamsIPVersionIPv4 RadarAttackLayer3IndustryListParamsIPVersion = "IPv4" + RadarAttackLayer3IndustryListParamsIPVersionIPv6 RadarAttackLayer3IndustryListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer3IndustryListParamsProtocol string + +const ( + RadarAttackLayer3IndustryListParamsProtocolUdp RadarAttackLayer3IndustryListParamsProtocol = "UDP" + RadarAttackLayer3IndustryListParamsProtocolTcp RadarAttackLayer3IndustryListParamsProtocol = "TCP" + RadarAttackLayer3IndustryListParamsProtocolIcmp RadarAttackLayer3IndustryListParamsProtocol = "ICMP" + RadarAttackLayer3IndustryListParamsProtocolGre RadarAttackLayer3IndustryListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3industry_test.go b/radarattacklayer3industry_test.go new file mode 100644 index 00000000000..d9fc4f3015f --- /dev/null +++ b/radarattacklayer3industry_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3IndustryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Industries.List(context.TODO(), cloudflare.RadarAttackLayer3IndustryListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3IndustryListParamsDateRange{cloudflare.RadarAttackLayer3IndustryListParamsDateRange1d, cloudflare.RadarAttackLayer3IndustryListParamsDateRange2d, cloudflare.RadarAttackLayer3IndustryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer3IndustryListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3IndustryListParamsIPVersion{cloudflare.RadarAttackLayer3IndustryListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3IndustryListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3IndustryListParamsProtocol{cloudflare.RadarAttackLayer3IndustryListParamsProtocolUdp, cloudflare.RadarAttackLayer3IndustryListParamsProtocolTcp, cloudflare.RadarAttackLayer3IndustryListParamsProtocolIcmp}), + }) + 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/radarattacklayer3location.go b/radarattacklayer3location.go new file mode 100644 index 00000000000..ae787efdd02 --- /dev/null +++ b/radarattacklayer3location.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3LocationService 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 +// [NewRadarAttackLayer3LocationService] method instead. +type RadarAttackLayer3LocationService struct { + Options []option.RequestOption + Origin *RadarAttackLayer3LocationOriginService + Target *RadarAttackLayer3LocationTargetService +} + +// NewRadarAttackLayer3LocationService 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 NewRadarAttackLayer3LocationService(opts ...option.RequestOption) (r *RadarAttackLayer3LocationService) { + r = &RadarAttackLayer3LocationService{} + r.Options = opts + r.Origin = NewRadarAttackLayer3LocationOriginService(opts...) + r.Target = NewRadarAttackLayer3LocationTargetService(opts...) + return +} diff --git a/radarattacklayer3locationorigin.go b/radarattacklayer3locationorigin.go new file mode 100644 index 00000000000..e21a816ff26 --- /dev/null +++ b/radarattacklayer3locationorigin.go @@ -0,0 +1,274 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3LocationOriginService 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 +// [NewRadarAttackLayer3LocationOriginService] method instead. +type RadarAttackLayer3LocationOriginService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3LocationOriginService 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 NewRadarAttackLayer3LocationOriginService(opts ...option.RequestOption) (r *RadarAttackLayer3LocationOriginService) { + r = &RadarAttackLayer3LocationOriginService{} + r.Options = opts + return +} + +// Get the origin locations of attacks. +func (r *RadarAttackLayer3LocationOriginService) List(ctx context.Context, query RadarAttackLayer3LocationOriginListParams, opts ...option.RequestOption) (res *RadarAttackLayer3LocationOriginListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/top/locations/origin" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3LocationOriginListResponse struct { + Result RadarAttackLayer3LocationOriginListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3LocationOriginListResponseJSON `json:"-"` +} + +// radarAttackLayer3LocationOriginListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3LocationOriginListResponse] +type radarAttackLayer3LocationOriginListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationOriginListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationOriginListResponseResult struct { + Meta RadarAttackLayer3LocationOriginListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer3LocationOriginListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer3LocationOriginListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3LocationOriginListResponseResultJSON contains the JSON metadata +// for the struct [RadarAttackLayer3LocationOriginListResponseResult] +type radarAttackLayer3LocationOriginListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationOriginListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationOriginListResponseResultMeta struct { + DateRange []RadarAttackLayer3LocationOriginListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3LocationOriginListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3LocationOriginListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer3LocationOriginListResponseResultMeta] +type radarAttackLayer3LocationOriginListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationOriginListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationOriginListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3LocationOriginListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3LocationOriginListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3LocationOriginListResponseResultMetaDateRange] +type radarAttackLayer3LocationOriginListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationOriginListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfo] +type radarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationOriginListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationOriginListResponseResultTop0 struct { + OriginCountryAlpha2 string `json:"originCountryAlpha2,required"` + OriginCountryName string `json:"originCountryName,required"` + Rank float64 `json:"rank,required"` + Value string `json:"value,required"` + JSON radarAttackLayer3LocationOriginListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer3LocationOriginListResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarAttackLayer3LocationOriginListResponseResultTop0] +type radarAttackLayer3LocationOriginListResponseResultTop0JSON struct { + OriginCountryAlpha2 apijson.Field + OriginCountryName apijson.Field + Rank apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationOriginListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationOriginListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3LocationOriginListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3LocationOriginListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3LocationOriginListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3LocationOriginListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3LocationOriginListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3LocationOriginListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3LocationOriginListParamsDateRange string + +const ( + RadarAttackLayer3LocationOriginListParamsDateRange1d RadarAttackLayer3LocationOriginListParamsDateRange = "1d" + RadarAttackLayer3LocationOriginListParamsDateRange2d RadarAttackLayer3LocationOriginListParamsDateRange = "2d" + RadarAttackLayer3LocationOriginListParamsDateRange7d RadarAttackLayer3LocationOriginListParamsDateRange = "7d" + RadarAttackLayer3LocationOriginListParamsDateRange14d RadarAttackLayer3LocationOriginListParamsDateRange = "14d" + RadarAttackLayer3LocationOriginListParamsDateRange28d RadarAttackLayer3LocationOriginListParamsDateRange = "28d" + RadarAttackLayer3LocationOriginListParamsDateRange12w RadarAttackLayer3LocationOriginListParamsDateRange = "12w" + RadarAttackLayer3LocationOriginListParamsDateRange24w RadarAttackLayer3LocationOriginListParamsDateRange = "24w" + RadarAttackLayer3LocationOriginListParamsDateRange52w RadarAttackLayer3LocationOriginListParamsDateRange = "52w" + RadarAttackLayer3LocationOriginListParamsDateRange1dControl RadarAttackLayer3LocationOriginListParamsDateRange = "1dControl" + RadarAttackLayer3LocationOriginListParamsDateRange2dControl RadarAttackLayer3LocationOriginListParamsDateRange = "2dControl" + RadarAttackLayer3LocationOriginListParamsDateRange7dControl RadarAttackLayer3LocationOriginListParamsDateRange = "7dControl" + RadarAttackLayer3LocationOriginListParamsDateRange14dControl RadarAttackLayer3LocationOriginListParamsDateRange = "14dControl" + RadarAttackLayer3LocationOriginListParamsDateRange28dControl RadarAttackLayer3LocationOriginListParamsDateRange = "28dControl" + RadarAttackLayer3LocationOriginListParamsDateRange12wControl RadarAttackLayer3LocationOriginListParamsDateRange = "12wControl" + RadarAttackLayer3LocationOriginListParamsDateRange24wControl RadarAttackLayer3LocationOriginListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer3LocationOriginListParamsFormat string + +const ( + RadarAttackLayer3LocationOriginListParamsFormatJson RadarAttackLayer3LocationOriginListParamsFormat = "JSON" + RadarAttackLayer3LocationOriginListParamsFormatCsv RadarAttackLayer3LocationOriginListParamsFormat = "CSV" +) + +type RadarAttackLayer3LocationOriginListParamsIPVersion string + +const ( + RadarAttackLayer3LocationOriginListParamsIPVersionIPv4 RadarAttackLayer3LocationOriginListParamsIPVersion = "IPv4" + RadarAttackLayer3LocationOriginListParamsIPVersionIPv6 RadarAttackLayer3LocationOriginListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer3LocationOriginListParamsProtocol string + +const ( + RadarAttackLayer3LocationOriginListParamsProtocolUdp RadarAttackLayer3LocationOriginListParamsProtocol = "UDP" + RadarAttackLayer3LocationOriginListParamsProtocolTcp RadarAttackLayer3LocationOriginListParamsProtocol = "TCP" + RadarAttackLayer3LocationOriginListParamsProtocolIcmp RadarAttackLayer3LocationOriginListParamsProtocol = "ICMP" + RadarAttackLayer3LocationOriginListParamsProtocolGre RadarAttackLayer3LocationOriginListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3locationorigin_test.go b/radarattacklayer3locationorigin_test.go new file mode 100644 index 00000000000..1a71fefa8eb --- /dev/null +++ b/radarattacklayer3locationorigin_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3LocationOriginListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Locations.Origin.List(context.TODO(), cloudflare.RadarAttackLayer3LocationOriginListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3LocationOriginListParamsDateRange{cloudflare.RadarAttackLayer3LocationOriginListParamsDateRange1d, cloudflare.RadarAttackLayer3LocationOriginListParamsDateRange2d, cloudflare.RadarAttackLayer3LocationOriginListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer3LocationOriginListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3LocationOriginListParamsIPVersion{cloudflare.RadarAttackLayer3LocationOriginListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3LocationOriginListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3LocationOriginListParamsProtocol{cloudflare.RadarAttackLayer3LocationOriginListParamsProtocolUdp, cloudflare.RadarAttackLayer3LocationOriginListParamsProtocolTcp, cloudflare.RadarAttackLayer3LocationOriginListParamsProtocolIcmp}), + }) + 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/radarattacklayer3locationtarget.go b/radarattacklayer3locationtarget.go new file mode 100644 index 00000000000..9755ce28ec4 --- /dev/null +++ b/radarattacklayer3locationtarget.go @@ -0,0 +1,274 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3LocationTargetService 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 +// [NewRadarAttackLayer3LocationTargetService] method instead. +type RadarAttackLayer3LocationTargetService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3LocationTargetService 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 NewRadarAttackLayer3LocationTargetService(opts ...option.RequestOption) (r *RadarAttackLayer3LocationTargetService) { + r = &RadarAttackLayer3LocationTargetService{} + r.Options = opts + return +} + +// Get the target locations of attacks. +func (r *RadarAttackLayer3LocationTargetService) List(ctx context.Context, query RadarAttackLayer3LocationTargetListParams, opts ...option.RequestOption) (res *RadarAttackLayer3LocationTargetListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/top/locations/target" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3LocationTargetListResponse struct { + Result RadarAttackLayer3LocationTargetListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3LocationTargetListResponseJSON `json:"-"` +} + +// radarAttackLayer3LocationTargetListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3LocationTargetListResponse] +type radarAttackLayer3LocationTargetListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationTargetListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationTargetListResponseResult struct { + Meta RadarAttackLayer3LocationTargetListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer3LocationTargetListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer3LocationTargetListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3LocationTargetListResponseResultJSON contains the JSON metadata +// for the struct [RadarAttackLayer3LocationTargetListResponseResult] +type radarAttackLayer3LocationTargetListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationTargetListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationTargetListResponseResultMeta struct { + DateRange []RadarAttackLayer3LocationTargetListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3LocationTargetListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3LocationTargetListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer3LocationTargetListResponseResultMeta] +type radarAttackLayer3LocationTargetListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationTargetListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationTargetListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3LocationTargetListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3LocationTargetListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3LocationTargetListResponseResultMetaDateRange] +type radarAttackLayer3LocationTargetListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationTargetListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfo] +type radarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationTargetListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationTargetListResponseResultTop0 struct { + Rank float64 `json:"rank,required"` + TargetCountryAlpha2 string `json:"targetCountryAlpha2,required"` + TargetCountryName string `json:"targetCountryName,required"` + Value string `json:"value,required"` + JSON radarAttackLayer3LocationTargetListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer3LocationTargetListResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarAttackLayer3LocationTargetListResponseResultTop0] +type radarAttackLayer3LocationTargetListResponseResultTop0JSON struct { + Rank apijson.Field + TargetCountryAlpha2 apijson.Field + TargetCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3LocationTargetListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3LocationTargetListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3LocationTargetListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3LocationTargetListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3LocationTargetListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3LocationTargetListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3LocationTargetListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3LocationTargetListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3LocationTargetListParamsDateRange string + +const ( + RadarAttackLayer3LocationTargetListParamsDateRange1d RadarAttackLayer3LocationTargetListParamsDateRange = "1d" + RadarAttackLayer3LocationTargetListParamsDateRange2d RadarAttackLayer3LocationTargetListParamsDateRange = "2d" + RadarAttackLayer3LocationTargetListParamsDateRange7d RadarAttackLayer3LocationTargetListParamsDateRange = "7d" + RadarAttackLayer3LocationTargetListParamsDateRange14d RadarAttackLayer3LocationTargetListParamsDateRange = "14d" + RadarAttackLayer3LocationTargetListParamsDateRange28d RadarAttackLayer3LocationTargetListParamsDateRange = "28d" + RadarAttackLayer3LocationTargetListParamsDateRange12w RadarAttackLayer3LocationTargetListParamsDateRange = "12w" + RadarAttackLayer3LocationTargetListParamsDateRange24w RadarAttackLayer3LocationTargetListParamsDateRange = "24w" + RadarAttackLayer3LocationTargetListParamsDateRange52w RadarAttackLayer3LocationTargetListParamsDateRange = "52w" + RadarAttackLayer3LocationTargetListParamsDateRange1dControl RadarAttackLayer3LocationTargetListParamsDateRange = "1dControl" + RadarAttackLayer3LocationTargetListParamsDateRange2dControl RadarAttackLayer3LocationTargetListParamsDateRange = "2dControl" + RadarAttackLayer3LocationTargetListParamsDateRange7dControl RadarAttackLayer3LocationTargetListParamsDateRange = "7dControl" + RadarAttackLayer3LocationTargetListParamsDateRange14dControl RadarAttackLayer3LocationTargetListParamsDateRange = "14dControl" + RadarAttackLayer3LocationTargetListParamsDateRange28dControl RadarAttackLayer3LocationTargetListParamsDateRange = "28dControl" + RadarAttackLayer3LocationTargetListParamsDateRange12wControl RadarAttackLayer3LocationTargetListParamsDateRange = "12wControl" + RadarAttackLayer3LocationTargetListParamsDateRange24wControl RadarAttackLayer3LocationTargetListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer3LocationTargetListParamsFormat string + +const ( + RadarAttackLayer3LocationTargetListParamsFormatJson RadarAttackLayer3LocationTargetListParamsFormat = "JSON" + RadarAttackLayer3LocationTargetListParamsFormatCsv RadarAttackLayer3LocationTargetListParamsFormat = "CSV" +) + +type RadarAttackLayer3LocationTargetListParamsIPVersion string + +const ( + RadarAttackLayer3LocationTargetListParamsIPVersionIPv4 RadarAttackLayer3LocationTargetListParamsIPVersion = "IPv4" + RadarAttackLayer3LocationTargetListParamsIPVersionIPv6 RadarAttackLayer3LocationTargetListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer3LocationTargetListParamsProtocol string + +const ( + RadarAttackLayer3LocationTargetListParamsProtocolUdp RadarAttackLayer3LocationTargetListParamsProtocol = "UDP" + RadarAttackLayer3LocationTargetListParamsProtocolTcp RadarAttackLayer3LocationTargetListParamsProtocol = "TCP" + RadarAttackLayer3LocationTargetListParamsProtocolIcmp RadarAttackLayer3LocationTargetListParamsProtocol = "ICMP" + RadarAttackLayer3LocationTargetListParamsProtocolGre RadarAttackLayer3LocationTargetListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3locationtarget_test.go b/radarattacklayer3locationtarget_test.go new file mode 100644 index 00000000000..99122539a83 --- /dev/null +++ b/radarattacklayer3locationtarget_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3LocationTargetListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Locations.Target.List(context.TODO(), cloudflare.RadarAttackLayer3LocationTargetListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3LocationTargetListParamsDateRange{cloudflare.RadarAttackLayer3LocationTargetListParamsDateRange1d, cloudflare.RadarAttackLayer3LocationTargetListParamsDateRange2d, cloudflare.RadarAttackLayer3LocationTargetListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer3LocationTargetListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3LocationTargetListParamsIPVersion{cloudflare.RadarAttackLayer3LocationTargetListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3LocationTargetListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3LocationTargetListParamsProtocol{cloudflare.RadarAttackLayer3LocationTargetListParamsProtocolUdp, cloudflare.RadarAttackLayer3LocationTargetListParamsProtocolTcp, cloudflare.RadarAttackLayer3LocationTargetListParamsProtocolIcmp}), + }) + 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/radarattacklayer3summary.go b/radarattacklayer3summary.go new file mode 100644 index 00000000000..d8127d89eb1 --- /dev/null +++ b/radarattacklayer3summary.go @@ -0,0 +1,265 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3SummaryService 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 +// [NewRadarAttackLayer3SummaryService] method instead. +type RadarAttackLayer3SummaryService struct { + Options []option.RequestOption + Bitrate *RadarAttackLayer3SummaryBitrateService + Durations *RadarAttackLayer3SummaryDurationService + IPVersions *RadarAttackLayer3SummaryIPVersionService + Protocols *RadarAttackLayer3SummaryProtocolService + Vectors *RadarAttackLayer3SummaryVectorService +} + +// NewRadarAttackLayer3SummaryService 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 NewRadarAttackLayer3SummaryService(opts ...option.RequestOption) (r *RadarAttackLayer3SummaryService) { + r = &RadarAttackLayer3SummaryService{} + r.Options = opts + r.Bitrate = NewRadarAttackLayer3SummaryBitrateService(opts...) + r.Durations = NewRadarAttackLayer3SummaryDurationService(opts...) + r.IPVersions = NewRadarAttackLayer3SummaryIPVersionService(opts...) + r.Protocols = NewRadarAttackLayer3SummaryProtocolService(opts...) + r.Vectors = NewRadarAttackLayer3SummaryVectorService(opts...) + return +} + +// Percentage distribution of network protocols in layer 3/4 attacks over a given +// time period. +func (r *RadarAttackLayer3SummaryService) List(ctx context.Context, query RadarAttackLayer3SummaryListParams, opts ...option.RequestOption) (res *RadarAttackLayer3SummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/summary" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3SummaryListResponse struct { + Result RadarAttackLayer3SummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3SummaryListResponseJSON `json:"-"` +} + +// radarAttackLayer3SummaryListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer3SummaryListResponse] +type radarAttackLayer3SummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryListResponseResult struct { + Meta RadarAttackLayer3SummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer3SummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer3SummaryListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3SummaryListResponseResultJSON contains the JSON metadata for +// the struct [RadarAttackLayer3SummaryListResponseResult] +type radarAttackLayer3SummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryListResponseResultMeta struct { + DateRange []RadarAttackLayer3SummaryListResponseResultMetaDateRange `json:"dateRange,required"` + ConfidenceInfo RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3SummaryListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3SummaryListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAttackLayer3SummaryListResponseResultMeta] +type radarAttackLayer3SummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3SummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3SummaryListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3SummaryListResponseResultMetaDateRange] +type radarAttackLayer3SummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3SummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3SummaryListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfo] +type radarAttackLayer3SummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3SummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3SummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3SummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryListResponseResultSummary0 struct { + Gre string `json:"gre,required"` + Icmp string `json:"icmp,required"` + Tcp string `json:"tcp,required"` + Udp string `json:"udp,required"` + JSON radarAttackLayer3SummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer3SummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryListResponseResultSummary0] +type radarAttackLayer3SummaryListResponseResultSummary0JSON struct { + Gre apijson.Field + Icmp apijson.Field + Tcp apijson.Field + Udp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3SummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3SummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer3SummaryListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer3SummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3SummaryListParamsDateRange string + +const ( + RadarAttackLayer3SummaryListParamsDateRange1d RadarAttackLayer3SummaryListParamsDateRange = "1d" + RadarAttackLayer3SummaryListParamsDateRange2d RadarAttackLayer3SummaryListParamsDateRange = "2d" + RadarAttackLayer3SummaryListParamsDateRange7d RadarAttackLayer3SummaryListParamsDateRange = "7d" + RadarAttackLayer3SummaryListParamsDateRange14d RadarAttackLayer3SummaryListParamsDateRange = "14d" + RadarAttackLayer3SummaryListParamsDateRange28d RadarAttackLayer3SummaryListParamsDateRange = "28d" + RadarAttackLayer3SummaryListParamsDateRange12w RadarAttackLayer3SummaryListParamsDateRange = "12w" + RadarAttackLayer3SummaryListParamsDateRange24w RadarAttackLayer3SummaryListParamsDateRange = "24w" + RadarAttackLayer3SummaryListParamsDateRange52w RadarAttackLayer3SummaryListParamsDateRange = "52w" + RadarAttackLayer3SummaryListParamsDateRange1dControl RadarAttackLayer3SummaryListParamsDateRange = "1dControl" + RadarAttackLayer3SummaryListParamsDateRange2dControl RadarAttackLayer3SummaryListParamsDateRange = "2dControl" + RadarAttackLayer3SummaryListParamsDateRange7dControl RadarAttackLayer3SummaryListParamsDateRange = "7dControl" + RadarAttackLayer3SummaryListParamsDateRange14dControl RadarAttackLayer3SummaryListParamsDateRange = "14dControl" + RadarAttackLayer3SummaryListParamsDateRange28dControl RadarAttackLayer3SummaryListParamsDateRange = "28dControl" + RadarAttackLayer3SummaryListParamsDateRange12wControl RadarAttackLayer3SummaryListParamsDateRange = "12wControl" + RadarAttackLayer3SummaryListParamsDateRange24wControl RadarAttackLayer3SummaryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer3SummaryListParamsFormat string + +const ( + RadarAttackLayer3SummaryListParamsFormatJson RadarAttackLayer3SummaryListParamsFormat = "JSON" + RadarAttackLayer3SummaryListParamsFormatCsv RadarAttackLayer3SummaryListParamsFormat = "CSV" +) diff --git a/radarattacklayer3summary_test.go b/radarattacklayer3summary_test.go new file mode 100644 index 00000000000..dde9f05f9d0 --- /dev/null +++ b/radarattacklayer3summary_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3SummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Summaries.List(context.TODO(), cloudflare.RadarAttackLayer3SummaryListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryListParamsDateRange{cloudflare.RadarAttackLayer3SummaryListParamsDateRange1d, cloudflare.RadarAttackLayer3SummaryListParamsDateRange2d, cloudflare.RadarAttackLayer3SummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer3SummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer3summarybitrate.go b/radarattacklayer3summarybitrate.go new file mode 100644 index 00000000000..5924e9b2861 --- /dev/null +++ b/radarattacklayer3summarybitrate.go @@ -0,0 +1,289 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3SummaryBitrateService 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 +// [NewRadarAttackLayer3SummaryBitrateService] method instead. +type RadarAttackLayer3SummaryBitrateService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3SummaryBitrateService 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 NewRadarAttackLayer3SummaryBitrateService(opts ...option.RequestOption) (r *RadarAttackLayer3SummaryBitrateService) { + r = &RadarAttackLayer3SummaryBitrateService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by bitrate. +func (r *RadarAttackLayer3SummaryBitrateService) Get(ctx context.Context, query RadarAttackLayer3SummaryBitrateGetParams, opts ...option.RequestOption) (res *RadarAttackLayer3SummaryBitrateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/summary/bitrate" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3SummaryBitrateGetResponse struct { + Result RadarAttackLayer3SummaryBitrateGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3SummaryBitrateGetResponseJSON `json:"-"` +} + +// radarAttackLayer3SummaryBitrateGetResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3SummaryBitrateGetResponse] +type radarAttackLayer3SummaryBitrateGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryBitrateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryBitrateGetResponseResult struct { + Meta RadarAttackLayer3SummaryBitrateGetResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer3SummaryBitrateGetResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer3SummaryBitrateGetResponseResultJSON `json:"-"` +} + +// radarAttackLayer3SummaryBitrateGetResponseResultJSON contains the JSON metadata +// for the struct [RadarAttackLayer3SummaryBitrateGetResponseResult] +type radarAttackLayer3SummaryBitrateGetResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryBitrateGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryBitrateGetResponseResultMeta struct { + DateRange []RadarAttackLayer3SummaryBitrateGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3SummaryBitrateGetResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3SummaryBitrateGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryBitrateGetResponseResultMeta] +type radarAttackLayer3SummaryBitrateGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryBitrateGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryBitrateGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3SummaryBitrateGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3SummaryBitrateGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3SummaryBitrateGetResponseResultMetaDateRange] +type radarAttackLayer3SummaryBitrateGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryBitrateGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfo] +type radarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryBitrateGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryBitrateGetResponseResultSummary0 struct { + Number1GbpsTo10Gbps string `json:"_1_GBPS_TO_10_GBPS,required"` + Number10GbpsTo100Gbps string `json:"_10_GBPS_TO_100_GBPS,required"` + Number500MbpsTo1Gbps string `json:"_500_MBPS_TO_1_GBPS,required"` + Over100Gbps string `json:"OVER_100_GBPS,required"` + Under500Mbps string `json:"UNDER_500_MBPS,required"` + JSON radarAttackLayer3SummaryBitrateGetResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer3SummaryBitrateGetResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3SummaryBitrateGetResponseResultSummary0] +type radarAttackLayer3SummaryBitrateGetResponseResultSummary0JSON struct { + Number1GbpsTo10Gbps apijson.Field + Number10GbpsTo100Gbps apijson.Field + Number500MbpsTo1Gbps apijson.Field + Over100Gbps apijson.Field + Under500Mbps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryBitrateGetResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryBitrateGetParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3SummaryBitrateGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3SummaryBitrateGetParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3SummaryBitrateGetParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3SummaryBitrateGetParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3SummaryBitrateGetParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3SummaryBitrateGetParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3SummaryBitrateGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3SummaryBitrateGetParamsDateRange string + +const ( + RadarAttackLayer3SummaryBitrateGetParamsDateRange1d RadarAttackLayer3SummaryBitrateGetParamsDateRange = "1d" + RadarAttackLayer3SummaryBitrateGetParamsDateRange2d RadarAttackLayer3SummaryBitrateGetParamsDateRange = "2d" + RadarAttackLayer3SummaryBitrateGetParamsDateRange7d RadarAttackLayer3SummaryBitrateGetParamsDateRange = "7d" + RadarAttackLayer3SummaryBitrateGetParamsDateRange14d RadarAttackLayer3SummaryBitrateGetParamsDateRange = "14d" + RadarAttackLayer3SummaryBitrateGetParamsDateRange28d RadarAttackLayer3SummaryBitrateGetParamsDateRange = "28d" + RadarAttackLayer3SummaryBitrateGetParamsDateRange12w RadarAttackLayer3SummaryBitrateGetParamsDateRange = "12w" + RadarAttackLayer3SummaryBitrateGetParamsDateRange24w RadarAttackLayer3SummaryBitrateGetParamsDateRange = "24w" + RadarAttackLayer3SummaryBitrateGetParamsDateRange52w RadarAttackLayer3SummaryBitrateGetParamsDateRange = "52w" + RadarAttackLayer3SummaryBitrateGetParamsDateRange1dControl RadarAttackLayer3SummaryBitrateGetParamsDateRange = "1dControl" + RadarAttackLayer3SummaryBitrateGetParamsDateRange2dControl RadarAttackLayer3SummaryBitrateGetParamsDateRange = "2dControl" + RadarAttackLayer3SummaryBitrateGetParamsDateRange7dControl RadarAttackLayer3SummaryBitrateGetParamsDateRange = "7dControl" + RadarAttackLayer3SummaryBitrateGetParamsDateRange14dControl RadarAttackLayer3SummaryBitrateGetParamsDateRange = "14dControl" + RadarAttackLayer3SummaryBitrateGetParamsDateRange28dControl RadarAttackLayer3SummaryBitrateGetParamsDateRange = "28dControl" + RadarAttackLayer3SummaryBitrateGetParamsDateRange12wControl RadarAttackLayer3SummaryBitrateGetParamsDateRange = "12wControl" + RadarAttackLayer3SummaryBitrateGetParamsDateRange24wControl RadarAttackLayer3SummaryBitrateGetParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3SummaryBitrateGetParamsDirection string + +const ( + RadarAttackLayer3SummaryBitrateGetParamsDirectionOrigin RadarAttackLayer3SummaryBitrateGetParamsDirection = "ORIGIN" + RadarAttackLayer3SummaryBitrateGetParamsDirectionTarget RadarAttackLayer3SummaryBitrateGetParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3SummaryBitrateGetParamsFormat string + +const ( + RadarAttackLayer3SummaryBitrateGetParamsFormatJson RadarAttackLayer3SummaryBitrateGetParamsFormat = "JSON" + RadarAttackLayer3SummaryBitrateGetParamsFormatCsv RadarAttackLayer3SummaryBitrateGetParamsFormat = "CSV" +) + +type RadarAttackLayer3SummaryBitrateGetParamsIPVersion string + +const ( + RadarAttackLayer3SummaryBitrateGetParamsIPVersionIPv4 RadarAttackLayer3SummaryBitrateGetParamsIPVersion = "IPv4" + RadarAttackLayer3SummaryBitrateGetParamsIPVersionIPv6 RadarAttackLayer3SummaryBitrateGetParamsIPVersion = "IPv6" +) + +type RadarAttackLayer3SummaryBitrateGetParamsProtocol string + +const ( + RadarAttackLayer3SummaryBitrateGetParamsProtocolUdp RadarAttackLayer3SummaryBitrateGetParamsProtocol = "UDP" + RadarAttackLayer3SummaryBitrateGetParamsProtocolTcp RadarAttackLayer3SummaryBitrateGetParamsProtocol = "TCP" + RadarAttackLayer3SummaryBitrateGetParamsProtocolIcmp RadarAttackLayer3SummaryBitrateGetParamsProtocol = "ICMP" + RadarAttackLayer3SummaryBitrateGetParamsProtocolGre RadarAttackLayer3SummaryBitrateGetParamsProtocol = "GRE" +) diff --git a/radarattacklayer3summarybitrate_test.go b/radarattacklayer3summarybitrate_test.go new file mode 100644 index 00000000000..a6a35d032ea --- /dev/null +++ b/radarattacklayer3summarybitrate_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3SummaryBitrateGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Summaries.Bitrate.Get(context.TODO(), cloudflare.RadarAttackLayer3SummaryBitrateGetParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryBitrateGetParamsDateRange{cloudflare.RadarAttackLayer3SummaryBitrateGetParamsDateRange1d, cloudflare.RadarAttackLayer3SummaryBitrateGetParamsDateRange2d, cloudflare.RadarAttackLayer3SummaryBitrateGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3SummaryBitrateGetParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3SummaryBitrateGetParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryBitrateGetParamsIPVersion{cloudflare.RadarAttackLayer3SummaryBitrateGetParamsIPVersionIPv4, cloudflare.RadarAttackLayer3SummaryBitrateGetParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryBitrateGetParamsProtocol{cloudflare.RadarAttackLayer3SummaryBitrateGetParamsProtocolUdp, cloudflare.RadarAttackLayer3SummaryBitrateGetParamsProtocolTcp, cloudflare.RadarAttackLayer3SummaryBitrateGetParamsProtocolIcmp}), + }) + 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/radarattacklayer3summaryduration.go b/radarattacklayer3summaryduration.go new file mode 100644 index 00000000000..d5dced5df09 --- /dev/null +++ b/radarattacklayer3summaryduration.go @@ -0,0 +1,291 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3SummaryDurationService 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 +// [NewRadarAttackLayer3SummaryDurationService] method instead. +type RadarAttackLayer3SummaryDurationService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3SummaryDurationService 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 NewRadarAttackLayer3SummaryDurationService(opts ...option.RequestOption) (r *RadarAttackLayer3SummaryDurationService) { + r = &RadarAttackLayer3SummaryDurationService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by duration. +func (r *RadarAttackLayer3SummaryDurationService) List(ctx context.Context, query RadarAttackLayer3SummaryDurationListParams, opts ...option.RequestOption) (res *RadarAttackLayer3SummaryDurationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/summary/duration" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3SummaryDurationListResponse struct { + Result RadarAttackLayer3SummaryDurationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3SummaryDurationListResponseJSON `json:"-"` +} + +// radarAttackLayer3SummaryDurationListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3SummaryDurationListResponse] +type radarAttackLayer3SummaryDurationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryDurationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryDurationListResponseResult struct { + Meta RadarAttackLayer3SummaryDurationListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer3SummaryDurationListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer3SummaryDurationListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3SummaryDurationListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryDurationListResponseResult] +type radarAttackLayer3SummaryDurationListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryDurationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryDurationListResponseResultMeta struct { + DateRange []RadarAttackLayer3SummaryDurationListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3SummaryDurationListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3SummaryDurationListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryDurationListResponseResultMeta] +type radarAttackLayer3SummaryDurationListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryDurationListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryDurationListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3SummaryDurationListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3SummaryDurationListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3SummaryDurationListResponseResultMetaDateRange] +type radarAttackLayer3SummaryDurationListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryDurationListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfo] +type radarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryDurationListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryDurationListResponseResultSummary0 struct { + Number1HourTo3Hours string `json:"_1_HOUR_TO_3_HOURS,required"` + Number10MinsTo20Mins string `json:"_10_MINS_TO_20_MINS,required"` + Number20MinsTo40Mins string `json:"_20_MINS_TO_40_MINS,required"` + Number40MinsTo1Hour string `json:"_40_MINS_TO_1_HOUR,required"` + Over3Hours string `json:"OVER_3_HOURS,required"` + Under10Mins string `json:"UNDER_10_MINS,required"` + JSON radarAttackLayer3SummaryDurationListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer3SummaryDurationListResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3SummaryDurationListResponseResultSummary0] +type radarAttackLayer3SummaryDurationListResponseResultSummary0JSON struct { + Number1HourTo3Hours apijson.Field + Number10MinsTo20Mins apijson.Field + Number20MinsTo40Mins apijson.Field + Number40MinsTo1Hour apijson.Field + Over3Hours apijson.Field + Under10Mins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryDurationListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryDurationListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3SummaryDurationListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3SummaryDurationListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3SummaryDurationListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3SummaryDurationListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3SummaryDurationListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3SummaryDurationListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3SummaryDurationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3SummaryDurationListParamsDateRange string + +const ( + RadarAttackLayer3SummaryDurationListParamsDateRange1d RadarAttackLayer3SummaryDurationListParamsDateRange = "1d" + RadarAttackLayer3SummaryDurationListParamsDateRange2d RadarAttackLayer3SummaryDurationListParamsDateRange = "2d" + RadarAttackLayer3SummaryDurationListParamsDateRange7d RadarAttackLayer3SummaryDurationListParamsDateRange = "7d" + RadarAttackLayer3SummaryDurationListParamsDateRange14d RadarAttackLayer3SummaryDurationListParamsDateRange = "14d" + RadarAttackLayer3SummaryDurationListParamsDateRange28d RadarAttackLayer3SummaryDurationListParamsDateRange = "28d" + RadarAttackLayer3SummaryDurationListParamsDateRange12w RadarAttackLayer3SummaryDurationListParamsDateRange = "12w" + RadarAttackLayer3SummaryDurationListParamsDateRange24w RadarAttackLayer3SummaryDurationListParamsDateRange = "24w" + RadarAttackLayer3SummaryDurationListParamsDateRange52w RadarAttackLayer3SummaryDurationListParamsDateRange = "52w" + RadarAttackLayer3SummaryDurationListParamsDateRange1dControl RadarAttackLayer3SummaryDurationListParamsDateRange = "1dControl" + RadarAttackLayer3SummaryDurationListParamsDateRange2dControl RadarAttackLayer3SummaryDurationListParamsDateRange = "2dControl" + RadarAttackLayer3SummaryDurationListParamsDateRange7dControl RadarAttackLayer3SummaryDurationListParamsDateRange = "7dControl" + RadarAttackLayer3SummaryDurationListParamsDateRange14dControl RadarAttackLayer3SummaryDurationListParamsDateRange = "14dControl" + RadarAttackLayer3SummaryDurationListParamsDateRange28dControl RadarAttackLayer3SummaryDurationListParamsDateRange = "28dControl" + RadarAttackLayer3SummaryDurationListParamsDateRange12wControl RadarAttackLayer3SummaryDurationListParamsDateRange = "12wControl" + RadarAttackLayer3SummaryDurationListParamsDateRange24wControl RadarAttackLayer3SummaryDurationListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3SummaryDurationListParamsDirection string + +const ( + RadarAttackLayer3SummaryDurationListParamsDirectionOrigin RadarAttackLayer3SummaryDurationListParamsDirection = "ORIGIN" + RadarAttackLayer3SummaryDurationListParamsDirectionTarget RadarAttackLayer3SummaryDurationListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3SummaryDurationListParamsFormat string + +const ( + RadarAttackLayer3SummaryDurationListParamsFormatJson RadarAttackLayer3SummaryDurationListParamsFormat = "JSON" + RadarAttackLayer3SummaryDurationListParamsFormatCsv RadarAttackLayer3SummaryDurationListParamsFormat = "CSV" +) + +type RadarAttackLayer3SummaryDurationListParamsIPVersion string + +const ( + RadarAttackLayer3SummaryDurationListParamsIPVersionIPv4 RadarAttackLayer3SummaryDurationListParamsIPVersion = "IPv4" + RadarAttackLayer3SummaryDurationListParamsIPVersionIPv6 RadarAttackLayer3SummaryDurationListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer3SummaryDurationListParamsProtocol string + +const ( + RadarAttackLayer3SummaryDurationListParamsProtocolUdp RadarAttackLayer3SummaryDurationListParamsProtocol = "UDP" + RadarAttackLayer3SummaryDurationListParamsProtocolTcp RadarAttackLayer3SummaryDurationListParamsProtocol = "TCP" + RadarAttackLayer3SummaryDurationListParamsProtocolIcmp RadarAttackLayer3SummaryDurationListParamsProtocol = "ICMP" + RadarAttackLayer3SummaryDurationListParamsProtocolGre RadarAttackLayer3SummaryDurationListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3summaryduration_test.go b/radarattacklayer3summaryduration_test.go new file mode 100644 index 00000000000..e00b7f40565 --- /dev/null +++ b/radarattacklayer3summaryduration_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3SummaryDurationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Summaries.Durations.List(context.TODO(), cloudflare.RadarAttackLayer3SummaryDurationListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryDurationListParamsDateRange{cloudflare.RadarAttackLayer3SummaryDurationListParamsDateRange1d, cloudflare.RadarAttackLayer3SummaryDurationListParamsDateRange2d, cloudflare.RadarAttackLayer3SummaryDurationListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3SummaryDurationListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3SummaryDurationListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryDurationListParamsIPVersion{cloudflare.RadarAttackLayer3SummaryDurationListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3SummaryDurationListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryDurationListParamsProtocol{cloudflare.RadarAttackLayer3SummaryDurationListParamsProtocolUdp, cloudflare.RadarAttackLayer3SummaryDurationListParamsProtocolTcp, cloudflare.RadarAttackLayer3SummaryDurationListParamsProtocolIcmp}), + }) + 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/radarattacklayer3summaryipversion.go b/radarattacklayer3summaryipversion.go new file mode 100644 index 00000000000..ae98a2e40e2 --- /dev/null +++ b/radarattacklayer3summaryipversion.go @@ -0,0 +1,275 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3SummaryIPVersionService 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 +// [NewRadarAttackLayer3SummaryIPVersionService] method instead. +type RadarAttackLayer3SummaryIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3SummaryIPVersionService 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 NewRadarAttackLayer3SummaryIPVersionService(opts ...option.RequestOption) (r *RadarAttackLayer3SummaryIPVersionService) { + r = &RadarAttackLayer3SummaryIPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by ip version used. +func (r *RadarAttackLayer3SummaryIPVersionService) List(ctx context.Context, query RadarAttackLayer3SummaryIPVersionListParams, opts ...option.RequestOption) (res *RadarAttackLayer3SummaryIPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/summary/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3SummaryIPVersionListResponse struct { + Result RadarAttackLayer3SummaryIPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3SummaryIPVersionListResponseJSON `json:"-"` +} + +// radarAttackLayer3SummaryIPVersionListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3SummaryIPVersionListResponse] +type radarAttackLayer3SummaryIPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryIPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryIPVersionListResponseResult struct { + Meta RadarAttackLayer3SummaryIPVersionListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer3SummaryIPVersionListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer3SummaryIPVersionListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3SummaryIPVersionListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryIPVersionListResponseResult] +type radarAttackLayer3SummaryIPVersionListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryIPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryIPVersionListResponseResultMeta struct { + DateRange []RadarAttackLayer3SummaryIPVersionListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3SummaryIPVersionListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3SummaryIPVersionListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3SummaryIPVersionListResponseResultMeta] +type radarAttackLayer3SummaryIPVersionListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryIPVersionListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryIPVersionListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3SummaryIPVersionListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3SummaryIPVersionListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3SummaryIPVersionListResponseResultMetaDateRange] +type radarAttackLayer3SummaryIPVersionListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryIPVersionListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfo] +type radarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryIPVersionListResponseResultSummary0 struct { + IPv4 string `json:"IPv4,required"` + IPv6 string `json:"IPv6,required"` + JSON radarAttackLayer3SummaryIPVersionListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer3SummaryIPVersionListResponseResultSummary0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3SummaryIPVersionListResponseResultSummary0] +type radarAttackLayer3SummaryIPVersionListResponseResultSummary0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryIPVersionListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryIPVersionListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3SummaryIPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3SummaryIPVersionListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3SummaryIPVersionListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3SummaryIPVersionListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3SummaryIPVersionListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3SummaryIPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3SummaryIPVersionListParamsDateRange string + +const ( + RadarAttackLayer3SummaryIPVersionListParamsDateRange1d RadarAttackLayer3SummaryIPVersionListParamsDateRange = "1d" + RadarAttackLayer3SummaryIPVersionListParamsDateRange2d RadarAttackLayer3SummaryIPVersionListParamsDateRange = "2d" + RadarAttackLayer3SummaryIPVersionListParamsDateRange7d RadarAttackLayer3SummaryIPVersionListParamsDateRange = "7d" + RadarAttackLayer3SummaryIPVersionListParamsDateRange14d RadarAttackLayer3SummaryIPVersionListParamsDateRange = "14d" + RadarAttackLayer3SummaryIPVersionListParamsDateRange28d RadarAttackLayer3SummaryIPVersionListParamsDateRange = "28d" + RadarAttackLayer3SummaryIPVersionListParamsDateRange12w RadarAttackLayer3SummaryIPVersionListParamsDateRange = "12w" + RadarAttackLayer3SummaryIPVersionListParamsDateRange24w RadarAttackLayer3SummaryIPVersionListParamsDateRange = "24w" + RadarAttackLayer3SummaryIPVersionListParamsDateRange52w RadarAttackLayer3SummaryIPVersionListParamsDateRange = "52w" + RadarAttackLayer3SummaryIPVersionListParamsDateRange1dControl RadarAttackLayer3SummaryIPVersionListParamsDateRange = "1dControl" + RadarAttackLayer3SummaryIPVersionListParamsDateRange2dControl RadarAttackLayer3SummaryIPVersionListParamsDateRange = "2dControl" + RadarAttackLayer3SummaryIPVersionListParamsDateRange7dControl RadarAttackLayer3SummaryIPVersionListParamsDateRange = "7dControl" + RadarAttackLayer3SummaryIPVersionListParamsDateRange14dControl RadarAttackLayer3SummaryIPVersionListParamsDateRange = "14dControl" + RadarAttackLayer3SummaryIPVersionListParamsDateRange28dControl RadarAttackLayer3SummaryIPVersionListParamsDateRange = "28dControl" + RadarAttackLayer3SummaryIPVersionListParamsDateRange12wControl RadarAttackLayer3SummaryIPVersionListParamsDateRange = "12wControl" + RadarAttackLayer3SummaryIPVersionListParamsDateRange24wControl RadarAttackLayer3SummaryIPVersionListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3SummaryIPVersionListParamsDirection string + +const ( + RadarAttackLayer3SummaryIPVersionListParamsDirectionOrigin RadarAttackLayer3SummaryIPVersionListParamsDirection = "ORIGIN" + RadarAttackLayer3SummaryIPVersionListParamsDirectionTarget RadarAttackLayer3SummaryIPVersionListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3SummaryIPVersionListParamsFormat string + +const ( + RadarAttackLayer3SummaryIPVersionListParamsFormatJson RadarAttackLayer3SummaryIPVersionListParamsFormat = "JSON" + RadarAttackLayer3SummaryIPVersionListParamsFormatCsv RadarAttackLayer3SummaryIPVersionListParamsFormat = "CSV" +) + +type RadarAttackLayer3SummaryIPVersionListParamsProtocol string + +const ( + RadarAttackLayer3SummaryIPVersionListParamsProtocolUdp RadarAttackLayer3SummaryIPVersionListParamsProtocol = "UDP" + RadarAttackLayer3SummaryIPVersionListParamsProtocolTcp RadarAttackLayer3SummaryIPVersionListParamsProtocol = "TCP" + RadarAttackLayer3SummaryIPVersionListParamsProtocolIcmp RadarAttackLayer3SummaryIPVersionListParamsProtocol = "ICMP" + RadarAttackLayer3SummaryIPVersionListParamsProtocolGre RadarAttackLayer3SummaryIPVersionListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3summaryipversion_test.go b/radarattacklayer3summaryipversion_test.go new file mode 100644 index 00000000000..87b5c9d4ffb --- /dev/null +++ b/radarattacklayer3summaryipversion_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3SummaryIPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Summaries.IPVersions.List(context.TODO(), cloudflare.RadarAttackLayer3SummaryIPVersionListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryIPVersionListParamsDateRange{cloudflare.RadarAttackLayer3SummaryIPVersionListParamsDateRange1d, cloudflare.RadarAttackLayer3SummaryIPVersionListParamsDateRange2d, cloudflare.RadarAttackLayer3SummaryIPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3SummaryIPVersionListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3SummaryIPVersionListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryIPVersionListParamsProtocol{cloudflare.RadarAttackLayer3SummaryIPVersionListParamsProtocolUdp, cloudflare.RadarAttackLayer3SummaryIPVersionListParamsProtocolTcp, cloudflare.RadarAttackLayer3SummaryIPVersionListParamsProtocolIcmp}), + }) + 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/radarattacklayer3summaryprotocol.go b/radarattacklayer3summaryprotocol.go new file mode 100644 index 00000000000..e7c3abf40e9 --- /dev/null +++ b/radarattacklayer3summaryprotocol.go @@ -0,0 +1,276 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3SummaryProtocolService 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 +// [NewRadarAttackLayer3SummaryProtocolService] method instead. +type RadarAttackLayer3SummaryProtocolService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3SummaryProtocolService 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 NewRadarAttackLayer3SummaryProtocolService(opts ...option.RequestOption) (r *RadarAttackLayer3SummaryProtocolService) { + r = &RadarAttackLayer3SummaryProtocolService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by protocol used. +func (r *RadarAttackLayer3SummaryProtocolService) List(ctx context.Context, query RadarAttackLayer3SummaryProtocolListParams, opts ...option.RequestOption) (res *RadarAttackLayer3SummaryProtocolListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/summary/protocol" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3SummaryProtocolListResponse struct { + Result RadarAttackLayer3SummaryProtocolListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3SummaryProtocolListResponseJSON `json:"-"` +} + +// radarAttackLayer3SummaryProtocolListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3SummaryProtocolListResponse] +type radarAttackLayer3SummaryProtocolListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryProtocolListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryProtocolListResponseResult struct { + Meta RadarAttackLayer3SummaryProtocolListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer3SummaryProtocolListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer3SummaryProtocolListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3SummaryProtocolListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryProtocolListResponseResult] +type radarAttackLayer3SummaryProtocolListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryProtocolListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryProtocolListResponseResultMeta struct { + DateRange []RadarAttackLayer3SummaryProtocolListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3SummaryProtocolListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3SummaryProtocolListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryProtocolListResponseResultMeta] +type radarAttackLayer3SummaryProtocolListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryProtocolListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryProtocolListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3SummaryProtocolListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3SummaryProtocolListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3SummaryProtocolListResponseResultMetaDateRange] +type radarAttackLayer3SummaryProtocolListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryProtocolListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfo] +type radarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryProtocolListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryProtocolListResponseResultSummary0 struct { + Gre string `json:"GRE,required"` + Icmp string `json:"ICMP,required"` + Tcp string `json:"TCP,required"` + Udp string `json:"UDP,required"` + JSON radarAttackLayer3SummaryProtocolListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer3SummaryProtocolListResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3SummaryProtocolListResponseResultSummary0] +type radarAttackLayer3SummaryProtocolListResponseResultSummary0JSON struct { + Gre apijson.Field + Icmp apijson.Field + Tcp apijson.Field + Udp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryProtocolListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryProtocolListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3SummaryProtocolListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3SummaryProtocolListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3SummaryProtocolListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3SummaryProtocolListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer3SummaryProtocolListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3SummaryProtocolListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3SummaryProtocolListParamsDateRange string + +const ( + RadarAttackLayer3SummaryProtocolListParamsDateRange1d RadarAttackLayer3SummaryProtocolListParamsDateRange = "1d" + RadarAttackLayer3SummaryProtocolListParamsDateRange2d RadarAttackLayer3SummaryProtocolListParamsDateRange = "2d" + RadarAttackLayer3SummaryProtocolListParamsDateRange7d RadarAttackLayer3SummaryProtocolListParamsDateRange = "7d" + RadarAttackLayer3SummaryProtocolListParamsDateRange14d RadarAttackLayer3SummaryProtocolListParamsDateRange = "14d" + RadarAttackLayer3SummaryProtocolListParamsDateRange28d RadarAttackLayer3SummaryProtocolListParamsDateRange = "28d" + RadarAttackLayer3SummaryProtocolListParamsDateRange12w RadarAttackLayer3SummaryProtocolListParamsDateRange = "12w" + RadarAttackLayer3SummaryProtocolListParamsDateRange24w RadarAttackLayer3SummaryProtocolListParamsDateRange = "24w" + RadarAttackLayer3SummaryProtocolListParamsDateRange52w RadarAttackLayer3SummaryProtocolListParamsDateRange = "52w" + RadarAttackLayer3SummaryProtocolListParamsDateRange1dControl RadarAttackLayer3SummaryProtocolListParamsDateRange = "1dControl" + RadarAttackLayer3SummaryProtocolListParamsDateRange2dControl RadarAttackLayer3SummaryProtocolListParamsDateRange = "2dControl" + RadarAttackLayer3SummaryProtocolListParamsDateRange7dControl RadarAttackLayer3SummaryProtocolListParamsDateRange = "7dControl" + RadarAttackLayer3SummaryProtocolListParamsDateRange14dControl RadarAttackLayer3SummaryProtocolListParamsDateRange = "14dControl" + RadarAttackLayer3SummaryProtocolListParamsDateRange28dControl RadarAttackLayer3SummaryProtocolListParamsDateRange = "28dControl" + RadarAttackLayer3SummaryProtocolListParamsDateRange12wControl RadarAttackLayer3SummaryProtocolListParamsDateRange = "12wControl" + RadarAttackLayer3SummaryProtocolListParamsDateRange24wControl RadarAttackLayer3SummaryProtocolListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3SummaryProtocolListParamsDirection string + +const ( + RadarAttackLayer3SummaryProtocolListParamsDirectionOrigin RadarAttackLayer3SummaryProtocolListParamsDirection = "ORIGIN" + RadarAttackLayer3SummaryProtocolListParamsDirectionTarget RadarAttackLayer3SummaryProtocolListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3SummaryProtocolListParamsFormat string + +const ( + RadarAttackLayer3SummaryProtocolListParamsFormatJson RadarAttackLayer3SummaryProtocolListParamsFormat = "JSON" + RadarAttackLayer3SummaryProtocolListParamsFormatCsv RadarAttackLayer3SummaryProtocolListParamsFormat = "CSV" +) + +type RadarAttackLayer3SummaryProtocolListParamsIPVersion string + +const ( + RadarAttackLayer3SummaryProtocolListParamsIPVersionIPv4 RadarAttackLayer3SummaryProtocolListParamsIPVersion = "IPv4" + RadarAttackLayer3SummaryProtocolListParamsIPVersionIPv6 RadarAttackLayer3SummaryProtocolListParamsIPVersion = "IPv6" +) diff --git a/radarattacklayer3summaryprotocol_test.go b/radarattacklayer3summaryprotocol_test.go new file mode 100644 index 00000000000..34ae93b34d0 --- /dev/null +++ b/radarattacklayer3summaryprotocol_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3SummaryProtocolListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Summaries.Protocols.List(context.TODO(), cloudflare.RadarAttackLayer3SummaryProtocolListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryProtocolListParamsDateRange{cloudflare.RadarAttackLayer3SummaryProtocolListParamsDateRange1d, cloudflare.RadarAttackLayer3SummaryProtocolListParamsDateRange2d, cloudflare.RadarAttackLayer3SummaryProtocolListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3SummaryProtocolListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3SummaryProtocolListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryProtocolListParamsIPVersion{cloudflare.RadarAttackLayer3SummaryProtocolListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3SummaryProtocolListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer3summaryvector.go b/radarattacklayer3summaryvector.go new file mode 100644 index 00000000000..76f9bd92da5 --- /dev/null +++ b/radarattacklayer3summaryvector.go @@ -0,0 +1,263 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3SummaryVectorService 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 +// [NewRadarAttackLayer3SummaryVectorService] method instead. +type RadarAttackLayer3SummaryVectorService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3SummaryVectorService 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 NewRadarAttackLayer3SummaryVectorService(opts ...option.RequestOption) (r *RadarAttackLayer3SummaryVectorService) { + r = &RadarAttackLayer3SummaryVectorService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by vector. +func (r *RadarAttackLayer3SummaryVectorService) List(ctx context.Context, query RadarAttackLayer3SummaryVectorListParams, opts ...option.RequestOption) (res *RadarAttackLayer3SummaryVectorListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/summary/vector" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3SummaryVectorListResponse struct { + Result RadarAttackLayer3SummaryVectorListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3SummaryVectorListResponseJSON `json:"-"` +} + +// radarAttackLayer3SummaryVectorListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3SummaryVectorListResponse] +type radarAttackLayer3SummaryVectorListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryVectorListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryVectorListResponseResult struct { + Meta RadarAttackLayer3SummaryVectorListResponseResultMeta `json:"meta,required"` + Summary0 interface{} `json:"summary_0,required"` + JSON radarAttackLayer3SummaryVectorListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3SummaryVectorListResponseResultJSON contains the JSON metadata +// for the struct [RadarAttackLayer3SummaryVectorListResponseResult] +type radarAttackLayer3SummaryVectorListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryVectorListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryVectorListResponseResultMeta struct { + DateRange []RadarAttackLayer3SummaryVectorListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3SummaryVectorListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3SummaryVectorListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer3SummaryVectorListResponseResultMeta] +type radarAttackLayer3SummaryVectorListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryVectorListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryVectorListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3SummaryVectorListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3SummaryVectorListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3SummaryVectorListResponseResultMetaDateRange] +type radarAttackLayer3SummaryVectorListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryVectorListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfo] +type radarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3SummaryVectorListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3SummaryVectorListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3SummaryVectorListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3SummaryVectorListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3SummaryVectorListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3SummaryVectorListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3SummaryVectorListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3SummaryVectorListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3SummaryVectorListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3SummaryVectorListParamsDateRange string + +const ( + RadarAttackLayer3SummaryVectorListParamsDateRange1d RadarAttackLayer3SummaryVectorListParamsDateRange = "1d" + RadarAttackLayer3SummaryVectorListParamsDateRange2d RadarAttackLayer3SummaryVectorListParamsDateRange = "2d" + RadarAttackLayer3SummaryVectorListParamsDateRange7d RadarAttackLayer3SummaryVectorListParamsDateRange = "7d" + RadarAttackLayer3SummaryVectorListParamsDateRange14d RadarAttackLayer3SummaryVectorListParamsDateRange = "14d" + RadarAttackLayer3SummaryVectorListParamsDateRange28d RadarAttackLayer3SummaryVectorListParamsDateRange = "28d" + RadarAttackLayer3SummaryVectorListParamsDateRange12w RadarAttackLayer3SummaryVectorListParamsDateRange = "12w" + RadarAttackLayer3SummaryVectorListParamsDateRange24w RadarAttackLayer3SummaryVectorListParamsDateRange = "24w" + RadarAttackLayer3SummaryVectorListParamsDateRange52w RadarAttackLayer3SummaryVectorListParamsDateRange = "52w" + RadarAttackLayer3SummaryVectorListParamsDateRange1dControl RadarAttackLayer3SummaryVectorListParamsDateRange = "1dControl" + RadarAttackLayer3SummaryVectorListParamsDateRange2dControl RadarAttackLayer3SummaryVectorListParamsDateRange = "2dControl" + RadarAttackLayer3SummaryVectorListParamsDateRange7dControl RadarAttackLayer3SummaryVectorListParamsDateRange = "7dControl" + RadarAttackLayer3SummaryVectorListParamsDateRange14dControl RadarAttackLayer3SummaryVectorListParamsDateRange = "14dControl" + RadarAttackLayer3SummaryVectorListParamsDateRange28dControl RadarAttackLayer3SummaryVectorListParamsDateRange = "28dControl" + RadarAttackLayer3SummaryVectorListParamsDateRange12wControl RadarAttackLayer3SummaryVectorListParamsDateRange = "12wControl" + RadarAttackLayer3SummaryVectorListParamsDateRange24wControl RadarAttackLayer3SummaryVectorListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3SummaryVectorListParamsDirection string + +const ( + RadarAttackLayer3SummaryVectorListParamsDirectionOrigin RadarAttackLayer3SummaryVectorListParamsDirection = "ORIGIN" + RadarAttackLayer3SummaryVectorListParamsDirectionTarget RadarAttackLayer3SummaryVectorListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3SummaryVectorListParamsFormat string + +const ( + RadarAttackLayer3SummaryVectorListParamsFormatJson RadarAttackLayer3SummaryVectorListParamsFormat = "JSON" + RadarAttackLayer3SummaryVectorListParamsFormatCsv RadarAttackLayer3SummaryVectorListParamsFormat = "CSV" +) + +type RadarAttackLayer3SummaryVectorListParamsIPVersion string + +const ( + RadarAttackLayer3SummaryVectorListParamsIPVersionIPv4 RadarAttackLayer3SummaryVectorListParamsIPVersion = "IPv4" + RadarAttackLayer3SummaryVectorListParamsIPVersionIPv6 RadarAttackLayer3SummaryVectorListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer3SummaryVectorListParamsProtocol string + +const ( + RadarAttackLayer3SummaryVectorListParamsProtocolUdp RadarAttackLayer3SummaryVectorListParamsProtocol = "UDP" + RadarAttackLayer3SummaryVectorListParamsProtocolTcp RadarAttackLayer3SummaryVectorListParamsProtocol = "TCP" + RadarAttackLayer3SummaryVectorListParamsProtocolIcmp RadarAttackLayer3SummaryVectorListParamsProtocol = "ICMP" + RadarAttackLayer3SummaryVectorListParamsProtocolGre RadarAttackLayer3SummaryVectorListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3summaryvector_test.go b/radarattacklayer3summaryvector_test.go new file mode 100644 index 00000000000..b2577bbe883 --- /dev/null +++ b/radarattacklayer3summaryvector_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3SummaryVectorListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Summaries.Vectors.List(context.TODO(), cloudflare.RadarAttackLayer3SummaryVectorListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryVectorListParamsDateRange{cloudflare.RadarAttackLayer3SummaryVectorListParamsDateRange1d, cloudflare.RadarAttackLayer3SummaryVectorListParamsDateRange2d, cloudflare.RadarAttackLayer3SummaryVectorListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3SummaryVectorListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3SummaryVectorListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryVectorListParamsIPVersion{cloudflare.RadarAttackLayer3SummaryVectorListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3SummaryVectorListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3SummaryVectorListParamsProtocol{cloudflare.RadarAttackLayer3SummaryVectorListParamsProtocolUdp, cloudflare.RadarAttackLayer3SummaryVectorListParamsProtocolTcp, cloudflare.RadarAttackLayer3SummaryVectorListParamsProtocolIcmp}), + }) + 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/radarattacklayer3timeseriesgroup.go b/radarattacklayer3timeseriesgroup.go new file mode 100644 index 00000000000..196e9407843 --- /dev/null +++ b/radarattacklayer3timeseriesgroup.go @@ -0,0 +1,292 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupService 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 +// [NewRadarAttackLayer3TimeseriesGroupService] method instead. +type RadarAttackLayer3TimeseriesGroupService struct { + Options []option.RequestOption + Bitrates *RadarAttackLayer3TimeseriesGroupBitrateService + Durations *RadarAttackLayer3TimeseriesGroupDurationService + Industries *RadarAttackLayer3TimeseriesGroupIndustryService + IPVersions *RadarAttackLayer3TimeseriesGroupIPVersionService + Protocols *RadarAttackLayer3TimeseriesGroupProtocolService + Vectors *RadarAttackLayer3TimeseriesGroupVectorService + Vertical *RadarAttackLayer3TimeseriesGroupVerticalService +} + +// NewRadarAttackLayer3TimeseriesGroupService 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 NewRadarAttackLayer3TimeseriesGroupService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupService) { + r = &RadarAttackLayer3TimeseriesGroupService{} + r.Options = opts + r.Bitrates = NewRadarAttackLayer3TimeseriesGroupBitrateService(opts...) + r.Durations = NewRadarAttackLayer3TimeseriesGroupDurationService(opts...) + r.Industries = NewRadarAttackLayer3TimeseriesGroupIndustryService(opts...) + r.IPVersions = NewRadarAttackLayer3TimeseriesGroupIPVersionService(opts...) + r.Protocols = NewRadarAttackLayer3TimeseriesGroupProtocolService(opts...) + r.Vectors = NewRadarAttackLayer3TimeseriesGroupVectorService(opts...) + r.Vertical = NewRadarAttackLayer3TimeseriesGroupVerticalService(opts...) + return +} + +// Get a timeseries of the percentage distribution of network protocols in Layer +// 3/4 attacks. +func (r *RadarAttackLayer3TimeseriesGroupService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupListResponse struct { + Result RadarAttackLayer3TimeseriesGroupListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer3TimeseriesGroupListResponse] +type radarAttackLayer3TimeseriesGroupListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupListResponseResult struct { + Meta RadarAttackLayer3TimeseriesGroupListResponseResultMeta `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupListResponseResult] +type radarAttackLayer3TimeseriesGroupListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupListResponseResultMeta struct { + AggInterval string `json:"aggInterval,required"` + DateRange []RadarAttackLayer3TimeseriesGroupListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated time.Time `json:"lastUpdated,required" format:"date-time"` + ConfidenceInfo RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3TimeseriesGroupListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupListResponseResultMeta] +type radarAttackLayer3TimeseriesGroupListResponseResultMetaJSON struct { + AggInterval apijson.Field + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3TimeseriesGroupListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupListResponseResultMetaDateRange] +type radarAttackLayer3TimeseriesGroupListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfo] +type radarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupListResponseResultSerie0 struct { + Gre []string `json:"gre,required"` + Icmp []string `json:"icmp,required"` + Tcp []string `json:"tcp,required"` + Timestamps []string `json:"timestamps,required"` + Udp []string `json:"udp,required"` + JSON radarAttackLayer3TimeseriesGroupListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupListResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3TimeseriesGroupListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupListResponseResultSerie0JSON struct { + Gre apijson.Field + Icmp apijson.Field + Tcp apijson.Field + Timestamps apijson.Field + Udp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupListParamsDateRange1d RadarAttackLayer3TimeseriesGroupListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupListParamsDateRange2d RadarAttackLayer3TimeseriesGroupListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupListParamsDateRange7d RadarAttackLayer3TimeseriesGroupListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupListParamsDateRange14d RadarAttackLayer3TimeseriesGroupListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupListParamsDateRange28d RadarAttackLayer3TimeseriesGroupListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupListParamsDateRange12w RadarAttackLayer3TimeseriesGroupListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupListParamsDateRange24w RadarAttackLayer3TimeseriesGroupListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupListParamsDateRange52w RadarAttackLayer3TimeseriesGroupListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupListParamsFormatJson RadarAttackLayer3TimeseriesGroupListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupListParamsFormatCsv RadarAttackLayer3TimeseriesGroupListParamsFormat = "CSV" +) diff --git a/radarattacklayer3timeseriesgroup_test.go b/radarattacklayer3timeseriesgroup_test.go new file mode 100644 index 00000000000..137a1588783 --- /dev/null +++ b/radarattacklayer3timeseriesgroup_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer3timeseriesgroupbitrate.go b/radarattacklayer3timeseriesgroupbitrate.go new file mode 100644 index 00000000000..52716755a35 --- /dev/null +++ b/radarattacklayer3timeseriesgroupbitrate.go @@ -0,0 +1,226 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupBitrateService 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 [NewRadarAttackLayer3TimeseriesGroupBitrateService] method instead. +type RadarAttackLayer3TimeseriesGroupBitrateService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseriesGroupBitrateService 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 NewRadarAttackLayer3TimeseriesGroupBitrateService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupBitrateService) { + r = &RadarAttackLayer3TimeseriesGroupBitrateService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by bitrate over time. +func (r *RadarAttackLayer3TimeseriesGroupBitrateService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupBitrateListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupBitrateListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups/bitrate" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupBitrateListResponse struct { + Result RadarAttackLayer3TimeseriesGroupBitrateListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupBitrateListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupBitrateListResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupBitrateListResponse] +type radarAttackLayer3TimeseriesGroupBitrateListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupBitrateListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupBitrateListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupBitrateListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupBitrateListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupBitrateListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3TimeseriesGroupBitrateListResponseResult] +type radarAttackLayer3TimeseriesGroupBitrateListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupBitrateListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupBitrateListResponseResultSerie0 struct { + Number1GbpsTo10Gbps []string `json:"_1_GBPS_TO_10_GBPS,required"` + Number10GbpsTo100Gbps []string `json:"_10_GBPS_TO_100_GBPS,required"` + Number500MbpsTo1Gbps []string `json:"_500_MBPS_TO_1_GBPS,required"` + Over100Gbps []string `json:"OVER_100_GBPS,required"` + Timestamps []string `json:"timestamps,required"` + Under500Mbps []string `json:"UNDER_500_MBPS,required"` + JSON radarAttackLayer3TimeseriesGroupBitrateListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupBitrateListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupBitrateListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupBitrateListResponseResultSerie0JSON struct { + Number1GbpsTo10Gbps apijson.Field + Number10GbpsTo100Gbps apijson.Field + Number500MbpsTo1Gbps apijson.Field + Over100Gbps apijson.Field + Timestamps apijson.Field + Under500Mbps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupBitrateListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupBitrateListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval] `query:"aggInterval"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseriesGroupBitrateListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupBitrateListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseriesGroupBitrateListParamsNormalization] `query:"normalization"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupBitrateListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupBitrateListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange1d RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange2d RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange7d RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange14d RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange28d RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange12w RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange24w RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange52w RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseriesGroupBitrateListParamsDirection string + +const ( + RadarAttackLayer3TimeseriesGroupBitrateListParamsDirectionOrigin RadarAttackLayer3TimeseriesGroupBitrateListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseriesGroupBitrateListParamsDirectionTarget RadarAttackLayer3TimeseriesGroupBitrateListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupBitrateListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupBitrateListParamsFormatJson RadarAttackLayer3TimeseriesGroupBitrateListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupBitrateListParamsFormatCsv RadarAttackLayer3TimeseriesGroupBitrateListParamsFormat = "CSV" +) + +type RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersion string + +const ( + RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersionIPv4 RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersion = "IPv4" + RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersionIPv6 RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersion = "IPv6" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseriesGroupBitrateListParamsNormalization string + +const ( + RadarAttackLayer3TimeseriesGroupBitrateListParamsNormalizationPercentage RadarAttackLayer3TimeseriesGroupBitrateListParamsNormalization = "PERCENTAGE" + RadarAttackLayer3TimeseriesGroupBitrateListParamsNormalizationMin0Max RadarAttackLayer3TimeseriesGroupBitrateListParamsNormalization = "MIN0_MAX" +) + +type RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocol string + +const ( + RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocolUdp RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocol = "UDP" + RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocolTcp RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocol = "TCP" + RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocolIcmp RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocol = "ICMP" + RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocolGre RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3timeseriesgroupbitrate_test.go b/radarattacklayer3timeseriesgroupbitrate_test.go new file mode 100644 index 00000000000..28d78650045 --- /dev/null +++ b/radarattacklayer3timeseriesgroupbitrate_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupBitrateListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.Bitrates.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsAggInterval1h), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersion{cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsNormalizationPercentage), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocol{cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocolUdp, cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocolTcp, cloudflare.RadarAttackLayer3TimeseriesGroupBitrateListParamsProtocolIcmp}), + }) + 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/radarattacklayer3timeseriesgroupduration.go b/radarattacklayer3timeseriesgroupduration.go new file mode 100644 index 00000000000..e4a728d6fd1 --- /dev/null +++ b/radarattacklayer3timeseriesgroupduration.go @@ -0,0 +1,228 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupDurationService 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 [NewRadarAttackLayer3TimeseriesGroupDurationService] method instead. +type RadarAttackLayer3TimeseriesGroupDurationService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseriesGroupDurationService 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 NewRadarAttackLayer3TimeseriesGroupDurationService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupDurationService) { + r = &RadarAttackLayer3TimeseriesGroupDurationService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by duration over time. +func (r *RadarAttackLayer3TimeseriesGroupDurationService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupDurationListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupDurationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups/duration" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupDurationListResponse struct { + Result RadarAttackLayer3TimeseriesGroupDurationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupDurationListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupDurationListResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupDurationListResponse] +type radarAttackLayer3TimeseriesGroupDurationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupDurationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupDurationListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupDurationListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupDurationListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupDurationListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3TimeseriesGroupDurationListResponseResult] +type radarAttackLayer3TimeseriesGroupDurationListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupDurationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupDurationListResponseResultSerie0 struct { + Number1HourTo3Hours []string `json:"_1_HOUR_TO_3_HOURS,required"` + Number10MinsTo20Mins []string `json:"_10_MINS_TO_20_MINS,required"` + Number20MinsTo40Mins []string `json:"_20_MINS_TO_40_MINS,required"` + Number40MinsTo1Hour []string `json:"_40_MINS_TO_1_HOUR,required"` + Over3Hours []string `json:"OVER_3_HOURS,required"` + Timestamps []string `json:"timestamps,required"` + Under10Mins []string `json:"UNDER_10_MINS,required"` + JSON radarAttackLayer3TimeseriesGroupDurationListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupDurationListResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupDurationListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupDurationListResponseResultSerie0JSON struct { + Number1HourTo3Hours apijson.Field + Number10MinsTo20Mins apijson.Field + Number20MinsTo40Mins apijson.Field + Number40MinsTo1Hour apijson.Field + Over3Hours apijson.Field + Timestamps apijson.Field + Under10Mins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupDurationListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupDurationListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval] `query:"aggInterval"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseriesGroupDurationListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupDurationListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseriesGroupDurationListParamsNormalization] `query:"normalization"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3TimeseriesGroupDurationListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupDurationListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupDurationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange1d RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange2d RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange7d RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange14d RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange28d RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange12w RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange24w RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange52w RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseriesGroupDurationListParamsDirection string + +const ( + RadarAttackLayer3TimeseriesGroupDurationListParamsDirectionOrigin RadarAttackLayer3TimeseriesGroupDurationListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseriesGroupDurationListParamsDirectionTarget RadarAttackLayer3TimeseriesGroupDurationListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupDurationListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupDurationListParamsFormatJson RadarAttackLayer3TimeseriesGroupDurationListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupDurationListParamsFormatCsv RadarAttackLayer3TimeseriesGroupDurationListParamsFormat = "CSV" +) + +type RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersion string + +const ( + RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersionIPv4 RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersion = "IPv4" + RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersionIPv6 RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersion = "IPv6" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseriesGroupDurationListParamsNormalization string + +const ( + RadarAttackLayer3TimeseriesGroupDurationListParamsNormalizationPercentage RadarAttackLayer3TimeseriesGroupDurationListParamsNormalization = "PERCENTAGE" + RadarAttackLayer3TimeseriesGroupDurationListParamsNormalizationMin0Max RadarAttackLayer3TimeseriesGroupDurationListParamsNormalization = "MIN0_MAX" +) + +type RadarAttackLayer3TimeseriesGroupDurationListParamsProtocol string + +const ( + RadarAttackLayer3TimeseriesGroupDurationListParamsProtocolUdp RadarAttackLayer3TimeseriesGroupDurationListParamsProtocol = "UDP" + RadarAttackLayer3TimeseriesGroupDurationListParamsProtocolTcp RadarAttackLayer3TimeseriesGroupDurationListParamsProtocol = "TCP" + RadarAttackLayer3TimeseriesGroupDurationListParamsProtocolIcmp RadarAttackLayer3TimeseriesGroupDurationListParamsProtocol = "ICMP" + RadarAttackLayer3TimeseriesGroupDurationListParamsProtocolGre RadarAttackLayer3TimeseriesGroupDurationListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3timeseriesgroupduration_test.go b/radarattacklayer3timeseriesgroupduration_test.go new file mode 100644 index 00000000000..5121d5348cd --- /dev/null +++ b/radarattacklayer3timeseriesgroupduration_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupDurationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.Durations.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsAggInterval1h), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersion{cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsNormalizationPercentage), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsProtocol{cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsProtocolUdp, cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsProtocolTcp, cloudflare.RadarAttackLayer3TimeseriesGroupDurationListParamsProtocolIcmp}), + }) + 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/radarattacklayer3timeseriesgroupindustry.go b/radarattacklayer3timeseriesgroupindustry.go new file mode 100644 index 00000000000..3a6234b3052 --- /dev/null +++ b/radarattacklayer3timeseriesgroupindustry.go @@ -0,0 +1,208 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupIndustryService 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 [NewRadarAttackLayer3TimeseriesGroupIndustryService] method instead. +type RadarAttackLayer3TimeseriesGroupIndustryService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseriesGroupIndustryService 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 NewRadarAttackLayer3TimeseriesGroupIndustryService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupIndustryService) { + r = &RadarAttackLayer3TimeseriesGroupIndustryService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by industry used over time. +func (r *RadarAttackLayer3TimeseriesGroupIndustryService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupIndustryListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupIndustryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups/industry" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupIndustryListResponse struct { + Result RadarAttackLayer3TimeseriesGroupIndustryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupIndustryListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupIndustryListResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupIndustryListResponse] +type radarAttackLayer3TimeseriesGroupIndustryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupIndustryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupIndustryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupIndustryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupIndustryListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupIndustryListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3TimeseriesGroupIndustryListResponseResult] +type radarAttackLayer3TimeseriesGroupIndustryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupIndustryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupIndustryListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer3TimeseriesGroupIndustryListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupIndustryListResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupIndustryListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupIndustryListResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupIndustryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupIndustryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval] `query:"aggInterval"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseriesGroupIndustryListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupIndustryListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects (eg browsers, verticals, etc) to the top items over + // the time range. + LimitPerGroup param.Field[int64] `query:"limitPerGroup"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseriesGroupIndustryListParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupIndustryListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupIndustryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange1d RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange2d RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange7d RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange14d RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange28d RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange12w RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange24w RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange52w RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseriesGroupIndustryListParamsDirection string + +const ( + RadarAttackLayer3TimeseriesGroupIndustryListParamsDirectionOrigin RadarAttackLayer3TimeseriesGroupIndustryListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseriesGroupIndustryListParamsDirectionTarget RadarAttackLayer3TimeseriesGroupIndustryListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupIndustryListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupIndustryListParamsFormatJson RadarAttackLayer3TimeseriesGroupIndustryListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupIndustryListParamsFormatCsv RadarAttackLayer3TimeseriesGroupIndustryListParamsFormat = "CSV" +) + +type RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersion string + +const ( + RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersionIPv4 RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersion = "IPv4" + RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersionIPv6 RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersion = "IPv6" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseriesGroupIndustryListParamsNormalization string + +const ( + RadarAttackLayer3TimeseriesGroupIndustryListParamsNormalizationPercentage RadarAttackLayer3TimeseriesGroupIndustryListParamsNormalization = "PERCENTAGE" + RadarAttackLayer3TimeseriesGroupIndustryListParamsNormalizationMin0Max RadarAttackLayer3TimeseriesGroupIndustryListParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer3timeseriesgroupindustry_test.go b/radarattacklayer3timeseriesgroupindustry_test.go new file mode 100644 index 00000000000..5cc6679d1ff --- /dev/null +++ b/radarattacklayer3timeseriesgroupindustry_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupIndustryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.Industries.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsAggInterval1h), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersion{cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsIPVersionIPv6}), + LimitPerGroup: cloudflare.F(int64(4)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIndustryListParamsNormalizationPercentage), + }) + 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/radarattacklayer3timeseriesgroupipversion.go b/radarattacklayer3timeseriesgroupipversion.go new file mode 100644 index 00000000000..b03cb82736c --- /dev/null +++ b/radarattacklayer3timeseriesgroupipversion.go @@ -0,0 +1,211 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupIPVersionService 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 [NewRadarAttackLayer3TimeseriesGroupIPVersionService] method instead. +type RadarAttackLayer3TimeseriesGroupIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseriesGroupIPVersionService 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 NewRadarAttackLayer3TimeseriesGroupIPVersionService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupIPVersionService) { + r = &RadarAttackLayer3TimeseriesGroupIPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by ip version used over time. +func (r *RadarAttackLayer3TimeseriesGroupIPVersionService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupIPVersionListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupIPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupIPVersionListResponse struct { + Result RadarAttackLayer3TimeseriesGroupIPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupIPVersionListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupIPVersionListResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupIPVersionListResponse] +type radarAttackLayer3TimeseriesGroupIPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupIPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupIPVersionListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupIPVersionListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupIPVersionListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupIPVersionListResponseResultJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupIPVersionListResponseResult] +type radarAttackLayer3TimeseriesGroupIPVersionListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupIPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupIPVersionListResponseResultSerie0 struct { + IPv4 []string `json:"IPv4,required"` + IPv6 []string `json:"IPv6,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer3TimeseriesGroupIPVersionListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupIPVersionListResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupIPVersionListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupIPVersionListResponseResultSerie0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupIPVersionListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupIPVersionListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval] `query:"aggInterval"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseriesGroupIPVersionListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupIPVersionListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseriesGroupIPVersionListParamsNormalization] `query:"normalization"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupIPVersionListParams]'s +// query parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupIPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange1d RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange2d RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange7d RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange14d RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange28d RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange12w RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange24w RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange52w RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseriesGroupIPVersionListParamsDirection string + +const ( + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDirectionOrigin RadarAttackLayer3TimeseriesGroupIPVersionListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsDirectionTarget RadarAttackLayer3TimeseriesGroupIPVersionListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupIPVersionListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupIPVersionListParamsFormatJson RadarAttackLayer3TimeseriesGroupIPVersionListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsFormatCsv RadarAttackLayer3TimeseriesGroupIPVersionListParamsFormat = "CSV" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseriesGroupIPVersionListParamsNormalization string + +const ( + RadarAttackLayer3TimeseriesGroupIPVersionListParamsNormalizationPercentage RadarAttackLayer3TimeseriesGroupIPVersionListParamsNormalization = "PERCENTAGE" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsNormalizationMin0Max RadarAttackLayer3TimeseriesGroupIPVersionListParamsNormalization = "MIN0_MAX" +) + +type RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocol string + +const ( + RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocolUdp RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocol = "UDP" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocolTcp RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocol = "TCP" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocolIcmp RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocol = "ICMP" + RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocolGre RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3timeseriesgroupipversion_test.go b/radarattacklayer3timeseriesgroupipversion_test.go new file mode 100644 index 00000000000..3068acf5b72 --- /dev/null +++ b/radarattacklayer3timeseriesgroupipversion_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupIPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.IPVersions.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsAggInterval1h), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsNormalizationPercentage), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocol{cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocolUdp, cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocolTcp, cloudflare.RadarAttackLayer3TimeseriesGroupIPVersionListParamsProtocolIcmp}), + }) + 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/radarattacklayer3timeseriesgroupprotocol.go b/radarattacklayer3timeseriesgroupprotocol.go new file mode 100644 index 00000000000..85b53f9687d --- /dev/null +++ b/radarattacklayer3timeseriesgroupprotocol.go @@ -0,0 +1,213 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupProtocolService 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 [NewRadarAttackLayer3TimeseriesGroupProtocolService] method instead. +type RadarAttackLayer3TimeseriesGroupProtocolService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseriesGroupProtocolService 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 NewRadarAttackLayer3TimeseriesGroupProtocolService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupProtocolService) { + r = &RadarAttackLayer3TimeseriesGroupProtocolService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by protocol used over time. +func (r *RadarAttackLayer3TimeseriesGroupProtocolService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupProtocolListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupProtocolListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups/protocol" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupProtocolListResponse struct { + Result RadarAttackLayer3TimeseriesGroupProtocolListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupProtocolListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupProtocolListResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupProtocolListResponse] +type radarAttackLayer3TimeseriesGroupProtocolListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupProtocolListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupProtocolListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupProtocolListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupProtocolListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupProtocolListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3TimeseriesGroupProtocolListResponseResult] +type radarAttackLayer3TimeseriesGroupProtocolListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupProtocolListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupProtocolListResponseResultSerie0 struct { + Gre []string `json:"GRE,required"` + Icmp []string `json:"ICMP,required"` + Tcp []string `json:"TCP,required"` + Timestamps []string `json:"timestamps,required"` + Udp []string `json:"UDP,required"` + JSON radarAttackLayer3TimeseriesGroupProtocolListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupProtocolListResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupProtocolListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupProtocolListResponseResultSerie0JSON struct { + Gre apijson.Field + Icmp apijson.Field + Tcp apijson.Field + Timestamps apijson.Field + Udp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupProtocolListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupProtocolListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval] `query:"aggInterval"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseriesGroupProtocolListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupProtocolListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseriesGroupProtocolListParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupProtocolListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupProtocolListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange1d RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange2d RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange7d RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange14d RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange28d RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange12w RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange24w RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange52w RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseriesGroupProtocolListParamsDirection string + +const ( + RadarAttackLayer3TimeseriesGroupProtocolListParamsDirectionOrigin RadarAttackLayer3TimeseriesGroupProtocolListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseriesGroupProtocolListParamsDirectionTarget RadarAttackLayer3TimeseriesGroupProtocolListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupProtocolListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupProtocolListParamsFormatJson RadarAttackLayer3TimeseriesGroupProtocolListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupProtocolListParamsFormatCsv RadarAttackLayer3TimeseriesGroupProtocolListParamsFormat = "CSV" +) + +type RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersion string + +const ( + RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersionIPv4 RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersion = "IPv4" + RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersionIPv6 RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersion = "IPv6" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseriesGroupProtocolListParamsNormalization string + +const ( + RadarAttackLayer3TimeseriesGroupProtocolListParamsNormalizationPercentage RadarAttackLayer3TimeseriesGroupProtocolListParamsNormalization = "PERCENTAGE" + RadarAttackLayer3TimeseriesGroupProtocolListParamsNormalizationMin0Max RadarAttackLayer3TimeseriesGroupProtocolListParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer3timeseriesgroupprotocol_test.go b/radarattacklayer3timeseriesgroupprotocol_test.go new file mode 100644 index 00000000000..1e1ff5c77cd --- /dev/null +++ b/radarattacklayer3timeseriesgroupprotocol_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupProtocolListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.Protocols.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsAggInterval1h), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersion{cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupProtocolListParamsNormalizationPercentage), + }) + 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/radarattacklayer3timeseriesgroupvector.go b/radarattacklayer3timeseriesgroupvector.go new file mode 100644 index 00000000000..02befab4816 --- /dev/null +++ b/radarattacklayer3timeseriesgroupvector.go @@ -0,0 +1,219 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupVectorService 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 [NewRadarAttackLayer3TimeseriesGroupVectorService] method instead. +type RadarAttackLayer3TimeseriesGroupVectorService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseriesGroupVectorService 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 NewRadarAttackLayer3TimeseriesGroupVectorService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupVectorService) { + r = &RadarAttackLayer3TimeseriesGroupVectorService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by vector used over time. +func (r *RadarAttackLayer3TimeseriesGroupVectorService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupVectorListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupVectorListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups/vector" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupVectorListResponse struct { + Result RadarAttackLayer3TimeseriesGroupVectorListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupVectorListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupVectorListResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupVectorListResponse] +type radarAttackLayer3TimeseriesGroupVectorListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupVectorListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupVectorListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupVectorListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupVectorListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupVectorListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3TimeseriesGroupVectorListResponseResult] +type radarAttackLayer3TimeseriesGroupVectorListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupVectorListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupVectorListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer3TimeseriesGroupVectorListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupVectorListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupVectorListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupVectorListResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupVectorListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupVectorListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval] `query:"aggInterval"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseriesGroupVectorListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupVectorListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects (eg browsers, verticals, etc) to the top items over + // the time range. + LimitPerGroup param.Field[int64] `query:"limitPerGroup"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseriesGroupVectorListParamsNormalization] `query:"normalization"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3TimeseriesGroupVectorListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupVectorListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupVectorListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange1d RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange2d RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange7d RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange14d RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange28d RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange12w RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange24w RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange52w RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseriesGroupVectorListParamsDirection string + +const ( + RadarAttackLayer3TimeseriesGroupVectorListParamsDirectionOrigin RadarAttackLayer3TimeseriesGroupVectorListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseriesGroupVectorListParamsDirectionTarget RadarAttackLayer3TimeseriesGroupVectorListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupVectorListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupVectorListParamsFormatJson RadarAttackLayer3TimeseriesGroupVectorListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupVectorListParamsFormatCsv RadarAttackLayer3TimeseriesGroupVectorListParamsFormat = "CSV" +) + +type RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersion string + +const ( + RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersionIPv4 RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersion = "IPv4" + RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersionIPv6 RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersion = "IPv6" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseriesGroupVectorListParamsNormalization string + +const ( + RadarAttackLayer3TimeseriesGroupVectorListParamsNormalizationPercentage RadarAttackLayer3TimeseriesGroupVectorListParamsNormalization = "PERCENTAGE" + RadarAttackLayer3TimeseriesGroupVectorListParamsNormalizationMin0Max RadarAttackLayer3TimeseriesGroupVectorListParamsNormalization = "MIN0_MAX" +) + +type RadarAttackLayer3TimeseriesGroupVectorListParamsProtocol string + +const ( + RadarAttackLayer3TimeseriesGroupVectorListParamsProtocolUdp RadarAttackLayer3TimeseriesGroupVectorListParamsProtocol = "UDP" + RadarAttackLayer3TimeseriesGroupVectorListParamsProtocolTcp RadarAttackLayer3TimeseriesGroupVectorListParamsProtocol = "TCP" + RadarAttackLayer3TimeseriesGroupVectorListParamsProtocolIcmp RadarAttackLayer3TimeseriesGroupVectorListParamsProtocol = "ICMP" + RadarAttackLayer3TimeseriesGroupVectorListParamsProtocolGre RadarAttackLayer3TimeseriesGroupVectorListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3timeseriesgroupvector_test.go b/radarattacklayer3timeseriesgroupvector_test.go new file mode 100644 index 00000000000..a6d2a5c7bc5 --- /dev/null +++ b/radarattacklayer3timeseriesgroupvector_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupVectorListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.Vectors.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsAggInterval1h), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersion{cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsIPVersionIPv6}), + LimitPerGroup: cloudflare.F(int64(4)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsNormalizationPercentage), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsProtocol{cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsProtocolUdp, cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsProtocolTcp, cloudflare.RadarAttackLayer3TimeseriesGroupVectorListParamsProtocolIcmp}), + }) + 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/radarattacklayer3timeseriesgroupvertical.go b/radarattacklayer3timeseriesgroupvertical.go new file mode 100644 index 00000000000..5bfd24c441a --- /dev/null +++ b/radarattacklayer3timeseriesgroupvertical.go @@ -0,0 +1,208 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseriesGroupVerticalService 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 [NewRadarAttackLayer3TimeseriesGroupVerticalService] method instead. +type RadarAttackLayer3TimeseriesGroupVerticalService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseriesGroupVerticalService 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 NewRadarAttackLayer3TimeseriesGroupVerticalService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseriesGroupVerticalService) { + r = &RadarAttackLayer3TimeseriesGroupVerticalService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by vertical used over time. +func (r *RadarAttackLayer3TimeseriesGroupVerticalService) List(ctx context.Context, query RadarAttackLayer3TimeseriesGroupVerticalListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseriesGroupVerticalListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries_groups/vertical" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseriesGroupVerticalListResponse struct { + Result RadarAttackLayer3TimeseriesGroupVerticalListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseriesGroupVerticalListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupVerticalListResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer3TimeseriesGroupVerticalListResponse] +type radarAttackLayer3TimeseriesGroupVerticalListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupVerticalListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupVerticalListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseriesGroupVerticalListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseriesGroupVerticalListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupVerticalListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3TimeseriesGroupVerticalListResponseResult] +type radarAttackLayer3TimeseriesGroupVerticalListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupVerticalListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupVerticalListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer3TimeseriesGroupVerticalListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseriesGroupVerticalListResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer3TimeseriesGroupVerticalListResponseResultSerie0] +type radarAttackLayer3TimeseriesGroupVerticalListResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseriesGroupVerticalListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseriesGroupVerticalListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval] `query:"aggInterval"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseriesGroupVerticalListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseriesGroupVerticalListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects (eg browsers, verticals, etc) to the top items over + // the time range. + LimitPerGroup param.Field[int64] `query:"limitPerGroup"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseriesGroupVerticalListParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseriesGroupVerticalListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer3TimeseriesGroupVerticalListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval15m RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval = "15m" + RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval1h RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval = "1h" + RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval1d RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval = "1d" + RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval1w RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange string + +const ( + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange1d RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "1d" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange2d RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "2d" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange7d RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "7d" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange14d RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "14d" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange28d RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "28d" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange12w RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "12w" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange24w RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "24w" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange52w RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "52w" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange1dControl RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange2dControl RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange7dControl RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange14dControl RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange28dControl RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange12wControl RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange24wControl RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseriesGroupVerticalListParamsDirection string + +const ( + RadarAttackLayer3TimeseriesGroupVerticalListParamsDirectionOrigin RadarAttackLayer3TimeseriesGroupVerticalListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseriesGroupVerticalListParamsDirectionTarget RadarAttackLayer3TimeseriesGroupVerticalListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseriesGroupVerticalListParamsFormat string + +const ( + RadarAttackLayer3TimeseriesGroupVerticalListParamsFormatJson RadarAttackLayer3TimeseriesGroupVerticalListParamsFormat = "JSON" + RadarAttackLayer3TimeseriesGroupVerticalListParamsFormatCsv RadarAttackLayer3TimeseriesGroupVerticalListParamsFormat = "CSV" +) + +type RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersion string + +const ( + RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersionIPv4 RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersion = "IPv4" + RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersionIPv6 RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersion = "IPv6" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseriesGroupVerticalListParamsNormalization string + +const ( + RadarAttackLayer3TimeseriesGroupVerticalListParamsNormalizationPercentage RadarAttackLayer3TimeseriesGroupVerticalListParamsNormalization = "PERCENTAGE" + RadarAttackLayer3TimeseriesGroupVerticalListParamsNormalizationMin0Max RadarAttackLayer3TimeseriesGroupVerticalListParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer3timeseriesgroupvertical_test.go b/radarattacklayer3timeseriesgroupvertical_test.go new file mode 100644 index 00000000000..018cfca595f --- /dev/null +++ b/radarattacklayer3timeseriesgroupvertical_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseriesGroupVerticalListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.TimeseriesGroups.Vertical.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsAggInterval1h), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange{cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersion{cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsIPVersionIPv6}), + LimitPerGroup: cloudflare.F(int64(4)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseriesGroupVerticalListParamsNormalizationPercentage), + }) + 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/radarattacklayer3timesery.go b/radarattacklayer3timesery.go new file mode 100644 index 00000000000..f3fa5db0f3f --- /dev/null +++ b/radarattacklayer3timesery.go @@ -0,0 +1,229 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3TimeseryService 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 +// [NewRadarAttackLayer3TimeseryService] method instead. +type RadarAttackLayer3TimeseryService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3TimeseryService 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 NewRadarAttackLayer3TimeseryService(opts ...option.RequestOption) (r *RadarAttackLayer3TimeseryService) { + r = &RadarAttackLayer3TimeseryService{} + r.Options = opts + return +} + +// Get attacks change over time by bytes. +func (r *RadarAttackLayer3TimeseryService) List(ctx context.Context, query RadarAttackLayer3TimeseryListParams, opts ...option.RequestOption) (res *RadarAttackLayer3TimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/timeseries" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3TimeseryListResponse struct { + Result RadarAttackLayer3TimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3TimeseryListResponseJSON `json:"-"` +} + +// radarAttackLayer3TimeseryListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer3TimeseryListResponse] +type radarAttackLayer3TimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer3TimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer3TimeseryListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3TimeseryListResponseResultJSON contains the JSON metadata for +// the struct [RadarAttackLayer3TimeseryListResponseResult] +type radarAttackLayer3TimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseryListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + Values []string `json:"values,required"` + JSON radarAttackLayer3TimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer3TimeseryListResponseResultSerie0JSON contains the JSON metadata +// for the struct [RadarAttackLayer3TimeseryListResponseResultSerie0] +type radarAttackLayer3TimeseryListResponseResultSerie0JSON struct { + Timestamps apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3TimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3TimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer3TimeseryListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3TimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Together with the `location` parameter, will apply the filter to origin or + // target location. + Direction param.Field[RadarAttackLayer3TimeseryListParamsDirection] `query:"direction"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3TimeseryListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3TimeseryListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Measurement units, eg. bytes. + Metric param.Field[RadarAttackLayer3TimeseryListParamsMetric] `query:"metric"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer3TimeseryListParamsNormalization] `query:"normalization"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3TimeseryListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3TimeseryListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer3TimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer3TimeseryListParamsAggInterval string + +const ( + RadarAttackLayer3TimeseryListParamsAggInterval15m RadarAttackLayer3TimeseryListParamsAggInterval = "15m" + RadarAttackLayer3TimeseryListParamsAggInterval1h RadarAttackLayer3TimeseryListParamsAggInterval = "1h" + RadarAttackLayer3TimeseryListParamsAggInterval1d RadarAttackLayer3TimeseryListParamsAggInterval = "1d" + RadarAttackLayer3TimeseryListParamsAggInterval1w RadarAttackLayer3TimeseryListParamsAggInterval = "1w" +) + +type RadarAttackLayer3TimeseryListParamsDateRange string + +const ( + RadarAttackLayer3TimeseryListParamsDateRange1d RadarAttackLayer3TimeseryListParamsDateRange = "1d" + RadarAttackLayer3TimeseryListParamsDateRange2d RadarAttackLayer3TimeseryListParamsDateRange = "2d" + RadarAttackLayer3TimeseryListParamsDateRange7d RadarAttackLayer3TimeseryListParamsDateRange = "7d" + RadarAttackLayer3TimeseryListParamsDateRange14d RadarAttackLayer3TimeseryListParamsDateRange = "14d" + RadarAttackLayer3TimeseryListParamsDateRange28d RadarAttackLayer3TimeseryListParamsDateRange = "28d" + RadarAttackLayer3TimeseryListParamsDateRange12w RadarAttackLayer3TimeseryListParamsDateRange = "12w" + RadarAttackLayer3TimeseryListParamsDateRange24w RadarAttackLayer3TimeseryListParamsDateRange = "24w" + RadarAttackLayer3TimeseryListParamsDateRange52w RadarAttackLayer3TimeseryListParamsDateRange = "52w" + RadarAttackLayer3TimeseryListParamsDateRange1dControl RadarAttackLayer3TimeseryListParamsDateRange = "1dControl" + RadarAttackLayer3TimeseryListParamsDateRange2dControl RadarAttackLayer3TimeseryListParamsDateRange = "2dControl" + RadarAttackLayer3TimeseryListParamsDateRange7dControl RadarAttackLayer3TimeseryListParamsDateRange = "7dControl" + RadarAttackLayer3TimeseryListParamsDateRange14dControl RadarAttackLayer3TimeseryListParamsDateRange = "14dControl" + RadarAttackLayer3TimeseryListParamsDateRange28dControl RadarAttackLayer3TimeseryListParamsDateRange = "28dControl" + RadarAttackLayer3TimeseryListParamsDateRange12wControl RadarAttackLayer3TimeseryListParamsDateRange = "12wControl" + RadarAttackLayer3TimeseryListParamsDateRange24wControl RadarAttackLayer3TimeseryListParamsDateRange = "24wControl" +) + +// Together with the `location` parameter, will apply the filter to origin or +// target location. +type RadarAttackLayer3TimeseryListParamsDirection string + +const ( + RadarAttackLayer3TimeseryListParamsDirectionOrigin RadarAttackLayer3TimeseryListParamsDirection = "ORIGIN" + RadarAttackLayer3TimeseryListParamsDirectionTarget RadarAttackLayer3TimeseryListParamsDirection = "TARGET" +) + +// Format results are returned in. +type RadarAttackLayer3TimeseryListParamsFormat string + +const ( + RadarAttackLayer3TimeseryListParamsFormatJson RadarAttackLayer3TimeseryListParamsFormat = "JSON" + RadarAttackLayer3TimeseryListParamsFormatCsv RadarAttackLayer3TimeseryListParamsFormat = "CSV" +) + +type RadarAttackLayer3TimeseryListParamsIPVersion string + +const ( + RadarAttackLayer3TimeseryListParamsIPVersionIPv4 RadarAttackLayer3TimeseryListParamsIPVersion = "IPv4" + RadarAttackLayer3TimeseryListParamsIPVersionIPv6 RadarAttackLayer3TimeseryListParamsIPVersion = "IPv6" +) + +// Measurement units, eg. bytes. +type RadarAttackLayer3TimeseryListParamsMetric string + +const ( + RadarAttackLayer3TimeseryListParamsMetricBytes RadarAttackLayer3TimeseryListParamsMetric = "BYTES" + RadarAttackLayer3TimeseryListParamsMetricBytesOld RadarAttackLayer3TimeseryListParamsMetric = "BYTES_OLD" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer3TimeseryListParamsNormalization string + +const ( + RadarAttackLayer3TimeseryListParamsNormalizationPercentageChange RadarAttackLayer3TimeseryListParamsNormalization = "PERCENTAGE_CHANGE" + RadarAttackLayer3TimeseryListParamsNormalizationMin0Max RadarAttackLayer3TimeseryListParamsNormalization = "MIN0_MAX" +) + +type RadarAttackLayer3TimeseryListParamsProtocol string + +const ( + RadarAttackLayer3TimeseryListParamsProtocolUdp RadarAttackLayer3TimeseryListParamsProtocol = "UDP" + RadarAttackLayer3TimeseryListParamsProtocolTcp RadarAttackLayer3TimeseryListParamsProtocol = "TCP" + RadarAttackLayer3TimeseryListParamsProtocolIcmp RadarAttackLayer3TimeseryListParamsProtocol = "ICMP" + RadarAttackLayer3TimeseryListParamsProtocolGre RadarAttackLayer3TimeseryListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3timesery_test.go b/radarattacklayer3timesery_test.go new file mode 100644 index 00000000000..24902f27b5c --- /dev/null +++ b/radarattacklayer3timesery_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3TimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Timeseries.List(context.TODO(), cloudflare.RadarAttackLayer3TimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer3TimeseryListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseryListParamsDateRange{cloudflare.RadarAttackLayer3TimeseryListParamsDateRange1d, cloudflare.RadarAttackLayer3TimeseryListParamsDateRange2d, cloudflare.RadarAttackLayer3TimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Direction: cloudflare.F(cloudflare.RadarAttackLayer3TimeseryListParamsDirectionOrigin), + Format: cloudflare.F(cloudflare.RadarAttackLayer3TimeseryListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseryListParamsIPVersion{cloudflare.RadarAttackLayer3TimeseryListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3TimeseryListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Metric: cloudflare.F(cloudflare.RadarAttackLayer3TimeseryListParamsMetricBytes), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer3TimeseryListParamsNormalizationMin0Max), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3TimeseryListParamsProtocol{cloudflare.RadarAttackLayer3TimeseryListParamsProtocolUdp, cloudflare.RadarAttackLayer3TimeseryListParamsProtocolTcp, cloudflare.RadarAttackLayer3TimeseryListParamsProtocolIcmp}), + }) + 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/radarattacklayer3vertical.go b/radarattacklayer3vertical.go new file mode 100644 index 00000000000..328051ec142 --- /dev/null +++ b/radarattacklayer3vertical.go @@ -0,0 +1,270 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer3VerticalService 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 +// [NewRadarAttackLayer3VerticalService] method instead. +type RadarAttackLayer3VerticalService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer3VerticalService 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 NewRadarAttackLayer3VerticalService(opts ...option.RequestOption) (r *RadarAttackLayer3VerticalService) { + r = &RadarAttackLayer3VerticalService{} + r.Options = opts + return +} + +// Get the Verticals of attacks. +func (r *RadarAttackLayer3VerticalService) List(ctx context.Context, query RadarAttackLayer3VerticalListParams, opts ...option.RequestOption) (res *RadarAttackLayer3VerticalListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer3/top/vertical" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer3VerticalListResponse struct { + Result RadarAttackLayer3VerticalListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer3VerticalListResponseJSON `json:"-"` +} + +// radarAttackLayer3VerticalListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer3VerticalListResponse] +type radarAttackLayer3VerticalListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3VerticalListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3VerticalListResponseResult struct { + Meta RadarAttackLayer3VerticalListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer3VerticalListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer3VerticalListResponseResultJSON `json:"-"` +} + +// radarAttackLayer3VerticalListResponseResultJSON contains the JSON metadata for +// the struct [RadarAttackLayer3VerticalListResponseResult] +type radarAttackLayer3VerticalListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3VerticalListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3VerticalListResponseResultMeta struct { + DateRange []RadarAttackLayer3VerticalListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer3VerticalListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer3VerticalListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAttackLayer3VerticalListResponseResultMeta] +type radarAttackLayer3VerticalListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3VerticalListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3VerticalListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer3VerticalListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer3VerticalListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer3VerticalListResponseResultMetaDateRange] +type radarAttackLayer3VerticalListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3VerticalListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer3VerticalListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer3VerticalListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfo] +type radarAttackLayer3VerticalListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer3VerticalListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer3VerticalListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer3VerticalListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3VerticalListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3VerticalListResponseResultTop0 struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON radarAttackLayer3VerticalListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer3VerticalListResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarAttackLayer3VerticalListResponseResultTop0] +type radarAttackLayer3VerticalListResponseResultTop0JSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer3VerticalListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer3VerticalListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer3VerticalListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer3VerticalListParamsFormat] `query:"format"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer3VerticalListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of L3/4 attack types. + Protocol param.Field[[]RadarAttackLayer3VerticalListParamsProtocol] `query:"protocol"` +} + +// URLQuery serializes [RadarAttackLayer3VerticalListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer3VerticalListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer3VerticalListParamsDateRange string + +const ( + RadarAttackLayer3VerticalListParamsDateRange1d RadarAttackLayer3VerticalListParamsDateRange = "1d" + RadarAttackLayer3VerticalListParamsDateRange2d RadarAttackLayer3VerticalListParamsDateRange = "2d" + RadarAttackLayer3VerticalListParamsDateRange7d RadarAttackLayer3VerticalListParamsDateRange = "7d" + RadarAttackLayer3VerticalListParamsDateRange14d RadarAttackLayer3VerticalListParamsDateRange = "14d" + RadarAttackLayer3VerticalListParamsDateRange28d RadarAttackLayer3VerticalListParamsDateRange = "28d" + RadarAttackLayer3VerticalListParamsDateRange12w RadarAttackLayer3VerticalListParamsDateRange = "12w" + RadarAttackLayer3VerticalListParamsDateRange24w RadarAttackLayer3VerticalListParamsDateRange = "24w" + RadarAttackLayer3VerticalListParamsDateRange52w RadarAttackLayer3VerticalListParamsDateRange = "52w" + RadarAttackLayer3VerticalListParamsDateRange1dControl RadarAttackLayer3VerticalListParamsDateRange = "1dControl" + RadarAttackLayer3VerticalListParamsDateRange2dControl RadarAttackLayer3VerticalListParamsDateRange = "2dControl" + RadarAttackLayer3VerticalListParamsDateRange7dControl RadarAttackLayer3VerticalListParamsDateRange = "7dControl" + RadarAttackLayer3VerticalListParamsDateRange14dControl RadarAttackLayer3VerticalListParamsDateRange = "14dControl" + RadarAttackLayer3VerticalListParamsDateRange28dControl RadarAttackLayer3VerticalListParamsDateRange = "28dControl" + RadarAttackLayer3VerticalListParamsDateRange12wControl RadarAttackLayer3VerticalListParamsDateRange = "12wControl" + RadarAttackLayer3VerticalListParamsDateRange24wControl RadarAttackLayer3VerticalListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer3VerticalListParamsFormat string + +const ( + RadarAttackLayer3VerticalListParamsFormatJson RadarAttackLayer3VerticalListParamsFormat = "JSON" + RadarAttackLayer3VerticalListParamsFormatCsv RadarAttackLayer3VerticalListParamsFormat = "CSV" +) + +type RadarAttackLayer3VerticalListParamsIPVersion string + +const ( + RadarAttackLayer3VerticalListParamsIPVersionIPv4 RadarAttackLayer3VerticalListParamsIPVersion = "IPv4" + RadarAttackLayer3VerticalListParamsIPVersionIPv6 RadarAttackLayer3VerticalListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer3VerticalListParamsProtocol string + +const ( + RadarAttackLayer3VerticalListParamsProtocolUdp RadarAttackLayer3VerticalListParamsProtocol = "UDP" + RadarAttackLayer3VerticalListParamsProtocolTcp RadarAttackLayer3VerticalListParamsProtocol = "TCP" + RadarAttackLayer3VerticalListParamsProtocolIcmp RadarAttackLayer3VerticalListParamsProtocol = "ICMP" + RadarAttackLayer3VerticalListParamsProtocolGre RadarAttackLayer3VerticalListParamsProtocol = "GRE" +) diff --git a/radarattacklayer3vertical_test.go b/radarattacklayer3vertical_test.go new file mode 100644 index 00000000000..a0308965a71 --- /dev/null +++ b/radarattacklayer3vertical_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer3VerticalListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer3.Verticals.List(context.TODO(), cloudflare.RadarAttackLayer3VerticalListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer3VerticalListParamsDateRange{cloudflare.RadarAttackLayer3VerticalListParamsDateRange1d, cloudflare.RadarAttackLayer3VerticalListParamsDateRange2d, cloudflare.RadarAttackLayer3VerticalListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer3VerticalListParamsFormatJson), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer3VerticalListParamsIPVersion{cloudflare.RadarAttackLayer3VerticalListParamsIPVersionIPv4, cloudflare.RadarAttackLayer3VerticalListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Protocol: cloudflare.F([]cloudflare.RadarAttackLayer3VerticalListParamsProtocol{cloudflare.RadarAttackLayer3VerticalListParamsProtocolUdp, cloudflare.RadarAttackLayer3VerticalListParamsProtocolTcp, cloudflare.RadarAttackLayer3VerticalListParamsProtocolIcmp}), + }) + 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/radarattacklayer7.go b/radarattacklayer7.go new file mode 100644 index 00000000000..50592a22edd --- /dev/null +++ b/radarattacklayer7.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7Service 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 [NewRadarAttackLayer7Service] method +// instead. +type RadarAttackLayer7Service struct { + Options []option.RequestOption + Summaries *RadarAttackLayer7SummaryService + MitigationProducts *RadarAttackLayer7MitigationProductService + HTTPMethods *RadarAttackLayer7HTTPMethodService + HTTPVersions *RadarAttackLayer7HTTPVersionService + Industries *RadarAttackLayer7IndustryService + IPVersions *RadarAttackLayer7IPVersionService + ManagedRules *RadarAttackLayer7ManagedRuleService + Verticals *RadarAttackLayer7VerticalService + Timeseries *RadarAttackLayer7TimeseryService + TimeseriesGroups *RadarAttackLayer7TimeseriesGroupService + Tops *RadarAttackLayer7TopService +} + +// NewRadarAttackLayer7Service 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 NewRadarAttackLayer7Service(opts ...option.RequestOption) (r *RadarAttackLayer7Service) { + r = &RadarAttackLayer7Service{} + r.Options = opts + r.Summaries = NewRadarAttackLayer7SummaryService(opts...) + r.MitigationProducts = NewRadarAttackLayer7MitigationProductService(opts...) + r.HTTPMethods = NewRadarAttackLayer7HTTPMethodService(opts...) + r.HTTPVersions = NewRadarAttackLayer7HTTPVersionService(opts...) + r.Industries = NewRadarAttackLayer7IndustryService(opts...) + r.IPVersions = NewRadarAttackLayer7IPVersionService(opts...) + r.ManagedRules = NewRadarAttackLayer7ManagedRuleService(opts...) + r.Verticals = NewRadarAttackLayer7VerticalService(opts...) + r.Timeseries = NewRadarAttackLayer7TimeseryService(opts...) + r.TimeseriesGroups = NewRadarAttackLayer7TimeseriesGroupService(opts...) + r.Tops = NewRadarAttackLayer7TopService(opts...) + return +} diff --git a/radarattacklayer7httpmethod.go b/radarattacklayer7httpmethod.go new file mode 100644 index 00000000000..19653cd43cf --- /dev/null +++ b/radarattacklayer7httpmethod.go @@ -0,0 +1,223 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7HTTPMethodService 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 +// [NewRadarAttackLayer7HTTPMethodService] method instead. +type RadarAttackLayer7HTTPMethodService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7HTTPMethodService 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 NewRadarAttackLayer7HTTPMethodService(opts ...option.RequestOption) (r *RadarAttackLayer7HTTPMethodService) { + r = &RadarAttackLayer7HTTPMethodService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by http method used over time. +func (r *RadarAttackLayer7HTTPMethodService) ListTimeseriesGroups(ctx context.Context, query RadarAttackLayer7HTTPMethodListTimeseriesGroupsParams, opts ...option.RequestOption) (res *RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups/http_method" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponse struct { + Result RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseJSON `json:"-"` +} + +// radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponse] +type radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResult] +type radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultSerie0 struct { + Get []string `json:"GET,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultSerie0] +type radarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultSerie0JSON struct { + Get apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7HTTPMethodListTimeseriesGroupsResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsFormat] `query:"format"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer7HTTPMethodListTimeseriesGroupsParams]'s +// query parameters as `url.Values`. +func (r RadarAttackLayer7HTTPMethodListTimeseriesGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval string + +const ( + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval15m RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval = "15m" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval1h RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval = "1h" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval1d RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval = "1d" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval1w RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval = "1w" +) + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange string + +const ( + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange1d RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "1d" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange2d RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "2d" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange7d RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "7d" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange14d RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "14d" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange28d RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "28d" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange12w RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "12w" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange24w RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "24w" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange52w RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "52w" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange1dControl RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "1dControl" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange2dControl RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "2dControl" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange7dControl RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "7dControl" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange14dControl RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "14dControl" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange28dControl RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "28dControl" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange12wControl RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "12wControl" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange24wControl RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsFormat string + +const ( + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsFormatJson RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsFormat = "JSON" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsFormatCsv RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsFormat = "CSV" +) + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersion string + +const ( + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersionHttPv1 RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersionHttPv2 RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersionHttPv3 RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersion string + +const ( + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersionIPv4 RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersion = "IPv4" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersionIPv6 RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct string + +const ( + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductDdos RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct = "DDOS" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductWaf RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct = "WAF" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductBotManagement RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductAccessRules RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductIPReputation RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductAPIShield RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductDataLossPrevention RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsNormalization string + +const ( + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsNormalizationPercentage RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsNormalization = "PERCENTAGE" + RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsNormalizationMin0Max RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer7httpmethod_test.go b/radarattacklayer7httpmethod_test.go new file mode 100644 index 00000000000..25a7df05404 --- /dev/null +++ b/radarattacklayer7httpmethod_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7HTTPMethodListTimeseriesGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.HTTPMethods.ListTimeseriesGroups(context.TODO(), cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange{cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange1d, cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange2d, cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsFormatJson), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersion{cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersion{cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersionIPv4, cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProduct{cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductDdos, cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductWaf, cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7HTTPMethodListTimeseriesGroupsParamsNormalizationPercentage), + }) + 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/radarattacklayer7httpversion.go b/radarattacklayer7httpversion.go new file mode 100644 index 00000000000..009c4da3076 --- /dev/null +++ b/radarattacklayer7httpversion.go @@ -0,0 +1,266 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7HTTPVersionService 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 +// [NewRadarAttackLayer7HTTPVersionService] method instead. +type RadarAttackLayer7HTTPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7HTTPVersionService 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 NewRadarAttackLayer7HTTPVersionService(opts ...option.RequestOption) (r *RadarAttackLayer7HTTPVersionService) { + r = &RadarAttackLayer7HTTPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by http version used over time. +func (r *RadarAttackLayer7HTTPVersionService) ListTimeseriesGroups(ctx context.Context, query RadarAttackLayer7HTTPVersionListTimeseriesGroupsParams, opts ...option.RequestOption) (res *RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups/http_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponse struct { + Result RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseJSON `json:"-"` +} + +// radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponse] +type radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResult] +type radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultSerie0 struct { + HTTP1X []string `json:"HTTP/1.x,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultSerie0JSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultSerie0] +type radarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultSerie0JSON struct { + HTTP1X apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7HTTPVersionListTimeseriesGroupsResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod] `query:"httpMethod"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer7HTTPVersionListTimeseriesGroupsParams]'s +// query parameters as `url.Values`. +func (r RadarAttackLayer7HTTPVersionListTimeseriesGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval string + +const ( + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval15m RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval = "15m" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval1h RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval = "1h" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval1d RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval = "1d" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval1w RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval = "1w" +) + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange string + +const ( + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange1d RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "1d" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange2d RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "2d" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange7d RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "7d" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange14d RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "14d" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange28d RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "28d" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange12w RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "12w" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange24w RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "24w" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange52w RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "52w" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange1dControl RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "1dControl" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange2dControl RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "2dControl" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange7dControl RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "7dControl" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange14dControl RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "14dControl" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange28dControl RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "28dControl" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange12wControl RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "12wControl" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange24wControl RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsFormat string + +const ( + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsFormatJson RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsFormat = "JSON" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsFormatCsv RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsFormat = "CSV" +) + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod string + +const ( + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodGet RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "GET" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodPost RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "POST" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodDelete RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "DELETE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodPut RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "PUT" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodHead RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "HEAD" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodPurge RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "PURGE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodOptions RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodPropfind RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodMkcol RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "MKCOL" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodPatch RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "PATCH" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodACL RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "ACL" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodBcopy RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "BCOPY" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodBdelete RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "BDELETE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodBmove RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "BMOVE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodBpropfind RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodBproppatch RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodCheckin RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodCheckout RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodConnect RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "CONNECT" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodCopy RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "COPY" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodLabel RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "LABEL" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodLock RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "LOCK" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodMerge RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "MERGE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodMkactivity RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodMkworkspace RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodMove RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "MOVE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodNotify RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodOrderpatch RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodPoll RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "POLL" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodProppatch RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodReport RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "REPORT" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodSearch RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "SEARCH" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodSubscribe RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodTrace RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "TRACE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodUncheckout RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodUnlock RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodUnsubscribe RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodUpdate RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "UPDATE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodVersioncontrol RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodBaselinecontrol RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodXmsenumatts RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodRpcOutData RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodRpcInData RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodJson RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "JSON" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodCook RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "COOK" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodTrack RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersion string + +const ( + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersionIPv4 RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersion = "IPv4" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersionIPv6 RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct string + +const ( + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductDdos RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct = "DDOS" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductWaf RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct = "WAF" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductBotManagement RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductAccessRules RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductIPReputation RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductAPIShield RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductDataLossPrevention RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsNormalization string + +const ( + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsNormalizationPercentage RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsNormalization = "PERCENTAGE" + RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsNormalizationMin0Max RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer7httpversion_test.go b/radarattacklayer7httpversion_test.go new file mode 100644 index 00000000000..9ea6e77e202 --- /dev/null +++ b/radarattacklayer7httpversion_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7HTTPVersionListTimeseriesGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.HTTPVersions.ListTimeseriesGroups(context.TODO(), cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange{cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange1d, cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange2d, cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethod{cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodGet, cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodPost, cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsHTTPMethodDelete}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersion{cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersionIPv4, cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProduct{cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductDdos, cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductWaf, cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7HTTPVersionListTimeseriesGroupsParamsNormalizationPercentage), + }) + 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/radarattacklayer7industry.go b/radarattacklayer7industry.go new file mode 100644 index 00000000000..5f9c7e3ee52 --- /dev/null +++ b/radarattacklayer7industry.go @@ -0,0 +1,496 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7IndustryService 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 +// [NewRadarAttackLayer7IndustryService] method instead. +type RadarAttackLayer7IndustryService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7IndustryService 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 NewRadarAttackLayer7IndustryService(opts ...option.RequestOption) (r *RadarAttackLayer7IndustryService) { + r = &RadarAttackLayer7IndustryService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by industry used over time. +func (r *RadarAttackLayer7IndustryService) ListTimeseriesGroups(ctx context.Context, query RadarAttackLayer7IndustryListTimeseriesGroupsParams, opts ...option.RequestOption) (res *RadarAttackLayer7IndustryListTimeseriesGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups/industry" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Get the Industry of attacks. +func (r *RadarAttackLayer7IndustryService) ListTops(ctx context.Context, query RadarAttackLayer7IndustryListTopsParams, opts ...option.RequestOption) (res *RadarAttackLayer7IndustryListTopsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/top/industry" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7IndustryListTimeseriesGroupsResponse struct { + Result RadarAttackLayer7IndustryListTimeseriesGroupsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7IndustryListTimeseriesGroupsResponseJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTimeseriesGroupsResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer7IndustryListTimeseriesGroupsResponse] +type radarAttackLayer7IndustryListTimeseriesGroupsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTimeseriesGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTimeseriesGroupsResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer7IndustryListTimeseriesGroupsResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7IndustryListTimeseriesGroupsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTimeseriesGroupsResponseResultJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7IndustryListTimeseriesGroupsResponseResult] +type radarAttackLayer7IndustryListTimeseriesGroupsResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTimeseriesGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTimeseriesGroupsResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer7IndustryListTimeseriesGroupsResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7IndustryListTimeseriesGroupsResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7IndustryListTimeseriesGroupsResponseResultSerie0] +type radarAttackLayer7IndustryListTimeseriesGroupsResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTimeseriesGroupsResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTopsResponse struct { + Result RadarAttackLayer7IndustryListTopsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7IndustryListTopsResponseJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTopsResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer7IndustryListTopsResponse] +type radarAttackLayer7IndustryListTopsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTopsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTopsResponseResult struct { + Meta RadarAttackLayer7IndustryListTopsResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer7IndustryListTopsResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer7IndustryListTopsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTopsResponseResultJSON contains the JSON metadata +// for the struct [RadarAttackLayer7IndustryListTopsResponseResult] +type radarAttackLayer7IndustryListTopsResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTopsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTopsResponseResultMeta struct { + DateRange []RadarAttackLayer7IndustryListTopsResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7IndustryListTopsResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTopsResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer7IndustryListTopsResponseResultMeta] +type radarAttackLayer7IndustryListTopsResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTopsResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTopsResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7IndustryListTopsResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTopsResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7IndustryListTopsResponseResultMetaDateRange] +type radarAttackLayer7IndustryListTopsResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTopsResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfo] +type radarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTopsResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTopsResponseResultTop0 struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON radarAttackLayer7IndustryListTopsResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer7IndustryListTopsResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarAttackLayer7IndustryListTopsResponseResultTop0] +type radarAttackLayer7IndustryListTopsResponseResultTop0JSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IndustryListTopsResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IndustryListTimeseriesGroupsParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7IndustryListTimeseriesGroupsParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects (eg browsers, verticals, etc) to the top items over + // the time range. + LimitPerGroup param.Field[int64] `query:"limitPerGroup"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7IndustryListTimeseriesGroupsParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer7IndustryListTimeseriesGroupsParams]'s +// query parameters as `url.Values`. +func (r RadarAttackLayer7IndustryListTimeseriesGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval15m RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval = "15m" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval1h RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval = "1h" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval1d RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval = "1d" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval1w RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval = "1w" +) + +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange1d RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "1d" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange2d RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "2d" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange7d RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "7d" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange14d RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "14d" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange28d RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "28d" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange12w RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "12w" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange24w RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "24w" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange52w RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "52w" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange1dControl RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "1dControl" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange2dControl RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "2dControl" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange7dControl RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "7dControl" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange14dControl RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "14dControl" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange28dControl RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "28dControl" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange12wControl RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "12wControl" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange24wControl RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsFormat string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsFormatJson RadarAttackLayer7IndustryListTimeseriesGroupsParamsFormat = "JSON" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsFormatCsv RadarAttackLayer7IndustryListTimeseriesGroupsParamsFormat = "CSV" +) + +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodGet RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "GET" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodPost RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "POST" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodDelete RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "DELETE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodPut RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "PUT" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodHead RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "HEAD" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodPurge RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "PURGE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodOptions RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodPropfind RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodMkcol RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "MKCOL" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodPatch RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "PATCH" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodACL RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "ACL" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodBcopy RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "BCOPY" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodBdelete RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "BDELETE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodBmove RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "BMOVE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodBpropfind RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodBproppatch RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodCheckin RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodCheckout RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodConnect RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "CONNECT" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodCopy RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "COPY" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodLabel RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "LABEL" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodLock RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "LOCK" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodMerge RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "MERGE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodMkactivity RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodMkworkspace RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodMove RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "MOVE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodNotify RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodOrderpatch RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodPoll RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "POLL" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodProppatch RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodReport RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "REPORT" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodSearch RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "SEARCH" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodSubscribe RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodTrace RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "TRACE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodUncheckout RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodUnlock RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodUnsubscribe RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodUpdate RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "UPDATE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodVersioncontrol RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodBaselinecontrol RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodXmsenumatts RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodRpcOutData RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodRpcInData RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodJson RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "JSON" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodCook RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "COOK" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodTrack RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersion string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersionHttPv1 RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersionHttPv2 RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersionHttPv3 RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersion string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersionIPv4 RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersion = "IPv4" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersionIPv6 RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductDdos RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct = "DDOS" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductWaf RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct = "WAF" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductBotManagement RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductAccessRules RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductIPReputation RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductAPIShield RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductDataLossPrevention RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7IndustryListTimeseriesGroupsParamsNormalization string + +const ( + RadarAttackLayer7IndustryListTimeseriesGroupsParamsNormalizationPercentage RadarAttackLayer7IndustryListTimeseriesGroupsParamsNormalization = "PERCENTAGE" + RadarAttackLayer7IndustryListTimeseriesGroupsParamsNormalizationMin0Max RadarAttackLayer7IndustryListTimeseriesGroupsParamsNormalization = "MIN0_MAX" +) + +type RadarAttackLayer7IndustryListTopsParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7IndustryListTopsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7IndustryListTopsParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7IndustryListTopsParams]'s query parameters +// as `url.Values`. +func (r RadarAttackLayer7IndustryListTopsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7IndustryListTopsParamsDateRange string + +const ( + RadarAttackLayer7IndustryListTopsParamsDateRange1d RadarAttackLayer7IndustryListTopsParamsDateRange = "1d" + RadarAttackLayer7IndustryListTopsParamsDateRange2d RadarAttackLayer7IndustryListTopsParamsDateRange = "2d" + RadarAttackLayer7IndustryListTopsParamsDateRange7d RadarAttackLayer7IndustryListTopsParamsDateRange = "7d" + RadarAttackLayer7IndustryListTopsParamsDateRange14d RadarAttackLayer7IndustryListTopsParamsDateRange = "14d" + RadarAttackLayer7IndustryListTopsParamsDateRange28d RadarAttackLayer7IndustryListTopsParamsDateRange = "28d" + RadarAttackLayer7IndustryListTopsParamsDateRange12w RadarAttackLayer7IndustryListTopsParamsDateRange = "12w" + RadarAttackLayer7IndustryListTopsParamsDateRange24w RadarAttackLayer7IndustryListTopsParamsDateRange = "24w" + RadarAttackLayer7IndustryListTopsParamsDateRange52w RadarAttackLayer7IndustryListTopsParamsDateRange = "52w" + RadarAttackLayer7IndustryListTopsParamsDateRange1dControl RadarAttackLayer7IndustryListTopsParamsDateRange = "1dControl" + RadarAttackLayer7IndustryListTopsParamsDateRange2dControl RadarAttackLayer7IndustryListTopsParamsDateRange = "2dControl" + RadarAttackLayer7IndustryListTopsParamsDateRange7dControl RadarAttackLayer7IndustryListTopsParamsDateRange = "7dControl" + RadarAttackLayer7IndustryListTopsParamsDateRange14dControl RadarAttackLayer7IndustryListTopsParamsDateRange = "14dControl" + RadarAttackLayer7IndustryListTopsParamsDateRange28dControl RadarAttackLayer7IndustryListTopsParamsDateRange = "28dControl" + RadarAttackLayer7IndustryListTopsParamsDateRange12wControl RadarAttackLayer7IndustryListTopsParamsDateRange = "12wControl" + RadarAttackLayer7IndustryListTopsParamsDateRange24wControl RadarAttackLayer7IndustryListTopsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7IndustryListTopsParamsFormat string + +const ( + RadarAttackLayer7IndustryListTopsParamsFormatJson RadarAttackLayer7IndustryListTopsParamsFormat = "JSON" + RadarAttackLayer7IndustryListTopsParamsFormatCsv RadarAttackLayer7IndustryListTopsParamsFormat = "CSV" +) diff --git a/radarattacklayer7industry_test.go b/radarattacklayer7industry_test.go new file mode 100644 index 00000000000..f32cf1209aa --- /dev/null +++ b/radarattacklayer7industry_test.go @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7IndustryListTimeseriesGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Industries.ListTimeseriesGroups(context.TODO(), cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange{cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange1d, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange2d, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethod{cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodGet, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodPost, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersion{cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersion{cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersionIPv4, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsIPVersionIPv6}), + LimitPerGroup: cloudflare.F(int64(4)), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProduct{cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductDdos, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductWaf, cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7IndustryListTimeseriesGroupsParamsNormalizationPercentage), + }) + 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 TestRadarAttackLayer7IndustryListTopsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Industries.ListTops(context.TODO(), cloudflare.RadarAttackLayer7IndustryListTopsParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7IndustryListTopsParamsDateRange{cloudflare.RadarAttackLayer7IndustryListTopsParamsDateRange1d, cloudflare.RadarAttackLayer7IndustryListTopsParamsDateRange2d, cloudflare.RadarAttackLayer7IndustryListTopsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7IndustryListTopsParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7ipversion.go b/radarattacklayer7ipversion.go new file mode 100644 index 00000000000..3010d5ddf39 --- /dev/null +++ b/radarattacklayer7ipversion.go @@ -0,0 +1,268 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7IPVersionService 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 +// [NewRadarAttackLayer7IPVersionService] method instead. +type RadarAttackLayer7IPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7IPVersionService 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 NewRadarAttackLayer7IPVersionService(opts ...option.RequestOption) (r *RadarAttackLayer7IPVersionService) { + r = &RadarAttackLayer7IPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by ip version used over time. +func (r *RadarAttackLayer7IPVersionService) ListTimeseriesGroups(ctx context.Context, query RadarAttackLayer7IPVersionListTimeseriesGroupsParams, opts ...option.RequestOption) (res *RadarAttackLayer7IPVersionListTimeseriesGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7IPVersionListTimeseriesGroupsResponse struct { + Result RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7IPVersionListTimeseriesGroupsResponseJSON `json:"-"` +} + +// radarAttackLayer7IPVersionListTimeseriesGroupsResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer7IPVersionListTimeseriesGroupsResponse] +type radarAttackLayer7IPVersionListTimeseriesGroupsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IPVersionListTimeseriesGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7IPVersionListTimeseriesGroupsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7IPVersionListTimeseriesGroupsResponseResultJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResult] +type radarAttackLayer7IPVersionListTimeseriesGroupsResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResultSerie0 struct { + IPv4 []string `json:"IPv4,required"` + IPv6 []string `json:"IPv6,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer7IPVersionListTimeseriesGroupsResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7IPVersionListTimeseriesGroupsResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResultSerie0] +type radarAttackLayer7IPVersionListTimeseriesGroupsResponseResultSerie0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7IPVersionListTimeseriesGroupsResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7IPVersionListTimeseriesGroupsParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7IPVersionListTimeseriesGroupsParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersion] `query:"httpVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7IPVersionListTimeseriesGroupsParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer7IPVersionListTimeseriesGroupsParams]'s +// query parameters as `url.Values`. +func (r RadarAttackLayer7IPVersionListTimeseriesGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval string + +const ( + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval15m RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval = "15m" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval1h RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval = "1h" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval1d RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval = "1d" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval1w RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval = "1w" +) + +type RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange string + +const ( + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange1d RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "1d" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange2d RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "2d" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange7d RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "7d" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange14d RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "14d" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange28d RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "28d" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange12w RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "12w" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange24w RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "24w" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange52w RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "52w" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange1dControl RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "1dControl" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange2dControl RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "2dControl" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange7dControl RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "7dControl" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange14dControl RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "14dControl" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange28dControl RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "28dControl" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange12wControl RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "12wControl" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange24wControl RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7IPVersionListTimeseriesGroupsParamsFormat string + +const ( + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsFormatJson RadarAttackLayer7IPVersionListTimeseriesGroupsParamsFormat = "JSON" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsFormatCsv RadarAttackLayer7IPVersionListTimeseriesGroupsParamsFormat = "CSV" +) + +type RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod string + +const ( + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodGet RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "GET" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodPost RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "POST" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodDelete RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "DELETE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodPut RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "PUT" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodHead RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "HEAD" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodPurge RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "PURGE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodOptions RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodPropfind RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodMkcol RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "MKCOL" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodPatch RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "PATCH" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodACL RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "ACL" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodBcopy RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "BCOPY" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodBdelete RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "BDELETE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodBmove RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "BMOVE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodBpropfind RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodBproppatch RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodCheckin RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodCheckout RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodConnect RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "CONNECT" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodCopy RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "COPY" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodLabel RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "LABEL" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodLock RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "LOCK" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodMerge RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "MERGE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodMkactivity RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodMkworkspace RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodMove RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "MOVE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodNotify RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodOrderpatch RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodPoll RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "POLL" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodProppatch RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodReport RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "REPORT" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodSearch RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "SEARCH" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodSubscribe RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodTrace RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "TRACE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodUncheckout RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodUnlock RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodUnsubscribe RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodUpdate RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "UPDATE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodVersioncontrol RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodBaselinecontrol RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodXmsenumatts RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodRpcOutData RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodRpcInData RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodJson RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "JSON" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodCook RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "COOK" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodTrack RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersion string + +const ( + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersionHttPv1 RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersionHttPv2 RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersionHttPv3 RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct string + +const ( + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductDdos RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct = "DDOS" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductWaf RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct = "WAF" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductBotManagement RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductAccessRules RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductIPReputation RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductAPIShield RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductDataLossPrevention RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7IPVersionListTimeseriesGroupsParamsNormalization string + +const ( + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsNormalizationPercentage RadarAttackLayer7IPVersionListTimeseriesGroupsParamsNormalization = "PERCENTAGE" + RadarAttackLayer7IPVersionListTimeseriesGroupsParamsNormalizationMin0Max RadarAttackLayer7IPVersionListTimeseriesGroupsParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer7ipversion_test.go b/radarattacklayer7ipversion_test.go new file mode 100644 index 00000000000..5051aeeb575 --- /dev/null +++ b/radarattacklayer7ipversion_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7IPVersionListTimeseriesGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.IPVersions.ListTimeseriesGroups(context.TODO(), cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange{cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange1d, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange2d, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethod{cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodGet, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodPost, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersion{cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsHTTPVersionHttPv3}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProduct{cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductDdos, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductWaf, cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7IPVersionListTimeseriesGroupsParamsNormalizationPercentage), + }) + 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/radarattacklayer7managedrule.go b/radarattacklayer7managedrule.go new file mode 100644 index 00000000000..ee017cecc94 --- /dev/null +++ b/radarattacklayer7managedrule.go @@ -0,0 +1,276 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7ManagedRuleService 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 +// [NewRadarAttackLayer7ManagedRuleService] method instead. +type RadarAttackLayer7ManagedRuleService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7ManagedRuleService 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 NewRadarAttackLayer7ManagedRuleService(opts ...option.RequestOption) (r *RadarAttackLayer7ManagedRuleService) { + r = &RadarAttackLayer7ManagedRuleService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by managed rules used over time. +func (r *RadarAttackLayer7ManagedRuleService) ListTimeseriesGroups(ctx context.Context, query RadarAttackLayer7ManagedRuleListTimeseriesGroupsParams, opts ...option.RequestOption) (res *RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups/managed_rules" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponse struct { + Result RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseJSON `json:"-"` +} + +// radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponse] +type radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResult] +type radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultSerie0 struct { + Bot []string `json:"Bot,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultSerie0JSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultSerie0] +type radarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultSerie0JSON struct { + Bot apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7ManagedRuleListTimeseriesGroupsResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer7ManagedRuleListTimeseriesGroupsParams]'s +// query parameters as `url.Values`. +func (r RadarAttackLayer7ManagedRuleListTimeseriesGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval15m RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval = "15m" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval1h RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval = "1h" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval1d RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval = "1d" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval1w RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval = "1w" +) + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange1d RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "1d" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange2d RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "2d" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange7d RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "7d" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange14d RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "14d" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange28d RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "28d" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange12w RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "12w" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange24w RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "24w" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange52w RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "52w" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange1dControl RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "1dControl" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange2dControl RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "2dControl" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange7dControl RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "7dControl" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange14dControl RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "14dControl" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange28dControl RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "28dControl" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange12wControl RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "12wControl" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange24wControl RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsFormat string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsFormatJson RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsFormat = "JSON" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsFormatCsv RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsFormat = "CSV" +) + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodGet RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "GET" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodPost RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "POST" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodDelete RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "DELETE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodPut RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "PUT" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodHead RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "HEAD" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodPurge RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "PURGE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodOptions RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodPropfind RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodMkcol RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "MKCOL" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodPatch RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "PATCH" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodACL RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "ACL" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodBcopy RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "BCOPY" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodBdelete RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "BDELETE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodBmove RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "BMOVE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodBpropfind RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodBproppatch RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodCheckin RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodCheckout RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodConnect RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "CONNECT" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodCopy RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "COPY" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodLabel RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "LABEL" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodLock RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "LOCK" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodMerge RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "MERGE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodMkactivity RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodMkworkspace RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodMove RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "MOVE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodNotify RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodOrderpatch RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodPoll RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "POLL" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodProppatch RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodReport RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "REPORT" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodSearch RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "SEARCH" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodSubscribe RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodTrace RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "TRACE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodUncheckout RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodUnlock RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodUnsubscribe RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodUpdate RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "UPDATE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodVersioncontrol RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodBaselinecontrol RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodXmsenumatts RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodRpcOutData RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodRpcInData RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodJson RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "JSON" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodCook RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "COOK" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodTrack RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersion string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersionHttPv1 RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersionHttPv2 RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersionHttPv3 RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersion string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersionIPv4 RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersion = "IPv4" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersionIPv6 RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductDdos RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct = "DDOS" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductWaf RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct = "WAF" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductBotManagement RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductAccessRules RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductIPReputation RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductAPIShield RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductDataLossPrevention RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsNormalization string + +const ( + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsNormalizationPercentage RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsNormalization = "PERCENTAGE" + RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsNormalizationMin0Max RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer7managedrule_test.go b/radarattacklayer7managedrule_test.go new file mode 100644 index 00000000000..5481e3927a0 --- /dev/null +++ b/radarattacklayer7managedrule_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7ManagedRuleListTimeseriesGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.ManagedRules.ListTimeseriesGroups(context.TODO(), cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange{cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange1d, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange2d, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethod{cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodGet, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodPost, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersion{cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersion{cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersionIPv4, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProduct{cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductDdos, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductWaf, cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7ManagedRuleListTimeseriesGroupsParamsNormalizationPercentage), + }) + 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/radarattacklayer7mitigationproduct.go b/radarattacklayer7mitigationproduct.go new file mode 100644 index 00000000000..345c2d99cac --- /dev/null +++ b/radarattacklayer7mitigationproduct.go @@ -0,0 +1,558 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7MitigationProductService 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 +// [NewRadarAttackLayer7MitigationProductService] method instead. +type RadarAttackLayer7MitigationProductService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7MitigationProductService 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 NewRadarAttackLayer7MitigationProductService(opts ...option.RequestOption) (r *RadarAttackLayer7MitigationProductService) { + r = &RadarAttackLayer7MitigationProductService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by mitigation product used. +func (r *RadarAttackLayer7MitigationProductService) List(ctx context.Context, query RadarAttackLayer7MitigationProductListParams, opts ...option.RequestOption) (res *RadarAttackLayer7MitigationProductListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/summary/mitigation_product" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Percentage distribution of attacks by mitigation product used over time. +func (r *RadarAttackLayer7MitigationProductService) ListTimeseriesGroups(ctx context.Context, query RadarAttackLayer7MitigationProductListTimeseriesGroupsParams, opts ...option.RequestOption) (res *RadarAttackLayer7MitigationProductListTimeseriesGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups/mitigation_product" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7MitigationProductListResponse struct { + Result RadarAttackLayer7MitigationProductListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7MitigationProductListResponseJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListResponseJSON contains the JSON metadata +// for the struct [RadarAttackLayer7MitigationProductListResponse] +type radarAttackLayer7MitigationProductListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListResponseResult struct { + Meta RadarAttackLayer7MitigationProductListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer7MitigationProductListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer7MitigationProductListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7MitigationProductListResponseResult] +type radarAttackLayer7MitigationProductListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListResponseResultMeta struct { + DateRange []RadarAttackLayer7MitigationProductListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7MitigationProductListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7MitigationProductListResponseResultMeta] +type radarAttackLayer7MitigationProductListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7MitigationProductListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7MitigationProductListResponseResultMetaDateRange] +type radarAttackLayer7MitigationProductListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfo] +type radarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListResponseResultSummary0 struct { + Ddos string `json:"DDOS,required"` + Waf string `json:"WAF,required"` + JSON radarAttackLayer7MitigationProductListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListResponseResultSummary0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7MitigationProductListResponseResultSummary0] +type radarAttackLayer7MitigationProductListResponseResultSummary0JSON struct { + Ddos apijson.Field + Waf apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsResponse struct { + Result RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7MitigationProductListTimeseriesGroupsResponseJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListTimeseriesGroupsResponseJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7MitigationProductListTimeseriesGroupsResponse] +type radarAttackLayer7MitigationProductListTimeseriesGroupsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListTimeseriesGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResult] +type radarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultSerie0 struct { + Ddos []string `json:"DDOS,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultSerie0JSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultSerie0] +type radarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultSerie0JSON struct { + Ddos apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7MitigationProductListTimeseriesGroupsResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7MitigationProductListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7MitigationProductListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7MitigationProductListParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7MitigationProductListParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7MitigationProductListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7MitigationProductListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7MitigationProductListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7MitigationProductListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7MitigationProductListParamsDateRange string + +const ( + RadarAttackLayer7MitigationProductListParamsDateRange1d RadarAttackLayer7MitigationProductListParamsDateRange = "1d" + RadarAttackLayer7MitigationProductListParamsDateRange2d RadarAttackLayer7MitigationProductListParamsDateRange = "2d" + RadarAttackLayer7MitigationProductListParamsDateRange7d RadarAttackLayer7MitigationProductListParamsDateRange = "7d" + RadarAttackLayer7MitigationProductListParamsDateRange14d RadarAttackLayer7MitigationProductListParamsDateRange = "14d" + RadarAttackLayer7MitigationProductListParamsDateRange28d RadarAttackLayer7MitigationProductListParamsDateRange = "28d" + RadarAttackLayer7MitigationProductListParamsDateRange12w RadarAttackLayer7MitigationProductListParamsDateRange = "12w" + RadarAttackLayer7MitigationProductListParamsDateRange24w RadarAttackLayer7MitigationProductListParamsDateRange = "24w" + RadarAttackLayer7MitigationProductListParamsDateRange52w RadarAttackLayer7MitigationProductListParamsDateRange = "52w" + RadarAttackLayer7MitigationProductListParamsDateRange1dControl RadarAttackLayer7MitigationProductListParamsDateRange = "1dControl" + RadarAttackLayer7MitigationProductListParamsDateRange2dControl RadarAttackLayer7MitigationProductListParamsDateRange = "2dControl" + RadarAttackLayer7MitigationProductListParamsDateRange7dControl RadarAttackLayer7MitigationProductListParamsDateRange = "7dControl" + RadarAttackLayer7MitigationProductListParamsDateRange14dControl RadarAttackLayer7MitigationProductListParamsDateRange = "14dControl" + RadarAttackLayer7MitigationProductListParamsDateRange28dControl RadarAttackLayer7MitigationProductListParamsDateRange = "28dControl" + RadarAttackLayer7MitigationProductListParamsDateRange12wControl RadarAttackLayer7MitigationProductListParamsDateRange = "12wControl" + RadarAttackLayer7MitigationProductListParamsDateRange24wControl RadarAttackLayer7MitigationProductListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7MitigationProductListParamsFormat string + +const ( + RadarAttackLayer7MitigationProductListParamsFormatJson RadarAttackLayer7MitigationProductListParamsFormat = "JSON" + RadarAttackLayer7MitigationProductListParamsFormatCsv RadarAttackLayer7MitigationProductListParamsFormat = "CSV" +) + +type RadarAttackLayer7MitigationProductListParamsHTTPMethod string + +const ( + RadarAttackLayer7MitigationProductListParamsHTTPMethodGet RadarAttackLayer7MitigationProductListParamsHTTPMethod = "GET" + RadarAttackLayer7MitigationProductListParamsHTTPMethodPost RadarAttackLayer7MitigationProductListParamsHTTPMethod = "POST" + RadarAttackLayer7MitigationProductListParamsHTTPMethodDelete RadarAttackLayer7MitigationProductListParamsHTTPMethod = "DELETE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodPut RadarAttackLayer7MitigationProductListParamsHTTPMethod = "PUT" + RadarAttackLayer7MitigationProductListParamsHTTPMethodHead RadarAttackLayer7MitigationProductListParamsHTTPMethod = "HEAD" + RadarAttackLayer7MitigationProductListParamsHTTPMethodPurge RadarAttackLayer7MitigationProductListParamsHTTPMethod = "PURGE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodOptions RadarAttackLayer7MitigationProductListParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7MitigationProductListParamsHTTPMethodPropfind RadarAttackLayer7MitigationProductListParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7MitigationProductListParamsHTTPMethodMkcol RadarAttackLayer7MitigationProductListParamsHTTPMethod = "MKCOL" + RadarAttackLayer7MitigationProductListParamsHTTPMethodPatch RadarAttackLayer7MitigationProductListParamsHTTPMethod = "PATCH" + RadarAttackLayer7MitigationProductListParamsHTTPMethodACL RadarAttackLayer7MitigationProductListParamsHTTPMethod = "ACL" + RadarAttackLayer7MitigationProductListParamsHTTPMethodBcopy RadarAttackLayer7MitigationProductListParamsHTTPMethod = "BCOPY" + RadarAttackLayer7MitigationProductListParamsHTTPMethodBdelete RadarAttackLayer7MitigationProductListParamsHTTPMethod = "BDELETE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodBmove RadarAttackLayer7MitigationProductListParamsHTTPMethod = "BMOVE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodBpropfind RadarAttackLayer7MitigationProductListParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7MitigationProductListParamsHTTPMethodBproppatch RadarAttackLayer7MitigationProductListParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7MitigationProductListParamsHTTPMethodCheckin RadarAttackLayer7MitigationProductListParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7MitigationProductListParamsHTTPMethodCheckout RadarAttackLayer7MitigationProductListParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7MitigationProductListParamsHTTPMethodConnect RadarAttackLayer7MitigationProductListParamsHTTPMethod = "CONNECT" + RadarAttackLayer7MitigationProductListParamsHTTPMethodCopy RadarAttackLayer7MitigationProductListParamsHTTPMethod = "COPY" + RadarAttackLayer7MitigationProductListParamsHTTPMethodLabel RadarAttackLayer7MitigationProductListParamsHTTPMethod = "LABEL" + RadarAttackLayer7MitigationProductListParamsHTTPMethodLock RadarAttackLayer7MitigationProductListParamsHTTPMethod = "LOCK" + RadarAttackLayer7MitigationProductListParamsHTTPMethodMerge RadarAttackLayer7MitigationProductListParamsHTTPMethod = "MERGE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodMkactivity RadarAttackLayer7MitigationProductListParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7MitigationProductListParamsHTTPMethodMkworkspace RadarAttackLayer7MitigationProductListParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodMove RadarAttackLayer7MitigationProductListParamsHTTPMethod = "MOVE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodNotify RadarAttackLayer7MitigationProductListParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7MitigationProductListParamsHTTPMethodOrderpatch RadarAttackLayer7MitigationProductListParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7MitigationProductListParamsHTTPMethodPoll RadarAttackLayer7MitigationProductListParamsHTTPMethod = "POLL" + RadarAttackLayer7MitigationProductListParamsHTTPMethodProppatch RadarAttackLayer7MitigationProductListParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7MitigationProductListParamsHTTPMethodReport RadarAttackLayer7MitigationProductListParamsHTTPMethod = "REPORT" + RadarAttackLayer7MitigationProductListParamsHTTPMethodSearch RadarAttackLayer7MitigationProductListParamsHTTPMethod = "SEARCH" + RadarAttackLayer7MitigationProductListParamsHTTPMethodSubscribe RadarAttackLayer7MitigationProductListParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodTrace RadarAttackLayer7MitigationProductListParamsHTTPMethod = "TRACE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodUncheckout RadarAttackLayer7MitigationProductListParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7MitigationProductListParamsHTTPMethodUnlock RadarAttackLayer7MitigationProductListParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7MitigationProductListParamsHTTPMethodUnsubscribe RadarAttackLayer7MitigationProductListParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodUpdate RadarAttackLayer7MitigationProductListParamsHTTPMethod = "UPDATE" + RadarAttackLayer7MitigationProductListParamsHTTPMethodVersioncontrol RadarAttackLayer7MitigationProductListParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7MitigationProductListParamsHTTPMethodBaselinecontrol RadarAttackLayer7MitigationProductListParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7MitigationProductListParamsHTTPMethodXmsenumatts RadarAttackLayer7MitigationProductListParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7MitigationProductListParamsHTTPMethodRpcOutData RadarAttackLayer7MitigationProductListParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7MitigationProductListParamsHTTPMethodRpcInData RadarAttackLayer7MitigationProductListParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7MitigationProductListParamsHTTPMethodJson RadarAttackLayer7MitigationProductListParamsHTTPMethod = "JSON" + RadarAttackLayer7MitigationProductListParamsHTTPMethodCook RadarAttackLayer7MitigationProductListParamsHTTPMethod = "COOK" + RadarAttackLayer7MitigationProductListParamsHTTPMethodTrack RadarAttackLayer7MitigationProductListParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7MitigationProductListParamsHTTPVersion string + +const ( + RadarAttackLayer7MitigationProductListParamsHTTPVersionHttPv1 RadarAttackLayer7MitigationProductListParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7MitigationProductListParamsHTTPVersionHttPv2 RadarAttackLayer7MitigationProductListParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7MitigationProductListParamsHTTPVersionHttPv3 RadarAttackLayer7MitigationProductListParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7MitigationProductListParamsIPVersion string + +const ( + RadarAttackLayer7MitigationProductListParamsIPVersionIPv4 RadarAttackLayer7MitigationProductListParamsIPVersion = "IPv4" + RadarAttackLayer7MitigationProductListParamsIPVersionIPv6 RadarAttackLayer7MitigationProductListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes +// [RadarAttackLayer7MitigationProductListTimeseriesGroupsParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7MitigationProductListTimeseriesGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval string + +const ( + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval15m RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval = "15m" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval1h RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval = "1h" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval1d RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval = "1d" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval1w RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval = "1w" +) + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange string + +const ( + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange1d RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "1d" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange2d RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "2d" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange7d RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "7d" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange14d RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "14d" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange28d RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "28d" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange12w RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "12w" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange24w RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "24w" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange52w RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "52w" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange1dControl RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "1dControl" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange2dControl RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "2dControl" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange7dControl RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "7dControl" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange14dControl RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "14dControl" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange28dControl RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "28dControl" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange12wControl RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "12wControl" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange24wControl RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsFormat string + +const ( + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsFormatJson RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsFormat = "JSON" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsFormatCsv RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsFormat = "CSV" +) + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod string + +const ( + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodGet RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "GET" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodPost RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "POST" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodDelete RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "DELETE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodPut RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "PUT" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodHead RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "HEAD" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodPurge RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "PURGE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodOptions RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodPropfind RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodMkcol RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "MKCOL" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodPatch RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "PATCH" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodACL RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "ACL" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodBcopy RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "BCOPY" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodBdelete RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "BDELETE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodBmove RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "BMOVE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodBpropfind RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodBproppatch RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodCheckin RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodCheckout RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodConnect RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "CONNECT" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodCopy RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "COPY" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodLabel RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "LABEL" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodLock RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "LOCK" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodMerge RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "MERGE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodMkactivity RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodMkworkspace RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodMove RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "MOVE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodNotify RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodOrderpatch RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodPoll RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "POLL" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodProppatch RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodReport RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "REPORT" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodSearch RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "SEARCH" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodSubscribe RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodTrace RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "TRACE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodUncheckout RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodUnlock RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodUnsubscribe RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodUpdate RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "UPDATE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodVersioncontrol RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodBaselinecontrol RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodXmsenumatts RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodRpcOutData RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodRpcInData RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodJson RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "JSON" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodCook RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "COOK" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodTrack RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersion string + +const ( + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersionHttPv1 RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersionHttPv2 RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersionHttPv3 RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersion string + +const ( + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersionIPv4 RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersion = "IPv4" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersionIPv6 RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersion = "IPv6" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsNormalization string + +const ( + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsNormalizationPercentage RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsNormalization = "PERCENTAGE" + RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsNormalizationMin0Max RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer7mitigationproduct_test.go b/radarattacklayer7mitigationproduct_test.go new file mode 100644 index 00000000000..7c3710c083a --- /dev/null +++ b/radarattacklayer7mitigationproduct_test.go @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7MitigationProductListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.MitigationProducts.List(context.TODO(), cloudflare.RadarAttackLayer7MitigationProductListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListParamsDateRange{cloudflare.RadarAttackLayer7MitigationProductListParamsDateRange1d, cloudflare.RadarAttackLayer7MitigationProductListParamsDateRange2d, cloudflare.RadarAttackLayer7MitigationProductListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7MitigationProductListParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPMethod{cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPMethodGet, cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPMethodPost, cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPVersion{cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7MitigationProductListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListParamsIPVersion{cloudflare.RadarAttackLayer7MitigationProductListParamsIPVersionIPv4, cloudflare.RadarAttackLayer7MitigationProductListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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 TestRadarAttackLayer7MitigationProductListTimeseriesGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.MitigationProducts.ListTimeseriesGroups(context.TODO(), cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange{cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange1d, cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange2d, cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethod{cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodGet, cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodPost, cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersion{cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersion{cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersionIPv4, cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7MitigationProductListTimeseriesGroupsParamsNormalizationPercentage), + }) + 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/radarattacklayer7summary.go b/radarattacklayer7summary.go new file mode 100644 index 00000000000..a35310c5c43 --- /dev/null +++ b/radarattacklayer7summary.go @@ -0,0 +1,268 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7SummaryService 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 +// [NewRadarAttackLayer7SummaryService] method instead. +type RadarAttackLayer7SummaryService struct { + Options []option.RequestOption + HTTPMethod *RadarAttackLayer7SummaryHTTPMethodService + HTTPVersion *RadarAttackLayer7SummaryHTTPVersionService + IPVersion *RadarAttackLayer7SummaryIPVersionService + ManagedRules *RadarAttackLayer7SummaryManagedRuleService +} + +// NewRadarAttackLayer7SummaryService 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 NewRadarAttackLayer7SummaryService(opts ...option.RequestOption) (r *RadarAttackLayer7SummaryService) { + r = &RadarAttackLayer7SummaryService{} + r.Options = opts + r.HTTPMethod = NewRadarAttackLayer7SummaryHTTPMethodService(opts...) + r.HTTPVersion = NewRadarAttackLayer7SummaryHTTPVersionService(opts...) + r.IPVersion = NewRadarAttackLayer7SummaryIPVersionService(opts...) + r.ManagedRules = NewRadarAttackLayer7SummaryManagedRuleService(opts...) + return +} + +// Percentage distribution of mitigation techniques in Layer 7 attacks. +func (r *RadarAttackLayer7SummaryService) List(ctx context.Context, query RadarAttackLayer7SummaryListParams, opts ...option.RequestOption) (res *RadarAttackLayer7SummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/summary" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7SummaryListResponse struct { + Result RadarAttackLayer7SummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7SummaryListResponseJSON `json:"-"` +} + +// radarAttackLayer7SummaryListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer7SummaryListResponse] +type radarAttackLayer7SummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryListResponseResult struct { + Meta RadarAttackLayer7SummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer7SummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer7SummaryListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7SummaryListResponseResultJSON contains the JSON metadata for +// the struct [RadarAttackLayer7SummaryListResponseResult] +type radarAttackLayer7SummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryListResponseResultMeta struct { + DateRange []RadarAttackLayer7SummaryListResponseResultMetaDateRange `json:"dateRange,required"` + ConfidenceInfo RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7SummaryListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7SummaryListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAttackLayer7SummaryListResponseResultMeta] +type radarAttackLayer7SummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7SummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7SummaryListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7SummaryListResponseResultMetaDateRange] +type radarAttackLayer7SummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7SummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7SummaryListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfo] +type radarAttackLayer7SummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7SummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7SummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7SummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryListResponseResultSummary0 struct { + AccessRules string `json:"ACCESS_RULES,required"` + APIShield string `json:"API_SHIELD,required"` + BotManagement string `json:"BOT_MANAGEMENT,required"` + DataLossPrevention string `json:"DATA_LOSS_PREVENTION,required"` + Ddos string `json:"DDOS,required"` + IPReputation string `json:"IP_REPUTATION,required"` + Waf string `json:"WAF,required"` + JSON radarAttackLayer7SummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer7SummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarAttackLayer7SummaryListResponseResultSummary0] +type radarAttackLayer7SummaryListResponseResultSummary0JSON struct { + AccessRules apijson.Field + APIShield apijson.Field + BotManagement apijson.Field + DataLossPrevention apijson.Field + Ddos apijson.Field + IPReputation apijson.Field + Waf apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7SummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7SummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7SummaryListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer7SummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7SummaryListParamsDateRange string + +const ( + RadarAttackLayer7SummaryListParamsDateRange1d RadarAttackLayer7SummaryListParamsDateRange = "1d" + RadarAttackLayer7SummaryListParamsDateRange2d RadarAttackLayer7SummaryListParamsDateRange = "2d" + RadarAttackLayer7SummaryListParamsDateRange7d RadarAttackLayer7SummaryListParamsDateRange = "7d" + RadarAttackLayer7SummaryListParamsDateRange14d RadarAttackLayer7SummaryListParamsDateRange = "14d" + RadarAttackLayer7SummaryListParamsDateRange28d RadarAttackLayer7SummaryListParamsDateRange = "28d" + RadarAttackLayer7SummaryListParamsDateRange12w RadarAttackLayer7SummaryListParamsDateRange = "12w" + RadarAttackLayer7SummaryListParamsDateRange24w RadarAttackLayer7SummaryListParamsDateRange = "24w" + RadarAttackLayer7SummaryListParamsDateRange52w RadarAttackLayer7SummaryListParamsDateRange = "52w" + RadarAttackLayer7SummaryListParamsDateRange1dControl RadarAttackLayer7SummaryListParamsDateRange = "1dControl" + RadarAttackLayer7SummaryListParamsDateRange2dControl RadarAttackLayer7SummaryListParamsDateRange = "2dControl" + RadarAttackLayer7SummaryListParamsDateRange7dControl RadarAttackLayer7SummaryListParamsDateRange = "7dControl" + RadarAttackLayer7SummaryListParamsDateRange14dControl RadarAttackLayer7SummaryListParamsDateRange = "14dControl" + RadarAttackLayer7SummaryListParamsDateRange28dControl RadarAttackLayer7SummaryListParamsDateRange = "28dControl" + RadarAttackLayer7SummaryListParamsDateRange12wControl RadarAttackLayer7SummaryListParamsDateRange = "12wControl" + RadarAttackLayer7SummaryListParamsDateRange24wControl RadarAttackLayer7SummaryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7SummaryListParamsFormat string + +const ( + RadarAttackLayer7SummaryListParamsFormatJson RadarAttackLayer7SummaryListParamsFormat = "JSON" + RadarAttackLayer7SummaryListParamsFormatCsv RadarAttackLayer7SummaryListParamsFormat = "CSV" +) diff --git a/radarattacklayer7summary_test.go b/radarattacklayer7summary_test.go new file mode 100644 index 00000000000..b1ee419ff85 --- /dev/null +++ b/radarattacklayer7summary_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7SummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Summaries.List(context.TODO(), cloudflare.RadarAttackLayer7SummaryListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryListParamsDateRange{cloudflare.RadarAttackLayer7SummaryListParamsDateRange1d, cloudflare.RadarAttackLayer7SummaryListParamsDateRange2d, cloudflare.RadarAttackLayer7SummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7SummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7summaryhttpmethod.go b/radarattacklayer7summaryhttpmethod.go new file mode 100644 index 00000000000..a5bc834d32a --- /dev/null +++ b/radarattacklayer7summaryhttpmethod.go @@ -0,0 +1,290 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7SummaryHTTPMethodService 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 +// [NewRadarAttackLayer7SummaryHTTPMethodService] method instead. +type RadarAttackLayer7SummaryHTTPMethodService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7SummaryHTTPMethodService 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 NewRadarAttackLayer7SummaryHTTPMethodService(opts ...option.RequestOption) (r *RadarAttackLayer7SummaryHTTPMethodService) { + r = &RadarAttackLayer7SummaryHTTPMethodService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by http method used. +func (r *RadarAttackLayer7SummaryHTTPMethodService) List(ctx context.Context, query RadarAttackLayer7SummaryHTTPMethodListParams, opts ...option.RequestOption) (res *RadarAttackLayer7SummaryHTTPMethodListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/summary/http_method" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7SummaryHTTPMethodListResponse struct { + Result RadarAttackLayer7SummaryHTTPMethodListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7SummaryHTTPMethodListResponseJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPMethodListResponseJSON contains the JSON metadata +// for the struct [RadarAttackLayer7SummaryHTTPMethodListResponse] +type radarAttackLayer7SummaryHTTPMethodListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPMethodListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPMethodListResponseResult struct { + Meta RadarAttackLayer7SummaryHTTPMethodListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer7SummaryHTTPMethodListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer7SummaryHTTPMethodListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPMethodListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7SummaryHTTPMethodListResponseResult] +type radarAttackLayer7SummaryHTTPMethodListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPMethodListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPMethodListResponseResultMeta struct { + DateRange []RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7SummaryHTTPMethodListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPMethodListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7SummaryHTTPMethodListResponseResultMeta] +type radarAttackLayer7SummaryHTTPMethodListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPMethodListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7SummaryHTTPMethodListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPMethodListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaDateRange] +type radarAttackLayer7SummaryHTTPMethodListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfo] +type radarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPMethodListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPMethodListResponseResultSummary0 struct { + Get string `json:"GET,required"` + Post string `json:"POST,required"` + JSON radarAttackLayer7SummaryHTTPMethodListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPMethodListResponseResultSummary0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPMethodListResponseResultSummary0] +type radarAttackLayer7SummaryHTTPMethodListResponseResultSummary0JSON struct { + Get apijson.Field + Post apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPMethodListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPMethodListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7SummaryHTTPMethodListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7SummaryHTTPMethodListParamsFormat] `query:"format"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7SummaryHTTPMethodListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7SummaryHTTPMethodListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7SummaryHTTPMethodListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7SummaryHTTPMethodListParamsDateRange string + +const ( + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange1d RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "1d" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange2d RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "2d" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange7d RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "7d" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange14d RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "14d" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange28d RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "28d" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange12w RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "12w" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange24w RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "24w" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange52w RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "52w" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange1dControl RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "1dControl" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange2dControl RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "2dControl" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange7dControl RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "7dControl" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange14dControl RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "14dControl" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange28dControl RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "28dControl" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange12wControl RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "12wControl" + RadarAttackLayer7SummaryHTTPMethodListParamsDateRange24wControl RadarAttackLayer7SummaryHTTPMethodListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7SummaryHTTPMethodListParamsFormat string + +const ( + RadarAttackLayer7SummaryHTTPMethodListParamsFormatJson RadarAttackLayer7SummaryHTTPMethodListParamsFormat = "JSON" + RadarAttackLayer7SummaryHTTPMethodListParamsFormatCsv RadarAttackLayer7SummaryHTTPMethodListParamsFormat = "CSV" +) + +type RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersion string + +const ( + RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersionHttPv1 RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersionHttPv2 RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersionHttPv3 RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7SummaryHTTPMethodListParamsIPVersion string + +const ( + RadarAttackLayer7SummaryHTTPMethodListParamsIPVersionIPv4 RadarAttackLayer7SummaryHTTPMethodListParamsIPVersion = "IPv4" + RadarAttackLayer7SummaryHTTPMethodListParamsIPVersionIPv6 RadarAttackLayer7SummaryHTTPMethodListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct string + +const ( + RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductDdos RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct = "DDOS" + RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductWaf RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct = "WAF" + RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductBotManagement RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductAccessRules RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductIPReputation RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductAPIShield RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductDataLossPrevention RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) diff --git a/radarattacklayer7summaryhttpmethod_test.go b/radarattacklayer7summaryhttpmethod_test.go new file mode 100644 index 00000000000..66e49242b95 --- /dev/null +++ b/radarattacklayer7summaryhttpmethod_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7SummaryHTTPMethodListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Summaries.HTTPMethod.List(context.TODO(), cloudflare.RadarAttackLayer7SummaryHTTPMethodListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsDateRange{cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsDateRange1d, cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsDateRange2d, cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsFormatJson), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersion{cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsIPVersion{cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsIPVersionIPv4, cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProduct{cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductDdos, cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductWaf, cloudflare.RadarAttackLayer7SummaryHTTPMethodListParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7summaryhttpversion.go b/radarattacklayer7summaryhttpversion.go new file mode 100644 index 00000000000..6844deb05e1 --- /dev/null +++ b/radarattacklayer7summaryhttpversion.go @@ -0,0 +1,335 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7SummaryHTTPVersionService 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 +// [NewRadarAttackLayer7SummaryHTTPVersionService] method instead. +type RadarAttackLayer7SummaryHTTPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7SummaryHTTPVersionService 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 NewRadarAttackLayer7SummaryHTTPVersionService(opts ...option.RequestOption) (r *RadarAttackLayer7SummaryHTTPVersionService) { + r = &RadarAttackLayer7SummaryHTTPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by http version used. +func (r *RadarAttackLayer7SummaryHTTPVersionService) List(ctx context.Context, query RadarAttackLayer7SummaryHTTPVersionListParams, opts ...option.RequestOption) (res *RadarAttackLayer7SummaryHTTPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/summary/http_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7SummaryHTTPVersionListResponse struct { + Result RadarAttackLayer7SummaryHTTPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7SummaryHTTPVersionListResponseJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPVersionListResponseJSON contains the JSON metadata +// for the struct [RadarAttackLayer7SummaryHTTPVersionListResponse] +type radarAttackLayer7SummaryHTTPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPVersionListResponseResult struct { + Meta RadarAttackLayer7SummaryHTTPVersionListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer7SummaryHTTPVersionListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer7SummaryHTTPVersionListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPVersionListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7SummaryHTTPVersionListResponseResult] +type radarAttackLayer7SummaryHTTPVersionListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPVersionListResponseResultMeta struct { + DateRange []RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7SummaryHTTPVersionListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPVersionListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7SummaryHTTPVersionListResponseResultMeta] +type radarAttackLayer7SummaryHTTPVersionListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPVersionListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7SummaryHTTPVersionListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPVersionListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaDateRange] +type radarAttackLayer7SummaryHTTPVersionListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfo] +type radarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPVersionListResponseResultSummary0 struct { + HTTP1X string `json:"HTTP/1.x,required"` + HTTP2 string `json:"HTTP/2,required"` + HTTP3 string `json:"HTTP/3,required"` + JSON radarAttackLayer7SummaryHTTPVersionListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer7SummaryHTTPVersionListResponseResultSummary0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7SummaryHTTPVersionListResponseResultSummary0] +type radarAttackLayer7SummaryHTTPVersionListResponseResultSummary0JSON struct { + HTTP1X apijson.Field + HTTP2 apijson.Field + HTTP3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryHTTPVersionListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryHTTPVersionListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7SummaryHTTPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7SummaryHTTPVersionListParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod] `query:"httpMethod"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7SummaryHTTPVersionListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7SummaryHTTPVersionListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7SummaryHTTPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7SummaryHTTPVersionListParamsDateRange string + +const ( + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange1d RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "1d" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange2d RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "2d" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange7d RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "7d" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange14d RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "14d" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange28d RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "28d" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange12w RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "12w" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange24w RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "24w" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange52w RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "52w" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange1dControl RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "1dControl" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange2dControl RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "2dControl" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange7dControl RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "7dControl" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange14dControl RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "14dControl" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange28dControl RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "28dControl" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange12wControl RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "12wControl" + RadarAttackLayer7SummaryHTTPVersionListParamsDateRange24wControl RadarAttackLayer7SummaryHTTPVersionListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7SummaryHTTPVersionListParamsFormat string + +const ( + RadarAttackLayer7SummaryHTTPVersionListParamsFormatJson RadarAttackLayer7SummaryHTTPVersionListParamsFormat = "JSON" + RadarAttackLayer7SummaryHTTPVersionListParamsFormatCsv RadarAttackLayer7SummaryHTTPVersionListParamsFormat = "CSV" +) + +type RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod string + +const ( + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodGet RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "GET" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodPost RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "POST" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodDelete RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "DELETE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodPut RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "PUT" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodHead RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "HEAD" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodPurge RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "PURGE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodOptions RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodPropfind RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodMkcol RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "MKCOL" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodPatch RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "PATCH" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodACL RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "ACL" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodBcopy RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "BCOPY" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodBdelete RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "BDELETE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodBmove RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "BMOVE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodBpropfind RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodBproppatch RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodCheckin RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodCheckout RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodConnect RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "CONNECT" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodCopy RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "COPY" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodLabel RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "LABEL" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodLock RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "LOCK" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodMerge RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "MERGE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodMkactivity RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodMkworkspace RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodMove RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "MOVE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodNotify RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodOrderpatch RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodPoll RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "POLL" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodProppatch RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodReport RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "REPORT" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodSearch RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "SEARCH" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodSubscribe RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodTrace RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "TRACE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodUncheckout RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodUnlock RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodUnsubscribe RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodUpdate RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "UPDATE" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodVersioncontrol RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodBaselinecontrol RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodXmsenumatts RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodRpcOutData RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodRpcInData RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodJson RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "JSON" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodCook RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "COOK" + RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodTrack RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7SummaryHTTPVersionListParamsIPVersion string + +const ( + RadarAttackLayer7SummaryHTTPVersionListParamsIPVersionIPv4 RadarAttackLayer7SummaryHTTPVersionListParamsIPVersion = "IPv4" + RadarAttackLayer7SummaryHTTPVersionListParamsIPVersionIPv6 RadarAttackLayer7SummaryHTTPVersionListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct string + +const ( + RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductDdos RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct = "DDOS" + RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductWaf RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct = "WAF" + RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductBotManagement RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductAccessRules RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductIPReputation RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductAPIShield RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductDataLossPrevention RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) diff --git a/radarattacklayer7summaryhttpversion_test.go b/radarattacklayer7summaryhttpversion_test.go new file mode 100644 index 00000000000..84588cef7eb --- /dev/null +++ b/radarattacklayer7summaryhttpversion_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7SummaryHTTPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Summaries.HTTPVersion.List(context.TODO(), cloudflare.RadarAttackLayer7SummaryHTTPVersionListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsDateRange{cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsDateRange1d, cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsDateRange2d, cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethod{cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodGet, cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodPost, cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsHTTPMethodDelete}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsIPVersion{cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsIPVersionIPv4, cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProduct{cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductDdos, cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductWaf, cloudflare.RadarAttackLayer7SummaryHTTPVersionListParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7summaryipversion.go b/radarattacklayer7summaryipversion.go new file mode 100644 index 00000000000..e2d91be12df --- /dev/null +++ b/radarattacklayer7summaryipversion.go @@ -0,0 +1,333 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7SummaryIPVersionService 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 +// [NewRadarAttackLayer7SummaryIPVersionService] method instead. +type RadarAttackLayer7SummaryIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7SummaryIPVersionService 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 NewRadarAttackLayer7SummaryIPVersionService(opts ...option.RequestOption) (r *RadarAttackLayer7SummaryIPVersionService) { + r = &RadarAttackLayer7SummaryIPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by ip version used. +func (r *RadarAttackLayer7SummaryIPVersionService) List(ctx context.Context, query RadarAttackLayer7SummaryIPVersionListParams, opts ...option.RequestOption) (res *RadarAttackLayer7SummaryIPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/summary/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7SummaryIPVersionListResponse struct { + Result RadarAttackLayer7SummaryIPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7SummaryIPVersionListResponseJSON `json:"-"` +} + +// radarAttackLayer7SummaryIPVersionListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer7SummaryIPVersionListResponse] +type radarAttackLayer7SummaryIPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryIPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryIPVersionListResponseResult struct { + Meta RadarAttackLayer7SummaryIPVersionListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer7SummaryIPVersionListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer7SummaryIPVersionListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7SummaryIPVersionListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7SummaryIPVersionListResponseResult] +type radarAttackLayer7SummaryIPVersionListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryIPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryIPVersionListResponseResultMeta struct { + DateRange []RadarAttackLayer7SummaryIPVersionListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7SummaryIPVersionListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7SummaryIPVersionListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7SummaryIPVersionListResponseResultMeta] +type radarAttackLayer7SummaryIPVersionListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryIPVersionListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryIPVersionListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7SummaryIPVersionListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7SummaryIPVersionListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7SummaryIPVersionListResponseResultMetaDateRange] +type radarAttackLayer7SummaryIPVersionListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryIPVersionListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfo] +type radarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryIPVersionListResponseResultSummary0 struct { + IPv4 string `json:"IPv4,required"` + IPv6 string `json:"IPv6,required"` + JSON radarAttackLayer7SummaryIPVersionListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer7SummaryIPVersionListResponseResultSummary0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7SummaryIPVersionListResponseResultSummary0] +type radarAttackLayer7SummaryIPVersionListResponseResultSummary0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryIPVersionListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryIPVersionListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7SummaryIPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7SummaryIPVersionListParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7SummaryIPVersionListParamsHTTPVersion] `query:"httpVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7SummaryIPVersionListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7SummaryIPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7SummaryIPVersionListParamsDateRange string + +const ( + RadarAttackLayer7SummaryIPVersionListParamsDateRange1d RadarAttackLayer7SummaryIPVersionListParamsDateRange = "1d" + RadarAttackLayer7SummaryIPVersionListParamsDateRange2d RadarAttackLayer7SummaryIPVersionListParamsDateRange = "2d" + RadarAttackLayer7SummaryIPVersionListParamsDateRange7d RadarAttackLayer7SummaryIPVersionListParamsDateRange = "7d" + RadarAttackLayer7SummaryIPVersionListParamsDateRange14d RadarAttackLayer7SummaryIPVersionListParamsDateRange = "14d" + RadarAttackLayer7SummaryIPVersionListParamsDateRange28d RadarAttackLayer7SummaryIPVersionListParamsDateRange = "28d" + RadarAttackLayer7SummaryIPVersionListParamsDateRange12w RadarAttackLayer7SummaryIPVersionListParamsDateRange = "12w" + RadarAttackLayer7SummaryIPVersionListParamsDateRange24w RadarAttackLayer7SummaryIPVersionListParamsDateRange = "24w" + RadarAttackLayer7SummaryIPVersionListParamsDateRange52w RadarAttackLayer7SummaryIPVersionListParamsDateRange = "52w" + RadarAttackLayer7SummaryIPVersionListParamsDateRange1dControl RadarAttackLayer7SummaryIPVersionListParamsDateRange = "1dControl" + RadarAttackLayer7SummaryIPVersionListParamsDateRange2dControl RadarAttackLayer7SummaryIPVersionListParamsDateRange = "2dControl" + RadarAttackLayer7SummaryIPVersionListParamsDateRange7dControl RadarAttackLayer7SummaryIPVersionListParamsDateRange = "7dControl" + RadarAttackLayer7SummaryIPVersionListParamsDateRange14dControl RadarAttackLayer7SummaryIPVersionListParamsDateRange = "14dControl" + RadarAttackLayer7SummaryIPVersionListParamsDateRange28dControl RadarAttackLayer7SummaryIPVersionListParamsDateRange = "28dControl" + RadarAttackLayer7SummaryIPVersionListParamsDateRange12wControl RadarAttackLayer7SummaryIPVersionListParamsDateRange = "12wControl" + RadarAttackLayer7SummaryIPVersionListParamsDateRange24wControl RadarAttackLayer7SummaryIPVersionListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7SummaryIPVersionListParamsFormat string + +const ( + RadarAttackLayer7SummaryIPVersionListParamsFormatJson RadarAttackLayer7SummaryIPVersionListParamsFormat = "JSON" + RadarAttackLayer7SummaryIPVersionListParamsFormatCsv RadarAttackLayer7SummaryIPVersionListParamsFormat = "CSV" +) + +type RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod string + +const ( + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodGet RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "GET" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodPost RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "POST" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodDelete RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "DELETE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodPut RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "PUT" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodHead RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "HEAD" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodPurge RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "PURGE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodOptions RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodPropfind RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodMkcol RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "MKCOL" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodPatch RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "PATCH" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodACL RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "ACL" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodBcopy RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "BCOPY" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodBdelete RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "BDELETE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodBmove RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "BMOVE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodBpropfind RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodBproppatch RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodCheckin RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodCheckout RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodConnect RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "CONNECT" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodCopy RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "COPY" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodLabel RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "LABEL" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodLock RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "LOCK" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodMerge RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "MERGE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodMkactivity RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodMkworkspace RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodMove RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "MOVE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodNotify RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodOrderpatch RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodPoll RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "POLL" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodProppatch RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodReport RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "REPORT" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodSearch RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "SEARCH" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodSubscribe RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodTrace RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "TRACE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodUncheckout RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodUnlock RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodUnsubscribe RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodUpdate RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "UPDATE" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodVersioncontrol RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodBaselinecontrol RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodXmsenumatts RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodRpcOutData RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodRpcInData RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodJson RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "JSON" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodCook RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "COOK" + RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodTrack RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7SummaryIPVersionListParamsHTTPVersion string + +const ( + RadarAttackLayer7SummaryIPVersionListParamsHTTPVersionHttPv1 RadarAttackLayer7SummaryIPVersionListParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7SummaryIPVersionListParamsHTTPVersionHttPv2 RadarAttackLayer7SummaryIPVersionListParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7SummaryIPVersionListParamsHTTPVersionHttPv3 RadarAttackLayer7SummaryIPVersionListParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct string + +const ( + RadarAttackLayer7SummaryIPVersionListParamsMitigationProductDdos RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct = "DDOS" + RadarAttackLayer7SummaryIPVersionListParamsMitigationProductWaf RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct = "WAF" + RadarAttackLayer7SummaryIPVersionListParamsMitigationProductBotManagement RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7SummaryIPVersionListParamsMitigationProductAccessRules RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7SummaryIPVersionListParamsMitigationProductIPReputation RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7SummaryIPVersionListParamsMitigationProductAPIShield RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7SummaryIPVersionListParamsMitigationProductDataLossPrevention RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) diff --git a/radarattacklayer7summaryipversion_test.go b/radarattacklayer7summaryipversion_test.go new file mode 100644 index 00000000000..3f5340ebaef --- /dev/null +++ b/radarattacklayer7summaryipversion_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7SummaryIPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Summaries.IPVersion.List(context.TODO(), cloudflare.RadarAttackLayer7SummaryIPVersionListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryIPVersionListParamsDateRange{cloudflare.RadarAttackLayer7SummaryIPVersionListParamsDateRange1d, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsDateRange2d, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7SummaryIPVersionListParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPMethod{cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodGet, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodPost, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPVersion{cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsHTTPVersionHttPv3}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryIPVersionListParamsMitigationProduct{cloudflare.RadarAttackLayer7SummaryIPVersionListParamsMitigationProductDdos, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsMitigationProductWaf, cloudflare.RadarAttackLayer7SummaryIPVersionListParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7summarymanagedrule.go b/radarattacklayer7summarymanagedrule.go new file mode 100644 index 00000000000..154575ca04b --- /dev/null +++ b/radarattacklayer7summarymanagedrule.go @@ -0,0 +1,343 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7SummaryManagedRuleService 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 +// [NewRadarAttackLayer7SummaryManagedRuleService] method instead. +type RadarAttackLayer7SummaryManagedRuleService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7SummaryManagedRuleService 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 NewRadarAttackLayer7SummaryManagedRuleService(opts ...option.RequestOption) (r *RadarAttackLayer7SummaryManagedRuleService) { + r = &RadarAttackLayer7SummaryManagedRuleService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by managed rules used. +func (r *RadarAttackLayer7SummaryManagedRuleService) List(ctx context.Context, query RadarAttackLayer7SummaryManagedRuleListParams, opts ...option.RequestOption) (res *RadarAttackLayer7SummaryManagedRuleListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/summary/managed_rules" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7SummaryManagedRuleListResponse struct { + Result RadarAttackLayer7SummaryManagedRuleListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7SummaryManagedRuleListResponseJSON `json:"-"` +} + +// radarAttackLayer7SummaryManagedRuleListResponseJSON contains the JSON metadata +// for the struct [RadarAttackLayer7SummaryManagedRuleListResponse] +type radarAttackLayer7SummaryManagedRuleListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryManagedRuleListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryManagedRuleListResponseResult struct { + Meta RadarAttackLayer7SummaryManagedRuleListResponseResultMeta `json:"meta,required"` + Summary0 RadarAttackLayer7SummaryManagedRuleListResponseResultSummary0 `json:"summary_0,required"` + JSON radarAttackLayer7SummaryManagedRuleListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7SummaryManagedRuleListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7SummaryManagedRuleListResponseResult] +type radarAttackLayer7SummaryManagedRuleListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryManagedRuleListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryManagedRuleListResponseResultMeta struct { + DateRange []RadarAttackLayer7SummaryManagedRuleListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7SummaryManagedRuleListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7SummaryManagedRuleListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7SummaryManagedRuleListResponseResultMeta] +type radarAttackLayer7SummaryManagedRuleListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryManagedRuleListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryManagedRuleListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7SummaryManagedRuleListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7SummaryManagedRuleListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7SummaryManagedRuleListResponseResultMetaDateRange] +type radarAttackLayer7SummaryManagedRuleListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryManagedRuleListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfo] +type radarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryManagedRuleListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryManagedRuleListResponseResultSummary0 struct { + Bot string `json:"Bot,required"` + HTTPAnomaly string `json:"HTTP Anomaly,required"` + JSON radarAttackLayer7SummaryManagedRuleListResponseResultSummary0JSON `json:"-"` +} + +// radarAttackLayer7SummaryManagedRuleListResponseResultSummary0JSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7SummaryManagedRuleListResponseResultSummary0] +type radarAttackLayer7SummaryManagedRuleListResponseResultSummary0JSON struct { + Bot apijson.Field + HTTPAnomaly apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7SummaryManagedRuleListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7SummaryManagedRuleListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7SummaryManagedRuleListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7SummaryManagedRuleListParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7SummaryManagedRuleListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7SummaryManagedRuleListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7SummaryManagedRuleListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7SummaryManagedRuleListParamsDateRange string + +const ( + RadarAttackLayer7SummaryManagedRuleListParamsDateRange1d RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "1d" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange2d RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "2d" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange7d RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "7d" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange14d RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "14d" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange28d RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "28d" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange12w RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "12w" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange24w RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "24w" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange52w RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "52w" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange1dControl RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "1dControl" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange2dControl RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "2dControl" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange7dControl RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "7dControl" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange14dControl RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "14dControl" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange28dControl RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "28dControl" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange12wControl RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "12wControl" + RadarAttackLayer7SummaryManagedRuleListParamsDateRange24wControl RadarAttackLayer7SummaryManagedRuleListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7SummaryManagedRuleListParamsFormat string + +const ( + RadarAttackLayer7SummaryManagedRuleListParamsFormatJson RadarAttackLayer7SummaryManagedRuleListParamsFormat = "JSON" + RadarAttackLayer7SummaryManagedRuleListParamsFormatCsv RadarAttackLayer7SummaryManagedRuleListParamsFormat = "CSV" +) + +type RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod string + +const ( + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodGet RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "GET" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodPost RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "POST" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodDelete RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "DELETE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodPut RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "PUT" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodHead RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "HEAD" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodPurge RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "PURGE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodOptions RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodPropfind RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodMkcol RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "MKCOL" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodPatch RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "PATCH" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodACL RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "ACL" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodBcopy RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "BCOPY" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodBdelete RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "BDELETE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodBmove RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "BMOVE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodBpropfind RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodBproppatch RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodCheckin RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodCheckout RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodConnect RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "CONNECT" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodCopy RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "COPY" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodLabel RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "LABEL" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodLock RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "LOCK" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodMerge RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "MERGE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodMkactivity RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodMkworkspace RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodMove RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "MOVE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodNotify RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodOrderpatch RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodPoll RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "POLL" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodProppatch RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodReport RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "REPORT" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodSearch RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "SEARCH" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodSubscribe RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodTrace RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "TRACE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodUncheckout RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodUnlock RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodUnsubscribe RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodUpdate RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "UPDATE" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodVersioncontrol RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodBaselinecontrol RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodXmsenumatts RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodRpcOutData RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodRpcInData RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodJson RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "JSON" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodCook RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "COOK" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodTrack RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersion string + +const ( + RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersionHttPv1 RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersionHttPv2 RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersionHttPv3 RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7SummaryManagedRuleListParamsIPVersion string + +const ( + RadarAttackLayer7SummaryManagedRuleListParamsIPVersionIPv4 RadarAttackLayer7SummaryManagedRuleListParamsIPVersion = "IPv4" + RadarAttackLayer7SummaryManagedRuleListParamsIPVersionIPv6 RadarAttackLayer7SummaryManagedRuleListParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct string + +const ( + RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductDdos RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct = "DDOS" + RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductWaf RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct = "WAF" + RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductBotManagement RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductAccessRules RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductIPReputation RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductAPIShield RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductDataLossPrevention RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) diff --git a/radarattacklayer7summarymanagedrule_test.go b/radarattacklayer7summarymanagedrule_test.go new file mode 100644 index 00000000000..d45a8eb57d0 --- /dev/null +++ b/radarattacklayer7summarymanagedrule_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7SummaryManagedRuleListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Summaries.ManagedRules.List(context.TODO(), cloudflare.RadarAttackLayer7SummaryManagedRuleListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsDateRange{cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsDateRange1d, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsDateRange2d, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethod{cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodGet, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodPost, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersion{cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsIPVersion{cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsIPVersionIPv4, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsMitigationProduct{cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductDdos, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductWaf, cloudflare.RadarAttackLayer7SummaryManagedRuleListParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7timeseriesgroup.go b/radarattacklayer7timeseriesgroup.go new file mode 100644 index 00000000000..04580e4719c --- /dev/null +++ b/radarattacklayer7timeseriesgroup.go @@ -0,0 +1,284 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TimeseriesGroupService 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 +// [NewRadarAttackLayer7TimeseriesGroupService] method instead. +type RadarAttackLayer7TimeseriesGroupService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7TimeseriesGroupService 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 NewRadarAttackLayer7TimeseriesGroupService(opts ...option.RequestOption) (r *RadarAttackLayer7TimeseriesGroupService) { + r = &RadarAttackLayer7TimeseriesGroupService{} + r.Options = opts + return +} + +// Get a time series of the percentual distribution of mitigation techniques, over +// time. +func (r *RadarAttackLayer7TimeseriesGroupService) List(ctx context.Context, query RadarAttackLayer7TimeseriesGroupListParams, opts ...option.RequestOption) (res *RadarAttackLayer7TimeseriesGroupListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7TimeseriesGroupListResponse struct { + Result RadarAttackLayer7TimeseriesGroupListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7TimeseriesGroupListResponseJSON `json:"-"` +} + +// radarAttackLayer7TimeseriesGroupListResponseJSON contains the JSON metadata for +// the struct [RadarAttackLayer7TimeseriesGroupListResponse] +type radarAttackLayer7TimeseriesGroupListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseriesGroupListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseriesGroupListResponseResult struct { + Meta RadarAttackLayer7TimeseriesGroupListResponseResultMeta `json:"meta,required"` + Serie0 RadarAttackLayer7TimeseriesGroupListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7TimeseriesGroupListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7TimeseriesGroupListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7TimeseriesGroupListResponseResult] +type radarAttackLayer7TimeseriesGroupListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseriesGroupListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseriesGroupListResponseResultMeta struct { + AggInterval string `json:"aggInterval,required"` + DateRange []RadarAttackLayer7TimeseriesGroupListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated time.Time `json:"lastUpdated,required" format:"date-time"` + ConfidenceInfo RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7TimeseriesGroupListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7TimeseriesGroupListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer7TimeseriesGroupListResponseResultMeta] +type radarAttackLayer7TimeseriesGroupListResponseResultMetaJSON struct { + AggInterval apijson.Field + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseriesGroupListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseriesGroupListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7TimeseriesGroupListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7TimeseriesGroupListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7TimeseriesGroupListResponseResultMetaDateRange] +type radarAttackLayer7TimeseriesGroupListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseriesGroupListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfo] +type radarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseriesGroupListResponseResultSerie0 struct { + AccessRules []string `json:"ACCESS_RULES,required"` + APIShield []string `json:"API_SHIELD,required"` + BotManagement []string `json:"BOT_MANAGEMENT,required"` + DataLossPrevention []string `json:"DATA_LOSS_PREVENTION,required"` + Ddos []string `json:"DDOS,required"` + IPReputation []string `json:"IP_REPUTATION,required"` + Timestamps []time.Time `json:"timestamps,required" format:"date-time"` + Waf []string `json:"WAF,required"` + JSON radarAttackLayer7TimeseriesGroupListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7TimeseriesGroupListResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7TimeseriesGroupListResponseResultSerie0] +type radarAttackLayer7TimeseriesGroupListResponseResultSerie0JSON struct { + AccessRules apijson.Field + APIShield apijson.Field + BotManagement apijson.Field + DataLossPrevention apijson.Field + Ddos apijson.Field + IPReputation apijson.Field + Timestamps apijson.Field + Waf apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseriesGroupListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseriesGroupListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7TimeseriesGroupListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7TimeseriesGroupListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7TimeseriesGroupListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7TimeseriesGroupListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7TimeseriesGroupListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7TimeseriesGroupListParamsAggInterval string + +const ( + RadarAttackLayer7TimeseriesGroupListParamsAggInterval15m RadarAttackLayer7TimeseriesGroupListParamsAggInterval = "15m" + RadarAttackLayer7TimeseriesGroupListParamsAggInterval1h RadarAttackLayer7TimeseriesGroupListParamsAggInterval = "1h" + RadarAttackLayer7TimeseriesGroupListParamsAggInterval1d RadarAttackLayer7TimeseriesGroupListParamsAggInterval = "1d" + RadarAttackLayer7TimeseriesGroupListParamsAggInterval1w RadarAttackLayer7TimeseriesGroupListParamsAggInterval = "1w" +) + +type RadarAttackLayer7TimeseriesGroupListParamsDateRange string + +const ( + RadarAttackLayer7TimeseriesGroupListParamsDateRange1d RadarAttackLayer7TimeseriesGroupListParamsDateRange = "1d" + RadarAttackLayer7TimeseriesGroupListParamsDateRange2d RadarAttackLayer7TimeseriesGroupListParamsDateRange = "2d" + RadarAttackLayer7TimeseriesGroupListParamsDateRange7d RadarAttackLayer7TimeseriesGroupListParamsDateRange = "7d" + RadarAttackLayer7TimeseriesGroupListParamsDateRange14d RadarAttackLayer7TimeseriesGroupListParamsDateRange = "14d" + RadarAttackLayer7TimeseriesGroupListParamsDateRange28d RadarAttackLayer7TimeseriesGroupListParamsDateRange = "28d" + RadarAttackLayer7TimeseriesGroupListParamsDateRange12w RadarAttackLayer7TimeseriesGroupListParamsDateRange = "12w" + RadarAttackLayer7TimeseriesGroupListParamsDateRange24w RadarAttackLayer7TimeseriesGroupListParamsDateRange = "24w" + RadarAttackLayer7TimeseriesGroupListParamsDateRange52w RadarAttackLayer7TimeseriesGroupListParamsDateRange = "52w" + RadarAttackLayer7TimeseriesGroupListParamsDateRange1dControl RadarAttackLayer7TimeseriesGroupListParamsDateRange = "1dControl" + RadarAttackLayer7TimeseriesGroupListParamsDateRange2dControl RadarAttackLayer7TimeseriesGroupListParamsDateRange = "2dControl" + RadarAttackLayer7TimeseriesGroupListParamsDateRange7dControl RadarAttackLayer7TimeseriesGroupListParamsDateRange = "7dControl" + RadarAttackLayer7TimeseriesGroupListParamsDateRange14dControl RadarAttackLayer7TimeseriesGroupListParamsDateRange = "14dControl" + RadarAttackLayer7TimeseriesGroupListParamsDateRange28dControl RadarAttackLayer7TimeseriesGroupListParamsDateRange = "28dControl" + RadarAttackLayer7TimeseriesGroupListParamsDateRange12wControl RadarAttackLayer7TimeseriesGroupListParamsDateRange = "12wControl" + RadarAttackLayer7TimeseriesGroupListParamsDateRange24wControl RadarAttackLayer7TimeseriesGroupListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7TimeseriesGroupListParamsFormat string + +const ( + RadarAttackLayer7TimeseriesGroupListParamsFormatJson RadarAttackLayer7TimeseriesGroupListParamsFormat = "JSON" + RadarAttackLayer7TimeseriesGroupListParamsFormatCsv RadarAttackLayer7TimeseriesGroupListParamsFormat = "CSV" +) diff --git a/radarattacklayer7timeseriesgroup_test.go b/radarattacklayer7timeseriesgroup_test.go new file mode 100644 index 00000000000..c0a8399abfb --- /dev/null +++ b/radarattacklayer7timeseriesgroup_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7TimeseriesGroupListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.TimeseriesGroups.List(context.TODO(), cloudflare.RadarAttackLayer7TimeseriesGroupListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7TimeseriesGroupListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7TimeseriesGroupListParamsDateRange{cloudflare.RadarAttackLayer7TimeseriesGroupListParamsDateRange1d, cloudflare.RadarAttackLayer7TimeseriesGroupListParamsDateRange2d, cloudflare.RadarAttackLayer7TimeseriesGroupListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7TimeseriesGroupListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7timesery.go b/radarattacklayer7timesery.go new file mode 100644 index 00000000000..5ea467447e0 --- /dev/null +++ b/radarattacklayer7timesery.go @@ -0,0 +1,297 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TimeseryService 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 +// [NewRadarAttackLayer7TimeseryService] method instead. +type RadarAttackLayer7TimeseryService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7TimeseryService 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 NewRadarAttackLayer7TimeseryService(opts ...option.RequestOption) (r *RadarAttackLayer7TimeseryService) { + r = &RadarAttackLayer7TimeseryService{} + r.Options = opts + return +} + +// Get a timeseries of Layer 7 attacks. Values represent HTTP requests and are +// normalized using min-max by default. +func (r *RadarAttackLayer7TimeseryService) List(ctx context.Context, query RadarAttackLayer7TimeseryListParams, opts ...option.RequestOption) (res *RadarAttackLayer7TimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7TimeseryListResponse struct { + Result RadarAttackLayer7TimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7TimeseryListResponseJSON `json:"-"` +} + +// radarAttackLayer7TimeseryListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer7TimeseryListResponse] +type radarAttackLayer7TimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseryListResponseResult struct { + Meta RadarAttackLayer7TimeseryListResponseResultMeta `json:"meta,required"` + Serie0 RadarAttackLayer7TimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7TimeseryListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7TimeseryListResponseResultJSON contains the JSON metadata for +// the struct [RadarAttackLayer7TimeseryListResponseResult] +type radarAttackLayer7TimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseryListResponseResultMeta struct { + AggInterval string `json:"aggInterval,required"` + DateRange []RadarAttackLayer7TimeseryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated time.Time `json:"lastUpdated,required" format:"date-time"` + ConfidenceInfo RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7TimeseryListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7TimeseryListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAttackLayer7TimeseryListResponseResultMeta] +type radarAttackLayer7TimeseryListResponseResultMetaJSON struct { + AggInterval apijson.Field + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7TimeseryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7TimeseryListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7TimeseryListResponseResultMetaDateRange] +type radarAttackLayer7TimeseryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfo] +type radarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseryListResponseResultSerie0 struct { + Timestamps []time.Time `json:"timestamps,required" format:"date-time"` + Values []string `json:"values,required"` + JSON radarAttackLayer7TimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7TimeseryListResponseResultSerie0JSON contains the JSON metadata +// for the struct [RadarAttackLayer7TimeseryListResponseResultSerie0] +type radarAttackLayer7TimeseryListResponseResultSerie0JSON struct { + Timestamps apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7TimeseryListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Array of L7 attack types. + Attack param.Field[[]RadarAttackLayer7TimeseryListParamsAttack] `query:"attack"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7TimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7TimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7TimeseryListParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer7TimeseryListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer7TimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7TimeseryListParamsAggInterval string + +const ( + RadarAttackLayer7TimeseryListParamsAggInterval15m RadarAttackLayer7TimeseryListParamsAggInterval = "15m" + RadarAttackLayer7TimeseryListParamsAggInterval1h RadarAttackLayer7TimeseryListParamsAggInterval = "1h" + RadarAttackLayer7TimeseryListParamsAggInterval1d RadarAttackLayer7TimeseryListParamsAggInterval = "1d" + RadarAttackLayer7TimeseryListParamsAggInterval1w RadarAttackLayer7TimeseryListParamsAggInterval = "1w" +) + +type RadarAttackLayer7TimeseryListParamsAttack string + +const ( + RadarAttackLayer7TimeseryListParamsAttackDdos RadarAttackLayer7TimeseryListParamsAttack = "DDOS" + RadarAttackLayer7TimeseryListParamsAttackWaf RadarAttackLayer7TimeseryListParamsAttack = "WAF" + RadarAttackLayer7TimeseryListParamsAttackBotManagement RadarAttackLayer7TimeseryListParamsAttack = "BOT_MANAGEMENT" + RadarAttackLayer7TimeseryListParamsAttackAccessRules RadarAttackLayer7TimeseryListParamsAttack = "ACCESS_RULES" + RadarAttackLayer7TimeseryListParamsAttackIPReputation RadarAttackLayer7TimeseryListParamsAttack = "IP_REPUTATION" + RadarAttackLayer7TimeseryListParamsAttackAPIShield RadarAttackLayer7TimeseryListParamsAttack = "API_SHIELD" + RadarAttackLayer7TimeseryListParamsAttackDataLossPrevention RadarAttackLayer7TimeseryListParamsAttack = "DATA_LOSS_PREVENTION" +) + +type RadarAttackLayer7TimeseryListParamsDateRange string + +const ( + RadarAttackLayer7TimeseryListParamsDateRange1d RadarAttackLayer7TimeseryListParamsDateRange = "1d" + RadarAttackLayer7TimeseryListParamsDateRange2d RadarAttackLayer7TimeseryListParamsDateRange = "2d" + RadarAttackLayer7TimeseryListParamsDateRange7d RadarAttackLayer7TimeseryListParamsDateRange = "7d" + RadarAttackLayer7TimeseryListParamsDateRange14d RadarAttackLayer7TimeseryListParamsDateRange = "14d" + RadarAttackLayer7TimeseryListParamsDateRange28d RadarAttackLayer7TimeseryListParamsDateRange = "28d" + RadarAttackLayer7TimeseryListParamsDateRange12w RadarAttackLayer7TimeseryListParamsDateRange = "12w" + RadarAttackLayer7TimeseryListParamsDateRange24w RadarAttackLayer7TimeseryListParamsDateRange = "24w" + RadarAttackLayer7TimeseryListParamsDateRange52w RadarAttackLayer7TimeseryListParamsDateRange = "52w" + RadarAttackLayer7TimeseryListParamsDateRange1dControl RadarAttackLayer7TimeseryListParamsDateRange = "1dControl" + RadarAttackLayer7TimeseryListParamsDateRange2dControl RadarAttackLayer7TimeseryListParamsDateRange = "2dControl" + RadarAttackLayer7TimeseryListParamsDateRange7dControl RadarAttackLayer7TimeseryListParamsDateRange = "7dControl" + RadarAttackLayer7TimeseryListParamsDateRange14dControl RadarAttackLayer7TimeseryListParamsDateRange = "14dControl" + RadarAttackLayer7TimeseryListParamsDateRange28dControl RadarAttackLayer7TimeseryListParamsDateRange = "28dControl" + RadarAttackLayer7TimeseryListParamsDateRange12wControl RadarAttackLayer7TimeseryListParamsDateRange = "12wControl" + RadarAttackLayer7TimeseryListParamsDateRange24wControl RadarAttackLayer7TimeseryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7TimeseryListParamsFormat string + +const ( + RadarAttackLayer7TimeseryListParamsFormatJson RadarAttackLayer7TimeseryListParamsFormat = "JSON" + RadarAttackLayer7TimeseryListParamsFormatCsv RadarAttackLayer7TimeseryListParamsFormat = "CSV" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7TimeseryListParamsNormalization string + +const ( + RadarAttackLayer7TimeseryListParamsNormalizationPercentageChange RadarAttackLayer7TimeseryListParamsNormalization = "PERCENTAGE_CHANGE" + RadarAttackLayer7TimeseryListParamsNormalizationMin0Max RadarAttackLayer7TimeseryListParamsNormalization = "MIN0_MAX" +) diff --git a/radarattacklayer7timesery_test.go b/radarattacklayer7timesery_test.go new file mode 100644 index 00000000000..4d606b6f672 --- /dev/null +++ b/radarattacklayer7timesery_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7TimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Timeseries.List(context.TODO(), cloudflare.RadarAttackLayer7TimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7TimeseryListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + Attack: cloudflare.F([]cloudflare.RadarAttackLayer7TimeseryListParamsAttack{cloudflare.RadarAttackLayer7TimeseryListParamsAttackDdos, cloudflare.RadarAttackLayer7TimeseryListParamsAttackWaf, cloudflare.RadarAttackLayer7TimeseryListParamsAttackBotManagement}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7TimeseryListParamsDateRange{cloudflare.RadarAttackLayer7TimeseryListParamsDateRange1d, cloudflare.RadarAttackLayer7TimeseryListParamsDateRange2d, cloudflare.RadarAttackLayer7TimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7TimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7TimeseryListParamsNormalizationMin0Max), + }) + 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/radarattacklayer7top.go b/radarattacklayer7top.go new file mode 100644 index 00000000000..af8f98e3fc1 --- /dev/null +++ b/radarattacklayer7top.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TopService 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 [NewRadarAttackLayer7TopService] +// method instead. +type RadarAttackLayer7TopService struct { + Options []option.RequestOption + Ases *RadarAttackLayer7TopAseService + Attacks *RadarAttackLayer7TopAttackService + Locations *RadarAttackLayer7TopLocationService +} + +// NewRadarAttackLayer7TopService 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 NewRadarAttackLayer7TopService(opts ...option.RequestOption) (r *RadarAttackLayer7TopService) { + r = &RadarAttackLayer7TopService{} + r.Options = opts + r.Ases = NewRadarAttackLayer7TopAseService(opts...) + r.Attacks = NewRadarAttackLayer7TopAttackService(opts...) + r.Locations = NewRadarAttackLayer7TopLocationService(opts...) + return +} diff --git a/radarattacklayer7topase.go b/radarattacklayer7topase.go new file mode 100644 index 00000000000..6cff8d29353 --- /dev/null +++ b/radarattacklayer7topase.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TopAseService 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 +// [NewRadarAttackLayer7TopAseService] method instead. +type RadarAttackLayer7TopAseService struct { + Options []option.RequestOption + Origins *RadarAttackLayer7TopAseOriginService +} + +// NewRadarAttackLayer7TopAseService 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 NewRadarAttackLayer7TopAseService(opts ...option.RequestOption) (r *RadarAttackLayer7TopAseService) { + r = &RadarAttackLayer7TopAseService{} + r.Options = opts + r.Origins = NewRadarAttackLayer7TopAseOriginService(opts...) + return +} diff --git a/radarattacklayer7topaseorigin.go b/radarattacklayer7topaseorigin.go new file mode 100644 index 00000000000..4d81a8c0cc7 --- /dev/null +++ b/radarattacklayer7topaseorigin.go @@ -0,0 +1,256 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TopAseOriginService 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 +// [NewRadarAttackLayer7TopAseOriginService] method instead. +type RadarAttackLayer7TopAseOriginService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7TopAseOriginService 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 NewRadarAttackLayer7TopAseOriginService(opts ...option.RequestOption) (r *RadarAttackLayer7TopAseOriginService) { + r = &RadarAttackLayer7TopAseOriginService{} + r.Options = opts + return +} + +// Get the top origin Autonomous Systems of and by layer 7 attacks. Values are a +// percentage out of the total layer 7 attacks. The origin Autonomous Systems is +// determined by the client IP. +func (r *RadarAttackLayer7TopAseOriginService) List(ctx context.Context, query RadarAttackLayer7TopAseOriginListParams, opts ...option.RequestOption) (res *RadarAttackLayer7TopAseOriginListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/top/ases/origin" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7TopAseOriginListResponse struct { + Result RadarAttackLayer7TopAseOriginListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7TopAseOriginListResponseJSON `json:"-"` +} + +// radarAttackLayer7TopAseOriginListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer7TopAseOriginListResponse] +type radarAttackLayer7TopAseOriginListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAseOriginListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAseOriginListResponseResult struct { + Meta RadarAttackLayer7TopAseOriginListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer7TopAseOriginListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer7TopAseOriginListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7TopAseOriginListResponseResultJSON contains the JSON metadata +// for the struct [RadarAttackLayer7TopAseOriginListResponseResult] +type radarAttackLayer7TopAseOriginListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAseOriginListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAseOriginListResponseResultMeta struct { + DateRange []RadarAttackLayer7TopAseOriginListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7TopAseOriginListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7TopAseOriginListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer7TopAseOriginListResponseResultMeta] +type radarAttackLayer7TopAseOriginListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAseOriginListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAseOriginListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7TopAseOriginListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7TopAseOriginListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7TopAseOriginListResponseResultMetaDateRange] +type radarAttackLayer7TopAseOriginListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAseOriginListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfo] +type radarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAseOriginListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAseOriginListResponseResultTop0 struct { + OriginASN string `json:"originAsn,required"` + OriginASNName string `json:"originAsnName,required"` + Rank float64 `json:"rank,required"` + Value string `json:"value,required"` + JSON radarAttackLayer7TopAseOriginListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer7TopAseOriginListResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarAttackLayer7TopAseOriginListResponseResultTop0] +type radarAttackLayer7TopAseOriginListResponseResultTop0JSON struct { + OriginASN apijson.Field + OriginASNName apijson.Field + Rank apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAseOriginListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAseOriginListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7TopAseOriginListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7TopAseOriginListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7TopAseOriginListParams]'s query parameters +// as `url.Values`. +func (r RadarAttackLayer7TopAseOriginListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7TopAseOriginListParamsDateRange string + +const ( + RadarAttackLayer7TopAseOriginListParamsDateRange1d RadarAttackLayer7TopAseOriginListParamsDateRange = "1d" + RadarAttackLayer7TopAseOriginListParamsDateRange2d RadarAttackLayer7TopAseOriginListParamsDateRange = "2d" + RadarAttackLayer7TopAseOriginListParamsDateRange7d RadarAttackLayer7TopAseOriginListParamsDateRange = "7d" + RadarAttackLayer7TopAseOriginListParamsDateRange14d RadarAttackLayer7TopAseOriginListParamsDateRange = "14d" + RadarAttackLayer7TopAseOriginListParamsDateRange28d RadarAttackLayer7TopAseOriginListParamsDateRange = "28d" + RadarAttackLayer7TopAseOriginListParamsDateRange12w RadarAttackLayer7TopAseOriginListParamsDateRange = "12w" + RadarAttackLayer7TopAseOriginListParamsDateRange24w RadarAttackLayer7TopAseOriginListParamsDateRange = "24w" + RadarAttackLayer7TopAseOriginListParamsDateRange52w RadarAttackLayer7TopAseOriginListParamsDateRange = "52w" + RadarAttackLayer7TopAseOriginListParamsDateRange1dControl RadarAttackLayer7TopAseOriginListParamsDateRange = "1dControl" + RadarAttackLayer7TopAseOriginListParamsDateRange2dControl RadarAttackLayer7TopAseOriginListParamsDateRange = "2dControl" + RadarAttackLayer7TopAseOriginListParamsDateRange7dControl RadarAttackLayer7TopAseOriginListParamsDateRange = "7dControl" + RadarAttackLayer7TopAseOriginListParamsDateRange14dControl RadarAttackLayer7TopAseOriginListParamsDateRange = "14dControl" + RadarAttackLayer7TopAseOriginListParamsDateRange28dControl RadarAttackLayer7TopAseOriginListParamsDateRange = "28dControl" + RadarAttackLayer7TopAseOriginListParamsDateRange12wControl RadarAttackLayer7TopAseOriginListParamsDateRange = "12wControl" + RadarAttackLayer7TopAseOriginListParamsDateRange24wControl RadarAttackLayer7TopAseOriginListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7TopAseOriginListParamsFormat string + +const ( + RadarAttackLayer7TopAseOriginListParamsFormatJson RadarAttackLayer7TopAseOriginListParamsFormat = "JSON" + RadarAttackLayer7TopAseOriginListParamsFormatCsv RadarAttackLayer7TopAseOriginListParamsFormat = "CSV" +) diff --git a/radarattacklayer7topaseorigin_test.go b/radarattacklayer7topaseorigin_test.go new file mode 100644 index 00000000000..2eadf4efd39 --- /dev/null +++ b/radarattacklayer7topaseorigin_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7TopAseOriginListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Tops.Ases.Origins.List(context.TODO(), cloudflare.RadarAttackLayer7TopAseOriginListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7TopAseOriginListParamsDateRange{cloudflare.RadarAttackLayer7TopAseOriginListParamsDateRange1d, cloudflare.RadarAttackLayer7TopAseOriginListParamsDateRange2d, cloudflare.RadarAttackLayer7TopAseOriginListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7TopAseOriginListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7topattack.go b/radarattacklayer7topattack.go new file mode 100644 index 00000000000..04fda386b4a --- /dev/null +++ b/radarattacklayer7topattack.go @@ -0,0 +1,293 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TopAttackService 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 +// [NewRadarAttackLayer7TopAttackService] method instead. +type RadarAttackLayer7TopAttackService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7TopAttackService 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 NewRadarAttackLayer7TopAttackService(opts ...option.RequestOption) (r *RadarAttackLayer7TopAttackService) { + r = &RadarAttackLayer7TopAttackService{} + r.Options = opts + return +} + +// Get the top attacks from origin to target location. Values are a percentage out +// of the total layer 7 attacks (with billing country). The attack magnitude can be +// defined by the number of mitigated requests or by the number of zones affected. +// You can optionally limit the number of attacks per origin/target location +// (useful if all the top attacks are from or to the same location). +func (r *RadarAttackLayer7TopAttackService) List(ctx context.Context, query RadarAttackLayer7TopAttackListParams, opts ...option.RequestOption) (res *RadarAttackLayer7TopAttackListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/top/attacks" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7TopAttackListResponse struct { + Result RadarAttackLayer7TopAttackListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7TopAttackListResponseJSON `json:"-"` +} + +// radarAttackLayer7TopAttackListResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer7TopAttackListResponse] +type radarAttackLayer7TopAttackListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAttackListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAttackListResponseResult struct { + Meta RadarAttackLayer7TopAttackListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer7TopAttackListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer7TopAttackListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7TopAttackListResponseResultJSON contains the JSON metadata for +// the struct [RadarAttackLayer7TopAttackListResponseResult] +type radarAttackLayer7TopAttackListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAttackListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAttackListResponseResultMeta struct { + DateRange []RadarAttackLayer7TopAttackListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7TopAttackListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7TopAttackListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarAttackLayer7TopAttackListResponseResultMeta] +type radarAttackLayer7TopAttackListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAttackListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAttackListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7TopAttackListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7TopAttackListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7TopAttackListResponseResultMetaDateRange] +type radarAttackLayer7TopAttackListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAttackListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfo] +type radarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAttackListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAttackListResponseResultTop0 struct { + OriginCountryAlpha2 string `json:"originCountryAlpha2,required"` + OriginCountryName string `json:"originCountryName,required"` + TargetCountryAlpha2 string `json:"targetCountryAlpha2,required"` + TargetCountryName string `json:"targetCountryName,required"` + Value string `json:"value,required"` + JSON radarAttackLayer7TopAttackListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer7TopAttackListResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarAttackLayer7TopAttackListResponseResultTop0] +type radarAttackLayer7TopAttackListResponseResultTop0JSON struct { + OriginCountryAlpha2 apijson.Field + OriginCountryName apijson.Field + TargetCountryAlpha2 apijson.Field + TargetCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopAttackListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopAttackListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7TopAttackListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7TopAttackListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of attack origin/target location attack limits. Together with + // `limitPerLocation`, limits how many objects will be fetched per origin/target + // location. + LimitDirection param.Field[RadarAttackLayer7TopAttackListParamsLimitDirection] `query:"limitDirection"` + // Limit the number of attacks per origin/target (refer to `limitDirection` + // parameter) location. + LimitPerLocation param.Field[int64] `query:"limitPerLocation"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Attack magnitude can be defined by total requests mitigated or by total zones + // attacked. + Magnitude param.Field[RadarAttackLayer7TopAttackListParamsMagnitude] `query:"magnitude"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7TopAttackListParams]'s query parameters as +// `url.Values`. +func (r RadarAttackLayer7TopAttackListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7TopAttackListParamsDateRange string + +const ( + RadarAttackLayer7TopAttackListParamsDateRange1d RadarAttackLayer7TopAttackListParamsDateRange = "1d" + RadarAttackLayer7TopAttackListParamsDateRange2d RadarAttackLayer7TopAttackListParamsDateRange = "2d" + RadarAttackLayer7TopAttackListParamsDateRange7d RadarAttackLayer7TopAttackListParamsDateRange = "7d" + RadarAttackLayer7TopAttackListParamsDateRange14d RadarAttackLayer7TopAttackListParamsDateRange = "14d" + RadarAttackLayer7TopAttackListParamsDateRange28d RadarAttackLayer7TopAttackListParamsDateRange = "28d" + RadarAttackLayer7TopAttackListParamsDateRange12w RadarAttackLayer7TopAttackListParamsDateRange = "12w" + RadarAttackLayer7TopAttackListParamsDateRange24w RadarAttackLayer7TopAttackListParamsDateRange = "24w" + RadarAttackLayer7TopAttackListParamsDateRange52w RadarAttackLayer7TopAttackListParamsDateRange = "52w" + RadarAttackLayer7TopAttackListParamsDateRange1dControl RadarAttackLayer7TopAttackListParamsDateRange = "1dControl" + RadarAttackLayer7TopAttackListParamsDateRange2dControl RadarAttackLayer7TopAttackListParamsDateRange = "2dControl" + RadarAttackLayer7TopAttackListParamsDateRange7dControl RadarAttackLayer7TopAttackListParamsDateRange = "7dControl" + RadarAttackLayer7TopAttackListParamsDateRange14dControl RadarAttackLayer7TopAttackListParamsDateRange = "14dControl" + RadarAttackLayer7TopAttackListParamsDateRange28dControl RadarAttackLayer7TopAttackListParamsDateRange = "28dControl" + RadarAttackLayer7TopAttackListParamsDateRange12wControl RadarAttackLayer7TopAttackListParamsDateRange = "12wControl" + RadarAttackLayer7TopAttackListParamsDateRange24wControl RadarAttackLayer7TopAttackListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7TopAttackListParamsFormat string + +const ( + RadarAttackLayer7TopAttackListParamsFormatJson RadarAttackLayer7TopAttackListParamsFormat = "JSON" + RadarAttackLayer7TopAttackListParamsFormatCsv RadarAttackLayer7TopAttackListParamsFormat = "CSV" +) + +// Array of attack origin/target location attack limits. Together with +// `limitPerLocation`, limits how many objects will be fetched per origin/target +// location. +type RadarAttackLayer7TopAttackListParamsLimitDirection string + +const ( + RadarAttackLayer7TopAttackListParamsLimitDirectionOrigin RadarAttackLayer7TopAttackListParamsLimitDirection = "ORIGIN" + RadarAttackLayer7TopAttackListParamsLimitDirectionTarget RadarAttackLayer7TopAttackListParamsLimitDirection = "TARGET" +) + +// Attack magnitude can be defined by total requests mitigated or by total zones +// attacked. +type RadarAttackLayer7TopAttackListParamsMagnitude string + +const ( + RadarAttackLayer7TopAttackListParamsMagnitudeAffectedZones RadarAttackLayer7TopAttackListParamsMagnitude = "AFFECTED_ZONES" + RadarAttackLayer7TopAttackListParamsMagnitudeMitigatedRequests RadarAttackLayer7TopAttackListParamsMagnitude = "MITIGATED_REQUESTS" +) diff --git a/radarattacklayer7topattack_test.go b/radarattacklayer7topattack_test.go new file mode 100644 index 00000000000..de857942462 --- /dev/null +++ b/radarattacklayer7topattack_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7TopAttackListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Tops.Attacks.List(context.TODO(), cloudflare.RadarAttackLayer7TopAttackListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7TopAttackListParamsDateRange{cloudflare.RadarAttackLayer7TopAttackListParamsDateRange1d, cloudflare.RadarAttackLayer7TopAttackListParamsDateRange2d, cloudflare.RadarAttackLayer7TopAttackListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7TopAttackListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + LimitDirection: cloudflare.F(cloudflare.RadarAttackLayer7TopAttackListParamsLimitDirectionOrigin), + LimitPerLocation: cloudflare.F(int64(10)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Magnitude: cloudflare.F(cloudflare.RadarAttackLayer7TopAttackListParamsMagnitudeMitigatedRequests), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7toplocation.go b/radarattacklayer7toplocation.go new file mode 100644 index 00000000000..8072aea8dae --- /dev/null +++ b/radarattacklayer7toplocation.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TopLocationService 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 +// [NewRadarAttackLayer7TopLocationService] method instead. +type RadarAttackLayer7TopLocationService struct { + Options []option.RequestOption + Origins *RadarAttackLayer7TopLocationOriginService + Targets *RadarAttackLayer7TopLocationTargetService +} + +// NewRadarAttackLayer7TopLocationService 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 NewRadarAttackLayer7TopLocationService(opts ...option.RequestOption) (r *RadarAttackLayer7TopLocationService) { + r = &RadarAttackLayer7TopLocationService{} + r.Options = opts + r.Origins = NewRadarAttackLayer7TopLocationOriginService(opts...) + r.Targets = NewRadarAttackLayer7TopLocationTargetService(opts...) + return +} diff --git a/radarattacklayer7toplocationorigin.go b/radarattacklayer7toplocationorigin.go new file mode 100644 index 00000000000..2e233f56464 --- /dev/null +++ b/radarattacklayer7toplocationorigin.go @@ -0,0 +1,259 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TopLocationOriginService 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 +// [NewRadarAttackLayer7TopLocationOriginService] method instead. +type RadarAttackLayer7TopLocationOriginService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7TopLocationOriginService 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 NewRadarAttackLayer7TopLocationOriginService(opts ...option.RequestOption) (r *RadarAttackLayer7TopLocationOriginService) { + r = &RadarAttackLayer7TopLocationOriginService{} + r.Options = opts + return +} + +// Get the top origin locations of and by layer 7 attacks. Values are a percentage +// out of the total layer 7 attacks. The origin location is determined by the +// client IP. +func (r *RadarAttackLayer7TopLocationOriginService) List(ctx context.Context, query RadarAttackLayer7TopLocationOriginListParams, opts ...option.RequestOption) (res *RadarAttackLayer7TopLocationOriginListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/top/locations/origin" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7TopLocationOriginListResponse struct { + Result RadarAttackLayer7TopLocationOriginListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7TopLocationOriginListResponseJSON `json:"-"` +} + +// radarAttackLayer7TopLocationOriginListResponseJSON contains the JSON metadata +// for the struct [RadarAttackLayer7TopLocationOriginListResponse] +type radarAttackLayer7TopLocationOriginListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationOriginListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationOriginListResponseResult struct { + Meta RadarAttackLayer7TopLocationOriginListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer7TopLocationOriginListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer7TopLocationOriginListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7TopLocationOriginListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7TopLocationOriginListResponseResult] +type radarAttackLayer7TopLocationOriginListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationOriginListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationOriginListResponseResultMeta struct { + DateRange []RadarAttackLayer7TopLocationOriginListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7TopLocationOriginListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7TopLocationOriginListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7TopLocationOriginListResponseResultMeta] +type radarAttackLayer7TopLocationOriginListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationOriginListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationOriginListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7TopLocationOriginListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7TopLocationOriginListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7TopLocationOriginListResponseResultMetaDateRange] +type radarAttackLayer7TopLocationOriginListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationOriginListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfo] +type radarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationOriginListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationOriginListResponseResultTop0 struct { + OriginCountryAlpha2 string `json:"originCountryAlpha2,required"` + OriginCountryName string `json:"originCountryName,required"` + Rank float64 `json:"rank,required"` + Value string `json:"value,required"` + JSON radarAttackLayer7TopLocationOriginListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer7TopLocationOriginListResponseResultTop0JSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7TopLocationOriginListResponseResultTop0] +type radarAttackLayer7TopLocationOriginListResponseResultTop0JSON struct { + OriginCountryAlpha2 apijson.Field + OriginCountryName apijson.Field + Rank apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationOriginListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationOriginListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7TopLocationOriginListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7TopLocationOriginListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7TopLocationOriginListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7TopLocationOriginListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7TopLocationOriginListParamsDateRange string + +const ( + RadarAttackLayer7TopLocationOriginListParamsDateRange1d RadarAttackLayer7TopLocationOriginListParamsDateRange = "1d" + RadarAttackLayer7TopLocationOriginListParamsDateRange2d RadarAttackLayer7TopLocationOriginListParamsDateRange = "2d" + RadarAttackLayer7TopLocationOriginListParamsDateRange7d RadarAttackLayer7TopLocationOriginListParamsDateRange = "7d" + RadarAttackLayer7TopLocationOriginListParamsDateRange14d RadarAttackLayer7TopLocationOriginListParamsDateRange = "14d" + RadarAttackLayer7TopLocationOriginListParamsDateRange28d RadarAttackLayer7TopLocationOriginListParamsDateRange = "28d" + RadarAttackLayer7TopLocationOriginListParamsDateRange12w RadarAttackLayer7TopLocationOriginListParamsDateRange = "12w" + RadarAttackLayer7TopLocationOriginListParamsDateRange24w RadarAttackLayer7TopLocationOriginListParamsDateRange = "24w" + RadarAttackLayer7TopLocationOriginListParamsDateRange52w RadarAttackLayer7TopLocationOriginListParamsDateRange = "52w" + RadarAttackLayer7TopLocationOriginListParamsDateRange1dControl RadarAttackLayer7TopLocationOriginListParamsDateRange = "1dControl" + RadarAttackLayer7TopLocationOriginListParamsDateRange2dControl RadarAttackLayer7TopLocationOriginListParamsDateRange = "2dControl" + RadarAttackLayer7TopLocationOriginListParamsDateRange7dControl RadarAttackLayer7TopLocationOriginListParamsDateRange = "7dControl" + RadarAttackLayer7TopLocationOriginListParamsDateRange14dControl RadarAttackLayer7TopLocationOriginListParamsDateRange = "14dControl" + RadarAttackLayer7TopLocationOriginListParamsDateRange28dControl RadarAttackLayer7TopLocationOriginListParamsDateRange = "28dControl" + RadarAttackLayer7TopLocationOriginListParamsDateRange12wControl RadarAttackLayer7TopLocationOriginListParamsDateRange = "12wControl" + RadarAttackLayer7TopLocationOriginListParamsDateRange24wControl RadarAttackLayer7TopLocationOriginListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7TopLocationOriginListParamsFormat string + +const ( + RadarAttackLayer7TopLocationOriginListParamsFormatJson RadarAttackLayer7TopLocationOriginListParamsFormat = "JSON" + RadarAttackLayer7TopLocationOriginListParamsFormatCsv RadarAttackLayer7TopLocationOriginListParamsFormat = "CSV" +) diff --git a/radarattacklayer7toplocationorigin_test.go b/radarattacklayer7toplocationorigin_test.go new file mode 100644 index 00000000000..44cca38a2ee --- /dev/null +++ b/radarattacklayer7toplocationorigin_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7TopLocationOriginListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Tops.Locations.Origins.List(context.TODO(), cloudflare.RadarAttackLayer7TopLocationOriginListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7TopLocationOriginListParamsDateRange{cloudflare.RadarAttackLayer7TopLocationOriginListParamsDateRange1d, cloudflare.RadarAttackLayer7TopLocationOriginListParamsDateRange2d, cloudflare.RadarAttackLayer7TopLocationOriginListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7TopLocationOriginListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7toplocationtarget.go b/radarattacklayer7toplocationtarget.go new file mode 100644 index 00000000000..19085e57fa9 --- /dev/null +++ b/radarattacklayer7toplocationtarget.go @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7TopLocationTargetService 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 +// [NewRadarAttackLayer7TopLocationTargetService] method instead. +type RadarAttackLayer7TopLocationTargetService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7TopLocationTargetService 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 NewRadarAttackLayer7TopLocationTargetService(opts ...option.RequestOption) (r *RadarAttackLayer7TopLocationTargetService) { + r = &RadarAttackLayer7TopLocationTargetService{} + r.Options = opts + return +} + +// Get the top target locations of and by layer 7 attacks. Values are a percentage +// out of the total layer 7 attacks. The target location is determined by the +// attacked zone's billing country, when available. +func (r *RadarAttackLayer7TopLocationTargetService) List(ctx context.Context, query RadarAttackLayer7TopLocationTargetListParams, opts ...option.RequestOption) (res *RadarAttackLayer7TopLocationTargetListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/top/locations/target" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7TopLocationTargetListResponse struct { + Result RadarAttackLayer7TopLocationTargetListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7TopLocationTargetListResponseJSON `json:"-"` +} + +// radarAttackLayer7TopLocationTargetListResponseJSON contains the JSON metadata +// for the struct [RadarAttackLayer7TopLocationTargetListResponse] +type radarAttackLayer7TopLocationTargetListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationTargetListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationTargetListResponseResult struct { + Meta RadarAttackLayer7TopLocationTargetListResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer7TopLocationTargetListResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer7TopLocationTargetListResponseResultJSON `json:"-"` +} + +// radarAttackLayer7TopLocationTargetListResponseResultJSON contains the JSON +// metadata for the struct [RadarAttackLayer7TopLocationTargetListResponseResult] +type radarAttackLayer7TopLocationTargetListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationTargetListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationTargetListResponseResultMeta struct { + DateRange []RadarAttackLayer7TopLocationTargetListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7TopLocationTargetListResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7TopLocationTargetListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7TopLocationTargetListResponseResultMeta] +type radarAttackLayer7TopLocationTargetListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationTargetListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationTargetListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7TopLocationTargetListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7TopLocationTargetListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7TopLocationTargetListResponseResultMetaDateRange] +type radarAttackLayer7TopLocationTargetListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationTargetListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfo] +type radarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationTargetListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationTargetListResponseResultTop0 struct { + Rank float64 `json:"rank,required"` + TargetCountryAlpha2 string `json:"targetCountryAlpha2,required"` + TargetCountryName string `json:"targetCountryName,required"` + Value string `json:"value,required"` + JSON radarAttackLayer7TopLocationTargetListResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer7TopLocationTargetListResponseResultTop0JSON contains the JSON +// metadata for the struct +// [RadarAttackLayer7TopLocationTargetListResponseResultTop0] +type radarAttackLayer7TopLocationTargetListResponseResultTop0JSON struct { + Rank apijson.Field + TargetCountryAlpha2 apijson.Field + TargetCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7TopLocationTargetListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7TopLocationTargetListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7TopLocationTargetListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7TopLocationTargetListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7TopLocationTargetListParams]'s query +// parameters as `url.Values`. +func (r RadarAttackLayer7TopLocationTargetListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7TopLocationTargetListParamsDateRange string + +const ( + RadarAttackLayer7TopLocationTargetListParamsDateRange1d RadarAttackLayer7TopLocationTargetListParamsDateRange = "1d" + RadarAttackLayer7TopLocationTargetListParamsDateRange2d RadarAttackLayer7TopLocationTargetListParamsDateRange = "2d" + RadarAttackLayer7TopLocationTargetListParamsDateRange7d RadarAttackLayer7TopLocationTargetListParamsDateRange = "7d" + RadarAttackLayer7TopLocationTargetListParamsDateRange14d RadarAttackLayer7TopLocationTargetListParamsDateRange = "14d" + RadarAttackLayer7TopLocationTargetListParamsDateRange28d RadarAttackLayer7TopLocationTargetListParamsDateRange = "28d" + RadarAttackLayer7TopLocationTargetListParamsDateRange12w RadarAttackLayer7TopLocationTargetListParamsDateRange = "12w" + RadarAttackLayer7TopLocationTargetListParamsDateRange24w RadarAttackLayer7TopLocationTargetListParamsDateRange = "24w" + RadarAttackLayer7TopLocationTargetListParamsDateRange52w RadarAttackLayer7TopLocationTargetListParamsDateRange = "52w" + RadarAttackLayer7TopLocationTargetListParamsDateRange1dControl RadarAttackLayer7TopLocationTargetListParamsDateRange = "1dControl" + RadarAttackLayer7TopLocationTargetListParamsDateRange2dControl RadarAttackLayer7TopLocationTargetListParamsDateRange = "2dControl" + RadarAttackLayer7TopLocationTargetListParamsDateRange7dControl RadarAttackLayer7TopLocationTargetListParamsDateRange = "7dControl" + RadarAttackLayer7TopLocationTargetListParamsDateRange14dControl RadarAttackLayer7TopLocationTargetListParamsDateRange = "14dControl" + RadarAttackLayer7TopLocationTargetListParamsDateRange28dControl RadarAttackLayer7TopLocationTargetListParamsDateRange = "28dControl" + RadarAttackLayer7TopLocationTargetListParamsDateRange12wControl RadarAttackLayer7TopLocationTargetListParamsDateRange = "12wControl" + RadarAttackLayer7TopLocationTargetListParamsDateRange24wControl RadarAttackLayer7TopLocationTargetListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7TopLocationTargetListParamsFormat string + +const ( + RadarAttackLayer7TopLocationTargetListParamsFormatJson RadarAttackLayer7TopLocationTargetListParamsFormat = "JSON" + RadarAttackLayer7TopLocationTargetListParamsFormatCsv RadarAttackLayer7TopLocationTargetListParamsFormat = "CSV" +) diff --git a/radarattacklayer7toplocationtarget_test.go b/radarattacklayer7toplocationtarget_test.go new file mode 100644 index 00000000000..a137be05101 --- /dev/null +++ b/radarattacklayer7toplocationtarget_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7TopLocationTargetListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Tops.Locations.Targets.List(context.TODO(), cloudflare.RadarAttackLayer7TopLocationTargetListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7TopLocationTargetListParamsDateRange{cloudflare.RadarAttackLayer7TopLocationTargetListParamsDateRange1d, cloudflare.RadarAttackLayer7TopLocationTargetListParamsDateRange2d, cloudflare.RadarAttackLayer7TopLocationTargetListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7TopLocationTargetListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarattacklayer7vertical.go b/radarattacklayer7vertical.go new file mode 100644 index 00000000000..e65b365f1e3 --- /dev/null +++ b/radarattacklayer7vertical.go @@ -0,0 +1,496 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarAttackLayer7VerticalService 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 +// [NewRadarAttackLayer7VerticalService] method instead. +type RadarAttackLayer7VerticalService struct { + Options []option.RequestOption +} + +// NewRadarAttackLayer7VerticalService 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 NewRadarAttackLayer7VerticalService(opts ...option.RequestOption) (r *RadarAttackLayer7VerticalService) { + r = &RadarAttackLayer7VerticalService{} + r.Options = opts + return +} + +// Percentage distribution of attacks by vertical used over time. +func (r *RadarAttackLayer7VerticalService) ListTimeseriesGroups(ctx context.Context, query RadarAttackLayer7VerticalListTimeseriesGroupsParams, opts ...option.RequestOption) (res *RadarAttackLayer7VerticalListTimeseriesGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/timeseries_groups/vertical" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Get the Verticals of attacks. +func (r *RadarAttackLayer7VerticalService) ListTops(ctx context.Context, query RadarAttackLayer7VerticalListTopsParams, opts ...option.RequestOption) (res *RadarAttackLayer7VerticalListTopsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/attacks/layer7/top/vertical" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarAttackLayer7VerticalListTimeseriesGroupsResponse struct { + Result RadarAttackLayer7VerticalListTimeseriesGroupsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7VerticalListTimeseriesGroupsResponseJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTimeseriesGroupsResponseJSON contains the JSON +// metadata for the struct [RadarAttackLayer7VerticalListTimeseriesGroupsResponse] +type radarAttackLayer7VerticalListTimeseriesGroupsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTimeseriesGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTimeseriesGroupsResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarAttackLayer7VerticalListTimeseriesGroupsResponseResultSerie0 `json:"serie_0,required"` + JSON radarAttackLayer7VerticalListTimeseriesGroupsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTimeseriesGroupsResponseResultJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7VerticalListTimeseriesGroupsResponseResult] +type radarAttackLayer7VerticalListTimeseriesGroupsResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTimeseriesGroupsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTimeseriesGroupsResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarAttackLayer7VerticalListTimeseriesGroupsResponseResultSerie0JSON `json:"-"` +} + +// radarAttackLayer7VerticalListTimeseriesGroupsResponseResultSerie0JSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7VerticalListTimeseriesGroupsResponseResultSerie0] +type radarAttackLayer7VerticalListTimeseriesGroupsResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTimeseriesGroupsResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTopsResponse struct { + Result RadarAttackLayer7VerticalListTopsResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarAttackLayer7VerticalListTopsResponseJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTopsResponseJSON contains the JSON metadata for the +// struct [RadarAttackLayer7VerticalListTopsResponse] +type radarAttackLayer7VerticalListTopsResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTopsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTopsResponseResult struct { + Meta RadarAttackLayer7VerticalListTopsResponseResultMeta `json:"meta,required"` + Top0 []RadarAttackLayer7VerticalListTopsResponseResultTop0 `json:"top_0,required"` + JSON radarAttackLayer7VerticalListTopsResponseResultJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTopsResponseResultJSON contains the JSON metadata +// for the struct [RadarAttackLayer7VerticalListTopsResponseResult] +type radarAttackLayer7VerticalListTopsResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTopsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTopsResponseResultMeta struct { + DateRange []RadarAttackLayer7VerticalListTopsResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarAttackLayer7VerticalListTopsResponseResultMetaJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTopsResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarAttackLayer7VerticalListTopsResponseResultMeta] +type radarAttackLayer7VerticalListTopsResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTopsResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTopsResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarAttackLayer7VerticalListTopsResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTopsResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarAttackLayer7VerticalListTopsResponseResultMetaDateRange] +type radarAttackLayer7VerticalListTopsResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTopsResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfo struct { + Annotations []RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfo] +type radarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoAnnotation] +type radarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTopsResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTopsResponseResultTop0 struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON radarAttackLayer7VerticalListTopsResponseResultTop0JSON `json:"-"` +} + +// radarAttackLayer7VerticalListTopsResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarAttackLayer7VerticalListTopsResponseResultTop0] +type radarAttackLayer7VerticalListTopsResponseResultTop0JSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarAttackLayer7VerticalListTopsResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarAttackLayer7VerticalListTimeseriesGroupsParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7VerticalListTimeseriesGroupsParamsFormat] `query:"format"` + // Filter for http method. + HTTPMethod param.Field[[]RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod] `query:"httpMethod"` + // Filter for http version. + HTTPVersion param.Field[[]RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects (eg browsers, verticals, etc) to the top items over + // the time range. + LimitPerGroup param.Field[int64] `query:"limitPerGroup"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of L7 mitigation products. + MitigationProduct param.Field[[]RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct] `query:"mitigationProduct"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarAttackLayer7VerticalListTimeseriesGroupsParamsNormalization] `query:"normalization"` +} + +// URLQuery serializes [RadarAttackLayer7VerticalListTimeseriesGroupsParams]'s +// query parameters as `url.Values`. +func (r RadarAttackLayer7VerticalListTimeseriesGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval15m RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval = "15m" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval1h RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval = "1h" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval1d RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval = "1d" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval1w RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval = "1w" +) + +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange1d RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "1d" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange2d RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "2d" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange7d RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "7d" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange14d RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "14d" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange28d RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "28d" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange12w RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "12w" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange24w RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "24w" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange52w RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "52w" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange1dControl RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "1dControl" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange2dControl RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "2dControl" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange7dControl RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "7dControl" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange14dControl RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "14dControl" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange28dControl RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "28dControl" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange12wControl RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "12wControl" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange24wControl RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsFormat string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsFormatJson RadarAttackLayer7VerticalListTimeseriesGroupsParamsFormat = "JSON" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsFormatCsv RadarAttackLayer7VerticalListTimeseriesGroupsParamsFormat = "CSV" +) + +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodGet RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "GET" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodPost RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "POST" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodDelete RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "DELETE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodPut RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "PUT" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodHead RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "HEAD" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodPurge RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "PURGE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodOptions RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "OPTIONS" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodPropfind RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "PROPFIND" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodMkcol RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "MKCOL" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodPatch RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "PATCH" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodACL RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "ACL" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodBcopy RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "BCOPY" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodBdelete RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "BDELETE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodBmove RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "BMOVE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodBpropfind RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "BPROPFIND" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodBproppatch RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "BPROPPATCH" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodCheckin RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "CHECKIN" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodCheckout RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "CHECKOUT" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodConnect RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "CONNECT" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodCopy RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "COPY" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodLabel RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "LABEL" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodLock RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "LOCK" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodMerge RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "MERGE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodMkactivity RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "MKACTIVITY" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodMkworkspace RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "MKWORKSPACE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodMove RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "MOVE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodNotify RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "NOTIFY" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodOrderpatch RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "ORDERPATCH" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodPoll RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "POLL" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodProppatch RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "PROPPATCH" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodReport RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "REPORT" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodSearch RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "SEARCH" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodSubscribe RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "SUBSCRIBE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodTrace RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "TRACE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodUncheckout RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "UNCHECKOUT" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodUnlock RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "UNLOCK" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodUnsubscribe RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "UNSUBSCRIBE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodUpdate RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "UPDATE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodVersioncontrol RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "VERSIONCONTROL" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodBaselinecontrol RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "BASELINECONTROL" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodXmsenumatts RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "XMSENUMATTS" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodRpcOutData RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "RPC_OUT_DATA" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodRpcInData RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "RPC_IN_DATA" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodJson RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "JSON" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodCook RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "COOK" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodTrack RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod = "TRACK" +) + +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersion string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersionHttPv1 RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersion = "HTTPv1" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersionHttPv2 RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersion = "HTTPv2" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersionHttPv3 RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersion = "HTTPv3" +) + +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersion string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersionIPv4 RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersion = "IPv4" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersionIPv6 RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersion = "IPv6" +) + +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductDdos RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct = "DDOS" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductWaf RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct = "WAF" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductBotManagement RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct = "BOT_MANAGEMENT" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductAccessRules RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct = "ACCESS_RULES" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductIPReputation RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct = "IP_REPUTATION" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductAPIShield RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct = "API_SHIELD" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductDataLossPrevention RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct = "DATA_LOSS_PREVENTION" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarAttackLayer7VerticalListTimeseriesGroupsParamsNormalization string + +const ( + RadarAttackLayer7VerticalListTimeseriesGroupsParamsNormalizationPercentage RadarAttackLayer7VerticalListTimeseriesGroupsParamsNormalization = "PERCENTAGE" + RadarAttackLayer7VerticalListTimeseriesGroupsParamsNormalizationMin0Max RadarAttackLayer7VerticalListTimeseriesGroupsParamsNormalization = "MIN0_MAX" +) + +type RadarAttackLayer7VerticalListTopsParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarAttackLayer7VerticalListTopsParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarAttackLayer7VerticalListTopsParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarAttackLayer7VerticalListTopsParams]'s query parameters +// as `url.Values`. +func (r RadarAttackLayer7VerticalListTopsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarAttackLayer7VerticalListTopsParamsDateRange string + +const ( + RadarAttackLayer7VerticalListTopsParamsDateRange1d RadarAttackLayer7VerticalListTopsParamsDateRange = "1d" + RadarAttackLayer7VerticalListTopsParamsDateRange2d RadarAttackLayer7VerticalListTopsParamsDateRange = "2d" + RadarAttackLayer7VerticalListTopsParamsDateRange7d RadarAttackLayer7VerticalListTopsParamsDateRange = "7d" + RadarAttackLayer7VerticalListTopsParamsDateRange14d RadarAttackLayer7VerticalListTopsParamsDateRange = "14d" + RadarAttackLayer7VerticalListTopsParamsDateRange28d RadarAttackLayer7VerticalListTopsParamsDateRange = "28d" + RadarAttackLayer7VerticalListTopsParamsDateRange12w RadarAttackLayer7VerticalListTopsParamsDateRange = "12w" + RadarAttackLayer7VerticalListTopsParamsDateRange24w RadarAttackLayer7VerticalListTopsParamsDateRange = "24w" + RadarAttackLayer7VerticalListTopsParamsDateRange52w RadarAttackLayer7VerticalListTopsParamsDateRange = "52w" + RadarAttackLayer7VerticalListTopsParamsDateRange1dControl RadarAttackLayer7VerticalListTopsParamsDateRange = "1dControl" + RadarAttackLayer7VerticalListTopsParamsDateRange2dControl RadarAttackLayer7VerticalListTopsParamsDateRange = "2dControl" + RadarAttackLayer7VerticalListTopsParamsDateRange7dControl RadarAttackLayer7VerticalListTopsParamsDateRange = "7dControl" + RadarAttackLayer7VerticalListTopsParamsDateRange14dControl RadarAttackLayer7VerticalListTopsParamsDateRange = "14dControl" + RadarAttackLayer7VerticalListTopsParamsDateRange28dControl RadarAttackLayer7VerticalListTopsParamsDateRange = "28dControl" + RadarAttackLayer7VerticalListTopsParamsDateRange12wControl RadarAttackLayer7VerticalListTopsParamsDateRange = "12wControl" + RadarAttackLayer7VerticalListTopsParamsDateRange24wControl RadarAttackLayer7VerticalListTopsParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarAttackLayer7VerticalListTopsParamsFormat string + +const ( + RadarAttackLayer7VerticalListTopsParamsFormatJson RadarAttackLayer7VerticalListTopsParamsFormat = "JSON" + RadarAttackLayer7VerticalListTopsParamsFormatCsv RadarAttackLayer7VerticalListTopsParamsFormat = "CSV" +) diff --git a/radarattacklayer7vertical_test.go b/radarattacklayer7vertical_test.go new file mode 100644 index 00000000000..bf40174e893 --- /dev/null +++ b/radarattacklayer7vertical_test.go @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarAttackLayer7VerticalListTimeseriesGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Verticals.ListTimeseriesGroups(context.TODO(), cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParams{ + AggInterval: cloudflare.F(cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange{cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange1d, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange2d, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsFormatJson), + HTTPMethod: cloudflare.F([]cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethod{cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodGet, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodPost, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPMethodDelete}), + HTTPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersion{cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersionHttPv1, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersionHttPv2, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersion{cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersionIPv4, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsIPVersionIPv6}), + LimitPerGroup: cloudflare.F(int64(4)), + Location: cloudflare.F([]string{"string", "string", "string"}), + MitigationProduct: cloudflare.F([]cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProduct{cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductDdos, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductWaf, cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsMitigationProductBotManagement}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarAttackLayer7VerticalListTimeseriesGroupsParamsNormalizationPercentage), + }) + 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 TestRadarAttackLayer7VerticalListTopsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Attacks.Layer7.Verticals.ListTops(context.TODO(), cloudflare.RadarAttackLayer7VerticalListTopsParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarAttackLayer7VerticalListTopsParamsDateRange{cloudflare.RadarAttackLayer7VerticalListTopsParamsDateRange1d, cloudflare.RadarAttackLayer7VerticalListTopsParamsDateRange2d, cloudflare.RadarAttackLayer7VerticalListTopsParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarAttackLayer7VerticalListTopsParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarbgp.go b/radarbgp.go new file mode 100644 index 00000000000..960e28b4a51 --- /dev/null +++ b/radarbgp.go @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpService 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 [NewRadarBgpService] method instead. +type RadarBgpService struct { + Options []option.RequestOption + Leaks *RadarBgpLeakService + Timeseries *RadarBgpTimeseryService + Tops *RadarBgpTopService + HijacksEvents *RadarBgpHijacksEventService + Routes *RadarBgpRouteService +} + +// NewRadarBgpService 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 NewRadarBgpService(opts ...option.RequestOption) (r *RadarBgpService) { + r = &RadarBgpService{} + r.Options = opts + r.Leaks = NewRadarBgpLeakService(opts...) + r.Timeseries = NewRadarBgpTimeseryService(opts...) + r.Tops = NewRadarBgpTopService(opts...) + r.HijacksEvents = NewRadarBgpHijacksEventService(opts...) + r.Routes = NewRadarBgpRouteService(opts...) + return +} diff --git a/radarbgphijacksevent.go b/radarbgphijacksevent.go new file mode 100644 index 00000000000..4adec430974 --- /dev/null +++ b/radarbgphijacksevent.go @@ -0,0 +1,290 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpHijacksEventService 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 [NewRadarBgpHijacksEventService] +// method instead. +type RadarBgpHijacksEventService struct { + Options []option.RequestOption +} + +// NewRadarBgpHijacksEventService 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 NewRadarBgpHijacksEventService(opts ...option.RequestOption) (r *RadarBgpHijacksEventService) { + r = &RadarBgpHijacksEventService{} + r.Options = opts + return +} + +// Get the BGP hijack events. (Beta) +func (r *RadarBgpHijacksEventService) List(ctx context.Context, query RadarBgpHijacksEventListParams, opts ...option.RequestOption) (res *RadarBgpHijacksEventListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/hijacks/events" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpHijacksEventListResponse struct { + Result RadarBgpHijacksEventListResponseResult `json:"result,required"` + ResultInfo RadarBgpHijacksEventListResponseResultInfo `json:"result_info,required"` + Success bool `json:"success,required"` + JSON radarBgpHijacksEventListResponseJSON `json:"-"` +} + +// radarBgpHijacksEventListResponseJSON contains the JSON metadata for the struct +// [RadarBgpHijacksEventListResponse] +type radarBgpHijacksEventListResponseJSON struct { + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpHijacksEventListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpHijacksEventListResponseResult struct { + ASNInfo []RadarBgpHijacksEventListResponseResultASNInfo `json:"asn_info,required"` + Events []RadarBgpHijacksEventListResponseResultEvent `json:"events,required"` + TotalMonitors int64 `json:"total_monitors,required"` + JSON radarBgpHijacksEventListResponseResultJSON `json:"-"` +} + +// radarBgpHijacksEventListResponseResultJSON contains the JSON metadata for the +// struct [RadarBgpHijacksEventListResponseResult] +type radarBgpHijacksEventListResponseResultJSON struct { + ASNInfo apijson.Field + Events apijson.Field + TotalMonitors apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpHijacksEventListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpHijacksEventListResponseResultASNInfo struct { + ASN int64 `json:"asn,required"` + CountryCode string `json:"country_code,required"` + OrgName string `json:"org_name,required"` + JSON radarBgpHijacksEventListResponseResultASNInfoJSON `json:"-"` +} + +// radarBgpHijacksEventListResponseResultASNInfoJSON contains the JSON metadata for +// the struct [RadarBgpHijacksEventListResponseResultASNInfo] +type radarBgpHijacksEventListResponseResultASNInfoJSON struct { + ASN apijson.Field + CountryCode apijson.Field + OrgName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpHijacksEventListResponseResultASNInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpHijacksEventListResponseResultEvent struct { + ID int64 `json:"id,required"` + ConfidenceScore int64 `json:"confidence_score,required"` + Duration int64 `json:"duration,required"` + EventType int64 `json:"event_type,required"` + HijackMsgsCount int64 `json:"hijack_msgs_count,required"` + HijackerASN int64 `json:"hijacker_asn,required"` + HijackerCountry string `json:"hijacker_country,required"` + IsStale bool `json:"is_stale,required"` + MaxHijackTs string `json:"max_hijack_ts,required"` + MaxMsgTs string `json:"max_msg_ts,required"` + MinHijackTs string `json:"min_hijack_ts,required"` + OnGoingCount int64 `json:"on_going_count,required"` + PeerASNs []int64 `json:"peer_asns,required"` + PeerIPCount int64 `json:"peer_ip_count,required"` + Prefixes []string `json:"prefixes,required"` + Tags []RadarBgpHijacksEventListResponseResultEventsTag `json:"tags,required"` + VictimASNs []int64 `json:"victim_asns,required"` + VictimCountries []string `json:"victim_countries,required"` + JSON radarBgpHijacksEventListResponseResultEventJSON `json:"-"` +} + +// radarBgpHijacksEventListResponseResultEventJSON contains the JSON metadata for +// the struct [RadarBgpHijacksEventListResponseResultEvent] +type radarBgpHijacksEventListResponseResultEventJSON struct { + ID apijson.Field + ConfidenceScore apijson.Field + Duration apijson.Field + EventType apijson.Field + HijackMsgsCount apijson.Field + HijackerASN apijson.Field + HijackerCountry apijson.Field + IsStale apijson.Field + MaxHijackTs apijson.Field + MaxMsgTs apijson.Field + MinHijackTs apijson.Field + OnGoingCount apijson.Field + PeerASNs apijson.Field + PeerIPCount apijson.Field + Prefixes apijson.Field + Tags apijson.Field + VictimASNs apijson.Field + VictimCountries apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpHijacksEventListResponseResultEvent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpHijacksEventListResponseResultEventsTag struct { + Name string `json:"name,required"` + Score int64 `json:"score,required"` + JSON radarBgpHijacksEventListResponseResultEventsTagJSON `json:"-"` +} + +// radarBgpHijacksEventListResponseResultEventsTagJSON contains the JSON metadata +// for the struct [RadarBgpHijacksEventListResponseResultEventsTag] +type radarBgpHijacksEventListResponseResultEventsTagJSON struct { + Name apijson.Field + Score apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpHijacksEventListResponseResultEventsTag) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpHijacksEventListResponseResultInfo struct { + Count int64 `json:"count,required"` + Page int64 `json:"page,required"` + PerPage int64 `json:"per_page,required"` + TotalCount int64 `json:"total_count,required"` + JSON radarBgpHijacksEventListResponseResultInfoJSON `json:"-"` +} + +// radarBgpHijacksEventListResponseResultInfoJSON contains the JSON metadata for +// the struct [RadarBgpHijacksEventListResponseResultInfo] +type radarBgpHijacksEventListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpHijacksEventListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpHijacksEventListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[time.Time] `query:"dateEnd" format:"date-time"` + // Shorthand date ranges for the last X days - use when you don't need specific + // start and end dates. + DateRange param.Field[RadarBgpHijacksEventListParamsDateRange] `query:"dateRange"` + // Start of the date range (inclusive). + DateStart param.Field[time.Time] `query:"dateStart" format:"date-time"` + // The unique identifier of a event + EventID param.Field[int64] `query:"eventId"` + // Format results are returned in. + Format param.Field[RadarBgpHijacksEventListParamsFormat] `query:"format"` + // The potential hijacker AS of a BGP hijack event + HijackerASN param.Field[int64] `query:"hijackerAsn"` + // The potential hijacker or victim AS of a BGP hijack event + InvolvedASN param.Field[int64] `query:"involvedAsn"` + // The country code of the potential hijacker or victim AS of a BGP hijack event + InvolvedCountry param.Field[string] `query:"involvedCountry"` + // The maximum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) + MaxConfidence param.Field[int64] `query:"maxConfidence"` + // The minimum confidence score to filter events (1-4 low, 5-7 mid, 8+ high) + MinConfidence param.Field[int64] `query:"minConfidence"` + // Current page number, starting from 1 + Page param.Field[int64] `query:"page"` + // Number of entries per page + PerPage param.Field[int64] `query:"per_page"` + // The prefix hijacked during a BGP hijack event + Prefix param.Field[string] `query:"prefix"` + // Sort events by field + SortBy param.Field[RadarBgpHijacksEventListParamsSortBy] `query:"sortBy"` + // Sort order + SortOrder param.Field[RadarBgpHijacksEventListParamsSortOrder] `query:"sortOrder"` + // The potential victim AS of a BGP hijack event + VictimASN param.Field[int64] `query:"victimAsn"` +} + +// URLQuery serializes [RadarBgpHijacksEventListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpHijacksEventListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Shorthand date ranges for the last X days - use when you don't need specific +// start and end dates. +type RadarBgpHijacksEventListParamsDateRange string + +const ( + RadarBgpHijacksEventListParamsDateRange1d RadarBgpHijacksEventListParamsDateRange = "1d" + RadarBgpHijacksEventListParamsDateRange2d RadarBgpHijacksEventListParamsDateRange = "2d" + RadarBgpHijacksEventListParamsDateRange7d RadarBgpHijacksEventListParamsDateRange = "7d" + RadarBgpHijacksEventListParamsDateRange14d RadarBgpHijacksEventListParamsDateRange = "14d" + RadarBgpHijacksEventListParamsDateRange28d RadarBgpHijacksEventListParamsDateRange = "28d" + RadarBgpHijacksEventListParamsDateRange12w RadarBgpHijacksEventListParamsDateRange = "12w" + RadarBgpHijacksEventListParamsDateRange24w RadarBgpHijacksEventListParamsDateRange = "24w" + RadarBgpHijacksEventListParamsDateRange52w RadarBgpHijacksEventListParamsDateRange = "52w" + RadarBgpHijacksEventListParamsDateRange1dControl RadarBgpHijacksEventListParamsDateRange = "1dControl" + RadarBgpHijacksEventListParamsDateRange2dControl RadarBgpHijacksEventListParamsDateRange = "2dControl" + RadarBgpHijacksEventListParamsDateRange7dControl RadarBgpHijacksEventListParamsDateRange = "7dControl" + RadarBgpHijacksEventListParamsDateRange14dControl RadarBgpHijacksEventListParamsDateRange = "14dControl" + RadarBgpHijacksEventListParamsDateRange28dControl RadarBgpHijacksEventListParamsDateRange = "28dControl" + RadarBgpHijacksEventListParamsDateRange12wControl RadarBgpHijacksEventListParamsDateRange = "12wControl" + RadarBgpHijacksEventListParamsDateRange24wControl RadarBgpHijacksEventListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarBgpHijacksEventListParamsFormat string + +const ( + RadarBgpHijacksEventListParamsFormatJson RadarBgpHijacksEventListParamsFormat = "JSON" + RadarBgpHijacksEventListParamsFormatCsv RadarBgpHijacksEventListParamsFormat = "CSV" +) + +// Sort events by field +type RadarBgpHijacksEventListParamsSortBy string + +const ( + RadarBgpHijacksEventListParamsSortByID RadarBgpHijacksEventListParamsSortBy = "ID" + RadarBgpHijacksEventListParamsSortByTime RadarBgpHijacksEventListParamsSortBy = "TIME" + RadarBgpHijacksEventListParamsSortByConfidence RadarBgpHijacksEventListParamsSortBy = "CONFIDENCE" +) + +// Sort order +type RadarBgpHijacksEventListParamsSortOrder string + +const ( + RadarBgpHijacksEventListParamsSortOrderAsc RadarBgpHijacksEventListParamsSortOrder = "ASC" + RadarBgpHijacksEventListParamsSortOrderDesc RadarBgpHijacksEventListParamsSortOrder = "DESC" +) diff --git a/radarbgphijacksevent_test.go b/radarbgphijacksevent_test.go new file mode 100644 index 00000000000..4d1ca8b68c3 --- /dev/null +++ b/radarbgphijacksevent_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpHijacksEventListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.HijacksEvents.List(context.TODO(), cloudflare.RadarBgpHijacksEventListParams{ + DateEnd: cloudflare.F(time.Now()), + DateRange: cloudflare.F(cloudflare.RadarBgpHijacksEventListParamsDateRange7d), + DateStart: cloudflare.F(time.Now()), + EventID: cloudflare.F(int64(0)), + Format: cloudflare.F(cloudflare.RadarBgpHijacksEventListParamsFormatJson), + HijackerASN: cloudflare.F(int64(0)), + InvolvedASN: cloudflare.F(int64(0)), + InvolvedCountry: cloudflare.F("string"), + MaxConfidence: cloudflare.F(int64(0)), + MinConfidence: cloudflare.F(int64(0)), + Page: cloudflare.F(int64(0)), + PerPage: cloudflare.F(int64(0)), + Prefix: cloudflare.F("string"), + SortBy: cloudflare.F(cloudflare.RadarBgpHijacksEventListParamsSortByTime), + SortOrder: cloudflare.F(cloudflare.RadarBgpHijacksEventListParamsSortOrderDesc), + VictimASN: cloudflare.F(int64(0)), + }) + 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/radarbgpleak.go b/radarbgpleak.go new file mode 100644 index 00000000000..9f76c63d814 --- /dev/null +++ b/radarbgpleak.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpLeakService 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 [NewRadarBgpLeakService] method +// instead. +type RadarBgpLeakService struct { + Options []option.RequestOption + Events *RadarBgpLeakEventService +} + +// NewRadarBgpLeakService 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 NewRadarBgpLeakService(opts ...option.RequestOption) (r *RadarBgpLeakService) { + r = &RadarBgpLeakService{} + r.Options = opts + r.Events = NewRadarBgpLeakEventService(opts...) + return +} diff --git a/radarbgpleakevent.go b/radarbgpleakevent.go new file mode 100644 index 00000000000..12ae114ec02 --- /dev/null +++ b/radarbgpleakevent.go @@ -0,0 +1,254 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpLeakEventService 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 [NewRadarBgpLeakEventService] method +// instead. +type RadarBgpLeakEventService struct { + Options []option.RequestOption +} + +// NewRadarBgpLeakEventService 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 NewRadarBgpLeakEventService(opts ...option.RequestOption) (r *RadarBgpLeakEventService) { + r = &RadarBgpLeakEventService{} + r.Options = opts + return +} + +// Get the BGP route leak events (Beta). +func (r *RadarBgpLeakEventService) List(ctx context.Context, query RadarBgpLeakEventListParams, opts ...option.RequestOption) (res *RadarBgpLeakEventListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/leaks/events" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpLeakEventListResponse struct { + Result RadarBgpLeakEventListResponseResult `json:"result,required"` + ResultInfo RadarBgpLeakEventListResponseResultInfo `json:"result_info,required"` + Success bool `json:"success,required"` + JSON radarBgpLeakEventListResponseJSON `json:"-"` +} + +// radarBgpLeakEventListResponseJSON contains the JSON metadata for the struct +// [RadarBgpLeakEventListResponse] +type radarBgpLeakEventListResponseJSON struct { + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpLeakEventListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpLeakEventListResponseResult struct { + ASNInfo []RadarBgpLeakEventListResponseResultASNInfo `json:"asn_info,required"` + Events []RadarBgpLeakEventListResponseResultEvent `json:"events,required"` + JSON radarBgpLeakEventListResponseResultJSON `json:"-"` +} + +// radarBgpLeakEventListResponseResultJSON contains the JSON metadata for the +// struct [RadarBgpLeakEventListResponseResult] +type radarBgpLeakEventListResponseResultJSON struct { + ASNInfo apijson.Field + Events apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpLeakEventListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpLeakEventListResponseResultASNInfo struct { + ASN int64 `json:"asn,required"` + CountryCode string `json:"country_code,required"` + OrgName string `json:"org_name,required"` + JSON radarBgpLeakEventListResponseResultASNInfoJSON `json:"-"` +} + +// radarBgpLeakEventListResponseResultASNInfoJSON contains the JSON metadata for +// the struct [RadarBgpLeakEventListResponseResultASNInfo] +type radarBgpLeakEventListResponseResultASNInfoJSON struct { + ASN apijson.Field + CountryCode apijson.Field + OrgName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpLeakEventListResponseResultASNInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpLeakEventListResponseResultEvent struct { + ID int64 `json:"id,required"` + Countries []string `json:"countries,required"` + DetectedTs string `json:"detected_ts,required"` + Finished bool `json:"finished,required"` + LeakASN int64 `json:"leak_asn,required"` + LeakCount int64 `json:"leak_count,required"` + LeakSeg []int64 `json:"leak_seg,required"` + LeakType int64 `json:"leak_type,required"` + MaxTs string `json:"max_ts,required"` + MinTs string `json:"min_ts,required"` + OriginCount int64 `json:"origin_count,required"` + PeerCount int64 `json:"peer_count,required"` + PrefixCount int64 `json:"prefix_count,required"` + JSON radarBgpLeakEventListResponseResultEventJSON `json:"-"` +} + +// radarBgpLeakEventListResponseResultEventJSON contains the JSON metadata for the +// struct [RadarBgpLeakEventListResponseResultEvent] +type radarBgpLeakEventListResponseResultEventJSON struct { + ID apijson.Field + Countries apijson.Field + DetectedTs apijson.Field + Finished apijson.Field + LeakASN apijson.Field + LeakCount apijson.Field + LeakSeg apijson.Field + LeakType apijson.Field + MaxTs apijson.Field + MinTs apijson.Field + OriginCount apijson.Field + PeerCount apijson.Field + PrefixCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpLeakEventListResponseResultEvent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpLeakEventListResponseResultInfo struct { + Count int64 `json:"count,required"` + Page int64 `json:"page,required"` + PerPage int64 `json:"per_page,required"` + TotalCount int64 `json:"total_count,required"` + JSON radarBgpLeakEventListResponseResultInfoJSON `json:"-"` +} + +// radarBgpLeakEventListResponseResultInfoJSON contains the JSON metadata for the +// struct [RadarBgpLeakEventListResponseResultInfo] +type radarBgpLeakEventListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpLeakEventListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpLeakEventListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[time.Time] `query:"dateEnd" format:"date-time"` + // Shorthand date ranges for the last X days - use when you don't need specific + // start and end dates. + DateRange param.Field[RadarBgpLeakEventListParamsDateRange] `query:"dateRange"` + // Start of the date range (inclusive). + DateStart param.Field[time.Time] `query:"dateStart" format:"date-time"` + // The unique identifier of a event + EventID param.Field[int64] `query:"eventId"` + // Format results are returned in. + Format param.Field[RadarBgpLeakEventListParamsFormat] `query:"format"` + // ASN that is causing or affected by a route leak event + InvolvedASN param.Field[int64] `query:"involvedAsn"` + // Country code of a involved ASN in a route leak event + InvolvedCountry param.Field[string] `query:"involvedCountry"` + // The leaking AS of a route leak event + LeakASN param.Field[int64] `query:"leakAsn"` + // Current page number, starting from 1 + Page param.Field[int64] `query:"page"` + // Number of entries per page + PerPage param.Field[int64] `query:"per_page"` + // Sort events by field + SortBy param.Field[RadarBgpLeakEventListParamsSortBy] `query:"sortBy"` + // Sort order + SortOrder param.Field[RadarBgpLeakEventListParamsSortOrder] `query:"sortOrder"` +} + +// URLQuery serializes [RadarBgpLeakEventListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpLeakEventListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Shorthand date ranges for the last X days - use when you don't need specific +// start and end dates. +type RadarBgpLeakEventListParamsDateRange string + +const ( + RadarBgpLeakEventListParamsDateRange1d RadarBgpLeakEventListParamsDateRange = "1d" + RadarBgpLeakEventListParamsDateRange2d RadarBgpLeakEventListParamsDateRange = "2d" + RadarBgpLeakEventListParamsDateRange7d RadarBgpLeakEventListParamsDateRange = "7d" + RadarBgpLeakEventListParamsDateRange14d RadarBgpLeakEventListParamsDateRange = "14d" + RadarBgpLeakEventListParamsDateRange28d RadarBgpLeakEventListParamsDateRange = "28d" + RadarBgpLeakEventListParamsDateRange12w RadarBgpLeakEventListParamsDateRange = "12w" + RadarBgpLeakEventListParamsDateRange24w RadarBgpLeakEventListParamsDateRange = "24w" + RadarBgpLeakEventListParamsDateRange52w RadarBgpLeakEventListParamsDateRange = "52w" + RadarBgpLeakEventListParamsDateRange1dControl RadarBgpLeakEventListParamsDateRange = "1dControl" + RadarBgpLeakEventListParamsDateRange2dControl RadarBgpLeakEventListParamsDateRange = "2dControl" + RadarBgpLeakEventListParamsDateRange7dControl RadarBgpLeakEventListParamsDateRange = "7dControl" + RadarBgpLeakEventListParamsDateRange14dControl RadarBgpLeakEventListParamsDateRange = "14dControl" + RadarBgpLeakEventListParamsDateRange28dControl RadarBgpLeakEventListParamsDateRange = "28dControl" + RadarBgpLeakEventListParamsDateRange12wControl RadarBgpLeakEventListParamsDateRange = "12wControl" + RadarBgpLeakEventListParamsDateRange24wControl RadarBgpLeakEventListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarBgpLeakEventListParamsFormat string + +const ( + RadarBgpLeakEventListParamsFormatJson RadarBgpLeakEventListParamsFormat = "JSON" + RadarBgpLeakEventListParamsFormatCsv RadarBgpLeakEventListParamsFormat = "CSV" +) + +// Sort events by field +type RadarBgpLeakEventListParamsSortBy string + +const ( + RadarBgpLeakEventListParamsSortByID RadarBgpLeakEventListParamsSortBy = "ID" + RadarBgpLeakEventListParamsSortByLeaks RadarBgpLeakEventListParamsSortBy = "LEAKS" + RadarBgpLeakEventListParamsSortByPeers RadarBgpLeakEventListParamsSortBy = "PEERS" + RadarBgpLeakEventListParamsSortByPrefixes RadarBgpLeakEventListParamsSortBy = "PREFIXES" + RadarBgpLeakEventListParamsSortByOrigins RadarBgpLeakEventListParamsSortBy = "ORIGINS" + RadarBgpLeakEventListParamsSortByTime RadarBgpLeakEventListParamsSortBy = "TIME" +) + +// Sort order +type RadarBgpLeakEventListParamsSortOrder string + +const ( + RadarBgpLeakEventListParamsSortOrderAsc RadarBgpLeakEventListParamsSortOrder = "ASC" + RadarBgpLeakEventListParamsSortOrderDesc RadarBgpLeakEventListParamsSortOrder = "DESC" +) diff --git a/radarbgpleakevent_test.go b/radarbgpleakevent_test.go new file mode 100644 index 00000000000..eeb151fe87c --- /dev/null +++ b/radarbgpleakevent_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpLeakEventListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Leaks.Events.List(context.TODO(), cloudflare.RadarBgpLeakEventListParams{ + DateEnd: cloudflare.F(time.Now()), + DateRange: cloudflare.F(cloudflare.RadarBgpLeakEventListParamsDateRange7d), + DateStart: cloudflare.F(time.Now()), + EventID: cloudflare.F(int64(0)), + Format: cloudflare.F(cloudflare.RadarBgpLeakEventListParamsFormatJson), + InvolvedASN: cloudflare.F(int64(0)), + InvolvedCountry: cloudflare.F("string"), + LeakASN: cloudflare.F(int64(0)), + Page: cloudflare.F(int64(0)), + PerPage: cloudflare.F(int64(0)), + SortBy: cloudflare.F(cloudflare.RadarBgpLeakEventListParamsSortByTime), + SortOrder: cloudflare.F(cloudflare.RadarBgpLeakEventListParamsSortOrderDesc), + }) + 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/radarbgproute.go b/radarbgproute.go new file mode 100644 index 00000000000..9cf831c34d5 --- /dev/null +++ b/radarbgproute.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpRouteService 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 [NewRadarBgpRouteService] method +// instead. +type RadarBgpRouteService struct { + Options []option.RequestOption + Moas *RadarBgpRouteMoaService + Pfx2as *RadarBgpRoutePfx2aService + Stats *RadarBgpRouteStatService +} + +// NewRadarBgpRouteService 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 NewRadarBgpRouteService(opts ...option.RequestOption) (r *RadarBgpRouteService) { + r = &RadarBgpRouteService{} + r.Options = opts + r.Moas = NewRadarBgpRouteMoaService(opts...) + r.Pfx2as = NewRadarBgpRoutePfx2aService(opts...) + r.Stats = NewRadarBgpRouteStatService(opts...) + return +} diff --git a/radarbgproutemoa.go b/radarbgproutemoa.go new file mode 100644 index 00000000000..7476db17414 --- /dev/null +++ b/radarbgproutemoa.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpRouteMoaService 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 [NewRadarBgpRouteMoaService] method +// instead. +type RadarBgpRouteMoaService struct { + Options []option.RequestOption +} + +// NewRadarBgpRouteMoaService 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 NewRadarBgpRouteMoaService(opts ...option.RequestOption) (r *RadarBgpRouteMoaService) { + r = &RadarBgpRouteMoaService{} + r.Options = opts + return +} + +// List all Multi-origin AS (MOAS) prefixes on the global routing tables. +func (r *RadarBgpRouteMoaService) List(ctx context.Context, query RadarBgpRouteMoaListParams, opts ...option.RequestOption) (res *RadarBgpRouteMoaListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/routes/moas" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpRouteMoaListResponse struct { + Result RadarBgpRouteMoaListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarBgpRouteMoaListResponseJSON `json:"-"` +} + +// radarBgpRouteMoaListResponseJSON contains the JSON metadata for the struct +// [RadarBgpRouteMoaListResponse] +type radarBgpRouteMoaListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteMoaListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteMoaListResponseResult struct { + Meta RadarBgpRouteMoaListResponseResultMeta `json:"meta,required"` + Moas []RadarBgpRouteMoaListResponseResultMoa `json:"moas,required"` + JSON radarBgpRouteMoaListResponseResultJSON `json:"-"` +} + +// radarBgpRouteMoaListResponseResultJSON contains the JSON metadata for the struct +// [RadarBgpRouteMoaListResponseResult] +type radarBgpRouteMoaListResponseResultJSON struct { + Meta apijson.Field + Moas apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteMoaListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteMoaListResponseResultMeta struct { + DataTime string `json:"data_time,required"` + QueryTime string `json:"query_time,required"` + TotalPeers int64 `json:"total_peers,required"` + JSON radarBgpRouteMoaListResponseResultMetaJSON `json:"-"` +} + +// radarBgpRouteMoaListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarBgpRouteMoaListResponseResultMeta] +type radarBgpRouteMoaListResponseResultMetaJSON struct { + DataTime apijson.Field + QueryTime apijson.Field + TotalPeers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteMoaListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteMoaListResponseResultMoa struct { + Origins []RadarBgpRouteMoaListResponseResultMoasOrigin `json:"origins,required"` + Prefix string `json:"prefix,required"` + JSON radarBgpRouteMoaListResponseResultMoaJSON `json:"-"` +} + +// radarBgpRouteMoaListResponseResultMoaJSON contains the JSON metadata for the +// struct [RadarBgpRouteMoaListResponseResultMoa] +type radarBgpRouteMoaListResponseResultMoaJSON struct { + Origins apijson.Field + Prefix apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteMoaListResponseResultMoa) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteMoaListResponseResultMoasOrigin struct { + Origin int64 `json:"origin,required"` + PeerCount int64 `json:"peer_count,required"` + RpkiValidation string `json:"rpki_validation,required"` + JSON radarBgpRouteMoaListResponseResultMoasOriginJSON `json:"-"` +} + +// radarBgpRouteMoaListResponseResultMoasOriginJSON contains the JSON metadata for +// the struct [RadarBgpRouteMoaListResponseResultMoasOrigin] +type radarBgpRouteMoaListResponseResultMoasOriginJSON struct { + Origin apijson.Field + PeerCount apijson.Field + RpkiValidation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteMoaListResponseResultMoasOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteMoaListParams struct { + // Format results are returned in. + Format param.Field[RadarBgpRouteMoaListParamsFormat] `query:"format"` + // Lookup only RPKI invalid MOASes + InvalidOnly param.Field[bool] `query:"invalid_only"` + // Lookup MOASes originated by the given ASN + Origin param.Field[int64] `query:"origin"` + // Lookup MOASes by prefix + Prefix param.Field[string] `query:"prefix"` +} + +// URLQuery serializes [RadarBgpRouteMoaListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpRouteMoaListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarBgpRouteMoaListParamsFormat string + +const ( + RadarBgpRouteMoaListParamsFormatJson RadarBgpRouteMoaListParamsFormat = "JSON" + RadarBgpRouteMoaListParamsFormatCsv RadarBgpRouteMoaListParamsFormat = "CSV" +) diff --git a/radarbgproutemoa_test.go b/radarbgproutemoa_test.go new file mode 100644 index 00000000000..c6c806c21dc --- /dev/null +++ b/radarbgproutemoa_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpRouteMoaListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Routes.Moas.List(context.TODO(), cloudflare.RadarBgpRouteMoaListParams{ + Format: cloudflare.F(cloudflare.RadarBgpRouteMoaListParamsFormatJson), + InvalidOnly: cloudflare.F(true), + Origin: cloudflare.F(int64(0)), + Prefix: cloudflare.F("string"), + }) + 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/radarbgproutepfx2a.go b/radarbgproutepfx2a.go new file mode 100644 index 00000000000..7cdd7923080 --- /dev/null +++ b/radarbgproutepfx2a.go @@ -0,0 +1,160 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpRoutePfx2aService 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 [NewRadarBgpRoutePfx2aService] method +// instead. +type RadarBgpRoutePfx2aService struct { + Options []option.RequestOption +} + +// NewRadarBgpRoutePfx2aService 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 NewRadarBgpRoutePfx2aService(opts ...option.RequestOption) (r *RadarBgpRoutePfx2aService) { + r = &RadarBgpRoutePfx2aService{} + r.Options = opts + return +} + +// Lookup prefix-to-origin mapping on global routing tables. +func (r *RadarBgpRoutePfx2aService) List(ctx context.Context, query RadarBgpRoutePfx2aListParams, opts ...option.RequestOption) (res *RadarBgpRoutePfx2aListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/routes/pfx2as" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpRoutePfx2aListResponse struct { + Result RadarBgpRoutePfx2aListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarBgpRoutePfx2aListResponseJSON `json:"-"` +} + +// radarBgpRoutePfx2aListResponseJSON contains the JSON metadata for the struct +// [RadarBgpRoutePfx2aListResponse] +type radarBgpRoutePfx2aListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRoutePfx2aListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRoutePfx2aListResponseResult struct { + Meta RadarBgpRoutePfx2aListResponseResultMeta `json:"meta,required"` + PrefixOrigins []RadarBgpRoutePfx2aListResponseResultPrefixOrigin `json:"prefix_origins,required"` + JSON radarBgpRoutePfx2aListResponseResultJSON `json:"-"` +} + +// radarBgpRoutePfx2aListResponseResultJSON contains the JSON metadata for the +// struct [RadarBgpRoutePfx2aListResponseResult] +type radarBgpRoutePfx2aListResponseResultJSON struct { + Meta apijson.Field + PrefixOrigins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRoutePfx2aListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRoutePfx2aListResponseResultMeta struct { + DataTime string `json:"data_time,required"` + QueryTime string `json:"query_time,required"` + TotalPeers int64 `json:"total_peers,required"` + JSON radarBgpRoutePfx2aListResponseResultMetaJSON `json:"-"` +} + +// radarBgpRoutePfx2aListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarBgpRoutePfx2aListResponseResultMeta] +type radarBgpRoutePfx2aListResponseResultMetaJSON struct { + DataTime apijson.Field + QueryTime apijson.Field + TotalPeers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRoutePfx2aListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRoutePfx2aListResponseResultPrefixOrigin struct { + Origin int64 `json:"origin,required"` + PeerCount int64 `json:"peer_count,required"` + Prefix string `json:"prefix,required"` + RpkiValidation string `json:"rpki_validation,required"` + JSON radarBgpRoutePfx2aListResponseResultPrefixOriginJSON `json:"-"` +} + +// radarBgpRoutePfx2aListResponseResultPrefixOriginJSON contains the JSON metadata +// for the struct [RadarBgpRoutePfx2aListResponseResultPrefixOrigin] +type radarBgpRoutePfx2aListResponseResultPrefixOriginJSON struct { + Origin apijson.Field + PeerCount apijson.Field + Prefix apijson.Field + RpkiValidation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRoutePfx2aListResponseResultPrefixOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRoutePfx2aListParams struct { + // Format results are returned in. + Format param.Field[RadarBgpRoutePfx2aListParamsFormat] `query:"format"` + // Lookup prefixes originated by the given ASN + Origin param.Field[int64] `query:"origin"` + // Lookup origins of the given prefix + Prefix param.Field[string] `query:"prefix"` + // Return only results with matching rpki status: valid, invalid or unknown + RpkiStatus param.Field[RadarBgpRoutePfx2aListParamsRpkiStatus] `query:"rpkiStatus"` +} + +// URLQuery serializes [RadarBgpRoutePfx2aListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpRoutePfx2aListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarBgpRoutePfx2aListParamsFormat string + +const ( + RadarBgpRoutePfx2aListParamsFormatJson RadarBgpRoutePfx2aListParamsFormat = "JSON" + RadarBgpRoutePfx2aListParamsFormatCsv RadarBgpRoutePfx2aListParamsFormat = "CSV" +) + +// Return only results with matching rpki status: valid, invalid or unknown +type RadarBgpRoutePfx2aListParamsRpkiStatus string + +const ( + RadarBgpRoutePfx2aListParamsRpkiStatusValid RadarBgpRoutePfx2aListParamsRpkiStatus = "VALID" + RadarBgpRoutePfx2aListParamsRpkiStatusInvalid RadarBgpRoutePfx2aListParamsRpkiStatus = "INVALID" + RadarBgpRoutePfx2aListParamsRpkiStatusUnknown RadarBgpRoutePfx2aListParamsRpkiStatus = "UNKNOWN" +) diff --git a/radarbgproutepfx2a_test.go b/radarbgproutepfx2a_test.go new file mode 100644 index 00000000000..968ccd64c02 --- /dev/null +++ b/radarbgproutepfx2a_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpRoutePfx2aListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Routes.Pfx2as.List(context.TODO(), cloudflare.RadarBgpRoutePfx2aListParams{ + Format: cloudflare.F(cloudflare.RadarBgpRoutePfx2aListParamsFormatJson), + Origin: cloudflare.F(int64(0)), + Prefix: cloudflare.F("1.1.1.0/24"), + RpkiStatus: cloudflare.F(cloudflare.RadarBgpRoutePfx2aListParamsRpkiStatusInvalid), + }) + 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/radarbgproutestat.go b/radarbgproutestat.go new file mode 100644 index 00000000000..603d9e18472 --- /dev/null +++ b/radarbgproutestat.go @@ -0,0 +1,177 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpRouteStatService 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 [NewRadarBgpRouteStatService] method +// instead. +type RadarBgpRouteStatService struct { + Options []option.RequestOption +} + +// NewRadarBgpRouteStatService 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 NewRadarBgpRouteStatService(opts ...option.RequestOption) (r *RadarBgpRouteStatService) { + r = &RadarBgpRouteStatService{} + r.Options = opts + return +} + +// Get the BGP routing table stats (Beta). +func (r *RadarBgpRouteStatService) List(ctx context.Context, query RadarBgpRouteStatListParams, opts ...option.RequestOption) (res *RadarBgpRouteStatListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/routes/stats" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpRouteStatListResponse struct { + Result RadarBgpRouteStatListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarBgpRouteStatListResponseJSON `json:"-"` +} + +// radarBgpRouteStatListResponseJSON contains the JSON metadata for the struct +// [RadarBgpRouteStatListResponse] +type radarBgpRouteStatListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteStatListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteStatListResponseResult struct { + Meta RadarBgpRouteStatListResponseResultMeta `json:"meta,required"` + Stats RadarBgpRouteStatListResponseResultStats `json:"stats,required"` + JSON radarBgpRouteStatListResponseResultJSON `json:"-"` +} + +// radarBgpRouteStatListResponseResultJSON contains the JSON metadata for the +// struct [RadarBgpRouteStatListResponseResult] +type radarBgpRouteStatListResponseResultJSON struct { + Meta apijson.Field + Stats apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteStatListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteStatListResponseResultMeta struct { + DataTime string `json:"data_time,required"` + QueryTime string `json:"query_time,required"` + TotalPeers int64 `json:"total_peers,required"` + JSON radarBgpRouteStatListResponseResultMetaJSON `json:"-"` +} + +// radarBgpRouteStatListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarBgpRouteStatListResponseResultMeta] +type radarBgpRouteStatListResponseResultMetaJSON struct { + DataTime apijson.Field + QueryTime apijson.Field + TotalPeers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteStatListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteStatListResponseResultStats struct { + DistinctOrigins int64 `json:"distinct_origins,required"` + DistinctOriginsIpv4 int64 `json:"distinct_origins_ipv4,required"` + DistinctOriginsIpv6 int64 `json:"distinct_origins_ipv6,required"` + DistinctPrefixes int64 `json:"distinct_prefixes,required"` + DistinctPrefixesIpv4 int64 `json:"distinct_prefixes_ipv4,required"` + DistinctPrefixesIpv6 int64 `json:"distinct_prefixes_ipv6,required"` + RoutesInvalid int64 `json:"routes_invalid,required"` + RoutesInvalidIpv4 int64 `json:"routes_invalid_ipv4,required"` + RoutesInvalidIpv6 int64 `json:"routes_invalid_ipv6,required"` + RoutesTotal int64 `json:"routes_total,required"` + RoutesTotalIpv4 int64 `json:"routes_total_ipv4,required"` + RoutesTotalIpv6 int64 `json:"routes_total_ipv6,required"` + RoutesUnknown int64 `json:"routes_unknown,required"` + RoutesUnknownIpv4 int64 `json:"routes_unknown_ipv4,required"` + RoutesUnknownIpv6 int64 `json:"routes_unknown_ipv6,required"` + RoutesValid int64 `json:"routes_valid,required"` + RoutesValidIpv4 int64 `json:"routes_valid_ipv4,required"` + RoutesValidIpv6 int64 `json:"routes_valid_ipv6,required"` + JSON radarBgpRouteStatListResponseResultStatsJSON `json:"-"` +} + +// radarBgpRouteStatListResponseResultStatsJSON contains the JSON metadata for the +// struct [RadarBgpRouteStatListResponseResultStats] +type radarBgpRouteStatListResponseResultStatsJSON struct { + DistinctOrigins apijson.Field + DistinctOriginsIpv4 apijson.Field + DistinctOriginsIpv6 apijson.Field + DistinctPrefixes apijson.Field + DistinctPrefixesIpv4 apijson.Field + DistinctPrefixesIpv6 apijson.Field + RoutesInvalid apijson.Field + RoutesInvalidIpv4 apijson.Field + RoutesInvalidIpv6 apijson.Field + RoutesTotal apijson.Field + RoutesTotalIpv4 apijson.Field + RoutesTotalIpv6 apijson.Field + RoutesUnknown apijson.Field + RoutesUnknownIpv4 apijson.Field + RoutesUnknownIpv6 apijson.Field + RoutesValid apijson.Field + RoutesValidIpv4 apijson.Field + RoutesValidIpv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpRouteStatListResponseResultStats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpRouteStatListParams struct { + // Single ASN as integer. + ASN param.Field[int64] `query:"asn"` + // Format results are returned in. + Format param.Field[RadarBgpRouteStatListParamsFormat] `query:"format"` + // Location Alpha2 code. + Location param.Field[string] `query:"location"` +} + +// URLQuery serializes [RadarBgpRouteStatListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpRouteStatListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarBgpRouteStatListParamsFormat string + +const ( + RadarBgpRouteStatListParamsFormatJson RadarBgpRouteStatListParamsFormat = "JSON" + RadarBgpRouteStatListParamsFormatCsv RadarBgpRouteStatListParamsFormat = "CSV" +) diff --git a/radarbgproutestat_test.go b/radarbgproutestat_test.go new file mode 100644 index 00000000000..aa39383b076 --- /dev/null +++ b/radarbgproutestat_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpRouteStatListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Routes.Stats.List(context.TODO(), cloudflare.RadarBgpRouteStatListParams{ + ASN: cloudflare.F(int64(174)), + Format: cloudflare.F(cloudflare.RadarBgpRouteStatListParamsFormatJson), + Location: cloudflare.F("US"), + }) + 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/radarbgptimesery.go b/radarbgptimesery.go new file mode 100644 index 00000000000..1656cbe5a13 --- /dev/null +++ b/radarbgptimesery.go @@ -0,0 +1,277 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpTimeseryService 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 [NewRadarBgpTimeseryService] method +// instead. +type RadarBgpTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarBgpTimeseryService 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 NewRadarBgpTimeseryService(opts ...option.RequestOption) (r *RadarBgpTimeseryService) { + r = &RadarBgpTimeseryService{} + r.Options = opts + return +} + +// Gets BGP updates change over time. Raw values are returned. When requesting +// updates of an autonomous system (AS), only BGP updates of type announcement are +// returned. +func (r *RadarBgpTimeseryService) List(ctx context.Context, query RadarBgpTimeseryListParams, opts ...option.RequestOption) (res *RadarBgpTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/timeseries" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpTimeseryListResponse struct { + Result RadarBgpTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarBgpTimeseryListResponseJSON `json:"-"` +} + +// radarBgpTimeseryListResponseJSON contains the JSON metadata for the struct +// [RadarBgpTimeseryListResponse] +type radarBgpTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTimeseryListResponseResult struct { + Meta RadarBgpTimeseryListResponseResultMeta `json:"meta,required"` + Serie0 RadarBgpTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarBgpTimeseryListResponseResultJSON `json:"-"` +} + +// radarBgpTimeseryListResponseResultJSON contains the JSON metadata for the struct +// [RadarBgpTimeseryListResponseResult] +type radarBgpTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTimeseryListResponseResultMeta struct { + AggInterval string `json:"aggInterval,required"` + DateRange []RadarBgpTimeseryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated time.Time `json:"lastUpdated,required" format:"date-time"` + ConfidenceInfo RadarBgpTimeseryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarBgpTimeseryListResponseResultMetaJSON `json:"-"` +} + +// radarBgpTimeseryListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarBgpTimeseryListResponseResultMeta] +type radarBgpTimeseryListResponseResultMetaJSON struct { + AggInterval apijson.Field + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTimeseryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTimeseryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarBgpTimeseryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarBgpTimeseryListResponseResultMetaDateRangeJSON contains the JSON metadata +// for the struct [RadarBgpTimeseryListResponseResultMetaDateRange] +type radarBgpTimeseryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTimeseryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTimeseryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarBgpTimeseryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarBgpTimeseryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarBgpTimeseryListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct [RadarBgpTimeseryListResponseResultMetaConfidenceInfo] +type radarBgpTimeseryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTimeseryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTimeseryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarBgpTimeseryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarBgpTimeseryListResponseResultMetaConfidenceInfoAnnotationJSON contains the +// JSON metadata for the struct +// [RadarBgpTimeseryListResponseResultMetaConfidenceInfoAnnotation] +type radarBgpTimeseryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTimeseryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTimeseryListResponseResultSerie0 struct { + Timestamps []time.Time `json:"timestamps,required" format:"date-time"` + Values []string `json:"values,required"` + JSON radarBgpTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarBgpTimeseryListResponseResultSerie0JSON contains the JSON metadata for the +// struct [RadarBgpTimeseryListResponseResultSerie0] +type radarBgpTimeseryListResponseResultSerie0JSON struct { + Timestamps apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarBgpTimeseryListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarBgpTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarBgpTimeseryListParamsFormat] `query:"format"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of BGP network prefixes. + Prefix param.Field[[]string] `query:"prefix"` + // Array of BGP update types. + UpdateType param.Field[[]RadarBgpTimeseryListParamsUpdateType] `query:"updateType"` +} + +// URLQuery serializes [RadarBgpTimeseryListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarBgpTimeseryListParamsAggInterval string + +const ( + RadarBgpTimeseryListParamsAggInterval15m RadarBgpTimeseryListParamsAggInterval = "15m" + RadarBgpTimeseryListParamsAggInterval1h RadarBgpTimeseryListParamsAggInterval = "1h" + RadarBgpTimeseryListParamsAggInterval1d RadarBgpTimeseryListParamsAggInterval = "1d" + RadarBgpTimeseryListParamsAggInterval1w RadarBgpTimeseryListParamsAggInterval = "1w" +) + +type RadarBgpTimeseryListParamsDateRange string + +const ( + RadarBgpTimeseryListParamsDateRange1d RadarBgpTimeseryListParamsDateRange = "1d" + RadarBgpTimeseryListParamsDateRange2d RadarBgpTimeseryListParamsDateRange = "2d" + RadarBgpTimeseryListParamsDateRange7d RadarBgpTimeseryListParamsDateRange = "7d" + RadarBgpTimeseryListParamsDateRange14d RadarBgpTimeseryListParamsDateRange = "14d" + RadarBgpTimeseryListParamsDateRange28d RadarBgpTimeseryListParamsDateRange = "28d" + RadarBgpTimeseryListParamsDateRange12w RadarBgpTimeseryListParamsDateRange = "12w" + RadarBgpTimeseryListParamsDateRange24w RadarBgpTimeseryListParamsDateRange = "24w" + RadarBgpTimeseryListParamsDateRange52w RadarBgpTimeseryListParamsDateRange = "52w" + RadarBgpTimeseryListParamsDateRange1dControl RadarBgpTimeseryListParamsDateRange = "1dControl" + RadarBgpTimeseryListParamsDateRange2dControl RadarBgpTimeseryListParamsDateRange = "2dControl" + RadarBgpTimeseryListParamsDateRange7dControl RadarBgpTimeseryListParamsDateRange = "7dControl" + RadarBgpTimeseryListParamsDateRange14dControl RadarBgpTimeseryListParamsDateRange = "14dControl" + RadarBgpTimeseryListParamsDateRange28dControl RadarBgpTimeseryListParamsDateRange = "28dControl" + RadarBgpTimeseryListParamsDateRange12wControl RadarBgpTimeseryListParamsDateRange = "12wControl" + RadarBgpTimeseryListParamsDateRange24wControl RadarBgpTimeseryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarBgpTimeseryListParamsFormat string + +const ( + RadarBgpTimeseryListParamsFormatJson RadarBgpTimeseryListParamsFormat = "JSON" + RadarBgpTimeseryListParamsFormatCsv RadarBgpTimeseryListParamsFormat = "CSV" +) + +type RadarBgpTimeseryListParamsUpdateType string + +const ( + RadarBgpTimeseryListParamsUpdateTypeAnnouncement RadarBgpTimeseryListParamsUpdateType = "ANNOUNCEMENT" + RadarBgpTimeseryListParamsUpdateTypeWithdrawal RadarBgpTimeseryListParamsUpdateType = "WITHDRAWAL" +) diff --git a/radarbgptimesery_test.go b/radarbgptimesery_test.go new file mode 100644 index 00000000000..1fb3dccebb1 --- /dev/null +++ b/radarbgptimesery_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Timeseries.List(context.TODO(), cloudflare.RadarBgpTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarBgpTimeseryListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarBgpTimeseryListParamsDateRange{cloudflare.RadarBgpTimeseryListParamsDateRange1d, cloudflare.RadarBgpTimeseryListParamsDateRange2d, cloudflare.RadarBgpTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarBgpTimeseryListParamsFormatJson), + Name: cloudflare.F([]string{"string", "string", "string"}), + Prefix: cloudflare.F([]string{"string", "string", "string"}), + UpdateType: cloudflare.F([]cloudflare.RadarBgpTimeseryListParamsUpdateType{cloudflare.RadarBgpTimeseryListParamsUpdateTypeAnnouncement, cloudflare.RadarBgpTimeseryListParamsUpdateTypeWithdrawal}), + }) + 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/radarbgptop.go b/radarbgptop.go new file mode 100644 index 00000000000..2aeea88380a --- /dev/null +++ b/radarbgptop.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpTopService 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 [NewRadarBgpTopService] method +// instead. +type RadarBgpTopService struct { + Options []option.RequestOption + Ases *RadarBgpTopAseService + Prefixes *RadarBgpTopPrefixService +} + +// NewRadarBgpTopService 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 NewRadarBgpTopService(opts ...option.RequestOption) (r *RadarBgpTopService) { + r = &RadarBgpTopService{} + r.Options = opts + r.Ases = NewRadarBgpTopAseService(opts...) + r.Prefixes = NewRadarBgpTopPrefixService(opts...) + return +} diff --git a/radarbgptopase.go b/radarbgptopase.go new file mode 100644 index 00000000000..8046d2a940a --- /dev/null +++ b/radarbgptopase.go @@ -0,0 +1,213 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpTopAseService 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 [NewRadarBgpTopAseService] method +// instead. +type RadarBgpTopAseService struct { + Options []option.RequestOption + Prefixes *RadarBgpTopAsePrefixService +} + +// NewRadarBgpTopAseService 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 NewRadarBgpTopAseService(opts ...option.RequestOption) (r *RadarBgpTopAseService) { + r = &RadarBgpTopAseService{} + r.Options = opts + r.Prefixes = NewRadarBgpTopAsePrefixService(opts...) + return +} + +// Get the top autonomous systems (AS) by BGP updates (announcements only). Values +// are a percentage out of the total updates. +func (r *RadarBgpTopAseService) List(ctx context.Context, query RadarBgpTopAseListParams, opts ...option.RequestOption) (res *RadarBgpTopAseListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/top/ases" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpTopAseListResponse struct { + Result RadarBgpTopAseListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarBgpTopAseListResponseJSON `json:"-"` +} + +// radarBgpTopAseListResponseJSON contains the JSON metadata for the struct +// [RadarBgpTopAseListResponse] +type radarBgpTopAseListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAseListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAseListResponseResult struct { + Meta RadarBgpTopAseListResponseResultMeta `json:"meta,required"` + Top0 []RadarBgpTopAseListResponseResultTop0 `json:"top_0,required"` + JSON radarBgpTopAseListResponseResultJSON `json:"-"` +} + +// radarBgpTopAseListResponseResultJSON contains the JSON metadata for the struct +// [RadarBgpTopAseListResponseResult] +type radarBgpTopAseListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAseListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAseListResponseResultMeta struct { + DateRange []RadarBgpTopAseListResponseResultMetaDateRange `json:"dateRange,required"` + JSON radarBgpTopAseListResponseResultMetaJSON `json:"-"` +} + +// radarBgpTopAseListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarBgpTopAseListResponseResultMeta] +type radarBgpTopAseListResponseResultMetaJSON struct { + DateRange apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAseListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAseListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarBgpTopAseListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarBgpTopAseListResponseResultMetaDateRangeJSON contains the JSON metadata for +// the struct [RadarBgpTopAseListResponseResultMetaDateRange] +type radarBgpTopAseListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAseListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAseListResponseResultTop0 struct { + ASN int64 `json:"asn,required"` + AsName string `json:"ASName,required"` + // Percentage of updates by this AS out of the total updates by all autonomous + // systems. + Value string `json:"value,required"` + JSON radarBgpTopAseListResponseResultTop0JSON `json:"-"` +} + +// radarBgpTopAseListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarBgpTopAseListResponseResultTop0] +type radarBgpTopAseListResponseResultTop0JSON struct { + ASN apijson.Field + AsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAseListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAseListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarBgpTopAseListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarBgpTopAseListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of BGP network prefixes. + Prefix param.Field[[]string] `query:"prefix"` + // Array of BGP update types. + UpdateType param.Field[[]RadarBgpTopAseListParamsUpdateType] `query:"updateType"` +} + +// URLQuery serializes [RadarBgpTopAseListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpTopAseListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarBgpTopAseListParamsDateRange string + +const ( + RadarBgpTopAseListParamsDateRange1d RadarBgpTopAseListParamsDateRange = "1d" + RadarBgpTopAseListParamsDateRange2d RadarBgpTopAseListParamsDateRange = "2d" + RadarBgpTopAseListParamsDateRange7d RadarBgpTopAseListParamsDateRange = "7d" + RadarBgpTopAseListParamsDateRange14d RadarBgpTopAseListParamsDateRange = "14d" + RadarBgpTopAseListParamsDateRange28d RadarBgpTopAseListParamsDateRange = "28d" + RadarBgpTopAseListParamsDateRange12w RadarBgpTopAseListParamsDateRange = "12w" + RadarBgpTopAseListParamsDateRange24w RadarBgpTopAseListParamsDateRange = "24w" + RadarBgpTopAseListParamsDateRange52w RadarBgpTopAseListParamsDateRange = "52w" + RadarBgpTopAseListParamsDateRange1dControl RadarBgpTopAseListParamsDateRange = "1dControl" + RadarBgpTopAseListParamsDateRange2dControl RadarBgpTopAseListParamsDateRange = "2dControl" + RadarBgpTopAseListParamsDateRange7dControl RadarBgpTopAseListParamsDateRange = "7dControl" + RadarBgpTopAseListParamsDateRange14dControl RadarBgpTopAseListParamsDateRange = "14dControl" + RadarBgpTopAseListParamsDateRange28dControl RadarBgpTopAseListParamsDateRange = "28dControl" + RadarBgpTopAseListParamsDateRange12wControl RadarBgpTopAseListParamsDateRange = "12wControl" + RadarBgpTopAseListParamsDateRange24wControl RadarBgpTopAseListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarBgpTopAseListParamsFormat string + +const ( + RadarBgpTopAseListParamsFormatJson RadarBgpTopAseListParamsFormat = "JSON" + RadarBgpTopAseListParamsFormatCsv RadarBgpTopAseListParamsFormat = "CSV" +) + +type RadarBgpTopAseListParamsUpdateType string + +const ( + RadarBgpTopAseListParamsUpdateTypeAnnouncement RadarBgpTopAseListParamsUpdateType = "ANNOUNCEMENT" + RadarBgpTopAseListParamsUpdateTypeWithdrawal RadarBgpTopAseListParamsUpdateType = "WITHDRAWAL" +) diff --git a/radarbgptopase_test.go b/radarbgptopase_test.go new file mode 100644 index 00000000000..c07c8907706 --- /dev/null +++ b/radarbgptopase_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpTopAseListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Tops.Ases.List(context.TODO(), cloudflare.RadarBgpTopAseListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarBgpTopAseListParamsDateRange{cloudflare.RadarBgpTopAseListParamsDateRange1d, cloudflare.RadarBgpTopAseListParamsDateRange2d, cloudflare.RadarBgpTopAseListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarBgpTopAseListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Name: cloudflare.F([]string{"string", "string", "string"}), + Prefix: cloudflare.F([]string{"string", "string", "string"}), + UpdateType: cloudflare.F([]cloudflare.RadarBgpTopAseListParamsUpdateType{cloudflare.RadarBgpTopAseListParamsUpdateTypeAnnouncement, cloudflare.RadarBgpTopAseListParamsUpdateTypeWithdrawal}), + }) + 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/radarbgptopaseprefix.go b/radarbgptopaseprefix.go new file mode 100644 index 00000000000..85c089b6d2a --- /dev/null +++ b/radarbgptopaseprefix.go @@ -0,0 +1,151 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpTopAsePrefixService 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 [NewRadarBgpTopAsePrefixService] +// method instead. +type RadarBgpTopAsePrefixService struct { + Options []option.RequestOption +} + +// NewRadarBgpTopAsePrefixService 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 NewRadarBgpTopAsePrefixService(opts ...option.RequestOption) (r *RadarBgpTopAsePrefixService) { + r = &RadarBgpTopAsePrefixService{} + r.Options = opts + return +} + +// Get the full list of autonomous systems on the global routing table ordered by +// announced prefixes count. The data comes from public BGP MRT data archives and +// updates every 2 hours. +func (r *RadarBgpTopAsePrefixService) List(ctx context.Context, query RadarBgpTopAsePrefixListParams, opts ...option.RequestOption) (res *RadarBgpTopAsePrefixListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/top/ases/prefixes" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpTopAsePrefixListResponse struct { + Result RadarBgpTopAsePrefixListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarBgpTopAsePrefixListResponseJSON `json:"-"` +} + +// radarBgpTopAsePrefixListResponseJSON contains the JSON metadata for the struct +// [RadarBgpTopAsePrefixListResponse] +type radarBgpTopAsePrefixListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAsePrefixListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAsePrefixListResponseResult struct { + ASNs []RadarBgpTopAsePrefixListResponseResultASN `json:"asns,required"` + Meta RadarBgpTopAsePrefixListResponseResultMeta `json:"meta,required"` + JSON radarBgpTopAsePrefixListResponseResultJSON `json:"-"` +} + +// radarBgpTopAsePrefixListResponseResultJSON contains the JSON metadata for the +// struct [RadarBgpTopAsePrefixListResponseResult] +type radarBgpTopAsePrefixListResponseResultJSON struct { + ASNs apijson.Field + Meta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAsePrefixListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAsePrefixListResponseResultASN struct { + ASN int64 `json:"asn,required"` + Country string `json:"country,required"` + Name string `json:"name,required"` + PfxsCount int64 `json:"pfxs_count,required"` + JSON radarBgpTopAsePrefixListResponseResultASNJSON `json:"-"` +} + +// radarBgpTopAsePrefixListResponseResultASNJSON contains the JSON metadata for the +// struct [RadarBgpTopAsePrefixListResponseResultASN] +type radarBgpTopAsePrefixListResponseResultASNJSON struct { + ASN apijson.Field + Country apijson.Field + Name apijson.Field + PfxsCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAsePrefixListResponseResultASN) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAsePrefixListResponseResultMeta struct { + DataTime string `json:"data_time,required"` + QueryTime string `json:"query_time,required"` + TotalPeers int64 `json:"total_peers,required"` + JSON radarBgpTopAsePrefixListResponseResultMetaJSON `json:"-"` +} + +// radarBgpTopAsePrefixListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarBgpTopAsePrefixListResponseResultMeta] +type radarBgpTopAsePrefixListResponseResultMetaJSON struct { + DataTime apijson.Field + QueryTime apijson.Field + TotalPeers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopAsePrefixListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopAsePrefixListParams struct { + // Alpha-2 country code. + Country param.Field[string] `query:"country"` + // Format results are returned in. + Format param.Field[RadarBgpTopAsePrefixListParamsFormat] `query:"format"` + // Maximum number of ASes to return + Limit param.Field[int64] `query:"limit"` +} + +// URLQuery serializes [RadarBgpTopAsePrefixListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpTopAsePrefixListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarBgpTopAsePrefixListParamsFormat string + +const ( + RadarBgpTopAsePrefixListParamsFormatJson RadarBgpTopAsePrefixListParamsFormat = "JSON" + RadarBgpTopAsePrefixListParamsFormatCsv RadarBgpTopAsePrefixListParamsFormat = "CSV" +) diff --git a/radarbgptopaseprefix_test.go b/radarbgptopaseprefix_test.go new file mode 100644 index 00000000000..da6437e8f40 --- /dev/null +++ b/radarbgptopaseprefix_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpTopAsePrefixListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Tops.Ases.Prefixes.List(context.TODO(), cloudflare.RadarBgpTopAsePrefixListParams{ + Country: cloudflare.F("NZ"), + Format: cloudflare.F(cloudflare.RadarBgpTopAsePrefixListParamsFormatJson), + Limit: cloudflare.F(int64(10)), + }) + 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/radarbgptopprefix.go b/radarbgptopprefix.go new file mode 100644 index 00000000000..4b6fb8fa2b6 --- /dev/null +++ b/radarbgptopprefix.go @@ -0,0 +1,205 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarBgpTopPrefixService 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 [NewRadarBgpTopPrefixService] method +// instead. +type RadarBgpTopPrefixService struct { + Options []option.RequestOption +} + +// NewRadarBgpTopPrefixService 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 NewRadarBgpTopPrefixService(opts ...option.RequestOption) (r *RadarBgpTopPrefixService) { + r = &RadarBgpTopPrefixService{} + r.Options = opts + return +} + +// Get the top network prefixes by BGP updates. Values are a percentage out of the +// total BGP updates. +func (r *RadarBgpTopPrefixService) List(ctx context.Context, query RadarBgpTopPrefixListParams, opts ...option.RequestOption) (res *RadarBgpTopPrefixListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/bgp/top/prefixes" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarBgpTopPrefixListResponse struct { + Result RadarBgpTopPrefixListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarBgpTopPrefixListResponseJSON `json:"-"` +} + +// radarBgpTopPrefixListResponseJSON contains the JSON metadata for the struct +// [RadarBgpTopPrefixListResponse] +type radarBgpTopPrefixListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopPrefixListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopPrefixListResponseResult struct { + Meta RadarBgpTopPrefixListResponseResultMeta `json:"meta,required"` + Top0 []RadarBgpTopPrefixListResponseResultTop0 `json:"top_0,required"` + JSON radarBgpTopPrefixListResponseResultJSON `json:"-"` +} + +// radarBgpTopPrefixListResponseResultJSON contains the JSON metadata for the +// struct [RadarBgpTopPrefixListResponseResult] +type radarBgpTopPrefixListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopPrefixListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopPrefixListResponseResultMeta struct { + DateRange []RadarBgpTopPrefixListResponseResultMetaDateRange `json:"dateRange,required"` + JSON radarBgpTopPrefixListResponseResultMetaJSON `json:"-"` +} + +// radarBgpTopPrefixListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarBgpTopPrefixListResponseResultMeta] +type radarBgpTopPrefixListResponseResultMetaJSON struct { + DateRange apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopPrefixListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopPrefixListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarBgpTopPrefixListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarBgpTopPrefixListResponseResultMetaDateRangeJSON contains the JSON metadata +// for the struct [RadarBgpTopPrefixListResponseResultMetaDateRange] +type radarBgpTopPrefixListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopPrefixListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopPrefixListResponseResultTop0 struct { + Prefix string `json:"prefix,required"` + Value string `json:"value,required"` + JSON radarBgpTopPrefixListResponseResultTop0JSON `json:"-"` +} + +// radarBgpTopPrefixListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarBgpTopPrefixListResponseResultTop0] +type radarBgpTopPrefixListResponseResultTop0JSON struct { + Prefix apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarBgpTopPrefixListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarBgpTopPrefixListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarBgpTopPrefixListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarBgpTopPrefixListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Array of BGP update types. + UpdateType param.Field[[]RadarBgpTopPrefixListParamsUpdateType] `query:"updateType"` +} + +// URLQuery serializes [RadarBgpTopPrefixListParams]'s query parameters as +// `url.Values`. +func (r RadarBgpTopPrefixListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarBgpTopPrefixListParamsDateRange string + +const ( + RadarBgpTopPrefixListParamsDateRange1d RadarBgpTopPrefixListParamsDateRange = "1d" + RadarBgpTopPrefixListParamsDateRange2d RadarBgpTopPrefixListParamsDateRange = "2d" + RadarBgpTopPrefixListParamsDateRange7d RadarBgpTopPrefixListParamsDateRange = "7d" + RadarBgpTopPrefixListParamsDateRange14d RadarBgpTopPrefixListParamsDateRange = "14d" + RadarBgpTopPrefixListParamsDateRange28d RadarBgpTopPrefixListParamsDateRange = "28d" + RadarBgpTopPrefixListParamsDateRange12w RadarBgpTopPrefixListParamsDateRange = "12w" + RadarBgpTopPrefixListParamsDateRange24w RadarBgpTopPrefixListParamsDateRange = "24w" + RadarBgpTopPrefixListParamsDateRange52w RadarBgpTopPrefixListParamsDateRange = "52w" + RadarBgpTopPrefixListParamsDateRange1dControl RadarBgpTopPrefixListParamsDateRange = "1dControl" + RadarBgpTopPrefixListParamsDateRange2dControl RadarBgpTopPrefixListParamsDateRange = "2dControl" + RadarBgpTopPrefixListParamsDateRange7dControl RadarBgpTopPrefixListParamsDateRange = "7dControl" + RadarBgpTopPrefixListParamsDateRange14dControl RadarBgpTopPrefixListParamsDateRange = "14dControl" + RadarBgpTopPrefixListParamsDateRange28dControl RadarBgpTopPrefixListParamsDateRange = "28dControl" + RadarBgpTopPrefixListParamsDateRange12wControl RadarBgpTopPrefixListParamsDateRange = "12wControl" + RadarBgpTopPrefixListParamsDateRange24wControl RadarBgpTopPrefixListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarBgpTopPrefixListParamsFormat string + +const ( + RadarBgpTopPrefixListParamsFormatJson RadarBgpTopPrefixListParamsFormat = "JSON" + RadarBgpTopPrefixListParamsFormatCsv RadarBgpTopPrefixListParamsFormat = "CSV" +) + +type RadarBgpTopPrefixListParamsUpdateType string + +const ( + RadarBgpTopPrefixListParamsUpdateTypeAnnouncement RadarBgpTopPrefixListParamsUpdateType = "ANNOUNCEMENT" + RadarBgpTopPrefixListParamsUpdateTypeWithdrawal RadarBgpTopPrefixListParamsUpdateType = "WITHDRAWAL" +) diff --git a/radarbgptopprefix_test.go b/radarbgptopprefix_test.go new file mode 100644 index 00000000000..27fa071dc05 --- /dev/null +++ b/radarbgptopprefix_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarBgpTopPrefixListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Bgps.Tops.Prefixes.List(context.TODO(), cloudflare.RadarBgpTopPrefixListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarBgpTopPrefixListParamsDateRange{cloudflare.RadarBgpTopPrefixListParamsDateRange1d, cloudflare.RadarBgpTopPrefixListParamsDateRange2d, cloudflare.RadarBgpTopPrefixListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarBgpTopPrefixListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Name: cloudflare.F([]string{"string", "string", "string"}), + UpdateType: cloudflare.F([]cloudflare.RadarBgpTopPrefixListParamsUpdateType{cloudflare.RadarBgpTopPrefixListParamsUpdateTypeAnnouncement, cloudflare.RadarBgpTopPrefixListParamsUpdateTypeWithdrawal}), + }) + 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/radarconnectiontampering.go b/radarconnectiontampering.go new file mode 100644 index 00000000000..240d2711cb8 --- /dev/null +++ b/radarconnectiontampering.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarConnectionTamperingService 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 +// [NewRadarConnectionTamperingService] method instead. +type RadarConnectionTamperingService struct { + Options []option.RequestOption + Summary *RadarConnectionTamperingSummaryService + TimeseriesGroups *RadarConnectionTamperingTimeseriesGroupService +} + +// NewRadarConnectionTamperingService 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 NewRadarConnectionTamperingService(opts ...option.RequestOption) (r *RadarConnectionTamperingService) { + r = &RadarConnectionTamperingService{} + r.Options = opts + r.Summary = NewRadarConnectionTamperingSummaryService(opts...) + r.TimeseriesGroups = NewRadarConnectionTamperingTimeseriesGroupService(opts...) + return +} diff --git a/radarconnectiontamperingsummary.go b/radarconnectiontamperingsummary.go new file mode 100644 index 00000000000..003ffc6e64d --- /dev/null +++ b/radarconnectiontamperingsummary.go @@ -0,0 +1,267 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarConnectionTamperingSummaryService 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 +// [NewRadarConnectionTamperingSummaryService] method instead. +type RadarConnectionTamperingSummaryService struct { + Options []option.RequestOption +} + +// NewRadarConnectionTamperingSummaryService 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 NewRadarConnectionTamperingSummaryService(opts ...option.RequestOption) (r *RadarConnectionTamperingSummaryService) { + r = &RadarConnectionTamperingSummaryService{} + r.Options = opts + return +} + +// Distribution of connection tampering types over a given time period. +func (r *RadarConnectionTamperingSummaryService) List(ctx context.Context, query RadarConnectionTamperingSummaryListParams, opts ...option.RequestOption) (res *RadarConnectionTamperingSummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/connection_tampering/summary" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarConnectionTamperingSummaryListResponse struct { + Result RadarConnectionTamperingSummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarConnectionTamperingSummaryListResponseJSON `json:"-"` +} + +// radarConnectionTamperingSummaryListResponseJSON contains the JSON metadata for +// the struct [RadarConnectionTamperingSummaryListResponse] +type radarConnectionTamperingSummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingSummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingSummaryListResponseResult struct { + Meta RadarConnectionTamperingSummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarConnectionTamperingSummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarConnectionTamperingSummaryListResponseResultJSON `json:"-"` +} + +// radarConnectionTamperingSummaryListResponseResultJSON contains the JSON metadata +// for the struct [RadarConnectionTamperingSummaryListResponseResult] +type radarConnectionTamperingSummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingSummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingSummaryListResponseResultMeta struct { + DateRange []RadarConnectionTamperingSummaryListResponseResultMetaDateRange `json:"dateRange,required"` + ConfidenceInfo RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarConnectionTamperingSummaryListResponseResultMetaJSON `json:"-"` +} + +// radarConnectionTamperingSummaryListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarConnectionTamperingSummaryListResponseResultMeta] +type radarConnectionTamperingSummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingSummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingSummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarConnectionTamperingSummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarConnectionTamperingSummaryListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarConnectionTamperingSummaryListResponseResultMetaDateRange] +type radarConnectionTamperingSummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingSummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfo] +type radarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingSummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingSummaryListResponseResultSummary0 struct { + // Connections matching signatures for tampering later in the connection, after the + // transfer of multiple data packets. + LaterInFlow string `json:"later_in_flow,required"` + // Connections that do not match any tampering signatures. + NoMatch string `json:"no_match,required"` + // Connections matching signatures for tampering after the receipt of a SYN packet + // and ACK packet, meaning the TCP connection was successfully established but the + // server did not receive any subsequent packets. + PostAck string `json:"post_ack,required"` + // Connections matching signatures for tampering after the receipt of a packet with + // PSH flag set, following connection establishment. + PostPsh string `json:"post_psh,required"` + // Connections matching signatures for tampering after the receipt of only a single + // SYN packet, and before the handshake completes. + PostSyn string `json:"post_syn,required"` + JSON radarConnectionTamperingSummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarConnectionTamperingSummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarConnectionTamperingSummaryListResponseResultSummary0] +type radarConnectionTamperingSummaryListResponseResultSummary0JSON struct { + LaterInFlow apijson.Field + NoMatch apijson.Field + PostAck apijson.Field + PostPsh apijson.Field + PostSyn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingSummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingSummaryListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarConnectionTamperingSummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarConnectionTamperingSummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarConnectionTamperingSummaryListParams]'s query +// parameters as `url.Values`. +func (r RadarConnectionTamperingSummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarConnectionTamperingSummaryListParamsDateRange string + +const ( + RadarConnectionTamperingSummaryListParamsDateRange1d RadarConnectionTamperingSummaryListParamsDateRange = "1d" + RadarConnectionTamperingSummaryListParamsDateRange2d RadarConnectionTamperingSummaryListParamsDateRange = "2d" + RadarConnectionTamperingSummaryListParamsDateRange7d RadarConnectionTamperingSummaryListParamsDateRange = "7d" + RadarConnectionTamperingSummaryListParamsDateRange14d RadarConnectionTamperingSummaryListParamsDateRange = "14d" + RadarConnectionTamperingSummaryListParamsDateRange28d RadarConnectionTamperingSummaryListParamsDateRange = "28d" + RadarConnectionTamperingSummaryListParamsDateRange12w RadarConnectionTamperingSummaryListParamsDateRange = "12w" + RadarConnectionTamperingSummaryListParamsDateRange24w RadarConnectionTamperingSummaryListParamsDateRange = "24w" + RadarConnectionTamperingSummaryListParamsDateRange52w RadarConnectionTamperingSummaryListParamsDateRange = "52w" + RadarConnectionTamperingSummaryListParamsDateRange1dControl RadarConnectionTamperingSummaryListParamsDateRange = "1dControl" + RadarConnectionTamperingSummaryListParamsDateRange2dControl RadarConnectionTamperingSummaryListParamsDateRange = "2dControl" + RadarConnectionTamperingSummaryListParamsDateRange7dControl RadarConnectionTamperingSummaryListParamsDateRange = "7dControl" + RadarConnectionTamperingSummaryListParamsDateRange14dControl RadarConnectionTamperingSummaryListParamsDateRange = "14dControl" + RadarConnectionTamperingSummaryListParamsDateRange28dControl RadarConnectionTamperingSummaryListParamsDateRange = "28dControl" + RadarConnectionTamperingSummaryListParamsDateRange12wControl RadarConnectionTamperingSummaryListParamsDateRange = "12wControl" + RadarConnectionTamperingSummaryListParamsDateRange24wControl RadarConnectionTamperingSummaryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarConnectionTamperingSummaryListParamsFormat string + +const ( + RadarConnectionTamperingSummaryListParamsFormatJson RadarConnectionTamperingSummaryListParamsFormat = "JSON" + RadarConnectionTamperingSummaryListParamsFormatCsv RadarConnectionTamperingSummaryListParamsFormat = "CSV" +) diff --git a/radarconnectiontamperingsummary_test.go b/radarconnectiontamperingsummary_test.go new file mode 100644 index 00000000000..b29906484ce --- /dev/null +++ b/radarconnectiontamperingsummary_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarConnectionTamperingSummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.ConnectionTamperings.Summary.List(context.TODO(), cloudflare.RadarConnectionTamperingSummaryListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarConnectionTamperingSummaryListParamsDateRange{cloudflare.RadarConnectionTamperingSummaryListParamsDateRange1d, cloudflare.RadarConnectionTamperingSummaryListParamsDateRange2d, cloudflare.RadarConnectionTamperingSummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarConnectionTamperingSummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarconnectiontamperingtimeseriesgroup.go b/radarconnectiontamperingtimeseriesgroup.go new file mode 100644 index 00000000000..617511a3951 --- /dev/null +++ b/radarconnectiontamperingtimeseriesgroup.go @@ -0,0 +1,292 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarConnectionTamperingTimeseriesGroupService 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 [NewRadarConnectionTamperingTimeseriesGroupService] method instead. +type RadarConnectionTamperingTimeseriesGroupService struct { + Options []option.RequestOption +} + +// NewRadarConnectionTamperingTimeseriesGroupService 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 NewRadarConnectionTamperingTimeseriesGroupService(opts ...option.RequestOption) (r *RadarConnectionTamperingTimeseriesGroupService) { + r = &RadarConnectionTamperingTimeseriesGroupService{} + r.Options = opts + return +} + +// Distribution of connection tampering types over time. +func (r *RadarConnectionTamperingTimeseriesGroupService) List(ctx context.Context, query RadarConnectionTamperingTimeseriesGroupListParams, opts ...option.RequestOption) (res *RadarConnectionTamperingTimeseriesGroupListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/connection_tampering/timeseries_groups" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarConnectionTamperingTimeseriesGroupListResponse struct { + Result RadarConnectionTamperingTimeseriesGroupListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarConnectionTamperingTimeseriesGroupListResponseJSON `json:"-"` +} + +// radarConnectionTamperingTimeseriesGroupListResponseJSON contains the JSON +// metadata for the struct [RadarConnectionTamperingTimeseriesGroupListResponse] +type radarConnectionTamperingTimeseriesGroupListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingTimeseriesGroupListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingTimeseriesGroupListResponseResult struct { + Meta RadarConnectionTamperingTimeseriesGroupListResponseResultMeta `json:"meta,required"` + Serie0 RadarConnectionTamperingTimeseriesGroupListResponseResultSerie0 `json:"serie_0,required"` + JSON radarConnectionTamperingTimeseriesGroupListResponseResultJSON `json:"-"` +} + +// radarConnectionTamperingTimeseriesGroupListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarConnectionTamperingTimeseriesGroupListResponseResult] +type radarConnectionTamperingTimeseriesGroupListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingTimeseriesGroupListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingTimeseriesGroupListResponseResultMeta struct { + AggInterval string `json:"aggInterval,required"` + DateRange []RadarConnectionTamperingTimeseriesGroupListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated time.Time `json:"lastUpdated,required" format:"date-time"` + ConfidenceInfo RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarConnectionTamperingTimeseriesGroupListResponseResultMetaJSON `json:"-"` +} + +// radarConnectionTamperingTimeseriesGroupListResponseResultMetaJSON contains the +// JSON metadata for the struct +// [RadarConnectionTamperingTimeseriesGroupListResponseResultMeta] +type radarConnectionTamperingTimeseriesGroupListResponseResultMetaJSON struct { + AggInterval apijson.Field + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingTimeseriesGroupListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingTimeseriesGroupListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarConnectionTamperingTimeseriesGroupListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarConnectionTamperingTimeseriesGroupListResponseResultMetaDateRangeJSON +// contains the JSON metadata for the struct +// [RadarConnectionTamperingTimeseriesGroupListResponseResultMetaDateRange] +type radarConnectionTamperingTimeseriesGroupListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingTimeseriesGroupListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfo struct { + Annotations []RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfo] +type radarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation] +type radarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingTimeseriesGroupListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingTimeseriesGroupListResponseResultSerie0 struct { + // Connections matching signatures for tampering later in the connection, after the + // transfer of multiple data packets. + LaterInFlow []string `json:"later_in_flow,required"` + // Connections that do not match any tampering signatures. + NoMatch []string `json:"no_match,required"` + // Connections matching signatures for tampering after the receipt of a SYN packet + // and ACK packet, meaning the TCP connection was successfully established but the + // server did not receive any subsequent packets. + PostAck []string `json:"post_ack,required"` + // Connections matching signatures for tampering after the receipt of a packet with + // PSH flag set, following connection establishment. + PostPsh []string `json:"post_psh,required"` + // Connections matching signatures for tampering after the receipt of only a single + // SYN packet, and before the handshake completes. + PostSyn []string `json:"post_syn,required"` + Timestamps []time.Time `json:"timestamps,required" format:"date-time"` + JSON radarConnectionTamperingTimeseriesGroupListResponseResultSerie0JSON `json:"-"` +} + +// radarConnectionTamperingTimeseriesGroupListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarConnectionTamperingTimeseriesGroupListResponseResultSerie0] +type radarConnectionTamperingTimeseriesGroupListResponseResultSerie0JSON struct { + LaterInFlow apijson.Field + NoMatch apijson.Field + PostAck apijson.Field + PostPsh apijson.Field + PostSyn apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarConnectionTamperingTimeseriesGroupListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarConnectionTamperingTimeseriesGroupListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarConnectionTamperingTimeseriesGroupListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarConnectionTamperingTimeseriesGroupListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarConnectionTamperingTimeseriesGroupListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarConnectionTamperingTimeseriesGroupListParams]'s query +// parameters as `url.Values`. +func (r RadarConnectionTamperingTimeseriesGroupListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarConnectionTamperingTimeseriesGroupListParamsAggInterval string + +const ( + RadarConnectionTamperingTimeseriesGroupListParamsAggInterval15m RadarConnectionTamperingTimeseriesGroupListParamsAggInterval = "15m" + RadarConnectionTamperingTimeseriesGroupListParamsAggInterval1h RadarConnectionTamperingTimeseriesGroupListParamsAggInterval = "1h" + RadarConnectionTamperingTimeseriesGroupListParamsAggInterval1d RadarConnectionTamperingTimeseriesGroupListParamsAggInterval = "1d" + RadarConnectionTamperingTimeseriesGroupListParamsAggInterval1w RadarConnectionTamperingTimeseriesGroupListParamsAggInterval = "1w" +) + +type RadarConnectionTamperingTimeseriesGroupListParamsDateRange string + +const ( + RadarConnectionTamperingTimeseriesGroupListParamsDateRange1d RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "1d" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange2d RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "2d" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange7d RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "7d" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange14d RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "14d" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange28d RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "28d" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange12w RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "12w" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange24w RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "24w" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange52w RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "52w" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange1dControl RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "1dControl" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange2dControl RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "2dControl" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange7dControl RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "7dControl" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange14dControl RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "14dControl" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange28dControl RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "28dControl" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange12wControl RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "12wControl" + RadarConnectionTamperingTimeseriesGroupListParamsDateRange24wControl RadarConnectionTamperingTimeseriesGroupListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarConnectionTamperingTimeseriesGroupListParamsFormat string + +const ( + RadarConnectionTamperingTimeseriesGroupListParamsFormatJson RadarConnectionTamperingTimeseriesGroupListParamsFormat = "JSON" + RadarConnectionTamperingTimeseriesGroupListParamsFormatCsv RadarConnectionTamperingTimeseriesGroupListParamsFormat = "CSV" +) diff --git a/radarconnectiontamperingtimeseriesgroup_test.go b/radarconnectiontamperingtimeseriesgroup_test.go new file mode 100644 index 00000000000..9c338d9de08 --- /dev/null +++ b/radarconnectiontamperingtimeseriesgroup_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarConnectionTamperingTimeseriesGroupListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.ConnectionTamperings.TimeseriesGroups.List(context.TODO(), cloudflare.RadarConnectionTamperingTimeseriesGroupListParams{ + AggInterval: cloudflare.F(cloudflare.RadarConnectionTamperingTimeseriesGroupListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarConnectionTamperingTimeseriesGroupListParamsDateRange{cloudflare.RadarConnectionTamperingTimeseriesGroupListParamsDateRange1d, cloudflare.RadarConnectionTamperingTimeseriesGroupListParamsDateRange2d, cloudflare.RadarConnectionTamperingTimeseriesGroupListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarConnectionTamperingTimeseriesGroupListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radardataset.go b/radardataset.go new file mode 100644 index 00000000000..35a68b52fa4 --- /dev/null +++ b/radardataset.go @@ -0,0 +1,166 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarDatasetService 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 [NewRadarDatasetService] method +// instead. +type RadarDatasetService struct { + Options []option.RequestOption + Downloads *RadarDatasetDownloadService +} + +// NewRadarDatasetService 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 NewRadarDatasetService(opts ...option.RequestOption) (r *RadarDatasetService) { + r = &RadarDatasetService{} + r.Options = opts + r.Downloads = NewRadarDatasetDownloadService(opts...) + return +} + +// Get the csv content of a given dataset by alias or id. When getting the content +// by alias the latest dataset is returned, optionally filtered by the latest +// available at a given date. +func (r *RadarDatasetService) Get(ctx context.Context, alias string, query RadarDatasetGetParams, opts ...option.RequestOption) (res *string, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "text/csv")}, opts...) + path := fmt.Sprintf("radar/datasets/%s", alias) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Get a list of datasets. +func (r *RadarDatasetService) List(ctx context.Context, query RadarDatasetListParams, opts ...option.RequestOption) (res *RadarDatasetListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/datasets" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarDatasetListResponse struct { + Result RadarDatasetListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarDatasetListResponseJSON `json:"-"` +} + +// radarDatasetListResponseJSON contains the JSON metadata for the struct +// [RadarDatasetListResponse] +type radarDatasetListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDatasetListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDatasetListResponseResult struct { + Datasets []RadarDatasetListResponseResultDataset `json:"datasets,required"` + JSON radarDatasetListResponseResultJSON `json:"-"` +} + +// radarDatasetListResponseResultJSON contains the JSON metadata for the struct +// [RadarDatasetListResponseResult] +type radarDatasetListResponseResultJSON struct { + Datasets apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDatasetListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDatasetListResponseResultDataset struct { + ID int64 `json:"id,required"` + Description string `json:"description,required"` + Meta interface{} `json:"meta,required"` + Tags []string `json:"tags,required"` + Title string `json:"title,required"` + Type string `json:"type,required"` + JSON radarDatasetListResponseResultDatasetJSON `json:"-"` +} + +// radarDatasetListResponseResultDatasetJSON contains the JSON metadata for the +// struct [RadarDatasetListResponseResultDataset] +type radarDatasetListResponseResultDatasetJSON struct { + ID apijson.Field + Description apijson.Field + Meta apijson.Field + Tags apijson.Field + Title apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDatasetListResponseResultDataset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDatasetGetParams struct { + // Filter dataset alias by date + Date param.Field[string] `query:"date"` +} + +// URLQuery serializes [RadarDatasetGetParams]'s query parameters as `url.Values`. +func (r RadarDatasetGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarDatasetListParams struct { + // Dataset type. + DatasetType param.Field[RadarDatasetListParamsDatasetType] `query:"datasetType"` + // Format results are returned in. + Format param.Field[RadarDatasetListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Number of objects to skip before grabbing results. + Offset param.Field[int64] `query:"offset"` +} + +// URLQuery serializes [RadarDatasetListParams]'s query parameters as `url.Values`. +func (r RadarDatasetListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Dataset type. +type RadarDatasetListParamsDatasetType string + +const ( + RadarDatasetListParamsDatasetTypeRankingBucket RadarDatasetListParamsDatasetType = "RANKING_BUCKET" + RadarDatasetListParamsDatasetTypeReport RadarDatasetListParamsDatasetType = "REPORT" +) + +// Format results are returned in. +type RadarDatasetListParamsFormat string + +const ( + RadarDatasetListParamsFormatJson RadarDatasetListParamsFormat = "JSON" + RadarDatasetListParamsFormatCsv RadarDatasetListParamsFormat = "CSV" +) diff --git a/radardataset_test.go b/radardataset_test.go new file mode 100644 index 00000000000..d3e9f8c43f0 --- /dev/null +++ b/radardataset_test.go @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarDatasetGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Datasets.Get( + context.TODO(), + "ranking_top_1000", + cloudflare.RadarDatasetGetParams{ + Date: cloudflare.F("string"), + }, + ) + 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 TestRadarDatasetListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Datasets.List(context.TODO(), cloudflare.RadarDatasetListParams{ + DatasetType: cloudflare.F(cloudflare.RadarDatasetListParamsDatasetTypeRankingBucket), + Format: cloudflare.F(cloudflare.RadarDatasetListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Offset: cloudflare.F(int64(0)), + }) + 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/radardatasetdownload.go b/radardatasetdownload.go new file mode 100644 index 00000000000..b3fed9b6e9e --- /dev/null +++ b/radardatasetdownload.go @@ -0,0 +1,123 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarDatasetDownloadService 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 [NewRadarDatasetDownloadService] +// method instead. +type RadarDatasetDownloadService struct { + Options []option.RequestOption +} + +// NewRadarDatasetDownloadService 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 NewRadarDatasetDownloadService(opts ...option.RequestOption) (r *RadarDatasetDownloadService) { + r = &RadarDatasetDownloadService{} + r.Options = opts + return +} + +// Get a url to download a single dataset. +func (r *RadarDatasetDownloadService) RadarPostDatasetDownload(ctx context.Context, params RadarDatasetDownloadRadarPostDatasetDownloadParams, opts ...option.RequestOption) (res *RadarDatasetDownloadRadarPostDatasetDownloadResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/datasets/download" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) + return +} + +type RadarDatasetDownloadRadarPostDatasetDownloadResponse struct { + Result RadarDatasetDownloadRadarPostDatasetDownloadResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarDatasetDownloadRadarPostDatasetDownloadResponseJSON `json:"-"` +} + +// radarDatasetDownloadRadarPostDatasetDownloadResponseJSON contains the JSON +// metadata for the struct [RadarDatasetDownloadRadarPostDatasetDownloadResponse] +type radarDatasetDownloadRadarPostDatasetDownloadResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDatasetDownloadRadarPostDatasetDownloadResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDatasetDownloadRadarPostDatasetDownloadResponseResult struct { + Dataset RadarDatasetDownloadRadarPostDatasetDownloadResponseResultDataset `json:"dataset,required"` + JSON radarDatasetDownloadRadarPostDatasetDownloadResponseResultJSON `json:"-"` +} + +// radarDatasetDownloadRadarPostDatasetDownloadResponseResultJSON contains the JSON +// metadata for the struct +// [RadarDatasetDownloadRadarPostDatasetDownloadResponseResult] +type radarDatasetDownloadRadarPostDatasetDownloadResponseResultJSON struct { + Dataset apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDatasetDownloadRadarPostDatasetDownloadResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDatasetDownloadRadarPostDatasetDownloadResponseResultDataset struct { + URL string `json:"url,required"` + JSON radarDatasetDownloadRadarPostDatasetDownloadResponseResultDatasetJSON `json:"-"` +} + +// radarDatasetDownloadRadarPostDatasetDownloadResponseResultDatasetJSON contains +// the JSON metadata for the struct +// [RadarDatasetDownloadRadarPostDatasetDownloadResponseResultDataset] +type radarDatasetDownloadRadarPostDatasetDownloadResponseResultDatasetJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDatasetDownloadRadarPostDatasetDownloadResponseResultDataset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDatasetDownloadRadarPostDatasetDownloadParams struct { + DatasetID param.Field[int64] `json:"datasetId,required"` + // Format results are returned in. + Format param.Field[RadarDatasetDownloadRadarPostDatasetDownloadParamsFormat] `query:"format"` +} + +func (r RadarDatasetDownloadRadarPostDatasetDownloadParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// URLQuery serializes [RadarDatasetDownloadRadarPostDatasetDownloadParams]'s query +// parameters as `url.Values`. +func (r RadarDatasetDownloadRadarPostDatasetDownloadParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarDatasetDownloadRadarPostDatasetDownloadParamsFormat string + +const ( + RadarDatasetDownloadRadarPostDatasetDownloadParamsFormatJson RadarDatasetDownloadRadarPostDatasetDownloadParamsFormat = "JSON" + RadarDatasetDownloadRadarPostDatasetDownloadParamsFormatCsv RadarDatasetDownloadRadarPostDatasetDownloadParamsFormat = "CSV" +) diff --git a/radardatasetdownload_test.go b/radardatasetdownload_test.go new file mode 100644 index 00000000000..0f251945d4c --- /dev/null +++ b/radardatasetdownload_test.go @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarDatasetDownloadRadarPostDatasetDownloadWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Datasets.Downloads.RadarPostDatasetDownload(context.TODO(), cloudflare.RadarDatasetDownloadRadarPostDatasetDownloadParams{ + DatasetID: cloudflare.F(int64(3)), + Format: cloudflare.F(cloudflare.RadarDatasetDownloadRadarPostDatasetDownloadParamsFormatJson), + }) + 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/radardns.go b/radardns.go new file mode 100644 index 00000000000..cb3bf17f7cf --- /dev/null +++ b/radardns.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarDNSService 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 [NewRadarDNSService] method instead. +type RadarDNSService struct { + Options []option.RequestOption + Tops *RadarDNSTopService +} + +// NewRadarDNSService 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 NewRadarDNSService(opts ...option.RequestOption) (r *RadarDNSService) { + r = &RadarDNSService{} + r.Options = opts + r.Tops = NewRadarDNSTopService(opts...) + return +} diff --git a/radardnstop.go b/radardnstop.go new file mode 100644 index 00000000000..8918ac8a66f --- /dev/null +++ b/radardnstop.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarDNSTopService 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 [NewRadarDNSTopService] method +// instead. +type RadarDNSTopService struct { + Options []option.RequestOption + Ases *RadarDNSTopAseService + Locations *RadarDNSTopLocationService +} + +// NewRadarDNSTopService 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 NewRadarDNSTopService(opts ...option.RequestOption) (r *RadarDNSTopService) { + r = &RadarDNSTopService{} + r.Options = opts + r.Ases = NewRadarDNSTopAseService(opts...) + r.Locations = NewRadarDNSTopLocationService(opts...) + return +} diff --git a/radardnstopase.go b/radardnstopase.go new file mode 100644 index 00000000000..d02032a6c2b --- /dev/null +++ b/radardnstopase.go @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarDNSTopAseService 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 [NewRadarDNSTopAseService] method +// instead. +type RadarDNSTopAseService struct { + Options []option.RequestOption +} + +// NewRadarDNSTopAseService 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 NewRadarDNSTopAseService(opts ...option.RequestOption) (r *RadarDNSTopAseService) { + r = &RadarDNSTopAseService{} + r.Options = opts + return +} + +// Get top autonomous systems by DNS queries made to Cloudflare's public DNS +// resolver. +func (r *RadarDNSTopAseService) List(ctx context.Context, query RadarDNSTopAseListParams, opts ...option.RequestOption) (res *RadarDNSTopAseListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/dns/top/ases" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarDNSTopAseListResponse struct { + Result RadarDNSTopAseListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarDNSTopAseListResponseJSON `json:"-"` +} + +// radarDNSTopAseListResponseJSON contains the JSON metadata for the struct +// [RadarDNSTopAseListResponse] +type radarDNSTopAseListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopAseListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopAseListResponseResult struct { + Meta RadarDNSTopAseListResponseResultMeta `json:"meta,required"` + Top0 []RadarDNSTopAseListResponseResultTop0 `json:"top_0,required"` + JSON radarDNSTopAseListResponseResultJSON `json:"-"` +} + +// radarDNSTopAseListResponseResultJSON contains the JSON metadata for the struct +// [RadarDNSTopAseListResponseResult] +type radarDNSTopAseListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopAseListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopAseListResponseResultMeta struct { + DateRange []RadarDNSTopAseListResponseResultMetaDateRange `json:"dateRange,required"` + ConfidenceInfo RadarDNSTopAseListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarDNSTopAseListResponseResultMetaJSON `json:"-"` +} + +// radarDNSTopAseListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarDNSTopAseListResponseResultMeta] +type radarDNSTopAseListResponseResultMetaJSON struct { + DateRange apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopAseListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopAseListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarDNSTopAseListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarDNSTopAseListResponseResultMetaDateRangeJSON contains the JSON metadata for +// the struct [RadarDNSTopAseListResponseResultMetaDateRange] +type radarDNSTopAseListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopAseListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopAseListResponseResultMetaConfidenceInfo struct { + Annotations []RadarDNSTopAseListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarDNSTopAseListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarDNSTopAseListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct [RadarDNSTopAseListResponseResultMetaConfidenceInfo] +type radarDNSTopAseListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopAseListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopAseListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarDNSTopAseListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarDNSTopAseListResponseResultMetaConfidenceInfoAnnotationJSON contains the +// JSON metadata for the struct +// [RadarDNSTopAseListResponseResultMetaConfidenceInfoAnnotation] +type radarDNSTopAseListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopAseListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopAseListResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarDNSTopAseListResponseResultTop0JSON `json:"-"` +} + +// radarDNSTopAseListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarDNSTopAseListResponseResultTop0] +type radarDNSTopAseListResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopAseListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopAseListParams struct { + // Array of domain names. + Domain param.Field[[]string] `query:"domain,required"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarDNSTopAseListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarDNSTopAseListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarDNSTopAseListParams]'s query parameters as +// `url.Values`. +func (r RadarDNSTopAseListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarDNSTopAseListParamsDateRange string + +const ( + RadarDNSTopAseListParamsDateRange1d RadarDNSTopAseListParamsDateRange = "1d" + RadarDNSTopAseListParamsDateRange2d RadarDNSTopAseListParamsDateRange = "2d" + RadarDNSTopAseListParamsDateRange7d RadarDNSTopAseListParamsDateRange = "7d" + RadarDNSTopAseListParamsDateRange14d RadarDNSTopAseListParamsDateRange = "14d" + RadarDNSTopAseListParamsDateRange28d RadarDNSTopAseListParamsDateRange = "28d" + RadarDNSTopAseListParamsDateRange12w RadarDNSTopAseListParamsDateRange = "12w" + RadarDNSTopAseListParamsDateRange24w RadarDNSTopAseListParamsDateRange = "24w" + RadarDNSTopAseListParamsDateRange52w RadarDNSTopAseListParamsDateRange = "52w" + RadarDNSTopAseListParamsDateRange1dControl RadarDNSTopAseListParamsDateRange = "1dControl" + RadarDNSTopAseListParamsDateRange2dControl RadarDNSTopAseListParamsDateRange = "2dControl" + RadarDNSTopAseListParamsDateRange7dControl RadarDNSTopAseListParamsDateRange = "7dControl" + RadarDNSTopAseListParamsDateRange14dControl RadarDNSTopAseListParamsDateRange = "14dControl" + RadarDNSTopAseListParamsDateRange28dControl RadarDNSTopAseListParamsDateRange = "28dControl" + RadarDNSTopAseListParamsDateRange12wControl RadarDNSTopAseListParamsDateRange = "12wControl" + RadarDNSTopAseListParamsDateRange24wControl RadarDNSTopAseListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarDNSTopAseListParamsFormat string + +const ( + RadarDNSTopAseListParamsFormatJson RadarDNSTopAseListParamsFormat = "JSON" + RadarDNSTopAseListParamsFormatCsv RadarDNSTopAseListParamsFormat = "CSV" +) diff --git a/radardnstopase_test.go b/radardnstopase_test.go new file mode 100644 index 00000000000..cf03790728b --- /dev/null +++ b/radardnstopase_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarDNSTopAseListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.DNS.Tops.Ases.List(context.TODO(), cloudflare.RadarDNSTopAseListParams{ + Domain: cloudflare.F([]string{"string", "string", "string"}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarDNSTopAseListParamsDateRange{cloudflare.RadarDNSTopAseListParamsDateRange1d, cloudflare.RadarDNSTopAseListParamsDateRange2d, cloudflare.RadarDNSTopAseListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarDNSTopAseListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radardnstoplocation.go b/radardnstoplocation.go new file mode 100644 index 00000000000..01f85a8a7f1 --- /dev/null +++ b/radardnstoplocation.go @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarDNSTopLocationService 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 [NewRadarDNSTopLocationService] +// method instead. +type RadarDNSTopLocationService struct { + Options []option.RequestOption +} + +// NewRadarDNSTopLocationService 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 NewRadarDNSTopLocationService(opts ...option.RequestOption) (r *RadarDNSTopLocationService) { + r = &RadarDNSTopLocationService{} + r.Options = opts + return +} + +// Get top locations by DNS queries made to Cloudflare's public DNS resolver. +func (r *RadarDNSTopLocationService) List(ctx context.Context, query RadarDNSTopLocationListParams, opts ...option.RequestOption) (res *RadarDNSTopLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/dns/top/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarDNSTopLocationListResponse struct { + Result RadarDNSTopLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarDNSTopLocationListResponseJSON `json:"-"` +} + +// radarDNSTopLocationListResponseJSON contains the JSON metadata for the struct +// [RadarDNSTopLocationListResponse] +type radarDNSTopLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopLocationListResponseResult struct { + Meta RadarDNSTopLocationListResponseResultMeta `json:"meta,required"` + Top0 []RadarDNSTopLocationListResponseResultTop0 `json:"top_0,required"` + JSON radarDNSTopLocationListResponseResultJSON `json:"-"` +} + +// radarDNSTopLocationListResponseResultJSON contains the JSON metadata for the +// struct [RadarDNSTopLocationListResponseResult] +type radarDNSTopLocationListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopLocationListResponseResultMeta struct { + DateRange []RadarDNSTopLocationListResponseResultMetaDateRange `json:"dateRange,required"` + ConfidenceInfo RadarDNSTopLocationListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarDNSTopLocationListResponseResultMetaJSON `json:"-"` +} + +// radarDNSTopLocationListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarDNSTopLocationListResponseResultMeta] +type radarDNSTopLocationListResponseResultMetaJSON struct { + DateRange apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopLocationListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopLocationListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarDNSTopLocationListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarDNSTopLocationListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarDNSTopLocationListResponseResultMetaDateRange] +type radarDNSTopLocationListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopLocationListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopLocationListResponseResultMetaConfidenceInfo struct { + Annotations []RadarDNSTopLocationListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarDNSTopLocationListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarDNSTopLocationListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarDNSTopLocationListResponseResultMetaConfidenceInfo] +type radarDNSTopLocationListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopLocationListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopLocationListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarDNSTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarDNSTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarDNSTopLocationListResponseResultMetaConfidenceInfoAnnotation] +type radarDNSTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopLocationListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopLocationListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarDNSTopLocationListResponseResultTop0JSON `json:"-"` +} + +// radarDNSTopLocationListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarDNSTopLocationListResponseResultTop0] +type radarDNSTopLocationListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarDNSTopLocationListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarDNSTopLocationListParams struct { + // Array of domain names. + Domain param.Field[[]string] `query:"domain,required"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarDNSTopLocationListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarDNSTopLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarDNSTopLocationListParams]'s query parameters as +// `url.Values`. +func (r RadarDNSTopLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarDNSTopLocationListParamsDateRange string + +const ( + RadarDNSTopLocationListParamsDateRange1d RadarDNSTopLocationListParamsDateRange = "1d" + RadarDNSTopLocationListParamsDateRange2d RadarDNSTopLocationListParamsDateRange = "2d" + RadarDNSTopLocationListParamsDateRange7d RadarDNSTopLocationListParamsDateRange = "7d" + RadarDNSTopLocationListParamsDateRange14d RadarDNSTopLocationListParamsDateRange = "14d" + RadarDNSTopLocationListParamsDateRange28d RadarDNSTopLocationListParamsDateRange = "28d" + RadarDNSTopLocationListParamsDateRange12w RadarDNSTopLocationListParamsDateRange = "12w" + RadarDNSTopLocationListParamsDateRange24w RadarDNSTopLocationListParamsDateRange = "24w" + RadarDNSTopLocationListParamsDateRange52w RadarDNSTopLocationListParamsDateRange = "52w" + RadarDNSTopLocationListParamsDateRange1dControl RadarDNSTopLocationListParamsDateRange = "1dControl" + RadarDNSTopLocationListParamsDateRange2dControl RadarDNSTopLocationListParamsDateRange = "2dControl" + RadarDNSTopLocationListParamsDateRange7dControl RadarDNSTopLocationListParamsDateRange = "7dControl" + RadarDNSTopLocationListParamsDateRange14dControl RadarDNSTopLocationListParamsDateRange = "14dControl" + RadarDNSTopLocationListParamsDateRange28dControl RadarDNSTopLocationListParamsDateRange = "28dControl" + RadarDNSTopLocationListParamsDateRange12wControl RadarDNSTopLocationListParamsDateRange = "12wControl" + RadarDNSTopLocationListParamsDateRange24wControl RadarDNSTopLocationListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarDNSTopLocationListParamsFormat string + +const ( + RadarDNSTopLocationListParamsFormatJson RadarDNSTopLocationListParamsFormat = "JSON" + RadarDNSTopLocationListParamsFormatCsv RadarDNSTopLocationListParamsFormat = "CSV" +) diff --git a/radardnstoplocation_test.go b/radardnstoplocation_test.go new file mode 100644 index 00000000000..5e54c2fc2dd --- /dev/null +++ b/radardnstoplocation_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarDNSTopLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.DNS.Tops.Locations.List(context.TODO(), cloudflare.RadarDNSTopLocationListParams{ + Domain: cloudflare.F([]string{"string", "string", "string"}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarDNSTopLocationListParamsDateRange{cloudflare.RadarDNSTopLocationListParamsDateRange1d, cloudflare.RadarDNSTopLocationListParamsDateRange2d, cloudflare.RadarDNSTopLocationListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarDNSTopLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaremail.go b/radaremail.go new file mode 100644 index 00000000000..ad7c62549ac --- /dev/null +++ b/radaremail.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailService 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 [NewRadarEmailService] method instead. +type RadarEmailService struct { + Options []option.RequestOption + Security *RadarEmailSecurityService +} + +// NewRadarEmailService 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 NewRadarEmailService(opts ...option.RequestOption) (r *RadarEmailService) { + r = &RadarEmailService{} + r.Options = opts + r.Security = NewRadarEmailSecurityService(opts...) + return +} diff --git a/radaremailsecurity.go b/radaremailsecurity.go new file mode 100644 index 00000000000..790fc9aa9e5 --- /dev/null +++ b/radaremailsecurity.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityService 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 [NewRadarEmailSecurityService] method +// instead. +type RadarEmailSecurityService struct { + Options []option.RequestOption + ArcSummary *RadarEmailSecurityArcSummaryService + DkimSummary *RadarEmailSecurityDkimSummaryService + DmarcSummary *RadarEmailSecurityDmarcSummaryService + MaliciousSummary *RadarEmailSecurityMaliciousSummaryService + SpamSummary *RadarEmailSecuritySpamSummaryService + SpfSummary *RadarEmailSecuritySpfSummaryService + ThreatCategorySummary *RadarEmailSecurityThreatCategorySummaryService + ArcTimeseries *RadarEmailSecurityArcTimeseryService + DkimTimeseries *RadarEmailSecurityDkimTimeseryService + DmarcTimeseries *RadarEmailSecurityDmarcTimeseryService + MaliciousTimeseries *RadarEmailSecurityMaliciousTimeseryService + SpamTimeseries *RadarEmailSecuritySpamTimeseryService + SpfTimeseries *RadarEmailSecuritySpfTimeseryService + TmeseriesGroups *RadarEmailSecurityTmeseriesGroupService + Top *RadarEmailSecurityTopService +} + +// NewRadarEmailSecurityService 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 NewRadarEmailSecurityService(opts ...option.RequestOption) (r *RadarEmailSecurityService) { + r = &RadarEmailSecurityService{} + r.Options = opts + r.ArcSummary = NewRadarEmailSecurityArcSummaryService(opts...) + r.DkimSummary = NewRadarEmailSecurityDkimSummaryService(opts...) + r.DmarcSummary = NewRadarEmailSecurityDmarcSummaryService(opts...) + r.MaliciousSummary = NewRadarEmailSecurityMaliciousSummaryService(opts...) + r.SpamSummary = NewRadarEmailSecuritySpamSummaryService(opts...) + r.SpfSummary = NewRadarEmailSecuritySpfSummaryService(opts...) + r.ThreatCategorySummary = NewRadarEmailSecurityThreatCategorySummaryService(opts...) + r.ArcTimeseries = NewRadarEmailSecurityArcTimeseryService(opts...) + r.DkimTimeseries = NewRadarEmailSecurityDkimTimeseryService(opts...) + r.DmarcTimeseries = NewRadarEmailSecurityDmarcTimeseryService(opts...) + r.MaliciousTimeseries = NewRadarEmailSecurityMaliciousTimeseryService(opts...) + r.SpamTimeseries = NewRadarEmailSecuritySpamTimeseryService(opts...) + r.SpfTimeseries = NewRadarEmailSecuritySpfTimeseryService(opts...) + r.TmeseriesGroups = NewRadarEmailSecurityTmeseriesGroupService(opts...) + r.Top = NewRadarEmailSecurityTopService(opts...) + return +} diff --git a/radaremailsecurityarcsummary.go b/radaremailsecurityarcsummary.go new file mode 100644 index 00000000000..097aa9d6970 --- /dev/null +++ b/radaremailsecurityarcsummary.go @@ -0,0 +1,286 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityArcSummaryService 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 +// [NewRadarEmailSecurityArcSummaryService] method instead. +type RadarEmailSecurityArcSummaryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityArcSummaryService 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 NewRadarEmailSecurityArcSummaryService(opts ...option.RequestOption) (r *RadarEmailSecurityArcSummaryService) { + r = &RadarEmailSecurityArcSummaryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per ARC validation. +func (r *RadarEmailSecurityArcSummaryService) List(ctx context.Context, query RadarEmailSecurityArcSummaryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityArcSummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/summary/arc" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityArcSummaryListResponse struct { + Result RadarEmailSecurityArcSummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityArcSummaryListResponseJSON `json:"-"` +} + +// radarEmailSecurityArcSummaryListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityArcSummaryListResponse] +type radarEmailSecurityArcSummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcSummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcSummaryListResponseResult struct { + Meta RadarEmailSecurityArcSummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarEmailSecurityArcSummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarEmailSecurityArcSummaryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityArcSummaryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityArcSummaryListResponseResult] +type radarEmailSecurityArcSummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcSummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcSummaryListResponseResultMeta struct { + DateRange []RadarEmailSecurityArcSummaryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityArcSummaryListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityArcSummaryListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecurityArcSummaryListResponseResultMeta] +type radarEmailSecurityArcSummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcSummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcSummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityArcSummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityArcSummaryListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityArcSummaryListResponseResultMetaDateRange] +type radarEmailSecurityArcSummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcSummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfo] +type radarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcSummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcSummaryListResponseResultSummary0 struct { + Fail string `json:"FAIL,required"` + None string `json:"NONE,required"` + Pass string `json:"PASS,required"` + JSON radarEmailSecurityArcSummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarEmailSecurityArcSummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityArcSummaryListResponseResultSummary0] +type radarEmailSecurityArcSummaryListResponseResultSummary0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcSummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcSummaryListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityArcSummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityArcSummaryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityArcSummaryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityArcSummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityArcSummaryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityArcSummaryListParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecurityArcSummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecurityArcSummaryListParamsDateRange string + +const ( + RadarEmailSecurityArcSummaryListParamsDateRange1d RadarEmailSecurityArcSummaryListParamsDateRange = "1d" + RadarEmailSecurityArcSummaryListParamsDateRange2d RadarEmailSecurityArcSummaryListParamsDateRange = "2d" + RadarEmailSecurityArcSummaryListParamsDateRange7d RadarEmailSecurityArcSummaryListParamsDateRange = "7d" + RadarEmailSecurityArcSummaryListParamsDateRange14d RadarEmailSecurityArcSummaryListParamsDateRange = "14d" + RadarEmailSecurityArcSummaryListParamsDateRange28d RadarEmailSecurityArcSummaryListParamsDateRange = "28d" + RadarEmailSecurityArcSummaryListParamsDateRange12w RadarEmailSecurityArcSummaryListParamsDateRange = "12w" + RadarEmailSecurityArcSummaryListParamsDateRange24w RadarEmailSecurityArcSummaryListParamsDateRange = "24w" + RadarEmailSecurityArcSummaryListParamsDateRange52w RadarEmailSecurityArcSummaryListParamsDateRange = "52w" + RadarEmailSecurityArcSummaryListParamsDateRange1dControl RadarEmailSecurityArcSummaryListParamsDateRange = "1dControl" + RadarEmailSecurityArcSummaryListParamsDateRange2dControl RadarEmailSecurityArcSummaryListParamsDateRange = "2dControl" + RadarEmailSecurityArcSummaryListParamsDateRange7dControl RadarEmailSecurityArcSummaryListParamsDateRange = "7dControl" + RadarEmailSecurityArcSummaryListParamsDateRange14dControl RadarEmailSecurityArcSummaryListParamsDateRange = "14dControl" + RadarEmailSecurityArcSummaryListParamsDateRange28dControl RadarEmailSecurityArcSummaryListParamsDateRange = "28dControl" + RadarEmailSecurityArcSummaryListParamsDateRange12wControl RadarEmailSecurityArcSummaryListParamsDateRange = "12wControl" + RadarEmailSecurityArcSummaryListParamsDateRange24wControl RadarEmailSecurityArcSummaryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityArcSummaryListParamsDkim string + +const ( + RadarEmailSecurityArcSummaryListParamsDkimPass RadarEmailSecurityArcSummaryListParamsDkim = "PASS" + RadarEmailSecurityArcSummaryListParamsDkimNone RadarEmailSecurityArcSummaryListParamsDkim = "NONE" + RadarEmailSecurityArcSummaryListParamsDkimFail RadarEmailSecurityArcSummaryListParamsDkim = "FAIL" +) + +type RadarEmailSecurityArcSummaryListParamsDmarc string + +const ( + RadarEmailSecurityArcSummaryListParamsDmarcPass RadarEmailSecurityArcSummaryListParamsDmarc = "PASS" + RadarEmailSecurityArcSummaryListParamsDmarcNone RadarEmailSecurityArcSummaryListParamsDmarc = "NONE" + RadarEmailSecurityArcSummaryListParamsDmarcFail RadarEmailSecurityArcSummaryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityArcSummaryListParamsFormat string + +const ( + RadarEmailSecurityArcSummaryListParamsFormatJson RadarEmailSecurityArcSummaryListParamsFormat = "JSON" + RadarEmailSecurityArcSummaryListParamsFormatCsv RadarEmailSecurityArcSummaryListParamsFormat = "CSV" +) + +type RadarEmailSecurityArcSummaryListParamsSpf string + +const ( + RadarEmailSecurityArcSummaryListParamsSpfPass RadarEmailSecurityArcSummaryListParamsSpf = "PASS" + RadarEmailSecurityArcSummaryListParamsSpfNone RadarEmailSecurityArcSummaryListParamsSpf = "NONE" + RadarEmailSecurityArcSummaryListParamsSpfFail RadarEmailSecurityArcSummaryListParamsSpf = "FAIL" +) diff --git a/radaremailsecurityarcsummary_test.go b/radaremailsecurityarcsummary_test.go new file mode 100644 index 00000000000..b2d26786125 --- /dev/null +++ b/radaremailsecurityarcsummary_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityArcSummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.ArcSummary.List(context.TODO(), cloudflare.RadarEmailSecurityArcSummaryListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityArcSummaryListParamsDateRange{cloudflare.RadarEmailSecurityArcSummaryListParamsDateRange1d, cloudflare.RadarEmailSecurityArcSummaryListParamsDateRange2d, cloudflare.RadarEmailSecurityArcSummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityArcSummaryListParamsDkim{cloudflare.RadarEmailSecurityArcSummaryListParamsDkimPass, cloudflare.RadarEmailSecurityArcSummaryListParamsDkimNone, cloudflare.RadarEmailSecurityArcSummaryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityArcSummaryListParamsDmarc{cloudflare.RadarEmailSecurityArcSummaryListParamsDmarcPass, cloudflare.RadarEmailSecurityArcSummaryListParamsDmarcNone, cloudflare.RadarEmailSecurityArcSummaryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityArcSummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityArcSummaryListParamsSpf{cloudflare.RadarEmailSecurityArcSummaryListParamsSpfPass, cloudflare.RadarEmailSecurityArcSummaryListParamsSpfNone, cloudflare.RadarEmailSecurityArcSummaryListParamsSpfFail}), + }) + 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/radaremailsecurityarctimesery.go b/radaremailsecurityarctimesery.go new file mode 100644 index 00000000000..b71e6f15b1f --- /dev/null +++ b/radaremailsecurityarctimesery.go @@ -0,0 +1,207 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityArcTimeseryService 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 +// [NewRadarEmailSecurityArcTimeseryService] method instead. +type RadarEmailSecurityArcTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityArcTimeseryService 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 NewRadarEmailSecurityArcTimeseryService(opts ...option.RequestOption) (r *RadarEmailSecurityArcTimeseryService) { + r = &RadarEmailSecurityArcTimeseryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per Arc validation over time. +func (r *RadarEmailSecurityArcTimeseryService) List(ctx context.Context, query RadarEmailSecurityArcTimeseryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityArcTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/timeseries_groups/arc" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityArcTimeseryListResponse struct { + Result RadarEmailSecurityArcTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityArcTimeseryListResponseJSON `json:"-"` +} + +// radarEmailSecurityArcTimeseryListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityArcTimeseryListResponse] +type radarEmailSecurityArcTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcTimeseryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityArcTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityArcTimeseryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityArcTimeseryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityArcTimeseryListResponseResult] +type radarEmailSecurityArcTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcTimeseryListResponseResultSerie0 struct { + Fail []string `json:"FAIL,required"` + None []string `json:"NONE,required"` + Pass []string `json:"PASS,required"` + JSON radarEmailSecurityArcTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarEmailSecurityArcTimeseryListResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityArcTimeseryListResponseResultSerie0] +type radarEmailSecurityArcTimeseryListResponseResultSerie0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityArcTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityArcTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityArcTimeseryListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityArcTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityArcTimeseryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityArcTimeseryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityArcTimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityArcTimeseryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityArcTimeseryListParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecurityArcTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityArcTimeseryListParamsAggInterval string + +const ( + RadarEmailSecurityArcTimeseryListParamsAggInterval15m RadarEmailSecurityArcTimeseryListParamsAggInterval = "15m" + RadarEmailSecurityArcTimeseryListParamsAggInterval1h RadarEmailSecurityArcTimeseryListParamsAggInterval = "1h" + RadarEmailSecurityArcTimeseryListParamsAggInterval1d RadarEmailSecurityArcTimeseryListParamsAggInterval = "1d" + RadarEmailSecurityArcTimeseryListParamsAggInterval1w RadarEmailSecurityArcTimeseryListParamsAggInterval = "1w" +) + +type RadarEmailSecurityArcTimeseryListParamsDateRange string + +const ( + RadarEmailSecurityArcTimeseryListParamsDateRange1d RadarEmailSecurityArcTimeseryListParamsDateRange = "1d" + RadarEmailSecurityArcTimeseryListParamsDateRange2d RadarEmailSecurityArcTimeseryListParamsDateRange = "2d" + RadarEmailSecurityArcTimeseryListParamsDateRange7d RadarEmailSecurityArcTimeseryListParamsDateRange = "7d" + RadarEmailSecurityArcTimeseryListParamsDateRange14d RadarEmailSecurityArcTimeseryListParamsDateRange = "14d" + RadarEmailSecurityArcTimeseryListParamsDateRange28d RadarEmailSecurityArcTimeseryListParamsDateRange = "28d" + RadarEmailSecurityArcTimeseryListParamsDateRange12w RadarEmailSecurityArcTimeseryListParamsDateRange = "12w" + RadarEmailSecurityArcTimeseryListParamsDateRange24w RadarEmailSecurityArcTimeseryListParamsDateRange = "24w" + RadarEmailSecurityArcTimeseryListParamsDateRange52w RadarEmailSecurityArcTimeseryListParamsDateRange = "52w" + RadarEmailSecurityArcTimeseryListParamsDateRange1dControl RadarEmailSecurityArcTimeseryListParamsDateRange = "1dControl" + RadarEmailSecurityArcTimeseryListParamsDateRange2dControl RadarEmailSecurityArcTimeseryListParamsDateRange = "2dControl" + RadarEmailSecurityArcTimeseryListParamsDateRange7dControl RadarEmailSecurityArcTimeseryListParamsDateRange = "7dControl" + RadarEmailSecurityArcTimeseryListParamsDateRange14dControl RadarEmailSecurityArcTimeseryListParamsDateRange = "14dControl" + RadarEmailSecurityArcTimeseryListParamsDateRange28dControl RadarEmailSecurityArcTimeseryListParamsDateRange = "28dControl" + RadarEmailSecurityArcTimeseryListParamsDateRange12wControl RadarEmailSecurityArcTimeseryListParamsDateRange = "12wControl" + RadarEmailSecurityArcTimeseryListParamsDateRange24wControl RadarEmailSecurityArcTimeseryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityArcTimeseryListParamsDkim string + +const ( + RadarEmailSecurityArcTimeseryListParamsDkimPass RadarEmailSecurityArcTimeseryListParamsDkim = "PASS" + RadarEmailSecurityArcTimeseryListParamsDkimNone RadarEmailSecurityArcTimeseryListParamsDkim = "NONE" + RadarEmailSecurityArcTimeseryListParamsDkimFail RadarEmailSecurityArcTimeseryListParamsDkim = "FAIL" +) + +type RadarEmailSecurityArcTimeseryListParamsDmarc string + +const ( + RadarEmailSecurityArcTimeseryListParamsDmarcPass RadarEmailSecurityArcTimeseryListParamsDmarc = "PASS" + RadarEmailSecurityArcTimeseryListParamsDmarcNone RadarEmailSecurityArcTimeseryListParamsDmarc = "NONE" + RadarEmailSecurityArcTimeseryListParamsDmarcFail RadarEmailSecurityArcTimeseryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityArcTimeseryListParamsFormat string + +const ( + RadarEmailSecurityArcTimeseryListParamsFormatJson RadarEmailSecurityArcTimeseryListParamsFormat = "JSON" + RadarEmailSecurityArcTimeseryListParamsFormatCsv RadarEmailSecurityArcTimeseryListParamsFormat = "CSV" +) + +type RadarEmailSecurityArcTimeseryListParamsSpf string + +const ( + RadarEmailSecurityArcTimeseryListParamsSpfPass RadarEmailSecurityArcTimeseryListParamsSpf = "PASS" + RadarEmailSecurityArcTimeseryListParamsSpfNone RadarEmailSecurityArcTimeseryListParamsSpf = "NONE" + RadarEmailSecurityArcTimeseryListParamsSpfFail RadarEmailSecurityArcTimeseryListParamsSpf = "FAIL" +) diff --git a/radaremailsecurityarctimesery_test.go b/radaremailsecurityarctimesery_test.go new file mode 100644 index 00000000000..15a4184a701 --- /dev/null +++ b/radaremailsecurityarctimesery_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityArcTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.ArcTimeseries.List(context.TODO(), cloudflare.RadarEmailSecurityArcTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityArcTimeseryListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityArcTimeseryListParamsDateRange{cloudflare.RadarEmailSecurityArcTimeseryListParamsDateRange1d, cloudflare.RadarEmailSecurityArcTimeseryListParamsDateRange2d, cloudflare.RadarEmailSecurityArcTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityArcTimeseryListParamsDkim{cloudflare.RadarEmailSecurityArcTimeseryListParamsDkimPass, cloudflare.RadarEmailSecurityArcTimeseryListParamsDkimNone, cloudflare.RadarEmailSecurityArcTimeseryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityArcTimeseryListParamsDmarc{cloudflare.RadarEmailSecurityArcTimeseryListParamsDmarcPass, cloudflare.RadarEmailSecurityArcTimeseryListParamsDmarcNone, cloudflare.RadarEmailSecurityArcTimeseryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityArcTimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityArcTimeseryListParamsSpf{cloudflare.RadarEmailSecurityArcTimeseryListParamsSpfPass, cloudflare.RadarEmailSecurityArcTimeseryListParamsSpfNone, cloudflare.RadarEmailSecurityArcTimeseryListParamsSpfFail}), + }) + 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/radaremailsecuritydkimsummary.go b/radaremailsecuritydkimsummary.go new file mode 100644 index 00000000000..f651ce93ad4 --- /dev/null +++ b/radaremailsecuritydkimsummary.go @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityDkimSummaryService 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 +// [NewRadarEmailSecurityDkimSummaryService] method instead. +type RadarEmailSecurityDkimSummaryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityDkimSummaryService 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 NewRadarEmailSecurityDkimSummaryService(opts ...option.RequestOption) (r *RadarEmailSecurityDkimSummaryService) { + r = &RadarEmailSecurityDkimSummaryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per DKIM validation. +func (r *RadarEmailSecurityDkimSummaryService) List(ctx context.Context, query RadarEmailSecurityDkimSummaryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityDkimSummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/summary/dkim" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityDkimSummaryListResponse struct { + Result RadarEmailSecurityDkimSummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityDkimSummaryListResponseJSON `json:"-"` +} + +// radarEmailSecurityDkimSummaryListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityDkimSummaryListResponse] +type radarEmailSecurityDkimSummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimSummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimSummaryListResponseResult struct { + Meta RadarEmailSecurityDkimSummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarEmailSecurityDkimSummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarEmailSecurityDkimSummaryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityDkimSummaryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityDkimSummaryListResponseResult] +type radarEmailSecurityDkimSummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimSummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimSummaryListResponseResultMeta struct { + DateRange []RadarEmailSecurityDkimSummaryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityDkimSummaryListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityDkimSummaryListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecurityDkimSummaryListResponseResultMeta] +type radarEmailSecurityDkimSummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimSummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimSummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityDkimSummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityDkimSummaryListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityDkimSummaryListResponseResultMetaDateRange] +type radarEmailSecurityDkimSummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimSummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfo] +type radarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimSummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimSummaryListResponseResultSummary0 struct { + Fail string `json:"FAIL,required"` + None string `json:"NONE,required"` + Pass string `json:"PASS,required"` + JSON radarEmailSecurityDkimSummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarEmailSecurityDkimSummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityDkimSummaryListResponseResultSummary0] +type radarEmailSecurityDkimSummaryListResponseResultSummary0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimSummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimSummaryListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityDkimSummaryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityDkimSummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityDkimSummaryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityDkimSummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityDkimSummaryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityDkimSummaryListParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecurityDkimSummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecurityDkimSummaryListParamsArc string + +const ( + RadarEmailSecurityDkimSummaryListParamsArcPass RadarEmailSecurityDkimSummaryListParamsArc = "PASS" + RadarEmailSecurityDkimSummaryListParamsArcNone RadarEmailSecurityDkimSummaryListParamsArc = "NONE" + RadarEmailSecurityDkimSummaryListParamsArcFail RadarEmailSecurityDkimSummaryListParamsArc = "FAIL" +) + +type RadarEmailSecurityDkimSummaryListParamsDateRange string + +const ( + RadarEmailSecurityDkimSummaryListParamsDateRange1d RadarEmailSecurityDkimSummaryListParamsDateRange = "1d" + RadarEmailSecurityDkimSummaryListParamsDateRange2d RadarEmailSecurityDkimSummaryListParamsDateRange = "2d" + RadarEmailSecurityDkimSummaryListParamsDateRange7d RadarEmailSecurityDkimSummaryListParamsDateRange = "7d" + RadarEmailSecurityDkimSummaryListParamsDateRange14d RadarEmailSecurityDkimSummaryListParamsDateRange = "14d" + RadarEmailSecurityDkimSummaryListParamsDateRange28d RadarEmailSecurityDkimSummaryListParamsDateRange = "28d" + RadarEmailSecurityDkimSummaryListParamsDateRange12w RadarEmailSecurityDkimSummaryListParamsDateRange = "12w" + RadarEmailSecurityDkimSummaryListParamsDateRange24w RadarEmailSecurityDkimSummaryListParamsDateRange = "24w" + RadarEmailSecurityDkimSummaryListParamsDateRange52w RadarEmailSecurityDkimSummaryListParamsDateRange = "52w" + RadarEmailSecurityDkimSummaryListParamsDateRange1dControl RadarEmailSecurityDkimSummaryListParamsDateRange = "1dControl" + RadarEmailSecurityDkimSummaryListParamsDateRange2dControl RadarEmailSecurityDkimSummaryListParamsDateRange = "2dControl" + RadarEmailSecurityDkimSummaryListParamsDateRange7dControl RadarEmailSecurityDkimSummaryListParamsDateRange = "7dControl" + RadarEmailSecurityDkimSummaryListParamsDateRange14dControl RadarEmailSecurityDkimSummaryListParamsDateRange = "14dControl" + RadarEmailSecurityDkimSummaryListParamsDateRange28dControl RadarEmailSecurityDkimSummaryListParamsDateRange = "28dControl" + RadarEmailSecurityDkimSummaryListParamsDateRange12wControl RadarEmailSecurityDkimSummaryListParamsDateRange = "12wControl" + RadarEmailSecurityDkimSummaryListParamsDateRange24wControl RadarEmailSecurityDkimSummaryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityDkimSummaryListParamsDmarc string + +const ( + RadarEmailSecurityDkimSummaryListParamsDmarcPass RadarEmailSecurityDkimSummaryListParamsDmarc = "PASS" + RadarEmailSecurityDkimSummaryListParamsDmarcNone RadarEmailSecurityDkimSummaryListParamsDmarc = "NONE" + RadarEmailSecurityDkimSummaryListParamsDmarcFail RadarEmailSecurityDkimSummaryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityDkimSummaryListParamsFormat string + +const ( + RadarEmailSecurityDkimSummaryListParamsFormatJson RadarEmailSecurityDkimSummaryListParamsFormat = "JSON" + RadarEmailSecurityDkimSummaryListParamsFormatCsv RadarEmailSecurityDkimSummaryListParamsFormat = "CSV" +) + +type RadarEmailSecurityDkimSummaryListParamsSpf string + +const ( + RadarEmailSecurityDkimSummaryListParamsSpfPass RadarEmailSecurityDkimSummaryListParamsSpf = "PASS" + RadarEmailSecurityDkimSummaryListParamsSpfNone RadarEmailSecurityDkimSummaryListParamsSpf = "NONE" + RadarEmailSecurityDkimSummaryListParamsSpfFail RadarEmailSecurityDkimSummaryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritydkimsummary_test.go b/radaremailsecuritydkimsummary_test.go new file mode 100644 index 00000000000..dc892374300 --- /dev/null +++ b/radaremailsecuritydkimsummary_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityDkimSummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.DkimSummary.List(context.TODO(), cloudflare.RadarEmailSecurityDkimSummaryListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityDkimSummaryListParamsArc{cloudflare.RadarEmailSecurityDkimSummaryListParamsArcPass, cloudflare.RadarEmailSecurityDkimSummaryListParamsArcNone, cloudflare.RadarEmailSecurityDkimSummaryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityDkimSummaryListParamsDateRange{cloudflare.RadarEmailSecurityDkimSummaryListParamsDateRange1d, cloudflare.RadarEmailSecurityDkimSummaryListParamsDateRange2d, cloudflare.RadarEmailSecurityDkimSummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityDkimSummaryListParamsDmarc{cloudflare.RadarEmailSecurityDkimSummaryListParamsDmarcPass, cloudflare.RadarEmailSecurityDkimSummaryListParamsDmarcNone, cloudflare.RadarEmailSecurityDkimSummaryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityDkimSummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityDkimSummaryListParamsSpf{cloudflare.RadarEmailSecurityDkimSummaryListParamsSpfPass, cloudflare.RadarEmailSecurityDkimSummaryListParamsSpfNone, cloudflare.RadarEmailSecurityDkimSummaryListParamsSpfFail}), + }) + 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/radaremailsecuritydkimtimesery.go b/radaremailsecuritydkimtimesery.go new file mode 100644 index 00000000000..72acf96e196 --- /dev/null +++ b/radaremailsecuritydkimtimesery.go @@ -0,0 +1,207 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityDkimTimeseryService 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 +// [NewRadarEmailSecurityDkimTimeseryService] method instead. +type RadarEmailSecurityDkimTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityDkimTimeseryService 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 NewRadarEmailSecurityDkimTimeseryService(opts ...option.RequestOption) (r *RadarEmailSecurityDkimTimeseryService) { + r = &RadarEmailSecurityDkimTimeseryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per DKIM validation over time. +func (r *RadarEmailSecurityDkimTimeseryService) List(ctx context.Context, query RadarEmailSecurityDkimTimeseryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityDkimTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/timeseries_groups/dkim" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityDkimTimeseryListResponse struct { + Result RadarEmailSecurityDkimTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityDkimTimeseryListResponseJSON `json:"-"` +} + +// radarEmailSecurityDkimTimeseryListResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecurityDkimTimeseryListResponse] +type radarEmailSecurityDkimTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimTimeseryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityDkimTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityDkimTimeseryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityDkimTimeseryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityDkimTimeseryListResponseResult] +type radarEmailSecurityDkimTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimTimeseryListResponseResultSerie0 struct { + Fail []string `json:"FAIL,required"` + None []string `json:"NONE,required"` + Pass []string `json:"PASS,required"` + JSON radarEmailSecurityDkimTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarEmailSecurityDkimTimeseryListResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityDkimTimeseryListResponseResultSerie0] +type radarEmailSecurityDkimTimeseryListResponseResultSerie0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDkimTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDkimTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityDkimTimeseryListParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityDkimTimeseryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityDkimTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityDkimTimeseryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityDkimTimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityDkimTimeseryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityDkimTimeseryListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityDkimTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityDkimTimeseryListParamsAggInterval string + +const ( + RadarEmailSecurityDkimTimeseryListParamsAggInterval15m RadarEmailSecurityDkimTimeseryListParamsAggInterval = "15m" + RadarEmailSecurityDkimTimeseryListParamsAggInterval1h RadarEmailSecurityDkimTimeseryListParamsAggInterval = "1h" + RadarEmailSecurityDkimTimeseryListParamsAggInterval1d RadarEmailSecurityDkimTimeseryListParamsAggInterval = "1d" + RadarEmailSecurityDkimTimeseryListParamsAggInterval1w RadarEmailSecurityDkimTimeseryListParamsAggInterval = "1w" +) + +type RadarEmailSecurityDkimTimeseryListParamsArc string + +const ( + RadarEmailSecurityDkimTimeseryListParamsArcPass RadarEmailSecurityDkimTimeseryListParamsArc = "PASS" + RadarEmailSecurityDkimTimeseryListParamsArcNone RadarEmailSecurityDkimTimeseryListParamsArc = "NONE" + RadarEmailSecurityDkimTimeseryListParamsArcFail RadarEmailSecurityDkimTimeseryListParamsArc = "FAIL" +) + +type RadarEmailSecurityDkimTimeseryListParamsDateRange string + +const ( + RadarEmailSecurityDkimTimeseryListParamsDateRange1d RadarEmailSecurityDkimTimeseryListParamsDateRange = "1d" + RadarEmailSecurityDkimTimeseryListParamsDateRange2d RadarEmailSecurityDkimTimeseryListParamsDateRange = "2d" + RadarEmailSecurityDkimTimeseryListParamsDateRange7d RadarEmailSecurityDkimTimeseryListParamsDateRange = "7d" + RadarEmailSecurityDkimTimeseryListParamsDateRange14d RadarEmailSecurityDkimTimeseryListParamsDateRange = "14d" + RadarEmailSecurityDkimTimeseryListParamsDateRange28d RadarEmailSecurityDkimTimeseryListParamsDateRange = "28d" + RadarEmailSecurityDkimTimeseryListParamsDateRange12w RadarEmailSecurityDkimTimeseryListParamsDateRange = "12w" + RadarEmailSecurityDkimTimeseryListParamsDateRange24w RadarEmailSecurityDkimTimeseryListParamsDateRange = "24w" + RadarEmailSecurityDkimTimeseryListParamsDateRange52w RadarEmailSecurityDkimTimeseryListParamsDateRange = "52w" + RadarEmailSecurityDkimTimeseryListParamsDateRange1dControl RadarEmailSecurityDkimTimeseryListParamsDateRange = "1dControl" + RadarEmailSecurityDkimTimeseryListParamsDateRange2dControl RadarEmailSecurityDkimTimeseryListParamsDateRange = "2dControl" + RadarEmailSecurityDkimTimeseryListParamsDateRange7dControl RadarEmailSecurityDkimTimeseryListParamsDateRange = "7dControl" + RadarEmailSecurityDkimTimeseryListParamsDateRange14dControl RadarEmailSecurityDkimTimeseryListParamsDateRange = "14dControl" + RadarEmailSecurityDkimTimeseryListParamsDateRange28dControl RadarEmailSecurityDkimTimeseryListParamsDateRange = "28dControl" + RadarEmailSecurityDkimTimeseryListParamsDateRange12wControl RadarEmailSecurityDkimTimeseryListParamsDateRange = "12wControl" + RadarEmailSecurityDkimTimeseryListParamsDateRange24wControl RadarEmailSecurityDkimTimeseryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityDkimTimeseryListParamsDmarc string + +const ( + RadarEmailSecurityDkimTimeseryListParamsDmarcPass RadarEmailSecurityDkimTimeseryListParamsDmarc = "PASS" + RadarEmailSecurityDkimTimeseryListParamsDmarcNone RadarEmailSecurityDkimTimeseryListParamsDmarc = "NONE" + RadarEmailSecurityDkimTimeseryListParamsDmarcFail RadarEmailSecurityDkimTimeseryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityDkimTimeseryListParamsFormat string + +const ( + RadarEmailSecurityDkimTimeseryListParamsFormatJson RadarEmailSecurityDkimTimeseryListParamsFormat = "JSON" + RadarEmailSecurityDkimTimeseryListParamsFormatCsv RadarEmailSecurityDkimTimeseryListParamsFormat = "CSV" +) + +type RadarEmailSecurityDkimTimeseryListParamsSpf string + +const ( + RadarEmailSecurityDkimTimeseryListParamsSpfPass RadarEmailSecurityDkimTimeseryListParamsSpf = "PASS" + RadarEmailSecurityDkimTimeseryListParamsSpfNone RadarEmailSecurityDkimTimeseryListParamsSpf = "NONE" + RadarEmailSecurityDkimTimeseryListParamsSpfFail RadarEmailSecurityDkimTimeseryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritydkimtimesery_test.go b/radaremailsecuritydkimtimesery_test.go new file mode 100644 index 00000000000..6c90785b678 --- /dev/null +++ b/radaremailsecuritydkimtimesery_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityDkimTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.DkimTimeseries.List(context.TODO(), cloudflare.RadarEmailSecurityDkimTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityDkimTimeseryListParamsAggInterval1h), + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityDkimTimeseryListParamsArc{cloudflare.RadarEmailSecurityDkimTimeseryListParamsArcPass, cloudflare.RadarEmailSecurityDkimTimeseryListParamsArcNone, cloudflare.RadarEmailSecurityDkimTimeseryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityDkimTimeseryListParamsDateRange{cloudflare.RadarEmailSecurityDkimTimeseryListParamsDateRange1d, cloudflare.RadarEmailSecurityDkimTimeseryListParamsDateRange2d, cloudflare.RadarEmailSecurityDkimTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityDkimTimeseryListParamsDmarc{cloudflare.RadarEmailSecurityDkimTimeseryListParamsDmarcPass, cloudflare.RadarEmailSecurityDkimTimeseryListParamsDmarcNone, cloudflare.RadarEmailSecurityDkimTimeseryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityDkimTimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityDkimTimeseryListParamsSpf{cloudflare.RadarEmailSecurityDkimTimeseryListParamsSpfPass, cloudflare.RadarEmailSecurityDkimTimeseryListParamsSpfNone, cloudflare.RadarEmailSecurityDkimTimeseryListParamsSpfFail}), + }) + 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/radaremailsecuritydmarcsummary.go b/radaremailsecuritydmarcsummary.go new file mode 100644 index 00000000000..5029ee4b19b --- /dev/null +++ b/radaremailsecuritydmarcsummary.go @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityDmarcSummaryService 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 +// [NewRadarEmailSecurityDmarcSummaryService] method instead. +type RadarEmailSecurityDmarcSummaryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityDmarcSummaryService 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 NewRadarEmailSecurityDmarcSummaryService(opts ...option.RequestOption) (r *RadarEmailSecurityDmarcSummaryService) { + r = &RadarEmailSecurityDmarcSummaryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per DMARC validation. +func (r *RadarEmailSecurityDmarcSummaryService) List(ctx context.Context, query RadarEmailSecurityDmarcSummaryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityDmarcSummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/summary/dmarc" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityDmarcSummaryListResponse struct { + Result RadarEmailSecurityDmarcSummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityDmarcSummaryListResponseJSON `json:"-"` +} + +// radarEmailSecurityDmarcSummaryListResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecurityDmarcSummaryListResponse] +type radarEmailSecurityDmarcSummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcSummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcSummaryListResponseResult struct { + Meta RadarEmailSecurityDmarcSummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarEmailSecurityDmarcSummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarEmailSecurityDmarcSummaryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityDmarcSummaryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityDmarcSummaryListResponseResult] +type radarEmailSecurityDmarcSummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcSummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcSummaryListResponseResultMeta struct { + DateRange []RadarEmailSecurityDmarcSummaryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityDmarcSummaryListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityDmarcSummaryListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecurityDmarcSummaryListResponseResultMeta] +type radarEmailSecurityDmarcSummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcSummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcSummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityDmarcSummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityDmarcSummaryListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityDmarcSummaryListResponseResultMetaDateRange] +type radarEmailSecurityDmarcSummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcSummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfo] +type radarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcSummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcSummaryListResponseResultSummary0 struct { + Fail string `json:"FAIL,required"` + None string `json:"NONE,required"` + Pass string `json:"PASS,required"` + JSON radarEmailSecurityDmarcSummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarEmailSecurityDmarcSummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityDmarcSummaryListResponseResultSummary0] +type radarEmailSecurityDmarcSummaryListResponseResultSummary0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcSummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcSummaryListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityDmarcSummaryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityDmarcSummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityDmarcSummaryListParamsDkim] `query:"dkim"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityDmarcSummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityDmarcSummaryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityDmarcSummaryListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityDmarcSummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecurityDmarcSummaryListParamsArc string + +const ( + RadarEmailSecurityDmarcSummaryListParamsArcPass RadarEmailSecurityDmarcSummaryListParamsArc = "PASS" + RadarEmailSecurityDmarcSummaryListParamsArcNone RadarEmailSecurityDmarcSummaryListParamsArc = "NONE" + RadarEmailSecurityDmarcSummaryListParamsArcFail RadarEmailSecurityDmarcSummaryListParamsArc = "FAIL" +) + +type RadarEmailSecurityDmarcSummaryListParamsDateRange string + +const ( + RadarEmailSecurityDmarcSummaryListParamsDateRange1d RadarEmailSecurityDmarcSummaryListParamsDateRange = "1d" + RadarEmailSecurityDmarcSummaryListParamsDateRange2d RadarEmailSecurityDmarcSummaryListParamsDateRange = "2d" + RadarEmailSecurityDmarcSummaryListParamsDateRange7d RadarEmailSecurityDmarcSummaryListParamsDateRange = "7d" + RadarEmailSecurityDmarcSummaryListParamsDateRange14d RadarEmailSecurityDmarcSummaryListParamsDateRange = "14d" + RadarEmailSecurityDmarcSummaryListParamsDateRange28d RadarEmailSecurityDmarcSummaryListParamsDateRange = "28d" + RadarEmailSecurityDmarcSummaryListParamsDateRange12w RadarEmailSecurityDmarcSummaryListParamsDateRange = "12w" + RadarEmailSecurityDmarcSummaryListParamsDateRange24w RadarEmailSecurityDmarcSummaryListParamsDateRange = "24w" + RadarEmailSecurityDmarcSummaryListParamsDateRange52w RadarEmailSecurityDmarcSummaryListParamsDateRange = "52w" + RadarEmailSecurityDmarcSummaryListParamsDateRange1dControl RadarEmailSecurityDmarcSummaryListParamsDateRange = "1dControl" + RadarEmailSecurityDmarcSummaryListParamsDateRange2dControl RadarEmailSecurityDmarcSummaryListParamsDateRange = "2dControl" + RadarEmailSecurityDmarcSummaryListParamsDateRange7dControl RadarEmailSecurityDmarcSummaryListParamsDateRange = "7dControl" + RadarEmailSecurityDmarcSummaryListParamsDateRange14dControl RadarEmailSecurityDmarcSummaryListParamsDateRange = "14dControl" + RadarEmailSecurityDmarcSummaryListParamsDateRange28dControl RadarEmailSecurityDmarcSummaryListParamsDateRange = "28dControl" + RadarEmailSecurityDmarcSummaryListParamsDateRange12wControl RadarEmailSecurityDmarcSummaryListParamsDateRange = "12wControl" + RadarEmailSecurityDmarcSummaryListParamsDateRange24wControl RadarEmailSecurityDmarcSummaryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityDmarcSummaryListParamsDkim string + +const ( + RadarEmailSecurityDmarcSummaryListParamsDkimPass RadarEmailSecurityDmarcSummaryListParamsDkim = "PASS" + RadarEmailSecurityDmarcSummaryListParamsDkimNone RadarEmailSecurityDmarcSummaryListParamsDkim = "NONE" + RadarEmailSecurityDmarcSummaryListParamsDkimFail RadarEmailSecurityDmarcSummaryListParamsDkim = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityDmarcSummaryListParamsFormat string + +const ( + RadarEmailSecurityDmarcSummaryListParamsFormatJson RadarEmailSecurityDmarcSummaryListParamsFormat = "JSON" + RadarEmailSecurityDmarcSummaryListParamsFormatCsv RadarEmailSecurityDmarcSummaryListParamsFormat = "CSV" +) + +type RadarEmailSecurityDmarcSummaryListParamsSpf string + +const ( + RadarEmailSecurityDmarcSummaryListParamsSpfPass RadarEmailSecurityDmarcSummaryListParamsSpf = "PASS" + RadarEmailSecurityDmarcSummaryListParamsSpfNone RadarEmailSecurityDmarcSummaryListParamsSpf = "NONE" + RadarEmailSecurityDmarcSummaryListParamsSpfFail RadarEmailSecurityDmarcSummaryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritydmarcsummary_test.go b/radaremailsecuritydmarcsummary_test.go new file mode 100644 index 00000000000..06e6ea7af19 --- /dev/null +++ b/radaremailsecuritydmarcsummary_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityDmarcSummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.DmarcSummary.List(context.TODO(), cloudflare.RadarEmailSecurityDmarcSummaryListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcSummaryListParamsArc{cloudflare.RadarEmailSecurityDmarcSummaryListParamsArcPass, cloudflare.RadarEmailSecurityDmarcSummaryListParamsArcNone, cloudflare.RadarEmailSecurityDmarcSummaryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcSummaryListParamsDateRange{cloudflare.RadarEmailSecurityDmarcSummaryListParamsDateRange1d, cloudflare.RadarEmailSecurityDmarcSummaryListParamsDateRange2d, cloudflare.RadarEmailSecurityDmarcSummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcSummaryListParamsDkim{cloudflare.RadarEmailSecurityDmarcSummaryListParamsDkimPass, cloudflare.RadarEmailSecurityDmarcSummaryListParamsDkimNone, cloudflare.RadarEmailSecurityDmarcSummaryListParamsDkimFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityDmarcSummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcSummaryListParamsSpf{cloudflare.RadarEmailSecurityDmarcSummaryListParamsSpfPass, cloudflare.RadarEmailSecurityDmarcSummaryListParamsSpfNone, cloudflare.RadarEmailSecurityDmarcSummaryListParamsSpfFail}), + }) + 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/radaremailsecuritydmarctimesery.go b/radaremailsecuritydmarctimesery.go new file mode 100644 index 00000000000..d0e7fe9606a --- /dev/null +++ b/radaremailsecuritydmarctimesery.go @@ -0,0 +1,208 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityDmarcTimeseryService 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 +// [NewRadarEmailSecurityDmarcTimeseryService] method instead. +type RadarEmailSecurityDmarcTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityDmarcTimeseryService 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 NewRadarEmailSecurityDmarcTimeseryService(opts ...option.RequestOption) (r *RadarEmailSecurityDmarcTimeseryService) { + r = &RadarEmailSecurityDmarcTimeseryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per DMARC validation over time. +func (r *RadarEmailSecurityDmarcTimeseryService) List(ctx context.Context, query RadarEmailSecurityDmarcTimeseryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityDmarcTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/timeseries_groups/dmarc" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityDmarcTimeseryListResponse struct { + Result RadarEmailSecurityDmarcTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityDmarcTimeseryListResponseJSON `json:"-"` +} + +// radarEmailSecurityDmarcTimeseryListResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecurityDmarcTimeseryListResponse] +type radarEmailSecurityDmarcTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcTimeseryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityDmarcTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityDmarcTimeseryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityDmarcTimeseryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityDmarcTimeseryListResponseResult] +type radarEmailSecurityDmarcTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcTimeseryListResponseResultSerie0 struct { + Fail []string `json:"FAIL,required"` + None []string `json:"NONE,required"` + Pass []string `json:"PASS,required"` + JSON radarEmailSecurityDmarcTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarEmailSecurityDmarcTimeseryListResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityDmarcTimeseryListResponseResultSerie0] +type radarEmailSecurityDmarcTimeseryListResponseResultSerie0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityDmarcTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityDmarcTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityDmarcTimeseryListParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityDmarcTimeseryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityDmarcTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityDmarcTimeseryListParamsDkim] `query:"dkim"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityDmarcTimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityDmarcTimeseryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityDmarcTimeseryListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityDmarcTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityDmarcTimeseryListParamsAggInterval string + +const ( + RadarEmailSecurityDmarcTimeseryListParamsAggInterval15m RadarEmailSecurityDmarcTimeseryListParamsAggInterval = "15m" + RadarEmailSecurityDmarcTimeseryListParamsAggInterval1h RadarEmailSecurityDmarcTimeseryListParamsAggInterval = "1h" + RadarEmailSecurityDmarcTimeseryListParamsAggInterval1d RadarEmailSecurityDmarcTimeseryListParamsAggInterval = "1d" + RadarEmailSecurityDmarcTimeseryListParamsAggInterval1w RadarEmailSecurityDmarcTimeseryListParamsAggInterval = "1w" +) + +type RadarEmailSecurityDmarcTimeseryListParamsArc string + +const ( + RadarEmailSecurityDmarcTimeseryListParamsArcPass RadarEmailSecurityDmarcTimeseryListParamsArc = "PASS" + RadarEmailSecurityDmarcTimeseryListParamsArcNone RadarEmailSecurityDmarcTimeseryListParamsArc = "NONE" + RadarEmailSecurityDmarcTimeseryListParamsArcFail RadarEmailSecurityDmarcTimeseryListParamsArc = "FAIL" +) + +type RadarEmailSecurityDmarcTimeseryListParamsDateRange string + +const ( + RadarEmailSecurityDmarcTimeseryListParamsDateRange1d RadarEmailSecurityDmarcTimeseryListParamsDateRange = "1d" + RadarEmailSecurityDmarcTimeseryListParamsDateRange2d RadarEmailSecurityDmarcTimeseryListParamsDateRange = "2d" + RadarEmailSecurityDmarcTimeseryListParamsDateRange7d RadarEmailSecurityDmarcTimeseryListParamsDateRange = "7d" + RadarEmailSecurityDmarcTimeseryListParamsDateRange14d RadarEmailSecurityDmarcTimeseryListParamsDateRange = "14d" + RadarEmailSecurityDmarcTimeseryListParamsDateRange28d RadarEmailSecurityDmarcTimeseryListParamsDateRange = "28d" + RadarEmailSecurityDmarcTimeseryListParamsDateRange12w RadarEmailSecurityDmarcTimeseryListParamsDateRange = "12w" + RadarEmailSecurityDmarcTimeseryListParamsDateRange24w RadarEmailSecurityDmarcTimeseryListParamsDateRange = "24w" + RadarEmailSecurityDmarcTimeseryListParamsDateRange52w RadarEmailSecurityDmarcTimeseryListParamsDateRange = "52w" + RadarEmailSecurityDmarcTimeseryListParamsDateRange1dControl RadarEmailSecurityDmarcTimeseryListParamsDateRange = "1dControl" + RadarEmailSecurityDmarcTimeseryListParamsDateRange2dControl RadarEmailSecurityDmarcTimeseryListParamsDateRange = "2dControl" + RadarEmailSecurityDmarcTimeseryListParamsDateRange7dControl RadarEmailSecurityDmarcTimeseryListParamsDateRange = "7dControl" + RadarEmailSecurityDmarcTimeseryListParamsDateRange14dControl RadarEmailSecurityDmarcTimeseryListParamsDateRange = "14dControl" + RadarEmailSecurityDmarcTimeseryListParamsDateRange28dControl RadarEmailSecurityDmarcTimeseryListParamsDateRange = "28dControl" + RadarEmailSecurityDmarcTimeseryListParamsDateRange12wControl RadarEmailSecurityDmarcTimeseryListParamsDateRange = "12wControl" + RadarEmailSecurityDmarcTimeseryListParamsDateRange24wControl RadarEmailSecurityDmarcTimeseryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityDmarcTimeseryListParamsDkim string + +const ( + RadarEmailSecurityDmarcTimeseryListParamsDkimPass RadarEmailSecurityDmarcTimeseryListParamsDkim = "PASS" + RadarEmailSecurityDmarcTimeseryListParamsDkimNone RadarEmailSecurityDmarcTimeseryListParamsDkim = "NONE" + RadarEmailSecurityDmarcTimeseryListParamsDkimFail RadarEmailSecurityDmarcTimeseryListParamsDkim = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityDmarcTimeseryListParamsFormat string + +const ( + RadarEmailSecurityDmarcTimeseryListParamsFormatJson RadarEmailSecurityDmarcTimeseryListParamsFormat = "JSON" + RadarEmailSecurityDmarcTimeseryListParamsFormatCsv RadarEmailSecurityDmarcTimeseryListParamsFormat = "CSV" +) + +type RadarEmailSecurityDmarcTimeseryListParamsSpf string + +const ( + RadarEmailSecurityDmarcTimeseryListParamsSpfPass RadarEmailSecurityDmarcTimeseryListParamsSpf = "PASS" + RadarEmailSecurityDmarcTimeseryListParamsSpfNone RadarEmailSecurityDmarcTimeseryListParamsSpf = "NONE" + RadarEmailSecurityDmarcTimeseryListParamsSpfFail RadarEmailSecurityDmarcTimeseryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritydmarctimesery_test.go b/radaremailsecuritydmarctimesery_test.go new file mode 100644 index 00000000000..69e156b2575 --- /dev/null +++ b/radaremailsecuritydmarctimesery_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityDmarcTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.DmarcTimeseries.List(context.TODO(), cloudflare.RadarEmailSecurityDmarcTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityDmarcTimeseryListParamsAggInterval1h), + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcTimeseryListParamsArc{cloudflare.RadarEmailSecurityDmarcTimeseryListParamsArcPass, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsArcNone, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDateRange{cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDateRange1d, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDateRange2d, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDkim{cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDkimPass, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDkimNone, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsDkimFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityDmarcTimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityDmarcTimeseryListParamsSpf{cloudflare.RadarEmailSecurityDmarcTimeseryListParamsSpfPass, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsSpfNone, cloudflare.RadarEmailSecurityDmarcTimeseryListParamsSpfFail}), + }) + 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/radaremailsecuritymalicioussummary.go b/radaremailsecuritymalicioussummary.go new file mode 100644 index 00000000000..8b67b2d90c5 --- /dev/null +++ b/radaremailsecuritymalicioussummary.go @@ -0,0 +1,297 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityMaliciousSummaryService 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 +// [NewRadarEmailSecurityMaliciousSummaryService] method instead. +type RadarEmailSecurityMaliciousSummaryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityMaliciousSummaryService 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 NewRadarEmailSecurityMaliciousSummaryService(opts ...option.RequestOption) (r *RadarEmailSecurityMaliciousSummaryService) { + r = &RadarEmailSecurityMaliciousSummaryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified as MALICIOUS. +func (r *RadarEmailSecurityMaliciousSummaryService) List(ctx context.Context, query RadarEmailSecurityMaliciousSummaryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityMaliciousSummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/summary/malicious" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityMaliciousSummaryListResponse struct { + Result RadarEmailSecurityMaliciousSummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityMaliciousSummaryListResponseJSON `json:"-"` +} + +// radarEmailSecurityMaliciousSummaryListResponseJSON contains the JSON metadata +// for the struct [RadarEmailSecurityMaliciousSummaryListResponse] +type radarEmailSecurityMaliciousSummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousSummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousSummaryListResponseResult struct { + Meta RadarEmailSecurityMaliciousSummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarEmailSecurityMaliciousSummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarEmailSecurityMaliciousSummaryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityMaliciousSummaryListResponseResultJSON contains the JSON +// metadata for the struct [RadarEmailSecurityMaliciousSummaryListResponseResult] +type radarEmailSecurityMaliciousSummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousSummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousSummaryListResponseResultMeta struct { + DateRange []RadarEmailSecurityMaliciousSummaryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityMaliciousSummaryListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityMaliciousSummaryListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityMaliciousSummaryListResponseResultMeta] +type radarEmailSecurityMaliciousSummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousSummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousSummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityMaliciousSummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityMaliciousSummaryListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityMaliciousSummaryListResponseResultMetaDateRange] +type radarEmailSecurityMaliciousSummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousSummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfo] +type radarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousSummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousSummaryListResponseResultSummary0 struct { + Malicious string `json:"MALICIOUS,required"` + NotMalicious string `json:"NOT_MALICIOUS,required"` + JSON radarEmailSecurityMaliciousSummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarEmailSecurityMaliciousSummaryListResponseResultSummary0JSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityMaliciousSummaryListResponseResultSummary0] +type radarEmailSecurityMaliciousSummaryListResponseResultSummary0JSON struct { + Malicious apijson.Field + NotMalicious apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousSummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousSummaryListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityMaliciousSummaryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityMaliciousSummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityMaliciousSummaryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityMaliciousSummaryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityMaliciousSummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityMaliciousSummaryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityMaliciousSummaryListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityMaliciousSummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecurityMaliciousSummaryListParamsArc string + +const ( + RadarEmailSecurityMaliciousSummaryListParamsArcPass RadarEmailSecurityMaliciousSummaryListParamsArc = "PASS" + RadarEmailSecurityMaliciousSummaryListParamsArcNone RadarEmailSecurityMaliciousSummaryListParamsArc = "NONE" + RadarEmailSecurityMaliciousSummaryListParamsArcFail RadarEmailSecurityMaliciousSummaryListParamsArc = "FAIL" +) + +type RadarEmailSecurityMaliciousSummaryListParamsDateRange string + +const ( + RadarEmailSecurityMaliciousSummaryListParamsDateRange1d RadarEmailSecurityMaliciousSummaryListParamsDateRange = "1d" + RadarEmailSecurityMaliciousSummaryListParamsDateRange2d RadarEmailSecurityMaliciousSummaryListParamsDateRange = "2d" + RadarEmailSecurityMaliciousSummaryListParamsDateRange7d RadarEmailSecurityMaliciousSummaryListParamsDateRange = "7d" + RadarEmailSecurityMaliciousSummaryListParamsDateRange14d RadarEmailSecurityMaliciousSummaryListParamsDateRange = "14d" + RadarEmailSecurityMaliciousSummaryListParamsDateRange28d RadarEmailSecurityMaliciousSummaryListParamsDateRange = "28d" + RadarEmailSecurityMaliciousSummaryListParamsDateRange12w RadarEmailSecurityMaliciousSummaryListParamsDateRange = "12w" + RadarEmailSecurityMaliciousSummaryListParamsDateRange24w RadarEmailSecurityMaliciousSummaryListParamsDateRange = "24w" + RadarEmailSecurityMaliciousSummaryListParamsDateRange52w RadarEmailSecurityMaliciousSummaryListParamsDateRange = "52w" + RadarEmailSecurityMaliciousSummaryListParamsDateRange1dControl RadarEmailSecurityMaliciousSummaryListParamsDateRange = "1dControl" + RadarEmailSecurityMaliciousSummaryListParamsDateRange2dControl RadarEmailSecurityMaliciousSummaryListParamsDateRange = "2dControl" + RadarEmailSecurityMaliciousSummaryListParamsDateRange7dControl RadarEmailSecurityMaliciousSummaryListParamsDateRange = "7dControl" + RadarEmailSecurityMaliciousSummaryListParamsDateRange14dControl RadarEmailSecurityMaliciousSummaryListParamsDateRange = "14dControl" + RadarEmailSecurityMaliciousSummaryListParamsDateRange28dControl RadarEmailSecurityMaliciousSummaryListParamsDateRange = "28dControl" + RadarEmailSecurityMaliciousSummaryListParamsDateRange12wControl RadarEmailSecurityMaliciousSummaryListParamsDateRange = "12wControl" + RadarEmailSecurityMaliciousSummaryListParamsDateRange24wControl RadarEmailSecurityMaliciousSummaryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityMaliciousSummaryListParamsDkim string + +const ( + RadarEmailSecurityMaliciousSummaryListParamsDkimPass RadarEmailSecurityMaliciousSummaryListParamsDkim = "PASS" + RadarEmailSecurityMaliciousSummaryListParamsDkimNone RadarEmailSecurityMaliciousSummaryListParamsDkim = "NONE" + RadarEmailSecurityMaliciousSummaryListParamsDkimFail RadarEmailSecurityMaliciousSummaryListParamsDkim = "FAIL" +) + +type RadarEmailSecurityMaliciousSummaryListParamsDmarc string + +const ( + RadarEmailSecurityMaliciousSummaryListParamsDmarcPass RadarEmailSecurityMaliciousSummaryListParamsDmarc = "PASS" + RadarEmailSecurityMaliciousSummaryListParamsDmarcNone RadarEmailSecurityMaliciousSummaryListParamsDmarc = "NONE" + RadarEmailSecurityMaliciousSummaryListParamsDmarcFail RadarEmailSecurityMaliciousSummaryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityMaliciousSummaryListParamsFormat string + +const ( + RadarEmailSecurityMaliciousSummaryListParamsFormatJson RadarEmailSecurityMaliciousSummaryListParamsFormat = "JSON" + RadarEmailSecurityMaliciousSummaryListParamsFormatCsv RadarEmailSecurityMaliciousSummaryListParamsFormat = "CSV" +) + +type RadarEmailSecurityMaliciousSummaryListParamsSpf string + +const ( + RadarEmailSecurityMaliciousSummaryListParamsSpfPass RadarEmailSecurityMaliciousSummaryListParamsSpf = "PASS" + RadarEmailSecurityMaliciousSummaryListParamsSpfNone RadarEmailSecurityMaliciousSummaryListParamsSpf = "NONE" + RadarEmailSecurityMaliciousSummaryListParamsSpfFail RadarEmailSecurityMaliciousSummaryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritymalicioussummary_test.go b/radaremailsecuritymalicioussummary_test.go new file mode 100644 index 00000000000..33848d87210 --- /dev/null +++ b/radaremailsecuritymalicioussummary_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityMaliciousSummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.MaliciousSummary.List(context.TODO(), cloudflare.RadarEmailSecurityMaliciousSummaryListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousSummaryListParamsArc{cloudflare.RadarEmailSecurityMaliciousSummaryListParamsArcPass, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsArcNone, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDateRange{cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDateRange1d, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDateRange2d, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDkim{cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDkimPass, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDkimNone, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDmarc{cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDmarcPass, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDmarcNone, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityMaliciousSummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousSummaryListParamsSpf{cloudflare.RadarEmailSecurityMaliciousSummaryListParamsSpfPass, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsSpfNone, cloudflare.RadarEmailSecurityMaliciousSummaryListParamsSpfFail}), + }) + 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/radaremailsecuritymalicioustimesery.go b/radaremailsecuritymalicioustimesery.go new file mode 100644 index 00000000000..a85f33a73d6 --- /dev/null +++ b/radaremailsecuritymalicioustimesery.go @@ -0,0 +1,217 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityMaliciousTimeseryService 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 +// [NewRadarEmailSecurityMaliciousTimeseryService] method instead. +type RadarEmailSecurityMaliciousTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityMaliciousTimeseryService 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 NewRadarEmailSecurityMaliciousTimeseryService(opts ...option.RequestOption) (r *RadarEmailSecurityMaliciousTimeseryService) { + r = &RadarEmailSecurityMaliciousTimeseryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified as MALICIOUS over time. +func (r *RadarEmailSecurityMaliciousTimeseryService) List(ctx context.Context, query RadarEmailSecurityMaliciousTimeseryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityMaliciousTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/timeseries_groups/malicious" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityMaliciousTimeseryListResponse struct { + Result RadarEmailSecurityMaliciousTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityMaliciousTimeseryListResponseJSON `json:"-"` +} + +// radarEmailSecurityMaliciousTimeseryListResponseJSON contains the JSON metadata +// for the struct [RadarEmailSecurityMaliciousTimeseryListResponse] +type radarEmailSecurityMaliciousTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousTimeseryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityMaliciousTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityMaliciousTimeseryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityMaliciousTimeseryListResponseResultJSON contains the JSON +// metadata for the struct [RadarEmailSecurityMaliciousTimeseryListResponseResult] +type radarEmailSecurityMaliciousTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousTimeseryListResponseResultSerie0 struct { + Malicious []string `json:"MALICIOUS,required"` + NotMalicious []string `json:"NOT_MALICIOUS,required"` + JSON radarEmailSecurityMaliciousTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarEmailSecurityMaliciousTimeseryListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityMaliciousTimeseryListResponseResultSerie0] +type radarEmailSecurityMaliciousTimeseryListResponseResultSerie0JSON struct { + Malicious apijson.Field + NotMalicious apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityMaliciousTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityMaliciousTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityMaliciousTimeseryListParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityMaliciousTimeseryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityMaliciousTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityMaliciousTimeseryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityMaliciousTimeseryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityMaliciousTimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityMaliciousTimeseryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityMaliciousTimeseryListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityMaliciousTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityMaliciousTimeseryListParamsAggInterval string + +const ( + RadarEmailSecurityMaliciousTimeseryListParamsAggInterval15m RadarEmailSecurityMaliciousTimeseryListParamsAggInterval = "15m" + RadarEmailSecurityMaliciousTimeseryListParamsAggInterval1h RadarEmailSecurityMaliciousTimeseryListParamsAggInterval = "1h" + RadarEmailSecurityMaliciousTimeseryListParamsAggInterval1d RadarEmailSecurityMaliciousTimeseryListParamsAggInterval = "1d" + RadarEmailSecurityMaliciousTimeseryListParamsAggInterval1w RadarEmailSecurityMaliciousTimeseryListParamsAggInterval = "1w" +) + +type RadarEmailSecurityMaliciousTimeseryListParamsArc string + +const ( + RadarEmailSecurityMaliciousTimeseryListParamsArcPass RadarEmailSecurityMaliciousTimeseryListParamsArc = "PASS" + RadarEmailSecurityMaliciousTimeseryListParamsArcNone RadarEmailSecurityMaliciousTimeseryListParamsArc = "NONE" + RadarEmailSecurityMaliciousTimeseryListParamsArcFail RadarEmailSecurityMaliciousTimeseryListParamsArc = "FAIL" +) + +type RadarEmailSecurityMaliciousTimeseryListParamsDateRange string + +const ( + RadarEmailSecurityMaliciousTimeseryListParamsDateRange1d RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "1d" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange2d RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "2d" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange7d RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "7d" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange14d RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "14d" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange28d RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "28d" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange12w RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "12w" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange24w RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "24w" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange52w RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "52w" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange1dControl RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "1dControl" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange2dControl RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "2dControl" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange7dControl RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "7dControl" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange14dControl RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "14dControl" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange28dControl RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "28dControl" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange12wControl RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "12wControl" + RadarEmailSecurityMaliciousTimeseryListParamsDateRange24wControl RadarEmailSecurityMaliciousTimeseryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityMaliciousTimeseryListParamsDkim string + +const ( + RadarEmailSecurityMaliciousTimeseryListParamsDkimPass RadarEmailSecurityMaliciousTimeseryListParamsDkim = "PASS" + RadarEmailSecurityMaliciousTimeseryListParamsDkimNone RadarEmailSecurityMaliciousTimeseryListParamsDkim = "NONE" + RadarEmailSecurityMaliciousTimeseryListParamsDkimFail RadarEmailSecurityMaliciousTimeseryListParamsDkim = "FAIL" +) + +type RadarEmailSecurityMaliciousTimeseryListParamsDmarc string + +const ( + RadarEmailSecurityMaliciousTimeseryListParamsDmarcPass RadarEmailSecurityMaliciousTimeseryListParamsDmarc = "PASS" + RadarEmailSecurityMaliciousTimeseryListParamsDmarcNone RadarEmailSecurityMaliciousTimeseryListParamsDmarc = "NONE" + RadarEmailSecurityMaliciousTimeseryListParamsDmarcFail RadarEmailSecurityMaliciousTimeseryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityMaliciousTimeseryListParamsFormat string + +const ( + RadarEmailSecurityMaliciousTimeseryListParamsFormatJson RadarEmailSecurityMaliciousTimeseryListParamsFormat = "JSON" + RadarEmailSecurityMaliciousTimeseryListParamsFormatCsv RadarEmailSecurityMaliciousTimeseryListParamsFormat = "CSV" +) + +type RadarEmailSecurityMaliciousTimeseryListParamsSpf string + +const ( + RadarEmailSecurityMaliciousTimeseryListParamsSpfPass RadarEmailSecurityMaliciousTimeseryListParamsSpf = "PASS" + RadarEmailSecurityMaliciousTimeseryListParamsSpfNone RadarEmailSecurityMaliciousTimeseryListParamsSpf = "NONE" + RadarEmailSecurityMaliciousTimeseryListParamsSpfFail RadarEmailSecurityMaliciousTimeseryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritymalicioustimesery_test.go b/radaremailsecuritymalicioustimesery_test.go new file mode 100644 index 00000000000..12fc2ddfa68 --- /dev/null +++ b/radaremailsecuritymalicioustimesery_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityMaliciousTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.MaliciousTimeseries.List(context.TODO(), cloudflare.RadarEmailSecurityMaliciousTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsAggInterval1h), + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsArc{cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsArcPass, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsArcNone, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDateRange{cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDateRange1d, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDateRange2d, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDkim{cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDkimPass, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDkimNone, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDmarc{cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDmarcPass, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDmarcNone, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsSpf{cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsSpfPass, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsSpfNone, cloudflare.RadarEmailSecurityMaliciousTimeseryListParamsSpfFail}), + }) + 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/radaremailsecurityspamsummary.go b/radaremailsecurityspamsummary.go new file mode 100644 index 00000000000..205eaef4bd5 --- /dev/null +++ b/radaremailsecurityspamsummary.go @@ -0,0 +1,295 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecuritySpamSummaryService 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 +// [NewRadarEmailSecuritySpamSummaryService] method instead. +type RadarEmailSecuritySpamSummaryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecuritySpamSummaryService 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 NewRadarEmailSecuritySpamSummaryService(opts ...option.RequestOption) (r *RadarEmailSecuritySpamSummaryService) { + r = &RadarEmailSecuritySpamSummaryService{} + r.Options = opts + return +} + +// Proportion of emails categorized as either spam or legitimate (non-spam). +func (r *RadarEmailSecuritySpamSummaryService) List(ctx context.Context, query RadarEmailSecuritySpamSummaryListParams, opts ...option.RequestOption) (res *RadarEmailSecuritySpamSummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/summary/spam" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecuritySpamSummaryListResponse struct { + Result RadarEmailSecuritySpamSummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecuritySpamSummaryListResponseJSON `json:"-"` +} + +// radarEmailSecuritySpamSummaryListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecuritySpamSummaryListResponse] +type radarEmailSecuritySpamSummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamSummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamSummaryListResponseResult struct { + Meta RadarEmailSecuritySpamSummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarEmailSecuritySpamSummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarEmailSecuritySpamSummaryListResponseResultJSON `json:"-"` +} + +// radarEmailSecuritySpamSummaryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecuritySpamSummaryListResponseResult] +type radarEmailSecuritySpamSummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamSummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamSummaryListResponseResultMeta struct { + DateRange []RadarEmailSecuritySpamSummaryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecuritySpamSummaryListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecuritySpamSummaryListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecuritySpamSummaryListResponseResultMeta] +type radarEmailSecuritySpamSummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamSummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamSummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecuritySpamSummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecuritySpamSummaryListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecuritySpamSummaryListResponseResultMetaDateRange] +type radarEmailSecuritySpamSummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamSummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfo] +type radarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamSummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamSummaryListResponseResultSummary0 struct { + NotSpam string `json:"NOT_SPAM,required"` + Spam string `json:"SPAM,required"` + JSON radarEmailSecuritySpamSummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarEmailSecuritySpamSummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecuritySpamSummaryListResponseResultSummary0] +type radarEmailSecuritySpamSummaryListResponseResultSummary0JSON struct { + NotSpam apijson.Field + Spam apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamSummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamSummaryListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecuritySpamSummaryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecuritySpamSummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecuritySpamSummaryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecuritySpamSummaryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecuritySpamSummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecuritySpamSummaryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecuritySpamSummaryListParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecuritySpamSummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecuritySpamSummaryListParamsArc string + +const ( + RadarEmailSecuritySpamSummaryListParamsArcPass RadarEmailSecuritySpamSummaryListParamsArc = "PASS" + RadarEmailSecuritySpamSummaryListParamsArcNone RadarEmailSecuritySpamSummaryListParamsArc = "NONE" + RadarEmailSecuritySpamSummaryListParamsArcFail RadarEmailSecuritySpamSummaryListParamsArc = "FAIL" +) + +type RadarEmailSecuritySpamSummaryListParamsDateRange string + +const ( + RadarEmailSecuritySpamSummaryListParamsDateRange1d RadarEmailSecuritySpamSummaryListParamsDateRange = "1d" + RadarEmailSecuritySpamSummaryListParamsDateRange2d RadarEmailSecuritySpamSummaryListParamsDateRange = "2d" + RadarEmailSecuritySpamSummaryListParamsDateRange7d RadarEmailSecuritySpamSummaryListParamsDateRange = "7d" + RadarEmailSecuritySpamSummaryListParamsDateRange14d RadarEmailSecuritySpamSummaryListParamsDateRange = "14d" + RadarEmailSecuritySpamSummaryListParamsDateRange28d RadarEmailSecuritySpamSummaryListParamsDateRange = "28d" + RadarEmailSecuritySpamSummaryListParamsDateRange12w RadarEmailSecuritySpamSummaryListParamsDateRange = "12w" + RadarEmailSecuritySpamSummaryListParamsDateRange24w RadarEmailSecuritySpamSummaryListParamsDateRange = "24w" + RadarEmailSecuritySpamSummaryListParamsDateRange52w RadarEmailSecuritySpamSummaryListParamsDateRange = "52w" + RadarEmailSecuritySpamSummaryListParamsDateRange1dControl RadarEmailSecuritySpamSummaryListParamsDateRange = "1dControl" + RadarEmailSecuritySpamSummaryListParamsDateRange2dControl RadarEmailSecuritySpamSummaryListParamsDateRange = "2dControl" + RadarEmailSecuritySpamSummaryListParamsDateRange7dControl RadarEmailSecuritySpamSummaryListParamsDateRange = "7dControl" + RadarEmailSecuritySpamSummaryListParamsDateRange14dControl RadarEmailSecuritySpamSummaryListParamsDateRange = "14dControl" + RadarEmailSecuritySpamSummaryListParamsDateRange28dControl RadarEmailSecuritySpamSummaryListParamsDateRange = "28dControl" + RadarEmailSecuritySpamSummaryListParamsDateRange12wControl RadarEmailSecuritySpamSummaryListParamsDateRange = "12wControl" + RadarEmailSecuritySpamSummaryListParamsDateRange24wControl RadarEmailSecuritySpamSummaryListParamsDateRange = "24wControl" +) + +type RadarEmailSecuritySpamSummaryListParamsDkim string + +const ( + RadarEmailSecuritySpamSummaryListParamsDkimPass RadarEmailSecuritySpamSummaryListParamsDkim = "PASS" + RadarEmailSecuritySpamSummaryListParamsDkimNone RadarEmailSecuritySpamSummaryListParamsDkim = "NONE" + RadarEmailSecuritySpamSummaryListParamsDkimFail RadarEmailSecuritySpamSummaryListParamsDkim = "FAIL" +) + +type RadarEmailSecuritySpamSummaryListParamsDmarc string + +const ( + RadarEmailSecuritySpamSummaryListParamsDmarcPass RadarEmailSecuritySpamSummaryListParamsDmarc = "PASS" + RadarEmailSecuritySpamSummaryListParamsDmarcNone RadarEmailSecuritySpamSummaryListParamsDmarc = "NONE" + RadarEmailSecuritySpamSummaryListParamsDmarcFail RadarEmailSecuritySpamSummaryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecuritySpamSummaryListParamsFormat string + +const ( + RadarEmailSecuritySpamSummaryListParamsFormatJson RadarEmailSecuritySpamSummaryListParamsFormat = "JSON" + RadarEmailSecuritySpamSummaryListParamsFormatCsv RadarEmailSecuritySpamSummaryListParamsFormat = "CSV" +) + +type RadarEmailSecuritySpamSummaryListParamsSpf string + +const ( + RadarEmailSecuritySpamSummaryListParamsSpfPass RadarEmailSecuritySpamSummaryListParamsSpf = "PASS" + RadarEmailSecuritySpamSummaryListParamsSpfNone RadarEmailSecuritySpamSummaryListParamsSpf = "NONE" + RadarEmailSecuritySpamSummaryListParamsSpfFail RadarEmailSecuritySpamSummaryListParamsSpf = "FAIL" +) diff --git a/radaremailsecurityspamsummary_test.go b/radaremailsecurityspamsummary_test.go new file mode 100644 index 00000000000..d1ec54bfd40 --- /dev/null +++ b/radaremailsecurityspamsummary_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecuritySpamSummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.SpamSummary.List(context.TODO(), cloudflare.RadarEmailSecuritySpamSummaryListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecuritySpamSummaryListParamsArc{cloudflare.RadarEmailSecuritySpamSummaryListParamsArcPass, cloudflare.RadarEmailSecuritySpamSummaryListParamsArcNone, cloudflare.RadarEmailSecuritySpamSummaryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecuritySpamSummaryListParamsDateRange{cloudflare.RadarEmailSecuritySpamSummaryListParamsDateRange1d, cloudflare.RadarEmailSecuritySpamSummaryListParamsDateRange2d, cloudflare.RadarEmailSecuritySpamSummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecuritySpamSummaryListParamsDkim{cloudflare.RadarEmailSecuritySpamSummaryListParamsDkimPass, cloudflare.RadarEmailSecuritySpamSummaryListParamsDkimNone, cloudflare.RadarEmailSecuritySpamSummaryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecuritySpamSummaryListParamsDmarc{cloudflare.RadarEmailSecuritySpamSummaryListParamsDmarcPass, cloudflare.RadarEmailSecuritySpamSummaryListParamsDmarcNone, cloudflare.RadarEmailSecuritySpamSummaryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecuritySpamSummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecuritySpamSummaryListParamsSpf{cloudflare.RadarEmailSecuritySpamSummaryListParamsSpfPass, cloudflare.RadarEmailSecuritySpamSummaryListParamsSpfNone, cloudflare.RadarEmailSecuritySpamSummaryListParamsSpfFail}), + }) + 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/radaremailsecurityspamtimesery.go b/radaremailsecurityspamtimesery.go new file mode 100644 index 00000000000..132d17f3e0f --- /dev/null +++ b/radaremailsecurityspamtimesery.go @@ -0,0 +1,215 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecuritySpamTimeseryService 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 +// [NewRadarEmailSecuritySpamTimeseryService] method instead. +type RadarEmailSecuritySpamTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecuritySpamTimeseryService 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 NewRadarEmailSecuritySpamTimeseryService(opts ...option.RequestOption) (r *RadarEmailSecuritySpamTimeseryService) { + r = &RadarEmailSecuritySpamTimeseryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified as SPAM over time. +func (r *RadarEmailSecuritySpamTimeseryService) List(ctx context.Context, query RadarEmailSecuritySpamTimeseryListParams, opts ...option.RequestOption) (res *RadarEmailSecuritySpamTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/timeseries_groups/spam" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecuritySpamTimeseryListResponse struct { + Result RadarEmailSecuritySpamTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecuritySpamTimeseryListResponseJSON `json:"-"` +} + +// radarEmailSecuritySpamTimeseryListResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecuritySpamTimeseryListResponse] +type radarEmailSecuritySpamTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamTimeseryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecuritySpamTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarEmailSecuritySpamTimeseryListResponseResultJSON `json:"-"` +} + +// radarEmailSecuritySpamTimeseryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecuritySpamTimeseryListResponseResult] +type radarEmailSecuritySpamTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamTimeseryListResponseResultSerie0 struct { + NotSpam []string `json:"NOT_SPAM,required"` + Spam []string `json:"SPAM,required"` + JSON radarEmailSecuritySpamTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarEmailSecuritySpamTimeseryListResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarEmailSecuritySpamTimeseryListResponseResultSerie0] +type radarEmailSecuritySpamTimeseryListResponseResultSerie0JSON struct { + NotSpam apijson.Field + Spam apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpamTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpamTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecuritySpamTimeseryListParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecuritySpamTimeseryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecuritySpamTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecuritySpamTimeseryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecuritySpamTimeseryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecuritySpamTimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecuritySpamTimeseryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecuritySpamTimeseryListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecuritySpamTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecuritySpamTimeseryListParamsAggInterval string + +const ( + RadarEmailSecuritySpamTimeseryListParamsAggInterval15m RadarEmailSecuritySpamTimeseryListParamsAggInterval = "15m" + RadarEmailSecuritySpamTimeseryListParamsAggInterval1h RadarEmailSecuritySpamTimeseryListParamsAggInterval = "1h" + RadarEmailSecuritySpamTimeseryListParamsAggInterval1d RadarEmailSecuritySpamTimeseryListParamsAggInterval = "1d" + RadarEmailSecuritySpamTimeseryListParamsAggInterval1w RadarEmailSecuritySpamTimeseryListParamsAggInterval = "1w" +) + +type RadarEmailSecuritySpamTimeseryListParamsArc string + +const ( + RadarEmailSecuritySpamTimeseryListParamsArcPass RadarEmailSecuritySpamTimeseryListParamsArc = "PASS" + RadarEmailSecuritySpamTimeseryListParamsArcNone RadarEmailSecuritySpamTimeseryListParamsArc = "NONE" + RadarEmailSecuritySpamTimeseryListParamsArcFail RadarEmailSecuritySpamTimeseryListParamsArc = "FAIL" +) + +type RadarEmailSecuritySpamTimeseryListParamsDateRange string + +const ( + RadarEmailSecuritySpamTimeseryListParamsDateRange1d RadarEmailSecuritySpamTimeseryListParamsDateRange = "1d" + RadarEmailSecuritySpamTimeseryListParamsDateRange2d RadarEmailSecuritySpamTimeseryListParamsDateRange = "2d" + RadarEmailSecuritySpamTimeseryListParamsDateRange7d RadarEmailSecuritySpamTimeseryListParamsDateRange = "7d" + RadarEmailSecuritySpamTimeseryListParamsDateRange14d RadarEmailSecuritySpamTimeseryListParamsDateRange = "14d" + RadarEmailSecuritySpamTimeseryListParamsDateRange28d RadarEmailSecuritySpamTimeseryListParamsDateRange = "28d" + RadarEmailSecuritySpamTimeseryListParamsDateRange12w RadarEmailSecuritySpamTimeseryListParamsDateRange = "12w" + RadarEmailSecuritySpamTimeseryListParamsDateRange24w RadarEmailSecuritySpamTimeseryListParamsDateRange = "24w" + RadarEmailSecuritySpamTimeseryListParamsDateRange52w RadarEmailSecuritySpamTimeseryListParamsDateRange = "52w" + RadarEmailSecuritySpamTimeseryListParamsDateRange1dControl RadarEmailSecuritySpamTimeseryListParamsDateRange = "1dControl" + RadarEmailSecuritySpamTimeseryListParamsDateRange2dControl RadarEmailSecuritySpamTimeseryListParamsDateRange = "2dControl" + RadarEmailSecuritySpamTimeseryListParamsDateRange7dControl RadarEmailSecuritySpamTimeseryListParamsDateRange = "7dControl" + RadarEmailSecuritySpamTimeseryListParamsDateRange14dControl RadarEmailSecuritySpamTimeseryListParamsDateRange = "14dControl" + RadarEmailSecuritySpamTimeseryListParamsDateRange28dControl RadarEmailSecuritySpamTimeseryListParamsDateRange = "28dControl" + RadarEmailSecuritySpamTimeseryListParamsDateRange12wControl RadarEmailSecuritySpamTimeseryListParamsDateRange = "12wControl" + RadarEmailSecuritySpamTimeseryListParamsDateRange24wControl RadarEmailSecuritySpamTimeseryListParamsDateRange = "24wControl" +) + +type RadarEmailSecuritySpamTimeseryListParamsDkim string + +const ( + RadarEmailSecuritySpamTimeseryListParamsDkimPass RadarEmailSecuritySpamTimeseryListParamsDkim = "PASS" + RadarEmailSecuritySpamTimeseryListParamsDkimNone RadarEmailSecuritySpamTimeseryListParamsDkim = "NONE" + RadarEmailSecuritySpamTimeseryListParamsDkimFail RadarEmailSecuritySpamTimeseryListParamsDkim = "FAIL" +) + +type RadarEmailSecuritySpamTimeseryListParamsDmarc string + +const ( + RadarEmailSecuritySpamTimeseryListParamsDmarcPass RadarEmailSecuritySpamTimeseryListParamsDmarc = "PASS" + RadarEmailSecuritySpamTimeseryListParamsDmarcNone RadarEmailSecuritySpamTimeseryListParamsDmarc = "NONE" + RadarEmailSecuritySpamTimeseryListParamsDmarcFail RadarEmailSecuritySpamTimeseryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecuritySpamTimeseryListParamsFormat string + +const ( + RadarEmailSecuritySpamTimeseryListParamsFormatJson RadarEmailSecuritySpamTimeseryListParamsFormat = "JSON" + RadarEmailSecuritySpamTimeseryListParamsFormatCsv RadarEmailSecuritySpamTimeseryListParamsFormat = "CSV" +) + +type RadarEmailSecuritySpamTimeseryListParamsSpf string + +const ( + RadarEmailSecuritySpamTimeseryListParamsSpfPass RadarEmailSecuritySpamTimeseryListParamsSpf = "PASS" + RadarEmailSecuritySpamTimeseryListParamsSpfNone RadarEmailSecuritySpamTimeseryListParamsSpf = "NONE" + RadarEmailSecuritySpamTimeseryListParamsSpfFail RadarEmailSecuritySpamTimeseryListParamsSpf = "FAIL" +) diff --git a/radaremailsecurityspamtimesery_test.go b/radaremailsecurityspamtimesery_test.go new file mode 100644 index 00000000000..a59a2e4508f --- /dev/null +++ b/radaremailsecurityspamtimesery_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecuritySpamTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.SpamTimeseries.List(context.TODO(), cloudflare.RadarEmailSecuritySpamTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecuritySpamTimeseryListParamsAggInterval1h), + Arc: cloudflare.F([]cloudflare.RadarEmailSecuritySpamTimeseryListParamsArc{cloudflare.RadarEmailSecuritySpamTimeseryListParamsArcPass, cloudflare.RadarEmailSecuritySpamTimeseryListParamsArcNone, cloudflare.RadarEmailSecuritySpamTimeseryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecuritySpamTimeseryListParamsDateRange{cloudflare.RadarEmailSecuritySpamTimeseryListParamsDateRange1d, cloudflare.RadarEmailSecuritySpamTimeseryListParamsDateRange2d, cloudflare.RadarEmailSecuritySpamTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecuritySpamTimeseryListParamsDkim{cloudflare.RadarEmailSecuritySpamTimeseryListParamsDkimPass, cloudflare.RadarEmailSecuritySpamTimeseryListParamsDkimNone, cloudflare.RadarEmailSecuritySpamTimeseryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecuritySpamTimeseryListParamsDmarc{cloudflare.RadarEmailSecuritySpamTimeseryListParamsDmarcPass, cloudflare.RadarEmailSecuritySpamTimeseryListParamsDmarcNone, cloudflare.RadarEmailSecuritySpamTimeseryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecuritySpamTimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecuritySpamTimeseryListParamsSpf{cloudflare.RadarEmailSecuritySpamTimeseryListParamsSpfPass, cloudflare.RadarEmailSecuritySpamTimeseryListParamsSpfNone, cloudflare.RadarEmailSecuritySpamTimeseryListParamsSpfFail}), + }) + 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/radaremailsecurityspfsummary.go b/radaremailsecurityspfsummary.go new file mode 100644 index 00000000000..44305333fff --- /dev/null +++ b/radaremailsecurityspfsummary.go @@ -0,0 +1,286 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecuritySpfSummaryService 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 +// [NewRadarEmailSecuritySpfSummaryService] method instead. +type RadarEmailSecuritySpfSummaryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecuritySpfSummaryService 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 NewRadarEmailSecuritySpfSummaryService(opts ...option.RequestOption) (r *RadarEmailSecuritySpfSummaryService) { + r = &RadarEmailSecuritySpfSummaryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per SPF validation. +func (r *RadarEmailSecuritySpfSummaryService) List(ctx context.Context, query RadarEmailSecuritySpfSummaryListParams, opts ...option.RequestOption) (res *RadarEmailSecuritySpfSummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/summary/spf" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecuritySpfSummaryListResponse struct { + Result RadarEmailSecuritySpfSummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecuritySpfSummaryListResponseJSON `json:"-"` +} + +// radarEmailSecuritySpfSummaryListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecuritySpfSummaryListResponse] +type radarEmailSecuritySpfSummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfSummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfSummaryListResponseResult struct { + Meta RadarEmailSecuritySpfSummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarEmailSecuritySpfSummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarEmailSecuritySpfSummaryListResponseResultJSON `json:"-"` +} + +// radarEmailSecuritySpfSummaryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecuritySpfSummaryListResponseResult] +type radarEmailSecuritySpfSummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfSummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfSummaryListResponseResultMeta struct { + DateRange []RadarEmailSecuritySpfSummaryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecuritySpfSummaryListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecuritySpfSummaryListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecuritySpfSummaryListResponseResultMeta] +type radarEmailSecuritySpfSummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfSummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfSummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecuritySpfSummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecuritySpfSummaryListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecuritySpfSummaryListResponseResultMetaDateRange] +type radarEmailSecuritySpfSummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfSummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfo] +type radarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfSummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfSummaryListResponseResultSummary0 struct { + Fail string `json:"FAIL,required"` + None string `json:"NONE,required"` + Pass string `json:"PASS,required"` + JSON radarEmailSecuritySpfSummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarEmailSecuritySpfSummaryListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarEmailSecuritySpfSummaryListResponseResultSummary0] +type radarEmailSecuritySpfSummaryListResponseResultSummary0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfSummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfSummaryListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecuritySpfSummaryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecuritySpfSummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecuritySpfSummaryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecuritySpfSummaryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecuritySpfSummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarEmailSecuritySpfSummaryListParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecuritySpfSummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecuritySpfSummaryListParamsArc string + +const ( + RadarEmailSecuritySpfSummaryListParamsArcPass RadarEmailSecuritySpfSummaryListParamsArc = "PASS" + RadarEmailSecuritySpfSummaryListParamsArcNone RadarEmailSecuritySpfSummaryListParamsArc = "NONE" + RadarEmailSecuritySpfSummaryListParamsArcFail RadarEmailSecuritySpfSummaryListParamsArc = "FAIL" +) + +type RadarEmailSecuritySpfSummaryListParamsDateRange string + +const ( + RadarEmailSecuritySpfSummaryListParamsDateRange1d RadarEmailSecuritySpfSummaryListParamsDateRange = "1d" + RadarEmailSecuritySpfSummaryListParamsDateRange2d RadarEmailSecuritySpfSummaryListParamsDateRange = "2d" + RadarEmailSecuritySpfSummaryListParamsDateRange7d RadarEmailSecuritySpfSummaryListParamsDateRange = "7d" + RadarEmailSecuritySpfSummaryListParamsDateRange14d RadarEmailSecuritySpfSummaryListParamsDateRange = "14d" + RadarEmailSecuritySpfSummaryListParamsDateRange28d RadarEmailSecuritySpfSummaryListParamsDateRange = "28d" + RadarEmailSecuritySpfSummaryListParamsDateRange12w RadarEmailSecuritySpfSummaryListParamsDateRange = "12w" + RadarEmailSecuritySpfSummaryListParamsDateRange24w RadarEmailSecuritySpfSummaryListParamsDateRange = "24w" + RadarEmailSecuritySpfSummaryListParamsDateRange52w RadarEmailSecuritySpfSummaryListParamsDateRange = "52w" + RadarEmailSecuritySpfSummaryListParamsDateRange1dControl RadarEmailSecuritySpfSummaryListParamsDateRange = "1dControl" + RadarEmailSecuritySpfSummaryListParamsDateRange2dControl RadarEmailSecuritySpfSummaryListParamsDateRange = "2dControl" + RadarEmailSecuritySpfSummaryListParamsDateRange7dControl RadarEmailSecuritySpfSummaryListParamsDateRange = "7dControl" + RadarEmailSecuritySpfSummaryListParamsDateRange14dControl RadarEmailSecuritySpfSummaryListParamsDateRange = "14dControl" + RadarEmailSecuritySpfSummaryListParamsDateRange28dControl RadarEmailSecuritySpfSummaryListParamsDateRange = "28dControl" + RadarEmailSecuritySpfSummaryListParamsDateRange12wControl RadarEmailSecuritySpfSummaryListParamsDateRange = "12wControl" + RadarEmailSecuritySpfSummaryListParamsDateRange24wControl RadarEmailSecuritySpfSummaryListParamsDateRange = "24wControl" +) + +type RadarEmailSecuritySpfSummaryListParamsDkim string + +const ( + RadarEmailSecuritySpfSummaryListParamsDkimPass RadarEmailSecuritySpfSummaryListParamsDkim = "PASS" + RadarEmailSecuritySpfSummaryListParamsDkimNone RadarEmailSecuritySpfSummaryListParamsDkim = "NONE" + RadarEmailSecuritySpfSummaryListParamsDkimFail RadarEmailSecuritySpfSummaryListParamsDkim = "FAIL" +) + +type RadarEmailSecuritySpfSummaryListParamsDmarc string + +const ( + RadarEmailSecuritySpfSummaryListParamsDmarcPass RadarEmailSecuritySpfSummaryListParamsDmarc = "PASS" + RadarEmailSecuritySpfSummaryListParamsDmarcNone RadarEmailSecuritySpfSummaryListParamsDmarc = "NONE" + RadarEmailSecuritySpfSummaryListParamsDmarcFail RadarEmailSecuritySpfSummaryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecuritySpfSummaryListParamsFormat string + +const ( + RadarEmailSecuritySpfSummaryListParamsFormatJson RadarEmailSecuritySpfSummaryListParamsFormat = "JSON" + RadarEmailSecuritySpfSummaryListParamsFormatCsv RadarEmailSecuritySpfSummaryListParamsFormat = "CSV" +) diff --git a/radaremailsecurityspfsummary_test.go b/radaremailsecurityspfsummary_test.go new file mode 100644 index 00000000000..2b1e3c70247 --- /dev/null +++ b/radaremailsecurityspfsummary_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecuritySpfSummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.SpfSummary.List(context.TODO(), cloudflare.RadarEmailSecuritySpfSummaryListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecuritySpfSummaryListParamsArc{cloudflare.RadarEmailSecuritySpfSummaryListParamsArcPass, cloudflare.RadarEmailSecuritySpfSummaryListParamsArcNone, cloudflare.RadarEmailSecuritySpfSummaryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecuritySpfSummaryListParamsDateRange{cloudflare.RadarEmailSecuritySpfSummaryListParamsDateRange1d, cloudflare.RadarEmailSecuritySpfSummaryListParamsDateRange2d, cloudflare.RadarEmailSecuritySpfSummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecuritySpfSummaryListParamsDkim{cloudflare.RadarEmailSecuritySpfSummaryListParamsDkimPass, cloudflare.RadarEmailSecuritySpfSummaryListParamsDkimNone, cloudflare.RadarEmailSecuritySpfSummaryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecuritySpfSummaryListParamsDmarc{cloudflare.RadarEmailSecuritySpfSummaryListParamsDmarcPass, cloudflare.RadarEmailSecuritySpfSummaryListParamsDmarcNone, cloudflare.RadarEmailSecuritySpfSummaryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecuritySpfSummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaremailsecurityspftimesery.go b/radaremailsecurityspftimesery.go new file mode 100644 index 00000000000..8506a4a4b58 --- /dev/null +++ b/radaremailsecurityspftimesery.go @@ -0,0 +1,207 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecuritySpfTimeseryService 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 +// [NewRadarEmailSecuritySpfTimeseryService] method instead. +type RadarEmailSecuritySpfTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecuritySpfTimeseryService 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 NewRadarEmailSecuritySpfTimeseryService(opts ...option.RequestOption) (r *RadarEmailSecuritySpfTimeseryService) { + r = &RadarEmailSecuritySpfTimeseryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified per SPF validation over time. +func (r *RadarEmailSecuritySpfTimeseryService) List(ctx context.Context, query RadarEmailSecuritySpfTimeseryListParams, opts ...option.RequestOption) (res *RadarEmailSecuritySpfTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/timeseries_groups/spf" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecuritySpfTimeseryListResponse struct { + Result RadarEmailSecuritySpfTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecuritySpfTimeseryListResponseJSON `json:"-"` +} + +// radarEmailSecuritySpfTimeseryListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecuritySpfTimeseryListResponse] +type radarEmailSecuritySpfTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfTimeseryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecuritySpfTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarEmailSecuritySpfTimeseryListResponseResultJSON `json:"-"` +} + +// radarEmailSecuritySpfTimeseryListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecuritySpfTimeseryListResponseResult] +type radarEmailSecuritySpfTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfTimeseryListResponseResultSerie0 struct { + Fail []string `json:"FAIL,required"` + None []string `json:"NONE,required"` + Pass []string `json:"PASS,required"` + JSON radarEmailSecuritySpfTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarEmailSecuritySpfTimeseryListResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarEmailSecuritySpfTimeseryListResponseResultSerie0] +type radarEmailSecuritySpfTimeseryListResponseResultSerie0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecuritySpfTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecuritySpfTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecuritySpfTimeseryListParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecuritySpfTimeseryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecuritySpfTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecuritySpfTimeseryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecuritySpfTimeseryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecuritySpfTimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarEmailSecuritySpfTimeseryListParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecuritySpfTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecuritySpfTimeseryListParamsAggInterval string + +const ( + RadarEmailSecuritySpfTimeseryListParamsAggInterval15m RadarEmailSecuritySpfTimeseryListParamsAggInterval = "15m" + RadarEmailSecuritySpfTimeseryListParamsAggInterval1h RadarEmailSecuritySpfTimeseryListParamsAggInterval = "1h" + RadarEmailSecuritySpfTimeseryListParamsAggInterval1d RadarEmailSecuritySpfTimeseryListParamsAggInterval = "1d" + RadarEmailSecuritySpfTimeseryListParamsAggInterval1w RadarEmailSecuritySpfTimeseryListParamsAggInterval = "1w" +) + +type RadarEmailSecuritySpfTimeseryListParamsArc string + +const ( + RadarEmailSecuritySpfTimeseryListParamsArcPass RadarEmailSecuritySpfTimeseryListParamsArc = "PASS" + RadarEmailSecuritySpfTimeseryListParamsArcNone RadarEmailSecuritySpfTimeseryListParamsArc = "NONE" + RadarEmailSecuritySpfTimeseryListParamsArcFail RadarEmailSecuritySpfTimeseryListParamsArc = "FAIL" +) + +type RadarEmailSecuritySpfTimeseryListParamsDateRange string + +const ( + RadarEmailSecuritySpfTimeseryListParamsDateRange1d RadarEmailSecuritySpfTimeseryListParamsDateRange = "1d" + RadarEmailSecuritySpfTimeseryListParamsDateRange2d RadarEmailSecuritySpfTimeseryListParamsDateRange = "2d" + RadarEmailSecuritySpfTimeseryListParamsDateRange7d RadarEmailSecuritySpfTimeseryListParamsDateRange = "7d" + RadarEmailSecuritySpfTimeseryListParamsDateRange14d RadarEmailSecuritySpfTimeseryListParamsDateRange = "14d" + RadarEmailSecuritySpfTimeseryListParamsDateRange28d RadarEmailSecuritySpfTimeseryListParamsDateRange = "28d" + RadarEmailSecuritySpfTimeseryListParamsDateRange12w RadarEmailSecuritySpfTimeseryListParamsDateRange = "12w" + RadarEmailSecuritySpfTimeseryListParamsDateRange24w RadarEmailSecuritySpfTimeseryListParamsDateRange = "24w" + RadarEmailSecuritySpfTimeseryListParamsDateRange52w RadarEmailSecuritySpfTimeseryListParamsDateRange = "52w" + RadarEmailSecuritySpfTimeseryListParamsDateRange1dControl RadarEmailSecuritySpfTimeseryListParamsDateRange = "1dControl" + RadarEmailSecuritySpfTimeseryListParamsDateRange2dControl RadarEmailSecuritySpfTimeseryListParamsDateRange = "2dControl" + RadarEmailSecuritySpfTimeseryListParamsDateRange7dControl RadarEmailSecuritySpfTimeseryListParamsDateRange = "7dControl" + RadarEmailSecuritySpfTimeseryListParamsDateRange14dControl RadarEmailSecuritySpfTimeseryListParamsDateRange = "14dControl" + RadarEmailSecuritySpfTimeseryListParamsDateRange28dControl RadarEmailSecuritySpfTimeseryListParamsDateRange = "28dControl" + RadarEmailSecuritySpfTimeseryListParamsDateRange12wControl RadarEmailSecuritySpfTimeseryListParamsDateRange = "12wControl" + RadarEmailSecuritySpfTimeseryListParamsDateRange24wControl RadarEmailSecuritySpfTimeseryListParamsDateRange = "24wControl" +) + +type RadarEmailSecuritySpfTimeseryListParamsDkim string + +const ( + RadarEmailSecuritySpfTimeseryListParamsDkimPass RadarEmailSecuritySpfTimeseryListParamsDkim = "PASS" + RadarEmailSecuritySpfTimeseryListParamsDkimNone RadarEmailSecuritySpfTimeseryListParamsDkim = "NONE" + RadarEmailSecuritySpfTimeseryListParamsDkimFail RadarEmailSecuritySpfTimeseryListParamsDkim = "FAIL" +) + +type RadarEmailSecuritySpfTimeseryListParamsDmarc string + +const ( + RadarEmailSecuritySpfTimeseryListParamsDmarcPass RadarEmailSecuritySpfTimeseryListParamsDmarc = "PASS" + RadarEmailSecuritySpfTimeseryListParamsDmarcNone RadarEmailSecuritySpfTimeseryListParamsDmarc = "NONE" + RadarEmailSecuritySpfTimeseryListParamsDmarcFail RadarEmailSecuritySpfTimeseryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecuritySpfTimeseryListParamsFormat string + +const ( + RadarEmailSecuritySpfTimeseryListParamsFormatJson RadarEmailSecuritySpfTimeseryListParamsFormat = "JSON" + RadarEmailSecuritySpfTimeseryListParamsFormatCsv RadarEmailSecuritySpfTimeseryListParamsFormat = "CSV" +) diff --git a/radaremailsecurityspftimesery_test.go b/radaremailsecurityspftimesery_test.go new file mode 100644 index 00000000000..4a2fd2922fd --- /dev/null +++ b/radaremailsecurityspftimesery_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecuritySpfTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.SpfTimeseries.List(context.TODO(), cloudflare.RadarEmailSecuritySpfTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecuritySpfTimeseryListParamsAggInterval1h), + Arc: cloudflare.F([]cloudflare.RadarEmailSecuritySpfTimeseryListParamsArc{cloudflare.RadarEmailSecuritySpfTimeseryListParamsArcPass, cloudflare.RadarEmailSecuritySpfTimeseryListParamsArcNone, cloudflare.RadarEmailSecuritySpfTimeseryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecuritySpfTimeseryListParamsDateRange{cloudflare.RadarEmailSecuritySpfTimeseryListParamsDateRange1d, cloudflare.RadarEmailSecuritySpfTimeseryListParamsDateRange2d, cloudflare.RadarEmailSecuritySpfTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecuritySpfTimeseryListParamsDkim{cloudflare.RadarEmailSecuritySpfTimeseryListParamsDkimPass, cloudflare.RadarEmailSecuritySpfTimeseryListParamsDkimNone, cloudflare.RadarEmailSecuritySpfTimeseryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecuritySpfTimeseryListParamsDmarc{cloudflare.RadarEmailSecuritySpfTimeseryListParamsDmarcPass, cloudflare.RadarEmailSecuritySpfTimeseryListParamsDmarcNone, cloudflare.RadarEmailSecuritySpfTimeseryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecuritySpfTimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radaremailsecuritythreatcategorysummary.go b/radaremailsecuritythreatcategorysummary.go new file mode 100644 index 00000000000..37298281459 --- /dev/null +++ b/radaremailsecuritythreatcategorysummary.go @@ -0,0 +1,302 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityThreatCategorySummaryService 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 [NewRadarEmailSecurityThreatCategorySummaryService] method instead. +type RadarEmailSecurityThreatCategorySummaryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityThreatCategorySummaryService 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 NewRadarEmailSecurityThreatCategorySummaryService(opts ...option.RequestOption) (r *RadarEmailSecurityThreatCategorySummaryService) { + r = &RadarEmailSecurityThreatCategorySummaryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified in Threat Categories. +func (r *RadarEmailSecurityThreatCategorySummaryService) List(ctx context.Context, query RadarEmailSecurityThreatCategorySummaryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityThreatCategorySummaryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/summary/threat_category" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityThreatCategorySummaryListResponse struct { + Result RadarEmailSecurityThreatCategorySummaryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityThreatCategorySummaryListResponseJSON `json:"-"` +} + +// radarEmailSecurityThreatCategorySummaryListResponseJSON contains the JSON +// metadata for the struct [RadarEmailSecurityThreatCategorySummaryListResponse] +type radarEmailSecurityThreatCategorySummaryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityThreatCategorySummaryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityThreatCategorySummaryListResponseResult struct { + Meta RadarEmailSecurityThreatCategorySummaryListResponseResultMeta `json:"meta,required"` + Summary0 RadarEmailSecurityThreatCategorySummaryListResponseResultSummary0 `json:"summary_0,required"` + JSON radarEmailSecurityThreatCategorySummaryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityThreatCategorySummaryListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityThreatCategorySummaryListResponseResult] +type radarEmailSecurityThreatCategorySummaryListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityThreatCategorySummaryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityThreatCategorySummaryListResponseResultMeta struct { + DateRange []RadarEmailSecurityThreatCategorySummaryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityThreatCategorySummaryListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityThreatCategorySummaryListResponseResultMetaJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityThreatCategorySummaryListResponseResultMeta] +type radarEmailSecurityThreatCategorySummaryListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityThreatCategorySummaryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityThreatCategorySummaryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityThreatCategorySummaryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityThreatCategorySummaryListResponseResultMetaDateRangeJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityThreatCategorySummaryListResponseResultMetaDateRange] +type radarEmailSecurityThreatCategorySummaryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityThreatCategorySummaryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfo] +type radarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityThreatCategorySummaryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityThreatCategorySummaryListResponseResultSummary0 struct { + BrandImpersonation string `json:"BrandImpersonation,required"` + CredentialHarvester string `json:"CredentialHarvester,required"` + IdentityDeception string `json:"IdentityDeception,required"` + Link string `json:"Link,required"` + JSON radarEmailSecurityThreatCategorySummaryListResponseResultSummary0JSON `json:"-"` +} + +// radarEmailSecurityThreatCategorySummaryListResponseResultSummary0JSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityThreatCategorySummaryListResponseResultSummary0] +type radarEmailSecurityThreatCategorySummaryListResponseResultSummary0JSON struct { + BrandImpersonation apijson.Field + CredentialHarvester apijson.Field + IdentityDeception apijson.Field + Link apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityThreatCategorySummaryListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityThreatCategorySummaryListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityThreatCategorySummaryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityThreatCategorySummaryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityThreatCategorySummaryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityThreatCategorySummaryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityThreatCategorySummaryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityThreatCategorySummaryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityThreatCategorySummaryListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityThreatCategorySummaryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecurityThreatCategorySummaryListParamsArc string + +const ( + RadarEmailSecurityThreatCategorySummaryListParamsArcPass RadarEmailSecurityThreatCategorySummaryListParamsArc = "PASS" + RadarEmailSecurityThreatCategorySummaryListParamsArcNone RadarEmailSecurityThreatCategorySummaryListParamsArc = "NONE" + RadarEmailSecurityThreatCategorySummaryListParamsArcFail RadarEmailSecurityThreatCategorySummaryListParamsArc = "FAIL" +) + +type RadarEmailSecurityThreatCategorySummaryListParamsDateRange string + +const ( + RadarEmailSecurityThreatCategorySummaryListParamsDateRange1d RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "1d" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange2d RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "2d" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange7d RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "7d" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange14d RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "14d" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange28d RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "28d" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange12w RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "12w" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange24w RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "24w" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange52w RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "52w" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange1dControl RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "1dControl" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange2dControl RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "2dControl" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange7dControl RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "7dControl" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange14dControl RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "14dControl" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange28dControl RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "28dControl" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange12wControl RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "12wControl" + RadarEmailSecurityThreatCategorySummaryListParamsDateRange24wControl RadarEmailSecurityThreatCategorySummaryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityThreatCategorySummaryListParamsDkim string + +const ( + RadarEmailSecurityThreatCategorySummaryListParamsDkimPass RadarEmailSecurityThreatCategorySummaryListParamsDkim = "PASS" + RadarEmailSecurityThreatCategorySummaryListParamsDkimNone RadarEmailSecurityThreatCategorySummaryListParamsDkim = "NONE" + RadarEmailSecurityThreatCategorySummaryListParamsDkimFail RadarEmailSecurityThreatCategorySummaryListParamsDkim = "FAIL" +) + +type RadarEmailSecurityThreatCategorySummaryListParamsDmarc string + +const ( + RadarEmailSecurityThreatCategorySummaryListParamsDmarcPass RadarEmailSecurityThreatCategorySummaryListParamsDmarc = "PASS" + RadarEmailSecurityThreatCategorySummaryListParamsDmarcNone RadarEmailSecurityThreatCategorySummaryListParamsDmarc = "NONE" + RadarEmailSecurityThreatCategorySummaryListParamsDmarcFail RadarEmailSecurityThreatCategorySummaryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityThreatCategorySummaryListParamsFormat string + +const ( + RadarEmailSecurityThreatCategorySummaryListParamsFormatJson RadarEmailSecurityThreatCategorySummaryListParamsFormat = "JSON" + RadarEmailSecurityThreatCategorySummaryListParamsFormatCsv RadarEmailSecurityThreatCategorySummaryListParamsFormat = "CSV" +) + +type RadarEmailSecurityThreatCategorySummaryListParamsSpf string + +const ( + RadarEmailSecurityThreatCategorySummaryListParamsSpfPass RadarEmailSecurityThreatCategorySummaryListParamsSpf = "PASS" + RadarEmailSecurityThreatCategorySummaryListParamsSpfNone RadarEmailSecurityThreatCategorySummaryListParamsSpf = "NONE" + RadarEmailSecurityThreatCategorySummaryListParamsSpfFail RadarEmailSecurityThreatCategorySummaryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritythreatcategorysummary_test.go b/radaremailsecuritythreatcategorysummary_test.go new file mode 100644 index 00000000000..1e39e919170 --- /dev/null +++ b/radaremailsecuritythreatcategorysummary_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityThreatCategorySummaryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.ThreatCategorySummary.List(context.TODO(), cloudflare.RadarEmailSecurityThreatCategorySummaryListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsArc{cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsArcPass, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsArcNone, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDateRange{cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDateRange1d, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDateRange2d, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDkim{cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDkimPass, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDkimNone, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDmarc{cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDmarcPass, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDmarcNone, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsSpf{cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsSpfPass, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsSpfNone, cloudflare.RadarEmailSecurityThreatCategorySummaryListParamsSpfFail}), + }) + 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/radaremailsecuritytmeseriesgroup.go b/radaremailsecuritytmeseriesgroup.go new file mode 100644 index 00000000000..82f506e480d --- /dev/null +++ b/radaremailsecuritytmeseriesgroup.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTmeseriesGroupService 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 +// [NewRadarEmailSecurityTmeseriesGroupService] method instead. +type RadarEmailSecurityTmeseriesGroupService struct { + Options []option.RequestOption + ThreatCategories *RadarEmailSecurityTmeseriesGroupThreatCategoryService +} + +// NewRadarEmailSecurityTmeseriesGroupService 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 NewRadarEmailSecurityTmeseriesGroupService(opts ...option.RequestOption) (r *RadarEmailSecurityTmeseriesGroupService) { + r = &RadarEmailSecurityTmeseriesGroupService{} + r.Options = opts + r.ThreatCategories = NewRadarEmailSecurityTmeseriesGroupThreatCategoryService(opts...) + return +} diff --git a/radaremailsecuritytmeseriesgroupthreatcategory.go b/radaremailsecuritytmeseriesgroupthreatcategory.go new file mode 100644 index 00000000000..e97f01c43ee --- /dev/null +++ b/radaremailsecuritytmeseriesgroupthreatcategory.go @@ -0,0 +1,223 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTmeseriesGroupThreatCategoryService 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 [NewRadarEmailSecurityTmeseriesGroupThreatCategoryService] method instead. +type RadarEmailSecurityTmeseriesGroupThreatCategoryService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTmeseriesGroupThreatCategoryService 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 NewRadarEmailSecurityTmeseriesGroupThreatCategoryService(opts ...option.RequestOption) (r *RadarEmailSecurityTmeseriesGroupThreatCategoryService) { + r = &RadarEmailSecurityTmeseriesGroupThreatCategoryService{} + r.Options = opts + return +} + +// Percentage distribution of emails classified in Threat Categories over time. +func (r *RadarEmailSecurityTmeseriesGroupThreatCategoryService) List(ctx context.Context, query RadarEmailSecurityTmeseriesGroupThreatCategoryListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTmeseriesGroupThreatCategoryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/timeseries_groups/threat_category" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListResponse struct { + Result RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTmeseriesGroupThreatCategoryListResponseJSON `json:"-"` +} + +// radarEmailSecurityTmeseriesGroupThreatCategoryListResponseJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTmeseriesGroupThreatCategoryListResponse] +type radarEmailSecurityTmeseriesGroupThreatCategoryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTmeseriesGroupThreatCategoryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResult] +type radarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultSerie0 struct { + BrandImpersonation []string `json:"BrandImpersonation,required"` + CredentialHarvester []string `json:"CredentialHarvester,required"` + IdentityDeception []string `json:"IdentityDeception,required"` + Link []string `json:"Link,required"` + JSON radarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultSerie0JSON `json:"-"` +} + +// radarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultSerie0JSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultSerie0] +type radarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultSerie0JSON struct { + BrandImpersonation apijson.Field + CredentialHarvester apijson.Field + IdentityDeception apijson.Field + Link apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTmeseriesGroupThreatCategoryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTmeseriesGroupThreatCategoryListParams]'s +// query parameters as `url.Values`. +func (r RadarEmailSecurityTmeseriesGroupThreatCategoryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval string + +const ( + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval15m RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval = "15m" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval1h RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval = "1h" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval1d RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval = "1d" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval1w RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval = "1w" +) + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArc string + +const ( + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArcPass RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArc = "PASS" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArcNone RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArc = "NONE" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArcFail RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArc = "FAIL" +) + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange string + +const ( + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange1d RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "1d" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange2d RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "2d" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange7d RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "7d" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange14d RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "14d" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange28d RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "28d" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange12w RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "12w" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange24w RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "24w" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange52w RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "52w" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange1dControl RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "1dControl" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange2dControl RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "2dControl" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange7dControl RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "7dControl" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange14dControl RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "14dControl" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange28dControl RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "28dControl" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange12wControl RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "12wControl" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange24wControl RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkim string + +const ( + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkimPass RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkim = "PASS" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkimNone RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkim = "NONE" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkimFail RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkim = "FAIL" +) + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarc string + +const ( + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarcPass RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarc = "PASS" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarcNone RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarc = "NONE" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarcFail RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsFormat string + +const ( + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsFormatJson RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsFormat = "JSON" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsFormatCsv RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsFormat = "CSV" +) + +type RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpf string + +const ( + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpfPass RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpf = "PASS" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpfNone RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpf = "NONE" + RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpfFail RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytmeseriesgroupthreatcategory_test.go b/radaremailsecuritytmeseriesgroupthreatcategory_test.go new file mode 100644 index 00000000000..9fd06953d8d --- /dev/null +++ b/radaremailsecuritytmeseriesgroupthreatcategory_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTmeseriesGroupThreatCategoryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.TmeseriesGroups.ThreatCategories.List(context.TODO(), cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsAggInterval1h), + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArc{cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArcPass, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArcNone, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange{cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange1d, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange2d, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkim{cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkimPass, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkimNone, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarc{cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarcPass, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarcNone, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpf{cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpfPass, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpfNone, cloudflare.RadarEmailSecurityTmeseriesGroupThreatCategoryListParamsSpfFail}), + }) + 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/radaremailsecuritytop.go b/radaremailsecuritytop.go new file mode 100644 index 00000000000..49c589014b5 --- /dev/null +++ b/radaremailsecuritytop.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopService 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 [NewRadarEmailSecurityTopService] +// method instead. +type RadarEmailSecurityTopService struct { + Options []option.RequestOption + Ases *RadarEmailSecurityTopAseService + Locations *RadarEmailSecurityTopLocationService +} + +// NewRadarEmailSecurityTopService 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 NewRadarEmailSecurityTopService(opts ...option.RequestOption) (r *RadarEmailSecurityTopService) { + r = &RadarEmailSecurityTopService{} + r.Options = opts + r.Ases = NewRadarEmailSecurityTopAseService(opts...) + r.Locations = NewRadarEmailSecurityTopLocationService(opts...) + return +} diff --git a/radaremailsecuritytopase.go b/radaremailsecuritytopase.go new file mode 100644 index 00000000000..8493c849f0b --- /dev/null +++ b/radaremailsecuritytopase.go @@ -0,0 +1,309 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopAseService 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 +// [NewRadarEmailSecurityTopAseService] method instead. +type RadarEmailSecurityTopAseService struct { + Options []option.RequestOption + Arc *RadarEmailSecurityTopAseArcService + Dkim *RadarEmailSecurityTopAseDkimService + Dmarc *RadarEmailSecurityTopAseDmarcService + Malicious *RadarEmailSecurityTopAseMaliciousService + Spam *RadarEmailSecurityTopAseSpamService + Spf *RadarEmailSecurityTopAseSpfService +} + +// NewRadarEmailSecurityTopAseService 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 NewRadarEmailSecurityTopAseService(opts ...option.RequestOption) (r *RadarEmailSecurityTopAseService) { + r = &RadarEmailSecurityTopAseService{} + r.Options = opts + r.Arc = NewRadarEmailSecurityTopAseArcService(opts...) + r.Dkim = NewRadarEmailSecurityTopAseDkimService(opts...) + r.Dmarc = NewRadarEmailSecurityTopAseDmarcService(opts...) + r.Malicious = NewRadarEmailSecurityTopAseMaliciousService(opts...) + r.Spam = NewRadarEmailSecurityTopAseSpamService(opts...) + r.Spf = NewRadarEmailSecurityTopAseSpfService(opts...) + return +} + +// Get the top autonomous systems (AS) by email messages. Values are a percentage +// out of the total emails. +func (r *RadarEmailSecurityTopAseService) List(ctx context.Context, query RadarEmailSecurityTopAseListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopAseListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/top/ases" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopAseListResponse struct { + Result RadarEmailSecurityTopAseListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopAseListResponseJSON `json:"-"` +} + +// radarEmailSecurityTopAseListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityTopAseListResponse] +type radarEmailSecurityTopAseListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseListResponseResult struct { + Meta RadarEmailSecurityTopAseListResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopAseListResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopAseListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopAseListResponseResultJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTopAseListResponseResult] +type radarEmailSecurityTopAseListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseListResponseResultMeta struct { + DateRange []RadarEmailSecurityTopAseListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopAseListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopAseListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseListResponseResultMeta] +type radarEmailSecurityTopAseListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopAseListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopAseListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopAseListResponseResultMetaDateRange] +type radarEmailSecurityTopAseListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopAseListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopAseListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopAseListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopAseListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopAseListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopAseListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseListResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopAseListResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopAseListResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseListResponseResultTop0] +type radarEmailSecurityTopAseListResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopAseListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopAseListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopAseListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopAseListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopAseListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopAseListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopAseListParams]'s query parameters as +// `url.Values`. +func (r RadarEmailSecurityTopAseListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecurityTopAseListParamsArc string + +const ( + RadarEmailSecurityTopAseListParamsArcPass RadarEmailSecurityTopAseListParamsArc = "PASS" + RadarEmailSecurityTopAseListParamsArcNone RadarEmailSecurityTopAseListParamsArc = "NONE" + RadarEmailSecurityTopAseListParamsArcFail RadarEmailSecurityTopAseListParamsArc = "FAIL" +) + +type RadarEmailSecurityTopAseListParamsDateRange string + +const ( + RadarEmailSecurityTopAseListParamsDateRange1d RadarEmailSecurityTopAseListParamsDateRange = "1d" + RadarEmailSecurityTopAseListParamsDateRange2d RadarEmailSecurityTopAseListParamsDateRange = "2d" + RadarEmailSecurityTopAseListParamsDateRange7d RadarEmailSecurityTopAseListParamsDateRange = "7d" + RadarEmailSecurityTopAseListParamsDateRange14d RadarEmailSecurityTopAseListParamsDateRange = "14d" + RadarEmailSecurityTopAseListParamsDateRange28d RadarEmailSecurityTopAseListParamsDateRange = "28d" + RadarEmailSecurityTopAseListParamsDateRange12w RadarEmailSecurityTopAseListParamsDateRange = "12w" + RadarEmailSecurityTopAseListParamsDateRange24w RadarEmailSecurityTopAseListParamsDateRange = "24w" + RadarEmailSecurityTopAseListParamsDateRange52w RadarEmailSecurityTopAseListParamsDateRange = "52w" + RadarEmailSecurityTopAseListParamsDateRange1dControl RadarEmailSecurityTopAseListParamsDateRange = "1dControl" + RadarEmailSecurityTopAseListParamsDateRange2dControl RadarEmailSecurityTopAseListParamsDateRange = "2dControl" + RadarEmailSecurityTopAseListParamsDateRange7dControl RadarEmailSecurityTopAseListParamsDateRange = "7dControl" + RadarEmailSecurityTopAseListParamsDateRange14dControl RadarEmailSecurityTopAseListParamsDateRange = "14dControl" + RadarEmailSecurityTopAseListParamsDateRange28dControl RadarEmailSecurityTopAseListParamsDateRange = "28dControl" + RadarEmailSecurityTopAseListParamsDateRange12wControl RadarEmailSecurityTopAseListParamsDateRange = "12wControl" + RadarEmailSecurityTopAseListParamsDateRange24wControl RadarEmailSecurityTopAseListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopAseListParamsDkim string + +const ( + RadarEmailSecurityTopAseListParamsDkimPass RadarEmailSecurityTopAseListParamsDkim = "PASS" + RadarEmailSecurityTopAseListParamsDkimNone RadarEmailSecurityTopAseListParamsDkim = "NONE" + RadarEmailSecurityTopAseListParamsDkimFail RadarEmailSecurityTopAseListParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopAseListParamsDmarc string + +const ( + RadarEmailSecurityTopAseListParamsDmarcPass RadarEmailSecurityTopAseListParamsDmarc = "PASS" + RadarEmailSecurityTopAseListParamsDmarcNone RadarEmailSecurityTopAseListParamsDmarc = "NONE" + RadarEmailSecurityTopAseListParamsDmarcFail RadarEmailSecurityTopAseListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopAseListParamsFormat string + +const ( + RadarEmailSecurityTopAseListParamsFormatJson RadarEmailSecurityTopAseListParamsFormat = "JSON" + RadarEmailSecurityTopAseListParamsFormatCsv RadarEmailSecurityTopAseListParamsFormat = "CSV" +) + +type RadarEmailSecurityTopAseListParamsSpf string + +const ( + RadarEmailSecurityTopAseListParamsSpfPass RadarEmailSecurityTopAseListParamsSpf = "PASS" + RadarEmailSecurityTopAseListParamsSpfNone RadarEmailSecurityTopAseListParamsSpf = "NONE" + RadarEmailSecurityTopAseListParamsSpfFail RadarEmailSecurityTopAseListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytopase_test.go b/radaremailsecuritytopase_test.go new file mode 100644 index 00000000000..7650ebd6af4 --- /dev/null +++ b/radaremailsecuritytopase_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopAseListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Ases.List(context.TODO(), cloudflare.RadarEmailSecurityTopAseListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseListParamsArc{cloudflare.RadarEmailSecurityTopAseListParamsArcPass, cloudflare.RadarEmailSecurityTopAseListParamsArcNone, cloudflare.RadarEmailSecurityTopAseListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseListParamsDateRange{cloudflare.RadarEmailSecurityTopAseListParamsDateRange1d, cloudflare.RadarEmailSecurityTopAseListParamsDateRange2d, cloudflare.RadarEmailSecurityTopAseListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseListParamsDkim{cloudflare.RadarEmailSecurityTopAseListParamsDkimPass, cloudflare.RadarEmailSecurityTopAseListParamsDkimNone, cloudflare.RadarEmailSecurityTopAseListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseListParamsDmarc{cloudflare.RadarEmailSecurityTopAseListParamsDmarcPass, cloudflare.RadarEmailSecurityTopAseListParamsDmarcNone, cloudflare.RadarEmailSecurityTopAseListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopAseListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseListParamsSpf{cloudflare.RadarEmailSecurityTopAseListParamsSpfPass, cloudflare.RadarEmailSecurityTopAseListParamsSpfNone, cloudflare.RadarEmailSecurityTopAseListParamsSpfFail}), + }) + 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/radaremailsecuritytopasearc.go b/radaremailsecuritytopasearc.go new file mode 100644 index 00000000000..d2c60a40a43 --- /dev/null +++ b/radaremailsecuritytopasearc.go @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopAseArcService 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 +// [NewRadarEmailSecurityTopAseArcService] method instead. +type RadarEmailSecurityTopAseArcService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopAseArcService 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 NewRadarEmailSecurityTopAseArcService(opts ...option.RequestOption) (r *RadarEmailSecurityTopAseArcService) { + r = &RadarEmailSecurityTopAseArcService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS) by emails ARC validation. +func (r *RadarEmailSecurityTopAseArcService) Get(ctx context.Context, arc RadarEmailSecurityTopAseArcGetParamsArc, query RadarEmailSecurityTopAseArcGetParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopAseArcGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/ases/arc/%v", arc) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopAseArcGetResponse struct { + Result RadarEmailSecurityTopAseArcGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopAseArcGetResponseJSON `json:"-"` +} + +// radarEmailSecurityTopAseArcGetResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityTopAseArcGetResponse] +type radarEmailSecurityTopAseArcGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseArcGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseArcGetResponseResult struct { + Meta RadarEmailSecurityTopAseArcGetResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopAseArcGetResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopAseArcGetResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopAseArcGetResponseResultJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTopAseArcGetResponseResult] +type radarEmailSecurityTopAseArcGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseArcGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseArcGetResponseResultMeta struct { + DateRange []RadarEmailSecurityTopAseArcGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopAseArcGetResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopAseArcGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseArcGetResponseResultMeta] +type radarEmailSecurityTopAseArcGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseArcGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseArcGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopAseArcGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopAseArcGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopAseArcGetResponseResultMetaDateRange] +type radarEmailSecurityTopAseArcGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseArcGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseArcGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseArcGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopAseArcGetResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopAseArcGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseArcGetResponseResultTop0] +type radarEmailSecurityTopAseArcGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseArcGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseArcGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopAseArcGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopAseArcGetParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopAseArcGetParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopAseArcGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopAseArcGetParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopAseArcGetParams]'s query parameters as +// `url.Values`. +func (r RadarEmailSecurityTopAseArcGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// ARC. +type RadarEmailSecurityTopAseArcGetParamsArc string + +const ( + RadarEmailSecurityTopAseArcGetParamsArcPass RadarEmailSecurityTopAseArcGetParamsArc = "PASS" + RadarEmailSecurityTopAseArcGetParamsArcNone RadarEmailSecurityTopAseArcGetParamsArc = "NONE" + RadarEmailSecurityTopAseArcGetParamsArcFail RadarEmailSecurityTopAseArcGetParamsArc = "FAIL" +) + +type RadarEmailSecurityTopAseArcGetParamsDateRange string + +const ( + RadarEmailSecurityTopAseArcGetParamsDateRange1d RadarEmailSecurityTopAseArcGetParamsDateRange = "1d" + RadarEmailSecurityTopAseArcGetParamsDateRange2d RadarEmailSecurityTopAseArcGetParamsDateRange = "2d" + RadarEmailSecurityTopAseArcGetParamsDateRange7d RadarEmailSecurityTopAseArcGetParamsDateRange = "7d" + RadarEmailSecurityTopAseArcGetParamsDateRange14d RadarEmailSecurityTopAseArcGetParamsDateRange = "14d" + RadarEmailSecurityTopAseArcGetParamsDateRange28d RadarEmailSecurityTopAseArcGetParamsDateRange = "28d" + RadarEmailSecurityTopAseArcGetParamsDateRange12w RadarEmailSecurityTopAseArcGetParamsDateRange = "12w" + RadarEmailSecurityTopAseArcGetParamsDateRange24w RadarEmailSecurityTopAseArcGetParamsDateRange = "24w" + RadarEmailSecurityTopAseArcGetParamsDateRange52w RadarEmailSecurityTopAseArcGetParamsDateRange = "52w" + RadarEmailSecurityTopAseArcGetParamsDateRange1dControl RadarEmailSecurityTopAseArcGetParamsDateRange = "1dControl" + RadarEmailSecurityTopAseArcGetParamsDateRange2dControl RadarEmailSecurityTopAseArcGetParamsDateRange = "2dControl" + RadarEmailSecurityTopAseArcGetParamsDateRange7dControl RadarEmailSecurityTopAseArcGetParamsDateRange = "7dControl" + RadarEmailSecurityTopAseArcGetParamsDateRange14dControl RadarEmailSecurityTopAseArcGetParamsDateRange = "14dControl" + RadarEmailSecurityTopAseArcGetParamsDateRange28dControl RadarEmailSecurityTopAseArcGetParamsDateRange = "28dControl" + RadarEmailSecurityTopAseArcGetParamsDateRange12wControl RadarEmailSecurityTopAseArcGetParamsDateRange = "12wControl" + RadarEmailSecurityTopAseArcGetParamsDateRange24wControl RadarEmailSecurityTopAseArcGetParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopAseArcGetParamsDkim string + +const ( + RadarEmailSecurityTopAseArcGetParamsDkimPass RadarEmailSecurityTopAseArcGetParamsDkim = "PASS" + RadarEmailSecurityTopAseArcGetParamsDkimNone RadarEmailSecurityTopAseArcGetParamsDkim = "NONE" + RadarEmailSecurityTopAseArcGetParamsDkimFail RadarEmailSecurityTopAseArcGetParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopAseArcGetParamsDmarc string + +const ( + RadarEmailSecurityTopAseArcGetParamsDmarcPass RadarEmailSecurityTopAseArcGetParamsDmarc = "PASS" + RadarEmailSecurityTopAseArcGetParamsDmarcNone RadarEmailSecurityTopAseArcGetParamsDmarc = "NONE" + RadarEmailSecurityTopAseArcGetParamsDmarcFail RadarEmailSecurityTopAseArcGetParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopAseArcGetParamsFormat string + +const ( + RadarEmailSecurityTopAseArcGetParamsFormatJson RadarEmailSecurityTopAseArcGetParamsFormat = "JSON" + RadarEmailSecurityTopAseArcGetParamsFormatCsv RadarEmailSecurityTopAseArcGetParamsFormat = "CSV" +) + +type RadarEmailSecurityTopAseArcGetParamsSpf string + +const ( + RadarEmailSecurityTopAseArcGetParamsSpfPass RadarEmailSecurityTopAseArcGetParamsSpf = "PASS" + RadarEmailSecurityTopAseArcGetParamsSpfNone RadarEmailSecurityTopAseArcGetParamsSpf = "NONE" + RadarEmailSecurityTopAseArcGetParamsSpfFail RadarEmailSecurityTopAseArcGetParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytopasearc_test.go b/radaremailsecuritytopasearc_test.go new file mode 100644 index 00000000000..d27e952eeef --- /dev/null +++ b/radaremailsecuritytopasearc_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopAseArcGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Ases.Arc.Get( + context.TODO(), + cloudflare.RadarEmailSecurityTopAseArcGetParamsArcPass, + cloudflare.RadarEmailSecurityTopAseArcGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseArcGetParamsDateRange{cloudflare.RadarEmailSecurityTopAseArcGetParamsDateRange1d, cloudflare.RadarEmailSecurityTopAseArcGetParamsDateRange2d, cloudflare.RadarEmailSecurityTopAseArcGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseArcGetParamsDkim{cloudflare.RadarEmailSecurityTopAseArcGetParamsDkimPass, cloudflare.RadarEmailSecurityTopAseArcGetParamsDkimNone, cloudflare.RadarEmailSecurityTopAseArcGetParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseArcGetParamsDmarc{cloudflare.RadarEmailSecurityTopAseArcGetParamsDmarcPass, cloudflare.RadarEmailSecurityTopAseArcGetParamsDmarcNone, cloudflare.RadarEmailSecurityTopAseArcGetParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopAseArcGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseArcGetParamsSpf{cloudflare.RadarEmailSecurityTopAseArcGetParamsSpfPass, cloudflare.RadarEmailSecurityTopAseArcGetParamsSpfNone, cloudflare.RadarEmailSecurityTopAseArcGetParamsSpfFail}), + }, + ) + 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/radaremailsecuritytopasedkim.go b/radaremailsecuritytopasedkim.go new file mode 100644 index 00000000000..dfb5871ff9b --- /dev/null +++ b/radaremailsecuritytopasedkim.go @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopAseDkimService 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 +// [NewRadarEmailSecurityTopAseDkimService] method instead. +type RadarEmailSecurityTopAseDkimService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopAseDkimService 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 NewRadarEmailSecurityTopAseDkimService(opts ...option.RequestOption) (r *RadarEmailSecurityTopAseDkimService) { + r = &RadarEmailSecurityTopAseDkimService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by email DKIM validation. +func (r *RadarEmailSecurityTopAseDkimService) Get(ctx context.Context, dkim RadarEmailSecurityTopAseDkimGetParamsDkim, query RadarEmailSecurityTopAseDkimGetParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopAseDkimGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/ases/dkim/%v", dkim) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopAseDkimGetResponse struct { + Result RadarEmailSecurityTopAseDkimGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopAseDkimGetResponseJSON `json:"-"` +} + +// radarEmailSecurityTopAseDkimGetResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityTopAseDkimGetResponse] +type radarEmailSecurityTopAseDkimGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDkimGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDkimGetResponseResult struct { + Meta RadarEmailSecurityTopAseDkimGetResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopAseDkimGetResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopAseDkimGetResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopAseDkimGetResponseResultJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTopAseDkimGetResponseResult] +type radarEmailSecurityTopAseDkimGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDkimGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDkimGetResponseResultMeta struct { + DateRange []RadarEmailSecurityTopAseDkimGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopAseDkimGetResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopAseDkimGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseDkimGetResponseResultMeta] +type radarEmailSecurityTopAseDkimGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDkimGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDkimGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopAseDkimGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopAseDkimGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopAseDkimGetResponseResultMetaDateRange] +type radarEmailSecurityTopAseDkimGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDkimGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDkimGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDkimGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopAseDkimGetResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopAseDkimGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseDkimGetResponseResultTop0] +type radarEmailSecurityTopAseDkimGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDkimGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDkimGetParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopAseDkimGetParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopAseDkimGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopAseDkimGetParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopAseDkimGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopAseDkimGetParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopAseDkimGetParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecurityTopAseDkimGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// DKIM. +type RadarEmailSecurityTopAseDkimGetParamsDkim string + +const ( + RadarEmailSecurityTopAseDkimGetParamsDkimPass RadarEmailSecurityTopAseDkimGetParamsDkim = "PASS" + RadarEmailSecurityTopAseDkimGetParamsDkimNone RadarEmailSecurityTopAseDkimGetParamsDkim = "NONE" + RadarEmailSecurityTopAseDkimGetParamsDkimFail RadarEmailSecurityTopAseDkimGetParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopAseDkimGetParamsArc string + +const ( + RadarEmailSecurityTopAseDkimGetParamsArcPass RadarEmailSecurityTopAseDkimGetParamsArc = "PASS" + RadarEmailSecurityTopAseDkimGetParamsArcNone RadarEmailSecurityTopAseDkimGetParamsArc = "NONE" + RadarEmailSecurityTopAseDkimGetParamsArcFail RadarEmailSecurityTopAseDkimGetParamsArc = "FAIL" +) + +type RadarEmailSecurityTopAseDkimGetParamsDateRange string + +const ( + RadarEmailSecurityTopAseDkimGetParamsDateRange1d RadarEmailSecurityTopAseDkimGetParamsDateRange = "1d" + RadarEmailSecurityTopAseDkimGetParamsDateRange2d RadarEmailSecurityTopAseDkimGetParamsDateRange = "2d" + RadarEmailSecurityTopAseDkimGetParamsDateRange7d RadarEmailSecurityTopAseDkimGetParamsDateRange = "7d" + RadarEmailSecurityTopAseDkimGetParamsDateRange14d RadarEmailSecurityTopAseDkimGetParamsDateRange = "14d" + RadarEmailSecurityTopAseDkimGetParamsDateRange28d RadarEmailSecurityTopAseDkimGetParamsDateRange = "28d" + RadarEmailSecurityTopAseDkimGetParamsDateRange12w RadarEmailSecurityTopAseDkimGetParamsDateRange = "12w" + RadarEmailSecurityTopAseDkimGetParamsDateRange24w RadarEmailSecurityTopAseDkimGetParamsDateRange = "24w" + RadarEmailSecurityTopAseDkimGetParamsDateRange52w RadarEmailSecurityTopAseDkimGetParamsDateRange = "52w" + RadarEmailSecurityTopAseDkimGetParamsDateRange1dControl RadarEmailSecurityTopAseDkimGetParamsDateRange = "1dControl" + RadarEmailSecurityTopAseDkimGetParamsDateRange2dControl RadarEmailSecurityTopAseDkimGetParamsDateRange = "2dControl" + RadarEmailSecurityTopAseDkimGetParamsDateRange7dControl RadarEmailSecurityTopAseDkimGetParamsDateRange = "7dControl" + RadarEmailSecurityTopAseDkimGetParamsDateRange14dControl RadarEmailSecurityTopAseDkimGetParamsDateRange = "14dControl" + RadarEmailSecurityTopAseDkimGetParamsDateRange28dControl RadarEmailSecurityTopAseDkimGetParamsDateRange = "28dControl" + RadarEmailSecurityTopAseDkimGetParamsDateRange12wControl RadarEmailSecurityTopAseDkimGetParamsDateRange = "12wControl" + RadarEmailSecurityTopAseDkimGetParamsDateRange24wControl RadarEmailSecurityTopAseDkimGetParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopAseDkimGetParamsDmarc string + +const ( + RadarEmailSecurityTopAseDkimGetParamsDmarcPass RadarEmailSecurityTopAseDkimGetParamsDmarc = "PASS" + RadarEmailSecurityTopAseDkimGetParamsDmarcNone RadarEmailSecurityTopAseDkimGetParamsDmarc = "NONE" + RadarEmailSecurityTopAseDkimGetParamsDmarcFail RadarEmailSecurityTopAseDkimGetParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopAseDkimGetParamsFormat string + +const ( + RadarEmailSecurityTopAseDkimGetParamsFormatJson RadarEmailSecurityTopAseDkimGetParamsFormat = "JSON" + RadarEmailSecurityTopAseDkimGetParamsFormatCsv RadarEmailSecurityTopAseDkimGetParamsFormat = "CSV" +) + +type RadarEmailSecurityTopAseDkimGetParamsSpf string + +const ( + RadarEmailSecurityTopAseDkimGetParamsSpfPass RadarEmailSecurityTopAseDkimGetParamsSpf = "PASS" + RadarEmailSecurityTopAseDkimGetParamsSpfNone RadarEmailSecurityTopAseDkimGetParamsSpf = "NONE" + RadarEmailSecurityTopAseDkimGetParamsSpfFail RadarEmailSecurityTopAseDkimGetParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytopasedkim_test.go b/radaremailsecuritytopasedkim_test.go new file mode 100644 index 00000000000..f539136ceb3 --- /dev/null +++ b/radaremailsecuritytopasedkim_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopAseDkimGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Ases.Dkim.Get( + context.TODO(), + cloudflare.RadarEmailSecurityTopAseDkimGetParamsDkimPass, + cloudflare.RadarEmailSecurityTopAseDkimGetParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDkimGetParamsArc{cloudflare.RadarEmailSecurityTopAseDkimGetParamsArcPass, cloudflare.RadarEmailSecurityTopAseDkimGetParamsArcNone, cloudflare.RadarEmailSecurityTopAseDkimGetParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDkimGetParamsDateRange{cloudflare.RadarEmailSecurityTopAseDkimGetParamsDateRange1d, cloudflare.RadarEmailSecurityTopAseDkimGetParamsDateRange2d, cloudflare.RadarEmailSecurityTopAseDkimGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDkimGetParamsDmarc{cloudflare.RadarEmailSecurityTopAseDkimGetParamsDmarcPass, cloudflare.RadarEmailSecurityTopAseDkimGetParamsDmarcNone, cloudflare.RadarEmailSecurityTopAseDkimGetParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopAseDkimGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDkimGetParamsSpf{cloudflare.RadarEmailSecurityTopAseDkimGetParamsSpfPass, cloudflare.RadarEmailSecurityTopAseDkimGetParamsSpfNone, cloudflare.RadarEmailSecurityTopAseDkimGetParamsSpfFail}), + }, + ) + 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/radaremailsecuritytopasedmarc.go b/radaremailsecuritytopasedmarc.go new file mode 100644 index 00000000000..1745c6e4121 --- /dev/null +++ b/radaremailsecuritytopasedmarc.go @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopAseDmarcService 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 +// [NewRadarEmailSecurityTopAseDmarcService] method instead. +type RadarEmailSecurityTopAseDmarcService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopAseDmarcService 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 NewRadarEmailSecurityTopAseDmarcService(opts ...option.RequestOption) (r *RadarEmailSecurityTopAseDmarcService) { + r = &RadarEmailSecurityTopAseDmarcService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS) by emails DMARC validation. +func (r *RadarEmailSecurityTopAseDmarcService) Get(ctx context.Context, dmarc RadarEmailSecurityTopAseDmarcGetParamsDmarc, query RadarEmailSecurityTopAseDmarcGetParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopAseDmarcGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/ases/dmarc/%v", dmarc) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopAseDmarcGetResponse struct { + Result RadarEmailSecurityTopAseDmarcGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopAseDmarcGetResponseJSON `json:"-"` +} + +// radarEmailSecurityTopAseDmarcGetResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityTopAseDmarcGetResponse] +type radarEmailSecurityTopAseDmarcGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDmarcGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDmarcGetResponseResult struct { + Meta RadarEmailSecurityTopAseDmarcGetResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopAseDmarcGetResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopAseDmarcGetResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopAseDmarcGetResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseDmarcGetResponseResult] +type radarEmailSecurityTopAseDmarcGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDmarcGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDmarcGetResponseResultMeta struct { + DateRange []RadarEmailSecurityTopAseDmarcGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopAseDmarcGetResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopAseDmarcGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopAseDmarcGetResponseResultMeta] +type radarEmailSecurityTopAseDmarcGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDmarcGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDmarcGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopAseDmarcGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopAseDmarcGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopAseDmarcGetResponseResultMetaDateRange] +type radarEmailSecurityTopAseDmarcGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDmarcGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDmarcGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDmarcGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopAseDmarcGetResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopAseDmarcGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopAseDmarcGetResponseResultTop0] +type radarEmailSecurityTopAseDmarcGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseDmarcGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseDmarcGetParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopAseDmarcGetParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopAseDmarcGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopAseDmarcGetParamsDkim] `query:"dkim"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopAseDmarcGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopAseDmarcGetParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopAseDmarcGetParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecurityTopAseDmarcGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// DMARC. +type RadarEmailSecurityTopAseDmarcGetParamsDmarc string + +const ( + RadarEmailSecurityTopAseDmarcGetParamsDmarcPass RadarEmailSecurityTopAseDmarcGetParamsDmarc = "PASS" + RadarEmailSecurityTopAseDmarcGetParamsDmarcNone RadarEmailSecurityTopAseDmarcGetParamsDmarc = "NONE" + RadarEmailSecurityTopAseDmarcGetParamsDmarcFail RadarEmailSecurityTopAseDmarcGetParamsDmarc = "FAIL" +) + +type RadarEmailSecurityTopAseDmarcGetParamsArc string + +const ( + RadarEmailSecurityTopAseDmarcGetParamsArcPass RadarEmailSecurityTopAseDmarcGetParamsArc = "PASS" + RadarEmailSecurityTopAseDmarcGetParamsArcNone RadarEmailSecurityTopAseDmarcGetParamsArc = "NONE" + RadarEmailSecurityTopAseDmarcGetParamsArcFail RadarEmailSecurityTopAseDmarcGetParamsArc = "FAIL" +) + +type RadarEmailSecurityTopAseDmarcGetParamsDateRange string + +const ( + RadarEmailSecurityTopAseDmarcGetParamsDateRange1d RadarEmailSecurityTopAseDmarcGetParamsDateRange = "1d" + RadarEmailSecurityTopAseDmarcGetParamsDateRange2d RadarEmailSecurityTopAseDmarcGetParamsDateRange = "2d" + RadarEmailSecurityTopAseDmarcGetParamsDateRange7d RadarEmailSecurityTopAseDmarcGetParamsDateRange = "7d" + RadarEmailSecurityTopAseDmarcGetParamsDateRange14d RadarEmailSecurityTopAseDmarcGetParamsDateRange = "14d" + RadarEmailSecurityTopAseDmarcGetParamsDateRange28d RadarEmailSecurityTopAseDmarcGetParamsDateRange = "28d" + RadarEmailSecurityTopAseDmarcGetParamsDateRange12w RadarEmailSecurityTopAseDmarcGetParamsDateRange = "12w" + RadarEmailSecurityTopAseDmarcGetParamsDateRange24w RadarEmailSecurityTopAseDmarcGetParamsDateRange = "24w" + RadarEmailSecurityTopAseDmarcGetParamsDateRange52w RadarEmailSecurityTopAseDmarcGetParamsDateRange = "52w" + RadarEmailSecurityTopAseDmarcGetParamsDateRange1dControl RadarEmailSecurityTopAseDmarcGetParamsDateRange = "1dControl" + RadarEmailSecurityTopAseDmarcGetParamsDateRange2dControl RadarEmailSecurityTopAseDmarcGetParamsDateRange = "2dControl" + RadarEmailSecurityTopAseDmarcGetParamsDateRange7dControl RadarEmailSecurityTopAseDmarcGetParamsDateRange = "7dControl" + RadarEmailSecurityTopAseDmarcGetParamsDateRange14dControl RadarEmailSecurityTopAseDmarcGetParamsDateRange = "14dControl" + RadarEmailSecurityTopAseDmarcGetParamsDateRange28dControl RadarEmailSecurityTopAseDmarcGetParamsDateRange = "28dControl" + RadarEmailSecurityTopAseDmarcGetParamsDateRange12wControl RadarEmailSecurityTopAseDmarcGetParamsDateRange = "12wControl" + RadarEmailSecurityTopAseDmarcGetParamsDateRange24wControl RadarEmailSecurityTopAseDmarcGetParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopAseDmarcGetParamsDkim string + +const ( + RadarEmailSecurityTopAseDmarcGetParamsDkimPass RadarEmailSecurityTopAseDmarcGetParamsDkim = "PASS" + RadarEmailSecurityTopAseDmarcGetParamsDkimNone RadarEmailSecurityTopAseDmarcGetParamsDkim = "NONE" + RadarEmailSecurityTopAseDmarcGetParamsDkimFail RadarEmailSecurityTopAseDmarcGetParamsDkim = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopAseDmarcGetParamsFormat string + +const ( + RadarEmailSecurityTopAseDmarcGetParamsFormatJson RadarEmailSecurityTopAseDmarcGetParamsFormat = "JSON" + RadarEmailSecurityTopAseDmarcGetParamsFormatCsv RadarEmailSecurityTopAseDmarcGetParamsFormat = "CSV" +) + +type RadarEmailSecurityTopAseDmarcGetParamsSpf string + +const ( + RadarEmailSecurityTopAseDmarcGetParamsSpfPass RadarEmailSecurityTopAseDmarcGetParamsSpf = "PASS" + RadarEmailSecurityTopAseDmarcGetParamsSpfNone RadarEmailSecurityTopAseDmarcGetParamsSpf = "NONE" + RadarEmailSecurityTopAseDmarcGetParamsSpfFail RadarEmailSecurityTopAseDmarcGetParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytopasedmarc_test.go b/radaremailsecuritytopasedmarc_test.go new file mode 100644 index 00000000000..f199381d34c --- /dev/null +++ b/radaremailsecuritytopasedmarc_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopAseDmarcGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Ases.Dmarc.Get( + context.TODO(), + cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDmarcPass, + cloudflare.RadarEmailSecurityTopAseDmarcGetParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDmarcGetParamsArc{cloudflare.RadarEmailSecurityTopAseDmarcGetParamsArcPass, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsArcNone, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDateRange{cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDateRange1d, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDateRange2d, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDkim{cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDkimPass, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDkimNone, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsDkimFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopAseDmarcGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseDmarcGetParamsSpf{cloudflare.RadarEmailSecurityTopAseDmarcGetParamsSpfPass, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsSpfNone, cloudflare.RadarEmailSecurityTopAseDmarcGetParamsSpfFail}), + }, + ) + 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/radaremailsecuritytopasemalicious.go b/radaremailsecuritytopasemalicious.go new file mode 100644 index 00000000000..4b04b6bb655 --- /dev/null +++ b/radaremailsecuritytopasemalicious.go @@ -0,0 +1,305 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopAseMaliciousService 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 +// [NewRadarEmailSecurityTopAseMaliciousService] method instead. +type RadarEmailSecurityTopAseMaliciousService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopAseMaliciousService 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 NewRadarEmailSecurityTopAseMaliciousService(opts ...option.RequestOption) (r *RadarEmailSecurityTopAseMaliciousService) { + r = &RadarEmailSecurityTopAseMaliciousService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by emails classified as Malicious or not. +func (r *RadarEmailSecurityTopAseMaliciousService) Get(ctx context.Context, malicious RadarEmailSecurityTopAseMaliciousGetParamsMalicious, query RadarEmailSecurityTopAseMaliciousGetParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopAseMaliciousGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/ases/malicious/%v", malicious) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopAseMaliciousGetResponse struct { + Result RadarEmailSecurityTopAseMaliciousGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopAseMaliciousGetResponseJSON `json:"-"` +} + +// radarEmailSecurityTopAseMaliciousGetResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTopAseMaliciousGetResponse] +type radarEmailSecurityTopAseMaliciousGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseMaliciousGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseMaliciousGetResponseResult struct { + Meta RadarEmailSecurityTopAseMaliciousGetResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopAseMaliciousGetResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopAseMaliciousGetResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopAseMaliciousGetResponseResultJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopAseMaliciousGetResponseResult] +type radarEmailSecurityTopAseMaliciousGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseMaliciousGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseMaliciousGetResponseResultMeta struct { + DateRange []RadarEmailSecurityTopAseMaliciousGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopAseMaliciousGetResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopAseMaliciousGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopAseMaliciousGetResponseResultMeta] +type radarEmailSecurityTopAseMaliciousGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseMaliciousGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseMaliciousGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopAseMaliciousGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopAseMaliciousGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopAseMaliciousGetResponseResultMetaDateRange] +type radarEmailSecurityTopAseMaliciousGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseMaliciousGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseMaliciousGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseMaliciousGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopAseMaliciousGetResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopAseMaliciousGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopAseMaliciousGetResponseResultTop0] +type radarEmailSecurityTopAseMaliciousGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseMaliciousGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseMaliciousGetParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopAseMaliciousGetParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopAseMaliciousGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopAseMaliciousGetParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopAseMaliciousGetParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopAseMaliciousGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopAseMaliciousGetParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopAseMaliciousGetParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTopAseMaliciousGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Malicious. +type RadarEmailSecurityTopAseMaliciousGetParamsMalicious string + +const ( + RadarEmailSecurityTopAseMaliciousGetParamsMaliciousMalicious RadarEmailSecurityTopAseMaliciousGetParamsMalicious = "MALICIOUS" + RadarEmailSecurityTopAseMaliciousGetParamsMaliciousNotMalicious RadarEmailSecurityTopAseMaliciousGetParamsMalicious = "NOT_MALICIOUS" +) + +type RadarEmailSecurityTopAseMaliciousGetParamsArc string + +const ( + RadarEmailSecurityTopAseMaliciousGetParamsArcPass RadarEmailSecurityTopAseMaliciousGetParamsArc = "PASS" + RadarEmailSecurityTopAseMaliciousGetParamsArcNone RadarEmailSecurityTopAseMaliciousGetParamsArc = "NONE" + RadarEmailSecurityTopAseMaliciousGetParamsArcFail RadarEmailSecurityTopAseMaliciousGetParamsArc = "FAIL" +) + +type RadarEmailSecurityTopAseMaliciousGetParamsDateRange string + +const ( + RadarEmailSecurityTopAseMaliciousGetParamsDateRange1d RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "1d" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange2d RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "2d" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange7d RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "7d" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange14d RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "14d" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange28d RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "28d" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange12w RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "12w" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange24w RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "24w" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange52w RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "52w" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange1dControl RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "1dControl" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange2dControl RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "2dControl" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange7dControl RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "7dControl" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange14dControl RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "14dControl" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange28dControl RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "28dControl" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange12wControl RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "12wControl" + RadarEmailSecurityTopAseMaliciousGetParamsDateRange24wControl RadarEmailSecurityTopAseMaliciousGetParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopAseMaliciousGetParamsDkim string + +const ( + RadarEmailSecurityTopAseMaliciousGetParamsDkimPass RadarEmailSecurityTopAseMaliciousGetParamsDkim = "PASS" + RadarEmailSecurityTopAseMaliciousGetParamsDkimNone RadarEmailSecurityTopAseMaliciousGetParamsDkim = "NONE" + RadarEmailSecurityTopAseMaliciousGetParamsDkimFail RadarEmailSecurityTopAseMaliciousGetParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopAseMaliciousGetParamsDmarc string + +const ( + RadarEmailSecurityTopAseMaliciousGetParamsDmarcPass RadarEmailSecurityTopAseMaliciousGetParamsDmarc = "PASS" + RadarEmailSecurityTopAseMaliciousGetParamsDmarcNone RadarEmailSecurityTopAseMaliciousGetParamsDmarc = "NONE" + RadarEmailSecurityTopAseMaliciousGetParamsDmarcFail RadarEmailSecurityTopAseMaliciousGetParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopAseMaliciousGetParamsFormat string + +const ( + RadarEmailSecurityTopAseMaliciousGetParamsFormatJson RadarEmailSecurityTopAseMaliciousGetParamsFormat = "JSON" + RadarEmailSecurityTopAseMaliciousGetParamsFormatCsv RadarEmailSecurityTopAseMaliciousGetParamsFormat = "CSV" +) + +type RadarEmailSecurityTopAseMaliciousGetParamsSpf string + +const ( + RadarEmailSecurityTopAseMaliciousGetParamsSpfPass RadarEmailSecurityTopAseMaliciousGetParamsSpf = "PASS" + RadarEmailSecurityTopAseMaliciousGetParamsSpfNone RadarEmailSecurityTopAseMaliciousGetParamsSpf = "NONE" + RadarEmailSecurityTopAseMaliciousGetParamsSpfFail RadarEmailSecurityTopAseMaliciousGetParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytopasemalicious_test.go b/radaremailsecuritytopasemalicious_test.go new file mode 100644 index 00000000000..463ef2bf8d7 --- /dev/null +++ b/radaremailsecuritytopasemalicious_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopAseMaliciousGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Ases.Malicious.Get( + context.TODO(), + cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsMaliciousMalicious, + cloudflare.RadarEmailSecurityTopAseMaliciousGetParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsArc{cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsArcPass, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsArcNone, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDateRange{cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDateRange1d, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDateRange2d, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDkim{cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDkimPass, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDkimNone, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDmarc{cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDmarcPass, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDmarcNone, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsSpf{cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsSpfPass, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsSpfNone, cloudflare.RadarEmailSecurityTopAseMaliciousGetParamsSpfFail}), + }, + ) + 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/radaremailsecuritytopasespam.go b/radaremailsecuritytopasespam.go new file mode 100644 index 00000000000..1b20c03a36e --- /dev/null +++ b/radaremailsecuritytopasespam.go @@ -0,0 +1,305 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopAseSpamService 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 +// [NewRadarEmailSecurityTopAseSpamService] method instead. +type RadarEmailSecurityTopAseSpamService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopAseSpamService 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 NewRadarEmailSecurityTopAseSpamService(opts ...option.RequestOption) (r *RadarEmailSecurityTopAseSpamService) { + r = &RadarEmailSecurityTopAseSpamService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by emails classified, of Spam validations. +func (r *RadarEmailSecurityTopAseSpamService) Get(ctx context.Context, spam RadarEmailSecurityTopAseSpamGetParamsSpam, query RadarEmailSecurityTopAseSpamGetParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopAseSpamGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/ases/spam/%v", spam) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopAseSpamGetResponse struct { + Result RadarEmailSecurityTopAseSpamGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopAseSpamGetResponseJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpamGetResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityTopAseSpamGetResponse] +type radarEmailSecurityTopAseSpamGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpamGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpamGetResponseResult struct { + Meta RadarEmailSecurityTopAseSpamGetResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopAseSpamGetResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopAseSpamGetResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpamGetResponseResultJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTopAseSpamGetResponseResult] +type radarEmailSecurityTopAseSpamGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpamGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpamGetResponseResultMeta struct { + DateRange []RadarEmailSecurityTopAseSpamGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopAseSpamGetResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpamGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseSpamGetResponseResultMeta] +type radarEmailSecurityTopAseSpamGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpamGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpamGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopAseSpamGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpamGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopAseSpamGetResponseResultMetaDateRange] +type radarEmailSecurityTopAseSpamGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpamGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpamGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpamGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopAseSpamGetResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopAseSpamGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseSpamGetResponseResultTop0] +type radarEmailSecurityTopAseSpamGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpamGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpamGetParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopAseSpamGetParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopAseSpamGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopAseSpamGetParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopAseSpamGetParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopAseSpamGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopAseSpamGetParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopAseSpamGetParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecurityTopAseSpamGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Spam. +type RadarEmailSecurityTopAseSpamGetParamsSpam string + +const ( + RadarEmailSecurityTopAseSpamGetParamsSpamSpam RadarEmailSecurityTopAseSpamGetParamsSpam = "SPAM" + RadarEmailSecurityTopAseSpamGetParamsSpamNotSpam RadarEmailSecurityTopAseSpamGetParamsSpam = "NOT_SPAM" +) + +type RadarEmailSecurityTopAseSpamGetParamsArc string + +const ( + RadarEmailSecurityTopAseSpamGetParamsArcPass RadarEmailSecurityTopAseSpamGetParamsArc = "PASS" + RadarEmailSecurityTopAseSpamGetParamsArcNone RadarEmailSecurityTopAseSpamGetParamsArc = "NONE" + RadarEmailSecurityTopAseSpamGetParamsArcFail RadarEmailSecurityTopAseSpamGetParamsArc = "FAIL" +) + +type RadarEmailSecurityTopAseSpamGetParamsDateRange string + +const ( + RadarEmailSecurityTopAseSpamGetParamsDateRange1d RadarEmailSecurityTopAseSpamGetParamsDateRange = "1d" + RadarEmailSecurityTopAseSpamGetParamsDateRange2d RadarEmailSecurityTopAseSpamGetParamsDateRange = "2d" + RadarEmailSecurityTopAseSpamGetParamsDateRange7d RadarEmailSecurityTopAseSpamGetParamsDateRange = "7d" + RadarEmailSecurityTopAseSpamGetParamsDateRange14d RadarEmailSecurityTopAseSpamGetParamsDateRange = "14d" + RadarEmailSecurityTopAseSpamGetParamsDateRange28d RadarEmailSecurityTopAseSpamGetParamsDateRange = "28d" + RadarEmailSecurityTopAseSpamGetParamsDateRange12w RadarEmailSecurityTopAseSpamGetParamsDateRange = "12w" + RadarEmailSecurityTopAseSpamGetParamsDateRange24w RadarEmailSecurityTopAseSpamGetParamsDateRange = "24w" + RadarEmailSecurityTopAseSpamGetParamsDateRange52w RadarEmailSecurityTopAseSpamGetParamsDateRange = "52w" + RadarEmailSecurityTopAseSpamGetParamsDateRange1dControl RadarEmailSecurityTopAseSpamGetParamsDateRange = "1dControl" + RadarEmailSecurityTopAseSpamGetParamsDateRange2dControl RadarEmailSecurityTopAseSpamGetParamsDateRange = "2dControl" + RadarEmailSecurityTopAseSpamGetParamsDateRange7dControl RadarEmailSecurityTopAseSpamGetParamsDateRange = "7dControl" + RadarEmailSecurityTopAseSpamGetParamsDateRange14dControl RadarEmailSecurityTopAseSpamGetParamsDateRange = "14dControl" + RadarEmailSecurityTopAseSpamGetParamsDateRange28dControl RadarEmailSecurityTopAseSpamGetParamsDateRange = "28dControl" + RadarEmailSecurityTopAseSpamGetParamsDateRange12wControl RadarEmailSecurityTopAseSpamGetParamsDateRange = "12wControl" + RadarEmailSecurityTopAseSpamGetParamsDateRange24wControl RadarEmailSecurityTopAseSpamGetParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopAseSpamGetParamsDkim string + +const ( + RadarEmailSecurityTopAseSpamGetParamsDkimPass RadarEmailSecurityTopAseSpamGetParamsDkim = "PASS" + RadarEmailSecurityTopAseSpamGetParamsDkimNone RadarEmailSecurityTopAseSpamGetParamsDkim = "NONE" + RadarEmailSecurityTopAseSpamGetParamsDkimFail RadarEmailSecurityTopAseSpamGetParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopAseSpamGetParamsDmarc string + +const ( + RadarEmailSecurityTopAseSpamGetParamsDmarcPass RadarEmailSecurityTopAseSpamGetParamsDmarc = "PASS" + RadarEmailSecurityTopAseSpamGetParamsDmarcNone RadarEmailSecurityTopAseSpamGetParamsDmarc = "NONE" + RadarEmailSecurityTopAseSpamGetParamsDmarcFail RadarEmailSecurityTopAseSpamGetParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopAseSpamGetParamsFormat string + +const ( + RadarEmailSecurityTopAseSpamGetParamsFormatJson RadarEmailSecurityTopAseSpamGetParamsFormat = "JSON" + RadarEmailSecurityTopAseSpamGetParamsFormatCsv RadarEmailSecurityTopAseSpamGetParamsFormat = "CSV" +) + +type RadarEmailSecurityTopAseSpamGetParamsSpf string + +const ( + RadarEmailSecurityTopAseSpamGetParamsSpfPass RadarEmailSecurityTopAseSpamGetParamsSpf = "PASS" + RadarEmailSecurityTopAseSpamGetParamsSpfNone RadarEmailSecurityTopAseSpamGetParamsSpf = "NONE" + RadarEmailSecurityTopAseSpamGetParamsSpfFail RadarEmailSecurityTopAseSpamGetParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytopasespam_test.go b/radaremailsecuritytopasespam_test.go new file mode 100644 index 00000000000..c7e931332a5 --- /dev/null +++ b/radaremailsecuritytopasespam_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopAseSpamGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Ases.Spam.Get( + context.TODO(), + cloudflare.RadarEmailSecurityTopAseSpamGetParamsSpamSpam, + cloudflare.RadarEmailSecurityTopAseSpamGetParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpamGetParamsArc{cloudflare.RadarEmailSecurityTopAseSpamGetParamsArcPass, cloudflare.RadarEmailSecurityTopAseSpamGetParamsArcNone, cloudflare.RadarEmailSecurityTopAseSpamGetParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpamGetParamsDateRange{cloudflare.RadarEmailSecurityTopAseSpamGetParamsDateRange1d, cloudflare.RadarEmailSecurityTopAseSpamGetParamsDateRange2d, cloudflare.RadarEmailSecurityTopAseSpamGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpamGetParamsDkim{cloudflare.RadarEmailSecurityTopAseSpamGetParamsDkimPass, cloudflare.RadarEmailSecurityTopAseSpamGetParamsDkimNone, cloudflare.RadarEmailSecurityTopAseSpamGetParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpamGetParamsDmarc{cloudflare.RadarEmailSecurityTopAseSpamGetParamsDmarcPass, cloudflare.RadarEmailSecurityTopAseSpamGetParamsDmarcNone, cloudflare.RadarEmailSecurityTopAseSpamGetParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopAseSpamGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpamGetParamsSpf{cloudflare.RadarEmailSecurityTopAseSpamGetParamsSpfPass, cloudflare.RadarEmailSecurityTopAseSpamGetParamsSpfNone, cloudflare.RadarEmailSecurityTopAseSpamGetParamsSpfFail}), + }, + ) + 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/radaremailsecuritytopasespf.go b/radaremailsecuritytopasespf.go new file mode 100644 index 00000000000..b28eb8e5ee9 --- /dev/null +++ b/radaremailsecuritytopasespf.go @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopAseSpfService 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 +// [NewRadarEmailSecurityTopAseSpfService] method instead. +type RadarEmailSecurityTopAseSpfService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopAseSpfService 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 NewRadarEmailSecurityTopAseSpfService(opts ...option.RequestOption) (r *RadarEmailSecurityTopAseSpfService) { + r = &RadarEmailSecurityTopAseSpfService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS) by email SPF validation. +func (r *RadarEmailSecurityTopAseSpfService) Get(ctx context.Context, spf RadarEmailSecurityTopAseSpfGetParamsSpf, query RadarEmailSecurityTopAseSpfGetParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopAseSpfGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/ases/spf/%v", spf) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopAseSpfGetResponse struct { + Result RadarEmailSecurityTopAseSpfGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopAseSpfGetResponseJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpfGetResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityTopAseSpfGetResponse] +type radarEmailSecurityTopAseSpfGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpfGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpfGetResponseResult struct { + Meta RadarEmailSecurityTopAseSpfGetResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopAseSpfGetResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopAseSpfGetResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpfGetResponseResultJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTopAseSpfGetResponseResult] +type radarEmailSecurityTopAseSpfGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpfGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpfGetResponseResultMeta struct { + DateRange []RadarEmailSecurityTopAseSpfGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopAseSpfGetResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpfGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseSpfGetResponseResultMeta] +type radarEmailSecurityTopAseSpfGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpfGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpfGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopAseSpfGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpfGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopAseSpfGetResponseResultMetaDateRange] +type radarEmailSecurityTopAseSpfGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpfGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpfGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpfGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopAseSpfGetResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopAseSpfGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopAseSpfGetResponseResultTop0] +type radarEmailSecurityTopAseSpfGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopAseSpfGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopAseSpfGetParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopAseSpfGetParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopAseSpfGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopAseSpfGetParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopAseSpfGetParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopAseSpfGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarEmailSecurityTopAseSpfGetParams]'s query parameters as +// `url.Values`. +func (r RadarEmailSecurityTopAseSpfGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// SPF. +type RadarEmailSecurityTopAseSpfGetParamsSpf string + +const ( + RadarEmailSecurityTopAseSpfGetParamsSpfPass RadarEmailSecurityTopAseSpfGetParamsSpf = "PASS" + RadarEmailSecurityTopAseSpfGetParamsSpfNone RadarEmailSecurityTopAseSpfGetParamsSpf = "NONE" + RadarEmailSecurityTopAseSpfGetParamsSpfFail RadarEmailSecurityTopAseSpfGetParamsSpf = "FAIL" +) + +type RadarEmailSecurityTopAseSpfGetParamsArc string + +const ( + RadarEmailSecurityTopAseSpfGetParamsArcPass RadarEmailSecurityTopAseSpfGetParamsArc = "PASS" + RadarEmailSecurityTopAseSpfGetParamsArcNone RadarEmailSecurityTopAseSpfGetParamsArc = "NONE" + RadarEmailSecurityTopAseSpfGetParamsArcFail RadarEmailSecurityTopAseSpfGetParamsArc = "FAIL" +) + +type RadarEmailSecurityTopAseSpfGetParamsDateRange string + +const ( + RadarEmailSecurityTopAseSpfGetParamsDateRange1d RadarEmailSecurityTopAseSpfGetParamsDateRange = "1d" + RadarEmailSecurityTopAseSpfGetParamsDateRange2d RadarEmailSecurityTopAseSpfGetParamsDateRange = "2d" + RadarEmailSecurityTopAseSpfGetParamsDateRange7d RadarEmailSecurityTopAseSpfGetParamsDateRange = "7d" + RadarEmailSecurityTopAseSpfGetParamsDateRange14d RadarEmailSecurityTopAseSpfGetParamsDateRange = "14d" + RadarEmailSecurityTopAseSpfGetParamsDateRange28d RadarEmailSecurityTopAseSpfGetParamsDateRange = "28d" + RadarEmailSecurityTopAseSpfGetParamsDateRange12w RadarEmailSecurityTopAseSpfGetParamsDateRange = "12w" + RadarEmailSecurityTopAseSpfGetParamsDateRange24w RadarEmailSecurityTopAseSpfGetParamsDateRange = "24w" + RadarEmailSecurityTopAseSpfGetParamsDateRange52w RadarEmailSecurityTopAseSpfGetParamsDateRange = "52w" + RadarEmailSecurityTopAseSpfGetParamsDateRange1dControl RadarEmailSecurityTopAseSpfGetParamsDateRange = "1dControl" + RadarEmailSecurityTopAseSpfGetParamsDateRange2dControl RadarEmailSecurityTopAseSpfGetParamsDateRange = "2dControl" + RadarEmailSecurityTopAseSpfGetParamsDateRange7dControl RadarEmailSecurityTopAseSpfGetParamsDateRange = "7dControl" + RadarEmailSecurityTopAseSpfGetParamsDateRange14dControl RadarEmailSecurityTopAseSpfGetParamsDateRange = "14dControl" + RadarEmailSecurityTopAseSpfGetParamsDateRange28dControl RadarEmailSecurityTopAseSpfGetParamsDateRange = "28dControl" + RadarEmailSecurityTopAseSpfGetParamsDateRange12wControl RadarEmailSecurityTopAseSpfGetParamsDateRange = "12wControl" + RadarEmailSecurityTopAseSpfGetParamsDateRange24wControl RadarEmailSecurityTopAseSpfGetParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopAseSpfGetParamsDkim string + +const ( + RadarEmailSecurityTopAseSpfGetParamsDkimPass RadarEmailSecurityTopAseSpfGetParamsDkim = "PASS" + RadarEmailSecurityTopAseSpfGetParamsDkimNone RadarEmailSecurityTopAseSpfGetParamsDkim = "NONE" + RadarEmailSecurityTopAseSpfGetParamsDkimFail RadarEmailSecurityTopAseSpfGetParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopAseSpfGetParamsDmarc string + +const ( + RadarEmailSecurityTopAseSpfGetParamsDmarcPass RadarEmailSecurityTopAseSpfGetParamsDmarc = "PASS" + RadarEmailSecurityTopAseSpfGetParamsDmarcNone RadarEmailSecurityTopAseSpfGetParamsDmarc = "NONE" + RadarEmailSecurityTopAseSpfGetParamsDmarcFail RadarEmailSecurityTopAseSpfGetParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopAseSpfGetParamsFormat string + +const ( + RadarEmailSecurityTopAseSpfGetParamsFormatJson RadarEmailSecurityTopAseSpfGetParamsFormat = "JSON" + RadarEmailSecurityTopAseSpfGetParamsFormatCsv RadarEmailSecurityTopAseSpfGetParamsFormat = "CSV" +) diff --git a/radaremailsecuritytopasespf_test.go b/radaremailsecuritytopasespf_test.go new file mode 100644 index 00000000000..5f20f5ebabc --- /dev/null +++ b/radaremailsecuritytopasespf_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopAseSpfGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Ases.Spf.Get( + context.TODO(), + cloudflare.RadarEmailSecurityTopAseSpfGetParamsSpfPass, + cloudflare.RadarEmailSecurityTopAseSpfGetParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpfGetParamsArc{cloudflare.RadarEmailSecurityTopAseSpfGetParamsArcPass, cloudflare.RadarEmailSecurityTopAseSpfGetParamsArcNone, cloudflare.RadarEmailSecurityTopAseSpfGetParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpfGetParamsDateRange{cloudflare.RadarEmailSecurityTopAseSpfGetParamsDateRange1d, cloudflare.RadarEmailSecurityTopAseSpfGetParamsDateRange2d, cloudflare.RadarEmailSecurityTopAseSpfGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpfGetParamsDkim{cloudflare.RadarEmailSecurityTopAseSpfGetParamsDkimPass, cloudflare.RadarEmailSecurityTopAseSpfGetParamsDkimNone, cloudflare.RadarEmailSecurityTopAseSpfGetParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopAseSpfGetParamsDmarc{cloudflare.RadarEmailSecurityTopAseSpfGetParamsDmarcPass, cloudflare.RadarEmailSecurityTopAseSpfGetParamsDmarcNone, cloudflare.RadarEmailSecurityTopAseSpfGetParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopAseSpfGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/radaremailsecuritytoplocation.go b/radaremailsecuritytoplocation.go new file mode 100644 index 00000000000..4a5b323bcf4 --- /dev/null +++ b/radaremailsecuritytoplocation.go @@ -0,0 +1,309 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopLocationService 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 +// [NewRadarEmailSecurityTopLocationService] method instead. +type RadarEmailSecurityTopLocationService struct { + Options []option.RequestOption + Arc *RadarEmailSecurityTopLocationArcService + ByDkim *RadarEmailSecurityTopLocationByDkimService + ByDmarc *RadarEmailSecurityTopLocationByDmarcService + ByMalicious *RadarEmailSecurityTopLocationByMaliciousService + BySpam *RadarEmailSecurityTopLocationBySpamService + BySpf *RadarEmailSecurityTopLocationBySpfService +} + +// NewRadarEmailSecurityTopLocationService 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 NewRadarEmailSecurityTopLocationService(opts ...option.RequestOption) (r *RadarEmailSecurityTopLocationService) { + r = &RadarEmailSecurityTopLocationService{} + r.Options = opts + r.Arc = NewRadarEmailSecurityTopLocationArcService(opts...) + r.ByDkim = NewRadarEmailSecurityTopLocationByDkimService(opts...) + r.ByDmarc = NewRadarEmailSecurityTopLocationByDmarcService(opts...) + r.ByMalicious = NewRadarEmailSecurityTopLocationByMaliciousService(opts...) + r.BySpam = NewRadarEmailSecurityTopLocationBySpamService(opts...) + r.BySpf = NewRadarEmailSecurityTopLocationBySpfService(opts...) + return +} + +// Get the top locations by email messages. Values are a percentage out of the +// total emails. +func (r *RadarEmailSecurityTopLocationService) List(ctx context.Context, query RadarEmailSecurityTopLocationListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/email/security/top/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopLocationListResponse struct { + Result RadarEmailSecurityTopLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopLocationListResponseJSON `json:"-"` +} + +// radarEmailSecurityTopLocationListResponseJSON contains the JSON metadata for the +// struct [RadarEmailSecurityTopLocationListResponse] +type radarEmailSecurityTopLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationListResponseResult struct { + Meta RadarEmailSecurityTopLocationListResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopLocationListResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopLocationListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopLocationListResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopLocationListResponseResult] +type radarEmailSecurityTopLocationListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationListResponseResultMeta struct { + DateRange []RadarEmailSecurityTopLocationListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopLocationListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopLocationListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationListResponseResultMeta] +type radarEmailSecurityTopLocationListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopLocationListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopLocationListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopLocationListResponseResultMetaDateRange] +type radarEmailSecurityTopLocationListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopLocationListResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopLocationListResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationListResponseResultTop0] +type radarEmailSecurityTopLocationListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopLocationListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopLocationListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopLocationListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopLocationListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopLocationListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopLocationListParams]'s query parameters +// as `url.Values`. +func (r RadarEmailSecurityTopLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarEmailSecurityTopLocationListParamsArc string + +const ( + RadarEmailSecurityTopLocationListParamsArcPass RadarEmailSecurityTopLocationListParamsArc = "PASS" + RadarEmailSecurityTopLocationListParamsArcNone RadarEmailSecurityTopLocationListParamsArc = "NONE" + RadarEmailSecurityTopLocationListParamsArcFail RadarEmailSecurityTopLocationListParamsArc = "FAIL" +) + +type RadarEmailSecurityTopLocationListParamsDateRange string + +const ( + RadarEmailSecurityTopLocationListParamsDateRange1d RadarEmailSecurityTopLocationListParamsDateRange = "1d" + RadarEmailSecurityTopLocationListParamsDateRange2d RadarEmailSecurityTopLocationListParamsDateRange = "2d" + RadarEmailSecurityTopLocationListParamsDateRange7d RadarEmailSecurityTopLocationListParamsDateRange = "7d" + RadarEmailSecurityTopLocationListParamsDateRange14d RadarEmailSecurityTopLocationListParamsDateRange = "14d" + RadarEmailSecurityTopLocationListParamsDateRange28d RadarEmailSecurityTopLocationListParamsDateRange = "28d" + RadarEmailSecurityTopLocationListParamsDateRange12w RadarEmailSecurityTopLocationListParamsDateRange = "12w" + RadarEmailSecurityTopLocationListParamsDateRange24w RadarEmailSecurityTopLocationListParamsDateRange = "24w" + RadarEmailSecurityTopLocationListParamsDateRange52w RadarEmailSecurityTopLocationListParamsDateRange = "52w" + RadarEmailSecurityTopLocationListParamsDateRange1dControl RadarEmailSecurityTopLocationListParamsDateRange = "1dControl" + RadarEmailSecurityTopLocationListParamsDateRange2dControl RadarEmailSecurityTopLocationListParamsDateRange = "2dControl" + RadarEmailSecurityTopLocationListParamsDateRange7dControl RadarEmailSecurityTopLocationListParamsDateRange = "7dControl" + RadarEmailSecurityTopLocationListParamsDateRange14dControl RadarEmailSecurityTopLocationListParamsDateRange = "14dControl" + RadarEmailSecurityTopLocationListParamsDateRange28dControl RadarEmailSecurityTopLocationListParamsDateRange = "28dControl" + RadarEmailSecurityTopLocationListParamsDateRange12wControl RadarEmailSecurityTopLocationListParamsDateRange = "12wControl" + RadarEmailSecurityTopLocationListParamsDateRange24wControl RadarEmailSecurityTopLocationListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopLocationListParamsDkim string + +const ( + RadarEmailSecurityTopLocationListParamsDkimPass RadarEmailSecurityTopLocationListParamsDkim = "PASS" + RadarEmailSecurityTopLocationListParamsDkimNone RadarEmailSecurityTopLocationListParamsDkim = "NONE" + RadarEmailSecurityTopLocationListParamsDkimFail RadarEmailSecurityTopLocationListParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopLocationListParamsDmarc string + +const ( + RadarEmailSecurityTopLocationListParamsDmarcPass RadarEmailSecurityTopLocationListParamsDmarc = "PASS" + RadarEmailSecurityTopLocationListParamsDmarcNone RadarEmailSecurityTopLocationListParamsDmarc = "NONE" + RadarEmailSecurityTopLocationListParamsDmarcFail RadarEmailSecurityTopLocationListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopLocationListParamsFormat string + +const ( + RadarEmailSecurityTopLocationListParamsFormatJson RadarEmailSecurityTopLocationListParamsFormat = "JSON" + RadarEmailSecurityTopLocationListParamsFormatCsv RadarEmailSecurityTopLocationListParamsFormat = "CSV" +) + +type RadarEmailSecurityTopLocationListParamsSpf string + +const ( + RadarEmailSecurityTopLocationListParamsSpfPass RadarEmailSecurityTopLocationListParamsSpf = "PASS" + RadarEmailSecurityTopLocationListParamsSpfNone RadarEmailSecurityTopLocationListParamsSpf = "NONE" + RadarEmailSecurityTopLocationListParamsSpfFail RadarEmailSecurityTopLocationListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytoplocation_test.go b/radaremailsecuritytoplocation_test.go new file mode 100644 index 00000000000..ed015adb7ac --- /dev/null +++ b/radaremailsecuritytoplocation_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Locations.List(context.TODO(), cloudflare.RadarEmailSecurityTopLocationListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationListParamsArc{cloudflare.RadarEmailSecurityTopLocationListParamsArcPass, cloudflare.RadarEmailSecurityTopLocationListParamsArcNone, cloudflare.RadarEmailSecurityTopLocationListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationListParamsDateRange{cloudflare.RadarEmailSecurityTopLocationListParamsDateRange1d, cloudflare.RadarEmailSecurityTopLocationListParamsDateRange2d, cloudflare.RadarEmailSecurityTopLocationListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationListParamsDkim{cloudflare.RadarEmailSecurityTopLocationListParamsDkimPass, cloudflare.RadarEmailSecurityTopLocationListParamsDkimNone, cloudflare.RadarEmailSecurityTopLocationListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationListParamsDmarc{cloudflare.RadarEmailSecurityTopLocationListParamsDmarcPass, cloudflare.RadarEmailSecurityTopLocationListParamsDmarcNone, cloudflare.RadarEmailSecurityTopLocationListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationListParamsSpf{cloudflare.RadarEmailSecurityTopLocationListParamsSpfPass, cloudflare.RadarEmailSecurityTopLocationListParamsSpfNone, cloudflare.RadarEmailSecurityTopLocationListParamsSpfFail}), + }) + 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/radaremailsecuritytoplocationarc.go b/radaremailsecuritytoplocationarc.go new file mode 100644 index 00000000000..bcb2f2e1f34 --- /dev/null +++ b/radaremailsecuritytoplocationarc.go @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopLocationArcService 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 +// [NewRadarEmailSecurityTopLocationArcService] method instead. +type RadarEmailSecurityTopLocationArcService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopLocationArcService 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 NewRadarEmailSecurityTopLocationArcService(opts ...option.RequestOption) (r *RadarEmailSecurityTopLocationArcService) { + r = &RadarEmailSecurityTopLocationArcService{} + r.Options = opts + return +} + +// Get the locations, by emails ARC validation. +func (r *RadarEmailSecurityTopLocationArcService) Get(ctx context.Context, arc RadarEmailSecurityTopLocationArcGetParamsArc, query RadarEmailSecurityTopLocationArcGetParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopLocationArcGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/locations/arc/%v", arc) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopLocationArcGetResponse struct { + Result RadarEmailSecurityTopLocationArcGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopLocationArcGetResponseJSON `json:"-"` +} + +// radarEmailSecurityTopLocationArcGetResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTopLocationArcGetResponse] +type radarEmailSecurityTopLocationArcGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationArcGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationArcGetResponseResult struct { + Meta RadarEmailSecurityTopLocationArcGetResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopLocationArcGetResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopLocationArcGetResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopLocationArcGetResponseResultJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopLocationArcGetResponseResult] +type radarEmailSecurityTopLocationArcGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationArcGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationArcGetResponseResultMeta struct { + DateRange []RadarEmailSecurityTopLocationArcGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopLocationArcGetResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopLocationArcGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationArcGetResponseResultMeta] +type radarEmailSecurityTopLocationArcGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationArcGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationArcGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopLocationArcGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopLocationArcGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopLocationArcGetResponseResultMetaDateRange] +type radarEmailSecurityTopLocationArcGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationArcGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationArcGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationArcGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopLocationArcGetResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopLocationArcGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationArcGetResponseResultTop0] +type radarEmailSecurityTopLocationArcGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationArcGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationArcGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopLocationArcGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopLocationArcGetParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopLocationArcGetParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopLocationArcGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopLocationArcGetParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopLocationArcGetParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTopLocationArcGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// ARC. +type RadarEmailSecurityTopLocationArcGetParamsArc string + +const ( + RadarEmailSecurityTopLocationArcGetParamsArcPass RadarEmailSecurityTopLocationArcGetParamsArc = "PASS" + RadarEmailSecurityTopLocationArcGetParamsArcNone RadarEmailSecurityTopLocationArcGetParamsArc = "NONE" + RadarEmailSecurityTopLocationArcGetParamsArcFail RadarEmailSecurityTopLocationArcGetParamsArc = "FAIL" +) + +type RadarEmailSecurityTopLocationArcGetParamsDateRange string + +const ( + RadarEmailSecurityTopLocationArcGetParamsDateRange1d RadarEmailSecurityTopLocationArcGetParamsDateRange = "1d" + RadarEmailSecurityTopLocationArcGetParamsDateRange2d RadarEmailSecurityTopLocationArcGetParamsDateRange = "2d" + RadarEmailSecurityTopLocationArcGetParamsDateRange7d RadarEmailSecurityTopLocationArcGetParamsDateRange = "7d" + RadarEmailSecurityTopLocationArcGetParamsDateRange14d RadarEmailSecurityTopLocationArcGetParamsDateRange = "14d" + RadarEmailSecurityTopLocationArcGetParamsDateRange28d RadarEmailSecurityTopLocationArcGetParamsDateRange = "28d" + RadarEmailSecurityTopLocationArcGetParamsDateRange12w RadarEmailSecurityTopLocationArcGetParamsDateRange = "12w" + RadarEmailSecurityTopLocationArcGetParamsDateRange24w RadarEmailSecurityTopLocationArcGetParamsDateRange = "24w" + RadarEmailSecurityTopLocationArcGetParamsDateRange52w RadarEmailSecurityTopLocationArcGetParamsDateRange = "52w" + RadarEmailSecurityTopLocationArcGetParamsDateRange1dControl RadarEmailSecurityTopLocationArcGetParamsDateRange = "1dControl" + RadarEmailSecurityTopLocationArcGetParamsDateRange2dControl RadarEmailSecurityTopLocationArcGetParamsDateRange = "2dControl" + RadarEmailSecurityTopLocationArcGetParamsDateRange7dControl RadarEmailSecurityTopLocationArcGetParamsDateRange = "7dControl" + RadarEmailSecurityTopLocationArcGetParamsDateRange14dControl RadarEmailSecurityTopLocationArcGetParamsDateRange = "14dControl" + RadarEmailSecurityTopLocationArcGetParamsDateRange28dControl RadarEmailSecurityTopLocationArcGetParamsDateRange = "28dControl" + RadarEmailSecurityTopLocationArcGetParamsDateRange12wControl RadarEmailSecurityTopLocationArcGetParamsDateRange = "12wControl" + RadarEmailSecurityTopLocationArcGetParamsDateRange24wControl RadarEmailSecurityTopLocationArcGetParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopLocationArcGetParamsDkim string + +const ( + RadarEmailSecurityTopLocationArcGetParamsDkimPass RadarEmailSecurityTopLocationArcGetParamsDkim = "PASS" + RadarEmailSecurityTopLocationArcGetParamsDkimNone RadarEmailSecurityTopLocationArcGetParamsDkim = "NONE" + RadarEmailSecurityTopLocationArcGetParamsDkimFail RadarEmailSecurityTopLocationArcGetParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopLocationArcGetParamsDmarc string + +const ( + RadarEmailSecurityTopLocationArcGetParamsDmarcPass RadarEmailSecurityTopLocationArcGetParamsDmarc = "PASS" + RadarEmailSecurityTopLocationArcGetParamsDmarcNone RadarEmailSecurityTopLocationArcGetParamsDmarc = "NONE" + RadarEmailSecurityTopLocationArcGetParamsDmarcFail RadarEmailSecurityTopLocationArcGetParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopLocationArcGetParamsFormat string + +const ( + RadarEmailSecurityTopLocationArcGetParamsFormatJson RadarEmailSecurityTopLocationArcGetParamsFormat = "JSON" + RadarEmailSecurityTopLocationArcGetParamsFormatCsv RadarEmailSecurityTopLocationArcGetParamsFormat = "CSV" +) + +type RadarEmailSecurityTopLocationArcGetParamsSpf string + +const ( + RadarEmailSecurityTopLocationArcGetParamsSpfPass RadarEmailSecurityTopLocationArcGetParamsSpf = "PASS" + RadarEmailSecurityTopLocationArcGetParamsSpfNone RadarEmailSecurityTopLocationArcGetParamsSpf = "NONE" + RadarEmailSecurityTopLocationArcGetParamsSpfFail RadarEmailSecurityTopLocationArcGetParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytoplocationarc_test.go b/radaremailsecuritytoplocationarc_test.go new file mode 100644 index 00000000000..45180c797e5 --- /dev/null +++ b/radaremailsecuritytoplocationarc_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopLocationArcGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Locations.Arc.Get( + context.TODO(), + cloudflare.RadarEmailSecurityTopLocationArcGetParamsArcPass, + cloudflare.RadarEmailSecurityTopLocationArcGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationArcGetParamsDateRange{cloudflare.RadarEmailSecurityTopLocationArcGetParamsDateRange1d, cloudflare.RadarEmailSecurityTopLocationArcGetParamsDateRange2d, cloudflare.RadarEmailSecurityTopLocationArcGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationArcGetParamsDkim{cloudflare.RadarEmailSecurityTopLocationArcGetParamsDkimPass, cloudflare.RadarEmailSecurityTopLocationArcGetParamsDkimNone, cloudflare.RadarEmailSecurityTopLocationArcGetParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationArcGetParamsDmarc{cloudflare.RadarEmailSecurityTopLocationArcGetParamsDmarcPass, cloudflare.RadarEmailSecurityTopLocationArcGetParamsDmarcNone, cloudflare.RadarEmailSecurityTopLocationArcGetParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopLocationArcGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationArcGetParamsSpf{cloudflare.RadarEmailSecurityTopLocationArcGetParamsSpfPass, cloudflare.RadarEmailSecurityTopLocationArcGetParamsSpfNone, cloudflare.RadarEmailSecurityTopLocationArcGetParamsSpfFail}), + }, + ) + 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/radaremailsecuritytoplocationbydkim.go b/radaremailsecuritytoplocationbydkim.go new file mode 100644 index 00000000000..1e7db36ff58 --- /dev/null +++ b/radaremailsecuritytoplocationbydkim.go @@ -0,0 +1,299 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopLocationByDkimService 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 +// [NewRadarEmailSecurityTopLocationByDkimService] method instead. +type RadarEmailSecurityTopLocationByDkimService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopLocationByDkimService 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 NewRadarEmailSecurityTopLocationByDkimService(opts ...option.RequestOption) (r *RadarEmailSecurityTopLocationByDkimService) { + r = &RadarEmailSecurityTopLocationByDkimService{} + r.Options = opts + return +} + +// Get the locations, by email DKIM validation. +func (r *RadarEmailSecurityTopLocationByDkimService) List(ctx context.Context, dkim RadarEmailSecurityTopLocationByDkimListParamsDkim, query RadarEmailSecurityTopLocationByDkimListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopLocationByDkimListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/locations/dkim/%v", dkim) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopLocationByDkimListResponse struct { + Result RadarEmailSecurityTopLocationByDkimListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopLocationByDkimListResponseJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDkimListResponseJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopLocationByDkimListResponse] +type radarEmailSecurityTopLocationByDkimListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDkimListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDkimListResponseResult struct { + Meta RadarEmailSecurityTopLocationByDkimListResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopLocationByDkimListResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopLocationByDkimListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDkimListResponseResultJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationByDkimListResponseResult] +type radarEmailSecurityTopLocationByDkimListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDkimListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDkimListResponseResultMeta struct { + DateRange []RadarEmailSecurityTopLocationByDkimListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopLocationByDkimListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDkimListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationByDkimListResponseResultMeta] +type radarEmailSecurityTopLocationByDkimListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDkimListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDkimListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopLocationByDkimListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDkimListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByDkimListResponseResultMetaDateRange] +type radarEmailSecurityTopLocationByDkimListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDkimListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDkimListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDkimListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopLocationByDkimListResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDkimListResponseResultTop0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationByDkimListResponseResultTop0] +type radarEmailSecurityTopLocationByDkimListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDkimListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDkimListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopLocationByDkimListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopLocationByDkimListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopLocationByDkimListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopLocationByDkimListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopLocationByDkimListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopLocationByDkimListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTopLocationByDkimListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// DKIM. +type RadarEmailSecurityTopLocationByDkimListParamsDkim string + +const ( + RadarEmailSecurityTopLocationByDkimListParamsDkimPass RadarEmailSecurityTopLocationByDkimListParamsDkim = "PASS" + RadarEmailSecurityTopLocationByDkimListParamsDkimNone RadarEmailSecurityTopLocationByDkimListParamsDkim = "NONE" + RadarEmailSecurityTopLocationByDkimListParamsDkimFail RadarEmailSecurityTopLocationByDkimListParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopLocationByDkimListParamsArc string + +const ( + RadarEmailSecurityTopLocationByDkimListParamsArcPass RadarEmailSecurityTopLocationByDkimListParamsArc = "PASS" + RadarEmailSecurityTopLocationByDkimListParamsArcNone RadarEmailSecurityTopLocationByDkimListParamsArc = "NONE" + RadarEmailSecurityTopLocationByDkimListParamsArcFail RadarEmailSecurityTopLocationByDkimListParamsArc = "FAIL" +) + +type RadarEmailSecurityTopLocationByDkimListParamsDateRange string + +const ( + RadarEmailSecurityTopLocationByDkimListParamsDateRange1d RadarEmailSecurityTopLocationByDkimListParamsDateRange = "1d" + RadarEmailSecurityTopLocationByDkimListParamsDateRange2d RadarEmailSecurityTopLocationByDkimListParamsDateRange = "2d" + RadarEmailSecurityTopLocationByDkimListParamsDateRange7d RadarEmailSecurityTopLocationByDkimListParamsDateRange = "7d" + RadarEmailSecurityTopLocationByDkimListParamsDateRange14d RadarEmailSecurityTopLocationByDkimListParamsDateRange = "14d" + RadarEmailSecurityTopLocationByDkimListParamsDateRange28d RadarEmailSecurityTopLocationByDkimListParamsDateRange = "28d" + RadarEmailSecurityTopLocationByDkimListParamsDateRange12w RadarEmailSecurityTopLocationByDkimListParamsDateRange = "12w" + RadarEmailSecurityTopLocationByDkimListParamsDateRange24w RadarEmailSecurityTopLocationByDkimListParamsDateRange = "24w" + RadarEmailSecurityTopLocationByDkimListParamsDateRange52w RadarEmailSecurityTopLocationByDkimListParamsDateRange = "52w" + RadarEmailSecurityTopLocationByDkimListParamsDateRange1dControl RadarEmailSecurityTopLocationByDkimListParamsDateRange = "1dControl" + RadarEmailSecurityTopLocationByDkimListParamsDateRange2dControl RadarEmailSecurityTopLocationByDkimListParamsDateRange = "2dControl" + RadarEmailSecurityTopLocationByDkimListParamsDateRange7dControl RadarEmailSecurityTopLocationByDkimListParamsDateRange = "7dControl" + RadarEmailSecurityTopLocationByDkimListParamsDateRange14dControl RadarEmailSecurityTopLocationByDkimListParamsDateRange = "14dControl" + RadarEmailSecurityTopLocationByDkimListParamsDateRange28dControl RadarEmailSecurityTopLocationByDkimListParamsDateRange = "28dControl" + RadarEmailSecurityTopLocationByDkimListParamsDateRange12wControl RadarEmailSecurityTopLocationByDkimListParamsDateRange = "12wControl" + RadarEmailSecurityTopLocationByDkimListParamsDateRange24wControl RadarEmailSecurityTopLocationByDkimListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopLocationByDkimListParamsDmarc string + +const ( + RadarEmailSecurityTopLocationByDkimListParamsDmarcPass RadarEmailSecurityTopLocationByDkimListParamsDmarc = "PASS" + RadarEmailSecurityTopLocationByDkimListParamsDmarcNone RadarEmailSecurityTopLocationByDkimListParamsDmarc = "NONE" + RadarEmailSecurityTopLocationByDkimListParamsDmarcFail RadarEmailSecurityTopLocationByDkimListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopLocationByDkimListParamsFormat string + +const ( + RadarEmailSecurityTopLocationByDkimListParamsFormatJson RadarEmailSecurityTopLocationByDkimListParamsFormat = "JSON" + RadarEmailSecurityTopLocationByDkimListParamsFormatCsv RadarEmailSecurityTopLocationByDkimListParamsFormat = "CSV" +) + +type RadarEmailSecurityTopLocationByDkimListParamsSpf string + +const ( + RadarEmailSecurityTopLocationByDkimListParamsSpfPass RadarEmailSecurityTopLocationByDkimListParamsSpf = "PASS" + RadarEmailSecurityTopLocationByDkimListParamsSpfNone RadarEmailSecurityTopLocationByDkimListParamsSpf = "NONE" + RadarEmailSecurityTopLocationByDkimListParamsSpfFail RadarEmailSecurityTopLocationByDkimListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytoplocationbydkim_test.go b/radaremailsecuritytoplocationbydkim_test.go new file mode 100644 index 00000000000..bbb2db3df2e --- /dev/null +++ b/radaremailsecuritytoplocationbydkim_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopLocationByDkimListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Locations.ByDkim.List( + context.TODO(), + cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDkimPass, + cloudflare.RadarEmailSecurityTopLocationByDkimListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDkimListParamsArc{cloudflare.RadarEmailSecurityTopLocationByDkimListParamsArcPass, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsArcNone, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDateRange{cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDateRange1d, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDateRange2d, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDmarc{cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDmarcPass, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDmarcNone, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopLocationByDkimListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDkimListParamsSpf{cloudflare.RadarEmailSecurityTopLocationByDkimListParamsSpfPass, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsSpfNone, cloudflare.RadarEmailSecurityTopLocationByDkimListParamsSpfFail}), + }, + ) + 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/radaremailsecuritytoplocationbydmarc.go b/radaremailsecuritytoplocationbydmarc.go new file mode 100644 index 00000000000..8d330a4a6b0 --- /dev/null +++ b/radaremailsecuritytoplocationbydmarc.go @@ -0,0 +1,299 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopLocationByDmarcService 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 +// [NewRadarEmailSecurityTopLocationByDmarcService] method instead. +type RadarEmailSecurityTopLocationByDmarcService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopLocationByDmarcService 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 NewRadarEmailSecurityTopLocationByDmarcService(opts ...option.RequestOption) (r *RadarEmailSecurityTopLocationByDmarcService) { + r = &RadarEmailSecurityTopLocationByDmarcService{} + r.Options = opts + return +} + +// Get the locations by email DMARC validation. +func (r *RadarEmailSecurityTopLocationByDmarcService) List(ctx context.Context, dmarc RadarEmailSecurityTopLocationByDmarcListParamsDmarc, query RadarEmailSecurityTopLocationByDmarcListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopLocationByDmarcListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/locations/dmarc/%v", dmarc) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopLocationByDmarcListResponse struct { + Result RadarEmailSecurityTopLocationByDmarcListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopLocationByDmarcListResponseJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDmarcListResponseJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopLocationByDmarcListResponse] +type radarEmailSecurityTopLocationByDmarcListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDmarcListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDmarcListResponseResult struct { + Meta RadarEmailSecurityTopLocationByDmarcListResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopLocationByDmarcListResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopLocationByDmarcListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDmarcListResponseResultJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationByDmarcListResponseResult] +type radarEmailSecurityTopLocationByDmarcListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDmarcListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDmarcListResponseResultMeta struct { + DateRange []RadarEmailSecurityTopLocationByDmarcListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopLocationByDmarcListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDmarcListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationByDmarcListResponseResultMeta] +type radarEmailSecurityTopLocationByDmarcListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDmarcListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDmarcListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopLocationByDmarcListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDmarcListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByDmarcListResponseResultMetaDateRange] +type radarEmailSecurityTopLocationByDmarcListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDmarcListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDmarcListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDmarcListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopLocationByDmarcListResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopLocationByDmarcListResponseResultTop0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationByDmarcListResponseResultTop0] +type radarEmailSecurityTopLocationByDmarcListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByDmarcListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByDmarcListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopLocationByDmarcListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopLocationByDmarcListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopLocationByDmarcListParamsDkim] `query:"dkim"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopLocationByDmarcListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopLocationByDmarcListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopLocationByDmarcListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTopLocationByDmarcListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// DMARC. +type RadarEmailSecurityTopLocationByDmarcListParamsDmarc string + +const ( + RadarEmailSecurityTopLocationByDmarcListParamsDmarcPass RadarEmailSecurityTopLocationByDmarcListParamsDmarc = "PASS" + RadarEmailSecurityTopLocationByDmarcListParamsDmarcNone RadarEmailSecurityTopLocationByDmarcListParamsDmarc = "NONE" + RadarEmailSecurityTopLocationByDmarcListParamsDmarcFail RadarEmailSecurityTopLocationByDmarcListParamsDmarc = "FAIL" +) + +type RadarEmailSecurityTopLocationByDmarcListParamsArc string + +const ( + RadarEmailSecurityTopLocationByDmarcListParamsArcPass RadarEmailSecurityTopLocationByDmarcListParamsArc = "PASS" + RadarEmailSecurityTopLocationByDmarcListParamsArcNone RadarEmailSecurityTopLocationByDmarcListParamsArc = "NONE" + RadarEmailSecurityTopLocationByDmarcListParamsArcFail RadarEmailSecurityTopLocationByDmarcListParamsArc = "FAIL" +) + +type RadarEmailSecurityTopLocationByDmarcListParamsDateRange string + +const ( + RadarEmailSecurityTopLocationByDmarcListParamsDateRange1d RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "1d" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange2d RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "2d" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange7d RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "7d" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange14d RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "14d" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange28d RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "28d" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange12w RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "12w" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange24w RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "24w" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange52w RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "52w" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange1dControl RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "1dControl" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange2dControl RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "2dControl" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange7dControl RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "7dControl" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange14dControl RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "14dControl" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange28dControl RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "28dControl" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange12wControl RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "12wControl" + RadarEmailSecurityTopLocationByDmarcListParamsDateRange24wControl RadarEmailSecurityTopLocationByDmarcListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopLocationByDmarcListParamsDkim string + +const ( + RadarEmailSecurityTopLocationByDmarcListParamsDkimPass RadarEmailSecurityTopLocationByDmarcListParamsDkim = "PASS" + RadarEmailSecurityTopLocationByDmarcListParamsDkimNone RadarEmailSecurityTopLocationByDmarcListParamsDkim = "NONE" + RadarEmailSecurityTopLocationByDmarcListParamsDkimFail RadarEmailSecurityTopLocationByDmarcListParamsDkim = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopLocationByDmarcListParamsFormat string + +const ( + RadarEmailSecurityTopLocationByDmarcListParamsFormatJson RadarEmailSecurityTopLocationByDmarcListParamsFormat = "JSON" + RadarEmailSecurityTopLocationByDmarcListParamsFormatCsv RadarEmailSecurityTopLocationByDmarcListParamsFormat = "CSV" +) + +type RadarEmailSecurityTopLocationByDmarcListParamsSpf string + +const ( + RadarEmailSecurityTopLocationByDmarcListParamsSpfPass RadarEmailSecurityTopLocationByDmarcListParamsSpf = "PASS" + RadarEmailSecurityTopLocationByDmarcListParamsSpfNone RadarEmailSecurityTopLocationByDmarcListParamsSpf = "NONE" + RadarEmailSecurityTopLocationByDmarcListParamsSpfFail RadarEmailSecurityTopLocationByDmarcListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytoplocationbydmarc_test.go b/radaremailsecuritytoplocationbydmarc_test.go new file mode 100644 index 00000000000..1d3d1d0c5aa --- /dev/null +++ b/radaremailsecuritytoplocationbydmarc_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopLocationByDmarcListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Locations.ByDmarc.List( + context.TODO(), + cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDmarcPass, + cloudflare.RadarEmailSecurityTopLocationByDmarcListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsArc{cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsArcPass, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsArcNone, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDateRange{cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDateRange1d, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDateRange2d, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDkim{cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDkimPass, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDkimNone, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsDkimFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsSpf{cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsSpfPass, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsSpfNone, cloudflare.RadarEmailSecurityTopLocationByDmarcListParamsSpfFail}), + }, + ) + 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/radaremailsecuritytoplocationbymalicious.go b/radaremailsecuritytoplocationbymalicious.go new file mode 100644 index 00000000000..d456858f96b --- /dev/null +++ b/radaremailsecuritytoplocationbymalicious.go @@ -0,0 +1,309 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopLocationByMaliciousService 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 [NewRadarEmailSecurityTopLocationByMaliciousService] method instead. +type RadarEmailSecurityTopLocationByMaliciousService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopLocationByMaliciousService 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 NewRadarEmailSecurityTopLocationByMaliciousService(opts ...option.RequestOption) (r *RadarEmailSecurityTopLocationByMaliciousService) { + r = &RadarEmailSecurityTopLocationByMaliciousService{} + r.Options = opts + return +} + +// Get the locations by emails classified as malicious or not. +func (r *RadarEmailSecurityTopLocationByMaliciousService) List(ctx context.Context, malicious RadarEmailSecurityTopLocationByMaliciousListParamsMalicious, query RadarEmailSecurityTopLocationByMaliciousListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopLocationByMaliciousListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/locations/malicious/%v", malicious) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopLocationByMaliciousListResponse struct { + Result RadarEmailSecurityTopLocationByMaliciousListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopLocationByMaliciousListResponseJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByMaliciousListResponseJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationByMaliciousListResponse] +type radarEmailSecurityTopLocationByMaliciousListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByMaliciousListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByMaliciousListResponseResult struct { + Meta RadarEmailSecurityTopLocationByMaliciousListResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopLocationByMaliciousListResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopLocationByMaliciousListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByMaliciousListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationByMaliciousListResponseResult] +type radarEmailSecurityTopLocationByMaliciousListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByMaliciousListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByMaliciousListResponseResultMeta struct { + DateRange []RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopLocationByMaliciousListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByMaliciousListResponseResultMetaJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopLocationByMaliciousListResponseResultMeta] +type radarEmailSecurityTopLocationByMaliciousListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByMaliciousListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopLocationByMaliciousListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByMaliciousListResponseResultMetaDateRangeJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaDateRange] +type radarEmailSecurityTopLocationByMaliciousListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByMaliciousListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByMaliciousListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopLocationByMaliciousListResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopLocationByMaliciousListResponseResultTop0JSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTopLocationByMaliciousListResponseResultTop0] +type radarEmailSecurityTopLocationByMaliciousListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationByMaliciousListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationByMaliciousListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopLocationByMaliciousListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopLocationByMaliciousListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopLocationByMaliciousListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopLocationByMaliciousListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopLocationByMaliciousListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopLocationByMaliciousListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopLocationByMaliciousListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTopLocationByMaliciousListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Malicious. +type RadarEmailSecurityTopLocationByMaliciousListParamsMalicious string + +const ( + RadarEmailSecurityTopLocationByMaliciousListParamsMaliciousMalicious RadarEmailSecurityTopLocationByMaliciousListParamsMalicious = "MALICIOUS" + RadarEmailSecurityTopLocationByMaliciousListParamsMaliciousNotMalicious RadarEmailSecurityTopLocationByMaliciousListParamsMalicious = "NOT_MALICIOUS" +) + +type RadarEmailSecurityTopLocationByMaliciousListParamsArc string + +const ( + RadarEmailSecurityTopLocationByMaliciousListParamsArcPass RadarEmailSecurityTopLocationByMaliciousListParamsArc = "PASS" + RadarEmailSecurityTopLocationByMaliciousListParamsArcNone RadarEmailSecurityTopLocationByMaliciousListParamsArc = "NONE" + RadarEmailSecurityTopLocationByMaliciousListParamsArcFail RadarEmailSecurityTopLocationByMaliciousListParamsArc = "FAIL" +) + +type RadarEmailSecurityTopLocationByMaliciousListParamsDateRange string + +const ( + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange1d RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "1d" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange2d RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "2d" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange7d RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "7d" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange14d RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "14d" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange28d RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "28d" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange12w RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "12w" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange24w RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "24w" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange52w RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "52w" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange1dControl RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "1dControl" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange2dControl RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "2dControl" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange7dControl RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "7dControl" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange14dControl RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "14dControl" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange28dControl RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "28dControl" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange12wControl RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "12wControl" + RadarEmailSecurityTopLocationByMaliciousListParamsDateRange24wControl RadarEmailSecurityTopLocationByMaliciousListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopLocationByMaliciousListParamsDkim string + +const ( + RadarEmailSecurityTopLocationByMaliciousListParamsDkimPass RadarEmailSecurityTopLocationByMaliciousListParamsDkim = "PASS" + RadarEmailSecurityTopLocationByMaliciousListParamsDkimNone RadarEmailSecurityTopLocationByMaliciousListParamsDkim = "NONE" + RadarEmailSecurityTopLocationByMaliciousListParamsDkimFail RadarEmailSecurityTopLocationByMaliciousListParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopLocationByMaliciousListParamsDmarc string + +const ( + RadarEmailSecurityTopLocationByMaliciousListParamsDmarcPass RadarEmailSecurityTopLocationByMaliciousListParamsDmarc = "PASS" + RadarEmailSecurityTopLocationByMaliciousListParamsDmarcNone RadarEmailSecurityTopLocationByMaliciousListParamsDmarc = "NONE" + RadarEmailSecurityTopLocationByMaliciousListParamsDmarcFail RadarEmailSecurityTopLocationByMaliciousListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopLocationByMaliciousListParamsFormat string + +const ( + RadarEmailSecurityTopLocationByMaliciousListParamsFormatJson RadarEmailSecurityTopLocationByMaliciousListParamsFormat = "JSON" + RadarEmailSecurityTopLocationByMaliciousListParamsFormatCsv RadarEmailSecurityTopLocationByMaliciousListParamsFormat = "CSV" +) + +type RadarEmailSecurityTopLocationByMaliciousListParamsSpf string + +const ( + RadarEmailSecurityTopLocationByMaliciousListParamsSpfPass RadarEmailSecurityTopLocationByMaliciousListParamsSpf = "PASS" + RadarEmailSecurityTopLocationByMaliciousListParamsSpfNone RadarEmailSecurityTopLocationByMaliciousListParamsSpf = "NONE" + RadarEmailSecurityTopLocationByMaliciousListParamsSpfFail RadarEmailSecurityTopLocationByMaliciousListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytoplocationbymalicious_test.go b/radaremailsecuritytoplocationbymalicious_test.go new file mode 100644 index 00000000000..b29c47ecb11 --- /dev/null +++ b/radaremailsecuritytoplocationbymalicious_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopLocationByMaliciousListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Locations.ByMalicious.List( + context.TODO(), + cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsMaliciousMalicious, + cloudflare.RadarEmailSecurityTopLocationByMaliciousListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsArc{cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsArcPass, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsArcNone, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDateRange{cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDateRange1d, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDateRange2d, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDkim{cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDkimPass, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDkimNone, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDmarc{cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDmarcPass, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDmarcNone, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsSpf{cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsSpfPass, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsSpfNone, cloudflare.RadarEmailSecurityTopLocationByMaliciousListParamsSpfFail}), + }, + ) + 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/radaremailsecuritytoplocationbyspam.go b/radaremailsecuritytoplocationbyspam.go new file mode 100644 index 00000000000..45d16fa39a4 --- /dev/null +++ b/radaremailsecuritytoplocationbyspam.go @@ -0,0 +1,308 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopLocationBySpamService 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 +// [NewRadarEmailSecurityTopLocationBySpamService] method instead. +type RadarEmailSecurityTopLocationBySpamService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopLocationBySpamService 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 NewRadarEmailSecurityTopLocationBySpamService(opts ...option.RequestOption) (r *RadarEmailSecurityTopLocationBySpamService) { + r = &RadarEmailSecurityTopLocationBySpamService{} + r.Options = opts + return +} + +// Get the top locations by emails classified as Spam or not. +func (r *RadarEmailSecurityTopLocationBySpamService) List(ctx context.Context, spam RadarEmailSecurityTopLocationBySpamListParamsSpam, query RadarEmailSecurityTopLocationBySpamListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopLocationBySpamListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/locations/spam/%v", spam) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopLocationBySpamListResponse struct { + Result RadarEmailSecurityTopLocationBySpamListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopLocationBySpamListResponseJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpamListResponseJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopLocationBySpamListResponse] +type radarEmailSecurityTopLocationBySpamListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpamListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpamListResponseResult struct { + Meta RadarEmailSecurityTopLocationBySpamListResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopLocationBySpamListResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopLocationBySpamListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpamListResponseResultJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationBySpamListResponseResult] +type radarEmailSecurityTopLocationBySpamListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpamListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpamListResponseResultMeta struct { + DateRange []RadarEmailSecurityTopLocationBySpamListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopLocationBySpamListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpamListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationBySpamListResponseResultMeta] +type radarEmailSecurityTopLocationBySpamListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpamListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpamListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopLocationBySpamListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpamListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTopLocationBySpamListResponseResultMetaDateRange] +type radarEmailSecurityTopLocationBySpamListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpamListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpamListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpamListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopLocationBySpamListResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpamListResponseResultTop0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationBySpamListResponseResultTop0] +type radarEmailSecurityTopLocationBySpamListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpamListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpamListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopLocationBySpamListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopLocationBySpamListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopLocationBySpamListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopLocationBySpamListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopLocationBySpamListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + Spf param.Field[[]RadarEmailSecurityTopLocationBySpamListParamsSpf] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTopLocationBySpamListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTopLocationBySpamListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Spam. +type RadarEmailSecurityTopLocationBySpamListParamsSpam string + +const ( + RadarEmailSecurityTopLocationBySpamListParamsSpamSpam RadarEmailSecurityTopLocationBySpamListParamsSpam = "SPAM" + RadarEmailSecurityTopLocationBySpamListParamsSpamNotSpam RadarEmailSecurityTopLocationBySpamListParamsSpam = "NOT_SPAM" +) + +type RadarEmailSecurityTopLocationBySpamListParamsArc string + +const ( + RadarEmailSecurityTopLocationBySpamListParamsArcPass RadarEmailSecurityTopLocationBySpamListParamsArc = "PASS" + RadarEmailSecurityTopLocationBySpamListParamsArcNone RadarEmailSecurityTopLocationBySpamListParamsArc = "NONE" + RadarEmailSecurityTopLocationBySpamListParamsArcFail RadarEmailSecurityTopLocationBySpamListParamsArc = "FAIL" +) + +type RadarEmailSecurityTopLocationBySpamListParamsDateRange string + +const ( + RadarEmailSecurityTopLocationBySpamListParamsDateRange1d RadarEmailSecurityTopLocationBySpamListParamsDateRange = "1d" + RadarEmailSecurityTopLocationBySpamListParamsDateRange2d RadarEmailSecurityTopLocationBySpamListParamsDateRange = "2d" + RadarEmailSecurityTopLocationBySpamListParamsDateRange7d RadarEmailSecurityTopLocationBySpamListParamsDateRange = "7d" + RadarEmailSecurityTopLocationBySpamListParamsDateRange14d RadarEmailSecurityTopLocationBySpamListParamsDateRange = "14d" + RadarEmailSecurityTopLocationBySpamListParamsDateRange28d RadarEmailSecurityTopLocationBySpamListParamsDateRange = "28d" + RadarEmailSecurityTopLocationBySpamListParamsDateRange12w RadarEmailSecurityTopLocationBySpamListParamsDateRange = "12w" + RadarEmailSecurityTopLocationBySpamListParamsDateRange24w RadarEmailSecurityTopLocationBySpamListParamsDateRange = "24w" + RadarEmailSecurityTopLocationBySpamListParamsDateRange52w RadarEmailSecurityTopLocationBySpamListParamsDateRange = "52w" + RadarEmailSecurityTopLocationBySpamListParamsDateRange1dControl RadarEmailSecurityTopLocationBySpamListParamsDateRange = "1dControl" + RadarEmailSecurityTopLocationBySpamListParamsDateRange2dControl RadarEmailSecurityTopLocationBySpamListParamsDateRange = "2dControl" + RadarEmailSecurityTopLocationBySpamListParamsDateRange7dControl RadarEmailSecurityTopLocationBySpamListParamsDateRange = "7dControl" + RadarEmailSecurityTopLocationBySpamListParamsDateRange14dControl RadarEmailSecurityTopLocationBySpamListParamsDateRange = "14dControl" + RadarEmailSecurityTopLocationBySpamListParamsDateRange28dControl RadarEmailSecurityTopLocationBySpamListParamsDateRange = "28dControl" + RadarEmailSecurityTopLocationBySpamListParamsDateRange12wControl RadarEmailSecurityTopLocationBySpamListParamsDateRange = "12wControl" + RadarEmailSecurityTopLocationBySpamListParamsDateRange24wControl RadarEmailSecurityTopLocationBySpamListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopLocationBySpamListParamsDkim string + +const ( + RadarEmailSecurityTopLocationBySpamListParamsDkimPass RadarEmailSecurityTopLocationBySpamListParamsDkim = "PASS" + RadarEmailSecurityTopLocationBySpamListParamsDkimNone RadarEmailSecurityTopLocationBySpamListParamsDkim = "NONE" + RadarEmailSecurityTopLocationBySpamListParamsDkimFail RadarEmailSecurityTopLocationBySpamListParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopLocationBySpamListParamsDmarc string + +const ( + RadarEmailSecurityTopLocationBySpamListParamsDmarcPass RadarEmailSecurityTopLocationBySpamListParamsDmarc = "PASS" + RadarEmailSecurityTopLocationBySpamListParamsDmarcNone RadarEmailSecurityTopLocationBySpamListParamsDmarc = "NONE" + RadarEmailSecurityTopLocationBySpamListParamsDmarcFail RadarEmailSecurityTopLocationBySpamListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopLocationBySpamListParamsFormat string + +const ( + RadarEmailSecurityTopLocationBySpamListParamsFormatJson RadarEmailSecurityTopLocationBySpamListParamsFormat = "JSON" + RadarEmailSecurityTopLocationBySpamListParamsFormatCsv RadarEmailSecurityTopLocationBySpamListParamsFormat = "CSV" +) + +type RadarEmailSecurityTopLocationBySpamListParamsSpf string + +const ( + RadarEmailSecurityTopLocationBySpamListParamsSpfPass RadarEmailSecurityTopLocationBySpamListParamsSpf = "PASS" + RadarEmailSecurityTopLocationBySpamListParamsSpfNone RadarEmailSecurityTopLocationBySpamListParamsSpf = "NONE" + RadarEmailSecurityTopLocationBySpamListParamsSpfFail RadarEmailSecurityTopLocationBySpamListParamsSpf = "FAIL" +) diff --git a/radaremailsecuritytoplocationbyspam_test.go b/radaremailsecuritytoplocationbyspam_test.go new file mode 100644 index 00000000000..6678eddd1eb --- /dev/null +++ b/radaremailsecuritytoplocationbyspam_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopLocationBySpamListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Locations.BySpam.List( + context.TODO(), + cloudflare.RadarEmailSecurityTopLocationBySpamListParamsSpamSpam, + cloudflare.RadarEmailSecurityTopLocationBySpamListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpamListParamsArc{cloudflare.RadarEmailSecurityTopLocationBySpamListParamsArcPass, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsArcNone, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDateRange{cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDateRange1d, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDateRange2d, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDkim{cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDkimPass, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDkimNone, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDmarc{cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDmarcPass, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDmarcNone, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopLocationBySpamListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Spf: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpamListParamsSpf{cloudflare.RadarEmailSecurityTopLocationBySpamListParamsSpfPass, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsSpfNone, cloudflare.RadarEmailSecurityTopLocationBySpamListParamsSpfFail}), + }, + ) + 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/radaremailsecuritytoplocationbyspf.go b/radaremailsecuritytoplocationbyspf.go new file mode 100644 index 00000000000..b88c3e8a040 --- /dev/null +++ b/radaremailsecuritytoplocationbyspf.go @@ -0,0 +1,299 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEmailSecurityTopLocationBySpfService 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 +// [NewRadarEmailSecurityTopLocationBySpfService] method instead. +type RadarEmailSecurityTopLocationBySpfService struct { + Options []option.RequestOption +} + +// NewRadarEmailSecurityTopLocationBySpfService 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 NewRadarEmailSecurityTopLocationBySpfService(opts ...option.RequestOption) (r *RadarEmailSecurityTopLocationBySpfService) { + r = &RadarEmailSecurityTopLocationBySpfService{} + r.Options = opts + return +} + +// Get the top locations by email SPF validation. +func (r *RadarEmailSecurityTopLocationBySpfService) List(ctx context.Context, spf RadarEmailSecurityTopLocationBySpfListParamsSpf, query RadarEmailSecurityTopLocationBySpfListParams, opts ...option.RequestOption) (res *RadarEmailSecurityTopLocationBySpfListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/email/security/top/locations/spf/%v", spf) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEmailSecurityTopLocationBySpfListResponse struct { + Result RadarEmailSecurityTopLocationBySpfListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTopLocationBySpfListResponseJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpfListResponseJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTopLocationBySpfListResponse] +type radarEmailSecurityTopLocationBySpfListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpfListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpfListResponseResult struct { + Meta RadarEmailSecurityTopLocationBySpfListResponseResultMeta `json:"meta,required"` + Top0 []RadarEmailSecurityTopLocationBySpfListResponseResultTop0 `json:"top_0,required"` + JSON radarEmailSecurityTopLocationBySpfListResponseResultJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpfListResponseResultJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTopLocationBySpfListResponseResult] +type radarEmailSecurityTopLocationBySpfListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpfListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpfListResponseResultMeta struct { + DateRange []RadarEmailSecurityTopLocationBySpfListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarEmailSecurityTopLocationBySpfListResponseResultMetaJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpfListResponseResultMetaJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationBySpfListResponseResultMeta] +type radarEmailSecurityTopLocationBySpfListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpfListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpfListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarEmailSecurityTopLocationBySpfListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpfListResponseResultMetaDateRangeJSON contains +// the JSON metadata for the struct +// [RadarEmailSecurityTopLocationBySpfListResponseResultMetaDateRange] +type radarEmailSecurityTopLocationBySpfListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpfListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfo struct { + Annotations []RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfo] +type radarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoAnnotation] +type radarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpfListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpfListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarEmailSecurityTopLocationBySpfListResponseResultTop0JSON `json:"-"` +} + +// radarEmailSecurityTopLocationBySpfListResponseResultTop0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTopLocationBySpfListResponseResultTop0] +type radarEmailSecurityTopLocationBySpfListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTopLocationBySpfListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTopLocationBySpfListParams struct { + // Filter for arc (Authenticated Received Chain). + Arc param.Field[[]RadarEmailSecurityTopLocationBySpfListParamsArc] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTopLocationBySpfListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + Dkim param.Field[[]RadarEmailSecurityTopLocationBySpfListParamsDkim] `query:"dkim"` + // Filter for dmarc. + Dmarc param.Field[[]RadarEmailSecurityTopLocationBySpfListParamsDmarc] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTopLocationBySpfListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarEmailSecurityTopLocationBySpfListParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTopLocationBySpfListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// SPF. +type RadarEmailSecurityTopLocationBySpfListParamsSpf string + +const ( + RadarEmailSecurityTopLocationBySpfListParamsSpfPass RadarEmailSecurityTopLocationBySpfListParamsSpf = "PASS" + RadarEmailSecurityTopLocationBySpfListParamsSpfNone RadarEmailSecurityTopLocationBySpfListParamsSpf = "NONE" + RadarEmailSecurityTopLocationBySpfListParamsSpfFail RadarEmailSecurityTopLocationBySpfListParamsSpf = "FAIL" +) + +type RadarEmailSecurityTopLocationBySpfListParamsArc string + +const ( + RadarEmailSecurityTopLocationBySpfListParamsArcPass RadarEmailSecurityTopLocationBySpfListParamsArc = "PASS" + RadarEmailSecurityTopLocationBySpfListParamsArcNone RadarEmailSecurityTopLocationBySpfListParamsArc = "NONE" + RadarEmailSecurityTopLocationBySpfListParamsArcFail RadarEmailSecurityTopLocationBySpfListParamsArc = "FAIL" +) + +type RadarEmailSecurityTopLocationBySpfListParamsDateRange string + +const ( + RadarEmailSecurityTopLocationBySpfListParamsDateRange1d RadarEmailSecurityTopLocationBySpfListParamsDateRange = "1d" + RadarEmailSecurityTopLocationBySpfListParamsDateRange2d RadarEmailSecurityTopLocationBySpfListParamsDateRange = "2d" + RadarEmailSecurityTopLocationBySpfListParamsDateRange7d RadarEmailSecurityTopLocationBySpfListParamsDateRange = "7d" + RadarEmailSecurityTopLocationBySpfListParamsDateRange14d RadarEmailSecurityTopLocationBySpfListParamsDateRange = "14d" + RadarEmailSecurityTopLocationBySpfListParamsDateRange28d RadarEmailSecurityTopLocationBySpfListParamsDateRange = "28d" + RadarEmailSecurityTopLocationBySpfListParamsDateRange12w RadarEmailSecurityTopLocationBySpfListParamsDateRange = "12w" + RadarEmailSecurityTopLocationBySpfListParamsDateRange24w RadarEmailSecurityTopLocationBySpfListParamsDateRange = "24w" + RadarEmailSecurityTopLocationBySpfListParamsDateRange52w RadarEmailSecurityTopLocationBySpfListParamsDateRange = "52w" + RadarEmailSecurityTopLocationBySpfListParamsDateRange1dControl RadarEmailSecurityTopLocationBySpfListParamsDateRange = "1dControl" + RadarEmailSecurityTopLocationBySpfListParamsDateRange2dControl RadarEmailSecurityTopLocationBySpfListParamsDateRange = "2dControl" + RadarEmailSecurityTopLocationBySpfListParamsDateRange7dControl RadarEmailSecurityTopLocationBySpfListParamsDateRange = "7dControl" + RadarEmailSecurityTopLocationBySpfListParamsDateRange14dControl RadarEmailSecurityTopLocationBySpfListParamsDateRange = "14dControl" + RadarEmailSecurityTopLocationBySpfListParamsDateRange28dControl RadarEmailSecurityTopLocationBySpfListParamsDateRange = "28dControl" + RadarEmailSecurityTopLocationBySpfListParamsDateRange12wControl RadarEmailSecurityTopLocationBySpfListParamsDateRange = "12wControl" + RadarEmailSecurityTopLocationBySpfListParamsDateRange24wControl RadarEmailSecurityTopLocationBySpfListParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTopLocationBySpfListParamsDkim string + +const ( + RadarEmailSecurityTopLocationBySpfListParamsDkimPass RadarEmailSecurityTopLocationBySpfListParamsDkim = "PASS" + RadarEmailSecurityTopLocationBySpfListParamsDkimNone RadarEmailSecurityTopLocationBySpfListParamsDkim = "NONE" + RadarEmailSecurityTopLocationBySpfListParamsDkimFail RadarEmailSecurityTopLocationBySpfListParamsDkim = "FAIL" +) + +type RadarEmailSecurityTopLocationBySpfListParamsDmarc string + +const ( + RadarEmailSecurityTopLocationBySpfListParamsDmarcPass RadarEmailSecurityTopLocationBySpfListParamsDmarc = "PASS" + RadarEmailSecurityTopLocationBySpfListParamsDmarcNone RadarEmailSecurityTopLocationBySpfListParamsDmarc = "NONE" + RadarEmailSecurityTopLocationBySpfListParamsDmarcFail RadarEmailSecurityTopLocationBySpfListParamsDmarc = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTopLocationBySpfListParamsFormat string + +const ( + RadarEmailSecurityTopLocationBySpfListParamsFormatJson RadarEmailSecurityTopLocationBySpfListParamsFormat = "JSON" + RadarEmailSecurityTopLocationBySpfListParamsFormatCsv RadarEmailSecurityTopLocationBySpfListParamsFormat = "CSV" +) diff --git a/radaremailsecuritytoplocationbyspf_test.go b/radaremailsecuritytoplocationbyspf_test.go new file mode 100644 index 00000000000..07b5f29a859 --- /dev/null +++ b/radaremailsecuritytoplocationbyspf_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEmailSecurityTopLocationBySpfListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Email.Security.Top.Locations.BySpf.List( + context.TODO(), + cloudflare.RadarEmailSecurityTopLocationBySpfListParamsSpfPass, + cloudflare.RadarEmailSecurityTopLocationBySpfListParams{ + Arc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpfListParamsArc{cloudflare.RadarEmailSecurityTopLocationBySpfListParamsArcPass, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsArcNone, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsArcFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDateRange{cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDateRange1d, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDateRange2d, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Dkim: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDkim{cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDkimPass, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDkimNone, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDkimFail}), + Dmarc: cloudflare.F([]cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDmarc{cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDmarcPass, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDmarcNone, cloudflare.RadarEmailSecurityTopLocationBySpfListParamsDmarcFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTopLocationBySpfListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }, + ) + 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/radarentity.go b/radarentity.go new file mode 100644 index 00000000000..2fc704508bc --- /dev/null +++ b/radarentity.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEntityService 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 [NewRadarEntityService] method +// instead. +type RadarEntityService struct { + Options []option.RequestOption + ASNs *RadarEntityASNService + IPs *RadarEntityIPService + Locations *RadarEntityLocationService +} + +// NewRadarEntityService 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 NewRadarEntityService(opts ...option.RequestOption) (r *RadarEntityService) { + r = &RadarEntityService{} + r.Options = opts + r.ASNs = NewRadarEntityASNService(opts...) + r.IPs = NewRadarEntityIPService(opts...) + r.Locations = NewRadarEntityLocationService(opts...) + return +} diff --git a/radarentityasn.go b/radarentityasn.go new file mode 100644 index 00000000000..2c1022ade84 --- /dev/null +++ b/radarentityasn.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEntityASNService 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 [NewRadarEntityASNService] method +// instead. +type RadarEntityASNService struct { + Options []option.RequestOption + IPs *RadarEntityASNIPService + Relationships *RadarEntityASNRelationshipService +} + +// NewRadarEntityASNService 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 NewRadarEntityASNService(opts ...option.RequestOption) (r *RadarEntityASNService) { + r = &RadarEntityASNService{} + r.Options = opts + r.IPs = NewRadarEntityASNIPService(opts...) + r.Relationships = NewRadarEntityASNRelationshipService(opts...) + return +} + +// Get the requested autonomous system information. A confidence level below `5` +// indicates a low level of confidence in the traffic data - normally this happens +// because Cloudflare has a small amount of traffic from/to this AS). Population +// estimates come from APNIC (refer to https://labs.apnic.net/?p=526). +func (r *RadarEntityASNService) Get(ctx context.Context, asn int64, query RadarEntityASNGetParams, opts ...option.RequestOption) (res *RadarEntityASNGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/entities/asns/%v", asn) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Gets a list of autonomous systems (AS). +func (r *RadarEntityASNService) List(ctx context.Context, query RadarEntityASNListParams, opts ...option.RequestOption) (res *RadarEntityASNListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/entities/asns" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEntityASNGetResponse struct { + Result RadarEntityASNGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEntityASNGetResponseJSON `json:"-"` +} + +// radarEntityASNGetResponseJSON contains the JSON metadata for the struct +// [RadarEntityASNGetResponse] +type radarEntityASNGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNGetResponseResult struct { + ASN RadarEntityASNGetResponseResultASN `json:"asn,required"` + JSON radarEntityASNGetResponseResultJSON `json:"-"` +} + +// radarEntityASNGetResponseResultJSON contains the JSON metadata for the struct +// [RadarEntityASNGetResponseResult] +type radarEntityASNGetResponseResultJSON struct { + ASN apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNGetResponseResultASN struct { + ASN int64 `json:"asn,required"` + ConfidenceLevel int64 `json:"confidenceLevel,required"` + Country string `json:"country,required"` + CountryName string `json:"countryName,required"` + EstimatedUsers RadarEntityASNGetResponseResultASNEstimatedUsers `json:"estimatedUsers,required"` + Name string `json:"name,required"` + OrgName string `json:"orgName,required"` + Related []RadarEntityASNGetResponseResultASNRelated `json:"related,required"` + // Regional Internet Registry + Source string `json:"source,required"` + Website string `json:"website,required"` + Aka string `json:"aka"` + // Deprecated field. Please use 'aka'. + NameLong string `json:"nameLong"` + JSON radarEntityASNGetResponseResultASNJSON `json:"-"` +} + +// radarEntityASNGetResponseResultASNJSON contains the JSON metadata for the struct +// [RadarEntityASNGetResponseResultASN] +type radarEntityASNGetResponseResultASNJSON struct { + ASN apijson.Field + ConfidenceLevel apijson.Field + Country apijson.Field + CountryName apijson.Field + EstimatedUsers apijson.Field + Name apijson.Field + OrgName apijson.Field + Related apijson.Field + Source apijson.Field + Website apijson.Field + Aka apijson.Field + NameLong apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNGetResponseResultASN) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNGetResponseResultASNEstimatedUsers struct { + Locations []RadarEntityASNGetResponseResultASNEstimatedUsersLocation `json:"locations,required"` + // Total estimated users + EstimatedUsers int64 `json:"estimatedUsers"` + JSON radarEntityASNGetResponseResultASNEstimatedUsersJSON `json:"-"` +} + +// radarEntityASNGetResponseResultASNEstimatedUsersJSON contains the JSON metadata +// for the struct [RadarEntityASNGetResponseResultASNEstimatedUsers] +type radarEntityASNGetResponseResultASNEstimatedUsersJSON struct { + Locations apijson.Field + EstimatedUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNGetResponseResultASNEstimatedUsers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNGetResponseResultASNEstimatedUsersLocation struct { + LocationAlpha2 string `json:"locationAlpha2,required"` + LocationName string `json:"locationName,required"` + // Estimated users per location + EstimatedUsers int64 `json:"estimatedUsers"` + JSON radarEntityASNGetResponseResultASNEstimatedUsersLocationJSON `json:"-"` +} + +// radarEntityASNGetResponseResultASNEstimatedUsersLocationJSON contains the JSON +// metadata for the struct +// [RadarEntityASNGetResponseResultASNEstimatedUsersLocation] +type radarEntityASNGetResponseResultASNEstimatedUsersLocationJSON struct { + LocationAlpha2 apijson.Field + LocationName apijson.Field + EstimatedUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNGetResponseResultASNEstimatedUsersLocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNGetResponseResultASNRelated struct { + ASN int64 `json:"asn,required"` + Name string `json:"name,required"` + Aka string `json:"aka"` + // Total estimated users + EstimatedUsers int64 `json:"estimatedUsers"` + JSON radarEntityASNGetResponseResultASNRelatedJSON `json:"-"` +} + +// radarEntityASNGetResponseResultASNRelatedJSON contains the JSON metadata for the +// struct [RadarEntityASNGetResponseResultASNRelated] +type radarEntityASNGetResponseResultASNRelatedJSON struct { + ASN apijson.Field + Name apijson.Field + Aka apijson.Field + EstimatedUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNGetResponseResultASNRelated) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNListResponse struct { + Result RadarEntityASNListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEntityASNListResponseJSON `json:"-"` +} + +// radarEntityASNListResponseJSON contains the JSON metadata for the struct +// [RadarEntityASNListResponse] +type radarEntityASNListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNListResponseResult struct { + ASNs []RadarEntityASNListResponseResultASN `json:"asns,required"` + JSON radarEntityASNListResponseResultJSON `json:"-"` +} + +// radarEntityASNListResponseResultJSON contains the JSON metadata for the struct +// [RadarEntityASNListResponseResult] +type radarEntityASNListResponseResultJSON struct { + ASNs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNListResponseResultASN struct { + ASN int64 `json:"asn,required"` + Country string `json:"country,required"` + CountryName string `json:"countryName,required"` + Name string `json:"name,required"` + Aka string `json:"aka"` + // Deprecated field. Please use 'aka'. + NameLong string `json:"nameLong"` + OrgName string `json:"orgName"` + Website string `json:"website"` + JSON radarEntityASNListResponseResultASNJSON `json:"-"` +} + +// radarEntityASNListResponseResultASNJSON contains the JSON metadata for the +// struct [RadarEntityASNListResponseResultASN] +type radarEntityASNListResponseResultASNJSON struct { + ASN apijson.Field + Country apijson.Field + CountryName apijson.Field + Name apijson.Field + Aka apijson.Field + NameLong apijson.Field + OrgName apijson.Field + Website apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNListResponseResultASN) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNGetParams struct { + // Format results are returned in. + Format param.Field[RadarEntityASNGetParamsFormat] `query:"format"` +} + +// URLQuery serializes [RadarEntityASNGetParams]'s query parameters as +// `url.Values`. +func (r RadarEntityASNGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarEntityASNGetParamsFormat string + +const ( + RadarEntityASNGetParamsFormatJson RadarEntityASNGetParamsFormat = "JSON" + RadarEntityASNGetParamsFormatCsv RadarEntityASNGetParamsFormat = "CSV" +) + +type RadarEntityASNListParams struct { + // Comma separated list of ASNs. + ASN param.Field[string] `query:"asn"` + // Format results are returned in. + Format param.Field[RadarEntityASNListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Location Alpha2 to filter results. + Location param.Field[string] `query:"location"` + // Number of objects to skip before grabbing results. + Offset param.Field[int64] `query:"offset"` + // Order asn list. + OrderBy param.Field[RadarEntityASNListParamsOrderBy] `query:"orderBy"` +} + +// URLQuery serializes [RadarEntityASNListParams]'s query parameters as +// `url.Values`. +func (r RadarEntityASNListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarEntityASNListParamsFormat string + +const ( + RadarEntityASNListParamsFormatJson RadarEntityASNListParamsFormat = "JSON" + RadarEntityASNListParamsFormatCsv RadarEntityASNListParamsFormat = "CSV" +) + +// Order asn list. +type RadarEntityASNListParamsOrderBy string + +const ( + RadarEntityASNListParamsOrderByASN RadarEntityASNListParamsOrderBy = "ASN" + RadarEntityASNListParamsOrderByPopulation RadarEntityASNListParamsOrderBy = "POPULATION" +) diff --git a/radarentityasn_test.go b/radarentityasn_test.go new file mode 100644 index 00000000000..846371f8fc4 --- /dev/null +++ b/radarentityasn_test.go @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEntityASNGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Entities.ASNs.Get( + context.TODO(), + int64(3), + cloudflare.RadarEntityASNGetParams{ + Format: cloudflare.F(cloudflare.RadarEntityASNGetParamsFormatJson), + }, + ) + 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 TestRadarEntityASNListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Entities.ASNs.List(context.TODO(), cloudflare.RadarEntityASNListParams{ + ASN: cloudflare.F("174,7922"), + Format: cloudflare.F(cloudflare.RadarEntityASNListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F("US"), + Offset: cloudflare.F(int64(0)), + OrderBy: cloudflare.F(cloudflare.RadarEntityASNListParamsOrderByASN), + }) + 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/radarentityasnip.go b/radarentityasnip.go new file mode 100644 index 00000000000..899aba7e8b2 --- /dev/null +++ b/radarentityasnip.go @@ -0,0 +1,208 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEntityASNIPService 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 [NewRadarEntityASNIPService] method +// instead. +type RadarEntityASNIPService struct { + Options []option.RequestOption +} + +// NewRadarEntityASNIPService 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 NewRadarEntityASNIPService(opts ...option.RequestOption) (r *RadarEntityASNIPService) { + r = &RadarEntityASNIPService{} + r.Options = opts + return +} + +// Get the requested autonomous system information based on IP address. Population +// estimates come from APNIC (refer to https://labs.apnic.net/?p=526). +func (r *RadarEntityASNIPService) List(ctx context.Context, query RadarEntityASNIPListParams, opts ...option.RequestOption) (res *RadarEntityAsnipListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/entities/asns/ip" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEntityAsnipListResponse struct { + Result RadarEntityAsnipListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEntityAsnipListResponseJSON `json:"-"` +} + +// radarEntityAsnipListResponseJSON contains the JSON metadata for the struct +// [RadarEntityAsnipListResponse] +type radarEntityAsnipListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityAsnipListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityAsnipListResponseResult struct { + ASN RadarEntityAsnipListResponseResultASN `json:"asn,required"` + JSON radarEntityAsnipListResponseResultJSON `json:"-"` +} + +// radarEntityAsnipListResponseResultJSON contains the JSON metadata for the struct +// [RadarEntityAsnipListResponseResult] +type radarEntityAsnipListResponseResultJSON struct { + ASN apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityAsnipListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityAsnipListResponseResultASN struct { + ASN int64 `json:"asn,required"` + Country string `json:"country,required"` + CountryName string `json:"countryName,required"` + EstimatedUsers RadarEntityAsnipListResponseResultASNEstimatedUsers `json:"estimatedUsers,required"` + Name string `json:"name,required"` + OrgName string `json:"orgName,required"` + Related []RadarEntityAsnipListResponseResultASNRelated `json:"related,required"` + // Regional Internet Registry + Source string `json:"source,required"` + Website string `json:"website,required"` + Aka string `json:"aka"` + // Deprecated field. Please use 'aka'. + NameLong string `json:"nameLong"` + JSON radarEntityAsnipListResponseResultASNJSON `json:"-"` +} + +// radarEntityAsnipListResponseResultASNJSON contains the JSON metadata for the +// struct [RadarEntityAsnipListResponseResultASN] +type radarEntityAsnipListResponseResultASNJSON struct { + ASN apijson.Field + Country apijson.Field + CountryName apijson.Field + EstimatedUsers apijson.Field + Name apijson.Field + OrgName apijson.Field + Related apijson.Field + Source apijson.Field + Website apijson.Field + Aka apijson.Field + NameLong apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityAsnipListResponseResultASN) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityAsnipListResponseResultASNEstimatedUsers struct { + Locations []RadarEntityAsnipListResponseResultASNEstimatedUsersLocation `json:"locations,required"` + // Total estimated users + EstimatedUsers int64 `json:"estimatedUsers"` + JSON radarEntityAsnipListResponseResultASNEstimatedUsersJSON `json:"-"` +} + +// radarEntityAsnipListResponseResultASNEstimatedUsersJSON contains the JSON +// metadata for the struct [RadarEntityAsnipListResponseResultASNEstimatedUsers] +type radarEntityAsnipListResponseResultASNEstimatedUsersJSON struct { + Locations apijson.Field + EstimatedUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityAsnipListResponseResultASNEstimatedUsers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityAsnipListResponseResultASNEstimatedUsersLocation struct { + LocationAlpha2 string `json:"locationAlpha2,required"` + LocationName string `json:"locationName,required"` + // Estimated users per location + EstimatedUsers int64 `json:"estimatedUsers"` + JSON radarEntityAsnipListResponseResultASNEstimatedUsersLocationJSON `json:"-"` +} + +// radarEntityAsnipListResponseResultASNEstimatedUsersLocationJSON contains the +// JSON metadata for the struct +// [RadarEntityAsnipListResponseResultASNEstimatedUsersLocation] +type radarEntityAsnipListResponseResultASNEstimatedUsersLocationJSON struct { + LocationAlpha2 apijson.Field + LocationName apijson.Field + EstimatedUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityAsnipListResponseResultASNEstimatedUsersLocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityAsnipListResponseResultASNRelated struct { + ASN int64 `json:"asn,required"` + Name string `json:"name,required"` + Aka string `json:"aka"` + // Total estimated users + EstimatedUsers int64 `json:"estimatedUsers"` + JSON radarEntityAsnipListResponseResultASNRelatedJSON `json:"-"` +} + +// radarEntityAsnipListResponseResultASNRelatedJSON contains the JSON metadata for +// the struct [RadarEntityAsnipListResponseResultASNRelated] +type radarEntityAsnipListResponseResultASNRelatedJSON struct { + ASN apijson.Field + Name apijson.Field + Aka apijson.Field + EstimatedUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityAsnipListResponseResultASNRelated) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNIPListParams struct { + // IP address. + IP param.Field[string] `query:"ip,required"` + // Format results are returned in. + Format param.Field[RadarEntityAsnipListParamsFormat] `query:"format"` +} + +// URLQuery serializes [RadarEntityASNIPListParams]'s query parameters as +// `url.Values`. +func (r RadarEntityASNIPListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarEntityAsnipListParamsFormat string + +const ( + RadarEntityAsnipListParamsFormatJson RadarEntityAsnipListParamsFormat = "JSON" + RadarEntityAsnipListParamsFormatCsv RadarEntityAsnipListParamsFormat = "CSV" +) diff --git a/radarentityasnip_test.go b/radarentityasnip_test.go new file mode 100644 index 00000000000..6fb15a62cb7 --- /dev/null +++ b/radarentityasnip_test.go @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEntityASNIPListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Entities.ASNs.IPs.List(context.TODO(), cloudflare.RadarEntityASNIPListParams{ + IP: cloudflare.F("8.8.8.8"), + Format: cloudflare.F(cloudflare.RadarEntityAsnipListParamsFormatJson), + }) + 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/radarentityasnrelationship.go b/radarentityasnrelationship.go new file mode 100644 index 00000000000..5beb861e2be --- /dev/null +++ b/radarentityasnrelationship.go @@ -0,0 +1,154 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEntityASNRelationshipService 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 +// [NewRadarEntityASNRelationshipService] method instead. +type RadarEntityASNRelationshipService struct { + Options []option.RequestOption +} + +// NewRadarEntityASNRelationshipService 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 NewRadarEntityASNRelationshipService(opts ...option.RequestOption) (r *RadarEntityASNRelationshipService) { + r = &RadarEntityASNRelationshipService{} + r.Options = opts + return +} + +// Get AS-level relationship for given networks. +func (r *RadarEntityASNRelationshipService) List(ctx context.Context, asn int64, query RadarEntityASNRelationshipListParams, opts ...option.RequestOption) (res *RadarEntityASNRelationshipListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/entities/asns/%v/rel", asn) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEntityASNRelationshipListResponse struct { + Result RadarEntityASNRelationshipListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEntityASNRelationshipListResponseJSON `json:"-"` +} + +// radarEntityASNRelationshipListResponseJSON contains the JSON metadata for the +// struct [RadarEntityASNRelationshipListResponse] +type radarEntityASNRelationshipListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNRelationshipListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNRelationshipListResponseResult struct { + Meta RadarEntityASNRelationshipListResponseResultMeta `json:"meta,required"` + Rels []RadarEntityASNRelationshipListResponseResultRel `json:"rels,required"` + JSON radarEntityASNRelationshipListResponseResultJSON `json:"-"` +} + +// radarEntityASNRelationshipListResponseResultJSON contains the JSON metadata for +// the struct [RadarEntityASNRelationshipListResponseResult] +type radarEntityASNRelationshipListResponseResultJSON struct { + Meta apijson.Field + Rels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNRelationshipListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNRelationshipListResponseResultMeta struct { + DataTime string `json:"data_time,required"` + QueryTime string `json:"query_time,required"` + TotalPeers int64 `json:"total_peers,required"` + JSON radarEntityASNRelationshipListResponseResultMetaJSON `json:"-"` +} + +// radarEntityASNRelationshipListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarEntityASNRelationshipListResponseResultMeta] +type radarEntityASNRelationshipListResponseResultMetaJSON struct { + DataTime apijson.Field + QueryTime apijson.Field + TotalPeers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNRelationshipListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNRelationshipListResponseResultRel struct { + Asn1 int64 `json:"asn1,required"` + Asn1Country string `json:"asn1_country,required"` + Asn1Name string `json:"asn1_name,required"` + Asn2 int64 `json:"asn2,required"` + Asn2Country string `json:"asn2_country,required"` + Asn2Name string `json:"asn2_name,required"` + Rel string `json:"rel,required"` + JSON radarEntityASNRelationshipListResponseResultRelJSON `json:"-"` +} + +// radarEntityASNRelationshipListResponseResultRelJSON contains the JSON metadata +// for the struct [RadarEntityASNRelationshipListResponseResultRel] +type radarEntityASNRelationshipListResponseResultRelJSON struct { + Asn1 apijson.Field + Asn1Country apijson.Field + Asn1Name apijson.Field + Asn2 apijson.Field + Asn2Country apijson.Field + Asn2Name apijson.Field + Rel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityASNRelationshipListResponseResultRel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityASNRelationshipListParams struct { + // Get the AS relationship of ASN2 with respect to the given ASN + Asn2 param.Field[int64] `query:"asn2"` + // Format results are returned in. + Format param.Field[RadarEntityASNRelationshipListParamsFormat] `query:"format"` +} + +// URLQuery serializes [RadarEntityASNRelationshipListParams]'s query parameters as +// `url.Values`. +func (r RadarEntityASNRelationshipListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarEntityASNRelationshipListParamsFormat string + +const ( + RadarEntityASNRelationshipListParamsFormatJson RadarEntityASNRelationshipListParamsFormat = "JSON" + RadarEntityASNRelationshipListParamsFormatCsv RadarEntityASNRelationshipListParamsFormat = "CSV" +) diff --git a/radarentityasnrelationship_test.go b/radarentityasnrelationship_test.go new file mode 100644 index 00000000000..8c88b8cfbf3 --- /dev/null +++ b/radarentityasnrelationship_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEntityASNRelationshipListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Entities.ASNs.Relationships.List( + context.TODO(), + int64(3), + cloudflare.RadarEntityASNRelationshipListParams{ + Asn2: cloudflare.F(int64(0)), + Format: cloudflare.F(cloudflare.RadarEntityASNRelationshipListParamsFormatJson), + }, + ) + 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/radarentityip.go b/radarentityip.go new file mode 100644 index 00000000000..73ff9ee5297 --- /dev/null +++ b/radarentityip.go @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEntityIPService 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 [NewRadarEntityIPService] method +// instead. +type RadarEntityIPService struct { + Options []option.RequestOption +} + +// NewRadarEntityIPService 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 NewRadarEntityIPService(opts ...option.RequestOption) (r *RadarEntityIPService) { + r = &RadarEntityIPService{} + r.Options = opts + return +} + +// Get IP address information. +func (r *RadarEntityIPService) List(ctx context.Context, query RadarEntityIPListParams, opts ...option.RequestOption) (res *RadarEntityIPListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/entities/ip" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEntityIPListResponse struct { + Result RadarEntityIPListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEntityIPListResponseJSON `json:"-"` +} + +// radarEntityIPListResponseJSON contains the JSON metadata for the struct +// [RadarEntityIPListResponse] +type radarEntityIPListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityIPListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityIPListResponseResult struct { + IP RadarEntityIPListResponseResultIP `json:"ip,required"` + JSON radarEntityIPListResponseResultJSON `json:"-"` +} + +// radarEntityIPListResponseResultJSON contains the JSON metadata for the struct +// [RadarEntityIPListResponseResult] +type radarEntityIPListResponseResultJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityIPListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityIPListResponseResultIP struct { + ASN string `json:"asn,required"` + ASNLocation string `json:"asnLocation,required"` + ASNName string `json:"asnName,required"` + ASNOrgName string `json:"asnOrgName,required"` + IP string `json:"ip,required"` + IPVersion string `json:"ipVersion,required"` + Location string `json:"location,required"` + LocationName string `json:"locationName,required"` + JSON radarEntityIPListResponseResultIPJSON `json:"-"` +} + +// radarEntityIPListResponseResultIPJSON contains the JSON metadata for the struct +// [RadarEntityIPListResponseResultIP] +type radarEntityIPListResponseResultIPJSON struct { + ASN apijson.Field + ASNLocation apijson.Field + ASNName apijson.Field + ASNOrgName apijson.Field + IP apijson.Field + IPVersion apijson.Field + Location apijson.Field + LocationName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityIPListResponseResultIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityIPListParams struct { + // IP address. + IP param.Field[string] `query:"ip,required"` + // Format results are returned in. + Format param.Field[RadarEntityIPListParamsFormat] `query:"format"` +} + +// URLQuery serializes [RadarEntityIPListParams]'s query parameters as +// `url.Values`. +func (r RadarEntityIPListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarEntityIPListParamsFormat string + +const ( + RadarEntityIPListParamsFormatJson RadarEntityIPListParamsFormat = "JSON" + RadarEntityIPListParamsFormatCsv RadarEntityIPListParamsFormat = "CSV" +) diff --git a/radarentityip_test.go b/radarentityip_test.go new file mode 100644 index 00000000000..3d9d9b823aa --- /dev/null +++ b/radarentityip_test.go @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEntityIPListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Entities.IPs.List(context.TODO(), cloudflare.RadarEntityIPListParams{ + IP: cloudflare.F("8.8.8.8"), + Format: cloudflare.F(cloudflare.RadarEntityIPListParamsFormatJson), + }) + 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/radarentitylocation.go b/radarentitylocation.go new file mode 100644 index 00000000000..fc66a18fd35 --- /dev/null +++ b/radarentitylocation.go @@ -0,0 +1,226 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarEntityLocationService 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 [NewRadarEntityLocationService] +// method instead. +type RadarEntityLocationService struct { + Options []option.RequestOption +} + +// NewRadarEntityLocationService 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 NewRadarEntityLocationService(opts ...option.RequestOption) (r *RadarEntityLocationService) { + r = &RadarEntityLocationService{} + r.Options = opts + return +} + +// Get the requested location information. A confidence level below `5` indicates a +// low level of confidence in the traffic data - normally this happens because +// Cloudflare has a small amount of traffic from/to this location). +func (r *RadarEntityLocationService) Get(ctx context.Context, location string, query RadarEntityLocationGetParams, opts ...option.RequestOption) (res *RadarEntityLocationGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/entities/locations/%s", location) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Get a list of locations. +func (r *RadarEntityLocationService) List(ctx context.Context, query RadarEntityLocationListParams, opts ...option.RequestOption) (res *RadarEntityLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/entities/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarEntityLocationGetResponse struct { + Result RadarEntityLocationGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEntityLocationGetResponseJSON `json:"-"` +} + +// radarEntityLocationGetResponseJSON contains the JSON metadata for the struct +// [RadarEntityLocationGetResponse] +type radarEntityLocationGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityLocationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityLocationGetResponseResult struct { + Location RadarEntityLocationGetResponseResultLocation `json:"location,required"` + JSON radarEntityLocationGetResponseResultJSON `json:"-"` +} + +// radarEntityLocationGetResponseResultJSON contains the JSON metadata for the +// struct [RadarEntityLocationGetResponseResult] +type radarEntityLocationGetResponseResultJSON struct { + Location apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityLocationGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityLocationGetResponseResultLocation struct { + Alpha2 string `json:"alpha2,required"` + ConfidenceLevel int64 `json:"confidenceLevel,required"` + Latitude string `json:"latitude,required"` + Longitude string `json:"longitude,required"` + Name string `json:"name,required"` + Region string `json:"region,required"` + Subregion string `json:"subregion,required"` + JSON radarEntityLocationGetResponseResultLocationJSON `json:"-"` +} + +// radarEntityLocationGetResponseResultLocationJSON contains the JSON metadata for +// the struct [RadarEntityLocationGetResponseResultLocation] +type radarEntityLocationGetResponseResultLocationJSON struct { + Alpha2 apijson.Field + ConfidenceLevel apijson.Field + Latitude apijson.Field + Longitude apijson.Field + Name apijson.Field + Region apijson.Field + Subregion apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityLocationGetResponseResultLocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityLocationListResponse struct { + Result RadarEntityLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEntityLocationListResponseJSON `json:"-"` +} + +// radarEntityLocationListResponseJSON contains the JSON metadata for the struct +// [RadarEntityLocationListResponse] +type radarEntityLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityLocationListResponseResult struct { + Locations []RadarEntityLocationListResponseResultLocation `json:"locations,required"` + JSON radarEntityLocationListResponseResultJSON `json:"-"` +} + +// radarEntityLocationListResponseResultJSON contains the JSON metadata for the +// struct [RadarEntityLocationListResponseResult] +type radarEntityLocationListResponseResultJSON struct { + Locations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityLocationListResponseResultLocation struct { + Alpha2 string `json:"alpha2,required"` + Latitude string `json:"latitude,required"` + Longitude string `json:"longitude,required"` + Name string `json:"name,required"` + JSON radarEntityLocationListResponseResultLocationJSON `json:"-"` +} + +// radarEntityLocationListResponseResultLocationJSON contains the JSON metadata for +// the struct [RadarEntityLocationListResponseResultLocation] +type radarEntityLocationListResponseResultLocationJSON struct { + Alpha2 apijson.Field + Latitude apijson.Field + Longitude apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEntityLocationListResponseResultLocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEntityLocationGetParams struct { + // Format results are returned in. + Format param.Field[RadarEntityLocationGetParamsFormat] `query:"format"` +} + +// URLQuery serializes [RadarEntityLocationGetParams]'s query parameters as +// `url.Values`. +func (r RadarEntityLocationGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarEntityLocationGetParamsFormat string + +const ( + RadarEntityLocationGetParamsFormatJson RadarEntityLocationGetParamsFormat = "JSON" + RadarEntityLocationGetParamsFormatCsv RadarEntityLocationGetParamsFormat = "CSV" +) + +type RadarEntityLocationListParams struct { + // Format results are returned in. + Format param.Field[RadarEntityLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Comma separated list of locations. + Location param.Field[string] `query:"location"` + // Number of objects to skip before grabbing results. + Offset param.Field[int64] `query:"offset"` +} + +// URLQuery serializes [RadarEntityLocationListParams]'s query parameters as +// `url.Values`. +func (r RadarEntityLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarEntityLocationListParamsFormat string + +const ( + RadarEntityLocationListParamsFormatJson RadarEntityLocationListParamsFormat = "JSON" + RadarEntityLocationListParamsFormatCsv RadarEntityLocationListParamsFormat = "CSV" +) diff --git a/radarentitylocation_test.go b/radarentitylocation_test.go new file mode 100644 index 00000000000..a20b3991b1e --- /dev/null +++ b/radarentitylocation_test.go @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarEntityLocationGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Entities.Locations.Get( + context.TODO(), + "US", + cloudflare.RadarEntityLocationGetParams{ + Format: cloudflare.F(cloudflare.RadarEntityLocationGetParamsFormatJson), + }, + ) + 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 TestRadarEntityLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Entities.Locations.List(context.TODO(), cloudflare.RadarEntityLocationListParams{ + Format: cloudflare.F(cloudflare.RadarEntityLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F("US,CA"), + Offset: cloudflare.F(int64(0)), + }) + 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/radarhttp.go b/radarhttp.go new file mode 100644 index 00000000000..ed6972a9de1 --- /dev/null +++ b/radarhttp.go @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPService 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 [NewRadarHTTPService] method instead. +type RadarHTTPService struct { + Options []option.RequestOption + Summaries *RadarHTTPSummaryService + TimeseriesGroups *RadarHTTPTimeseriesGroupService + Tops *RadarHTTPTopService +} + +// NewRadarHTTPService 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 NewRadarHTTPService(opts ...option.RequestOption) (r *RadarHTTPService) { + r = &RadarHTTPService{} + r.Options = opts + r.Summaries = NewRadarHTTPSummaryService(opts...) + r.TimeseriesGroups = NewRadarHTTPTimeseriesGroupService(opts...) + r.Tops = NewRadarHTTPTopService(opts...) + return +} diff --git a/radarhttpsummary.go b/radarhttpsummary.go new file mode 100644 index 00000000000..41264c6e1c5 --- /dev/null +++ b/radarhttpsummary.go @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryService 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 [NewRadarHTTPSummaryService] method +// instead. +type RadarHTTPSummaryService struct { + Options []option.RequestOption + BotClasses *RadarHTTPSummaryBotClassService + DeviceTypes *RadarHTTPSummaryDeviceTypeService + HTTPProtocols *RadarHTTPSummaryHTTPProtocolService + HTTPVersions *RadarHTTPSummaryHTTPVersionService + IPVersions *RadarHTTPSummaryIPVersionService + Os *RadarHTTPSummaryOService + TlsVersions *RadarHTTPSummaryTlsVersionService +} + +// NewRadarHTTPSummaryService 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 NewRadarHTTPSummaryService(opts ...option.RequestOption) (r *RadarHTTPSummaryService) { + r = &RadarHTTPSummaryService{} + r.Options = opts + r.BotClasses = NewRadarHTTPSummaryBotClassService(opts...) + r.DeviceTypes = NewRadarHTTPSummaryDeviceTypeService(opts...) + r.HTTPProtocols = NewRadarHTTPSummaryHTTPProtocolService(opts...) + r.HTTPVersions = NewRadarHTTPSummaryHTTPVersionService(opts...) + r.IPVersions = NewRadarHTTPSummaryIPVersionService(opts...) + r.Os = NewRadarHTTPSummaryOService(opts...) + r.TlsVersions = NewRadarHTTPSummaryTlsVersionService(opts...) + return +} diff --git a/radarhttpsummarybotclass.go b/radarhttpsummarybotclass.go new file mode 100644 index 00000000000..dd35d802179 --- /dev/null +++ b/radarhttpsummarybotclass.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryBotClassService 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 +// [NewRadarHTTPSummaryBotClassService] method instead. +type RadarHTTPSummaryBotClassService struct { + Options []option.RequestOption +} + +// NewRadarHTTPSummaryBotClassService 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 NewRadarHTTPSummaryBotClassService(opts ...option.RequestOption) (r *RadarHTTPSummaryBotClassService) { + r = &RadarHTTPSummaryBotClassService{} + r.Options = opts + return +} + +// Percentage distribution of bot-generated traffic to genuine human traffic, as +// classified by Cloudflare. Visit +// https://developers.cloudflare.com/radar/concepts/bot-classes/ for more +// information. +func (r *RadarHTTPSummaryBotClassService) List(ctx context.Context, query RadarHTTPSummaryBotClassListParams, opts ...option.RequestOption) (res *RadarHTTPSummaryBotClassListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/summary/bot_class" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPSummaryBotClassListResponse struct { + Result RadarHTTPSummaryBotClassListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPSummaryBotClassListResponseJSON `json:"-"` +} + +// radarHTTPSummaryBotClassListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryBotClassListResponse] +type radarHTTPSummaryBotClassListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryBotClassListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryBotClassListResponseResult struct { + Meta RadarHTTPSummaryBotClassListResponseResultMeta `json:"meta,required"` + Summary0 RadarHTTPSummaryBotClassListResponseResultSummary0 `json:"summary_0,required"` + JSON radarHTTPSummaryBotClassListResponseResultJSON `json:"-"` +} + +// radarHTTPSummaryBotClassListResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPSummaryBotClassListResponseResult] +type radarHTTPSummaryBotClassListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryBotClassListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryBotClassListResponseResultMeta struct { + DateRange []RadarHTTPSummaryBotClassListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPSummaryBotClassListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPSummaryBotClassListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPSummaryBotClassListResponseResultMeta] +type radarHTTPSummaryBotClassListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryBotClassListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryBotClassListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPSummaryBotClassListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPSummaryBotClassListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPSummaryBotClassListResponseResultMetaDateRange] +type radarHTTPSummaryBotClassListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryBotClassListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfo] +type radarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryBotClassListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryBotClassListResponseResultSummary0 struct { + Bot string `json:"bot,required"` + Human string `json:"human,required"` + JSON radarHTTPSummaryBotClassListResponseResultSummary0JSON `json:"-"` +} + +// radarHTTPSummaryBotClassListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarHTTPSummaryBotClassListResponseResultSummary0] +type radarHTTPSummaryBotClassListResponseResultSummary0JSON struct { + Bot apijson.Field + Human apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryBotClassListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryBotClassListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPSummaryBotClassListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPSummaryBotClassListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPSummaryBotClassListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPSummaryBotClassListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPSummaryBotClassListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPSummaryBotClassListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPSummaryBotClassListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPSummaryBotClassListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPSummaryBotClassListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPSummaryBotClassListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPSummaryBotClassListParamsDateRange string + +const ( + RadarHTTPSummaryBotClassListParamsDateRange1d RadarHTTPSummaryBotClassListParamsDateRange = "1d" + RadarHTTPSummaryBotClassListParamsDateRange2d RadarHTTPSummaryBotClassListParamsDateRange = "2d" + RadarHTTPSummaryBotClassListParamsDateRange7d RadarHTTPSummaryBotClassListParamsDateRange = "7d" + RadarHTTPSummaryBotClassListParamsDateRange14d RadarHTTPSummaryBotClassListParamsDateRange = "14d" + RadarHTTPSummaryBotClassListParamsDateRange28d RadarHTTPSummaryBotClassListParamsDateRange = "28d" + RadarHTTPSummaryBotClassListParamsDateRange12w RadarHTTPSummaryBotClassListParamsDateRange = "12w" + RadarHTTPSummaryBotClassListParamsDateRange24w RadarHTTPSummaryBotClassListParamsDateRange = "24w" + RadarHTTPSummaryBotClassListParamsDateRange52w RadarHTTPSummaryBotClassListParamsDateRange = "52w" + RadarHTTPSummaryBotClassListParamsDateRange1dControl RadarHTTPSummaryBotClassListParamsDateRange = "1dControl" + RadarHTTPSummaryBotClassListParamsDateRange2dControl RadarHTTPSummaryBotClassListParamsDateRange = "2dControl" + RadarHTTPSummaryBotClassListParamsDateRange7dControl RadarHTTPSummaryBotClassListParamsDateRange = "7dControl" + RadarHTTPSummaryBotClassListParamsDateRange14dControl RadarHTTPSummaryBotClassListParamsDateRange = "14dControl" + RadarHTTPSummaryBotClassListParamsDateRange28dControl RadarHTTPSummaryBotClassListParamsDateRange = "28dControl" + RadarHTTPSummaryBotClassListParamsDateRange12wControl RadarHTTPSummaryBotClassListParamsDateRange = "12wControl" + RadarHTTPSummaryBotClassListParamsDateRange24wControl RadarHTTPSummaryBotClassListParamsDateRange = "24wControl" +) + +type RadarHTTPSummaryBotClassListParamsDeviceType string + +const ( + RadarHTTPSummaryBotClassListParamsDeviceTypeDesktop RadarHTTPSummaryBotClassListParamsDeviceType = "DESKTOP" + RadarHTTPSummaryBotClassListParamsDeviceTypeMobile RadarHTTPSummaryBotClassListParamsDeviceType = "MOBILE" + RadarHTTPSummaryBotClassListParamsDeviceTypeOther RadarHTTPSummaryBotClassListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPSummaryBotClassListParamsFormat string + +const ( + RadarHTTPSummaryBotClassListParamsFormatJson RadarHTTPSummaryBotClassListParamsFormat = "JSON" + RadarHTTPSummaryBotClassListParamsFormatCsv RadarHTTPSummaryBotClassListParamsFormat = "CSV" +) + +type RadarHTTPSummaryBotClassListParamsHTTPProtocol string + +const ( + RadarHTTPSummaryBotClassListParamsHTTPProtocolHTTP RadarHTTPSummaryBotClassListParamsHTTPProtocol = "HTTP" + RadarHTTPSummaryBotClassListParamsHTTPProtocolHTTPs RadarHTTPSummaryBotClassListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPSummaryBotClassListParamsHTTPVersion string + +const ( + RadarHTTPSummaryBotClassListParamsHTTPVersionHttPv1 RadarHTTPSummaryBotClassListParamsHTTPVersion = "HTTPv1" + RadarHTTPSummaryBotClassListParamsHTTPVersionHttPv2 RadarHTTPSummaryBotClassListParamsHTTPVersion = "HTTPv2" + RadarHTTPSummaryBotClassListParamsHTTPVersionHttPv3 RadarHTTPSummaryBotClassListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPSummaryBotClassListParamsIPVersion string + +const ( + RadarHTTPSummaryBotClassListParamsIPVersionIPv4 RadarHTTPSummaryBotClassListParamsIPVersion = "IPv4" + RadarHTTPSummaryBotClassListParamsIPVersionIPv6 RadarHTTPSummaryBotClassListParamsIPVersion = "IPv6" +) + +type RadarHTTPSummaryBotClassListParamsO string + +const ( + RadarHTTPSummaryBotClassListParamsOWindows RadarHTTPSummaryBotClassListParamsO = "WINDOWS" + RadarHTTPSummaryBotClassListParamsOMacosx RadarHTTPSummaryBotClassListParamsO = "MACOSX" + RadarHTTPSummaryBotClassListParamsOIos RadarHTTPSummaryBotClassListParamsO = "IOS" + RadarHTTPSummaryBotClassListParamsOAndroid RadarHTTPSummaryBotClassListParamsO = "ANDROID" + RadarHTTPSummaryBotClassListParamsOChromeos RadarHTTPSummaryBotClassListParamsO = "CHROMEOS" + RadarHTTPSummaryBotClassListParamsOLinux RadarHTTPSummaryBotClassListParamsO = "LINUX" + RadarHTTPSummaryBotClassListParamsOSmartTv RadarHTTPSummaryBotClassListParamsO = "SMART_TV" +) + +type RadarHTTPSummaryBotClassListParamsTlsVersion string + +const ( + RadarHTTPSummaryBotClassListParamsTlsVersionTlSv1_0 RadarHTTPSummaryBotClassListParamsTlsVersion = "TLSv1_0" + RadarHTTPSummaryBotClassListParamsTlsVersionTlSv1_1 RadarHTTPSummaryBotClassListParamsTlsVersion = "TLSv1_1" + RadarHTTPSummaryBotClassListParamsTlsVersionTlSv1_2 RadarHTTPSummaryBotClassListParamsTlsVersion = "TLSv1_2" + RadarHTTPSummaryBotClassListParamsTlsVersionTlSv1_3 RadarHTTPSummaryBotClassListParamsTlsVersion = "TLSv1_3" + RadarHTTPSummaryBotClassListParamsTlsVersionTlSvQuic RadarHTTPSummaryBotClassListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttpsummarybotclass_test.go b/radarhttpsummarybotclass_test.go new file mode 100644 index 00000000000..d4e93df71c3 --- /dev/null +++ b/radarhttpsummarybotclass_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPSummaryBotClassListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Summaries.BotClasses.List(context.TODO(), cloudflare.RadarHTTPSummaryBotClassListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPSummaryBotClassListParamsDateRange{cloudflare.RadarHTTPSummaryBotClassListParamsDateRange1d, cloudflare.RadarHTTPSummaryBotClassListParamsDateRange2d, cloudflare.RadarHTTPSummaryBotClassListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPSummaryBotClassListParamsDeviceType{cloudflare.RadarHTTPSummaryBotClassListParamsDeviceTypeDesktop, cloudflare.RadarHTTPSummaryBotClassListParamsDeviceTypeMobile, cloudflare.RadarHTTPSummaryBotClassListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPSummaryBotClassListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPSummaryBotClassListParamsHTTPProtocol{cloudflare.RadarHTTPSummaryBotClassListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPSummaryBotClassListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryBotClassListParamsHTTPVersion{cloudflare.RadarHTTPSummaryBotClassListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPSummaryBotClassListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPSummaryBotClassListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryBotClassListParamsIPVersion{cloudflare.RadarHTTPSummaryBotClassListParamsIPVersionIPv4, cloudflare.RadarHTTPSummaryBotClassListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPSummaryBotClassListParamsO{cloudflare.RadarHTTPSummaryBotClassListParamsOWindows, cloudflare.RadarHTTPSummaryBotClassListParamsOMacosx, cloudflare.RadarHTTPSummaryBotClassListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryBotClassListParamsTlsVersion{cloudflare.RadarHTTPSummaryBotClassListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPSummaryBotClassListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPSummaryBotClassListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttpsummarydevicetype.go b/radarhttpsummarydevicetype.go new file mode 100644 index 00000000000..ea96e783508 --- /dev/null +++ b/radarhttpsummarydevicetype.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryDeviceTypeService 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 +// [NewRadarHTTPSummaryDeviceTypeService] method instead. +type RadarHTTPSummaryDeviceTypeService struct { + Options []option.RequestOption +} + +// NewRadarHTTPSummaryDeviceTypeService 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 NewRadarHTTPSummaryDeviceTypeService(opts ...option.RequestOption) (r *RadarHTTPSummaryDeviceTypeService) { + r = &RadarHTTPSummaryDeviceTypeService{} + r.Options = opts + return +} + +// Percentage of Internet traffic generated by mobile, desktop, and other types of +// devices, over a given time period. +func (r *RadarHTTPSummaryDeviceTypeService) List(ctx context.Context, query RadarHTTPSummaryDeviceTypeListParams, opts ...option.RequestOption) (res *RadarHTTPSummaryDeviceTypeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/summary/device_type" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPSummaryDeviceTypeListResponse struct { + Result RadarHTTPSummaryDeviceTypeListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPSummaryDeviceTypeListResponseJSON `json:"-"` +} + +// radarHTTPSummaryDeviceTypeListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryDeviceTypeListResponse] +type radarHTTPSummaryDeviceTypeListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryDeviceTypeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryDeviceTypeListResponseResult struct { + Meta RadarHTTPSummaryDeviceTypeListResponseResultMeta `json:"meta,required"` + Summary0 RadarHTTPSummaryDeviceTypeListResponseResultSummary0 `json:"summary_0,required"` + JSON radarHTTPSummaryDeviceTypeListResponseResultJSON `json:"-"` +} + +// radarHTTPSummaryDeviceTypeListResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPSummaryDeviceTypeListResponseResult] +type radarHTTPSummaryDeviceTypeListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryDeviceTypeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryDeviceTypeListResponseResultMeta struct { + DateRange []RadarHTTPSummaryDeviceTypeListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPSummaryDeviceTypeListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPSummaryDeviceTypeListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPSummaryDeviceTypeListResponseResultMeta] +type radarHTTPSummaryDeviceTypeListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryDeviceTypeListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryDeviceTypeListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPSummaryDeviceTypeListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPSummaryDeviceTypeListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPSummaryDeviceTypeListResponseResultMetaDateRange] +type radarHTTPSummaryDeviceTypeListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryDeviceTypeListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfo] +type radarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryDeviceTypeListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryDeviceTypeListResponseResultSummary0 struct { + Desktop string `json:"desktop,required"` + Mobile string `json:"mobile,required"` + Other string `json:"other,required"` + JSON radarHTTPSummaryDeviceTypeListResponseResultSummary0JSON `json:"-"` +} + +// radarHTTPSummaryDeviceTypeListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarHTTPSummaryDeviceTypeListResponseResultSummary0] +type radarHTTPSummaryDeviceTypeListResponseResultSummary0JSON struct { + Desktop apijson.Field + Mobile apijson.Field + Other apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryDeviceTypeListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryDeviceTypeListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPSummaryDeviceTypeListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPSummaryDeviceTypeListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarHTTPSummaryDeviceTypeListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPSummaryDeviceTypeListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPSummaryDeviceTypeListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPSummaryDeviceTypeListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPSummaryDeviceTypeListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPSummaryDeviceTypeListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPSummaryDeviceTypeListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPSummaryDeviceTypeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPSummaryDeviceTypeListParamsBotClass string + +const ( + RadarHTTPSummaryDeviceTypeListParamsBotClassLikelyAutomated RadarHTTPSummaryDeviceTypeListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPSummaryDeviceTypeListParamsBotClassLikelyHuman RadarHTTPSummaryDeviceTypeListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPSummaryDeviceTypeListParamsDateRange string + +const ( + RadarHTTPSummaryDeviceTypeListParamsDateRange1d RadarHTTPSummaryDeviceTypeListParamsDateRange = "1d" + RadarHTTPSummaryDeviceTypeListParamsDateRange2d RadarHTTPSummaryDeviceTypeListParamsDateRange = "2d" + RadarHTTPSummaryDeviceTypeListParamsDateRange7d RadarHTTPSummaryDeviceTypeListParamsDateRange = "7d" + RadarHTTPSummaryDeviceTypeListParamsDateRange14d RadarHTTPSummaryDeviceTypeListParamsDateRange = "14d" + RadarHTTPSummaryDeviceTypeListParamsDateRange28d RadarHTTPSummaryDeviceTypeListParamsDateRange = "28d" + RadarHTTPSummaryDeviceTypeListParamsDateRange12w RadarHTTPSummaryDeviceTypeListParamsDateRange = "12w" + RadarHTTPSummaryDeviceTypeListParamsDateRange24w RadarHTTPSummaryDeviceTypeListParamsDateRange = "24w" + RadarHTTPSummaryDeviceTypeListParamsDateRange52w RadarHTTPSummaryDeviceTypeListParamsDateRange = "52w" + RadarHTTPSummaryDeviceTypeListParamsDateRange1dControl RadarHTTPSummaryDeviceTypeListParamsDateRange = "1dControl" + RadarHTTPSummaryDeviceTypeListParamsDateRange2dControl RadarHTTPSummaryDeviceTypeListParamsDateRange = "2dControl" + RadarHTTPSummaryDeviceTypeListParamsDateRange7dControl RadarHTTPSummaryDeviceTypeListParamsDateRange = "7dControl" + RadarHTTPSummaryDeviceTypeListParamsDateRange14dControl RadarHTTPSummaryDeviceTypeListParamsDateRange = "14dControl" + RadarHTTPSummaryDeviceTypeListParamsDateRange28dControl RadarHTTPSummaryDeviceTypeListParamsDateRange = "28dControl" + RadarHTTPSummaryDeviceTypeListParamsDateRange12wControl RadarHTTPSummaryDeviceTypeListParamsDateRange = "12wControl" + RadarHTTPSummaryDeviceTypeListParamsDateRange24wControl RadarHTTPSummaryDeviceTypeListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarHTTPSummaryDeviceTypeListParamsFormat string + +const ( + RadarHTTPSummaryDeviceTypeListParamsFormatJson RadarHTTPSummaryDeviceTypeListParamsFormat = "JSON" + RadarHTTPSummaryDeviceTypeListParamsFormatCsv RadarHTTPSummaryDeviceTypeListParamsFormat = "CSV" +) + +type RadarHTTPSummaryDeviceTypeListParamsHTTPProtocol string + +const ( + RadarHTTPSummaryDeviceTypeListParamsHTTPProtocolHTTP RadarHTTPSummaryDeviceTypeListParamsHTTPProtocol = "HTTP" + RadarHTTPSummaryDeviceTypeListParamsHTTPProtocolHTTPs RadarHTTPSummaryDeviceTypeListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPSummaryDeviceTypeListParamsHTTPVersion string + +const ( + RadarHTTPSummaryDeviceTypeListParamsHTTPVersionHttPv1 RadarHTTPSummaryDeviceTypeListParamsHTTPVersion = "HTTPv1" + RadarHTTPSummaryDeviceTypeListParamsHTTPVersionHttPv2 RadarHTTPSummaryDeviceTypeListParamsHTTPVersion = "HTTPv2" + RadarHTTPSummaryDeviceTypeListParamsHTTPVersionHttPv3 RadarHTTPSummaryDeviceTypeListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPSummaryDeviceTypeListParamsIPVersion string + +const ( + RadarHTTPSummaryDeviceTypeListParamsIPVersionIPv4 RadarHTTPSummaryDeviceTypeListParamsIPVersion = "IPv4" + RadarHTTPSummaryDeviceTypeListParamsIPVersionIPv6 RadarHTTPSummaryDeviceTypeListParamsIPVersion = "IPv6" +) + +type RadarHTTPSummaryDeviceTypeListParamsO string + +const ( + RadarHTTPSummaryDeviceTypeListParamsOWindows RadarHTTPSummaryDeviceTypeListParamsO = "WINDOWS" + RadarHTTPSummaryDeviceTypeListParamsOMacosx RadarHTTPSummaryDeviceTypeListParamsO = "MACOSX" + RadarHTTPSummaryDeviceTypeListParamsOIos RadarHTTPSummaryDeviceTypeListParamsO = "IOS" + RadarHTTPSummaryDeviceTypeListParamsOAndroid RadarHTTPSummaryDeviceTypeListParamsO = "ANDROID" + RadarHTTPSummaryDeviceTypeListParamsOChromeos RadarHTTPSummaryDeviceTypeListParamsO = "CHROMEOS" + RadarHTTPSummaryDeviceTypeListParamsOLinux RadarHTTPSummaryDeviceTypeListParamsO = "LINUX" + RadarHTTPSummaryDeviceTypeListParamsOSmartTv RadarHTTPSummaryDeviceTypeListParamsO = "SMART_TV" +) + +type RadarHTTPSummaryDeviceTypeListParamsTlsVersion string + +const ( + RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSv1_0 RadarHTTPSummaryDeviceTypeListParamsTlsVersion = "TLSv1_0" + RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSv1_1 RadarHTTPSummaryDeviceTypeListParamsTlsVersion = "TLSv1_1" + RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSv1_2 RadarHTTPSummaryDeviceTypeListParamsTlsVersion = "TLSv1_2" + RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSv1_3 RadarHTTPSummaryDeviceTypeListParamsTlsVersion = "TLSv1_3" + RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSvQuic RadarHTTPSummaryDeviceTypeListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttpsummarydevicetype_test.go b/radarhttpsummarydevicetype_test.go new file mode 100644 index 00000000000..e27558fc46a --- /dev/null +++ b/radarhttpsummarydevicetype_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPSummaryDeviceTypeListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Summaries.DeviceTypes.List(context.TODO(), cloudflare.RadarHTTPSummaryDeviceTypeListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPSummaryDeviceTypeListParamsBotClass{cloudflare.RadarHTTPSummaryDeviceTypeListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPSummaryDeviceTypeListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPSummaryDeviceTypeListParamsDateRange{cloudflare.RadarHTTPSummaryDeviceTypeListParamsDateRange1d, cloudflare.RadarHTTPSummaryDeviceTypeListParamsDateRange2d, cloudflare.RadarHTTPSummaryDeviceTypeListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarHTTPSummaryDeviceTypeListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPSummaryDeviceTypeListParamsHTTPProtocol{cloudflare.RadarHTTPSummaryDeviceTypeListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPSummaryDeviceTypeListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryDeviceTypeListParamsHTTPVersion{cloudflare.RadarHTTPSummaryDeviceTypeListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPSummaryDeviceTypeListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPSummaryDeviceTypeListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryDeviceTypeListParamsIPVersion{cloudflare.RadarHTTPSummaryDeviceTypeListParamsIPVersionIPv4, cloudflare.RadarHTTPSummaryDeviceTypeListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPSummaryDeviceTypeListParamsO{cloudflare.RadarHTTPSummaryDeviceTypeListParamsOWindows, cloudflare.RadarHTTPSummaryDeviceTypeListParamsOMacosx, cloudflare.RadarHTTPSummaryDeviceTypeListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryDeviceTypeListParamsTlsVersion{cloudflare.RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPSummaryDeviceTypeListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttpsummaryhttpprotocol.go b/radarhttpsummaryhttpprotocol.go new file mode 100644 index 00000000000..16eece28f04 --- /dev/null +++ b/radarhttpsummaryhttpprotocol.go @@ -0,0 +1,319 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryHTTPProtocolService 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 +// [NewRadarHTTPSummaryHTTPProtocolService] method instead. +type RadarHTTPSummaryHTTPProtocolService struct { + Options []option.RequestOption +} + +// NewRadarHTTPSummaryHTTPProtocolService 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 NewRadarHTTPSummaryHTTPProtocolService(opts ...option.RequestOption) (r *RadarHTTPSummaryHTTPProtocolService) { + r = &RadarHTTPSummaryHTTPProtocolService{} + r.Options = opts + return +} + +// Percentage distribution of traffic per HTTP protocol over a given time period. +func (r *RadarHTTPSummaryHTTPProtocolService) List(ctx context.Context, query RadarHTTPSummaryHTTPProtocolListParams, opts ...option.RequestOption) (res *RadarHTTPSummaryHTTPProtocolListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/summary/http_protocol" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPSummaryHTTPProtocolListResponse struct { + Result RadarHTTPSummaryHTTPProtocolListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPSummaryHTTPProtocolListResponseJSON `json:"-"` +} + +// radarHTTPSummaryHTTPProtocolListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryHTTPProtocolListResponse] +type radarHTTPSummaryHTTPProtocolListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPProtocolListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPProtocolListResponseResult struct { + Meta RadarHTTPSummaryHTTPProtocolListResponseResultMeta `json:"meta,required"` + Summary0 RadarHTTPSummaryHTTPProtocolListResponseResultSummary0 `json:"summary_0,required"` + JSON radarHTTPSummaryHTTPProtocolListResponseResultJSON `json:"-"` +} + +// radarHTTPSummaryHTTPProtocolListResponseResultJSON contains the JSON metadata +// for the struct [RadarHTTPSummaryHTTPProtocolListResponseResult] +type radarHTTPSummaryHTTPProtocolListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPProtocolListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPProtocolListResponseResultMeta struct { + DateRange []RadarHTTPSummaryHTTPProtocolListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPSummaryHTTPProtocolListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPSummaryHTTPProtocolListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarHTTPSummaryHTTPProtocolListResponseResultMeta] +type radarHTTPSummaryHTTPProtocolListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPProtocolListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPProtocolListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPSummaryHTTPProtocolListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPSummaryHTTPProtocolListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarHTTPSummaryHTTPProtocolListResponseResultMetaDateRange] +type radarHTTPSummaryHTTPProtocolListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPProtocolListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfo] +type radarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPProtocolListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPProtocolListResponseResultSummary0 struct { + HTTP string `json:"http,required"` + HTTPs string `json:"https,required"` + JSON radarHTTPSummaryHTTPProtocolListResponseResultSummary0JSON `json:"-"` +} + +// radarHTTPSummaryHTTPProtocolListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarHTTPSummaryHTTPProtocolListResponseResultSummary0] +type radarHTTPSummaryHTTPProtocolListResponseResultSummary0JSON struct { + HTTP apijson.Field + HTTPs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPProtocolListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPProtocolListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPSummaryHTTPProtocolListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPSummaryHTTPProtocolListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPSummaryHTTPProtocolListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPSummaryHTTPProtocolListParamsFormat] `query:"format"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPSummaryHTTPProtocolListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPSummaryHTTPProtocolListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPSummaryHTTPProtocolListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPSummaryHTTPProtocolListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPSummaryHTTPProtocolListParams]'s query parameters +// as `url.Values`. +func (r RadarHTTPSummaryHTTPProtocolListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPSummaryHTTPProtocolListParamsBotClass string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsBotClassLikelyAutomated RadarHTTPSummaryHTTPProtocolListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPSummaryHTTPProtocolListParamsBotClassLikelyHuman RadarHTTPSummaryHTTPProtocolListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPSummaryHTTPProtocolListParamsDateRange string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsDateRange1d RadarHTTPSummaryHTTPProtocolListParamsDateRange = "1d" + RadarHTTPSummaryHTTPProtocolListParamsDateRange2d RadarHTTPSummaryHTTPProtocolListParamsDateRange = "2d" + RadarHTTPSummaryHTTPProtocolListParamsDateRange7d RadarHTTPSummaryHTTPProtocolListParamsDateRange = "7d" + RadarHTTPSummaryHTTPProtocolListParamsDateRange14d RadarHTTPSummaryHTTPProtocolListParamsDateRange = "14d" + RadarHTTPSummaryHTTPProtocolListParamsDateRange28d RadarHTTPSummaryHTTPProtocolListParamsDateRange = "28d" + RadarHTTPSummaryHTTPProtocolListParamsDateRange12w RadarHTTPSummaryHTTPProtocolListParamsDateRange = "12w" + RadarHTTPSummaryHTTPProtocolListParamsDateRange24w RadarHTTPSummaryHTTPProtocolListParamsDateRange = "24w" + RadarHTTPSummaryHTTPProtocolListParamsDateRange52w RadarHTTPSummaryHTTPProtocolListParamsDateRange = "52w" + RadarHTTPSummaryHTTPProtocolListParamsDateRange1dControl RadarHTTPSummaryHTTPProtocolListParamsDateRange = "1dControl" + RadarHTTPSummaryHTTPProtocolListParamsDateRange2dControl RadarHTTPSummaryHTTPProtocolListParamsDateRange = "2dControl" + RadarHTTPSummaryHTTPProtocolListParamsDateRange7dControl RadarHTTPSummaryHTTPProtocolListParamsDateRange = "7dControl" + RadarHTTPSummaryHTTPProtocolListParamsDateRange14dControl RadarHTTPSummaryHTTPProtocolListParamsDateRange = "14dControl" + RadarHTTPSummaryHTTPProtocolListParamsDateRange28dControl RadarHTTPSummaryHTTPProtocolListParamsDateRange = "28dControl" + RadarHTTPSummaryHTTPProtocolListParamsDateRange12wControl RadarHTTPSummaryHTTPProtocolListParamsDateRange = "12wControl" + RadarHTTPSummaryHTTPProtocolListParamsDateRange24wControl RadarHTTPSummaryHTTPProtocolListParamsDateRange = "24wControl" +) + +type RadarHTTPSummaryHTTPProtocolListParamsDeviceType string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsDeviceTypeDesktop RadarHTTPSummaryHTTPProtocolListParamsDeviceType = "DESKTOP" + RadarHTTPSummaryHTTPProtocolListParamsDeviceTypeMobile RadarHTTPSummaryHTTPProtocolListParamsDeviceType = "MOBILE" + RadarHTTPSummaryHTTPProtocolListParamsDeviceTypeOther RadarHTTPSummaryHTTPProtocolListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPSummaryHTTPProtocolListParamsFormat string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsFormatJson RadarHTTPSummaryHTTPProtocolListParamsFormat = "JSON" + RadarHTTPSummaryHTTPProtocolListParamsFormatCsv RadarHTTPSummaryHTTPProtocolListParamsFormat = "CSV" +) + +type RadarHTTPSummaryHTTPProtocolListParamsHTTPVersion string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsHTTPVersionHttPv1 RadarHTTPSummaryHTTPProtocolListParamsHTTPVersion = "HTTPv1" + RadarHTTPSummaryHTTPProtocolListParamsHTTPVersionHttPv2 RadarHTTPSummaryHTTPProtocolListParamsHTTPVersion = "HTTPv2" + RadarHTTPSummaryHTTPProtocolListParamsHTTPVersionHttPv3 RadarHTTPSummaryHTTPProtocolListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPSummaryHTTPProtocolListParamsIPVersion string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsIPVersionIPv4 RadarHTTPSummaryHTTPProtocolListParamsIPVersion = "IPv4" + RadarHTTPSummaryHTTPProtocolListParamsIPVersionIPv6 RadarHTTPSummaryHTTPProtocolListParamsIPVersion = "IPv6" +) + +type RadarHTTPSummaryHTTPProtocolListParamsO string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsOWindows RadarHTTPSummaryHTTPProtocolListParamsO = "WINDOWS" + RadarHTTPSummaryHTTPProtocolListParamsOMacosx RadarHTTPSummaryHTTPProtocolListParamsO = "MACOSX" + RadarHTTPSummaryHTTPProtocolListParamsOIos RadarHTTPSummaryHTTPProtocolListParamsO = "IOS" + RadarHTTPSummaryHTTPProtocolListParamsOAndroid RadarHTTPSummaryHTTPProtocolListParamsO = "ANDROID" + RadarHTTPSummaryHTTPProtocolListParamsOChromeos RadarHTTPSummaryHTTPProtocolListParamsO = "CHROMEOS" + RadarHTTPSummaryHTTPProtocolListParamsOLinux RadarHTTPSummaryHTTPProtocolListParamsO = "LINUX" + RadarHTTPSummaryHTTPProtocolListParamsOSmartTv RadarHTTPSummaryHTTPProtocolListParamsO = "SMART_TV" +) + +type RadarHTTPSummaryHTTPProtocolListParamsTlsVersion string + +const ( + RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSv1_0 RadarHTTPSummaryHTTPProtocolListParamsTlsVersion = "TLSv1_0" + RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSv1_1 RadarHTTPSummaryHTTPProtocolListParamsTlsVersion = "TLSv1_1" + RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSv1_2 RadarHTTPSummaryHTTPProtocolListParamsTlsVersion = "TLSv1_2" + RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSv1_3 RadarHTTPSummaryHTTPProtocolListParamsTlsVersion = "TLSv1_3" + RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSvQuic RadarHTTPSummaryHTTPProtocolListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttpsummaryhttpprotocol_test.go b/radarhttpsummaryhttpprotocol_test.go new file mode 100644 index 00000000000..6b0106a720d --- /dev/null +++ b/radarhttpsummaryhttpprotocol_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPSummaryHTTPProtocolListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Summaries.HTTPProtocols.List(context.TODO(), cloudflare.RadarHTTPSummaryHTTPProtocolListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPProtocolListParamsBotClass{cloudflare.RadarHTTPSummaryHTTPProtocolListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDateRange{cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDateRange1d, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDateRange2d, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDeviceType{cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDeviceTypeDesktop, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDeviceTypeMobile, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPSummaryHTTPProtocolListParamsFormatJson), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPProtocolListParamsHTTPVersion{cloudflare.RadarHTTPSummaryHTTPProtocolListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPProtocolListParamsIPVersion{cloudflare.RadarHTTPSummaryHTTPProtocolListParamsIPVersionIPv4, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPProtocolListParamsO{cloudflare.RadarHTTPSummaryHTTPProtocolListParamsOWindows, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsOMacosx, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPProtocolListParamsTlsVersion{cloudflare.RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPSummaryHTTPProtocolListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttpsummaryhttpversion.go b/radarhttpsummaryhttpversion.go new file mode 100644 index 00000000000..d1c27b44efc --- /dev/null +++ b/radarhttpsummaryhttpversion.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryHTTPVersionService 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 +// [NewRadarHTTPSummaryHTTPVersionService] method instead. +type RadarHTTPSummaryHTTPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPSummaryHTTPVersionService 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 NewRadarHTTPSummaryHTTPVersionService(opts ...option.RequestOption) (r *RadarHTTPSummaryHTTPVersionService) { + r = &RadarHTTPSummaryHTTPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of traffic per HTTP protocol version over a given time +// period. +func (r *RadarHTTPSummaryHTTPVersionService) List(ctx context.Context, query RadarHTTPSummaryHTTPVersionListParams, opts ...option.RequestOption) (res *RadarHTTPSummaryHTTPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/summary/http_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPSummaryHTTPVersionListResponse struct { + Result RadarHTTPSummaryHTTPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPSummaryHTTPVersionListResponseJSON `json:"-"` +} + +// radarHTTPSummaryHTTPVersionListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryHTTPVersionListResponse] +type radarHTTPSummaryHTTPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPVersionListResponseResult struct { + Meta RadarHTTPSummaryHTTPVersionListResponseResultMeta `json:"meta,required"` + Summary0 RadarHTTPSummaryHTTPVersionListResponseResultSummary0 `json:"summary_0,required"` + JSON radarHTTPSummaryHTTPVersionListResponseResultJSON `json:"-"` +} + +// radarHTTPSummaryHTTPVersionListResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPSummaryHTTPVersionListResponseResult] +type radarHTTPSummaryHTTPVersionListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPVersionListResponseResultMeta struct { + DateRange []RadarHTTPSummaryHTTPVersionListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPSummaryHTTPVersionListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPSummaryHTTPVersionListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPSummaryHTTPVersionListResponseResultMeta] +type radarHTTPSummaryHTTPVersionListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPVersionListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPVersionListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPSummaryHTTPVersionListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPSummaryHTTPVersionListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPSummaryHTTPVersionListResponseResultMetaDateRange] +type radarHTTPSummaryHTTPVersionListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPVersionListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfo] +type radarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPVersionListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPVersionListResponseResultSummary0 struct { + HTTP1X string `json:"HTTP/1.x,required"` + HTTP2 string `json:"HTTP/2,required"` + HTTP3 string `json:"HTTP/3,required"` + JSON radarHTTPSummaryHTTPVersionListResponseResultSummary0JSON `json:"-"` +} + +// radarHTTPSummaryHTTPVersionListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarHTTPSummaryHTTPVersionListResponseResultSummary0] +type radarHTTPSummaryHTTPVersionListResponseResultSummary0JSON struct { + HTTP1X apijson.Field + HTTP2 apijson.Field + HTTP3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryHTTPVersionListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryHTTPVersionListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPSummaryHTTPVersionListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPSummaryHTTPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPSummaryHTTPVersionListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPSummaryHTTPVersionListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPSummaryHTTPVersionListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPSummaryHTTPVersionListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPSummaryHTTPVersionListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPSummaryHTTPVersionListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPSummaryHTTPVersionListParams]'s query parameters +// as `url.Values`. +func (r RadarHTTPSummaryHTTPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPSummaryHTTPVersionListParamsBotClass string + +const ( + RadarHTTPSummaryHTTPVersionListParamsBotClassLikelyAutomated RadarHTTPSummaryHTTPVersionListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPSummaryHTTPVersionListParamsBotClassLikelyHuman RadarHTTPSummaryHTTPVersionListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPSummaryHTTPVersionListParamsDateRange string + +const ( + RadarHTTPSummaryHTTPVersionListParamsDateRange1d RadarHTTPSummaryHTTPVersionListParamsDateRange = "1d" + RadarHTTPSummaryHTTPVersionListParamsDateRange2d RadarHTTPSummaryHTTPVersionListParamsDateRange = "2d" + RadarHTTPSummaryHTTPVersionListParamsDateRange7d RadarHTTPSummaryHTTPVersionListParamsDateRange = "7d" + RadarHTTPSummaryHTTPVersionListParamsDateRange14d RadarHTTPSummaryHTTPVersionListParamsDateRange = "14d" + RadarHTTPSummaryHTTPVersionListParamsDateRange28d RadarHTTPSummaryHTTPVersionListParamsDateRange = "28d" + RadarHTTPSummaryHTTPVersionListParamsDateRange12w RadarHTTPSummaryHTTPVersionListParamsDateRange = "12w" + RadarHTTPSummaryHTTPVersionListParamsDateRange24w RadarHTTPSummaryHTTPVersionListParamsDateRange = "24w" + RadarHTTPSummaryHTTPVersionListParamsDateRange52w RadarHTTPSummaryHTTPVersionListParamsDateRange = "52w" + RadarHTTPSummaryHTTPVersionListParamsDateRange1dControl RadarHTTPSummaryHTTPVersionListParamsDateRange = "1dControl" + RadarHTTPSummaryHTTPVersionListParamsDateRange2dControl RadarHTTPSummaryHTTPVersionListParamsDateRange = "2dControl" + RadarHTTPSummaryHTTPVersionListParamsDateRange7dControl RadarHTTPSummaryHTTPVersionListParamsDateRange = "7dControl" + RadarHTTPSummaryHTTPVersionListParamsDateRange14dControl RadarHTTPSummaryHTTPVersionListParamsDateRange = "14dControl" + RadarHTTPSummaryHTTPVersionListParamsDateRange28dControl RadarHTTPSummaryHTTPVersionListParamsDateRange = "28dControl" + RadarHTTPSummaryHTTPVersionListParamsDateRange12wControl RadarHTTPSummaryHTTPVersionListParamsDateRange = "12wControl" + RadarHTTPSummaryHTTPVersionListParamsDateRange24wControl RadarHTTPSummaryHTTPVersionListParamsDateRange = "24wControl" +) + +type RadarHTTPSummaryHTTPVersionListParamsDeviceType string + +const ( + RadarHTTPSummaryHTTPVersionListParamsDeviceTypeDesktop RadarHTTPSummaryHTTPVersionListParamsDeviceType = "DESKTOP" + RadarHTTPSummaryHTTPVersionListParamsDeviceTypeMobile RadarHTTPSummaryHTTPVersionListParamsDeviceType = "MOBILE" + RadarHTTPSummaryHTTPVersionListParamsDeviceTypeOther RadarHTTPSummaryHTTPVersionListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPSummaryHTTPVersionListParamsFormat string + +const ( + RadarHTTPSummaryHTTPVersionListParamsFormatJson RadarHTTPSummaryHTTPVersionListParamsFormat = "JSON" + RadarHTTPSummaryHTTPVersionListParamsFormatCsv RadarHTTPSummaryHTTPVersionListParamsFormat = "CSV" +) + +type RadarHTTPSummaryHTTPVersionListParamsHTTPProtocol string + +const ( + RadarHTTPSummaryHTTPVersionListParamsHTTPProtocolHTTP RadarHTTPSummaryHTTPVersionListParamsHTTPProtocol = "HTTP" + RadarHTTPSummaryHTTPVersionListParamsHTTPProtocolHTTPs RadarHTTPSummaryHTTPVersionListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPSummaryHTTPVersionListParamsIPVersion string + +const ( + RadarHTTPSummaryHTTPVersionListParamsIPVersionIPv4 RadarHTTPSummaryHTTPVersionListParamsIPVersion = "IPv4" + RadarHTTPSummaryHTTPVersionListParamsIPVersionIPv6 RadarHTTPSummaryHTTPVersionListParamsIPVersion = "IPv6" +) + +type RadarHTTPSummaryHTTPVersionListParamsO string + +const ( + RadarHTTPSummaryHTTPVersionListParamsOWindows RadarHTTPSummaryHTTPVersionListParamsO = "WINDOWS" + RadarHTTPSummaryHTTPVersionListParamsOMacosx RadarHTTPSummaryHTTPVersionListParamsO = "MACOSX" + RadarHTTPSummaryHTTPVersionListParamsOIos RadarHTTPSummaryHTTPVersionListParamsO = "IOS" + RadarHTTPSummaryHTTPVersionListParamsOAndroid RadarHTTPSummaryHTTPVersionListParamsO = "ANDROID" + RadarHTTPSummaryHTTPVersionListParamsOChromeos RadarHTTPSummaryHTTPVersionListParamsO = "CHROMEOS" + RadarHTTPSummaryHTTPVersionListParamsOLinux RadarHTTPSummaryHTTPVersionListParamsO = "LINUX" + RadarHTTPSummaryHTTPVersionListParamsOSmartTv RadarHTTPSummaryHTTPVersionListParamsO = "SMART_TV" +) + +type RadarHTTPSummaryHTTPVersionListParamsTlsVersion string + +const ( + RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSv1_0 RadarHTTPSummaryHTTPVersionListParamsTlsVersion = "TLSv1_0" + RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSv1_1 RadarHTTPSummaryHTTPVersionListParamsTlsVersion = "TLSv1_1" + RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSv1_2 RadarHTTPSummaryHTTPVersionListParamsTlsVersion = "TLSv1_2" + RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSv1_3 RadarHTTPSummaryHTTPVersionListParamsTlsVersion = "TLSv1_3" + RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSvQuic RadarHTTPSummaryHTTPVersionListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttpsummaryhttpversion_test.go b/radarhttpsummaryhttpversion_test.go new file mode 100644 index 00000000000..0a9925139e1 --- /dev/null +++ b/radarhttpsummaryhttpversion_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPSummaryHTTPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Summaries.HTTPVersions.List(context.TODO(), cloudflare.RadarHTTPSummaryHTTPVersionListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPVersionListParamsBotClass{cloudflare.RadarHTTPSummaryHTTPVersionListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPSummaryHTTPVersionListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPVersionListParamsDateRange{cloudflare.RadarHTTPSummaryHTTPVersionListParamsDateRange1d, cloudflare.RadarHTTPSummaryHTTPVersionListParamsDateRange2d, cloudflare.RadarHTTPSummaryHTTPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPVersionListParamsDeviceType{cloudflare.RadarHTTPSummaryHTTPVersionListParamsDeviceTypeDesktop, cloudflare.RadarHTTPSummaryHTTPVersionListParamsDeviceTypeMobile, cloudflare.RadarHTTPSummaryHTTPVersionListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPSummaryHTTPVersionListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPVersionListParamsHTTPProtocol{cloudflare.RadarHTTPSummaryHTTPVersionListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPSummaryHTTPVersionListParamsHTTPProtocolHTTPs}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPVersionListParamsIPVersion{cloudflare.RadarHTTPSummaryHTTPVersionListParamsIPVersionIPv4, cloudflare.RadarHTTPSummaryHTTPVersionListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPVersionListParamsO{cloudflare.RadarHTTPSummaryHTTPVersionListParamsOWindows, cloudflare.RadarHTTPSummaryHTTPVersionListParamsOMacosx, cloudflare.RadarHTTPSummaryHTTPVersionListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryHTTPVersionListParamsTlsVersion{cloudflare.RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPSummaryHTTPVersionListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttpsummaryipversion.go b/radarhttpsummaryipversion.go new file mode 100644 index 00000000000..b6e676be170 --- /dev/null +++ b/radarhttpsummaryipversion.go @@ -0,0 +1,320 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryIPVersionService 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 +// [NewRadarHTTPSummaryIPVersionService] method instead. +type RadarHTTPSummaryIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPSummaryIPVersionService 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 NewRadarHTTPSummaryIPVersionService(opts ...option.RequestOption) (r *RadarHTTPSummaryIPVersionService) { + r = &RadarHTTPSummaryIPVersionService{} + r.Options = opts + return +} + +// Percentage distribution of Internet traffic based on IP protocol versions, such +// as IPv4 and IPv6, over a given time period. +func (r *RadarHTTPSummaryIPVersionService) List(ctx context.Context, query RadarHTTPSummaryIPVersionListParams, opts ...option.RequestOption) (res *RadarHTTPSummaryIPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/summary/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPSummaryIPVersionListResponse struct { + Result RadarHTTPSummaryIPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPSummaryIPVersionListResponseJSON `json:"-"` +} + +// radarHTTPSummaryIPVersionListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryIPVersionListResponse] +type radarHTTPSummaryIPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryIPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryIPVersionListResponseResult struct { + Meta RadarHTTPSummaryIPVersionListResponseResultMeta `json:"meta,required"` + Summary0 RadarHTTPSummaryIPVersionListResponseResultSummary0 `json:"summary_0,required"` + JSON radarHTTPSummaryIPVersionListResponseResultJSON `json:"-"` +} + +// radarHTTPSummaryIPVersionListResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPSummaryIPVersionListResponseResult] +type radarHTTPSummaryIPVersionListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryIPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryIPVersionListResponseResultMeta struct { + DateRange []RadarHTTPSummaryIPVersionListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPSummaryIPVersionListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPSummaryIPVersionListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPSummaryIPVersionListResponseResultMeta] +type radarHTTPSummaryIPVersionListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryIPVersionListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryIPVersionListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPSummaryIPVersionListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPSummaryIPVersionListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPSummaryIPVersionListResponseResultMetaDateRange] +type radarHTTPSummaryIPVersionListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryIPVersionListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfo] +type radarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryIPVersionListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryIPVersionListResponseResultSummary0 struct { + IPv4 string `json:"IPv4,required"` + IPv6 string `json:"IPv6,required"` + JSON radarHTTPSummaryIPVersionListResponseResultSummary0JSON `json:"-"` +} + +// radarHTTPSummaryIPVersionListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarHTTPSummaryIPVersionListResponseResultSummary0] +type radarHTTPSummaryIPVersionListResponseResultSummary0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryIPVersionListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryIPVersionListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPSummaryIPVersionListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPSummaryIPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPSummaryIPVersionListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPSummaryIPVersionListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPSummaryIPVersionListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPSummaryIPVersionListParamsHTTPVersion] `query:"httpVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPSummaryIPVersionListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPSummaryIPVersionListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPSummaryIPVersionListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPSummaryIPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPSummaryIPVersionListParamsBotClass string + +const ( + RadarHTTPSummaryIPVersionListParamsBotClassLikelyAutomated RadarHTTPSummaryIPVersionListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPSummaryIPVersionListParamsBotClassLikelyHuman RadarHTTPSummaryIPVersionListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPSummaryIPVersionListParamsDateRange string + +const ( + RadarHTTPSummaryIPVersionListParamsDateRange1d RadarHTTPSummaryIPVersionListParamsDateRange = "1d" + RadarHTTPSummaryIPVersionListParamsDateRange2d RadarHTTPSummaryIPVersionListParamsDateRange = "2d" + RadarHTTPSummaryIPVersionListParamsDateRange7d RadarHTTPSummaryIPVersionListParamsDateRange = "7d" + RadarHTTPSummaryIPVersionListParamsDateRange14d RadarHTTPSummaryIPVersionListParamsDateRange = "14d" + RadarHTTPSummaryIPVersionListParamsDateRange28d RadarHTTPSummaryIPVersionListParamsDateRange = "28d" + RadarHTTPSummaryIPVersionListParamsDateRange12w RadarHTTPSummaryIPVersionListParamsDateRange = "12w" + RadarHTTPSummaryIPVersionListParamsDateRange24w RadarHTTPSummaryIPVersionListParamsDateRange = "24w" + RadarHTTPSummaryIPVersionListParamsDateRange52w RadarHTTPSummaryIPVersionListParamsDateRange = "52w" + RadarHTTPSummaryIPVersionListParamsDateRange1dControl RadarHTTPSummaryIPVersionListParamsDateRange = "1dControl" + RadarHTTPSummaryIPVersionListParamsDateRange2dControl RadarHTTPSummaryIPVersionListParamsDateRange = "2dControl" + RadarHTTPSummaryIPVersionListParamsDateRange7dControl RadarHTTPSummaryIPVersionListParamsDateRange = "7dControl" + RadarHTTPSummaryIPVersionListParamsDateRange14dControl RadarHTTPSummaryIPVersionListParamsDateRange = "14dControl" + RadarHTTPSummaryIPVersionListParamsDateRange28dControl RadarHTTPSummaryIPVersionListParamsDateRange = "28dControl" + RadarHTTPSummaryIPVersionListParamsDateRange12wControl RadarHTTPSummaryIPVersionListParamsDateRange = "12wControl" + RadarHTTPSummaryIPVersionListParamsDateRange24wControl RadarHTTPSummaryIPVersionListParamsDateRange = "24wControl" +) + +type RadarHTTPSummaryIPVersionListParamsDeviceType string + +const ( + RadarHTTPSummaryIPVersionListParamsDeviceTypeDesktop RadarHTTPSummaryIPVersionListParamsDeviceType = "DESKTOP" + RadarHTTPSummaryIPVersionListParamsDeviceTypeMobile RadarHTTPSummaryIPVersionListParamsDeviceType = "MOBILE" + RadarHTTPSummaryIPVersionListParamsDeviceTypeOther RadarHTTPSummaryIPVersionListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPSummaryIPVersionListParamsFormat string + +const ( + RadarHTTPSummaryIPVersionListParamsFormatJson RadarHTTPSummaryIPVersionListParamsFormat = "JSON" + RadarHTTPSummaryIPVersionListParamsFormatCsv RadarHTTPSummaryIPVersionListParamsFormat = "CSV" +) + +type RadarHTTPSummaryIPVersionListParamsHTTPProtocol string + +const ( + RadarHTTPSummaryIPVersionListParamsHTTPProtocolHTTP RadarHTTPSummaryIPVersionListParamsHTTPProtocol = "HTTP" + RadarHTTPSummaryIPVersionListParamsHTTPProtocolHTTPs RadarHTTPSummaryIPVersionListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPSummaryIPVersionListParamsHTTPVersion string + +const ( + RadarHTTPSummaryIPVersionListParamsHTTPVersionHttPv1 RadarHTTPSummaryIPVersionListParamsHTTPVersion = "HTTPv1" + RadarHTTPSummaryIPVersionListParamsHTTPVersionHttPv2 RadarHTTPSummaryIPVersionListParamsHTTPVersion = "HTTPv2" + RadarHTTPSummaryIPVersionListParamsHTTPVersionHttPv3 RadarHTTPSummaryIPVersionListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPSummaryIPVersionListParamsO string + +const ( + RadarHTTPSummaryIPVersionListParamsOWindows RadarHTTPSummaryIPVersionListParamsO = "WINDOWS" + RadarHTTPSummaryIPVersionListParamsOMacosx RadarHTTPSummaryIPVersionListParamsO = "MACOSX" + RadarHTTPSummaryIPVersionListParamsOIos RadarHTTPSummaryIPVersionListParamsO = "IOS" + RadarHTTPSummaryIPVersionListParamsOAndroid RadarHTTPSummaryIPVersionListParamsO = "ANDROID" + RadarHTTPSummaryIPVersionListParamsOChromeos RadarHTTPSummaryIPVersionListParamsO = "CHROMEOS" + RadarHTTPSummaryIPVersionListParamsOLinux RadarHTTPSummaryIPVersionListParamsO = "LINUX" + RadarHTTPSummaryIPVersionListParamsOSmartTv RadarHTTPSummaryIPVersionListParamsO = "SMART_TV" +) + +type RadarHTTPSummaryIPVersionListParamsTlsVersion string + +const ( + RadarHTTPSummaryIPVersionListParamsTlsVersionTlSv1_0 RadarHTTPSummaryIPVersionListParamsTlsVersion = "TLSv1_0" + RadarHTTPSummaryIPVersionListParamsTlsVersionTlSv1_1 RadarHTTPSummaryIPVersionListParamsTlsVersion = "TLSv1_1" + RadarHTTPSummaryIPVersionListParamsTlsVersionTlSv1_2 RadarHTTPSummaryIPVersionListParamsTlsVersion = "TLSv1_2" + RadarHTTPSummaryIPVersionListParamsTlsVersionTlSv1_3 RadarHTTPSummaryIPVersionListParamsTlsVersion = "TLSv1_3" + RadarHTTPSummaryIPVersionListParamsTlsVersionTlSvQuic RadarHTTPSummaryIPVersionListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttpsummaryipversion_test.go b/radarhttpsummaryipversion_test.go new file mode 100644 index 00000000000..c888a479c91 --- /dev/null +++ b/radarhttpsummaryipversion_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPSummaryIPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Summaries.IPVersions.List(context.TODO(), cloudflare.RadarHTTPSummaryIPVersionListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPSummaryIPVersionListParamsBotClass{cloudflare.RadarHTTPSummaryIPVersionListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPSummaryIPVersionListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPSummaryIPVersionListParamsDateRange{cloudflare.RadarHTTPSummaryIPVersionListParamsDateRange1d, cloudflare.RadarHTTPSummaryIPVersionListParamsDateRange2d, cloudflare.RadarHTTPSummaryIPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPSummaryIPVersionListParamsDeviceType{cloudflare.RadarHTTPSummaryIPVersionListParamsDeviceTypeDesktop, cloudflare.RadarHTTPSummaryIPVersionListParamsDeviceTypeMobile, cloudflare.RadarHTTPSummaryIPVersionListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPSummaryIPVersionListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPSummaryIPVersionListParamsHTTPProtocol{cloudflare.RadarHTTPSummaryIPVersionListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPSummaryIPVersionListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryIPVersionListParamsHTTPVersion{cloudflare.RadarHTTPSummaryIPVersionListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPSummaryIPVersionListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPSummaryIPVersionListParamsHTTPVersionHttPv3}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPSummaryIPVersionListParamsO{cloudflare.RadarHTTPSummaryIPVersionListParamsOWindows, cloudflare.RadarHTTPSummaryIPVersionListParamsOMacosx, cloudflare.RadarHTTPSummaryIPVersionListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryIPVersionListParamsTlsVersion{cloudflare.RadarHTTPSummaryIPVersionListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPSummaryIPVersionListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPSummaryIPVersionListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttpsummaryo.go b/radarhttpsummaryo.go new file mode 100644 index 00000000000..6d6da51fa83 --- /dev/null +++ b/radarhttpsummaryo.go @@ -0,0 +1,313 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryOService 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 [NewRadarHTTPSummaryOService] method +// instead. +type RadarHTTPSummaryOService struct { + Options []option.RequestOption +} + +// NewRadarHTTPSummaryOService 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 NewRadarHTTPSummaryOService(opts ...option.RequestOption) (r *RadarHTTPSummaryOService) { + r = &RadarHTTPSummaryOService{} + r.Options = opts + return +} + +// Percentage distribution of Internet traffic generated by different operating +// systems like Windows, macOS, Android, iOS, and others, over a given time period. +func (r *RadarHTTPSummaryOService) List(ctx context.Context, query RadarHTTPSummaryOListParams, opts ...option.RequestOption) (res *RadarHTTPSummaryOListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/summary/os" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPSummaryOListResponse struct { + Result RadarHTTPSummaryOListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPSummaryOListResponseJSON `json:"-"` +} + +// radarHTTPSummaryOListResponseJSON contains the JSON metadata for the struct +// [RadarHTTPSummaryOListResponse] +type radarHTTPSummaryOListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryOListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryOListResponseResult struct { + Meta RadarHTTPSummaryOListResponseResultMeta `json:"meta,required"` + Summary0 RadarHTTPSummaryOListResponseResultSummary0 `json:"summary_0,required"` + JSON radarHTTPSummaryOListResponseResultJSON `json:"-"` +} + +// radarHTTPSummaryOListResponseResultJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryOListResponseResult] +type radarHTTPSummaryOListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryOListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryOListResponseResultMeta struct { + DateRange []RadarHTTPSummaryOListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarHTTPSummaryOListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPSummaryOListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPSummaryOListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryOListResponseResultMeta] +type radarHTTPSummaryOListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryOListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryOListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPSummaryOListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPSummaryOListResponseResultMetaDateRangeJSON contains the JSON metadata +// for the struct [RadarHTTPSummaryOListResponseResultMetaDateRange] +type radarHTTPSummaryOListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryOListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryOListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPSummaryOListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPSummaryOListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPSummaryOListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct [RadarHTTPSummaryOListResponseResultMetaConfidenceInfo] +type radarHTTPSummaryOListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryOListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryOListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPSummaryOListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPSummaryOListResponseResultMetaConfidenceInfoAnnotationJSON contains the +// JSON metadata for the struct +// [RadarHTTPSummaryOListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPSummaryOListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryOListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryOListResponseResultSummary0 struct { + Android string `json:"ANDROID,required"` + Ios string `json:"IOS,required"` + JSON radarHTTPSummaryOListResponseResultSummary0JSON `json:"-"` +} + +// radarHTTPSummaryOListResponseResultSummary0JSON contains the JSON metadata for +// the struct [RadarHTTPSummaryOListResponseResultSummary0] +type radarHTTPSummaryOListResponseResultSummary0JSON struct { + Android apijson.Field + Ios apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryOListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryOListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPSummaryOListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPSummaryOListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPSummaryOListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPSummaryOListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPSummaryOListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPSummaryOListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPSummaryOListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPSummaryOListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPSummaryOListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPSummaryOListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPSummaryOListParamsBotClass string + +const ( + RadarHTTPSummaryOListParamsBotClassLikelyAutomated RadarHTTPSummaryOListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPSummaryOListParamsBotClassLikelyHuman RadarHTTPSummaryOListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPSummaryOListParamsDateRange string + +const ( + RadarHTTPSummaryOListParamsDateRange1d RadarHTTPSummaryOListParamsDateRange = "1d" + RadarHTTPSummaryOListParamsDateRange2d RadarHTTPSummaryOListParamsDateRange = "2d" + RadarHTTPSummaryOListParamsDateRange7d RadarHTTPSummaryOListParamsDateRange = "7d" + RadarHTTPSummaryOListParamsDateRange14d RadarHTTPSummaryOListParamsDateRange = "14d" + RadarHTTPSummaryOListParamsDateRange28d RadarHTTPSummaryOListParamsDateRange = "28d" + RadarHTTPSummaryOListParamsDateRange12w RadarHTTPSummaryOListParamsDateRange = "12w" + RadarHTTPSummaryOListParamsDateRange24w RadarHTTPSummaryOListParamsDateRange = "24w" + RadarHTTPSummaryOListParamsDateRange52w RadarHTTPSummaryOListParamsDateRange = "52w" + RadarHTTPSummaryOListParamsDateRange1dControl RadarHTTPSummaryOListParamsDateRange = "1dControl" + RadarHTTPSummaryOListParamsDateRange2dControl RadarHTTPSummaryOListParamsDateRange = "2dControl" + RadarHTTPSummaryOListParamsDateRange7dControl RadarHTTPSummaryOListParamsDateRange = "7dControl" + RadarHTTPSummaryOListParamsDateRange14dControl RadarHTTPSummaryOListParamsDateRange = "14dControl" + RadarHTTPSummaryOListParamsDateRange28dControl RadarHTTPSummaryOListParamsDateRange = "28dControl" + RadarHTTPSummaryOListParamsDateRange12wControl RadarHTTPSummaryOListParamsDateRange = "12wControl" + RadarHTTPSummaryOListParamsDateRange24wControl RadarHTTPSummaryOListParamsDateRange = "24wControl" +) + +type RadarHTTPSummaryOListParamsDeviceType string + +const ( + RadarHTTPSummaryOListParamsDeviceTypeDesktop RadarHTTPSummaryOListParamsDeviceType = "DESKTOP" + RadarHTTPSummaryOListParamsDeviceTypeMobile RadarHTTPSummaryOListParamsDeviceType = "MOBILE" + RadarHTTPSummaryOListParamsDeviceTypeOther RadarHTTPSummaryOListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPSummaryOListParamsFormat string + +const ( + RadarHTTPSummaryOListParamsFormatJson RadarHTTPSummaryOListParamsFormat = "JSON" + RadarHTTPSummaryOListParamsFormatCsv RadarHTTPSummaryOListParamsFormat = "CSV" +) + +type RadarHTTPSummaryOListParamsHTTPProtocol string + +const ( + RadarHTTPSummaryOListParamsHTTPProtocolHTTP RadarHTTPSummaryOListParamsHTTPProtocol = "HTTP" + RadarHTTPSummaryOListParamsHTTPProtocolHTTPs RadarHTTPSummaryOListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPSummaryOListParamsHTTPVersion string + +const ( + RadarHTTPSummaryOListParamsHTTPVersionHttPv1 RadarHTTPSummaryOListParamsHTTPVersion = "HTTPv1" + RadarHTTPSummaryOListParamsHTTPVersionHttPv2 RadarHTTPSummaryOListParamsHTTPVersion = "HTTPv2" + RadarHTTPSummaryOListParamsHTTPVersionHttPv3 RadarHTTPSummaryOListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPSummaryOListParamsIPVersion string + +const ( + RadarHTTPSummaryOListParamsIPVersionIPv4 RadarHTTPSummaryOListParamsIPVersion = "IPv4" + RadarHTTPSummaryOListParamsIPVersionIPv6 RadarHTTPSummaryOListParamsIPVersion = "IPv6" +) + +type RadarHTTPSummaryOListParamsTlsVersion string + +const ( + RadarHTTPSummaryOListParamsTlsVersionTlSv1_0 RadarHTTPSummaryOListParamsTlsVersion = "TLSv1_0" + RadarHTTPSummaryOListParamsTlsVersionTlSv1_1 RadarHTTPSummaryOListParamsTlsVersion = "TLSv1_1" + RadarHTTPSummaryOListParamsTlsVersionTlSv1_2 RadarHTTPSummaryOListParamsTlsVersion = "TLSv1_2" + RadarHTTPSummaryOListParamsTlsVersionTlSv1_3 RadarHTTPSummaryOListParamsTlsVersion = "TLSv1_3" + RadarHTTPSummaryOListParamsTlsVersionTlSvQuic RadarHTTPSummaryOListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttpsummaryo_test.go b/radarhttpsummaryo_test.go new file mode 100644 index 00000000000..f99276cdc74 --- /dev/null +++ b/radarhttpsummaryo_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPSummaryOListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Summaries.Os.List(context.TODO(), cloudflare.RadarHTTPSummaryOListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPSummaryOListParamsBotClass{cloudflare.RadarHTTPSummaryOListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPSummaryOListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPSummaryOListParamsDateRange{cloudflare.RadarHTTPSummaryOListParamsDateRange1d, cloudflare.RadarHTTPSummaryOListParamsDateRange2d, cloudflare.RadarHTTPSummaryOListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPSummaryOListParamsDeviceType{cloudflare.RadarHTTPSummaryOListParamsDeviceTypeDesktop, cloudflare.RadarHTTPSummaryOListParamsDeviceTypeMobile, cloudflare.RadarHTTPSummaryOListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPSummaryOListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPSummaryOListParamsHTTPProtocol{cloudflare.RadarHTTPSummaryOListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPSummaryOListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryOListParamsHTTPVersion{cloudflare.RadarHTTPSummaryOListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPSummaryOListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPSummaryOListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryOListParamsIPVersion{cloudflare.RadarHTTPSummaryOListParamsIPVersionIPv4, cloudflare.RadarHTTPSummaryOListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryOListParamsTlsVersion{cloudflare.RadarHTTPSummaryOListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPSummaryOListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPSummaryOListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttpsummarytlsversion.go b/radarhttpsummarytlsversion.go new file mode 100644 index 00000000000..d9d1204c3ad --- /dev/null +++ b/radarhttpsummarytlsversion.go @@ -0,0 +1,323 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPSummaryTlsVersionService 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 +// [NewRadarHTTPSummaryTlsVersionService] method instead. +type RadarHTTPSummaryTlsVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPSummaryTlsVersionService 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 NewRadarHTTPSummaryTlsVersionService(opts ...option.RequestOption) (r *RadarHTTPSummaryTlsVersionService) { + r = &RadarHTTPSummaryTlsVersionService{} + r.Options = opts + return +} + +// Percentage distribution of traffic per TLS protocol version, over a given time +// period. +func (r *RadarHTTPSummaryTlsVersionService) List(ctx context.Context, query RadarHTTPSummaryTlsVersionListParams, opts ...option.RequestOption) (res *RadarHTTPSummaryTlsVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/summary/tls_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPSummaryTlsVersionListResponse struct { + Result RadarHTTPSummaryTlsVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPSummaryTlsVersionListResponseJSON `json:"-"` +} + +// radarHTTPSummaryTlsVersionListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPSummaryTlsVersionListResponse] +type radarHTTPSummaryTlsVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryTlsVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryTlsVersionListResponseResult struct { + Meta RadarHTTPSummaryTlsVersionListResponseResultMeta `json:"meta,required"` + Summary0 RadarHTTPSummaryTlsVersionListResponseResultSummary0 `json:"summary_0,required"` + JSON radarHTTPSummaryTlsVersionListResponseResultJSON `json:"-"` +} + +// radarHTTPSummaryTlsVersionListResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPSummaryTlsVersionListResponseResult] +type radarHTTPSummaryTlsVersionListResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryTlsVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryTlsVersionListResponseResultMeta struct { + DateRange []RadarHTTPSummaryTlsVersionListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPSummaryTlsVersionListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPSummaryTlsVersionListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPSummaryTlsVersionListResponseResultMeta] +type radarHTTPSummaryTlsVersionListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryTlsVersionListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryTlsVersionListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPSummaryTlsVersionListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPSummaryTlsVersionListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPSummaryTlsVersionListResponseResultMetaDateRange] +type radarHTTPSummaryTlsVersionListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryTlsVersionListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfo] +type radarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryTlsVersionListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryTlsVersionListResponseResultSummary0 struct { + Tls1_0 string `json:"TLS 1.0,required"` + Tls1_1 string `json:"TLS 1.1,required"` + Tls1_2 string `json:"TLS 1.2,required"` + Tls1_3 string `json:"TLS 1.3,required"` + TlsQuic string `json:"TLS QUIC,required"` + JSON radarHTTPSummaryTlsVersionListResponseResultSummary0JSON `json:"-"` +} + +// radarHTTPSummaryTlsVersionListResponseResultSummary0JSON contains the JSON +// metadata for the struct [RadarHTTPSummaryTlsVersionListResponseResultSummary0] +type radarHTTPSummaryTlsVersionListResponseResultSummary0JSON struct { + Tls1_0 apijson.Field + Tls1_1 apijson.Field + Tls1_2 apijson.Field + Tls1_3 apijson.Field + TlsQuic apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPSummaryTlsVersionListResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPSummaryTlsVersionListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPSummaryTlsVersionListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPSummaryTlsVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPSummaryTlsVersionListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPSummaryTlsVersionListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPSummaryTlsVersionListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPSummaryTlsVersionListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPSummaryTlsVersionListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPSummaryTlsVersionListParamsO] `query:"os"` +} + +// URLQuery serializes [RadarHTTPSummaryTlsVersionListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPSummaryTlsVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPSummaryTlsVersionListParamsBotClass string + +const ( + RadarHTTPSummaryTlsVersionListParamsBotClassLikelyAutomated RadarHTTPSummaryTlsVersionListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPSummaryTlsVersionListParamsBotClassLikelyHuman RadarHTTPSummaryTlsVersionListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPSummaryTlsVersionListParamsDateRange string + +const ( + RadarHTTPSummaryTlsVersionListParamsDateRange1d RadarHTTPSummaryTlsVersionListParamsDateRange = "1d" + RadarHTTPSummaryTlsVersionListParamsDateRange2d RadarHTTPSummaryTlsVersionListParamsDateRange = "2d" + RadarHTTPSummaryTlsVersionListParamsDateRange7d RadarHTTPSummaryTlsVersionListParamsDateRange = "7d" + RadarHTTPSummaryTlsVersionListParamsDateRange14d RadarHTTPSummaryTlsVersionListParamsDateRange = "14d" + RadarHTTPSummaryTlsVersionListParamsDateRange28d RadarHTTPSummaryTlsVersionListParamsDateRange = "28d" + RadarHTTPSummaryTlsVersionListParamsDateRange12w RadarHTTPSummaryTlsVersionListParamsDateRange = "12w" + RadarHTTPSummaryTlsVersionListParamsDateRange24w RadarHTTPSummaryTlsVersionListParamsDateRange = "24w" + RadarHTTPSummaryTlsVersionListParamsDateRange52w RadarHTTPSummaryTlsVersionListParamsDateRange = "52w" + RadarHTTPSummaryTlsVersionListParamsDateRange1dControl RadarHTTPSummaryTlsVersionListParamsDateRange = "1dControl" + RadarHTTPSummaryTlsVersionListParamsDateRange2dControl RadarHTTPSummaryTlsVersionListParamsDateRange = "2dControl" + RadarHTTPSummaryTlsVersionListParamsDateRange7dControl RadarHTTPSummaryTlsVersionListParamsDateRange = "7dControl" + RadarHTTPSummaryTlsVersionListParamsDateRange14dControl RadarHTTPSummaryTlsVersionListParamsDateRange = "14dControl" + RadarHTTPSummaryTlsVersionListParamsDateRange28dControl RadarHTTPSummaryTlsVersionListParamsDateRange = "28dControl" + RadarHTTPSummaryTlsVersionListParamsDateRange12wControl RadarHTTPSummaryTlsVersionListParamsDateRange = "12wControl" + RadarHTTPSummaryTlsVersionListParamsDateRange24wControl RadarHTTPSummaryTlsVersionListParamsDateRange = "24wControl" +) + +type RadarHTTPSummaryTlsVersionListParamsDeviceType string + +const ( + RadarHTTPSummaryTlsVersionListParamsDeviceTypeDesktop RadarHTTPSummaryTlsVersionListParamsDeviceType = "DESKTOP" + RadarHTTPSummaryTlsVersionListParamsDeviceTypeMobile RadarHTTPSummaryTlsVersionListParamsDeviceType = "MOBILE" + RadarHTTPSummaryTlsVersionListParamsDeviceTypeOther RadarHTTPSummaryTlsVersionListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPSummaryTlsVersionListParamsFormat string + +const ( + RadarHTTPSummaryTlsVersionListParamsFormatJson RadarHTTPSummaryTlsVersionListParamsFormat = "JSON" + RadarHTTPSummaryTlsVersionListParamsFormatCsv RadarHTTPSummaryTlsVersionListParamsFormat = "CSV" +) + +type RadarHTTPSummaryTlsVersionListParamsHTTPProtocol string + +const ( + RadarHTTPSummaryTlsVersionListParamsHTTPProtocolHTTP RadarHTTPSummaryTlsVersionListParamsHTTPProtocol = "HTTP" + RadarHTTPSummaryTlsVersionListParamsHTTPProtocolHTTPs RadarHTTPSummaryTlsVersionListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPSummaryTlsVersionListParamsHTTPVersion string + +const ( + RadarHTTPSummaryTlsVersionListParamsHTTPVersionHttPv1 RadarHTTPSummaryTlsVersionListParamsHTTPVersion = "HTTPv1" + RadarHTTPSummaryTlsVersionListParamsHTTPVersionHttPv2 RadarHTTPSummaryTlsVersionListParamsHTTPVersion = "HTTPv2" + RadarHTTPSummaryTlsVersionListParamsHTTPVersionHttPv3 RadarHTTPSummaryTlsVersionListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPSummaryTlsVersionListParamsIPVersion string + +const ( + RadarHTTPSummaryTlsVersionListParamsIPVersionIPv4 RadarHTTPSummaryTlsVersionListParamsIPVersion = "IPv4" + RadarHTTPSummaryTlsVersionListParamsIPVersionIPv6 RadarHTTPSummaryTlsVersionListParamsIPVersion = "IPv6" +) + +type RadarHTTPSummaryTlsVersionListParamsO string + +const ( + RadarHTTPSummaryTlsVersionListParamsOWindows RadarHTTPSummaryTlsVersionListParamsO = "WINDOWS" + RadarHTTPSummaryTlsVersionListParamsOMacosx RadarHTTPSummaryTlsVersionListParamsO = "MACOSX" + RadarHTTPSummaryTlsVersionListParamsOIos RadarHTTPSummaryTlsVersionListParamsO = "IOS" + RadarHTTPSummaryTlsVersionListParamsOAndroid RadarHTTPSummaryTlsVersionListParamsO = "ANDROID" + RadarHTTPSummaryTlsVersionListParamsOChromeos RadarHTTPSummaryTlsVersionListParamsO = "CHROMEOS" + RadarHTTPSummaryTlsVersionListParamsOLinux RadarHTTPSummaryTlsVersionListParamsO = "LINUX" + RadarHTTPSummaryTlsVersionListParamsOSmartTv RadarHTTPSummaryTlsVersionListParamsO = "SMART_TV" +) diff --git a/radarhttpsummarytlsversion_test.go b/radarhttpsummarytlsversion_test.go new file mode 100644 index 00000000000..98bb50cbc5e --- /dev/null +++ b/radarhttpsummarytlsversion_test.go @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPSummaryTlsVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Summaries.TlsVersions.List(context.TODO(), cloudflare.RadarHTTPSummaryTlsVersionListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPSummaryTlsVersionListParamsBotClass{cloudflare.RadarHTTPSummaryTlsVersionListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPSummaryTlsVersionListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPSummaryTlsVersionListParamsDateRange{cloudflare.RadarHTTPSummaryTlsVersionListParamsDateRange1d, cloudflare.RadarHTTPSummaryTlsVersionListParamsDateRange2d, cloudflare.RadarHTTPSummaryTlsVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPSummaryTlsVersionListParamsDeviceType{cloudflare.RadarHTTPSummaryTlsVersionListParamsDeviceTypeDesktop, cloudflare.RadarHTTPSummaryTlsVersionListParamsDeviceTypeMobile, cloudflare.RadarHTTPSummaryTlsVersionListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPSummaryTlsVersionListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPSummaryTlsVersionListParamsHTTPProtocol{cloudflare.RadarHTTPSummaryTlsVersionListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPSummaryTlsVersionListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryTlsVersionListParamsHTTPVersion{cloudflare.RadarHTTPSummaryTlsVersionListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPSummaryTlsVersionListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPSummaryTlsVersionListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPSummaryTlsVersionListParamsIPVersion{cloudflare.RadarHTTPSummaryTlsVersionListParamsIPVersionIPv4, cloudflare.RadarHTTPSummaryTlsVersionListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPSummaryTlsVersionListParamsO{cloudflare.RadarHTTPSummaryTlsVersionListParamsOWindows, cloudflare.RadarHTTPSummaryTlsVersionListParamsOMacosx, cloudflare.RadarHTTPSummaryTlsVersionListParamsOIos}), + }) + 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/radarhttptimeseriesgroup.go b/radarhttptimeseriesgroup.go new file mode 100644 index 00000000000..0e81e1521f5 --- /dev/null +++ b/radarhttptimeseriesgroup.go @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupService 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 +// [NewRadarHTTPTimeseriesGroupService] method instead. +type RadarHTTPTimeseriesGroupService struct { + Options []option.RequestOption + ByBotClass *RadarHTTPTimeseriesGroupByBotClassService + ByBrowser *RadarHTTPTimeseriesGroupByBrowserService + ByBrowserFamily *RadarHTTPTimeseriesGroupByBrowserFamilyService + ByDeviceType *RadarHTTPTimeseriesGroupByDeviceTypeService + ByHTTPProtocol *RadarHTTPTimeseriesGroupByHTTPProtocolService + ByHTTPVersion *RadarHTTPTimeseriesGroupByHTTPVersionService + ByIPVersion *RadarHTTPTimeseriesGroupByIPVersionService + ByOs *RadarHTTPTimeseriesGroupByOService + ByTlsVersion *RadarHTTPTimeseriesGroupByTlsVersionService +} + +// NewRadarHTTPTimeseriesGroupService 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 NewRadarHTTPTimeseriesGroupService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupService) { + r = &RadarHTTPTimeseriesGroupService{} + r.Options = opts + r.ByBotClass = NewRadarHTTPTimeseriesGroupByBotClassService(opts...) + r.ByBrowser = NewRadarHTTPTimeseriesGroupByBrowserService(opts...) + r.ByBrowserFamily = NewRadarHTTPTimeseriesGroupByBrowserFamilyService(opts...) + r.ByDeviceType = NewRadarHTTPTimeseriesGroupByDeviceTypeService(opts...) + r.ByHTTPProtocol = NewRadarHTTPTimeseriesGroupByHTTPProtocolService(opts...) + r.ByHTTPVersion = NewRadarHTTPTimeseriesGroupByHTTPVersionService(opts...) + r.ByIPVersion = NewRadarHTTPTimeseriesGroupByIPVersionService(opts...) + r.ByOs = NewRadarHTTPTimeseriesGroupByOService(opts...) + r.ByTlsVersion = NewRadarHTTPTimeseriesGroupByTlsVersionService(opts...) + return +} diff --git a/radarhttptimeseriesgroupbybotclass.go b/radarhttptimeseriesgroupbybotclass.go new file mode 100644 index 00000000000..3fdaee6f394 --- /dev/null +++ b/radarhttptimeseriesgroupbybotclass.go @@ -0,0 +1,246 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByBotClassService 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 +// [NewRadarHTTPTimeseriesGroupByBotClassService] method instead. +type RadarHTTPTimeseriesGroupByBotClassService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByBotClassService 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 NewRadarHTTPTimeseriesGroupByBotClassService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByBotClassService) { + r = &RadarHTTPTimeseriesGroupByBotClassService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic classified as +// automated or human. Visit +// https://developers.cloudflare.com/radar/concepts/bot-classes/ for more +// information. +func (r *RadarHTTPTimeseriesGroupByBotClassService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByBotClassListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByBotClassListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/bot_class" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByBotClassListResponse struct { + Result RadarHTTPTimeseriesGroupByBotClassListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByBotClassListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBotClassListResponseJSON contains the JSON metadata +// for the struct [RadarHTTPTimeseriesGroupByBotClassListResponse] +type radarHTTPTimeseriesGroupByBotClassListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBotClassListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBotClassListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByBotClassListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByBotClassListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBotClassListResponseResultJSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByBotClassListResponseResult] +type radarHTTPTimeseriesGroupByBotClassListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBotClassListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBotClassListResponseResultSerie0 struct { + Bot []string `json:"bot,required"` + Human []string `json:"human,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByBotClassListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBotClassListResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarHTTPTimeseriesGroupByBotClassListResponseResultSerie0] +type radarHTTPTimeseriesGroupByBotClassListResponseResultSerie0JSON struct { + Bot apijson.Field + Human apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBotClassListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBotClassListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByBotClassListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByBotClassListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByBotClassListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByBotClassListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByBotClassListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByBotClassListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByBotClassListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval15m RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval1h RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval1d RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval1w RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByBotClassListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange1d RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange2d RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange7d RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange14d RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange28d RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange12w RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange24w RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange52w RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange1dControl RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange2dControl RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange7dControl RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange14dControl RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange28dControl RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange12wControl RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByBotClassListParamsDateRange24wControl RadarHTTPTimeseriesGroupByBotClassListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByBotClassListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByBotClassListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByBotClassListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByBotClassListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByBotClassListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByBotClassListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByBotClassListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsFormatJson RadarHTTPTimeseriesGroupByBotClassListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByBotClassListParamsFormatCsv RadarHTTPTimeseriesGroupByBotClassListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByBotClassListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByBotClassListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByBotClassListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByBotClassListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByBotClassListParamsO string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsOWindows RadarHTTPTimeseriesGroupByBotClassListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByBotClassListParamsOMacosx RadarHTTPTimeseriesGroupByBotClassListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByBotClassListParamsOIos RadarHTTPTimeseriesGroupByBotClassListParamsO = "IOS" + RadarHTTPTimeseriesGroupByBotClassListParamsOAndroid RadarHTTPTimeseriesGroupByBotClassListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByBotClassListParamsOChromeos RadarHTTPTimeseriesGroupByBotClassListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByBotClassListParamsOLinux RadarHTTPTimeseriesGroupByBotClassListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByBotClassListParamsOSmartTv RadarHTTPTimeseriesGroupByBotClassListParamsO = "SMART_TV" +) + +type RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbybotclass_test.go b/radarhttptimeseriesgroupbybotclass_test.go new file mode 100644 index 00000000000..f32628949a8 --- /dev/null +++ b/radarhttptimeseriesgroupbybotclass_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByBotClassListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByBotClass.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByBotClassListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsO{cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByBotClassListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbybrowser.go b/radarhttptimeseriesgroupbybrowser.go new file mode 100644 index 00000000000..26a3ef35790 --- /dev/null +++ b/radarhttptimeseriesgroupbybrowser.go @@ -0,0 +1,252 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByBrowserService 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 +// [NewRadarHTTPTimeseriesGroupByBrowserService] method instead. +type RadarHTTPTimeseriesGroupByBrowserService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByBrowserService 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 NewRadarHTTPTimeseriesGroupByBrowserService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByBrowserService) { + r = &RadarHTTPTimeseriesGroupByBrowserService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic of the top user +// agents. +func (r *RadarHTTPTimeseriesGroupByBrowserService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByBrowserListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByBrowserListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/browser" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByBrowserListResponse struct { + Result RadarHTTPTimeseriesGroupByBrowserListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByBrowserListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBrowserListResponseJSON contains the JSON metadata for +// the struct [RadarHTTPTimeseriesGroupByBrowserListResponse] +type radarHTTPTimeseriesGroupByBrowserListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBrowserListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBrowserListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByBrowserListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByBrowserListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBrowserListResponseResultJSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByBrowserListResponseResult] +type radarHTTPTimeseriesGroupByBrowserListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBrowserListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBrowserListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByBrowserListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBrowserListResponseResultSerie0JSON contains the JSON +// metadata for the struct +// [RadarHTTPTimeseriesGroupByBrowserListResponseResultSerie0] +type radarHTTPTimeseriesGroupByBrowserListResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBrowserListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBrowserListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByBrowserListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects (eg browsers, verticals, etc) to the top items over + // the time range. + LimitPerGroup param.Field[int64] `query:"limitPerGroup"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByBrowserListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByBrowserListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval15m RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval1h RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval1d RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval1w RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByBrowserListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByBrowserListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByBrowserListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange1d RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange2d RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange7d RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange14d RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange28d RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange12w RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange24w RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange52w RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange1dControl RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange2dControl RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange7dControl RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange14dControl RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange28dControl RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange12wControl RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByBrowserListParamsDateRange24wControl RadarHTTPTimeseriesGroupByBrowserListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByBrowserListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByBrowserListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByBrowserListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByBrowserListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByBrowserListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByBrowserListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsFormatJson RadarHTTPTimeseriesGroupByBrowserListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByBrowserListParamsFormatCsv RadarHTTPTimeseriesGroupByBrowserListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByBrowserListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByBrowserListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByBrowserListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsO string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsOWindows RadarHTTPTimeseriesGroupByBrowserListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByBrowserListParamsOMacosx RadarHTTPTimeseriesGroupByBrowserListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByBrowserListParamsOIos RadarHTTPTimeseriesGroupByBrowserListParamsO = "IOS" + RadarHTTPTimeseriesGroupByBrowserListParamsOAndroid RadarHTTPTimeseriesGroupByBrowserListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByBrowserListParamsOChromeos RadarHTTPTimeseriesGroupByBrowserListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByBrowserListParamsOLinux RadarHTTPTimeseriesGroupByBrowserListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByBrowserListParamsOSmartTv RadarHTTPTimeseriesGroupByBrowserListParamsO = "SMART_TV" +) + +type RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbybrowser_test.go b/radarhttptimeseriesgroupbybrowser_test.go new file mode 100644 index 00000000000..75dd534a6e1 --- /dev/null +++ b/radarhttptimeseriesgroupbybrowser_test.go @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByBrowserListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByBrowser.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByBrowserListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsIPVersionIPv6}), + LimitPerGroup: cloudflare.F(int64(4)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsO{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByBrowserListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbybrowserfamily.go b/radarhttptimeseriesgroupbybrowserfamily.go new file mode 100644 index 00000000000..212f3639aa7 --- /dev/null +++ b/radarhttptimeseriesgroupbybrowserfamily.go @@ -0,0 +1,251 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByBrowserFamilyService 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 [NewRadarHTTPTimeseriesGroupByBrowserFamilyService] method instead. +type RadarHTTPTimeseriesGroupByBrowserFamilyService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByBrowserFamilyService 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 NewRadarHTTPTimeseriesGroupByBrowserFamilyService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByBrowserFamilyService) { + r = &RadarHTTPTimeseriesGroupByBrowserFamilyService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic of the top user +// agents aggregated in families. +func (r *RadarHTTPTimeseriesGroupByBrowserFamilyService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByBrowserFamilyListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByBrowserFamilyListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/browser_family" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByBrowserFamilyListResponse struct { + Result RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByBrowserFamilyListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBrowserFamilyListResponseJSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByBrowserFamilyListResponse] +type radarHTTPTimeseriesGroupByBrowserFamilyListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBrowserFamilyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByBrowserFamilyListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBrowserFamilyListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResult] +type radarHTTPTimeseriesGroupByBrowserFamilyListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByBrowserFamilyListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByBrowserFamilyListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResultSerie0] +type radarHTTPTimeseriesGroupByBrowserFamilyListResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByBrowserFamilyListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByBrowserFamilyListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByBrowserFamilyListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByBrowserFamilyListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval15m RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval1h RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval1d RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval1w RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange1d RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange2d RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange7d RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange14d RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange28d RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange12w RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange24w RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange52w RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange1dControl RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange2dControl RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange7dControl RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange14dControl RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange28dControl RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange12wControl RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange24wControl RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsFormatJson RadarHTTPTimeseriesGroupByBrowserFamilyListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsFormatCsv RadarHTTPTimeseriesGroupByBrowserFamilyListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOWindows RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOMacosx RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOIos RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO = "IOS" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOAndroid RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOChromeos RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOLinux RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOSmartTv RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO = "SMART_TV" +) + +type RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbybrowserfamily_test.go b/radarhttptimeseriesgroupbybrowserfamily_test.go new file mode 100644 index 00000000000..471ae774b75 --- /dev/null +++ b/radarhttptimeseriesgroupbybrowserfamily_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByBrowserFamilyListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByBrowserFamily.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsO{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByBrowserFamilyListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbydevicetype.go b/radarhttptimeseriesgroupbydevicetype.go new file mode 100644 index 00000000000..ee83eaba0c6 --- /dev/null +++ b/radarhttptimeseriesgroupbydevicetype.go @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByDeviceTypeService 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 +// [NewRadarHTTPTimeseriesGroupByDeviceTypeService] method instead. +type RadarHTTPTimeseriesGroupByDeviceTypeService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByDeviceTypeService 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 NewRadarHTTPTimeseriesGroupByDeviceTypeService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByDeviceTypeService) { + r = &RadarHTTPTimeseriesGroupByDeviceTypeService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic per device type. +func (r *RadarHTTPTimeseriesGroupByDeviceTypeService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByDeviceTypeListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByDeviceTypeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/device_type" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByDeviceTypeListResponse struct { + Result RadarHTTPTimeseriesGroupByDeviceTypeListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByDeviceTypeListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByDeviceTypeListResponseJSON contains the JSON metadata +// for the struct [RadarHTTPTimeseriesGroupByDeviceTypeListResponse] +type radarHTTPTimeseriesGroupByDeviceTypeListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByDeviceTypeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByDeviceTypeListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByDeviceTypeListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByDeviceTypeListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByDeviceTypeListResponseResultJSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByDeviceTypeListResponseResult] +type radarHTTPTimeseriesGroupByDeviceTypeListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByDeviceTypeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByDeviceTypeListResponseResultSerie0 struct { + Desktop []string `json:"desktop,required"` + Mobile []string `json:"mobile,required"` + Other []string `json:"other,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByDeviceTypeListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByDeviceTypeListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarHTTPTimeseriesGroupByDeviceTypeListResponseResultSerie0] +type radarHTTPTimeseriesGroupByDeviceTypeListResponseResultSerie0JSON struct { + Desktop apijson.Field + Mobile apijson.Field + Other apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByDeviceTypeListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByDeviceTypeListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByDeviceTypeListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByDeviceTypeListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByDeviceTypeListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByDeviceTypeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval15m RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval1h RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval1d RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval1w RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange1d RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange2d RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange7d RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange14d RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange28d RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange12w RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange24w RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange52w RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange1dControl RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange2dControl RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange7dControl RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange14dControl RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange28dControl RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange12wControl RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange24wControl RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsFormatJson RadarHTTPTimeseriesGroupByDeviceTypeListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsFormatCsv RadarHTTPTimeseriesGroupByDeviceTypeListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsO string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsOWindows RadarHTTPTimeseriesGroupByDeviceTypeListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsOMacosx RadarHTTPTimeseriesGroupByDeviceTypeListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsOIos RadarHTTPTimeseriesGroupByDeviceTypeListParamsO = "IOS" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsOAndroid RadarHTTPTimeseriesGroupByDeviceTypeListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsOChromeos RadarHTTPTimeseriesGroupByDeviceTypeListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsOLinux RadarHTTPTimeseriesGroupByDeviceTypeListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsOSmartTv RadarHTTPTimeseriesGroupByDeviceTypeListParamsO = "SMART_TV" +) + +type RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbydevicetype_test.go b/radarhttptimeseriesgroupbydevicetype_test.go new file mode 100644 index 00000000000..9987da950dd --- /dev/null +++ b/radarhttptimeseriesgroupbydevicetype_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByDeviceTypeListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByDeviceType.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsO{cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByDeviceTypeListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbyhttpprotocol.go b/radarhttptimeseriesgroupbyhttpprotocol.go new file mode 100644 index 00000000000..8049b44757d --- /dev/null +++ b/radarhttptimeseriesgroupbyhttpprotocol.go @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByHTTPProtocolService 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 [NewRadarHTTPTimeseriesGroupByHTTPProtocolService] method instead. +type RadarHTTPTimeseriesGroupByHTTPProtocolService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByHTTPProtocolService 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 NewRadarHTTPTimeseriesGroupByHTTPProtocolService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByHTTPProtocolService) { + r = &RadarHTTPTimeseriesGroupByHTTPProtocolService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic per HTTP protocol. +func (r *RadarHTTPTimeseriesGroupByHTTPProtocolService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByHTTPProtocolListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByHTTPProtocolListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/http_protocol" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByHTTPProtocolListResponse struct { + Result RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByHTTPProtocolListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByHTTPProtocolListResponseJSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByHTTPProtocolListResponse] +type radarHTTPTimeseriesGroupByHTTPProtocolListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByHTTPProtocolListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByHTTPProtocolListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByHTTPProtocolListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResult] +type radarHTTPTimeseriesGroupByHTTPProtocolListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResultSerie0 struct { + HTTP []string `json:"http,required"` + HTTPs []string `json:"https,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByHTTPProtocolListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByHTTPProtocolListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResultSerie0] +type radarHTTPTimeseriesGroupByHTTPProtocolListResponseResultSerie0JSON struct { + HTTP apijson.Field + HTTPs apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByHTTPProtocolListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByHTTPProtocolListParamsFormat] `query:"format"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByHTTPProtocolListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByHTTPProtocolListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval15m RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval1h RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval1d RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval1w RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange1d RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange2d RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange7d RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange14d RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange28d RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange12w RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange24w RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange52w RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange1dControl RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange2dControl RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange7dControl RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange14dControl RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange28dControl RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange12wControl RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange24wControl RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsFormatJson RadarHTTPTimeseriesGroupByHTTPProtocolListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsFormatCsv RadarHTTPTimeseriesGroupByHTTPProtocolListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOWindows RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOMacosx RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOIos RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO = "IOS" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOAndroid RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOChromeos RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOLinux RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOSmartTv RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO = "SMART_TV" +) + +type RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbyhttpprotocol_test.go b/radarhttptimeseriesgroupbyhttpprotocol_test.go new file mode 100644 index 00000000000..1c314bdc56b --- /dev/null +++ b/radarhttptimeseriesgroupbyhttpprotocol_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByHTTPProtocolListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByHTTPProtocol.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsFormatJson), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsO{cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByHTTPProtocolListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbyhttpversion.go b/radarhttptimeseriesgroupbyhttpversion.go new file mode 100644 index 00000000000..539eba65c65 --- /dev/null +++ b/radarhttptimeseriesgroupbyhttpversion.go @@ -0,0 +1,247 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByHTTPVersionService 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 +// [NewRadarHTTPTimeseriesGroupByHTTPVersionService] method instead. +type RadarHTTPTimeseriesGroupByHTTPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByHTTPVersionService 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 NewRadarHTTPTimeseriesGroupByHTTPVersionService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByHTTPVersionService) { + r = &RadarHTTPTimeseriesGroupByHTTPVersionService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic per HTTP protocol +// version. +func (r *RadarHTTPTimeseriesGroupByHTTPVersionService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByHTTPVersionListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByHTTPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/http_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByHTTPVersionListResponse struct { + Result RadarHTTPTimeseriesGroupByHTTPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByHTTPVersionListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByHTTPVersionListResponseJSON contains the JSON metadata +// for the struct [RadarHTTPTimeseriesGroupByHTTPVersionListResponse] +type radarHTTPTimeseriesGroupByHTTPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByHTTPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByHTTPVersionListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByHTTPVersionListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByHTTPVersionListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByHTTPVersionListResponseResultJSON contains the JSON +// metadata for the struct +// [RadarHTTPTimeseriesGroupByHTTPVersionListResponseResult] +type radarHTTPTimeseriesGroupByHTTPVersionListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByHTTPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByHTTPVersionListResponseResultSerie0 struct { + HTTP1X []string `json:"HTTP/1.x,required"` + HTTP2 []string `json:"HTTP/2,required"` + HTTP3 []string `json:"HTTP/3,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByHTTPVersionListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByHTTPVersionListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarHTTPTimeseriesGroupByHTTPVersionListResponseResultSerie0] +type radarHTTPTimeseriesGroupByHTTPVersionListResponseResultSerie0JSON struct { + HTTP1X apijson.Field + HTTP2 apijson.Field + HTTP3 apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByHTTPVersionListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByHTTPVersionListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByHTTPVersionListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByHTTPVersionListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByHTTPVersionListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByHTTPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval15m RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval1h RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval1d RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval1w RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange1d RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange2d RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange7d RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange14d RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange28d RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange12w RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange24w RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange52w RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange1dControl RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange2dControl RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange7dControl RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange14dControl RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange28dControl RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange12wControl RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange24wControl RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsFormatJson RadarHTTPTimeseriesGroupByHTTPVersionListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsFormatCsv RadarHTTPTimeseriesGroupByHTTPVersionListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsO string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsOWindows RadarHTTPTimeseriesGroupByHTTPVersionListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsOMacosx RadarHTTPTimeseriesGroupByHTTPVersionListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsOIos RadarHTTPTimeseriesGroupByHTTPVersionListParamsO = "IOS" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsOAndroid RadarHTTPTimeseriesGroupByHTTPVersionListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsOChromeos RadarHTTPTimeseriesGroupByHTTPVersionListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsOLinux RadarHTTPTimeseriesGroupByHTTPVersionListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsOSmartTv RadarHTTPTimeseriesGroupByHTTPVersionListParamsO = "SMART_TV" +) + +type RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbyhttpversion_test.go b/radarhttptimeseriesgroupbyhttpversion_test.go new file mode 100644 index 00000000000..d2c15b6bb47 --- /dev/null +++ b/radarhttptimeseriesgroupbyhttpversion_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByHTTPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByHTTPVersion.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsHTTPProtocolHTTPs}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsO{cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByHTTPVersionListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbyipversion.go b/radarhttptimeseriesgroupbyipversion.go new file mode 100644 index 00000000000..ecddfb2e21c --- /dev/null +++ b/radarhttptimeseriesgroupbyipversion.go @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByIPVersionService 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 +// [NewRadarHTTPTimeseriesGroupByIPVersionService] method instead. +type RadarHTTPTimeseriesGroupByIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByIPVersionService 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 NewRadarHTTPTimeseriesGroupByIPVersionService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByIPVersionService) { + r = &RadarHTTPTimeseriesGroupByIPVersionService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic per IP protocol +// version. +func (r *RadarHTTPTimeseriesGroupByIPVersionService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByIPVersionListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByIPVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/ip_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByIPVersionListResponse struct { + Result RadarHTTPTimeseriesGroupByIPVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByIPVersionListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByIPVersionListResponseJSON contains the JSON metadata +// for the struct [RadarHTTPTimeseriesGroupByIPVersionListResponse] +type radarHTTPTimeseriesGroupByIPVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByIPVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByIPVersionListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByIPVersionListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByIPVersionListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByIPVersionListResponseResultJSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByIPVersionListResponseResult] +type radarHTTPTimeseriesGroupByIPVersionListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByIPVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByIPVersionListResponseResultSerie0 struct { + IPv4 []string `json:"IPv4,required"` + IPv6 []string `json:"IPv6,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByIPVersionListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByIPVersionListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarHTTPTimeseriesGroupByIPVersionListResponseResultSerie0] +type radarHTTPTimeseriesGroupByIPVersionListResponseResultSerie0JSON struct { + IPv4 apijson.Field + IPv6 apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByIPVersionListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByIPVersionListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByIPVersionListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByIPVersionListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersion] `query:"httpVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByIPVersionListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByIPVersionListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByIPVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval15m RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval1h RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval1d RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval1w RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByIPVersionListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByIPVersionListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByIPVersionListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByIPVersionListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange1d RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange2d RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange7d RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange14d RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange28d RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange12w RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange24w RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange52w RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange1dControl RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange2dControl RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange7dControl RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange14dControl RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange28dControl RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange12wControl RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange24wControl RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByIPVersionListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsFormatJson RadarHTTPTimeseriesGroupByIPVersionListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByIPVersionListParamsFormatCsv RadarHTTPTimeseriesGroupByIPVersionListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByIPVersionListParamsO string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsOWindows RadarHTTPTimeseriesGroupByIPVersionListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByIPVersionListParamsOMacosx RadarHTTPTimeseriesGroupByIPVersionListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByIPVersionListParamsOIos RadarHTTPTimeseriesGroupByIPVersionListParamsO = "IOS" + RadarHTTPTimeseriesGroupByIPVersionListParamsOAndroid RadarHTTPTimeseriesGroupByIPVersionListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByIPVersionListParamsOChromeos RadarHTTPTimeseriesGroupByIPVersionListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByIPVersionListParamsOLinux RadarHTTPTimeseriesGroupByIPVersionListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByIPVersionListParamsOSmartTv RadarHTTPTimeseriesGroupByIPVersionListParamsO = "SMART_TV" +) + +type RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbyipversion_test.go b/radarhttptimeseriesgroupbyipversion_test.go new file mode 100644 index 00000000000..5958bad45bf --- /dev/null +++ b/radarhttptimeseriesgroupbyipversion_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByIPVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByIPVersion.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsHTTPVersionHttPv3}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsO{cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByIPVersionListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbyo.go b/radarhttptimeseriesgroupbyo.go new file mode 100644 index 00000000000..5d8ef787b12 --- /dev/null +++ b/radarhttptimeseriesgroupbyo.go @@ -0,0 +1,234 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByOService 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 +// [NewRadarHTTPTimeseriesGroupByOService] method instead. +type RadarHTTPTimeseriesGroupByOService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByOService 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 NewRadarHTTPTimeseriesGroupByOService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByOService) { + r = &RadarHTTPTimeseriesGroupByOService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic of the top operating +// systems. +func (r *RadarHTTPTimeseriesGroupByOService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByOListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByOListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/os" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByOListResponse struct { + Result RadarHTTPTimeseriesGroupByOListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByOListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByOListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTimeseriesGroupByOListResponse] +type radarHTTPTimeseriesGroupByOListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByOListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByOListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByOListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByOListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByOListResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPTimeseriesGroupByOListResponseResult] +type radarHTTPTimeseriesGroupByOListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByOListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByOListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarHTTPTimeseriesGroupByOListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByOListResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByOListResponseResultSerie0] +type radarHTTPTimeseriesGroupByOListResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByOListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByOListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByOListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByOListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByOListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByOListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByOListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByOListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByOListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByOListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTimeseriesGroupByOListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByOListParams]'s query parameters +// as `url.Values`. +func (r RadarHTTPTimeseriesGroupByOListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByOListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByOListParamsAggInterval15m RadarHTTPTimeseriesGroupByOListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByOListParamsAggInterval1h RadarHTTPTimeseriesGroupByOListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByOListParamsAggInterval1d RadarHTTPTimeseriesGroupByOListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByOListParamsAggInterval1w RadarHTTPTimeseriesGroupByOListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByOListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByOListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByOListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByOListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByOListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByOListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByOListParamsDateRange1d RadarHTTPTimeseriesGroupByOListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByOListParamsDateRange2d RadarHTTPTimeseriesGroupByOListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByOListParamsDateRange7d RadarHTTPTimeseriesGroupByOListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByOListParamsDateRange14d RadarHTTPTimeseriesGroupByOListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByOListParamsDateRange28d RadarHTTPTimeseriesGroupByOListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByOListParamsDateRange12w RadarHTTPTimeseriesGroupByOListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByOListParamsDateRange24w RadarHTTPTimeseriesGroupByOListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByOListParamsDateRange52w RadarHTTPTimeseriesGroupByOListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByOListParamsDateRange1dControl RadarHTTPTimeseriesGroupByOListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByOListParamsDateRange2dControl RadarHTTPTimeseriesGroupByOListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByOListParamsDateRange7dControl RadarHTTPTimeseriesGroupByOListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByOListParamsDateRange14dControl RadarHTTPTimeseriesGroupByOListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByOListParamsDateRange28dControl RadarHTTPTimeseriesGroupByOListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByOListParamsDateRange12wControl RadarHTTPTimeseriesGroupByOListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByOListParamsDateRange24wControl RadarHTTPTimeseriesGroupByOListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByOListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByOListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByOListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByOListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByOListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByOListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByOListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByOListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByOListParamsFormatJson RadarHTTPTimeseriesGroupByOListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByOListParamsFormatCsv RadarHTTPTimeseriesGroupByOListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByOListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByOListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByOListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByOListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByOListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByOListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByOListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByOListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByOListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByOListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByOListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByOListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByOListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByOListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByOListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByOListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByOListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByOListParamsTlsVersion string + +const ( + RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSv1_0 RadarHTTPTimeseriesGroupByOListParamsTlsVersion = "TLSv1_0" + RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSv1_1 RadarHTTPTimeseriesGroupByOListParamsTlsVersion = "TLSv1_1" + RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSv1_2 RadarHTTPTimeseriesGroupByOListParamsTlsVersion = "TLSv1_2" + RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSv1_3 RadarHTTPTimeseriesGroupByOListParamsTlsVersion = "TLSv1_3" + RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSvQuic RadarHTTPTimeseriesGroupByOListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptimeseriesgroupbyo_test.go b/radarhttptimeseriesgroupbyo_test.go new file mode 100644 index 00000000000..0fdd635f949 --- /dev/null +++ b/radarhttptimeseriesgroupbyo_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByOListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByOs.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByOListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByOListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByOListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByOListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByOListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByOListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByOListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByOListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByOListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByOListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByOListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByOListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByOListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByOListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByOListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByOListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByOListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByOListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByOListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByOListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByOListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByOListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByOListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByOListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByOListParamsTlsVersion{cloudflare.RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTimeseriesGroupByOListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptimeseriesgroupbytlsversion.go b/radarhttptimeseriesgroupbytlsversion.go new file mode 100644 index 00000000000..3a5030d6b81 --- /dev/null +++ b/radarhttptimeseriesgroupbytlsversion.go @@ -0,0 +1,248 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTimeseriesGroupByTlsVersionService 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 +// [NewRadarHTTPTimeseriesGroupByTlsVersionService] method instead. +type RadarHTTPTimeseriesGroupByTlsVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTimeseriesGroupByTlsVersionService 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 NewRadarHTTPTimeseriesGroupByTlsVersionService(opts ...option.RequestOption) (r *RadarHTTPTimeseriesGroupByTlsVersionService) { + r = &RadarHTTPTimeseriesGroupByTlsVersionService{} + r.Options = opts + return +} + +// Get a time series of the percentage distribution of traffic per TLS protocol +// version. +func (r *RadarHTTPTimeseriesGroupByTlsVersionService) List(ctx context.Context, query RadarHTTPTimeseriesGroupByTlsVersionListParams, opts ...option.RequestOption) (res *RadarHTTPTimeseriesGroupByTlsVersionListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/timeseries_groups/tls_version" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTimeseriesGroupByTlsVersionListResponse struct { + Result RadarHTTPTimeseriesGroupByTlsVersionListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTimeseriesGroupByTlsVersionListResponseJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByTlsVersionListResponseJSON contains the JSON metadata +// for the struct [RadarHTTPTimeseriesGroupByTlsVersionListResponse] +type radarHTTPTimeseriesGroupByTlsVersionListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByTlsVersionListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByTlsVersionListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarHTTPTimeseriesGroupByTlsVersionListResponseResultSerie0 `json:"serie_0,required"` + JSON radarHTTPTimeseriesGroupByTlsVersionListResponseResultJSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByTlsVersionListResponseResultJSON contains the JSON +// metadata for the struct [RadarHTTPTimeseriesGroupByTlsVersionListResponseResult] +type radarHTTPTimeseriesGroupByTlsVersionListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByTlsVersionListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByTlsVersionListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + Tls1_0 []string `json:"TLS 1.0,required"` + Tls1_1 []string `json:"TLS 1.1,required"` + Tls1_2 []string `json:"TLS 1.2,required"` + Tls1_3 []string `json:"TLS 1.3,required"` + TlsQuic []string `json:"TLS QUIC,required"` + JSON radarHTTPTimeseriesGroupByTlsVersionListResponseResultSerie0JSON `json:"-"` +} + +// radarHTTPTimeseriesGroupByTlsVersionListResponseResultSerie0JSON contains the +// JSON metadata for the struct +// [RadarHTTPTimeseriesGroupByTlsVersionListResponseResultSerie0] +type radarHTTPTimeseriesGroupByTlsVersionListResponseResultSerie0JSON struct { + Timestamps apijson.Field + Tls1_0 apijson.Field + Tls1_1 apijson.Field + Tls1_2 apijson.Field + Tls1_3 apijson.Field + TlsQuic apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTimeseriesGroupByTlsVersionListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTimeseriesGroupByTlsVersionListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTimeseriesGroupByTlsVersionListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersion] `query:"ipVersion"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTimeseriesGroupByTlsVersionListParamsO] `query:"os"` +} + +// URLQuery serializes [RadarHTTPTimeseriesGroupByTlsVersionListParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTimeseriesGroupByTlsVersionListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval15m RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval = "15m" + RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval1h RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval = "1h" + RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval1d RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval = "1d" + RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval1w RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval = "1w" +) + +type RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClass string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClassLikelyAutomated RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClassLikelyHuman RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange1d RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "1d" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange2d RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "2d" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange7d RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "7d" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange14d RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "14d" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange28d RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "28d" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange12w RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "12w" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange24w RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "24w" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange52w RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "52w" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange1dControl RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "1dControl" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange2dControl RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "2dControl" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange7dControl RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "7dControl" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange14dControl RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "14dControl" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange28dControl RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "28dControl" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange12wControl RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "12wControl" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange24wControl RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange = "24wControl" +) + +type RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceType string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceTypeDesktop RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceType = "DESKTOP" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceTypeMobile RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceType = "MOBILE" + RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceTypeOther RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTimeseriesGroupByTlsVersionListParamsFormat string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsFormatJson RadarHTTPTimeseriesGroupByTlsVersionListParamsFormat = "JSON" + RadarHTTPTimeseriesGroupByTlsVersionListParamsFormatCsv RadarHTTPTimeseriesGroupByTlsVersionListParamsFormat = "CSV" +) + +type RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocol string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocolHTTP RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocol = "HTTP" + RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocolHTTPs RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersion string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersionHttPv1 RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersion = "HTTPv1" + RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersionHttPv2 RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersion = "HTTPv2" + RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersionHttPv3 RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersion string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersionIPv4 RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersion = "IPv4" + RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersionIPv6 RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersion = "IPv6" +) + +type RadarHTTPTimeseriesGroupByTlsVersionListParamsO string + +const ( + RadarHTTPTimeseriesGroupByTlsVersionListParamsOWindows RadarHTTPTimeseriesGroupByTlsVersionListParamsO = "WINDOWS" + RadarHTTPTimeseriesGroupByTlsVersionListParamsOMacosx RadarHTTPTimeseriesGroupByTlsVersionListParamsO = "MACOSX" + RadarHTTPTimeseriesGroupByTlsVersionListParamsOIos RadarHTTPTimeseriesGroupByTlsVersionListParamsO = "IOS" + RadarHTTPTimeseriesGroupByTlsVersionListParamsOAndroid RadarHTTPTimeseriesGroupByTlsVersionListParamsO = "ANDROID" + RadarHTTPTimeseriesGroupByTlsVersionListParamsOChromeos RadarHTTPTimeseriesGroupByTlsVersionListParamsO = "CHROMEOS" + RadarHTTPTimeseriesGroupByTlsVersionListParamsOLinux RadarHTTPTimeseriesGroupByTlsVersionListParamsO = "LINUX" + RadarHTTPTimeseriesGroupByTlsVersionListParamsOSmartTv RadarHTTPTimeseriesGroupByTlsVersionListParamsO = "SMART_TV" +) diff --git a/radarhttptimeseriesgroupbytlsversion_test.go b/radarhttptimeseriesgroupbytlsversion_test.go new file mode 100644 index 00000000000..ff79eeefe3b --- /dev/null +++ b/radarhttptimeseriesgroupbytlsversion_test.go @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTimeseriesGroupByTlsVersionListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.ByTlsVersion.List(context.TODO(), cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParams{ + AggInterval: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClass{cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange{cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange1d, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange2d, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceType{cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceTypeMobile, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocol{cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersion{cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersion{cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersionIPv4, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsO{cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsOWindows, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsOMacosx, cloudflare.RadarHTTPTimeseriesGroupByTlsVersionListParamsOIos}), + }) + 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/radarhttptop.go b/radarhttptop.go new file mode 100644 index 00000000000..8830af523ff --- /dev/null +++ b/radarhttptop.go @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopService 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 [NewRadarHTTPTopService] method +// instead. +type RadarHTTPTopService struct { + Options []option.RequestOption + Ases *RadarHTTPTopAseService + BrowserFamilies *RadarHTTPTopBrowserFamilyService + Browsers *RadarHTTPTopBrowserService + Locations *RadarHTTPTopLocationService +} + +// NewRadarHTTPTopService 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 NewRadarHTTPTopService(opts ...option.RequestOption) (r *RadarHTTPTopService) { + r = &RadarHTTPTopService{} + r.Options = opts + r.Ases = NewRadarHTTPTopAseService(opts...) + r.BrowserFamilies = NewRadarHTTPTopBrowserFamilyService(opts...) + r.Browsers = NewRadarHTTPTopBrowserService(opts...) + r.Locations = NewRadarHTTPTopLocationService(opts...) + return +} diff --git a/radarhttptopase.go b/radarhttptopase.go new file mode 100644 index 00000000000..81a8bcdd433 --- /dev/null +++ b/radarhttptopase.go @@ -0,0 +1,343 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseService 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 [NewRadarHTTPTopAseService] method +// instead. +type RadarHTTPTopAseService struct { + Options []option.RequestOption + BotClasses *RadarHTTPTopAseBotClassService + DeviceTypes *RadarHTTPTopAseDeviceTypeService + HTTPProtocols *RadarHTTPTopAseHTTPProtocolService + HTTPVersions *RadarHTTPTopAseHTTPVersionService + IPVersions *RadarHTTPTopAseIPVersionService + Os *RadarHTTPTopAseOService + TlsVersions *RadarHTTPTopAseTlsVersionService +} + +// NewRadarHTTPTopAseService 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 NewRadarHTTPTopAseService(opts ...option.RequestOption) (r *RadarHTTPTopAseService) { + r = &RadarHTTPTopAseService{} + r.Options = opts + r.BotClasses = NewRadarHTTPTopAseBotClassService(opts...) + r.DeviceTypes = NewRadarHTTPTopAseDeviceTypeService(opts...) + r.HTTPProtocols = NewRadarHTTPTopAseHTTPProtocolService(opts...) + r.HTTPVersions = NewRadarHTTPTopAseHTTPVersionService(opts...) + r.IPVersions = NewRadarHTTPTopAseIPVersionService(opts...) + r.Os = NewRadarHTTPTopAseOService(opts...) + r.TlsVersions = NewRadarHTTPTopAseTlsVersionService(opts...) + return +} + +// Get the top autonomous systems by HTTP traffic. Values are a percentage out of +// the total traffic. +func (r *RadarHTTPTopAseService) List(ctx context.Context, query RadarHTTPTopAseListParams, opts ...option.RequestOption) (res *RadarHTTPTopAseListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/top/ases" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseListResponse struct { + Result RadarHTTPTopAseListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseListResponseJSON `json:"-"` +} + +// radarHTTPTopAseListResponseJSON contains the JSON metadata for the struct +// [RadarHTTPTopAseListResponse] +type radarHTTPTopAseListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseListResponseResult struct { + Meta RadarHTTPTopAseListResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseListResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseListResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseListResponseResultJSON contains the JSON metadata for the struct +// [RadarHTTPTopAseListResponseResult] +type radarHTTPTopAseListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseListResponseResultMeta struct { + DateRange []RadarHTTPTopAseListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseListResponseResultMeta] +type radarHTTPTopAseListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseListResponseResultMetaDateRangeJSON contains the JSON metadata +// for the struct [RadarHTTPTopAseListResponseResultMetaDateRange] +type radarHTTPTopAseListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct [RadarHTTPTopAseListResponseResultMetaConfidenceInfo] +type radarHTTPTopAseListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseListResponseResultMetaConfidenceInfoAnnotationJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopAseListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseListResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseListResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarHTTPTopAseListResponseResultTop0] +type radarHTTPTopAseListResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopAseListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopAseListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopAseListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopAseListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopAseListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopAseListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopAseListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPTopAseListParamsBotClass string + +const ( + RadarHTTPTopAseListParamsBotClassLikelyAutomated RadarHTTPTopAseListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseListParamsBotClassLikelyHuman RadarHTTPTopAseListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseListParamsDateRange string + +const ( + RadarHTTPTopAseListParamsDateRange1d RadarHTTPTopAseListParamsDateRange = "1d" + RadarHTTPTopAseListParamsDateRange2d RadarHTTPTopAseListParamsDateRange = "2d" + RadarHTTPTopAseListParamsDateRange7d RadarHTTPTopAseListParamsDateRange = "7d" + RadarHTTPTopAseListParamsDateRange14d RadarHTTPTopAseListParamsDateRange = "14d" + RadarHTTPTopAseListParamsDateRange28d RadarHTTPTopAseListParamsDateRange = "28d" + RadarHTTPTopAseListParamsDateRange12w RadarHTTPTopAseListParamsDateRange = "12w" + RadarHTTPTopAseListParamsDateRange24w RadarHTTPTopAseListParamsDateRange = "24w" + RadarHTTPTopAseListParamsDateRange52w RadarHTTPTopAseListParamsDateRange = "52w" + RadarHTTPTopAseListParamsDateRange1dControl RadarHTTPTopAseListParamsDateRange = "1dControl" + RadarHTTPTopAseListParamsDateRange2dControl RadarHTTPTopAseListParamsDateRange = "2dControl" + RadarHTTPTopAseListParamsDateRange7dControl RadarHTTPTopAseListParamsDateRange = "7dControl" + RadarHTTPTopAseListParamsDateRange14dControl RadarHTTPTopAseListParamsDateRange = "14dControl" + RadarHTTPTopAseListParamsDateRange28dControl RadarHTTPTopAseListParamsDateRange = "28dControl" + RadarHTTPTopAseListParamsDateRange12wControl RadarHTTPTopAseListParamsDateRange = "12wControl" + RadarHTTPTopAseListParamsDateRange24wControl RadarHTTPTopAseListParamsDateRange = "24wControl" +) + +type RadarHTTPTopAseListParamsDeviceType string + +const ( + RadarHTTPTopAseListParamsDeviceTypeDesktop RadarHTTPTopAseListParamsDeviceType = "DESKTOP" + RadarHTTPTopAseListParamsDeviceTypeMobile RadarHTTPTopAseListParamsDeviceType = "MOBILE" + RadarHTTPTopAseListParamsDeviceTypeOther RadarHTTPTopAseListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopAseListParamsFormat string + +const ( + RadarHTTPTopAseListParamsFormatJson RadarHTTPTopAseListParamsFormat = "JSON" + RadarHTTPTopAseListParamsFormatCsv RadarHTTPTopAseListParamsFormat = "CSV" +) + +type RadarHTTPTopAseListParamsHTTPProtocol string + +const ( + RadarHTTPTopAseListParamsHTTPProtocolHTTP RadarHTTPTopAseListParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseListParamsHTTPProtocolHTTPs RadarHTTPTopAseListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseListParamsHTTPVersion string + +const ( + RadarHTTPTopAseListParamsHTTPVersionHttPv1 RadarHTTPTopAseListParamsHTTPVersion = "HTTPv1" + RadarHTTPTopAseListParamsHTTPVersionHttPv2 RadarHTTPTopAseListParamsHTTPVersion = "HTTPv2" + RadarHTTPTopAseListParamsHTTPVersionHttPv3 RadarHTTPTopAseListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopAseListParamsIPVersion string + +const ( + RadarHTTPTopAseListParamsIPVersionIPv4 RadarHTTPTopAseListParamsIPVersion = "IPv4" + RadarHTTPTopAseListParamsIPVersionIPv6 RadarHTTPTopAseListParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseListParamsO string + +const ( + RadarHTTPTopAseListParamsOWindows RadarHTTPTopAseListParamsO = "WINDOWS" + RadarHTTPTopAseListParamsOMacosx RadarHTTPTopAseListParamsO = "MACOSX" + RadarHTTPTopAseListParamsOIos RadarHTTPTopAseListParamsO = "IOS" + RadarHTTPTopAseListParamsOAndroid RadarHTTPTopAseListParamsO = "ANDROID" + RadarHTTPTopAseListParamsOChromeos RadarHTTPTopAseListParamsO = "CHROMEOS" + RadarHTTPTopAseListParamsOLinux RadarHTTPTopAseListParamsO = "LINUX" + RadarHTTPTopAseListParamsOSmartTv RadarHTTPTopAseListParamsO = "SMART_TV" +) + +type RadarHTTPTopAseListParamsTlsVersion string + +const ( + RadarHTTPTopAseListParamsTlsVersionTlSv1_0 RadarHTTPTopAseListParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseListParamsTlsVersionTlSv1_1 RadarHTTPTopAseListParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseListParamsTlsVersionTlSv1_2 RadarHTTPTopAseListParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseListParamsTlsVersionTlSv1_3 RadarHTTPTopAseListParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseListParamsTlsVersionTlSvQuic RadarHTTPTopAseListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopase_test.go b/radarhttptopase_test.go new file mode 100644 index 00000000000..e7e1680882b --- /dev/null +++ b/radarhttptopase_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.List(context.TODO(), cloudflare.RadarHTTPTopAseListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsBotClass{cloudflare.RadarHTTPTopAseListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopAseListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsDateRange{cloudflare.RadarHTTPTopAseListParamsDateRange1d, cloudflare.RadarHTTPTopAseListParamsDateRange2d, cloudflare.RadarHTTPTopAseListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsDeviceType{cloudflare.RadarHTTPTopAseListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopAseListParamsDeviceTypeMobile, cloudflare.RadarHTTPTopAseListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsHTTPProtocol{cloudflare.RadarHTTPTopAseListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsHTTPVersion{cloudflare.RadarHTTPTopAseListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopAseListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopAseListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsIPVersion{cloudflare.RadarHTTPTopAseListParamsIPVersionIPv4, cloudflare.RadarHTTPTopAseListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsO{cloudflare.RadarHTTPTopAseListParamsOWindows, cloudflare.RadarHTTPTopAseListParamsOMacosx, cloudflare.RadarHTTPTopAseListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseListParamsTlsVersion{cloudflare.RadarHTTPTopAseListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopAseListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopAseListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptopasebotclass.go b/radarhttptopasebotclass.go new file mode 100644 index 00000000000..79031dc84af --- /dev/null +++ b/radarhttptopasebotclass.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseBotClassService 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 +// [NewRadarHTTPTopAseBotClassService] method instead. +type RadarHTTPTopAseBotClassService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopAseBotClassService 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 NewRadarHTTPTopAseBotClassService(opts ...option.RequestOption) (r *RadarHTTPTopAseBotClassService) { + r = &RadarHTTPTopAseBotClassService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by HTTP traffic, of the requested bot +// class. These two categories use Cloudflare's bot score - refer to +// [Bot Scores](https://developers.cloudflare.com/bots/concepts/bot-score) for more +// information. Values are a percentage out of the total traffic. +func (r *RadarHTTPTopAseBotClassService) Get(ctx context.Context, botClass RadarHTTPTopAseBotClassGetParamsBotClass, query RadarHTTPTopAseBotClassGetParams, opts ...option.RequestOption) (res *RadarHTTPTopAseBotClassGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/ases/bot_class/%v", botClass) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseBotClassGetResponse struct { + Result RadarHTTPTopAseBotClassGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseBotClassGetResponseJSON `json:"-"` +} + +// radarHTTPTopAseBotClassGetResponseJSON contains the JSON metadata for the struct +// [RadarHTTPTopAseBotClassGetResponse] +type radarHTTPTopAseBotClassGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseBotClassGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseBotClassGetResponseResult struct { + Meta RadarHTTPTopAseBotClassGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseBotClassGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseBotClassGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseBotClassGetResponseResultJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseBotClassGetResponseResult] +type radarHTTPTopAseBotClassGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseBotClassGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseBotClassGetResponseResultMeta struct { + DateRange []RadarHTTPTopAseBotClassGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseBotClassGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseBotClassGetResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarHTTPTopAseBotClassGetResponseResultMeta] +type radarHTTPTopAseBotClassGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseBotClassGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseBotClassGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseBotClassGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseBotClassGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarHTTPTopAseBotClassGetResponseResultMetaDateRange] +type radarHTTPTopAseBotClassGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseBotClassGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfo] +type radarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseBotClassGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseBotClassGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseBotClassGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseBotClassGetResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarHTTPTopAseBotClassGetResponseResultTop0] +type radarHTTPTopAseBotClassGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseBotClassGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseBotClassGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseBotClassGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopAseBotClassGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseBotClassGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseBotClassGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopAseBotClassGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopAseBotClassGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopAseBotClassGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopAseBotClassGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopAseBotClassGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseBotClassGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Bot class. +type RadarHTTPTopAseBotClassGetParamsBotClass string + +const ( + RadarHTTPTopAseBotClassGetParamsBotClassLikelyAutomated RadarHTTPTopAseBotClassGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseBotClassGetParamsBotClassLikelyHuman RadarHTTPTopAseBotClassGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseBotClassGetParamsDateRange string + +const ( + RadarHTTPTopAseBotClassGetParamsDateRange1d RadarHTTPTopAseBotClassGetParamsDateRange = "1d" + RadarHTTPTopAseBotClassGetParamsDateRange2d RadarHTTPTopAseBotClassGetParamsDateRange = "2d" + RadarHTTPTopAseBotClassGetParamsDateRange7d RadarHTTPTopAseBotClassGetParamsDateRange = "7d" + RadarHTTPTopAseBotClassGetParamsDateRange14d RadarHTTPTopAseBotClassGetParamsDateRange = "14d" + RadarHTTPTopAseBotClassGetParamsDateRange28d RadarHTTPTopAseBotClassGetParamsDateRange = "28d" + RadarHTTPTopAseBotClassGetParamsDateRange12w RadarHTTPTopAseBotClassGetParamsDateRange = "12w" + RadarHTTPTopAseBotClassGetParamsDateRange24w RadarHTTPTopAseBotClassGetParamsDateRange = "24w" + RadarHTTPTopAseBotClassGetParamsDateRange52w RadarHTTPTopAseBotClassGetParamsDateRange = "52w" + RadarHTTPTopAseBotClassGetParamsDateRange1dControl RadarHTTPTopAseBotClassGetParamsDateRange = "1dControl" + RadarHTTPTopAseBotClassGetParamsDateRange2dControl RadarHTTPTopAseBotClassGetParamsDateRange = "2dControl" + RadarHTTPTopAseBotClassGetParamsDateRange7dControl RadarHTTPTopAseBotClassGetParamsDateRange = "7dControl" + RadarHTTPTopAseBotClassGetParamsDateRange14dControl RadarHTTPTopAseBotClassGetParamsDateRange = "14dControl" + RadarHTTPTopAseBotClassGetParamsDateRange28dControl RadarHTTPTopAseBotClassGetParamsDateRange = "28dControl" + RadarHTTPTopAseBotClassGetParamsDateRange12wControl RadarHTTPTopAseBotClassGetParamsDateRange = "12wControl" + RadarHTTPTopAseBotClassGetParamsDateRange24wControl RadarHTTPTopAseBotClassGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopAseBotClassGetParamsDeviceType string + +const ( + RadarHTTPTopAseBotClassGetParamsDeviceTypeDesktop RadarHTTPTopAseBotClassGetParamsDeviceType = "DESKTOP" + RadarHTTPTopAseBotClassGetParamsDeviceTypeMobile RadarHTTPTopAseBotClassGetParamsDeviceType = "MOBILE" + RadarHTTPTopAseBotClassGetParamsDeviceTypeOther RadarHTTPTopAseBotClassGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopAseBotClassGetParamsFormat string + +const ( + RadarHTTPTopAseBotClassGetParamsFormatJson RadarHTTPTopAseBotClassGetParamsFormat = "JSON" + RadarHTTPTopAseBotClassGetParamsFormatCsv RadarHTTPTopAseBotClassGetParamsFormat = "CSV" +) + +type RadarHTTPTopAseBotClassGetParamsHTTPProtocol string + +const ( + RadarHTTPTopAseBotClassGetParamsHTTPProtocolHTTP RadarHTTPTopAseBotClassGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseBotClassGetParamsHTTPProtocolHTTPs RadarHTTPTopAseBotClassGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseBotClassGetParamsHTTPVersion string + +const ( + RadarHTTPTopAseBotClassGetParamsHTTPVersionHttPv1 RadarHTTPTopAseBotClassGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopAseBotClassGetParamsHTTPVersionHttPv2 RadarHTTPTopAseBotClassGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopAseBotClassGetParamsHTTPVersionHttPv3 RadarHTTPTopAseBotClassGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopAseBotClassGetParamsIPVersion string + +const ( + RadarHTTPTopAseBotClassGetParamsIPVersionIPv4 RadarHTTPTopAseBotClassGetParamsIPVersion = "IPv4" + RadarHTTPTopAseBotClassGetParamsIPVersionIPv6 RadarHTTPTopAseBotClassGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseBotClassGetParamsO string + +const ( + RadarHTTPTopAseBotClassGetParamsOWindows RadarHTTPTopAseBotClassGetParamsO = "WINDOWS" + RadarHTTPTopAseBotClassGetParamsOMacosx RadarHTTPTopAseBotClassGetParamsO = "MACOSX" + RadarHTTPTopAseBotClassGetParamsOIos RadarHTTPTopAseBotClassGetParamsO = "IOS" + RadarHTTPTopAseBotClassGetParamsOAndroid RadarHTTPTopAseBotClassGetParamsO = "ANDROID" + RadarHTTPTopAseBotClassGetParamsOChromeos RadarHTTPTopAseBotClassGetParamsO = "CHROMEOS" + RadarHTTPTopAseBotClassGetParamsOLinux RadarHTTPTopAseBotClassGetParamsO = "LINUX" + RadarHTTPTopAseBotClassGetParamsOSmartTv RadarHTTPTopAseBotClassGetParamsO = "SMART_TV" +) + +type RadarHTTPTopAseBotClassGetParamsTlsVersion string + +const ( + RadarHTTPTopAseBotClassGetParamsTlsVersionTlSv1_0 RadarHTTPTopAseBotClassGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseBotClassGetParamsTlsVersionTlSv1_1 RadarHTTPTopAseBotClassGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseBotClassGetParamsTlsVersionTlSv1_2 RadarHTTPTopAseBotClassGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseBotClassGetParamsTlsVersionTlSv1_3 RadarHTTPTopAseBotClassGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseBotClassGetParamsTlsVersionTlSvQuic RadarHTTPTopAseBotClassGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopasebotclass_test.go b/radarhttptopasebotclass_test.go new file mode 100644 index 00000000000..97e81928768 --- /dev/null +++ b/radarhttptopasebotclass_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseBotClassGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.BotClasses.Get( + context.TODO(), + cloudflare.RadarHTTPTopAseBotClassGetParamsBotClassLikelyAutomated, + cloudflare.RadarHTTPTopAseBotClassGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseBotClassGetParamsDateRange{cloudflare.RadarHTTPTopAseBotClassGetParamsDateRange1d, cloudflare.RadarHTTPTopAseBotClassGetParamsDateRange2d, cloudflare.RadarHTTPTopAseBotClassGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopAseBotClassGetParamsDeviceType{cloudflare.RadarHTTPTopAseBotClassGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopAseBotClassGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopAseBotClassGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseBotClassGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseBotClassGetParamsHTTPProtocol{cloudflare.RadarHTTPTopAseBotClassGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseBotClassGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseBotClassGetParamsHTTPVersion{cloudflare.RadarHTTPTopAseBotClassGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopAseBotClassGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopAseBotClassGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseBotClassGetParamsIPVersion{cloudflare.RadarHTTPTopAseBotClassGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopAseBotClassGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopAseBotClassGetParamsO{cloudflare.RadarHTTPTopAseBotClassGetParamsOWindows, cloudflare.RadarHTTPTopAseBotClassGetParamsOMacosx, cloudflare.RadarHTTPTopAseBotClassGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseBotClassGetParamsTlsVersion{cloudflare.RadarHTTPTopAseBotClassGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopAseBotClassGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopAseBotClassGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptopasedevicetype.go b/radarhttptopasedevicetype.go new file mode 100644 index 00000000000..f6bcd8feb73 --- /dev/null +++ b/radarhttptopasedevicetype.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseDeviceTypeService 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 +// [NewRadarHTTPTopAseDeviceTypeService] method instead. +type RadarHTTPTopAseDeviceTypeService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopAseDeviceTypeService 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 NewRadarHTTPTopAseDeviceTypeService(opts ...option.RequestOption) (r *RadarHTTPTopAseDeviceTypeService) { + r = &RadarHTTPTopAseDeviceTypeService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by HTTP traffic, of the requested device +// type. Values are a percentage out of the total traffic. +func (r *RadarHTTPTopAseDeviceTypeService) Get(ctx context.Context, deviceType RadarHTTPTopAseDeviceTypeGetParamsDeviceType, query RadarHTTPTopAseDeviceTypeGetParams, opts ...option.RequestOption) (res *RadarHTTPTopAseDeviceTypeGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/ases/device_type/%v", deviceType) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseDeviceTypeGetResponse struct { + Result RadarHTTPTopAseDeviceTypeGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseDeviceTypeGetResponseJSON `json:"-"` +} + +// radarHTTPTopAseDeviceTypeGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseDeviceTypeGetResponse] +type radarHTTPTopAseDeviceTypeGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseDeviceTypeGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseDeviceTypeGetResponseResult struct { + Meta RadarHTTPTopAseDeviceTypeGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseDeviceTypeGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseDeviceTypeGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseDeviceTypeGetResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPTopAseDeviceTypeGetResponseResult] +type radarHTTPTopAseDeviceTypeGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseDeviceTypeGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseDeviceTypeGetResponseResultMeta struct { + DateRange []RadarHTTPTopAseDeviceTypeGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseDeviceTypeGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseDeviceTypeGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPTopAseDeviceTypeGetResponseResultMeta] +type radarHTTPTopAseDeviceTypeGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseDeviceTypeGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseDeviceTypeGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseDeviceTypeGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseDeviceTypeGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopAseDeviceTypeGetResponseResultMetaDateRange] +type radarHTTPTopAseDeviceTypeGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseDeviceTypeGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfo] +type radarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseDeviceTypeGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseDeviceTypeGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseDeviceTypeGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarHTTPTopAseDeviceTypeGetResponseResultTop0] +type radarHTTPTopAseDeviceTypeGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseDeviceTypeGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseDeviceTypeGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopAseDeviceTypeGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseDeviceTypeGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseDeviceTypeGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopAseDeviceTypeGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopAseDeviceTypeGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopAseDeviceTypeGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopAseDeviceTypeGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopAseDeviceTypeGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseDeviceTypeGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Device type. +type RadarHTTPTopAseDeviceTypeGetParamsDeviceType string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsDeviceTypeDesktop RadarHTTPTopAseDeviceTypeGetParamsDeviceType = "DESKTOP" + RadarHTTPTopAseDeviceTypeGetParamsDeviceTypeMobile RadarHTTPTopAseDeviceTypeGetParamsDeviceType = "MOBILE" + RadarHTTPTopAseDeviceTypeGetParamsDeviceTypeOther RadarHTTPTopAseDeviceTypeGetParamsDeviceType = "OTHER" +) + +type RadarHTTPTopAseDeviceTypeGetParamsBotClass string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsBotClassLikelyAutomated RadarHTTPTopAseDeviceTypeGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseDeviceTypeGetParamsBotClassLikelyHuman RadarHTTPTopAseDeviceTypeGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseDeviceTypeGetParamsDateRange string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsDateRange1d RadarHTTPTopAseDeviceTypeGetParamsDateRange = "1d" + RadarHTTPTopAseDeviceTypeGetParamsDateRange2d RadarHTTPTopAseDeviceTypeGetParamsDateRange = "2d" + RadarHTTPTopAseDeviceTypeGetParamsDateRange7d RadarHTTPTopAseDeviceTypeGetParamsDateRange = "7d" + RadarHTTPTopAseDeviceTypeGetParamsDateRange14d RadarHTTPTopAseDeviceTypeGetParamsDateRange = "14d" + RadarHTTPTopAseDeviceTypeGetParamsDateRange28d RadarHTTPTopAseDeviceTypeGetParamsDateRange = "28d" + RadarHTTPTopAseDeviceTypeGetParamsDateRange12w RadarHTTPTopAseDeviceTypeGetParamsDateRange = "12w" + RadarHTTPTopAseDeviceTypeGetParamsDateRange24w RadarHTTPTopAseDeviceTypeGetParamsDateRange = "24w" + RadarHTTPTopAseDeviceTypeGetParamsDateRange52w RadarHTTPTopAseDeviceTypeGetParamsDateRange = "52w" + RadarHTTPTopAseDeviceTypeGetParamsDateRange1dControl RadarHTTPTopAseDeviceTypeGetParamsDateRange = "1dControl" + RadarHTTPTopAseDeviceTypeGetParamsDateRange2dControl RadarHTTPTopAseDeviceTypeGetParamsDateRange = "2dControl" + RadarHTTPTopAseDeviceTypeGetParamsDateRange7dControl RadarHTTPTopAseDeviceTypeGetParamsDateRange = "7dControl" + RadarHTTPTopAseDeviceTypeGetParamsDateRange14dControl RadarHTTPTopAseDeviceTypeGetParamsDateRange = "14dControl" + RadarHTTPTopAseDeviceTypeGetParamsDateRange28dControl RadarHTTPTopAseDeviceTypeGetParamsDateRange = "28dControl" + RadarHTTPTopAseDeviceTypeGetParamsDateRange12wControl RadarHTTPTopAseDeviceTypeGetParamsDateRange = "12wControl" + RadarHTTPTopAseDeviceTypeGetParamsDateRange24wControl RadarHTTPTopAseDeviceTypeGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarHTTPTopAseDeviceTypeGetParamsFormat string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsFormatJson RadarHTTPTopAseDeviceTypeGetParamsFormat = "JSON" + RadarHTTPTopAseDeviceTypeGetParamsFormatCsv RadarHTTPTopAseDeviceTypeGetParamsFormat = "CSV" +) + +type RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocol string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocolHTTP RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocolHTTPs RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseDeviceTypeGetParamsHTTPVersion string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsHTTPVersionHttPv1 RadarHTTPTopAseDeviceTypeGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopAseDeviceTypeGetParamsHTTPVersionHttPv2 RadarHTTPTopAseDeviceTypeGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopAseDeviceTypeGetParamsHTTPVersionHttPv3 RadarHTTPTopAseDeviceTypeGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopAseDeviceTypeGetParamsIPVersion string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsIPVersionIPv4 RadarHTTPTopAseDeviceTypeGetParamsIPVersion = "IPv4" + RadarHTTPTopAseDeviceTypeGetParamsIPVersionIPv6 RadarHTTPTopAseDeviceTypeGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseDeviceTypeGetParamsO string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsOWindows RadarHTTPTopAseDeviceTypeGetParamsO = "WINDOWS" + RadarHTTPTopAseDeviceTypeGetParamsOMacosx RadarHTTPTopAseDeviceTypeGetParamsO = "MACOSX" + RadarHTTPTopAseDeviceTypeGetParamsOIos RadarHTTPTopAseDeviceTypeGetParamsO = "IOS" + RadarHTTPTopAseDeviceTypeGetParamsOAndroid RadarHTTPTopAseDeviceTypeGetParamsO = "ANDROID" + RadarHTTPTopAseDeviceTypeGetParamsOChromeos RadarHTTPTopAseDeviceTypeGetParamsO = "CHROMEOS" + RadarHTTPTopAseDeviceTypeGetParamsOLinux RadarHTTPTopAseDeviceTypeGetParamsO = "LINUX" + RadarHTTPTopAseDeviceTypeGetParamsOSmartTv RadarHTTPTopAseDeviceTypeGetParamsO = "SMART_TV" +) + +type RadarHTTPTopAseDeviceTypeGetParamsTlsVersion string + +const ( + RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSv1_0 RadarHTTPTopAseDeviceTypeGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSv1_1 RadarHTTPTopAseDeviceTypeGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSv1_2 RadarHTTPTopAseDeviceTypeGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSv1_3 RadarHTTPTopAseDeviceTypeGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSvQuic RadarHTTPTopAseDeviceTypeGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopasedevicetype_test.go b/radarhttptopasedevicetype_test.go new file mode 100644 index 00000000000..5bcaa29c495 --- /dev/null +++ b/radarhttptopasedevicetype_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseDeviceTypeGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.DeviceTypes.Get( + context.TODO(), + cloudflare.RadarHTTPTopAseDeviceTypeGetParamsDeviceTypeDesktop, + cloudflare.RadarHTTPTopAseDeviceTypeGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopAseDeviceTypeGetParamsBotClass{cloudflare.RadarHTTPTopAseDeviceTypeGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseDeviceTypeGetParamsDateRange{cloudflare.RadarHTTPTopAseDeviceTypeGetParamsDateRange1d, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsDateRange2d, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseDeviceTypeGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocol{cloudflare.RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseDeviceTypeGetParamsHTTPVersion{cloudflare.RadarHTTPTopAseDeviceTypeGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseDeviceTypeGetParamsIPVersion{cloudflare.RadarHTTPTopAseDeviceTypeGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopAseDeviceTypeGetParamsO{cloudflare.RadarHTTPTopAseDeviceTypeGetParamsOWindows, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsOMacosx, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseDeviceTypeGetParamsTlsVersion{cloudflare.RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopAseDeviceTypeGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptopasehttpprotocol.go b/radarhttptopasehttpprotocol.go new file mode 100644 index 00000000000..2642d066c5b --- /dev/null +++ b/radarhttptopasehttpprotocol.go @@ -0,0 +1,323 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseHTTPProtocolService 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 +// [NewRadarHTTPTopAseHTTPProtocolService] method instead. +type RadarHTTPTopAseHTTPProtocolService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopAseHTTPProtocolService 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 NewRadarHTTPTopAseHTTPProtocolService(opts ...option.RequestOption) (r *RadarHTTPTopAseHTTPProtocolService) { + r = &RadarHTTPTopAseHTTPProtocolService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by HTTP traffic, of the requested HTTP +// protocol. Values are a percentage out of the total traffic. +func (r *RadarHTTPTopAseHTTPProtocolService) Get(ctx context.Context, httpProtocol RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocol, query RadarHTTPTopAseHTTPProtocolGetParams, opts ...option.RequestOption) (res *RadarHTTPTopAseHTTPProtocolGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/ases/http_protocol/%v", httpProtocol) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseHTTPProtocolGetResponse struct { + Result RadarHTTPTopAseHTTPProtocolGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseHTTPProtocolGetResponseJSON `json:"-"` +} + +// radarHTTPTopAseHTTPProtocolGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseHTTPProtocolGetResponse] +type radarHTTPTopAseHTTPProtocolGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPProtocolGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPProtocolGetResponseResult struct { + Meta RadarHTTPTopAseHTTPProtocolGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseHTTPProtocolGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseHTTPProtocolGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseHTTPProtocolGetResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPTopAseHTTPProtocolGetResponseResult] +type radarHTTPTopAseHTTPProtocolGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPProtocolGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPProtocolGetResponseResultMeta struct { + DateRange []RadarHTTPTopAseHTTPProtocolGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseHTTPProtocolGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseHTTPProtocolGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPTopAseHTTPProtocolGetResponseResultMeta] +type radarHTTPTopAseHTTPProtocolGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPProtocolGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPProtocolGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseHTTPProtocolGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseHTTPProtocolGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopAseHTTPProtocolGetResponseResultMetaDateRange] +type radarHTTPTopAseHTTPProtocolGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPProtocolGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfo] +type radarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPProtocolGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseHTTPProtocolGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseHTTPProtocolGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarHTTPTopAseHTTPProtocolGetResponseResultTop0] +type radarHTTPTopAseHTTPProtocolGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPProtocolGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPProtocolGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopAseHTTPProtocolGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseHTTPProtocolGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopAseHTTPProtocolGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseHTTPProtocolGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopAseHTTPProtocolGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopAseHTTPProtocolGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopAseHTTPProtocolGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseHTTPProtocolGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// HTTP Protocol. +type RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocol string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocolHTTP RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocolHTTPs RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseHTTPProtocolGetParamsBotClass string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsBotClassLikelyAutomated RadarHTTPTopAseHTTPProtocolGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseHTTPProtocolGetParamsBotClassLikelyHuman RadarHTTPTopAseHTTPProtocolGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseHTTPProtocolGetParamsDateRange string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsDateRange1d RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "1d" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange2d RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "2d" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange7d RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "7d" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange14d RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "14d" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange28d RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "28d" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange12w RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "12w" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange24w RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "24w" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange52w RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "52w" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange1dControl RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "1dControl" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange2dControl RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "2dControl" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange7dControl RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "7dControl" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange14dControl RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "14dControl" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange28dControl RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "28dControl" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange12wControl RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "12wControl" + RadarHTTPTopAseHTTPProtocolGetParamsDateRange24wControl RadarHTTPTopAseHTTPProtocolGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopAseHTTPProtocolGetParamsDeviceType string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsDeviceTypeDesktop RadarHTTPTopAseHTTPProtocolGetParamsDeviceType = "DESKTOP" + RadarHTTPTopAseHTTPProtocolGetParamsDeviceTypeMobile RadarHTTPTopAseHTTPProtocolGetParamsDeviceType = "MOBILE" + RadarHTTPTopAseHTTPProtocolGetParamsDeviceTypeOther RadarHTTPTopAseHTTPProtocolGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopAseHTTPProtocolGetParamsFormat string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsFormatJson RadarHTTPTopAseHTTPProtocolGetParamsFormat = "JSON" + RadarHTTPTopAseHTTPProtocolGetParamsFormatCsv RadarHTTPTopAseHTTPProtocolGetParamsFormat = "CSV" +) + +type RadarHTTPTopAseHTTPProtocolGetParamsIPVersion string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsIPVersionIPv4 RadarHTTPTopAseHTTPProtocolGetParamsIPVersion = "IPv4" + RadarHTTPTopAseHTTPProtocolGetParamsIPVersionIPv6 RadarHTTPTopAseHTTPProtocolGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseHTTPProtocolGetParamsO string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsOWindows RadarHTTPTopAseHTTPProtocolGetParamsO = "WINDOWS" + RadarHTTPTopAseHTTPProtocolGetParamsOMacosx RadarHTTPTopAseHTTPProtocolGetParamsO = "MACOSX" + RadarHTTPTopAseHTTPProtocolGetParamsOIos RadarHTTPTopAseHTTPProtocolGetParamsO = "IOS" + RadarHTTPTopAseHTTPProtocolGetParamsOAndroid RadarHTTPTopAseHTTPProtocolGetParamsO = "ANDROID" + RadarHTTPTopAseHTTPProtocolGetParamsOChromeos RadarHTTPTopAseHTTPProtocolGetParamsO = "CHROMEOS" + RadarHTTPTopAseHTTPProtocolGetParamsOLinux RadarHTTPTopAseHTTPProtocolGetParamsO = "LINUX" + RadarHTTPTopAseHTTPProtocolGetParamsOSmartTv RadarHTTPTopAseHTTPProtocolGetParamsO = "SMART_TV" +) + +type RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion string + +const ( + RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSv1_0 RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSv1_1 RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSv1_2 RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSv1_3 RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSvQuic RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopasehttpprotocol_test.go b/radarhttptopasehttpprotocol_test.go new file mode 100644 index 00000000000..e88b4be892e --- /dev/null +++ b/radarhttptopasehttpprotocol_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseHTTPProtocolGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.HTTPProtocols.Get( + context.TODO(), + cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocolHTTP, + cloudflare.RadarHTTPTopAseHTTPProtocolGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsBotClass{cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDateRange{cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDateRange1d, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDateRange2d, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDeviceType{cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocol{cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsHTTPProtocolHTTPs}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsIPVersion{cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsO{cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsOWindows, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsOMacosx, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsTlsVersion{cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopAseHTTPProtocolGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptopasehttpversion.go b/radarhttptopasehttpversion.go new file mode 100644 index 00000000000..adc902d68d6 --- /dev/null +++ b/radarhttptopasehttpversion.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseHTTPVersionService 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 +// [NewRadarHTTPTopAseHTTPVersionService] method instead. +type RadarHTTPTopAseHTTPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopAseHTTPVersionService 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 NewRadarHTTPTopAseHTTPVersionService(opts ...option.RequestOption) (r *RadarHTTPTopAseHTTPVersionService) { + r = &RadarHTTPTopAseHTTPVersionService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by HTTP traffic, of the requested HTTP +// protocol version. Values are a percentage out of the total traffic. +func (r *RadarHTTPTopAseHTTPVersionService) Get(ctx context.Context, httpVersion RadarHTTPTopAseHTTPVersionGetParamsHTTPVersion, query RadarHTTPTopAseHTTPVersionGetParams, opts ...option.RequestOption) (res *RadarHTTPTopAseHTTPVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/ases/http_version/%v", httpVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseHTTPVersionGetResponse struct { + Result RadarHTTPTopAseHTTPVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseHTTPVersionGetResponseJSON `json:"-"` +} + +// radarHTTPTopAseHTTPVersionGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseHTTPVersionGetResponse] +type radarHTTPTopAseHTTPVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPVersionGetResponseResult struct { + Meta RadarHTTPTopAseHTTPVersionGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseHTTPVersionGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseHTTPVersionGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseHTTPVersionGetResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPTopAseHTTPVersionGetResponseResult] +type radarHTTPTopAseHTTPVersionGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPVersionGetResponseResultMeta struct { + DateRange []RadarHTTPTopAseHTTPVersionGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseHTTPVersionGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseHTTPVersionGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPTopAseHTTPVersionGetResponseResultMeta] +type radarHTTPTopAseHTTPVersionGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPVersionGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPVersionGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseHTTPVersionGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseHTTPVersionGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopAseHTTPVersionGetResponseResultMetaDateRange] +type radarHTTPTopAseHTTPVersionGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPVersionGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfo] +type radarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPVersionGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseHTTPVersionGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseHTTPVersionGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarHTTPTopAseHTTPVersionGetResponseResultTop0] +type radarHTTPTopAseHTTPVersionGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseHTTPVersionGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseHTTPVersionGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopAseHTTPVersionGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseHTTPVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopAseHTTPVersionGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseHTTPVersionGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopAseHTTPVersionGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopAseHTTPVersionGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopAseHTTPVersionGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopAseHTTPVersionGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseHTTPVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// HTTP version. +type RadarHTTPTopAseHTTPVersionGetParamsHTTPVersion string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsHTTPVersionHttPv1 RadarHTTPTopAseHTTPVersionGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopAseHTTPVersionGetParamsHTTPVersionHttPv2 RadarHTTPTopAseHTTPVersionGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopAseHTTPVersionGetParamsHTTPVersionHttPv3 RadarHTTPTopAseHTTPVersionGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopAseHTTPVersionGetParamsBotClass string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsBotClassLikelyAutomated RadarHTTPTopAseHTTPVersionGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseHTTPVersionGetParamsBotClassLikelyHuman RadarHTTPTopAseHTTPVersionGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseHTTPVersionGetParamsDateRange string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsDateRange1d RadarHTTPTopAseHTTPVersionGetParamsDateRange = "1d" + RadarHTTPTopAseHTTPVersionGetParamsDateRange2d RadarHTTPTopAseHTTPVersionGetParamsDateRange = "2d" + RadarHTTPTopAseHTTPVersionGetParamsDateRange7d RadarHTTPTopAseHTTPVersionGetParamsDateRange = "7d" + RadarHTTPTopAseHTTPVersionGetParamsDateRange14d RadarHTTPTopAseHTTPVersionGetParamsDateRange = "14d" + RadarHTTPTopAseHTTPVersionGetParamsDateRange28d RadarHTTPTopAseHTTPVersionGetParamsDateRange = "28d" + RadarHTTPTopAseHTTPVersionGetParamsDateRange12w RadarHTTPTopAseHTTPVersionGetParamsDateRange = "12w" + RadarHTTPTopAseHTTPVersionGetParamsDateRange24w RadarHTTPTopAseHTTPVersionGetParamsDateRange = "24w" + RadarHTTPTopAseHTTPVersionGetParamsDateRange52w RadarHTTPTopAseHTTPVersionGetParamsDateRange = "52w" + RadarHTTPTopAseHTTPVersionGetParamsDateRange1dControl RadarHTTPTopAseHTTPVersionGetParamsDateRange = "1dControl" + RadarHTTPTopAseHTTPVersionGetParamsDateRange2dControl RadarHTTPTopAseHTTPVersionGetParamsDateRange = "2dControl" + RadarHTTPTopAseHTTPVersionGetParamsDateRange7dControl RadarHTTPTopAseHTTPVersionGetParamsDateRange = "7dControl" + RadarHTTPTopAseHTTPVersionGetParamsDateRange14dControl RadarHTTPTopAseHTTPVersionGetParamsDateRange = "14dControl" + RadarHTTPTopAseHTTPVersionGetParamsDateRange28dControl RadarHTTPTopAseHTTPVersionGetParamsDateRange = "28dControl" + RadarHTTPTopAseHTTPVersionGetParamsDateRange12wControl RadarHTTPTopAseHTTPVersionGetParamsDateRange = "12wControl" + RadarHTTPTopAseHTTPVersionGetParamsDateRange24wControl RadarHTTPTopAseHTTPVersionGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopAseHTTPVersionGetParamsDeviceType string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsDeviceTypeDesktop RadarHTTPTopAseHTTPVersionGetParamsDeviceType = "DESKTOP" + RadarHTTPTopAseHTTPVersionGetParamsDeviceTypeMobile RadarHTTPTopAseHTTPVersionGetParamsDeviceType = "MOBILE" + RadarHTTPTopAseHTTPVersionGetParamsDeviceTypeOther RadarHTTPTopAseHTTPVersionGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopAseHTTPVersionGetParamsFormat string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsFormatJson RadarHTTPTopAseHTTPVersionGetParamsFormat = "JSON" + RadarHTTPTopAseHTTPVersionGetParamsFormatCsv RadarHTTPTopAseHTTPVersionGetParamsFormat = "CSV" +) + +type RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocol string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocolHTTP RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocolHTTPs RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseHTTPVersionGetParamsIPVersion string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsIPVersionIPv4 RadarHTTPTopAseHTTPVersionGetParamsIPVersion = "IPv4" + RadarHTTPTopAseHTTPVersionGetParamsIPVersionIPv6 RadarHTTPTopAseHTTPVersionGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseHTTPVersionGetParamsO string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsOWindows RadarHTTPTopAseHTTPVersionGetParamsO = "WINDOWS" + RadarHTTPTopAseHTTPVersionGetParamsOMacosx RadarHTTPTopAseHTTPVersionGetParamsO = "MACOSX" + RadarHTTPTopAseHTTPVersionGetParamsOIos RadarHTTPTopAseHTTPVersionGetParamsO = "IOS" + RadarHTTPTopAseHTTPVersionGetParamsOAndroid RadarHTTPTopAseHTTPVersionGetParamsO = "ANDROID" + RadarHTTPTopAseHTTPVersionGetParamsOChromeos RadarHTTPTopAseHTTPVersionGetParamsO = "CHROMEOS" + RadarHTTPTopAseHTTPVersionGetParamsOLinux RadarHTTPTopAseHTTPVersionGetParamsO = "LINUX" + RadarHTTPTopAseHTTPVersionGetParamsOSmartTv RadarHTTPTopAseHTTPVersionGetParamsO = "SMART_TV" +) + +type RadarHTTPTopAseHTTPVersionGetParamsTlsVersion string + +const ( + RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSv1_0 RadarHTTPTopAseHTTPVersionGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSv1_1 RadarHTTPTopAseHTTPVersionGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSv1_2 RadarHTTPTopAseHTTPVersionGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSv1_3 RadarHTTPTopAseHTTPVersionGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSvQuic RadarHTTPTopAseHTTPVersionGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopasehttpversion_test.go b/radarhttptopasehttpversion_test.go new file mode 100644 index 00000000000..9f2de396c3c --- /dev/null +++ b/radarhttptopasehttpversion_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseHTTPVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.HTTPVersions.Get( + context.TODO(), + cloudflare.RadarHTTPTopAseHTTPVersionGetParamsHTTPVersionHttPv1, + cloudflare.RadarHTTPTopAseHTTPVersionGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPVersionGetParamsBotClass{cloudflare.RadarHTTPTopAseHTTPVersionGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDateRange{cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDateRange1d, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDateRange2d, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDeviceType{cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseHTTPVersionGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocol{cloudflare.RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsHTTPProtocolHTTPs}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPVersionGetParamsIPVersion{cloudflare.RadarHTTPTopAseHTTPVersionGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPVersionGetParamsO{cloudflare.RadarHTTPTopAseHTTPVersionGetParamsOWindows, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsOMacosx, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseHTTPVersionGetParamsTlsVersion{cloudflare.RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopAseHTTPVersionGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptopaseipversion.go b/radarhttptopaseipversion.go new file mode 100644 index 00000000000..71746120e11 --- /dev/null +++ b/radarhttptopaseipversion.go @@ -0,0 +1,330 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseIPVersionService 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 +// [NewRadarHTTPTopAseIPVersionService] method instead. +type RadarHTTPTopAseIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopAseIPVersionService 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 NewRadarHTTPTopAseIPVersionService(opts ...option.RequestOption) (r *RadarHTTPTopAseIPVersionService) { + r = &RadarHTTPTopAseIPVersionService{} + r.Options = opts + return +} + +// Get the top autonomous systems, by HTTP traffic, of the requested IP protocol +// version. Values are a percentage out of the total traffic. +func (r *RadarHTTPTopAseIPVersionService) Get(ctx context.Context, ipVersion RadarHTTPTopAseIPVersionGetParamsIPVersion, query RadarHTTPTopAseIPVersionGetParams, opts ...option.RequestOption) (res *RadarHTTPTopAseIPVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/ases/ip_version/%v", ipVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseIPVersionGetResponse struct { + Result RadarHTTPTopAseIPVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseIPVersionGetResponseJSON `json:"-"` +} + +// radarHTTPTopAseIPVersionGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseIPVersionGetResponse] +type radarHTTPTopAseIPVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseIPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseIPVersionGetResponseResult struct { + Meta RadarHTTPTopAseIPVersionGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseIPVersionGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseIPVersionGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseIPVersionGetResponseResultJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseIPVersionGetResponseResult] +type radarHTTPTopAseIPVersionGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseIPVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseIPVersionGetResponseResultMeta struct { + DateRange []RadarHTTPTopAseIPVersionGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseIPVersionGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseIPVersionGetResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarHTTPTopAseIPVersionGetResponseResultMeta] +type radarHTTPTopAseIPVersionGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseIPVersionGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseIPVersionGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseIPVersionGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseIPVersionGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarHTTPTopAseIPVersionGetResponseResultMetaDateRange] +type radarHTTPTopAseIPVersionGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseIPVersionGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfo] +type radarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseIPVersionGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseIPVersionGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseIPVersionGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseIPVersionGetResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarHTTPTopAseIPVersionGetResponseResultTop0] +type radarHTTPTopAseIPVersionGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseIPVersionGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseIPVersionGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopAseIPVersionGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseIPVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopAseIPVersionGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseIPVersionGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseIPVersionGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopAseIPVersionGetParamsHTTPVersion] `query:"httpVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopAseIPVersionGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopAseIPVersionGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopAseIPVersionGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseIPVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// IP version. +type RadarHTTPTopAseIPVersionGetParamsIPVersion string + +const ( + RadarHTTPTopAseIPVersionGetParamsIPVersionIPv4 RadarHTTPTopAseIPVersionGetParamsIPVersion = "IPv4" + RadarHTTPTopAseIPVersionGetParamsIPVersionIPv6 RadarHTTPTopAseIPVersionGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseIPVersionGetParamsBotClass string + +const ( + RadarHTTPTopAseIPVersionGetParamsBotClassLikelyAutomated RadarHTTPTopAseIPVersionGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseIPVersionGetParamsBotClassLikelyHuman RadarHTTPTopAseIPVersionGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseIPVersionGetParamsDateRange string + +const ( + RadarHTTPTopAseIPVersionGetParamsDateRange1d RadarHTTPTopAseIPVersionGetParamsDateRange = "1d" + RadarHTTPTopAseIPVersionGetParamsDateRange2d RadarHTTPTopAseIPVersionGetParamsDateRange = "2d" + RadarHTTPTopAseIPVersionGetParamsDateRange7d RadarHTTPTopAseIPVersionGetParamsDateRange = "7d" + RadarHTTPTopAseIPVersionGetParamsDateRange14d RadarHTTPTopAseIPVersionGetParamsDateRange = "14d" + RadarHTTPTopAseIPVersionGetParamsDateRange28d RadarHTTPTopAseIPVersionGetParamsDateRange = "28d" + RadarHTTPTopAseIPVersionGetParamsDateRange12w RadarHTTPTopAseIPVersionGetParamsDateRange = "12w" + RadarHTTPTopAseIPVersionGetParamsDateRange24w RadarHTTPTopAseIPVersionGetParamsDateRange = "24w" + RadarHTTPTopAseIPVersionGetParamsDateRange52w RadarHTTPTopAseIPVersionGetParamsDateRange = "52w" + RadarHTTPTopAseIPVersionGetParamsDateRange1dControl RadarHTTPTopAseIPVersionGetParamsDateRange = "1dControl" + RadarHTTPTopAseIPVersionGetParamsDateRange2dControl RadarHTTPTopAseIPVersionGetParamsDateRange = "2dControl" + RadarHTTPTopAseIPVersionGetParamsDateRange7dControl RadarHTTPTopAseIPVersionGetParamsDateRange = "7dControl" + RadarHTTPTopAseIPVersionGetParamsDateRange14dControl RadarHTTPTopAseIPVersionGetParamsDateRange = "14dControl" + RadarHTTPTopAseIPVersionGetParamsDateRange28dControl RadarHTTPTopAseIPVersionGetParamsDateRange = "28dControl" + RadarHTTPTopAseIPVersionGetParamsDateRange12wControl RadarHTTPTopAseIPVersionGetParamsDateRange = "12wControl" + RadarHTTPTopAseIPVersionGetParamsDateRange24wControl RadarHTTPTopAseIPVersionGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopAseIPVersionGetParamsDeviceType string + +const ( + RadarHTTPTopAseIPVersionGetParamsDeviceTypeDesktop RadarHTTPTopAseIPVersionGetParamsDeviceType = "DESKTOP" + RadarHTTPTopAseIPVersionGetParamsDeviceTypeMobile RadarHTTPTopAseIPVersionGetParamsDeviceType = "MOBILE" + RadarHTTPTopAseIPVersionGetParamsDeviceTypeOther RadarHTTPTopAseIPVersionGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopAseIPVersionGetParamsFormat string + +const ( + RadarHTTPTopAseIPVersionGetParamsFormatJson RadarHTTPTopAseIPVersionGetParamsFormat = "JSON" + RadarHTTPTopAseIPVersionGetParamsFormatCsv RadarHTTPTopAseIPVersionGetParamsFormat = "CSV" +) + +type RadarHTTPTopAseIPVersionGetParamsHTTPProtocol string + +const ( + RadarHTTPTopAseIPVersionGetParamsHTTPProtocolHTTP RadarHTTPTopAseIPVersionGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseIPVersionGetParamsHTTPProtocolHTTPs RadarHTTPTopAseIPVersionGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseIPVersionGetParamsHTTPVersion string + +const ( + RadarHTTPTopAseIPVersionGetParamsHTTPVersionHttPv1 RadarHTTPTopAseIPVersionGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopAseIPVersionGetParamsHTTPVersionHttPv2 RadarHTTPTopAseIPVersionGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopAseIPVersionGetParamsHTTPVersionHttPv3 RadarHTTPTopAseIPVersionGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopAseIPVersionGetParamsO string + +const ( + RadarHTTPTopAseIPVersionGetParamsOWindows RadarHTTPTopAseIPVersionGetParamsO = "WINDOWS" + RadarHTTPTopAseIPVersionGetParamsOMacosx RadarHTTPTopAseIPVersionGetParamsO = "MACOSX" + RadarHTTPTopAseIPVersionGetParamsOIos RadarHTTPTopAseIPVersionGetParamsO = "IOS" + RadarHTTPTopAseIPVersionGetParamsOAndroid RadarHTTPTopAseIPVersionGetParamsO = "ANDROID" + RadarHTTPTopAseIPVersionGetParamsOChromeos RadarHTTPTopAseIPVersionGetParamsO = "CHROMEOS" + RadarHTTPTopAseIPVersionGetParamsOLinux RadarHTTPTopAseIPVersionGetParamsO = "LINUX" + RadarHTTPTopAseIPVersionGetParamsOSmartTv RadarHTTPTopAseIPVersionGetParamsO = "SMART_TV" +) + +type RadarHTTPTopAseIPVersionGetParamsTlsVersion string + +const ( + RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSv1_0 RadarHTTPTopAseIPVersionGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSv1_1 RadarHTTPTopAseIPVersionGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSv1_2 RadarHTTPTopAseIPVersionGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSv1_3 RadarHTTPTopAseIPVersionGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSvQuic RadarHTTPTopAseIPVersionGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopaseipversion_test.go b/radarhttptopaseipversion_test.go new file mode 100644 index 00000000000..65c62d99afd --- /dev/null +++ b/radarhttptopaseipversion_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseIPVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.IPVersions.Get( + context.TODO(), + cloudflare.RadarHTTPTopAseIPVersionGetParamsIPVersionIPv4, + cloudflare.RadarHTTPTopAseIPVersionGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopAseIPVersionGetParamsBotClass{cloudflare.RadarHTTPTopAseIPVersionGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopAseIPVersionGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseIPVersionGetParamsDateRange{cloudflare.RadarHTTPTopAseIPVersionGetParamsDateRange1d, cloudflare.RadarHTTPTopAseIPVersionGetParamsDateRange2d, cloudflare.RadarHTTPTopAseIPVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopAseIPVersionGetParamsDeviceType{cloudflare.RadarHTTPTopAseIPVersionGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopAseIPVersionGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopAseIPVersionGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseIPVersionGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseIPVersionGetParamsHTTPProtocol{cloudflare.RadarHTTPTopAseIPVersionGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseIPVersionGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseIPVersionGetParamsHTTPVersion{cloudflare.RadarHTTPTopAseIPVersionGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopAseIPVersionGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopAseIPVersionGetParamsHTTPVersionHttPv3}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopAseIPVersionGetParamsO{cloudflare.RadarHTTPTopAseIPVersionGetParamsOWindows, cloudflare.RadarHTTPTopAseIPVersionGetParamsOMacosx, cloudflare.RadarHTTPTopAseIPVersionGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseIPVersionGetParamsTlsVersion{cloudflare.RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopAseIPVersionGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptopaseo.go b/radarhttptopaseo.go new file mode 100644 index 00000000000..0a75188f7d7 --- /dev/null +++ b/radarhttptopaseo.go @@ -0,0 +1,329 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseOService 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 [NewRadarHTTPTopAseOService] method +// instead. +type RadarHTTPTopAseOService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopAseOService 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 NewRadarHTTPTopAseOService(opts ...option.RequestOption) (r *RadarHTTPTopAseOService) { + r = &RadarHTTPTopAseOService{} + r.Options = opts + return +} + +// Get the top autonomous systems, by HTTP traffic, of the requested operating +// systems. Values are a percentage out of the total traffic. +func (r *RadarHTTPTopAseOService) Get(ctx context.Context, os RadarHTTPTopAseOGetParamsOs, query RadarHTTPTopAseOGetParams, opts ...option.RequestOption) (res *RadarHTTPTopAseOGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/ases/os/%v", os) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseOGetResponse struct { + Result RadarHTTPTopAseOGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseOGetResponseJSON `json:"-"` +} + +// radarHTTPTopAseOGetResponseJSON contains the JSON metadata for the struct +// [RadarHTTPTopAseOGetResponse] +type radarHTTPTopAseOGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseOGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseOGetResponseResult struct { + Meta RadarHTTPTopAseOGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseOGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseOGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseOGetResponseResultJSON contains the JSON metadata for the struct +// [RadarHTTPTopAseOGetResponseResult] +type radarHTTPTopAseOGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseOGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseOGetResponseResultMeta struct { + DateRange []RadarHTTPTopAseOGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseOGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseOGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseOGetResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseOGetResponseResultMeta] +type radarHTTPTopAseOGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseOGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseOGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseOGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseOGetResponseResultMetaDateRangeJSON contains the JSON metadata +// for the struct [RadarHTTPTopAseOGetResponseResultMetaDateRange] +type radarHTTPTopAseOGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseOGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseOGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseOGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseOGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseOGetResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct [RadarHTTPTopAseOGetResponseResultMetaConfidenceInfo] +type radarHTTPTopAseOGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseOGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseOGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseOGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseOGetResponseResultMetaConfidenceInfoAnnotationJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopAseOGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseOGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseOGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseOGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseOGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseOGetResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarHTTPTopAseOGetResponseResultTop0] +type radarHTTPTopAseOGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseOGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseOGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopAseOGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseOGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopAseOGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseOGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseOGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopAseOGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopAseOGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopAseOGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopAseOGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseOGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// IP version. +type RadarHTTPTopAseOGetParamsOs string + +const ( + RadarHTTPTopAseOGetParamsOsWindows RadarHTTPTopAseOGetParamsOs = "WINDOWS" + RadarHTTPTopAseOGetParamsOsMacosx RadarHTTPTopAseOGetParamsOs = "MACOSX" + RadarHTTPTopAseOGetParamsOsIos RadarHTTPTopAseOGetParamsOs = "IOS" + RadarHTTPTopAseOGetParamsOsAndroid RadarHTTPTopAseOGetParamsOs = "ANDROID" + RadarHTTPTopAseOGetParamsOsChromeos RadarHTTPTopAseOGetParamsOs = "CHROMEOS" + RadarHTTPTopAseOGetParamsOsLinux RadarHTTPTopAseOGetParamsOs = "LINUX" + RadarHTTPTopAseOGetParamsOsSmartTv RadarHTTPTopAseOGetParamsOs = "SMART_TV" +) + +type RadarHTTPTopAseOGetParamsBotClass string + +const ( + RadarHTTPTopAseOGetParamsBotClassLikelyAutomated RadarHTTPTopAseOGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseOGetParamsBotClassLikelyHuman RadarHTTPTopAseOGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseOGetParamsDateRange string + +const ( + RadarHTTPTopAseOGetParamsDateRange1d RadarHTTPTopAseOGetParamsDateRange = "1d" + RadarHTTPTopAseOGetParamsDateRange2d RadarHTTPTopAseOGetParamsDateRange = "2d" + RadarHTTPTopAseOGetParamsDateRange7d RadarHTTPTopAseOGetParamsDateRange = "7d" + RadarHTTPTopAseOGetParamsDateRange14d RadarHTTPTopAseOGetParamsDateRange = "14d" + RadarHTTPTopAseOGetParamsDateRange28d RadarHTTPTopAseOGetParamsDateRange = "28d" + RadarHTTPTopAseOGetParamsDateRange12w RadarHTTPTopAseOGetParamsDateRange = "12w" + RadarHTTPTopAseOGetParamsDateRange24w RadarHTTPTopAseOGetParamsDateRange = "24w" + RadarHTTPTopAseOGetParamsDateRange52w RadarHTTPTopAseOGetParamsDateRange = "52w" + RadarHTTPTopAseOGetParamsDateRange1dControl RadarHTTPTopAseOGetParamsDateRange = "1dControl" + RadarHTTPTopAseOGetParamsDateRange2dControl RadarHTTPTopAseOGetParamsDateRange = "2dControl" + RadarHTTPTopAseOGetParamsDateRange7dControl RadarHTTPTopAseOGetParamsDateRange = "7dControl" + RadarHTTPTopAseOGetParamsDateRange14dControl RadarHTTPTopAseOGetParamsDateRange = "14dControl" + RadarHTTPTopAseOGetParamsDateRange28dControl RadarHTTPTopAseOGetParamsDateRange = "28dControl" + RadarHTTPTopAseOGetParamsDateRange12wControl RadarHTTPTopAseOGetParamsDateRange = "12wControl" + RadarHTTPTopAseOGetParamsDateRange24wControl RadarHTTPTopAseOGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopAseOGetParamsDeviceType string + +const ( + RadarHTTPTopAseOGetParamsDeviceTypeDesktop RadarHTTPTopAseOGetParamsDeviceType = "DESKTOP" + RadarHTTPTopAseOGetParamsDeviceTypeMobile RadarHTTPTopAseOGetParamsDeviceType = "MOBILE" + RadarHTTPTopAseOGetParamsDeviceTypeOther RadarHTTPTopAseOGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopAseOGetParamsFormat string + +const ( + RadarHTTPTopAseOGetParamsFormatJson RadarHTTPTopAseOGetParamsFormat = "JSON" + RadarHTTPTopAseOGetParamsFormatCsv RadarHTTPTopAseOGetParamsFormat = "CSV" +) + +type RadarHTTPTopAseOGetParamsHTTPProtocol string + +const ( + RadarHTTPTopAseOGetParamsHTTPProtocolHTTP RadarHTTPTopAseOGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseOGetParamsHTTPProtocolHTTPs RadarHTTPTopAseOGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseOGetParamsHTTPVersion string + +const ( + RadarHTTPTopAseOGetParamsHTTPVersionHttPv1 RadarHTTPTopAseOGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopAseOGetParamsHTTPVersionHttPv2 RadarHTTPTopAseOGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopAseOGetParamsHTTPVersionHttPv3 RadarHTTPTopAseOGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopAseOGetParamsIPVersion string + +const ( + RadarHTTPTopAseOGetParamsIPVersionIPv4 RadarHTTPTopAseOGetParamsIPVersion = "IPv4" + RadarHTTPTopAseOGetParamsIPVersionIPv6 RadarHTTPTopAseOGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseOGetParamsTlsVersion string + +const ( + RadarHTTPTopAseOGetParamsTlsVersionTlSv1_0 RadarHTTPTopAseOGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseOGetParamsTlsVersionTlSv1_1 RadarHTTPTopAseOGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseOGetParamsTlsVersionTlSv1_2 RadarHTTPTopAseOGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseOGetParamsTlsVersionTlSv1_3 RadarHTTPTopAseOGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseOGetParamsTlsVersionTlSvQuic RadarHTTPTopAseOGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopaseo_test.go b/radarhttptopaseo_test.go new file mode 100644 index 00000000000..3a35641e446 --- /dev/null +++ b/radarhttptopaseo_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseOGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.Os.Get( + context.TODO(), + cloudflare.RadarHTTPTopAseOGetParamsOsWindows, + cloudflare.RadarHTTPTopAseOGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopAseOGetParamsBotClass{cloudflare.RadarHTTPTopAseOGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopAseOGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseOGetParamsDateRange{cloudflare.RadarHTTPTopAseOGetParamsDateRange1d, cloudflare.RadarHTTPTopAseOGetParamsDateRange2d, cloudflare.RadarHTTPTopAseOGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopAseOGetParamsDeviceType{cloudflare.RadarHTTPTopAseOGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopAseOGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopAseOGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseOGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseOGetParamsHTTPProtocol{cloudflare.RadarHTTPTopAseOGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseOGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseOGetParamsHTTPVersion{cloudflare.RadarHTTPTopAseOGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopAseOGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopAseOGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseOGetParamsIPVersion{cloudflare.RadarHTTPTopAseOGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopAseOGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseOGetParamsTlsVersion{cloudflare.RadarHTTPTopAseOGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopAseOGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopAseOGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptopasetlsversion.go b/radarhttptopasetlsversion.go new file mode 100644 index 00000000000..10c51cbadf3 --- /dev/null +++ b/radarhttptopasetlsversion.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopAseTlsVersionService 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 +// [NewRadarHTTPTopAseTlsVersionService] method instead. +type RadarHTTPTopAseTlsVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopAseTlsVersionService 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 NewRadarHTTPTopAseTlsVersionService(opts ...option.RequestOption) (r *RadarHTTPTopAseTlsVersionService) { + r = &RadarHTTPTopAseTlsVersionService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS), by HTTP traffic, of the requested TLS +// protocol version. Values are a percentage out of the total traffic. +func (r *RadarHTTPTopAseTlsVersionService) Get(ctx context.Context, tlsVersion RadarHTTPTopAseTlsVersionGetParamsTlsVersion, query RadarHTTPTopAseTlsVersionGetParams, opts ...option.RequestOption) (res *RadarHTTPTopAseTlsVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/ases/tls_version/%v", tlsVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopAseTlsVersionGetResponse struct { + Result RadarHTTPTopAseTlsVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopAseTlsVersionGetResponseJSON `json:"-"` +} + +// radarHTTPTopAseTlsVersionGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopAseTlsVersionGetResponse] +type radarHTTPTopAseTlsVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseTlsVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseTlsVersionGetResponseResult struct { + Meta RadarHTTPTopAseTlsVersionGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopAseTlsVersionGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopAseTlsVersionGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopAseTlsVersionGetResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPTopAseTlsVersionGetResponseResult] +type radarHTTPTopAseTlsVersionGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseTlsVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseTlsVersionGetResponseResultMeta struct { + DateRange []RadarHTTPTopAseTlsVersionGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopAseTlsVersionGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopAseTlsVersionGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPTopAseTlsVersionGetResponseResultMeta] +type radarHTTPTopAseTlsVersionGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseTlsVersionGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseTlsVersionGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopAseTlsVersionGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopAseTlsVersionGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopAseTlsVersionGetResponseResultMetaDateRange] +type radarHTTPTopAseTlsVersionGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseTlsVersionGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfo] +type radarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseTlsVersionGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseTlsVersionGetResponseResultTop0 struct { + ClientASN int64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopAseTlsVersionGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopAseTlsVersionGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarHTTPTopAseTlsVersionGetResponseResultTop0] +type radarHTTPTopAseTlsVersionGetResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopAseTlsVersionGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopAseTlsVersionGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopAseTlsVersionGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopAseTlsVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopAseTlsVersionGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopAseTlsVersionGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopAseTlsVersionGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopAseTlsVersionGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopAseTlsVersionGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopAseTlsVersionGetParamsO] `query:"os"` +} + +// URLQuery serializes [RadarHTTPTopAseTlsVersionGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopAseTlsVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// TLS version. +type RadarHTTPTopAseTlsVersionGetParamsTlsVersion string + +const ( + RadarHTTPTopAseTlsVersionGetParamsTlsVersionTlSv1_0 RadarHTTPTopAseTlsVersionGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopAseTlsVersionGetParamsTlsVersionTlSv1_1 RadarHTTPTopAseTlsVersionGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopAseTlsVersionGetParamsTlsVersionTlSv1_2 RadarHTTPTopAseTlsVersionGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopAseTlsVersionGetParamsTlsVersionTlSv1_3 RadarHTTPTopAseTlsVersionGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopAseTlsVersionGetParamsTlsVersionTlSvQuic RadarHTTPTopAseTlsVersionGetParamsTlsVersion = "TLSvQUIC" +) + +type RadarHTTPTopAseTlsVersionGetParamsBotClass string + +const ( + RadarHTTPTopAseTlsVersionGetParamsBotClassLikelyAutomated RadarHTTPTopAseTlsVersionGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopAseTlsVersionGetParamsBotClassLikelyHuman RadarHTTPTopAseTlsVersionGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopAseTlsVersionGetParamsDateRange string + +const ( + RadarHTTPTopAseTlsVersionGetParamsDateRange1d RadarHTTPTopAseTlsVersionGetParamsDateRange = "1d" + RadarHTTPTopAseTlsVersionGetParamsDateRange2d RadarHTTPTopAseTlsVersionGetParamsDateRange = "2d" + RadarHTTPTopAseTlsVersionGetParamsDateRange7d RadarHTTPTopAseTlsVersionGetParamsDateRange = "7d" + RadarHTTPTopAseTlsVersionGetParamsDateRange14d RadarHTTPTopAseTlsVersionGetParamsDateRange = "14d" + RadarHTTPTopAseTlsVersionGetParamsDateRange28d RadarHTTPTopAseTlsVersionGetParamsDateRange = "28d" + RadarHTTPTopAseTlsVersionGetParamsDateRange12w RadarHTTPTopAseTlsVersionGetParamsDateRange = "12w" + RadarHTTPTopAseTlsVersionGetParamsDateRange24w RadarHTTPTopAseTlsVersionGetParamsDateRange = "24w" + RadarHTTPTopAseTlsVersionGetParamsDateRange52w RadarHTTPTopAseTlsVersionGetParamsDateRange = "52w" + RadarHTTPTopAseTlsVersionGetParamsDateRange1dControl RadarHTTPTopAseTlsVersionGetParamsDateRange = "1dControl" + RadarHTTPTopAseTlsVersionGetParamsDateRange2dControl RadarHTTPTopAseTlsVersionGetParamsDateRange = "2dControl" + RadarHTTPTopAseTlsVersionGetParamsDateRange7dControl RadarHTTPTopAseTlsVersionGetParamsDateRange = "7dControl" + RadarHTTPTopAseTlsVersionGetParamsDateRange14dControl RadarHTTPTopAseTlsVersionGetParamsDateRange = "14dControl" + RadarHTTPTopAseTlsVersionGetParamsDateRange28dControl RadarHTTPTopAseTlsVersionGetParamsDateRange = "28dControl" + RadarHTTPTopAseTlsVersionGetParamsDateRange12wControl RadarHTTPTopAseTlsVersionGetParamsDateRange = "12wControl" + RadarHTTPTopAseTlsVersionGetParamsDateRange24wControl RadarHTTPTopAseTlsVersionGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopAseTlsVersionGetParamsDeviceType string + +const ( + RadarHTTPTopAseTlsVersionGetParamsDeviceTypeDesktop RadarHTTPTopAseTlsVersionGetParamsDeviceType = "DESKTOP" + RadarHTTPTopAseTlsVersionGetParamsDeviceTypeMobile RadarHTTPTopAseTlsVersionGetParamsDeviceType = "MOBILE" + RadarHTTPTopAseTlsVersionGetParamsDeviceTypeOther RadarHTTPTopAseTlsVersionGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopAseTlsVersionGetParamsFormat string + +const ( + RadarHTTPTopAseTlsVersionGetParamsFormatJson RadarHTTPTopAseTlsVersionGetParamsFormat = "JSON" + RadarHTTPTopAseTlsVersionGetParamsFormatCsv RadarHTTPTopAseTlsVersionGetParamsFormat = "CSV" +) + +type RadarHTTPTopAseTlsVersionGetParamsHTTPProtocol string + +const ( + RadarHTTPTopAseTlsVersionGetParamsHTTPProtocolHTTP RadarHTTPTopAseTlsVersionGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopAseTlsVersionGetParamsHTTPProtocolHTTPs RadarHTTPTopAseTlsVersionGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopAseTlsVersionGetParamsHTTPVersion string + +const ( + RadarHTTPTopAseTlsVersionGetParamsHTTPVersionHttPv1 RadarHTTPTopAseTlsVersionGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopAseTlsVersionGetParamsHTTPVersionHttPv2 RadarHTTPTopAseTlsVersionGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopAseTlsVersionGetParamsHTTPVersionHttPv3 RadarHTTPTopAseTlsVersionGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopAseTlsVersionGetParamsIPVersion string + +const ( + RadarHTTPTopAseTlsVersionGetParamsIPVersionIPv4 RadarHTTPTopAseTlsVersionGetParamsIPVersion = "IPv4" + RadarHTTPTopAseTlsVersionGetParamsIPVersionIPv6 RadarHTTPTopAseTlsVersionGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopAseTlsVersionGetParamsO string + +const ( + RadarHTTPTopAseTlsVersionGetParamsOWindows RadarHTTPTopAseTlsVersionGetParamsO = "WINDOWS" + RadarHTTPTopAseTlsVersionGetParamsOMacosx RadarHTTPTopAseTlsVersionGetParamsO = "MACOSX" + RadarHTTPTopAseTlsVersionGetParamsOIos RadarHTTPTopAseTlsVersionGetParamsO = "IOS" + RadarHTTPTopAseTlsVersionGetParamsOAndroid RadarHTTPTopAseTlsVersionGetParamsO = "ANDROID" + RadarHTTPTopAseTlsVersionGetParamsOChromeos RadarHTTPTopAseTlsVersionGetParamsO = "CHROMEOS" + RadarHTTPTopAseTlsVersionGetParamsOLinux RadarHTTPTopAseTlsVersionGetParamsO = "LINUX" + RadarHTTPTopAseTlsVersionGetParamsOSmartTv RadarHTTPTopAseTlsVersionGetParamsO = "SMART_TV" +) diff --git a/radarhttptopasetlsversion_test.go b/radarhttptopasetlsversion_test.go new file mode 100644 index 00000000000..e8fbb945a08 --- /dev/null +++ b/radarhttptopasetlsversion_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopAseTlsVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Ases.TlsVersions.Get( + context.TODO(), + cloudflare.RadarHTTPTopAseTlsVersionGetParamsTlsVersionTlSv1_0, + cloudflare.RadarHTTPTopAseTlsVersionGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopAseTlsVersionGetParamsBotClass{cloudflare.RadarHTTPTopAseTlsVersionGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopAseTlsVersionGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopAseTlsVersionGetParamsDateRange{cloudflare.RadarHTTPTopAseTlsVersionGetParamsDateRange1d, cloudflare.RadarHTTPTopAseTlsVersionGetParamsDateRange2d, cloudflare.RadarHTTPTopAseTlsVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopAseTlsVersionGetParamsDeviceType{cloudflare.RadarHTTPTopAseTlsVersionGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopAseTlsVersionGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopAseTlsVersionGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopAseTlsVersionGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopAseTlsVersionGetParamsHTTPProtocol{cloudflare.RadarHTTPTopAseTlsVersionGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopAseTlsVersionGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseTlsVersionGetParamsHTTPVersion{cloudflare.RadarHTTPTopAseTlsVersionGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopAseTlsVersionGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopAseTlsVersionGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopAseTlsVersionGetParamsIPVersion{cloudflare.RadarHTTPTopAseTlsVersionGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopAseTlsVersionGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopAseTlsVersionGetParamsO{cloudflare.RadarHTTPTopAseTlsVersionGetParamsOWindows, cloudflare.RadarHTTPTopAseTlsVersionGetParamsOMacosx, cloudflare.RadarHTTPTopAseTlsVersionGetParamsOIos}), + }, + ) + 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/radarhttptopbrowser.go b/radarhttptopbrowser.go new file mode 100644 index 00000000000..68437c70eb1 --- /dev/null +++ b/radarhttptopbrowser.go @@ -0,0 +1,328 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopBrowserService 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 [NewRadarHTTPTopBrowserService] +// method instead. +type RadarHTTPTopBrowserService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopBrowserService 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 NewRadarHTTPTopBrowserService(opts ...option.RequestOption) (r *RadarHTTPTopBrowserService) { + r = &RadarHTTPTopBrowserService{} + r.Options = opts + return +} + +// Get the top user agents by HTTP traffic. Values are a percentage out of the +// total traffic. +func (r *RadarHTTPTopBrowserService) List(ctx context.Context, query RadarHTTPTopBrowserListParams, opts ...option.RequestOption) (res *RadarHTTPTopBrowserListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/top/browsers" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopBrowserListResponse struct { + Result RadarHTTPTopBrowserListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopBrowserListResponseJSON `json:"-"` +} + +// radarHTTPTopBrowserListResponseJSON contains the JSON metadata for the struct +// [RadarHTTPTopBrowserListResponse] +type radarHTTPTopBrowserListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserListResponseResult struct { + Meta RadarHTTPTopBrowserListResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopBrowserListResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopBrowserListResponseResultJSON `json:"-"` +} + +// radarHTTPTopBrowserListResponseResultJSON contains the JSON metadata for the +// struct [RadarHTTPTopBrowserListResponseResult] +type radarHTTPTopBrowserListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserListResponseResultMeta struct { + DateRange []RadarHTTPTopBrowserListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopBrowserListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopBrowserListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopBrowserListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarHTTPTopBrowserListResponseResultMeta] +type radarHTTPTopBrowserListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopBrowserListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopBrowserListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarHTTPTopBrowserListResponseResultMetaDateRange] +type radarHTTPTopBrowserListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopBrowserListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopBrowserListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopBrowserListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopBrowserListResponseResultMetaConfidenceInfo] +type radarHTTPTopBrowserListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopBrowserListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopBrowserListResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopBrowserListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopBrowserListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserListResponseResultTop0 struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON radarHTTPTopBrowserListResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopBrowserListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarHTTPTopBrowserListResponseResultTop0] +type radarHTTPTopBrowserListResponseResultTop0JSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopBrowserListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopBrowserListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopBrowserListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopBrowserListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopBrowserListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopBrowserListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopBrowserListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopBrowserListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopBrowserListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopBrowserListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopBrowserListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPTopBrowserListParamsBotClass string + +const ( + RadarHTTPTopBrowserListParamsBotClassLikelyAutomated RadarHTTPTopBrowserListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopBrowserListParamsBotClassLikelyHuman RadarHTTPTopBrowserListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopBrowserListParamsDateRange string + +const ( + RadarHTTPTopBrowserListParamsDateRange1d RadarHTTPTopBrowserListParamsDateRange = "1d" + RadarHTTPTopBrowserListParamsDateRange2d RadarHTTPTopBrowserListParamsDateRange = "2d" + RadarHTTPTopBrowserListParamsDateRange7d RadarHTTPTopBrowserListParamsDateRange = "7d" + RadarHTTPTopBrowserListParamsDateRange14d RadarHTTPTopBrowserListParamsDateRange = "14d" + RadarHTTPTopBrowserListParamsDateRange28d RadarHTTPTopBrowserListParamsDateRange = "28d" + RadarHTTPTopBrowserListParamsDateRange12w RadarHTTPTopBrowserListParamsDateRange = "12w" + RadarHTTPTopBrowserListParamsDateRange24w RadarHTTPTopBrowserListParamsDateRange = "24w" + RadarHTTPTopBrowserListParamsDateRange52w RadarHTTPTopBrowserListParamsDateRange = "52w" + RadarHTTPTopBrowserListParamsDateRange1dControl RadarHTTPTopBrowserListParamsDateRange = "1dControl" + RadarHTTPTopBrowserListParamsDateRange2dControl RadarHTTPTopBrowserListParamsDateRange = "2dControl" + RadarHTTPTopBrowserListParamsDateRange7dControl RadarHTTPTopBrowserListParamsDateRange = "7dControl" + RadarHTTPTopBrowserListParamsDateRange14dControl RadarHTTPTopBrowserListParamsDateRange = "14dControl" + RadarHTTPTopBrowserListParamsDateRange28dControl RadarHTTPTopBrowserListParamsDateRange = "28dControl" + RadarHTTPTopBrowserListParamsDateRange12wControl RadarHTTPTopBrowserListParamsDateRange = "12wControl" + RadarHTTPTopBrowserListParamsDateRange24wControl RadarHTTPTopBrowserListParamsDateRange = "24wControl" +) + +type RadarHTTPTopBrowserListParamsDeviceType string + +const ( + RadarHTTPTopBrowserListParamsDeviceTypeDesktop RadarHTTPTopBrowserListParamsDeviceType = "DESKTOP" + RadarHTTPTopBrowserListParamsDeviceTypeMobile RadarHTTPTopBrowserListParamsDeviceType = "MOBILE" + RadarHTTPTopBrowserListParamsDeviceTypeOther RadarHTTPTopBrowserListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopBrowserListParamsFormat string + +const ( + RadarHTTPTopBrowserListParamsFormatJson RadarHTTPTopBrowserListParamsFormat = "JSON" + RadarHTTPTopBrowserListParamsFormatCsv RadarHTTPTopBrowserListParamsFormat = "CSV" +) + +type RadarHTTPTopBrowserListParamsHTTPProtocol string + +const ( + RadarHTTPTopBrowserListParamsHTTPProtocolHTTP RadarHTTPTopBrowserListParamsHTTPProtocol = "HTTP" + RadarHTTPTopBrowserListParamsHTTPProtocolHTTPs RadarHTTPTopBrowserListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopBrowserListParamsHTTPVersion string + +const ( + RadarHTTPTopBrowserListParamsHTTPVersionHttPv1 RadarHTTPTopBrowserListParamsHTTPVersion = "HTTPv1" + RadarHTTPTopBrowserListParamsHTTPVersionHttPv2 RadarHTTPTopBrowserListParamsHTTPVersion = "HTTPv2" + RadarHTTPTopBrowserListParamsHTTPVersionHttPv3 RadarHTTPTopBrowserListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopBrowserListParamsIPVersion string + +const ( + RadarHTTPTopBrowserListParamsIPVersionIPv4 RadarHTTPTopBrowserListParamsIPVersion = "IPv4" + RadarHTTPTopBrowserListParamsIPVersionIPv6 RadarHTTPTopBrowserListParamsIPVersion = "IPv6" +) + +type RadarHTTPTopBrowserListParamsO string + +const ( + RadarHTTPTopBrowserListParamsOWindows RadarHTTPTopBrowserListParamsO = "WINDOWS" + RadarHTTPTopBrowserListParamsOMacosx RadarHTTPTopBrowserListParamsO = "MACOSX" + RadarHTTPTopBrowserListParamsOIos RadarHTTPTopBrowserListParamsO = "IOS" + RadarHTTPTopBrowserListParamsOAndroid RadarHTTPTopBrowserListParamsO = "ANDROID" + RadarHTTPTopBrowserListParamsOChromeos RadarHTTPTopBrowserListParamsO = "CHROMEOS" + RadarHTTPTopBrowserListParamsOLinux RadarHTTPTopBrowserListParamsO = "LINUX" + RadarHTTPTopBrowserListParamsOSmartTv RadarHTTPTopBrowserListParamsO = "SMART_TV" +) + +type RadarHTTPTopBrowserListParamsTlsVersion string + +const ( + RadarHTTPTopBrowserListParamsTlsVersionTlSv1_0 RadarHTTPTopBrowserListParamsTlsVersion = "TLSv1_0" + RadarHTTPTopBrowserListParamsTlsVersionTlSv1_1 RadarHTTPTopBrowserListParamsTlsVersion = "TLSv1_1" + RadarHTTPTopBrowserListParamsTlsVersionTlSv1_2 RadarHTTPTopBrowserListParamsTlsVersion = "TLSv1_2" + RadarHTTPTopBrowserListParamsTlsVersionTlSv1_3 RadarHTTPTopBrowserListParamsTlsVersion = "TLSv1_3" + RadarHTTPTopBrowserListParamsTlsVersionTlSvQuic RadarHTTPTopBrowserListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopbrowser_test.go b/radarhttptopbrowser_test.go new file mode 100644 index 00000000000..e3b03014817 --- /dev/null +++ b/radarhttptopbrowser_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopBrowserListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Browsers.List(context.TODO(), cloudflare.RadarHTTPTopBrowserListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsBotClass{cloudflare.RadarHTTPTopBrowserListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopBrowserListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsDateRange{cloudflare.RadarHTTPTopBrowserListParamsDateRange1d, cloudflare.RadarHTTPTopBrowserListParamsDateRange2d, cloudflare.RadarHTTPTopBrowserListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsDeviceType{cloudflare.RadarHTTPTopBrowserListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopBrowserListParamsDeviceTypeMobile, cloudflare.RadarHTTPTopBrowserListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopBrowserListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsHTTPProtocol{cloudflare.RadarHTTPTopBrowserListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopBrowserListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsHTTPVersion{cloudflare.RadarHTTPTopBrowserListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopBrowserListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopBrowserListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsIPVersion{cloudflare.RadarHTTPTopBrowserListParamsIPVersionIPv4, cloudflare.RadarHTTPTopBrowserListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsO{cloudflare.RadarHTTPTopBrowserListParamsOWindows, cloudflare.RadarHTTPTopBrowserListParamsOMacosx, cloudflare.RadarHTTPTopBrowserListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopBrowserListParamsTlsVersion{cloudflare.RadarHTTPTopBrowserListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopBrowserListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopBrowserListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptopbrowserfamily.go b/radarhttptopbrowserfamily.go new file mode 100644 index 00000000000..2b1a8b5e6c5 --- /dev/null +++ b/radarhttptopbrowserfamily.go @@ -0,0 +1,329 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopBrowserFamilyService 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 +// [NewRadarHTTPTopBrowserFamilyService] method instead. +type RadarHTTPTopBrowserFamilyService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopBrowserFamilyService 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 NewRadarHTTPTopBrowserFamilyService(opts ...option.RequestOption) (r *RadarHTTPTopBrowserFamilyService) { + r = &RadarHTTPTopBrowserFamilyService{} + r.Options = opts + return +} + +// Get the top user agents aggregated in families by HTTP traffic. Values are a +// percentage out of the total traffic. +func (r *RadarHTTPTopBrowserFamilyService) List(ctx context.Context, query RadarHTTPTopBrowserFamilyListParams, opts ...option.RequestOption) (res *RadarHTTPTopBrowserFamilyListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/top/browser_families" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopBrowserFamilyListResponse struct { + Result RadarHTTPTopBrowserFamilyListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopBrowserFamilyListResponseJSON `json:"-"` +} + +// radarHTTPTopBrowserFamilyListResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopBrowserFamilyListResponse] +type radarHTTPTopBrowserFamilyListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserFamilyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserFamilyListResponseResult struct { + Meta RadarHTTPTopBrowserFamilyListResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopBrowserFamilyListResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopBrowserFamilyListResponseResultJSON `json:"-"` +} + +// radarHTTPTopBrowserFamilyListResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPTopBrowserFamilyListResponseResult] +type radarHTTPTopBrowserFamilyListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserFamilyListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserFamilyListResponseResultMeta struct { + DateRange []RadarHTTPTopBrowserFamilyListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopBrowserFamilyListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopBrowserFamilyListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPTopBrowserFamilyListResponseResultMeta] +type radarHTTPTopBrowserFamilyListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserFamilyListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserFamilyListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopBrowserFamilyListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopBrowserFamilyListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopBrowserFamilyListResponseResultMetaDateRange] +type radarHTTPTopBrowserFamilyListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserFamilyListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfo] +type radarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserFamilyListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserFamilyListResponseResultTop0 struct { + Name string `json:"name,required"` + Value string `json:"value,required"` + JSON radarHTTPTopBrowserFamilyListResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopBrowserFamilyListResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarHTTPTopBrowserFamilyListResponseResultTop0] +type radarHTTPTopBrowserFamilyListResponseResultTop0JSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopBrowserFamilyListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopBrowserFamilyListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopBrowserFamilyListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopBrowserFamilyListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopBrowserFamilyListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopBrowserFamilyListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopBrowserFamilyListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopBrowserFamilyListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopBrowserFamilyListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopBrowserFamilyListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopBrowserFamilyListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopBrowserFamilyListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopBrowserFamilyListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPTopBrowserFamilyListParamsBotClass string + +const ( + RadarHTTPTopBrowserFamilyListParamsBotClassLikelyAutomated RadarHTTPTopBrowserFamilyListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopBrowserFamilyListParamsBotClassLikelyHuman RadarHTTPTopBrowserFamilyListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopBrowserFamilyListParamsDateRange string + +const ( + RadarHTTPTopBrowserFamilyListParamsDateRange1d RadarHTTPTopBrowserFamilyListParamsDateRange = "1d" + RadarHTTPTopBrowserFamilyListParamsDateRange2d RadarHTTPTopBrowserFamilyListParamsDateRange = "2d" + RadarHTTPTopBrowserFamilyListParamsDateRange7d RadarHTTPTopBrowserFamilyListParamsDateRange = "7d" + RadarHTTPTopBrowserFamilyListParamsDateRange14d RadarHTTPTopBrowserFamilyListParamsDateRange = "14d" + RadarHTTPTopBrowserFamilyListParamsDateRange28d RadarHTTPTopBrowserFamilyListParamsDateRange = "28d" + RadarHTTPTopBrowserFamilyListParamsDateRange12w RadarHTTPTopBrowserFamilyListParamsDateRange = "12w" + RadarHTTPTopBrowserFamilyListParamsDateRange24w RadarHTTPTopBrowserFamilyListParamsDateRange = "24w" + RadarHTTPTopBrowserFamilyListParamsDateRange52w RadarHTTPTopBrowserFamilyListParamsDateRange = "52w" + RadarHTTPTopBrowserFamilyListParamsDateRange1dControl RadarHTTPTopBrowserFamilyListParamsDateRange = "1dControl" + RadarHTTPTopBrowserFamilyListParamsDateRange2dControl RadarHTTPTopBrowserFamilyListParamsDateRange = "2dControl" + RadarHTTPTopBrowserFamilyListParamsDateRange7dControl RadarHTTPTopBrowserFamilyListParamsDateRange = "7dControl" + RadarHTTPTopBrowserFamilyListParamsDateRange14dControl RadarHTTPTopBrowserFamilyListParamsDateRange = "14dControl" + RadarHTTPTopBrowserFamilyListParamsDateRange28dControl RadarHTTPTopBrowserFamilyListParamsDateRange = "28dControl" + RadarHTTPTopBrowserFamilyListParamsDateRange12wControl RadarHTTPTopBrowserFamilyListParamsDateRange = "12wControl" + RadarHTTPTopBrowserFamilyListParamsDateRange24wControl RadarHTTPTopBrowserFamilyListParamsDateRange = "24wControl" +) + +type RadarHTTPTopBrowserFamilyListParamsDeviceType string + +const ( + RadarHTTPTopBrowserFamilyListParamsDeviceTypeDesktop RadarHTTPTopBrowserFamilyListParamsDeviceType = "DESKTOP" + RadarHTTPTopBrowserFamilyListParamsDeviceTypeMobile RadarHTTPTopBrowserFamilyListParamsDeviceType = "MOBILE" + RadarHTTPTopBrowserFamilyListParamsDeviceTypeOther RadarHTTPTopBrowserFamilyListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopBrowserFamilyListParamsFormat string + +const ( + RadarHTTPTopBrowserFamilyListParamsFormatJson RadarHTTPTopBrowserFamilyListParamsFormat = "JSON" + RadarHTTPTopBrowserFamilyListParamsFormatCsv RadarHTTPTopBrowserFamilyListParamsFormat = "CSV" +) + +type RadarHTTPTopBrowserFamilyListParamsHTTPProtocol string + +const ( + RadarHTTPTopBrowserFamilyListParamsHTTPProtocolHTTP RadarHTTPTopBrowserFamilyListParamsHTTPProtocol = "HTTP" + RadarHTTPTopBrowserFamilyListParamsHTTPProtocolHTTPs RadarHTTPTopBrowserFamilyListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopBrowserFamilyListParamsHTTPVersion string + +const ( + RadarHTTPTopBrowserFamilyListParamsHTTPVersionHttPv1 RadarHTTPTopBrowserFamilyListParamsHTTPVersion = "HTTPv1" + RadarHTTPTopBrowserFamilyListParamsHTTPVersionHttPv2 RadarHTTPTopBrowserFamilyListParamsHTTPVersion = "HTTPv2" + RadarHTTPTopBrowserFamilyListParamsHTTPVersionHttPv3 RadarHTTPTopBrowserFamilyListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopBrowserFamilyListParamsIPVersion string + +const ( + RadarHTTPTopBrowserFamilyListParamsIPVersionIPv4 RadarHTTPTopBrowserFamilyListParamsIPVersion = "IPv4" + RadarHTTPTopBrowserFamilyListParamsIPVersionIPv6 RadarHTTPTopBrowserFamilyListParamsIPVersion = "IPv6" +) + +type RadarHTTPTopBrowserFamilyListParamsO string + +const ( + RadarHTTPTopBrowserFamilyListParamsOWindows RadarHTTPTopBrowserFamilyListParamsO = "WINDOWS" + RadarHTTPTopBrowserFamilyListParamsOMacosx RadarHTTPTopBrowserFamilyListParamsO = "MACOSX" + RadarHTTPTopBrowserFamilyListParamsOIos RadarHTTPTopBrowserFamilyListParamsO = "IOS" + RadarHTTPTopBrowserFamilyListParamsOAndroid RadarHTTPTopBrowserFamilyListParamsO = "ANDROID" + RadarHTTPTopBrowserFamilyListParamsOChromeos RadarHTTPTopBrowserFamilyListParamsO = "CHROMEOS" + RadarHTTPTopBrowserFamilyListParamsOLinux RadarHTTPTopBrowserFamilyListParamsO = "LINUX" + RadarHTTPTopBrowserFamilyListParamsOSmartTv RadarHTTPTopBrowserFamilyListParamsO = "SMART_TV" +) + +type RadarHTTPTopBrowserFamilyListParamsTlsVersion string + +const ( + RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSv1_0 RadarHTTPTopBrowserFamilyListParamsTlsVersion = "TLSv1_0" + RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSv1_1 RadarHTTPTopBrowserFamilyListParamsTlsVersion = "TLSv1_1" + RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSv1_2 RadarHTTPTopBrowserFamilyListParamsTlsVersion = "TLSv1_2" + RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSv1_3 RadarHTTPTopBrowserFamilyListParamsTlsVersion = "TLSv1_3" + RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSvQuic RadarHTTPTopBrowserFamilyListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptopbrowserfamily_test.go b/radarhttptopbrowserfamily_test.go new file mode 100644 index 00000000000..ff09c17c012 --- /dev/null +++ b/radarhttptopbrowserfamily_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopBrowserFamilyListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.BrowserFamilies.List(context.TODO(), cloudflare.RadarHTTPTopBrowserFamilyListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsBotClass{cloudflare.RadarHTTPTopBrowserFamilyListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopBrowserFamilyListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsDateRange{cloudflare.RadarHTTPTopBrowserFamilyListParamsDateRange1d, cloudflare.RadarHTTPTopBrowserFamilyListParamsDateRange2d, cloudflare.RadarHTTPTopBrowserFamilyListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsDeviceType{cloudflare.RadarHTTPTopBrowserFamilyListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopBrowserFamilyListParamsDeviceTypeMobile, cloudflare.RadarHTTPTopBrowserFamilyListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopBrowserFamilyListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsHTTPProtocol{cloudflare.RadarHTTPTopBrowserFamilyListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopBrowserFamilyListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsHTTPVersion{cloudflare.RadarHTTPTopBrowserFamilyListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopBrowserFamilyListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopBrowserFamilyListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsIPVersion{cloudflare.RadarHTTPTopBrowserFamilyListParamsIPVersionIPv4, cloudflare.RadarHTTPTopBrowserFamilyListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsO{cloudflare.RadarHTTPTopBrowserFamilyListParamsOWindows, cloudflare.RadarHTTPTopBrowserFamilyListParamsOMacosx, cloudflare.RadarHTTPTopBrowserFamilyListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopBrowserFamilyListParamsTlsVersion{cloudflare.RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopBrowserFamilyListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptoplocation.go b/radarhttptoplocation.go new file mode 100644 index 00000000000..70e0e64316a --- /dev/null +++ b/radarhttptoplocation.go @@ -0,0 +1,344 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationService 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 [NewRadarHTTPTopLocationService] +// method instead. +type RadarHTTPTopLocationService struct { + Options []option.RequestOption + BotClasses *RadarHTTPTopLocationBotClassService + DeviceTypes *RadarHTTPTopLocationDeviceTypeService + HTTPProtocols *RadarHTTPTopLocationHTTPProtocolService + HTTPVersions *RadarHTTPTopLocationHTTPVersionService + IPVersions *RadarHTTPTopLocationIPVersionService + Os *RadarHTTPTopLocationOService + TlsVersions *RadarHTTPTopLocationTlsVersionService +} + +// NewRadarHTTPTopLocationService 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 NewRadarHTTPTopLocationService(opts ...option.RequestOption) (r *RadarHTTPTopLocationService) { + r = &RadarHTTPTopLocationService{} + r.Options = opts + r.BotClasses = NewRadarHTTPTopLocationBotClassService(opts...) + r.DeviceTypes = NewRadarHTTPTopLocationDeviceTypeService(opts...) + r.HTTPProtocols = NewRadarHTTPTopLocationHTTPProtocolService(opts...) + r.HTTPVersions = NewRadarHTTPTopLocationHTTPVersionService(opts...) + r.IPVersions = NewRadarHTTPTopLocationIPVersionService(opts...) + r.Os = NewRadarHTTPTopLocationOService(opts...) + r.TlsVersions = NewRadarHTTPTopLocationTlsVersionService(opts...) + return +} + +// Get the top locations by HTTP traffic. Values are a percentage out of the total +// traffic. +func (r *RadarHTTPTopLocationService) List(ctx context.Context, query RadarHTTPTopLocationListParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/http/top/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationListResponse struct { + Result RadarHTTPTopLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationListResponseJSON `json:"-"` +} + +// radarHTTPTopLocationListResponseJSON contains the JSON metadata for the struct +// [RadarHTTPTopLocationListResponse] +type radarHTTPTopLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationListResponseResult struct { + Meta RadarHTTPTopLocationListResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationListResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationListResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationListResponseResultJSON contains the JSON metadata for the +// struct [RadarHTTPTopLocationListResponseResult] +type radarHTTPTopLocationListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationListResponseResultMeta struct { + DateRange []RadarHTTPTopLocationListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationListResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarHTTPTopLocationListResponseResultMeta] +type radarHTTPTopLocationListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationListResponseResultMetaDateRange] +type radarHTTPTopLocationListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationListResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopLocationListResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopLocationListResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationListResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationListResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarHTTPTopLocationListResponseResultTop0] +type radarHTTPTopLocationListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopLocationListParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopLocationListParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationListParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationListParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopLocationListParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopLocationListParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopLocationListParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopLocationListParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopLocationListParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarHTTPTopLocationListParamsBotClass string + +const ( + RadarHTTPTopLocationListParamsBotClassLikelyAutomated RadarHTTPTopLocationListParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationListParamsBotClassLikelyHuman RadarHTTPTopLocationListParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationListParamsDateRange string + +const ( + RadarHTTPTopLocationListParamsDateRange1d RadarHTTPTopLocationListParamsDateRange = "1d" + RadarHTTPTopLocationListParamsDateRange2d RadarHTTPTopLocationListParamsDateRange = "2d" + RadarHTTPTopLocationListParamsDateRange7d RadarHTTPTopLocationListParamsDateRange = "7d" + RadarHTTPTopLocationListParamsDateRange14d RadarHTTPTopLocationListParamsDateRange = "14d" + RadarHTTPTopLocationListParamsDateRange28d RadarHTTPTopLocationListParamsDateRange = "28d" + RadarHTTPTopLocationListParamsDateRange12w RadarHTTPTopLocationListParamsDateRange = "12w" + RadarHTTPTopLocationListParamsDateRange24w RadarHTTPTopLocationListParamsDateRange = "24w" + RadarHTTPTopLocationListParamsDateRange52w RadarHTTPTopLocationListParamsDateRange = "52w" + RadarHTTPTopLocationListParamsDateRange1dControl RadarHTTPTopLocationListParamsDateRange = "1dControl" + RadarHTTPTopLocationListParamsDateRange2dControl RadarHTTPTopLocationListParamsDateRange = "2dControl" + RadarHTTPTopLocationListParamsDateRange7dControl RadarHTTPTopLocationListParamsDateRange = "7dControl" + RadarHTTPTopLocationListParamsDateRange14dControl RadarHTTPTopLocationListParamsDateRange = "14dControl" + RadarHTTPTopLocationListParamsDateRange28dControl RadarHTTPTopLocationListParamsDateRange = "28dControl" + RadarHTTPTopLocationListParamsDateRange12wControl RadarHTTPTopLocationListParamsDateRange = "12wControl" + RadarHTTPTopLocationListParamsDateRange24wControl RadarHTTPTopLocationListParamsDateRange = "24wControl" +) + +type RadarHTTPTopLocationListParamsDeviceType string + +const ( + RadarHTTPTopLocationListParamsDeviceTypeDesktop RadarHTTPTopLocationListParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationListParamsDeviceTypeMobile RadarHTTPTopLocationListParamsDeviceType = "MOBILE" + RadarHTTPTopLocationListParamsDeviceTypeOther RadarHTTPTopLocationListParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopLocationListParamsFormat string + +const ( + RadarHTTPTopLocationListParamsFormatJson RadarHTTPTopLocationListParamsFormat = "JSON" + RadarHTTPTopLocationListParamsFormatCsv RadarHTTPTopLocationListParamsFormat = "CSV" +) + +type RadarHTTPTopLocationListParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationListParamsHTTPProtocolHTTP RadarHTTPTopLocationListParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationListParamsHTTPProtocolHTTPs RadarHTTPTopLocationListParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationListParamsHTTPVersion string + +const ( + RadarHTTPTopLocationListParamsHTTPVersionHttPv1 RadarHTTPTopLocationListParamsHTTPVersion = "HTTPv1" + RadarHTTPTopLocationListParamsHTTPVersionHttPv2 RadarHTTPTopLocationListParamsHTTPVersion = "HTTPv2" + RadarHTTPTopLocationListParamsHTTPVersionHttPv3 RadarHTTPTopLocationListParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopLocationListParamsIPVersion string + +const ( + RadarHTTPTopLocationListParamsIPVersionIPv4 RadarHTTPTopLocationListParamsIPVersion = "IPv4" + RadarHTTPTopLocationListParamsIPVersionIPv6 RadarHTTPTopLocationListParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationListParamsO string + +const ( + RadarHTTPTopLocationListParamsOWindows RadarHTTPTopLocationListParamsO = "WINDOWS" + RadarHTTPTopLocationListParamsOMacosx RadarHTTPTopLocationListParamsO = "MACOSX" + RadarHTTPTopLocationListParamsOIos RadarHTTPTopLocationListParamsO = "IOS" + RadarHTTPTopLocationListParamsOAndroid RadarHTTPTopLocationListParamsO = "ANDROID" + RadarHTTPTopLocationListParamsOChromeos RadarHTTPTopLocationListParamsO = "CHROMEOS" + RadarHTTPTopLocationListParamsOLinux RadarHTTPTopLocationListParamsO = "LINUX" + RadarHTTPTopLocationListParamsOSmartTv RadarHTTPTopLocationListParamsO = "SMART_TV" +) + +type RadarHTTPTopLocationListParamsTlsVersion string + +const ( + RadarHTTPTopLocationListParamsTlsVersionTlSv1_0 RadarHTTPTopLocationListParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationListParamsTlsVersionTlSv1_1 RadarHTTPTopLocationListParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationListParamsTlsVersionTlSv1_2 RadarHTTPTopLocationListParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationListParamsTlsVersionTlSv1_3 RadarHTTPTopLocationListParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationListParamsTlsVersionTlSvQuic RadarHTTPTopLocationListParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptoplocation_test.go b/radarhttptoplocation_test.go new file mode 100644 index 00000000000..b45efbafa4c --- /dev/null +++ b/radarhttptoplocation_test.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.List(context.TODO(), cloudflare.RadarHTTPTopLocationListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsBotClass{cloudflare.RadarHTTPTopLocationListParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopLocationListParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsDateRange{cloudflare.RadarHTTPTopLocationListParamsDateRange1d, cloudflare.RadarHTTPTopLocationListParamsDateRange2d, cloudflare.RadarHTTPTopLocationListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsDeviceType{cloudflare.RadarHTTPTopLocationListParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopLocationListParamsDeviceTypeMobile, cloudflare.RadarHTTPTopLocationListParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationListParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationListParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationListParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsHTTPVersion{cloudflare.RadarHTTPTopLocationListParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopLocationListParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopLocationListParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsIPVersion{cloudflare.RadarHTTPTopLocationListParamsIPVersionIPv4, cloudflare.RadarHTTPTopLocationListParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsO{cloudflare.RadarHTTPTopLocationListParamsOWindows, cloudflare.RadarHTTPTopLocationListParamsOMacosx, cloudflare.RadarHTTPTopLocationListParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationListParamsTlsVersion{cloudflare.RadarHTTPTopLocationListParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopLocationListParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopLocationListParamsTlsVersionTlSv1_2}), + }) + 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/radarhttptoplocationbotclass.go b/radarhttptoplocationbotclass.go new file mode 100644 index 00000000000..a2a9c2c6c48 --- /dev/null +++ b/radarhttptoplocationbotclass.go @@ -0,0 +1,332 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationBotClassService 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 +// [NewRadarHTTPTopLocationBotClassService] method instead. +type RadarHTTPTopLocationBotClassService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopLocationBotClassService 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 NewRadarHTTPTopLocationBotClassService(opts ...option.RequestOption) (r *RadarHTTPTopLocationBotClassService) { + r = &RadarHTTPTopLocationBotClassService{} + r.Options = opts + return +} + +// Get the top locations, by HTTP traffic, of the requested bot class. These two +// categories use Cloudflare's bot score - refer to [Bot +// scores])https://developers.cloudflare.com/bots/concepts/bot-score). Values are a +// percentage out of the total traffic. +func (r *RadarHTTPTopLocationBotClassService) Get(ctx context.Context, botClass RadarHTTPTopLocationBotClassGetParamsBotClass, query RadarHTTPTopLocationBotClassGetParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationBotClassGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/locations/bot_class/%v", botClass) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationBotClassGetResponse struct { + Result RadarHTTPTopLocationBotClassGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationBotClassGetResponseJSON `json:"-"` +} + +// radarHTTPTopLocationBotClassGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopLocationBotClassGetResponse] +type radarHTTPTopLocationBotClassGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationBotClassGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationBotClassGetResponseResult struct { + Meta RadarHTTPTopLocationBotClassGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationBotClassGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationBotClassGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationBotClassGetResponseResultJSON contains the JSON metadata for +// the struct [RadarHTTPTopLocationBotClassGetResponseResult] +type radarHTTPTopLocationBotClassGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationBotClassGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationBotClassGetResponseResultMeta struct { + DateRange []RadarHTTPTopLocationBotClassGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationBotClassGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationBotClassGetResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarHTTPTopLocationBotClassGetResponseResultMeta] +type radarHTTPTopLocationBotClassGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationBotClassGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationBotClassGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationBotClassGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationBotClassGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopLocationBotClassGetResponseResultMetaDateRange] +type radarHTTPTopLocationBotClassGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationBotClassGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationBotClassGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationBotClassGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationBotClassGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationBotClassGetResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarHTTPTopLocationBotClassGetResponseResultTop0] +type radarHTTPTopLocationBotClassGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationBotClassGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationBotClassGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationBotClassGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopLocationBotClassGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationBotClassGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationBotClassGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopLocationBotClassGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopLocationBotClassGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopLocationBotClassGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopLocationBotClassGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopLocationBotClassGetParams]'s query parameters +// as `url.Values`. +func (r RadarHTTPTopLocationBotClassGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Bot class. +type RadarHTTPTopLocationBotClassGetParamsBotClass string + +const ( + RadarHTTPTopLocationBotClassGetParamsBotClassLikelyAutomated RadarHTTPTopLocationBotClassGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationBotClassGetParamsBotClassLikelyHuman RadarHTTPTopLocationBotClassGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationBotClassGetParamsDateRange string + +const ( + RadarHTTPTopLocationBotClassGetParamsDateRange1d RadarHTTPTopLocationBotClassGetParamsDateRange = "1d" + RadarHTTPTopLocationBotClassGetParamsDateRange2d RadarHTTPTopLocationBotClassGetParamsDateRange = "2d" + RadarHTTPTopLocationBotClassGetParamsDateRange7d RadarHTTPTopLocationBotClassGetParamsDateRange = "7d" + RadarHTTPTopLocationBotClassGetParamsDateRange14d RadarHTTPTopLocationBotClassGetParamsDateRange = "14d" + RadarHTTPTopLocationBotClassGetParamsDateRange28d RadarHTTPTopLocationBotClassGetParamsDateRange = "28d" + RadarHTTPTopLocationBotClassGetParamsDateRange12w RadarHTTPTopLocationBotClassGetParamsDateRange = "12w" + RadarHTTPTopLocationBotClassGetParamsDateRange24w RadarHTTPTopLocationBotClassGetParamsDateRange = "24w" + RadarHTTPTopLocationBotClassGetParamsDateRange52w RadarHTTPTopLocationBotClassGetParamsDateRange = "52w" + RadarHTTPTopLocationBotClassGetParamsDateRange1dControl RadarHTTPTopLocationBotClassGetParamsDateRange = "1dControl" + RadarHTTPTopLocationBotClassGetParamsDateRange2dControl RadarHTTPTopLocationBotClassGetParamsDateRange = "2dControl" + RadarHTTPTopLocationBotClassGetParamsDateRange7dControl RadarHTTPTopLocationBotClassGetParamsDateRange = "7dControl" + RadarHTTPTopLocationBotClassGetParamsDateRange14dControl RadarHTTPTopLocationBotClassGetParamsDateRange = "14dControl" + RadarHTTPTopLocationBotClassGetParamsDateRange28dControl RadarHTTPTopLocationBotClassGetParamsDateRange = "28dControl" + RadarHTTPTopLocationBotClassGetParamsDateRange12wControl RadarHTTPTopLocationBotClassGetParamsDateRange = "12wControl" + RadarHTTPTopLocationBotClassGetParamsDateRange24wControl RadarHTTPTopLocationBotClassGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopLocationBotClassGetParamsDeviceType string + +const ( + RadarHTTPTopLocationBotClassGetParamsDeviceTypeDesktop RadarHTTPTopLocationBotClassGetParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationBotClassGetParamsDeviceTypeMobile RadarHTTPTopLocationBotClassGetParamsDeviceType = "MOBILE" + RadarHTTPTopLocationBotClassGetParamsDeviceTypeOther RadarHTTPTopLocationBotClassGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopLocationBotClassGetParamsFormat string + +const ( + RadarHTTPTopLocationBotClassGetParamsFormatJson RadarHTTPTopLocationBotClassGetParamsFormat = "JSON" + RadarHTTPTopLocationBotClassGetParamsFormatCsv RadarHTTPTopLocationBotClassGetParamsFormat = "CSV" +) + +type RadarHTTPTopLocationBotClassGetParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationBotClassGetParamsHTTPProtocolHTTP RadarHTTPTopLocationBotClassGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationBotClassGetParamsHTTPProtocolHTTPs RadarHTTPTopLocationBotClassGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationBotClassGetParamsHTTPVersion string + +const ( + RadarHTTPTopLocationBotClassGetParamsHTTPVersionHttPv1 RadarHTTPTopLocationBotClassGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopLocationBotClassGetParamsHTTPVersionHttPv2 RadarHTTPTopLocationBotClassGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopLocationBotClassGetParamsHTTPVersionHttPv3 RadarHTTPTopLocationBotClassGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopLocationBotClassGetParamsIPVersion string + +const ( + RadarHTTPTopLocationBotClassGetParamsIPVersionIPv4 RadarHTTPTopLocationBotClassGetParamsIPVersion = "IPv4" + RadarHTTPTopLocationBotClassGetParamsIPVersionIPv6 RadarHTTPTopLocationBotClassGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationBotClassGetParamsO string + +const ( + RadarHTTPTopLocationBotClassGetParamsOWindows RadarHTTPTopLocationBotClassGetParamsO = "WINDOWS" + RadarHTTPTopLocationBotClassGetParamsOMacosx RadarHTTPTopLocationBotClassGetParamsO = "MACOSX" + RadarHTTPTopLocationBotClassGetParamsOIos RadarHTTPTopLocationBotClassGetParamsO = "IOS" + RadarHTTPTopLocationBotClassGetParamsOAndroid RadarHTTPTopLocationBotClassGetParamsO = "ANDROID" + RadarHTTPTopLocationBotClassGetParamsOChromeos RadarHTTPTopLocationBotClassGetParamsO = "CHROMEOS" + RadarHTTPTopLocationBotClassGetParamsOLinux RadarHTTPTopLocationBotClassGetParamsO = "LINUX" + RadarHTTPTopLocationBotClassGetParamsOSmartTv RadarHTTPTopLocationBotClassGetParamsO = "SMART_TV" +) + +type RadarHTTPTopLocationBotClassGetParamsTlsVersion string + +const ( + RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSv1_0 RadarHTTPTopLocationBotClassGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSv1_1 RadarHTTPTopLocationBotClassGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSv1_2 RadarHTTPTopLocationBotClassGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSv1_3 RadarHTTPTopLocationBotClassGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSvQuic RadarHTTPTopLocationBotClassGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptoplocationbotclass_test.go b/radarhttptoplocationbotclass_test.go new file mode 100644 index 00000000000..4f794c6f9b9 --- /dev/null +++ b/radarhttptoplocationbotclass_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationBotClassGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.BotClasses.Get( + context.TODO(), + cloudflare.RadarHTTPTopLocationBotClassGetParamsBotClassLikelyAutomated, + cloudflare.RadarHTTPTopLocationBotClassGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationBotClassGetParamsDateRange{cloudflare.RadarHTTPTopLocationBotClassGetParamsDateRange1d, cloudflare.RadarHTTPTopLocationBotClassGetParamsDateRange2d, cloudflare.RadarHTTPTopLocationBotClassGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopLocationBotClassGetParamsDeviceType{cloudflare.RadarHTTPTopLocationBotClassGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopLocationBotClassGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopLocationBotClassGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationBotClassGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationBotClassGetParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationBotClassGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationBotClassGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationBotClassGetParamsHTTPVersion{cloudflare.RadarHTTPTopLocationBotClassGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopLocationBotClassGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopLocationBotClassGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationBotClassGetParamsIPVersion{cloudflare.RadarHTTPTopLocationBotClassGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopLocationBotClassGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopLocationBotClassGetParamsO{cloudflare.RadarHTTPTopLocationBotClassGetParamsOWindows, cloudflare.RadarHTTPTopLocationBotClassGetParamsOMacosx, cloudflare.RadarHTTPTopLocationBotClassGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationBotClassGetParamsTlsVersion{cloudflare.RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopLocationBotClassGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptoplocationdevicetype.go b/radarhttptoplocationdevicetype.go new file mode 100644 index 00000000000..5e54662413c --- /dev/null +++ b/radarhttptoplocationdevicetype.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationDeviceTypeService 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 +// [NewRadarHTTPTopLocationDeviceTypeService] method instead. +type RadarHTTPTopLocationDeviceTypeService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopLocationDeviceTypeService 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 NewRadarHTTPTopLocationDeviceTypeService(opts ...option.RequestOption) (r *RadarHTTPTopLocationDeviceTypeService) { + r = &RadarHTTPTopLocationDeviceTypeService{} + r.Options = opts + return +} + +// Get the top locations, by HTTP traffic, of the requested device type. Values are +// a percentage out of the total traffic. +func (r *RadarHTTPTopLocationDeviceTypeService) Get(ctx context.Context, deviceType RadarHTTPTopLocationDeviceTypeGetParamsDeviceType, query RadarHTTPTopLocationDeviceTypeGetParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationDeviceTypeGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/locations/device_type/%v", deviceType) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationDeviceTypeGetResponse struct { + Result RadarHTTPTopLocationDeviceTypeGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationDeviceTypeGetResponseJSON `json:"-"` +} + +// radarHTTPTopLocationDeviceTypeGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopLocationDeviceTypeGetResponse] +type radarHTTPTopLocationDeviceTypeGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationDeviceTypeGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationDeviceTypeGetResponseResult struct { + Meta RadarHTTPTopLocationDeviceTypeGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationDeviceTypeGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationDeviceTypeGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationDeviceTypeGetResponseResultJSON contains the JSON metadata +// for the struct [RadarHTTPTopLocationDeviceTypeGetResponseResult] +type radarHTTPTopLocationDeviceTypeGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationDeviceTypeGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationDeviceTypeGetResponseResultMeta struct { + DateRange []RadarHTTPTopLocationDeviceTypeGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationDeviceTypeGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationDeviceTypeGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationDeviceTypeGetResponseResultMeta] +type radarHTTPTopLocationDeviceTypeGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationDeviceTypeGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationDeviceTypeGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationDeviceTypeGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationDeviceTypeGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopLocationDeviceTypeGetResponseResultMetaDateRange] +type radarHTTPTopLocationDeviceTypeGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationDeviceTypeGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationDeviceTypeGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationDeviceTypeGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationDeviceTypeGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationDeviceTypeGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationDeviceTypeGetResponseResultTop0] +type radarHTTPTopLocationDeviceTypeGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationDeviceTypeGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationDeviceTypeGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopLocationDeviceTypeGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationDeviceTypeGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationDeviceTypeGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopLocationDeviceTypeGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopLocationDeviceTypeGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopLocationDeviceTypeGetParams]'s query parameters +// as `url.Values`. +func (r RadarHTTPTopLocationDeviceTypeGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Device type. +type RadarHTTPTopLocationDeviceTypeGetParamsDeviceType string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsDeviceTypeDesktop RadarHTTPTopLocationDeviceTypeGetParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationDeviceTypeGetParamsDeviceTypeMobile RadarHTTPTopLocationDeviceTypeGetParamsDeviceType = "MOBILE" + RadarHTTPTopLocationDeviceTypeGetParamsDeviceTypeOther RadarHTTPTopLocationDeviceTypeGetParamsDeviceType = "OTHER" +) + +type RadarHTTPTopLocationDeviceTypeGetParamsBotClass string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsBotClassLikelyAutomated RadarHTTPTopLocationDeviceTypeGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationDeviceTypeGetParamsBotClassLikelyHuman RadarHTTPTopLocationDeviceTypeGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationDeviceTypeGetParamsDateRange string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsDateRange1d RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "1d" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange2d RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "2d" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange7d RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "7d" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange14d RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "14d" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange28d RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "28d" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange12w RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "12w" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange24w RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "24w" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange52w RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "52w" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange1dControl RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "1dControl" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange2dControl RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "2dControl" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange7dControl RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "7dControl" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange14dControl RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "14dControl" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange28dControl RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "28dControl" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange12wControl RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "12wControl" + RadarHTTPTopLocationDeviceTypeGetParamsDateRange24wControl RadarHTTPTopLocationDeviceTypeGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarHTTPTopLocationDeviceTypeGetParamsFormat string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsFormatJson RadarHTTPTopLocationDeviceTypeGetParamsFormat = "JSON" + RadarHTTPTopLocationDeviceTypeGetParamsFormatCsv RadarHTTPTopLocationDeviceTypeGetParamsFormat = "CSV" +) + +type RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocolHTTP RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocolHTTPs RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersion string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersionHttPv1 RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersionHttPv2 RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersionHttPv3 RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopLocationDeviceTypeGetParamsIPVersion string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsIPVersionIPv4 RadarHTTPTopLocationDeviceTypeGetParamsIPVersion = "IPv4" + RadarHTTPTopLocationDeviceTypeGetParamsIPVersionIPv6 RadarHTTPTopLocationDeviceTypeGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationDeviceTypeGetParamsO string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsOWindows RadarHTTPTopLocationDeviceTypeGetParamsO = "WINDOWS" + RadarHTTPTopLocationDeviceTypeGetParamsOMacosx RadarHTTPTopLocationDeviceTypeGetParamsO = "MACOSX" + RadarHTTPTopLocationDeviceTypeGetParamsOIos RadarHTTPTopLocationDeviceTypeGetParamsO = "IOS" + RadarHTTPTopLocationDeviceTypeGetParamsOAndroid RadarHTTPTopLocationDeviceTypeGetParamsO = "ANDROID" + RadarHTTPTopLocationDeviceTypeGetParamsOChromeos RadarHTTPTopLocationDeviceTypeGetParamsO = "CHROMEOS" + RadarHTTPTopLocationDeviceTypeGetParamsOLinux RadarHTTPTopLocationDeviceTypeGetParamsO = "LINUX" + RadarHTTPTopLocationDeviceTypeGetParamsOSmartTv RadarHTTPTopLocationDeviceTypeGetParamsO = "SMART_TV" +) + +type RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion string + +const ( + RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSv1_0 RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSv1_1 RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSv1_2 RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSv1_3 RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSvQuic RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptoplocationdevicetype_test.go b/radarhttptoplocationdevicetype_test.go new file mode 100644 index 00000000000..017e6f05b79 --- /dev/null +++ b/radarhttptoplocationdevicetype_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationDeviceTypeGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.DeviceTypes.Get( + context.TODO(), + cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsDeviceTypeDesktop, + cloudflare.RadarHTTPTopLocationDeviceTypeGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsBotClass{cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsDateRange{cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsDateRange1d, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsDateRange2d, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersion{cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsIPVersion{cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsO{cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsOWindows, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsOMacosx, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsTlsVersion{cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopLocationDeviceTypeGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptoplocationhttpprotocol.go b/radarhttptoplocationhttpprotocol.go new file mode 100644 index 00000000000..96ca6f26da4 --- /dev/null +++ b/radarhttptoplocationhttpprotocol.go @@ -0,0 +1,323 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationHTTPProtocolService 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 +// [NewRadarHTTPTopLocationHTTPProtocolService] method instead. +type RadarHTTPTopLocationHTTPProtocolService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopLocationHTTPProtocolService 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 NewRadarHTTPTopLocationHTTPProtocolService(opts ...option.RequestOption) (r *RadarHTTPTopLocationHTTPProtocolService) { + r = &RadarHTTPTopLocationHTTPProtocolService{} + r.Options = opts + return +} + +// Get the top locations, by HTTP traffic, of the requested HTTP protocol. Values +// are a percentage out of the total traffic. +func (r *RadarHTTPTopLocationHTTPProtocolService) Get(ctx context.Context, httpProtocol RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocol, query RadarHTTPTopLocationHTTPProtocolGetParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationHTTPProtocolGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/locations/http_protocol/%v", httpProtocol) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationHTTPProtocolGetResponse struct { + Result RadarHTTPTopLocationHTTPProtocolGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationHTTPProtocolGetResponseJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPProtocolGetResponseJSON contains the JSON metadata for +// the struct [RadarHTTPTopLocationHTTPProtocolGetResponse] +type radarHTTPTopLocationHTTPProtocolGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPProtocolGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPProtocolGetResponseResult struct { + Meta RadarHTTPTopLocationHTTPProtocolGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationHTTPProtocolGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationHTTPProtocolGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPProtocolGetResponseResultJSON contains the JSON metadata +// for the struct [RadarHTTPTopLocationHTTPProtocolGetResponseResult] +type radarHTTPTopLocationHTTPProtocolGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPProtocolGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPProtocolGetResponseResultMeta struct { + DateRange []RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationHTTPProtocolGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPProtocolGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationHTTPProtocolGetResponseResultMeta] +type radarHTTPTopLocationHTTPProtocolGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPProtocolGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationHTTPProtocolGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPProtocolGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaDateRange] +type radarHTTPTopLocationHTTPProtocolGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPProtocolGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPProtocolGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationHTTPProtocolGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationHTTPProtocolGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationHTTPProtocolGetResponseResultTop0] +type radarHTTPTopLocationHTTPProtocolGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPProtocolGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPProtocolGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopLocationHTTPProtocolGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationHTTPProtocolGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopLocationHTTPProtocolGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationHTTPProtocolGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopLocationHTTPProtocolGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopLocationHTTPProtocolGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopLocationHTTPProtocolGetParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTopLocationHTTPProtocolGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// HTTP Protocol. +type RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocolHTTP RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocolHTTPs RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationHTTPProtocolGetParamsBotClass string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsBotClassLikelyAutomated RadarHTTPTopLocationHTTPProtocolGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationHTTPProtocolGetParamsBotClassLikelyHuman RadarHTTPTopLocationHTTPProtocolGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationHTTPProtocolGetParamsDateRange string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange1d RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "1d" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange2d RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "2d" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange7d RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "7d" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange14d RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "14d" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange28d RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "28d" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange12w RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "12w" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange24w RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "24w" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange52w RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "52w" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange1dControl RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "1dControl" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange2dControl RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "2dControl" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange7dControl RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "7dControl" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange14dControl RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "14dControl" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange28dControl RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "28dControl" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange12wControl RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "12wControl" + RadarHTTPTopLocationHTTPProtocolGetParamsDateRange24wControl RadarHTTPTopLocationHTTPProtocolGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopLocationHTTPProtocolGetParamsDeviceType string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsDeviceTypeDesktop RadarHTTPTopLocationHTTPProtocolGetParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationHTTPProtocolGetParamsDeviceTypeMobile RadarHTTPTopLocationHTTPProtocolGetParamsDeviceType = "MOBILE" + RadarHTTPTopLocationHTTPProtocolGetParamsDeviceTypeOther RadarHTTPTopLocationHTTPProtocolGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopLocationHTTPProtocolGetParamsFormat string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsFormatJson RadarHTTPTopLocationHTTPProtocolGetParamsFormat = "JSON" + RadarHTTPTopLocationHTTPProtocolGetParamsFormatCsv RadarHTTPTopLocationHTTPProtocolGetParamsFormat = "CSV" +) + +type RadarHTTPTopLocationHTTPProtocolGetParamsIPVersion string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsIPVersionIPv4 RadarHTTPTopLocationHTTPProtocolGetParamsIPVersion = "IPv4" + RadarHTTPTopLocationHTTPProtocolGetParamsIPVersionIPv6 RadarHTTPTopLocationHTTPProtocolGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationHTTPProtocolGetParamsO string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsOWindows RadarHTTPTopLocationHTTPProtocolGetParamsO = "WINDOWS" + RadarHTTPTopLocationHTTPProtocolGetParamsOMacosx RadarHTTPTopLocationHTTPProtocolGetParamsO = "MACOSX" + RadarHTTPTopLocationHTTPProtocolGetParamsOIos RadarHTTPTopLocationHTTPProtocolGetParamsO = "IOS" + RadarHTTPTopLocationHTTPProtocolGetParamsOAndroid RadarHTTPTopLocationHTTPProtocolGetParamsO = "ANDROID" + RadarHTTPTopLocationHTTPProtocolGetParamsOChromeos RadarHTTPTopLocationHTTPProtocolGetParamsO = "CHROMEOS" + RadarHTTPTopLocationHTTPProtocolGetParamsOLinux RadarHTTPTopLocationHTTPProtocolGetParamsO = "LINUX" + RadarHTTPTopLocationHTTPProtocolGetParamsOSmartTv RadarHTTPTopLocationHTTPProtocolGetParamsO = "SMART_TV" +) + +type RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion string + +const ( + RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSv1_0 RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSv1_1 RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSv1_2 RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSv1_3 RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSvQuic RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptoplocationhttpprotocol_test.go b/radarhttptoplocationhttpprotocol_test.go new file mode 100644 index 00000000000..5a69283ab41 --- /dev/null +++ b/radarhttptoplocationhttpprotocol_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationHTTPProtocolGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.HTTPProtocols.Get( + context.TODO(), + cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocolHTTP, + cloudflare.RadarHTTPTopLocationHTTPProtocolGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsBotClass{cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDateRange{cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDateRange1d, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDateRange2d, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDeviceType{cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsHTTPProtocolHTTPs}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsIPVersion{cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsO{cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsOWindows, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsOMacosx, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersion{cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopLocationHTTPProtocolGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptoplocationhttpversion.go b/radarhttptoplocationhttpversion.go new file mode 100644 index 00000000000..12d7a8d7e71 --- /dev/null +++ b/radarhttptoplocationhttpversion.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationHTTPVersionService 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 +// [NewRadarHTTPTopLocationHTTPVersionService] method instead. +type RadarHTTPTopLocationHTTPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopLocationHTTPVersionService 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 NewRadarHTTPTopLocationHTTPVersionService(opts ...option.RequestOption) (r *RadarHTTPTopLocationHTTPVersionService) { + r = &RadarHTTPTopLocationHTTPVersionService{} + r.Options = opts + return +} + +// Get the top locations, by HTTP traffic, of the requested HTTP protocol. Values +// are a percentage out of the total traffic. +func (r *RadarHTTPTopLocationHTTPVersionService) Get(ctx context.Context, httpVersion RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersion, query RadarHTTPTopLocationHTTPVersionGetParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationHTTPVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/locations/http_version/%v", httpVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationHTTPVersionGetResponse struct { + Result RadarHTTPTopLocationHTTPVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationHTTPVersionGetResponseJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPVersionGetResponseJSON contains the JSON metadata for +// the struct [RadarHTTPTopLocationHTTPVersionGetResponse] +type radarHTTPTopLocationHTTPVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPVersionGetResponseResult struct { + Meta RadarHTTPTopLocationHTTPVersionGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationHTTPVersionGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationHTTPVersionGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPVersionGetResponseResultJSON contains the JSON metadata +// for the struct [RadarHTTPTopLocationHTTPVersionGetResponseResult] +type radarHTTPTopLocationHTTPVersionGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPVersionGetResponseResultMeta struct { + DateRange []RadarHTTPTopLocationHTTPVersionGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationHTTPVersionGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPVersionGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationHTTPVersionGetResponseResultMeta] +type radarHTTPTopLocationHTTPVersionGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPVersionGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPVersionGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationHTTPVersionGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPVersionGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopLocationHTTPVersionGetResponseResultMetaDateRange] +type radarHTTPTopLocationHTTPVersionGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPVersionGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPVersionGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPVersionGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationHTTPVersionGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationHTTPVersionGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationHTTPVersionGetResponseResultTop0] +type radarHTTPTopLocationHTTPVersionGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationHTTPVersionGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationHTTPVersionGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopLocationHTTPVersionGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationHTTPVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopLocationHTTPVersionGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationHTTPVersionGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopLocationHTTPVersionGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopLocationHTTPVersionGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopLocationHTTPVersionGetParams]'s query +// parameters as `url.Values`. +func (r RadarHTTPTopLocationHTTPVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// HTTP version. +type RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersion string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersionHttPv1 RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersionHttPv2 RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersionHttPv3 RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopLocationHTTPVersionGetParamsBotClass string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsBotClassLikelyAutomated RadarHTTPTopLocationHTTPVersionGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationHTTPVersionGetParamsBotClassLikelyHuman RadarHTTPTopLocationHTTPVersionGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationHTTPVersionGetParamsDateRange string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsDateRange1d RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "1d" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange2d RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "2d" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange7d RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "7d" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange14d RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "14d" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange28d RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "28d" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange12w RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "12w" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange24w RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "24w" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange52w RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "52w" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange1dControl RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "1dControl" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange2dControl RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "2dControl" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange7dControl RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "7dControl" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange14dControl RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "14dControl" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange28dControl RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "28dControl" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange12wControl RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "12wControl" + RadarHTTPTopLocationHTTPVersionGetParamsDateRange24wControl RadarHTTPTopLocationHTTPVersionGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopLocationHTTPVersionGetParamsDeviceType string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsDeviceTypeDesktop RadarHTTPTopLocationHTTPVersionGetParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationHTTPVersionGetParamsDeviceTypeMobile RadarHTTPTopLocationHTTPVersionGetParamsDeviceType = "MOBILE" + RadarHTTPTopLocationHTTPVersionGetParamsDeviceTypeOther RadarHTTPTopLocationHTTPVersionGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopLocationHTTPVersionGetParamsFormat string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsFormatJson RadarHTTPTopLocationHTTPVersionGetParamsFormat = "JSON" + RadarHTTPTopLocationHTTPVersionGetParamsFormatCsv RadarHTTPTopLocationHTTPVersionGetParamsFormat = "CSV" +) + +type RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocolHTTP RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocolHTTPs RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationHTTPVersionGetParamsIPVersion string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsIPVersionIPv4 RadarHTTPTopLocationHTTPVersionGetParamsIPVersion = "IPv4" + RadarHTTPTopLocationHTTPVersionGetParamsIPVersionIPv6 RadarHTTPTopLocationHTTPVersionGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationHTTPVersionGetParamsO string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsOWindows RadarHTTPTopLocationHTTPVersionGetParamsO = "WINDOWS" + RadarHTTPTopLocationHTTPVersionGetParamsOMacosx RadarHTTPTopLocationHTTPVersionGetParamsO = "MACOSX" + RadarHTTPTopLocationHTTPVersionGetParamsOIos RadarHTTPTopLocationHTTPVersionGetParamsO = "IOS" + RadarHTTPTopLocationHTTPVersionGetParamsOAndroid RadarHTTPTopLocationHTTPVersionGetParamsO = "ANDROID" + RadarHTTPTopLocationHTTPVersionGetParamsOChromeos RadarHTTPTopLocationHTTPVersionGetParamsO = "CHROMEOS" + RadarHTTPTopLocationHTTPVersionGetParamsOLinux RadarHTTPTopLocationHTTPVersionGetParamsO = "LINUX" + RadarHTTPTopLocationHTTPVersionGetParamsOSmartTv RadarHTTPTopLocationHTTPVersionGetParamsO = "SMART_TV" +) + +type RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion string + +const ( + RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSv1_0 RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSv1_1 RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSv1_2 RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSv1_3 RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSvQuic RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptoplocationhttpversion_test.go b/radarhttptoplocationhttpversion_test.go new file mode 100644 index 00000000000..d77904d1233 --- /dev/null +++ b/radarhttptoplocationhttpversion_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationHTTPVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.HTTPVersions.Get( + context.TODO(), + cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsHTTPVersionHttPv1, + cloudflare.RadarHTTPTopLocationHTTPVersionGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsBotClass{cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDateRange{cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDateRange1d, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDateRange2d, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDeviceType{cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsHTTPProtocolHTTPs}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsIPVersion{cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsO{cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsOWindows, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsOMacosx, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsTlsVersion{cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopLocationHTTPVersionGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptoplocationipversion.go b/radarhttptoplocationipversion.go new file mode 100644 index 00000000000..219c51bfa61 --- /dev/null +++ b/radarhttptoplocationipversion.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationIPVersionService 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 +// [NewRadarHTTPTopLocationIPVersionService] method instead. +type RadarHTTPTopLocationIPVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopLocationIPVersionService 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 NewRadarHTTPTopLocationIPVersionService(opts ...option.RequestOption) (r *RadarHTTPTopLocationIPVersionService) { + r = &RadarHTTPTopLocationIPVersionService{} + r.Options = opts + return +} + +// Get the top locations, by HTTP traffic, of the requested IP protocol version. +// Values are a percentage out of the total traffic. +func (r *RadarHTTPTopLocationIPVersionService) Get(ctx context.Context, ipVersion RadarHTTPTopLocationIPVersionGetParamsIPVersion, query RadarHTTPTopLocationIPVersionGetParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationIPVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/locations/ip_version/%v", ipVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationIPVersionGetResponse struct { + Result RadarHTTPTopLocationIPVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationIPVersionGetResponseJSON `json:"-"` +} + +// radarHTTPTopLocationIPVersionGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopLocationIPVersionGetResponse] +type radarHTTPTopLocationIPVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationIPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationIPVersionGetResponseResult struct { + Meta RadarHTTPTopLocationIPVersionGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationIPVersionGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationIPVersionGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationIPVersionGetResponseResultJSON contains the JSON metadata +// for the struct [RadarHTTPTopLocationIPVersionGetResponseResult] +type radarHTTPTopLocationIPVersionGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationIPVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationIPVersionGetResponseResultMeta struct { + DateRange []RadarHTTPTopLocationIPVersionGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationIPVersionGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationIPVersionGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationIPVersionGetResponseResultMeta] +type radarHTTPTopLocationIPVersionGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationIPVersionGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationIPVersionGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationIPVersionGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationIPVersionGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopLocationIPVersionGetResponseResultMetaDateRange] +type radarHTTPTopLocationIPVersionGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationIPVersionGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationIPVersionGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationIPVersionGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationIPVersionGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationIPVersionGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationIPVersionGetResponseResultTop0] +type radarHTTPTopLocationIPVersionGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationIPVersionGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationIPVersionGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopLocationIPVersionGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationIPVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopLocationIPVersionGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationIPVersionGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationIPVersionGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopLocationIPVersionGetParamsHTTPVersion] `query:"httpVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopLocationIPVersionGetParamsO] `query:"os"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopLocationIPVersionGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopLocationIPVersionGetParams]'s query parameters +// as `url.Values`. +func (r RadarHTTPTopLocationIPVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// IP version. +type RadarHTTPTopLocationIPVersionGetParamsIPVersion string + +const ( + RadarHTTPTopLocationIPVersionGetParamsIPVersionIPv4 RadarHTTPTopLocationIPVersionGetParamsIPVersion = "IPv4" + RadarHTTPTopLocationIPVersionGetParamsIPVersionIPv6 RadarHTTPTopLocationIPVersionGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationIPVersionGetParamsBotClass string + +const ( + RadarHTTPTopLocationIPVersionGetParamsBotClassLikelyAutomated RadarHTTPTopLocationIPVersionGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationIPVersionGetParamsBotClassLikelyHuman RadarHTTPTopLocationIPVersionGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationIPVersionGetParamsDateRange string + +const ( + RadarHTTPTopLocationIPVersionGetParamsDateRange1d RadarHTTPTopLocationIPVersionGetParamsDateRange = "1d" + RadarHTTPTopLocationIPVersionGetParamsDateRange2d RadarHTTPTopLocationIPVersionGetParamsDateRange = "2d" + RadarHTTPTopLocationIPVersionGetParamsDateRange7d RadarHTTPTopLocationIPVersionGetParamsDateRange = "7d" + RadarHTTPTopLocationIPVersionGetParamsDateRange14d RadarHTTPTopLocationIPVersionGetParamsDateRange = "14d" + RadarHTTPTopLocationIPVersionGetParamsDateRange28d RadarHTTPTopLocationIPVersionGetParamsDateRange = "28d" + RadarHTTPTopLocationIPVersionGetParamsDateRange12w RadarHTTPTopLocationIPVersionGetParamsDateRange = "12w" + RadarHTTPTopLocationIPVersionGetParamsDateRange24w RadarHTTPTopLocationIPVersionGetParamsDateRange = "24w" + RadarHTTPTopLocationIPVersionGetParamsDateRange52w RadarHTTPTopLocationIPVersionGetParamsDateRange = "52w" + RadarHTTPTopLocationIPVersionGetParamsDateRange1dControl RadarHTTPTopLocationIPVersionGetParamsDateRange = "1dControl" + RadarHTTPTopLocationIPVersionGetParamsDateRange2dControl RadarHTTPTopLocationIPVersionGetParamsDateRange = "2dControl" + RadarHTTPTopLocationIPVersionGetParamsDateRange7dControl RadarHTTPTopLocationIPVersionGetParamsDateRange = "7dControl" + RadarHTTPTopLocationIPVersionGetParamsDateRange14dControl RadarHTTPTopLocationIPVersionGetParamsDateRange = "14dControl" + RadarHTTPTopLocationIPVersionGetParamsDateRange28dControl RadarHTTPTopLocationIPVersionGetParamsDateRange = "28dControl" + RadarHTTPTopLocationIPVersionGetParamsDateRange12wControl RadarHTTPTopLocationIPVersionGetParamsDateRange = "12wControl" + RadarHTTPTopLocationIPVersionGetParamsDateRange24wControl RadarHTTPTopLocationIPVersionGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopLocationIPVersionGetParamsDeviceType string + +const ( + RadarHTTPTopLocationIPVersionGetParamsDeviceTypeDesktop RadarHTTPTopLocationIPVersionGetParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationIPVersionGetParamsDeviceTypeMobile RadarHTTPTopLocationIPVersionGetParamsDeviceType = "MOBILE" + RadarHTTPTopLocationIPVersionGetParamsDeviceTypeOther RadarHTTPTopLocationIPVersionGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopLocationIPVersionGetParamsFormat string + +const ( + RadarHTTPTopLocationIPVersionGetParamsFormatJson RadarHTTPTopLocationIPVersionGetParamsFormat = "JSON" + RadarHTTPTopLocationIPVersionGetParamsFormatCsv RadarHTTPTopLocationIPVersionGetParamsFormat = "CSV" +) + +type RadarHTTPTopLocationIPVersionGetParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationIPVersionGetParamsHTTPProtocolHTTP RadarHTTPTopLocationIPVersionGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationIPVersionGetParamsHTTPProtocolHTTPs RadarHTTPTopLocationIPVersionGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationIPVersionGetParamsHTTPVersion string + +const ( + RadarHTTPTopLocationIPVersionGetParamsHTTPVersionHttPv1 RadarHTTPTopLocationIPVersionGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopLocationIPVersionGetParamsHTTPVersionHttPv2 RadarHTTPTopLocationIPVersionGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopLocationIPVersionGetParamsHTTPVersionHttPv3 RadarHTTPTopLocationIPVersionGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopLocationIPVersionGetParamsO string + +const ( + RadarHTTPTopLocationIPVersionGetParamsOWindows RadarHTTPTopLocationIPVersionGetParamsO = "WINDOWS" + RadarHTTPTopLocationIPVersionGetParamsOMacosx RadarHTTPTopLocationIPVersionGetParamsO = "MACOSX" + RadarHTTPTopLocationIPVersionGetParamsOIos RadarHTTPTopLocationIPVersionGetParamsO = "IOS" + RadarHTTPTopLocationIPVersionGetParamsOAndroid RadarHTTPTopLocationIPVersionGetParamsO = "ANDROID" + RadarHTTPTopLocationIPVersionGetParamsOChromeos RadarHTTPTopLocationIPVersionGetParamsO = "CHROMEOS" + RadarHTTPTopLocationIPVersionGetParamsOLinux RadarHTTPTopLocationIPVersionGetParamsO = "LINUX" + RadarHTTPTopLocationIPVersionGetParamsOSmartTv RadarHTTPTopLocationIPVersionGetParamsO = "SMART_TV" +) + +type RadarHTTPTopLocationIPVersionGetParamsTlsVersion string + +const ( + RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSv1_0 RadarHTTPTopLocationIPVersionGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSv1_1 RadarHTTPTopLocationIPVersionGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSv1_2 RadarHTTPTopLocationIPVersionGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSv1_3 RadarHTTPTopLocationIPVersionGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSvQuic RadarHTTPTopLocationIPVersionGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptoplocationipversion_test.go b/radarhttptoplocationipversion_test.go new file mode 100644 index 00000000000..72cadec19ae --- /dev/null +++ b/radarhttptoplocationipversion_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationIPVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.IPVersions.Get( + context.TODO(), + cloudflare.RadarHTTPTopLocationIPVersionGetParamsIPVersionIPv4, + cloudflare.RadarHTTPTopLocationIPVersionGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopLocationIPVersionGetParamsBotClass{cloudflare.RadarHTTPTopLocationIPVersionGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopLocationIPVersionGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationIPVersionGetParamsDateRange{cloudflare.RadarHTTPTopLocationIPVersionGetParamsDateRange1d, cloudflare.RadarHTTPTopLocationIPVersionGetParamsDateRange2d, cloudflare.RadarHTTPTopLocationIPVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopLocationIPVersionGetParamsDeviceType{cloudflare.RadarHTTPTopLocationIPVersionGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopLocationIPVersionGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopLocationIPVersionGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationIPVersionGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationIPVersionGetParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationIPVersionGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationIPVersionGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationIPVersionGetParamsHTTPVersion{cloudflare.RadarHTTPTopLocationIPVersionGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopLocationIPVersionGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopLocationIPVersionGetParamsHTTPVersionHttPv3}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopLocationIPVersionGetParamsO{cloudflare.RadarHTTPTopLocationIPVersionGetParamsOWindows, cloudflare.RadarHTTPTopLocationIPVersionGetParamsOMacosx, cloudflare.RadarHTTPTopLocationIPVersionGetParamsOIos}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationIPVersionGetParamsTlsVersion{cloudflare.RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopLocationIPVersionGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptoplocationo.go b/radarhttptoplocationo.go new file mode 100644 index 00000000000..542b3cf46cd --- /dev/null +++ b/radarhttptoplocationo.go @@ -0,0 +1,330 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationOService 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 [NewRadarHTTPTopLocationOService] +// method instead. +type RadarHTTPTopLocationOService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopLocationOService 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 NewRadarHTTPTopLocationOService(opts ...option.RequestOption) (r *RadarHTTPTopLocationOService) { + r = &RadarHTTPTopLocationOService{} + r.Options = opts + return +} + +// Get the top locations, by HTTP traffic, of the requested operating systems. +// Values are a percentage out of the total traffic. +func (r *RadarHTTPTopLocationOService) Get(ctx context.Context, os RadarHTTPTopLocationOGetParamsOs, query RadarHTTPTopLocationOGetParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationOGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/locations/os/%v", os) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationOGetResponse struct { + Result RadarHTTPTopLocationOGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationOGetResponseJSON `json:"-"` +} + +// radarHTTPTopLocationOGetResponseJSON contains the JSON metadata for the struct +// [RadarHTTPTopLocationOGetResponse] +type radarHTTPTopLocationOGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationOGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationOGetResponseResult struct { + Meta RadarHTTPTopLocationOGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationOGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationOGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationOGetResponseResultJSON contains the JSON metadata for the +// struct [RadarHTTPTopLocationOGetResponseResult] +type radarHTTPTopLocationOGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationOGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationOGetResponseResultMeta struct { + DateRange []RadarHTTPTopLocationOGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationOGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationOGetResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarHTTPTopLocationOGetResponseResultMeta] +type radarHTTPTopLocationOGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationOGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationOGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationOGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationOGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationOGetResponseResultMetaDateRange] +type radarHTTPTopLocationOGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationOGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationOGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationOGetResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationOGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationOGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationOGetResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationOGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationOGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationOGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationOGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationOGetResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarHTTPTopLocationOGetResponseResultTop0] +type radarHTTPTopLocationOGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationOGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationOGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopLocationOGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationOGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopLocationOGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationOGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationOGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopLocationOGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopLocationOGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for tls version. + TlsVersion param.Field[[]RadarHTTPTopLocationOGetParamsTlsVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [RadarHTTPTopLocationOGetParams]'s query parameters as +// `url.Values`. +func (r RadarHTTPTopLocationOGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// IP version. +type RadarHTTPTopLocationOGetParamsOs string + +const ( + RadarHTTPTopLocationOGetParamsOsWindows RadarHTTPTopLocationOGetParamsOs = "WINDOWS" + RadarHTTPTopLocationOGetParamsOsMacosx RadarHTTPTopLocationOGetParamsOs = "MACOSX" + RadarHTTPTopLocationOGetParamsOsIos RadarHTTPTopLocationOGetParamsOs = "IOS" + RadarHTTPTopLocationOGetParamsOsAndroid RadarHTTPTopLocationOGetParamsOs = "ANDROID" + RadarHTTPTopLocationOGetParamsOsChromeos RadarHTTPTopLocationOGetParamsOs = "CHROMEOS" + RadarHTTPTopLocationOGetParamsOsLinux RadarHTTPTopLocationOGetParamsOs = "LINUX" + RadarHTTPTopLocationOGetParamsOsSmartTv RadarHTTPTopLocationOGetParamsOs = "SMART_TV" +) + +type RadarHTTPTopLocationOGetParamsBotClass string + +const ( + RadarHTTPTopLocationOGetParamsBotClassLikelyAutomated RadarHTTPTopLocationOGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationOGetParamsBotClassLikelyHuman RadarHTTPTopLocationOGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationOGetParamsDateRange string + +const ( + RadarHTTPTopLocationOGetParamsDateRange1d RadarHTTPTopLocationOGetParamsDateRange = "1d" + RadarHTTPTopLocationOGetParamsDateRange2d RadarHTTPTopLocationOGetParamsDateRange = "2d" + RadarHTTPTopLocationOGetParamsDateRange7d RadarHTTPTopLocationOGetParamsDateRange = "7d" + RadarHTTPTopLocationOGetParamsDateRange14d RadarHTTPTopLocationOGetParamsDateRange = "14d" + RadarHTTPTopLocationOGetParamsDateRange28d RadarHTTPTopLocationOGetParamsDateRange = "28d" + RadarHTTPTopLocationOGetParamsDateRange12w RadarHTTPTopLocationOGetParamsDateRange = "12w" + RadarHTTPTopLocationOGetParamsDateRange24w RadarHTTPTopLocationOGetParamsDateRange = "24w" + RadarHTTPTopLocationOGetParamsDateRange52w RadarHTTPTopLocationOGetParamsDateRange = "52w" + RadarHTTPTopLocationOGetParamsDateRange1dControl RadarHTTPTopLocationOGetParamsDateRange = "1dControl" + RadarHTTPTopLocationOGetParamsDateRange2dControl RadarHTTPTopLocationOGetParamsDateRange = "2dControl" + RadarHTTPTopLocationOGetParamsDateRange7dControl RadarHTTPTopLocationOGetParamsDateRange = "7dControl" + RadarHTTPTopLocationOGetParamsDateRange14dControl RadarHTTPTopLocationOGetParamsDateRange = "14dControl" + RadarHTTPTopLocationOGetParamsDateRange28dControl RadarHTTPTopLocationOGetParamsDateRange = "28dControl" + RadarHTTPTopLocationOGetParamsDateRange12wControl RadarHTTPTopLocationOGetParamsDateRange = "12wControl" + RadarHTTPTopLocationOGetParamsDateRange24wControl RadarHTTPTopLocationOGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopLocationOGetParamsDeviceType string + +const ( + RadarHTTPTopLocationOGetParamsDeviceTypeDesktop RadarHTTPTopLocationOGetParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationOGetParamsDeviceTypeMobile RadarHTTPTopLocationOGetParamsDeviceType = "MOBILE" + RadarHTTPTopLocationOGetParamsDeviceTypeOther RadarHTTPTopLocationOGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopLocationOGetParamsFormat string + +const ( + RadarHTTPTopLocationOGetParamsFormatJson RadarHTTPTopLocationOGetParamsFormat = "JSON" + RadarHTTPTopLocationOGetParamsFormatCsv RadarHTTPTopLocationOGetParamsFormat = "CSV" +) + +type RadarHTTPTopLocationOGetParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationOGetParamsHTTPProtocolHTTP RadarHTTPTopLocationOGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationOGetParamsHTTPProtocolHTTPs RadarHTTPTopLocationOGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationOGetParamsHTTPVersion string + +const ( + RadarHTTPTopLocationOGetParamsHTTPVersionHttPv1 RadarHTTPTopLocationOGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopLocationOGetParamsHTTPVersionHttPv2 RadarHTTPTopLocationOGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopLocationOGetParamsHTTPVersionHttPv3 RadarHTTPTopLocationOGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopLocationOGetParamsIPVersion string + +const ( + RadarHTTPTopLocationOGetParamsIPVersionIPv4 RadarHTTPTopLocationOGetParamsIPVersion = "IPv4" + RadarHTTPTopLocationOGetParamsIPVersionIPv6 RadarHTTPTopLocationOGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationOGetParamsTlsVersion string + +const ( + RadarHTTPTopLocationOGetParamsTlsVersionTlSv1_0 RadarHTTPTopLocationOGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationOGetParamsTlsVersionTlSv1_1 RadarHTTPTopLocationOGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationOGetParamsTlsVersionTlSv1_2 RadarHTTPTopLocationOGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationOGetParamsTlsVersionTlSv1_3 RadarHTTPTopLocationOGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationOGetParamsTlsVersionTlSvQuic RadarHTTPTopLocationOGetParamsTlsVersion = "TLSvQUIC" +) diff --git a/radarhttptoplocationo_test.go b/radarhttptoplocationo_test.go new file mode 100644 index 00000000000..2667baca2f2 --- /dev/null +++ b/radarhttptoplocationo_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationOGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.Os.Get( + context.TODO(), + cloudflare.RadarHTTPTopLocationOGetParamsOsWindows, + cloudflare.RadarHTTPTopLocationOGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopLocationOGetParamsBotClass{cloudflare.RadarHTTPTopLocationOGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopLocationOGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationOGetParamsDateRange{cloudflare.RadarHTTPTopLocationOGetParamsDateRange1d, cloudflare.RadarHTTPTopLocationOGetParamsDateRange2d, cloudflare.RadarHTTPTopLocationOGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopLocationOGetParamsDeviceType{cloudflare.RadarHTTPTopLocationOGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopLocationOGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopLocationOGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationOGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationOGetParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationOGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationOGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationOGetParamsHTTPVersion{cloudflare.RadarHTTPTopLocationOGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopLocationOGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopLocationOGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationOGetParamsIPVersion{cloudflare.RadarHTTPTopLocationOGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopLocationOGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + TlsVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationOGetParamsTlsVersion{cloudflare.RadarHTTPTopLocationOGetParamsTlsVersionTlSv1_0, cloudflare.RadarHTTPTopLocationOGetParamsTlsVersionTlSv1_1, cloudflare.RadarHTTPTopLocationOGetParamsTlsVersionTlSv1_2}), + }, + ) + 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/radarhttptoplocationtlsversion.go b/radarhttptoplocationtlsversion.go new file mode 100644 index 00000000000..89defb1dc8f --- /dev/null +++ b/radarhttptoplocationtlsversion.go @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarHTTPTopLocationTlsVersionService 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 +// [NewRadarHTTPTopLocationTlsVersionService] method instead. +type RadarHTTPTopLocationTlsVersionService struct { + Options []option.RequestOption +} + +// NewRadarHTTPTopLocationTlsVersionService 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 NewRadarHTTPTopLocationTlsVersionService(opts ...option.RequestOption) (r *RadarHTTPTopLocationTlsVersionService) { + r = &RadarHTTPTopLocationTlsVersionService{} + r.Options = opts + return +} + +// Get the top locations, by HTTP traffic, of the requested TLS protocol version. +// Values are a percentage out of the total traffic. +func (r *RadarHTTPTopLocationTlsVersionService) Get(ctx context.Context, tlsVersion RadarHTTPTopLocationTlsVersionGetParamsTlsVersion, query RadarHTTPTopLocationTlsVersionGetParams, opts ...option.RequestOption) (res *RadarHTTPTopLocationTlsVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/http/top/locations/tls_version/%v", tlsVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarHTTPTopLocationTlsVersionGetResponse struct { + Result RadarHTTPTopLocationTlsVersionGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarHTTPTopLocationTlsVersionGetResponseJSON `json:"-"` +} + +// radarHTTPTopLocationTlsVersionGetResponseJSON contains the JSON metadata for the +// struct [RadarHTTPTopLocationTlsVersionGetResponse] +type radarHTTPTopLocationTlsVersionGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationTlsVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationTlsVersionGetResponseResult struct { + Meta RadarHTTPTopLocationTlsVersionGetResponseResultMeta `json:"meta,required"` + Top0 []RadarHTTPTopLocationTlsVersionGetResponseResultTop0 `json:"top_0,required"` + JSON radarHTTPTopLocationTlsVersionGetResponseResultJSON `json:"-"` +} + +// radarHTTPTopLocationTlsVersionGetResponseResultJSON contains the JSON metadata +// for the struct [RadarHTTPTopLocationTlsVersionGetResponseResult] +type radarHTTPTopLocationTlsVersionGetResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationTlsVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationTlsVersionGetResponseResultMeta struct { + DateRange []RadarHTTPTopLocationTlsVersionGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarHTTPTopLocationTlsVersionGetResponseResultMetaJSON `json:"-"` +} + +// radarHTTPTopLocationTlsVersionGetResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationTlsVersionGetResponseResultMeta] +type radarHTTPTopLocationTlsVersionGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationTlsVersionGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationTlsVersionGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarHTTPTopLocationTlsVersionGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarHTTPTopLocationTlsVersionGetResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarHTTPTopLocationTlsVersionGetResponseResultMetaDateRange] +type radarHTTPTopLocationTlsVersionGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationTlsVersionGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfo] +type radarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoAnnotation] +type radarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationTlsVersionGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationTlsVersionGetResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarHTTPTopLocationTlsVersionGetResponseResultTop0JSON `json:"-"` +} + +// radarHTTPTopLocationTlsVersionGetResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarHTTPTopLocationTlsVersionGetResponseResultTop0] +type radarHTTPTopLocationTlsVersionGetResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarHTTPTopLocationTlsVersionGetResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarHTTPTopLocationTlsVersionGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]RadarHTTPTopLocationTlsVersionGetParamsBotClass] `query:"botClass"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarHTTPTopLocationTlsVersionGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]RadarHTTPTopLocationTlsVersionGetParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[RadarHTTPTopLocationTlsVersionGetParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]RadarHTTPTopLocationTlsVersionGetParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]RadarHTTPTopLocationTlsVersionGetParamsIPVersion] `query:"ipVersion"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + Os param.Field[[]RadarHTTPTopLocationTlsVersionGetParamsO] `query:"os"` +} + +// URLQuery serializes [RadarHTTPTopLocationTlsVersionGetParams]'s query parameters +// as `url.Values`. +func (r RadarHTTPTopLocationTlsVersionGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// TLS version. +type RadarHTTPTopLocationTlsVersionGetParamsTlsVersion string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsTlsVersionTlSv1_0 RadarHTTPTopLocationTlsVersionGetParamsTlsVersion = "TLSv1_0" + RadarHTTPTopLocationTlsVersionGetParamsTlsVersionTlSv1_1 RadarHTTPTopLocationTlsVersionGetParamsTlsVersion = "TLSv1_1" + RadarHTTPTopLocationTlsVersionGetParamsTlsVersionTlSv1_2 RadarHTTPTopLocationTlsVersionGetParamsTlsVersion = "TLSv1_2" + RadarHTTPTopLocationTlsVersionGetParamsTlsVersionTlSv1_3 RadarHTTPTopLocationTlsVersionGetParamsTlsVersion = "TLSv1_3" + RadarHTTPTopLocationTlsVersionGetParamsTlsVersionTlSvQuic RadarHTTPTopLocationTlsVersionGetParamsTlsVersion = "TLSvQUIC" +) + +type RadarHTTPTopLocationTlsVersionGetParamsBotClass string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsBotClassLikelyAutomated RadarHTTPTopLocationTlsVersionGetParamsBotClass = "LIKELY_AUTOMATED" + RadarHTTPTopLocationTlsVersionGetParamsBotClassLikelyHuman RadarHTTPTopLocationTlsVersionGetParamsBotClass = "LIKELY_HUMAN" +) + +type RadarHTTPTopLocationTlsVersionGetParamsDateRange string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsDateRange1d RadarHTTPTopLocationTlsVersionGetParamsDateRange = "1d" + RadarHTTPTopLocationTlsVersionGetParamsDateRange2d RadarHTTPTopLocationTlsVersionGetParamsDateRange = "2d" + RadarHTTPTopLocationTlsVersionGetParamsDateRange7d RadarHTTPTopLocationTlsVersionGetParamsDateRange = "7d" + RadarHTTPTopLocationTlsVersionGetParamsDateRange14d RadarHTTPTopLocationTlsVersionGetParamsDateRange = "14d" + RadarHTTPTopLocationTlsVersionGetParamsDateRange28d RadarHTTPTopLocationTlsVersionGetParamsDateRange = "28d" + RadarHTTPTopLocationTlsVersionGetParamsDateRange12w RadarHTTPTopLocationTlsVersionGetParamsDateRange = "12w" + RadarHTTPTopLocationTlsVersionGetParamsDateRange24w RadarHTTPTopLocationTlsVersionGetParamsDateRange = "24w" + RadarHTTPTopLocationTlsVersionGetParamsDateRange52w RadarHTTPTopLocationTlsVersionGetParamsDateRange = "52w" + RadarHTTPTopLocationTlsVersionGetParamsDateRange1dControl RadarHTTPTopLocationTlsVersionGetParamsDateRange = "1dControl" + RadarHTTPTopLocationTlsVersionGetParamsDateRange2dControl RadarHTTPTopLocationTlsVersionGetParamsDateRange = "2dControl" + RadarHTTPTopLocationTlsVersionGetParamsDateRange7dControl RadarHTTPTopLocationTlsVersionGetParamsDateRange = "7dControl" + RadarHTTPTopLocationTlsVersionGetParamsDateRange14dControl RadarHTTPTopLocationTlsVersionGetParamsDateRange = "14dControl" + RadarHTTPTopLocationTlsVersionGetParamsDateRange28dControl RadarHTTPTopLocationTlsVersionGetParamsDateRange = "28dControl" + RadarHTTPTopLocationTlsVersionGetParamsDateRange12wControl RadarHTTPTopLocationTlsVersionGetParamsDateRange = "12wControl" + RadarHTTPTopLocationTlsVersionGetParamsDateRange24wControl RadarHTTPTopLocationTlsVersionGetParamsDateRange = "24wControl" +) + +type RadarHTTPTopLocationTlsVersionGetParamsDeviceType string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsDeviceTypeDesktop RadarHTTPTopLocationTlsVersionGetParamsDeviceType = "DESKTOP" + RadarHTTPTopLocationTlsVersionGetParamsDeviceTypeMobile RadarHTTPTopLocationTlsVersionGetParamsDeviceType = "MOBILE" + RadarHTTPTopLocationTlsVersionGetParamsDeviceTypeOther RadarHTTPTopLocationTlsVersionGetParamsDeviceType = "OTHER" +) + +// Format results are returned in. +type RadarHTTPTopLocationTlsVersionGetParamsFormat string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsFormatJson RadarHTTPTopLocationTlsVersionGetParamsFormat = "JSON" + RadarHTTPTopLocationTlsVersionGetParamsFormatCsv RadarHTTPTopLocationTlsVersionGetParamsFormat = "CSV" +) + +type RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocol string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocolHTTP RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocol = "HTTP" + RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocolHTTPs RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocol = "HTTPS" +) + +type RadarHTTPTopLocationTlsVersionGetParamsHTTPVersion string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsHTTPVersionHttPv1 RadarHTTPTopLocationTlsVersionGetParamsHTTPVersion = "HTTPv1" + RadarHTTPTopLocationTlsVersionGetParamsHTTPVersionHttPv2 RadarHTTPTopLocationTlsVersionGetParamsHTTPVersion = "HTTPv2" + RadarHTTPTopLocationTlsVersionGetParamsHTTPVersionHttPv3 RadarHTTPTopLocationTlsVersionGetParamsHTTPVersion = "HTTPv3" +) + +type RadarHTTPTopLocationTlsVersionGetParamsIPVersion string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsIPVersionIPv4 RadarHTTPTopLocationTlsVersionGetParamsIPVersion = "IPv4" + RadarHTTPTopLocationTlsVersionGetParamsIPVersionIPv6 RadarHTTPTopLocationTlsVersionGetParamsIPVersion = "IPv6" +) + +type RadarHTTPTopLocationTlsVersionGetParamsO string + +const ( + RadarHTTPTopLocationTlsVersionGetParamsOWindows RadarHTTPTopLocationTlsVersionGetParamsO = "WINDOWS" + RadarHTTPTopLocationTlsVersionGetParamsOMacosx RadarHTTPTopLocationTlsVersionGetParamsO = "MACOSX" + RadarHTTPTopLocationTlsVersionGetParamsOIos RadarHTTPTopLocationTlsVersionGetParamsO = "IOS" + RadarHTTPTopLocationTlsVersionGetParamsOAndroid RadarHTTPTopLocationTlsVersionGetParamsO = "ANDROID" + RadarHTTPTopLocationTlsVersionGetParamsOChromeos RadarHTTPTopLocationTlsVersionGetParamsO = "CHROMEOS" + RadarHTTPTopLocationTlsVersionGetParamsOLinux RadarHTTPTopLocationTlsVersionGetParamsO = "LINUX" + RadarHTTPTopLocationTlsVersionGetParamsOSmartTv RadarHTTPTopLocationTlsVersionGetParamsO = "SMART_TV" +) diff --git a/radarhttptoplocationtlsversion_test.go b/radarhttptoplocationtlsversion_test.go new file mode 100644 index 00000000000..7be92916060 --- /dev/null +++ b/radarhttptoplocationtlsversion_test.go @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarHTTPTopLocationTlsVersionGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.HTTP.Tops.Locations.TlsVersions.Get( + context.TODO(), + cloudflare.RadarHTTPTopLocationTlsVersionGetParamsTlsVersionTlSv1_0, + cloudflare.RadarHTTPTopLocationTlsVersionGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]cloudflare.RadarHTTPTopLocationTlsVersionGetParamsBotClass{cloudflare.RadarHTTPTopLocationTlsVersionGetParamsBotClassLikelyAutomated, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsBotClassLikelyHuman}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDateRange{cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDateRange1d, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDateRange2d, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDeviceType{cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDeviceTypeDesktop, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDeviceTypeMobile, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsDeviceTypeOther}), + Format: cloudflare.F(cloudflare.RadarHTTPTopLocationTlsVersionGetParamsFormatJson), + HTTPProtocol: cloudflare.F([]cloudflare.RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocol{cloudflare.RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocolHTTP, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsHTTPProtocolHTTPs}), + HTTPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationTlsVersionGetParamsHTTPVersion{cloudflare.RadarHTTPTopLocationTlsVersionGetParamsHTTPVersionHttPv1, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsHTTPVersionHttPv2, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]cloudflare.RadarHTTPTopLocationTlsVersionGetParamsIPVersion{cloudflare.RadarHTTPTopLocationTlsVersionGetParamsIPVersionIPv4, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsIPVersionIPv6}), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Os: cloudflare.F([]cloudflare.RadarHTTPTopLocationTlsVersionGetParamsO{cloudflare.RadarHTTPTopLocationTlsVersionGetParamsOWindows, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsOMacosx, cloudflare.RadarHTTPTopLocationTlsVersionGetParamsOIos}), + }, + ) + 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/radarnetflow.go b/radarnetflow.go new file mode 100644 index 00000000000..c9056903000 --- /dev/null +++ b/radarnetflow.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarNetflowService 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 [NewRadarNetflowService] method +// instead. +type RadarNetflowService struct { + Options []option.RequestOption + Timeseries *RadarNetflowTimeseryService + Tops *RadarNetflowTopService +} + +// NewRadarNetflowService 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 NewRadarNetflowService(opts ...option.RequestOption) (r *RadarNetflowService) { + r = &RadarNetflowService{} + r.Options = opts + r.Timeseries = NewRadarNetflowTimeseryService(opts...) + r.Tops = NewRadarNetflowTopService(opts...) + return +} diff --git a/radarnetflowtimesery.go b/radarnetflowtimesery.go new file mode 100644 index 00000000000..cb6074ac279 --- /dev/null +++ b/radarnetflowtimesery.go @@ -0,0 +1,291 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarNetflowTimeseryService 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 [NewRadarNetflowTimeseryService] +// method instead. +type RadarNetflowTimeseryService struct { + Options []option.RequestOption +} + +// NewRadarNetflowTimeseryService 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 NewRadarNetflowTimeseryService(opts ...option.RequestOption) (r *RadarNetflowTimeseryService) { + r = &RadarNetflowTimeseryService{} + r.Options = opts + return +} + +// Get network traffic change over time. Visit +// https://en.wikipedia.org/wiki/NetFlow for more information on NetFlows. +func (r *RadarNetflowTimeseryService) List(ctx context.Context, query RadarNetflowTimeseryListParams, opts ...option.RequestOption) (res *RadarNetflowTimeseryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/netflows/timeseries" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarNetflowTimeseryListResponse struct { + Result RadarNetflowTimeseryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarNetflowTimeseryListResponseJSON `json:"-"` +} + +// radarNetflowTimeseryListResponseJSON contains the JSON metadata for the struct +// [RadarNetflowTimeseryListResponse] +type radarNetflowTimeseryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTimeseryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTimeseryListResponseResult struct { + Meta RadarNetflowTimeseryListResponseResultMeta `json:"meta,required"` + Serie0 RadarNetflowTimeseryListResponseResultSerie0 `json:"serie_0,required"` + JSON radarNetflowTimeseryListResponseResultJSON `json:"-"` +} + +// radarNetflowTimeseryListResponseResultJSON contains the JSON metadata for the +// struct [RadarNetflowTimeseryListResponseResult] +type radarNetflowTimeseryListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTimeseryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTimeseryListResponseResultMeta struct { + AggInterval string `json:"aggInterval,required"` + DateRange []RadarNetflowTimeseryListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated time.Time `json:"lastUpdated,required" format:"date-time"` + ConfidenceInfo RadarNetflowTimeseryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarNetflowTimeseryListResponseResultMetaJSON `json:"-"` +} + +// radarNetflowTimeseryListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarNetflowTimeseryListResponseResultMeta] +type radarNetflowTimeseryListResponseResultMetaJSON struct { + AggInterval apijson.Field + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTimeseryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTimeseryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarNetflowTimeseryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarNetflowTimeseryListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarNetflowTimeseryListResponseResultMetaDateRange] +type radarNetflowTimeseryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTimeseryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTimeseryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarNetflowTimeseryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarNetflowTimeseryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarNetflowTimeseryListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarNetflowTimeseryListResponseResultMetaConfidenceInfo] +type radarNetflowTimeseryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTimeseryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTimeseryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarNetflowTimeseryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarNetflowTimeseryListResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarNetflowTimeseryListResponseResultMetaConfidenceInfoAnnotation] +type radarNetflowTimeseryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTimeseryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTimeseryListResponseResultSerie0 struct { + Timestamps []time.Time `json:"timestamps,required" format:"date-time"` + Values []string `json:"values,required"` + JSON radarNetflowTimeseryListResponseResultSerie0JSON `json:"-"` +} + +// radarNetflowTimeseryListResponseResultSerie0JSON contains the JSON metadata for +// the struct [RadarNetflowTimeseryListResponseResultSerie0] +type radarNetflowTimeseryListResponseResultSerie0JSON struct { + Timestamps apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTimeseryListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTimeseryListParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarNetflowTimeseryListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarNetflowTimeseryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarNetflowTimeseryListParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Normalization method applied. Refer to + // [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + Normalization param.Field[RadarNetflowTimeseryListParamsNormalization] `query:"normalization"` + // Array of network traffic product types. + Product param.Field[[]RadarNetflowTimeseryListParamsProduct] `query:"product"` +} + +// URLQuery serializes [RadarNetflowTimeseryListParams]'s query parameters as +// `url.Values`. +func (r RadarNetflowTimeseryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarNetflowTimeseryListParamsAggInterval string + +const ( + RadarNetflowTimeseryListParamsAggInterval15m RadarNetflowTimeseryListParamsAggInterval = "15m" + RadarNetflowTimeseryListParamsAggInterval1h RadarNetflowTimeseryListParamsAggInterval = "1h" + RadarNetflowTimeseryListParamsAggInterval1d RadarNetflowTimeseryListParamsAggInterval = "1d" + RadarNetflowTimeseryListParamsAggInterval1w RadarNetflowTimeseryListParamsAggInterval = "1w" +) + +type RadarNetflowTimeseryListParamsDateRange string + +const ( + RadarNetflowTimeseryListParamsDateRange1d RadarNetflowTimeseryListParamsDateRange = "1d" + RadarNetflowTimeseryListParamsDateRange2d RadarNetflowTimeseryListParamsDateRange = "2d" + RadarNetflowTimeseryListParamsDateRange7d RadarNetflowTimeseryListParamsDateRange = "7d" + RadarNetflowTimeseryListParamsDateRange14d RadarNetflowTimeseryListParamsDateRange = "14d" + RadarNetflowTimeseryListParamsDateRange28d RadarNetflowTimeseryListParamsDateRange = "28d" + RadarNetflowTimeseryListParamsDateRange12w RadarNetflowTimeseryListParamsDateRange = "12w" + RadarNetflowTimeseryListParamsDateRange24w RadarNetflowTimeseryListParamsDateRange = "24w" + RadarNetflowTimeseryListParamsDateRange52w RadarNetflowTimeseryListParamsDateRange = "52w" + RadarNetflowTimeseryListParamsDateRange1dControl RadarNetflowTimeseryListParamsDateRange = "1dControl" + RadarNetflowTimeseryListParamsDateRange2dControl RadarNetflowTimeseryListParamsDateRange = "2dControl" + RadarNetflowTimeseryListParamsDateRange7dControl RadarNetflowTimeseryListParamsDateRange = "7dControl" + RadarNetflowTimeseryListParamsDateRange14dControl RadarNetflowTimeseryListParamsDateRange = "14dControl" + RadarNetflowTimeseryListParamsDateRange28dControl RadarNetflowTimeseryListParamsDateRange = "28dControl" + RadarNetflowTimeseryListParamsDateRange12wControl RadarNetflowTimeseryListParamsDateRange = "12wControl" + RadarNetflowTimeseryListParamsDateRange24wControl RadarNetflowTimeseryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarNetflowTimeseryListParamsFormat string + +const ( + RadarNetflowTimeseryListParamsFormatJson RadarNetflowTimeseryListParamsFormat = "JSON" + RadarNetflowTimeseryListParamsFormatCsv RadarNetflowTimeseryListParamsFormat = "CSV" +) + +// Normalization method applied. Refer to +// [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). +type RadarNetflowTimeseryListParamsNormalization string + +const ( + RadarNetflowTimeseryListParamsNormalizationPercentageChange RadarNetflowTimeseryListParamsNormalization = "PERCENTAGE_CHANGE" + RadarNetflowTimeseryListParamsNormalizationMin0Max RadarNetflowTimeseryListParamsNormalization = "MIN0_MAX" +) + +type RadarNetflowTimeseryListParamsProduct string + +const ( + RadarNetflowTimeseryListParamsProductHTTP RadarNetflowTimeseryListParamsProduct = "HTTP" + RadarNetflowTimeseryListParamsProductAll RadarNetflowTimeseryListParamsProduct = "ALL" +) diff --git a/radarnetflowtimesery_test.go b/radarnetflowtimesery_test.go new file mode 100644 index 00000000000..a5baeb7cab0 --- /dev/null +++ b/radarnetflowtimesery_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarNetflowTimeseryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Netflows.Timeseries.List(context.TODO(), cloudflare.RadarNetflowTimeseryListParams{ + AggInterval: cloudflare.F(cloudflare.RadarNetflowTimeseryListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarNetflowTimeseryListParamsDateRange{cloudflare.RadarNetflowTimeseryListParamsDateRange1d, cloudflare.RadarNetflowTimeseryListParamsDateRange2d, cloudflare.RadarNetflowTimeseryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarNetflowTimeseryListParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + Normalization: cloudflare.F(cloudflare.RadarNetflowTimeseryListParamsNormalizationMin0Max), + Product: cloudflare.F([]cloudflare.RadarNetflowTimeseryListParamsProduct{cloudflare.RadarNetflowTimeseryListParamsProductHTTP, cloudflare.RadarNetflowTimeseryListParamsProductAll}), + }) + 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/radarnetflowtop.go b/radarnetflowtop.go new file mode 100644 index 00000000000..4fcb79d405d --- /dev/null +++ b/radarnetflowtop.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarNetflowTopService 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 [NewRadarNetflowTopService] method +// instead. +type RadarNetflowTopService struct { + Options []option.RequestOption + Ases *RadarNetflowTopAseService + Locations *RadarNetflowTopLocationService +} + +// NewRadarNetflowTopService 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 NewRadarNetflowTopService(opts ...option.RequestOption) (r *RadarNetflowTopService) { + r = &RadarNetflowTopService{} + r.Options = opts + r.Ases = NewRadarNetflowTopAseService(opts...) + r.Locations = NewRadarNetflowTopLocationService(opts...) + return +} diff --git a/radarnetflowtopase.go b/radarnetflowtopase.go new file mode 100644 index 00000000000..6de6de396ab --- /dev/null +++ b/radarnetflowtopase.go @@ -0,0 +1,162 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarNetflowTopAseService 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 [NewRadarNetflowTopAseService] method +// instead. +type RadarNetflowTopAseService struct { + Options []option.RequestOption +} + +// NewRadarNetflowTopAseService 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 NewRadarNetflowTopAseService(opts ...option.RequestOption) (r *RadarNetflowTopAseService) { + r = &RadarNetflowTopAseService{} + r.Options = opts + return +} + +// Get the top autonomous systems (AS) by network traffic (NetFlows) over a given +// time period. Visit https://en.wikipedia.org/wiki/NetFlow for more information. +func (r *RadarNetflowTopAseService) List(ctx context.Context, query RadarNetflowTopAseListParams, opts ...option.RequestOption) (res *RadarNetflowTopAseListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/netflows/top/ases" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarNetflowTopAseListResponse struct { + Result RadarNetflowTopAseListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarNetflowTopAseListResponseJSON `json:"-"` +} + +// radarNetflowTopAseListResponseJSON contains the JSON metadata for the struct +// [RadarNetflowTopAseListResponse] +type radarNetflowTopAseListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTopAseListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTopAseListResponseResult struct { + Top0 []RadarNetflowTopAseListResponseResultTop0 `json:"top_0,required"` + JSON radarNetflowTopAseListResponseResultJSON `json:"-"` +} + +// radarNetflowTopAseListResponseResultJSON contains the JSON metadata for the +// struct [RadarNetflowTopAseListResponseResult] +type radarNetflowTopAseListResponseResultJSON struct { + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTopAseListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTopAseListResponseResultTop0 struct { + ClientASN float64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + Value string `json:"value,required"` + JSON radarNetflowTopAseListResponseResultTop0JSON `json:"-"` +} + +// radarNetflowTopAseListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarNetflowTopAseListResponseResultTop0] +type radarNetflowTopAseListResponseResultTop0JSON struct { + ClientASN apijson.Field + ClientAsName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTopAseListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTopAseListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarNetflowTopAseListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarNetflowTopAseListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarNetflowTopAseListParams]'s query parameters as +// `url.Values`. +func (r RadarNetflowTopAseListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarNetflowTopAseListParamsDateRange string + +const ( + RadarNetflowTopAseListParamsDateRange1d RadarNetflowTopAseListParamsDateRange = "1d" + RadarNetflowTopAseListParamsDateRange2d RadarNetflowTopAseListParamsDateRange = "2d" + RadarNetflowTopAseListParamsDateRange7d RadarNetflowTopAseListParamsDateRange = "7d" + RadarNetflowTopAseListParamsDateRange14d RadarNetflowTopAseListParamsDateRange = "14d" + RadarNetflowTopAseListParamsDateRange28d RadarNetflowTopAseListParamsDateRange = "28d" + RadarNetflowTopAseListParamsDateRange12w RadarNetflowTopAseListParamsDateRange = "12w" + RadarNetflowTopAseListParamsDateRange24w RadarNetflowTopAseListParamsDateRange = "24w" + RadarNetflowTopAseListParamsDateRange52w RadarNetflowTopAseListParamsDateRange = "52w" + RadarNetflowTopAseListParamsDateRange1dControl RadarNetflowTopAseListParamsDateRange = "1dControl" + RadarNetflowTopAseListParamsDateRange2dControl RadarNetflowTopAseListParamsDateRange = "2dControl" + RadarNetflowTopAseListParamsDateRange7dControl RadarNetflowTopAseListParamsDateRange = "7dControl" + RadarNetflowTopAseListParamsDateRange14dControl RadarNetflowTopAseListParamsDateRange = "14dControl" + RadarNetflowTopAseListParamsDateRange28dControl RadarNetflowTopAseListParamsDateRange = "28dControl" + RadarNetflowTopAseListParamsDateRange12wControl RadarNetflowTopAseListParamsDateRange = "12wControl" + RadarNetflowTopAseListParamsDateRange24wControl RadarNetflowTopAseListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarNetflowTopAseListParamsFormat string + +const ( + RadarNetflowTopAseListParamsFormatJson RadarNetflowTopAseListParamsFormat = "JSON" + RadarNetflowTopAseListParamsFormatCsv RadarNetflowTopAseListParamsFormat = "CSV" +) diff --git a/radarnetflowtopase_test.go b/radarnetflowtopase_test.go new file mode 100644 index 00000000000..77b4c4a4c32 --- /dev/null +++ b/radarnetflowtopase_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarNetflowTopAseListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Netflows.Tops.Ases.List(context.TODO(), cloudflare.RadarNetflowTopAseListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarNetflowTopAseListParamsDateRange{cloudflare.RadarNetflowTopAseListParamsDateRange1d, cloudflare.RadarNetflowTopAseListParamsDateRange2d, cloudflare.RadarNetflowTopAseListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarNetflowTopAseListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarnetflowtoplocation.go b/radarnetflowtoplocation.go new file mode 100644 index 00000000000..a99d063fc2b --- /dev/null +++ b/radarnetflowtoplocation.go @@ -0,0 +1,162 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarNetflowTopLocationService 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 +// [NewRadarNetflowTopLocationService] method instead. +type RadarNetflowTopLocationService struct { + Options []option.RequestOption +} + +// NewRadarNetflowTopLocationService 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 NewRadarNetflowTopLocationService(opts ...option.RequestOption) (r *RadarNetflowTopLocationService) { + r = &RadarNetflowTopLocationService{} + r.Options = opts + return +} + +// Get the top locations by network traffic (NetFlows) over a given time period. +// Visit https://en.wikipedia.org/wiki/NetFlow for more information. +func (r *RadarNetflowTopLocationService) List(ctx context.Context, query RadarNetflowTopLocationListParams, opts ...option.RequestOption) (res *RadarNetflowTopLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/netflows/top/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarNetflowTopLocationListResponse struct { + Result RadarNetflowTopLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarNetflowTopLocationListResponseJSON `json:"-"` +} + +// radarNetflowTopLocationListResponseJSON contains the JSON metadata for the +// struct [RadarNetflowTopLocationListResponse] +type radarNetflowTopLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTopLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTopLocationListResponseResult struct { + Top0 []RadarNetflowTopLocationListResponseResultTop0 `json:"top_0,required"` + JSON radarNetflowTopLocationListResponseResultJSON `json:"-"` +} + +// radarNetflowTopLocationListResponseResultJSON contains the JSON metadata for the +// struct [RadarNetflowTopLocationListResponseResult] +type radarNetflowTopLocationListResponseResultJSON struct { + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTopLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTopLocationListResponseResultTop0 struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarNetflowTopLocationListResponseResultTop0JSON `json:"-"` +} + +// radarNetflowTopLocationListResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarNetflowTopLocationListResponseResultTop0] +type radarNetflowTopLocationListResponseResultTop0JSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarNetflowTopLocationListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarNetflowTopLocationListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarNetflowTopLocationListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarNetflowTopLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarNetflowTopLocationListParams]'s query parameters as +// `url.Values`. +func (r RadarNetflowTopLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarNetflowTopLocationListParamsDateRange string + +const ( + RadarNetflowTopLocationListParamsDateRange1d RadarNetflowTopLocationListParamsDateRange = "1d" + RadarNetflowTopLocationListParamsDateRange2d RadarNetflowTopLocationListParamsDateRange = "2d" + RadarNetflowTopLocationListParamsDateRange7d RadarNetflowTopLocationListParamsDateRange = "7d" + RadarNetflowTopLocationListParamsDateRange14d RadarNetflowTopLocationListParamsDateRange = "14d" + RadarNetflowTopLocationListParamsDateRange28d RadarNetflowTopLocationListParamsDateRange = "28d" + RadarNetflowTopLocationListParamsDateRange12w RadarNetflowTopLocationListParamsDateRange = "12w" + RadarNetflowTopLocationListParamsDateRange24w RadarNetflowTopLocationListParamsDateRange = "24w" + RadarNetflowTopLocationListParamsDateRange52w RadarNetflowTopLocationListParamsDateRange = "52w" + RadarNetflowTopLocationListParamsDateRange1dControl RadarNetflowTopLocationListParamsDateRange = "1dControl" + RadarNetflowTopLocationListParamsDateRange2dControl RadarNetflowTopLocationListParamsDateRange = "2dControl" + RadarNetflowTopLocationListParamsDateRange7dControl RadarNetflowTopLocationListParamsDateRange = "7dControl" + RadarNetflowTopLocationListParamsDateRange14dControl RadarNetflowTopLocationListParamsDateRange = "14dControl" + RadarNetflowTopLocationListParamsDateRange28dControl RadarNetflowTopLocationListParamsDateRange = "28dControl" + RadarNetflowTopLocationListParamsDateRange12wControl RadarNetflowTopLocationListParamsDateRange = "12wControl" + RadarNetflowTopLocationListParamsDateRange24wControl RadarNetflowTopLocationListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarNetflowTopLocationListParamsFormat string + +const ( + RadarNetflowTopLocationListParamsFormatJson RadarNetflowTopLocationListParamsFormat = "JSON" + RadarNetflowTopLocationListParamsFormatCsv RadarNetflowTopLocationListParamsFormat = "CSV" +) diff --git a/radarnetflowtoplocation_test.go b/radarnetflowtoplocation_test.go new file mode 100644 index 00000000000..dab9a267137 --- /dev/null +++ b/radarnetflowtoplocation_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarNetflowTopLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Netflows.Tops.Locations.List(context.TODO(), cloudflare.RadarNetflowTopLocationListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarNetflowTopLocationListParamsDateRange{cloudflare.RadarNetflowTopLocationListParamsDateRange1d, cloudflare.RadarNetflowTopLocationListParamsDateRange2d, cloudflare.RadarNetflowTopLocationListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarNetflowTopLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarquality.go b/radarquality.go new file mode 100644 index 00000000000..a6e947f64fb --- /dev/null +++ b/radarquality.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualityService 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 [NewRadarQualityService] method +// instead. +type RadarQualityService struct { + Options []option.RequestOption + Iqi *RadarQualityIqiService + Speed *RadarQualitySpeedService +} + +// NewRadarQualityService 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 NewRadarQualityService(opts ...option.RequestOption) (r *RadarQualityService) { + r = &RadarQualityService{} + r.Options = opts + r.Iqi = NewRadarQualityIqiService(opts...) + r.Speed = NewRadarQualitySpeedService(opts...) + return +} diff --git a/radarqualityiqi.go b/radarqualityiqi.go new file mode 100644 index 00000000000..9b3952b3c0b --- /dev/null +++ b/radarqualityiqi.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualityIqiService 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 [NewRadarQualityIqiService] method +// instead. +type RadarQualityIqiService struct { + Options []option.RequestOption + Summary *RadarQualityIqiSummaryService + TimeseriesGroups *RadarQualityIqiTimeseriesGroupService +} + +// NewRadarQualityIqiService 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 NewRadarQualityIqiService(opts ...option.RequestOption) (r *RadarQualityIqiService) { + r = &RadarQualityIqiService{} + r.Options = opts + r.Summary = NewRadarQualityIqiSummaryService(opts...) + r.TimeseriesGroups = NewRadarQualityIqiTimeseriesGroupService(opts...) + return +} diff --git a/radarqualityiqisummary.go b/radarqualityiqisummary.go new file mode 100644 index 00000000000..60468437b15 --- /dev/null +++ b/radarqualityiqisummary.go @@ -0,0 +1,271 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualityIqiSummaryService 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 [NewRadarQualityIqiSummaryService] +// method instead. +type RadarQualityIqiSummaryService struct { + Options []option.RequestOption +} + +// NewRadarQualityIqiSummaryService 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 NewRadarQualityIqiSummaryService(opts ...option.RequestOption) (r *RadarQualityIqiSummaryService) { + r = &RadarQualityIqiSummaryService{} + r.Options = opts + return +} + +// Get a summary (percentiles) of bandwidth, latency or DNS response time from the +// Radar Internet Quality Index (IQI). +func (r *RadarQualityIqiSummaryService) Get(ctx context.Context, query RadarQualityIqiSummaryGetParams, opts ...option.RequestOption) (res *RadarQualityIqiSummaryGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/quality/iqi/summary" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarQualityIqiSummaryGetResponse struct { + Result RadarQualityIqiSummaryGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarQualityIqiSummaryGetResponseJSON `json:"-"` +} + +// radarQualityIqiSummaryGetResponseJSON contains the JSON metadata for the struct +// [RadarQualityIqiSummaryGetResponse] +type radarQualityIqiSummaryGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiSummaryGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiSummaryGetResponseResult struct { + Meta RadarQualityIqiSummaryGetResponseResultMeta `json:"meta,required"` + Summary0 RadarQualityIqiSummaryGetResponseResultSummary0 `json:"summary_0,required"` + JSON radarQualityIqiSummaryGetResponseResultJSON `json:"-"` +} + +// radarQualityIqiSummaryGetResponseResultJSON contains the JSON metadata for the +// struct [RadarQualityIqiSummaryGetResponseResult] +type radarQualityIqiSummaryGetResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiSummaryGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiSummaryGetResponseResultMeta struct { + DateRange []RadarQualityIqiSummaryGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarQualityIqiSummaryGetResponseResultMetaJSON `json:"-"` +} + +// radarQualityIqiSummaryGetResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarQualityIqiSummaryGetResponseResultMeta] +type radarQualityIqiSummaryGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiSummaryGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiSummaryGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarQualityIqiSummaryGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarQualityIqiSummaryGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarQualityIqiSummaryGetResponseResultMetaDateRange] +type radarQualityIqiSummaryGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiSummaryGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarQualityIqiSummaryGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarQualityIqiSummaryGetResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfo] +type radarQualityIqiSummaryGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarQualityIqiSummaryGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarQualityIqiSummaryGetResponseResultMetaConfidenceInfoAnnotationJSON contains +// the JSON metadata for the struct +// [RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfoAnnotation] +type radarQualityIqiSummaryGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiSummaryGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiSummaryGetResponseResultSummary0 struct { + P25 string `json:"p25,required"` + P50 string `json:"p50,required"` + P75 string `json:"p75,required"` + JSON radarQualityIqiSummaryGetResponseResultSummary0JSON `json:"-"` +} + +// radarQualityIqiSummaryGetResponseResultSummary0JSON contains the JSON metadata +// for the struct [RadarQualityIqiSummaryGetResponseResultSummary0] +type radarQualityIqiSummaryGetResponseResultSummary0JSON struct { + P25 apijson.Field + P50 apijson.Field + P75 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiSummaryGetResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiSummaryGetParams struct { + // Which metric to return: bandwidth, latency or DNS response time. + Metric param.Field[RadarQualityIqiSummaryGetParamsMetric] `query:"metric,required"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Array of comma separated list of continents (alpha-2 continent codes). Start + // with `-` to exclude from results. For example, `-EU,NA` excludes results from + // Europe, but includes results from North America. + Continent param.Field[[]string] `query:"continent"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarQualityIqiSummaryGetParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarQualityIqiSummaryGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarQualityIqiSummaryGetParams]'s query parameters as +// `url.Values`. +func (r RadarQualityIqiSummaryGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Which metric to return: bandwidth, latency or DNS response time. +type RadarQualityIqiSummaryGetParamsMetric string + +const ( + RadarQualityIqiSummaryGetParamsMetricBandwidth RadarQualityIqiSummaryGetParamsMetric = "BANDWIDTH" + RadarQualityIqiSummaryGetParamsMetricDNS RadarQualityIqiSummaryGetParamsMetric = "DNS" + RadarQualityIqiSummaryGetParamsMetricLatency RadarQualityIqiSummaryGetParamsMetric = "LATENCY" +) + +type RadarQualityIqiSummaryGetParamsDateRange string + +const ( + RadarQualityIqiSummaryGetParamsDateRange1d RadarQualityIqiSummaryGetParamsDateRange = "1d" + RadarQualityIqiSummaryGetParamsDateRange2d RadarQualityIqiSummaryGetParamsDateRange = "2d" + RadarQualityIqiSummaryGetParamsDateRange7d RadarQualityIqiSummaryGetParamsDateRange = "7d" + RadarQualityIqiSummaryGetParamsDateRange14d RadarQualityIqiSummaryGetParamsDateRange = "14d" + RadarQualityIqiSummaryGetParamsDateRange28d RadarQualityIqiSummaryGetParamsDateRange = "28d" + RadarQualityIqiSummaryGetParamsDateRange12w RadarQualityIqiSummaryGetParamsDateRange = "12w" + RadarQualityIqiSummaryGetParamsDateRange24w RadarQualityIqiSummaryGetParamsDateRange = "24w" + RadarQualityIqiSummaryGetParamsDateRange52w RadarQualityIqiSummaryGetParamsDateRange = "52w" + RadarQualityIqiSummaryGetParamsDateRange1dControl RadarQualityIqiSummaryGetParamsDateRange = "1dControl" + RadarQualityIqiSummaryGetParamsDateRange2dControl RadarQualityIqiSummaryGetParamsDateRange = "2dControl" + RadarQualityIqiSummaryGetParamsDateRange7dControl RadarQualityIqiSummaryGetParamsDateRange = "7dControl" + RadarQualityIqiSummaryGetParamsDateRange14dControl RadarQualityIqiSummaryGetParamsDateRange = "14dControl" + RadarQualityIqiSummaryGetParamsDateRange28dControl RadarQualityIqiSummaryGetParamsDateRange = "28dControl" + RadarQualityIqiSummaryGetParamsDateRange12wControl RadarQualityIqiSummaryGetParamsDateRange = "12wControl" + RadarQualityIqiSummaryGetParamsDateRange24wControl RadarQualityIqiSummaryGetParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarQualityIqiSummaryGetParamsFormat string + +const ( + RadarQualityIqiSummaryGetParamsFormatJson RadarQualityIqiSummaryGetParamsFormat = "JSON" + RadarQualityIqiSummaryGetParamsFormatCsv RadarQualityIqiSummaryGetParamsFormat = "CSV" +) diff --git a/radarqualityiqisummary_test.go b/radarqualityiqisummary_test.go new file mode 100644 index 00000000000..206410e872e --- /dev/null +++ b/radarqualityiqisummary_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarQualityIqiSummaryGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Quality.Iqi.Summary.Get(context.TODO(), cloudflare.RadarQualityIqiSummaryGetParams{ + Metric: cloudflare.F(cloudflare.RadarQualityIqiSummaryGetParamsMetricBandwidth), + ASN: cloudflare.F([]string{"string", "string", "string"}), + Continent: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarQualityIqiSummaryGetParamsDateRange{cloudflare.RadarQualityIqiSummaryGetParamsDateRange1d, cloudflare.RadarQualityIqiSummaryGetParamsDateRange2d, cloudflare.RadarQualityIqiSummaryGetParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarQualityIqiSummaryGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarqualityiqitimeseriesgroup.go b/radarqualityiqitimeseriesgroup.go new file mode 100644 index 00000000000..cc57af7673b --- /dev/null +++ b/radarqualityiqitimeseriesgroup.go @@ -0,0 +1,197 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualityIqiTimeseriesGroupService 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 +// [NewRadarQualityIqiTimeseriesGroupService] method instead. +type RadarQualityIqiTimeseriesGroupService struct { + Options []option.RequestOption +} + +// NewRadarQualityIqiTimeseriesGroupService 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 NewRadarQualityIqiTimeseriesGroupService(opts ...option.RequestOption) (r *RadarQualityIqiTimeseriesGroupService) { + r = &RadarQualityIqiTimeseriesGroupService{} + r.Options = opts + return +} + +// Get a time series (percentiles) of bandwidth, latency or DNS response time from +// the Radar Internet Quality Index (IQI). +func (r *RadarQualityIqiTimeseriesGroupService) List(ctx context.Context, query RadarQualityIqiTimeseriesGroupListParams, opts ...option.RequestOption) (res *RadarQualityIqiTimeseriesGroupListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/quality/iqi/timeseries_groups" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarQualityIqiTimeseriesGroupListResponse struct { + Result RadarQualityIqiTimeseriesGroupListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarQualityIqiTimeseriesGroupListResponseJSON `json:"-"` +} + +// radarQualityIqiTimeseriesGroupListResponseJSON contains the JSON metadata for +// the struct [RadarQualityIqiTimeseriesGroupListResponse] +type radarQualityIqiTimeseriesGroupListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiTimeseriesGroupListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiTimeseriesGroupListResponseResult struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarQualityIqiTimeseriesGroupListResponseResultSerie0 `json:"serie_0,required"` + JSON radarQualityIqiTimeseriesGroupListResponseResultJSON `json:"-"` +} + +// radarQualityIqiTimeseriesGroupListResponseResultJSON contains the JSON metadata +// for the struct [RadarQualityIqiTimeseriesGroupListResponseResult] +type radarQualityIqiTimeseriesGroupListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiTimeseriesGroupListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiTimeseriesGroupListResponseResultSerie0 struct { + P25 []string `json:"p25,required"` + P50 []string `json:"p50,required"` + P75 []string `json:"p75,required"` + Timestamps []string `json:"timestamps,required"` + JSON radarQualityIqiTimeseriesGroupListResponseResultSerie0JSON `json:"-"` +} + +// radarQualityIqiTimeseriesGroupListResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarQualityIqiTimeseriesGroupListResponseResultSerie0] +type radarQualityIqiTimeseriesGroupListResponseResultSerie0JSON struct { + P25 apijson.Field + P50 apijson.Field + P75 apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualityIqiTimeseriesGroupListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualityIqiTimeseriesGroupListParams struct { + // Which metric to return: bandwidth, latency or DNS response time. + Metric param.Field[RadarQualityIqiTimeseriesGroupListParamsMetric] `query:"metric,required"` + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarQualityIqiTimeseriesGroupListParamsAggInterval] `query:"aggInterval"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // Array of comma separated list of continents (alpha-2 continent codes). Start + // with `-` to exclude from results. For example, `-EU,NA` excludes results from + // Europe, but includes results from North America. + Continent param.Field[[]string] `query:"continent"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarQualityIqiTimeseriesGroupListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarQualityIqiTimeseriesGroupListParamsFormat] `query:"format"` + // Enable interpolation for all series (using the average). + Interpolation param.Field[bool] `query:"interpolation"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarQualityIqiTimeseriesGroupListParams]'s query +// parameters as `url.Values`. +func (r RadarQualityIqiTimeseriesGroupListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Which metric to return: bandwidth, latency or DNS response time. +type RadarQualityIqiTimeseriesGroupListParamsMetric string + +const ( + RadarQualityIqiTimeseriesGroupListParamsMetricBandwidth RadarQualityIqiTimeseriesGroupListParamsMetric = "BANDWIDTH" + RadarQualityIqiTimeseriesGroupListParamsMetricDNS RadarQualityIqiTimeseriesGroupListParamsMetric = "DNS" + RadarQualityIqiTimeseriesGroupListParamsMetricLatency RadarQualityIqiTimeseriesGroupListParamsMetric = "LATENCY" +) + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarQualityIqiTimeseriesGroupListParamsAggInterval string + +const ( + RadarQualityIqiTimeseriesGroupListParamsAggInterval15m RadarQualityIqiTimeseriesGroupListParamsAggInterval = "15m" + RadarQualityIqiTimeseriesGroupListParamsAggInterval1h RadarQualityIqiTimeseriesGroupListParamsAggInterval = "1h" + RadarQualityIqiTimeseriesGroupListParamsAggInterval1d RadarQualityIqiTimeseriesGroupListParamsAggInterval = "1d" + RadarQualityIqiTimeseriesGroupListParamsAggInterval1w RadarQualityIqiTimeseriesGroupListParamsAggInterval = "1w" +) + +type RadarQualityIqiTimeseriesGroupListParamsDateRange string + +const ( + RadarQualityIqiTimeseriesGroupListParamsDateRange1d RadarQualityIqiTimeseriesGroupListParamsDateRange = "1d" + RadarQualityIqiTimeseriesGroupListParamsDateRange2d RadarQualityIqiTimeseriesGroupListParamsDateRange = "2d" + RadarQualityIqiTimeseriesGroupListParamsDateRange7d RadarQualityIqiTimeseriesGroupListParamsDateRange = "7d" + RadarQualityIqiTimeseriesGroupListParamsDateRange14d RadarQualityIqiTimeseriesGroupListParamsDateRange = "14d" + RadarQualityIqiTimeseriesGroupListParamsDateRange28d RadarQualityIqiTimeseriesGroupListParamsDateRange = "28d" + RadarQualityIqiTimeseriesGroupListParamsDateRange12w RadarQualityIqiTimeseriesGroupListParamsDateRange = "12w" + RadarQualityIqiTimeseriesGroupListParamsDateRange24w RadarQualityIqiTimeseriesGroupListParamsDateRange = "24w" + RadarQualityIqiTimeseriesGroupListParamsDateRange52w RadarQualityIqiTimeseriesGroupListParamsDateRange = "52w" + RadarQualityIqiTimeseriesGroupListParamsDateRange1dControl RadarQualityIqiTimeseriesGroupListParamsDateRange = "1dControl" + RadarQualityIqiTimeseriesGroupListParamsDateRange2dControl RadarQualityIqiTimeseriesGroupListParamsDateRange = "2dControl" + RadarQualityIqiTimeseriesGroupListParamsDateRange7dControl RadarQualityIqiTimeseriesGroupListParamsDateRange = "7dControl" + RadarQualityIqiTimeseriesGroupListParamsDateRange14dControl RadarQualityIqiTimeseriesGroupListParamsDateRange = "14dControl" + RadarQualityIqiTimeseriesGroupListParamsDateRange28dControl RadarQualityIqiTimeseriesGroupListParamsDateRange = "28dControl" + RadarQualityIqiTimeseriesGroupListParamsDateRange12wControl RadarQualityIqiTimeseriesGroupListParamsDateRange = "12wControl" + RadarQualityIqiTimeseriesGroupListParamsDateRange24wControl RadarQualityIqiTimeseriesGroupListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarQualityIqiTimeseriesGroupListParamsFormat string + +const ( + RadarQualityIqiTimeseriesGroupListParamsFormatJson RadarQualityIqiTimeseriesGroupListParamsFormat = "JSON" + RadarQualityIqiTimeseriesGroupListParamsFormatCsv RadarQualityIqiTimeseriesGroupListParamsFormat = "CSV" +) diff --git a/radarqualityiqitimeseriesgroup_test.go b/radarqualityiqitimeseriesgroup_test.go new file mode 100644 index 00000000000..804b977ee30 --- /dev/null +++ b/radarqualityiqitimeseriesgroup_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarQualityIqiTimeseriesGroupListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Quality.Iqi.TimeseriesGroups.List(context.TODO(), cloudflare.RadarQualityIqiTimeseriesGroupListParams{ + Metric: cloudflare.F(cloudflare.RadarQualityIqiTimeseriesGroupListParamsMetricBandwidth), + AggInterval: cloudflare.F(cloudflare.RadarQualityIqiTimeseriesGroupListParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + Continent: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarQualityIqiTimeseriesGroupListParamsDateRange{cloudflare.RadarQualityIqiTimeseriesGroupListParamsDateRange1d, cloudflare.RadarQualityIqiTimeseriesGroupListParamsDateRange2d, cloudflare.RadarQualityIqiTimeseriesGroupListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarQualityIqiTimeseriesGroupListParamsFormatJson), + Interpolation: cloudflare.F(true), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarqualityspeed.go b/radarqualityspeed.go new file mode 100644 index 00000000000..9553cdb7f2d --- /dev/null +++ b/radarqualityspeed.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualitySpeedService 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 [NewRadarQualitySpeedService] method +// instead. +type RadarQualitySpeedService struct { + Options []option.RequestOption + Histogram *RadarQualitySpeedHistogramService + Summary *RadarQualitySpeedSummaryService + Top *RadarQualitySpeedTopService +} + +// NewRadarQualitySpeedService 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 NewRadarQualitySpeedService(opts ...option.RequestOption) (r *RadarQualitySpeedService) { + r = &RadarQualitySpeedService{} + r.Options = opts + r.Histogram = NewRadarQualitySpeedHistogramService(opts...) + r.Summary = NewRadarQualitySpeedSummaryService(opts...) + r.Top = NewRadarQualitySpeedTopService(opts...) + return +} diff --git a/radarqualityspeedhistogram.go b/radarqualityspeedhistogram.go new file mode 100644 index 00000000000..cf801e17320 --- /dev/null +++ b/radarqualityspeedhistogram.go @@ -0,0 +1,149 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualitySpeedHistogramService 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 +// [NewRadarQualitySpeedHistogramService] method instead. +type RadarQualitySpeedHistogramService struct { + Options []option.RequestOption +} + +// NewRadarQualitySpeedHistogramService 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 NewRadarQualitySpeedHistogramService(opts ...option.RequestOption) (r *RadarQualitySpeedHistogramService) { + r = &RadarQualitySpeedHistogramService{} + r.Options = opts + return +} + +// Get an histogram from the previous 90 days of Cloudflare Speed Test data, split +// into fixed bandwidth (Mbps), latency (ms) or jitter (ms) buckets. +func (r *RadarQualitySpeedHistogramService) Get(ctx context.Context, query RadarQualitySpeedHistogramGetParams, opts ...option.RequestOption) (res *RadarQualitySpeedHistogramGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/quality/speed/histogram" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarQualitySpeedHistogramGetResponse struct { + Result RadarQualitySpeedHistogramGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarQualitySpeedHistogramGetResponseJSON `json:"-"` +} + +// radarQualitySpeedHistogramGetResponseJSON contains the JSON metadata for the +// struct [RadarQualitySpeedHistogramGetResponse] +type radarQualitySpeedHistogramGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedHistogramGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedHistogramGetResponseResult struct { + Histogram0 RadarQualitySpeedHistogramGetResponseResultHistogram0 `json:"histogram_0,required"` + Meta interface{} `json:"meta,required"` + JSON radarQualitySpeedHistogramGetResponseResultJSON `json:"-"` +} + +// radarQualitySpeedHistogramGetResponseResultJSON contains the JSON metadata for +// the struct [RadarQualitySpeedHistogramGetResponseResult] +type radarQualitySpeedHistogramGetResponseResultJSON struct { + Histogram0 apijson.Field + Meta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedHistogramGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedHistogramGetResponseResultHistogram0 struct { + BandwidthDownload []string `json:"bandwidthDownload,required"` + BandwidthUpload []string `json:"bandwidthUpload,required"` + BucketMin []string `json:"bucketMin,required"` + JSON radarQualitySpeedHistogramGetResponseResultHistogram0JSON `json:"-"` +} + +// radarQualitySpeedHistogramGetResponseResultHistogram0JSON contains the JSON +// metadata for the struct [RadarQualitySpeedHistogramGetResponseResultHistogram0] +type radarQualitySpeedHistogramGetResponseResultHistogram0JSON struct { + BandwidthDownload apijson.Field + BandwidthUpload apijson.Field + BucketMin apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedHistogramGetResponseResultHistogram0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedHistogramGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // The width for every bucket in the histogram. + BucketSize param.Field[int64] `query:"bucketSize"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarQualitySpeedHistogramGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Metrics to be returned. + MetricGroup param.Field[RadarQualitySpeedHistogramGetParamsMetricGroup] `query:"metricGroup"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarQualitySpeedHistogramGetParams]'s query parameters as +// `url.Values`. +func (r RadarQualitySpeedHistogramGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarQualitySpeedHistogramGetParamsFormat string + +const ( + RadarQualitySpeedHistogramGetParamsFormatJson RadarQualitySpeedHistogramGetParamsFormat = "JSON" + RadarQualitySpeedHistogramGetParamsFormatCsv RadarQualitySpeedHistogramGetParamsFormat = "CSV" +) + +// Metrics to be returned. +type RadarQualitySpeedHistogramGetParamsMetricGroup string + +const ( + RadarQualitySpeedHistogramGetParamsMetricGroupBandwidth RadarQualitySpeedHistogramGetParamsMetricGroup = "BANDWIDTH" + RadarQualitySpeedHistogramGetParamsMetricGroupLatency RadarQualitySpeedHistogramGetParamsMetricGroup = "LATENCY" + RadarQualitySpeedHistogramGetParamsMetricGroupJitter RadarQualitySpeedHistogramGetParamsMetricGroup = "JITTER" +) diff --git a/radarqualityspeedhistogram_test.go b/radarqualityspeedhistogram_test.go new file mode 100644 index 00000000000..ca5f16e38ba --- /dev/null +++ b/radarqualityspeedhistogram_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarQualitySpeedHistogramGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Quality.Speed.Histogram.Get(context.TODO(), cloudflare.RadarQualitySpeedHistogramGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BucketSize: cloudflare.F(int64(0)), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarQualitySpeedHistogramGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + MetricGroup: cloudflare.F(cloudflare.RadarQualitySpeedHistogramGetParamsMetricGroupBandwidth), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarqualityspeedsummary.go b/radarqualityspeedsummary.go new file mode 100644 index 00000000000..d8b014dd9c3 --- /dev/null +++ b/radarqualityspeedsummary.go @@ -0,0 +1,238 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualitySpeedSummaryService 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 +// [NewRadarQualitySpeedSummaryService] method instead. +type RadarQualitySpeedSummaryService struct { + Options []option.RequestOption +} + +// NewRadarQualitySpeedSummaryService 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 NewRadarQualitySpeedSummaryService(opts ...option.RequestOption) (r *RadarQualitySpeedSummaryService) { + r = &RadarQualitySpeedSummaryService{} + r.Options = opts + return +} + +// Get a summary of bandwidth, latency, jitter and packet loss, from the previous +// 90 days of Cloudflare Speed Test data. +func (r *RadarQualitySpeedSummaryService) Get(ctx context.Context, query RadarQualitySpeedSummaryGetParams, opts ...option.RequestOption) (res *RadarQualitySpeedSummaryGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/quality/speed/summary" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarQualitySpeedSummaryGetResponse struct { + Result RadarQualitySpeedSummaryGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarQualitySpeedSummaryGetResponseJSON `json:"-"` +} + +// radarQualitySpeedSummaryGetResponseJSON contains the JSON metadata for the +// struct [RadarQualitySpeedSummaryGetResponse] +type radarQualitySpeedSummaryGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedSummaryGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedSummaryGetResponseResult struct { + Meta RadarQualitySpeedSummaryGetResponseResultMeta `json:"meta,required"` + Summary0 RadarQualitySpeedSummaryGetResponseResultSummary0 `json:"summary_0,required"` + JSON radarQualitySpeedSummaryGetResponseResultJSON `json:"-"` +} + +// radarQualitySpeedSummaryGetResponseResultJSON contains the JSON metadata for the +// struct [RadarQualitySpeedSummaryGetResponseResult] +type radarQualitySpeedSummaryGetResponseResultJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedSummaryGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedSummaryGetResponseResultMeta struct { + DateRange []RadarQualitySpeedSummaryGetResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarQualitySpeedSummaryGetResponseResultMetaJSON `json:"-"` +} + +// radarQualitySpeedSummaryGetResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarQualitySpeedSummaryGetResponseResultMeta] +type radarQualitySpeedSummaryGetResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedSummaryGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedSummaryGetResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarQualitySpeedSummaryGetResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarQualitySpeedSummaryGetResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarQualitySpeedSummaryGetResponseResultMetaDateRange] +type radarQualitySpeedSummaryGetResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedSummaryGetResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfo struct { + Annotations []RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfo] +type radarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoAnnotation] +type radarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedSummaryGetResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedSummaryGetResponseResultSummary0 struct { + BandwidthDownload string `json:"bandwidthDownload,required"` + BandwidthUpload string `json:"bandwidthUpload,required"` + JitterIdle string `json:"jitterIdle,required"` + JitterLoaded string `json:"jitterLoaded,required"` + LatencyIdle string `json:"latencyIdle,required"` + LatencyLoaded string `json:"latencyLoaded,required"` + PacketLoss string `json:"packetLoss,required"` + JSON radarQualitySpeedSummaryGetResponseResultSummary0JSON `json:"-"` +} + +// radarQualitySpeedSummaryGetResponseResultSummary0JSON contains the JSON metadata +// for the struct [RadarQualitySpeedSummaryGetResponseResultSummary0] +type radarQualitySpeedSummaryGetResponseResultSummary0JSON struct { + BandwidthDownload apijson.Field + BandwidthUpload apijson.Field + JitterIdle apijson.Field + JitterLoaded apijson.Field + LatencyIdle apijson.Field + LatencyLoaded apijson.Field + PacketLoss apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedSummaryGetResponseResultSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedSummaryGetParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarQualitySpeedSummaryGetParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarQualitySpeedSummaryGetParams]'s query parameters as +// `url.Values`. +func (r RadarQualitySpeedSummaryGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarQualitySpeedSummaryGetParamsFormat string + +const ( + RadarQualitySpeedSummaryGetParamsFormatJson RadarQualitySpeedSummaryGetParamsFormat = "JSON" + RadarQualitySpeedSummaryGetParamsFormatCsv RadarQualitySpeedSummaryGetParamsFormat = "CSV" +) diff --git a/radarqualityspeedsummary_test.go b/radarqualityspeedsummary_test.go new file mode 100644 index 00000000000..d2ba6915fc0 --- /dev/null +++ b/radarqualityspeedsummary_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarQualitySpeedSummaryGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Quality.Speed.Summary.Get(context.TODO(), cloudflare.RadarQualitySpeedSummaryGetParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarQualitySpeedSummaryGetParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarqualityspeedtop.go b/radarqualityspeedtop.go new file mode 100644 index 00000000000..3a644406c28 --- /dev/null +++ b/radarqualityspeedtop.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualitySpeedTopService 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 [NewRadarQualitySpeedTopService] +// method instead. +type RadarQualitySpeedTopService struct { + Options []option.RequestOption + Ases *RadarQualitySpeedTopAseService + Locations *RadarQualitySpeedTopLocationService +} + +// NewRadarQualitySpeedTopService 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 NewRadarQualitySpeedTopService(opts ...option.RequestOption) (r *RadarQualitySpeedTopService) { + r = &RadarQualitySpeedTopService{} + r.Options = opts + r.Ases = NewRadarQualitySpeedTopAseService(opts...) + r.Locations = NewRadarQualitySpeedTopLocationService(opts...) + return +} diff --git a/radarqualityspeedtopase.go b/radarqualityspeedtopase.go new file mode 100644 index 00000000000..77553b7d4d9 --- /dev/null +++ b/radarqualityspeedtopase.go @@ -0,0 +1,260 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualitySpeedTopAseService 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 +// [NewRadarQualitySpeedTopAseService] method instead. +type RadarQualitySpeedTopAseService struct { + Options []option.RequestOption +} + +// NewRadarQualitySpeedTopAseService 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 NewRadarQualitySpeedTopAseService(opts ...option.RequestOption) (r *RadarQualitySpeedTopAseService) { + r = &RadarQualitySpeedTopAseService{} + r.Options = opts + return +} + +// Get the top autonomous systems by bandwidth, latency, jitter or packet loss, +// from the previous 90 days of Cloudflare Speed Test data. +func (r *RadarQualitySpeedTopAseService) List(ctx context.Context, query RadarQualitySpeedTopAseListParams, opts ...option.RequestOption) (res *RadarQualitySpeedTopAseListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/quality/speed/top/ases" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarQualitySpeedTopAseListResponse struct { + Result RadarQualitySpeedTopAseListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarQualitySpeedTopAseListResponseJSON `json:"-"` +} + +// radarQualitySpeedTopAseListResponseJSON contains the JSON metadata for the +// struct [RadarQualitySpeedTopAseListResponse] +type radarQualitySpeedTopAseListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopAseListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopAseListResponseResult struct { + Meta RadarQualitySpeedTopAseListResponseResultMeta `json:"meta,required"` + Top0 []RadarQualitySpeedTopAseListResponseResultTop0 `json:"top_0,required"` + JSON radarQualitySpeedTopAseListResponseResultJSON `json:"-"` +} + +// radarQualitySpeedTopAseListResponseResultJSON contains the JSON metadata for the +// struct [RadarQualitySpeedTopAseListResponseResult] +type radarQualitySpeedTopAseListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopAseListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopAseListResponseResultMeta struct { + DateRange []RadarQualitySpeedTopAseListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarQualitySpeedTopAseListResponseResultMetaJSON `json:"-"` +} + +// radarQualitySpeedTopAseListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarQualitySpeedTopAseListResponseResultMeta] +type radarQualitySpeedTopAseListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopAseListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopAseListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarQualitySpeedTopAseListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarQualitySpeedTopAseListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarQualitySpeedTopAseListResponseResultMetaDateRange] +type radarQualitySpeedTopAseListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopAseListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfo struct { + Annotations []RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarQualitySpeedTopAseListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarQualitySpeedTopAseListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfo] +type radarQualitySpeedTopAseListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarQualitySpeedTopAseListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarQualitySpeedTopAseListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfoAnnotation] +type radarQualitySpeedTopAseListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopAseListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopAseListResponseResultTop0 struct { + BandwidthDownload string `json:"bandwidthDownload,required"` + BandwidthUpload string `json:"bandwidthUpload,required"` + ClientASN float64 `json:"clientASN,required"` + ClientAsName string `json:"clientASName,required"` + JitterIdle string `json:"jitterIdle,required"` + JitterLoaded string `json:"jitterLoaded,required"` + LatencyIdle string `json:"latencyIdle,required"` + LatencyLoaded string `json:"latencyLoaded,required"` + NumTests float64 `json:"numTests,required"` + RankPower float64 `json:"rankPower,required"` + JSON radarQualitySpeedTopAseListResponseResultTop0JSON `json:"-"` +} + +// radarQualitySpeedTopAseListResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarQualitySpeedTopAseListResponseResultTop0] +type radarQualitySpeedTopAseListResponseResultTop0JSON struct { + BandwidthDownload apijson.Field + BandwidthUpload apijson.Field + ClientASN apijson.Field + ClientAsName apijson.Field + JitterIdle apijson.Field + JitterLoaded apijson.Field + LatencyIdle apijson.Field + LatencyLoaded apijson.Field + NumTests apijson.Field + RankPower apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopAseListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopAseListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarQualitySpeedTopAseListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Metric to order the results by. + OrderBy param.Field[RadarQualitySpeedTopAseListParamsOrderBy] `query:"orderBy"` + // Reverse the order of results. + Reverse param.Field[bool] `query:"reverse"` +} + +// URLQuery serializes [RadarQualitySpeedTopAseListParams]'s query parameters as +// `url.Values`. +func (r RadarQualitySpeedTopAseListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarQualitySpeedTopAseListParamsFormat string + +const ( + RadarQualitySpeedTopAseListParamsFormatJson RadarQualitySpeedTopAseListParamsFormat = "JSON" + RadarQualitySpeedTopAseListParamsFormatCsv RadarQualitySpeedTopAseListParamsFormat = "CSV" +) + +// Metric to order the results by. +type RadarQualitySpeedTopAseListParamsOrderBy string + +const ( + RadarQualitySpeedTopAseListParamsOrderByBandwidthDownload RadarQualitySpeedTopAseListParamsOrderBy = "BANDWIDTH_DOWNLOAD" + RadarQualitySpeedTopAseListParamsOrderByBandwidthUpload RadarQualitySpeedTopAseListParamsOrderBy = "BANDWIDTH_UPLOAD" + RadarQualitySpeedTopAseListParamsOrderByLatencyIdle RadarQualitySpeedTopAseListParamsOrderBy = "LATENCY_IDLE" + RadarQualitySpeedTopAseListParamsOrderByLatencyLoaded RadarQualitySpeedTopAseListParamsOrderBy = "LATENCY_LOADED" + RadarQualitySpeedTopAseListParamsOrderByJitterIdle RadarQualitySpeedTopAseListParamsOrderBy = "JITTER_IDLE" + RadarQualitySpeedTopAseListParamsOrderByJitterLoaded RadarQualitySpeedTopAseListParamsOrderBy = "JITTER_LOADED" +) diff --git a/radarqualityspeedtopase_test.go b/radarqualityspeedtopase_test.go new file mode 100644 index 00000000000..63483414f24 --- /dev/null +++ b/radarqualityspeedtopase_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarQualitySpeedTopAseListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Quality.Speed.Top.Ases.List(context.TODO(), cloudflare.RadarQualitySpeedTopAseListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarQualitySpeedTopAseListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + OrderBy: cloudflare.F(cloudflare.RadarQualitySpeedTopAseListParamsOrderByBandwidthDownload), + Reverse: cloudflare.F(true), + }) + 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/radarqualityspeedtoplocation.go b/radarqualityspeedtoplocation.go new file mode 100644 index 00000000000..72ff457f1d7 --- /dev/null +++ b/radarqualityspeedtoplocation.go @@ -0,0 +1,261 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarQualitySpeedTopLocationService 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 +// [NewRadarQualitySpeedTopLocationService] method instead. +type RadarQualitySpeedTopLocationService struct { + Options []option.RequestOption +} + +// NewRadarQualitySpeedTopLocationService 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 NewRadarQualitySpeedTopLocationService(opts ...option.RequestOption) (r *RadarQualitySpeedTopLocationService) { + r = &RadarQualitySpeedTopLocationService{} + r.Options = opts + return +} + +// Get the top locations by bandwidth, latency, jitter or packet loss, from the +// previous 90 days of Cloudflare Speed Test data. +func (r *RadarQualitySpeedTopLocationService) List(ctx context.Context, query RadarQualitySpeedTopLocationListParams, opts ...option.RequestOption) (res *RadarQualitySpeedTopLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/quality/speed/top/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarQualitySpeedTopLocationListResponse struct { + Result RadarQualitySpeedTopLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarQualitySpeedTopLocationListResponseJSON `json:"-"` +} + +// radarQualitySpeedTopLocationListResponseJSON contains the JSON metadata for the +// struct [RadarQualitySpeedTopLocationListResponse] +type radarQualitySpeedTopLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopLocationListResponseResult struct { + Meta RadarQualitySpeedTopLocationListResponseResultMeta `json:"meta,required"` + Top0 []RadarQualitySpeedTopLocationListResponseResultTop0 `json:"top_0,required"` + JSON radarQualitySpeedTopLocationListResponseResultJSON `json:"-"` +} + +// radarQualitySpeedTopLocationListResponseResultJSON contains the JSON metadata +// for the struct [RadarQualitySpeedTopLocationListResponseResult] +type radarQualitySpeedTopLocationListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopLocationListResponseResultMeta struct { + DateRange []RadarQualitySpeedTopLocationListResponseResultMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + ConfidenceInfo RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarQualitySpeedTopLocationListResponseResultMetaJSON `json:"-"` +} + +// radarQualitySpeedTopLocationListResponseResultMetaJSON contains the JSON +// metadata for the struct [RadarQualitySpeedTopLocationListResponseResultMeta] +type radarQualitySpeedTopLocationListResponseResultMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopLocationListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopLocationListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarQualitySpeedTopLocationListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarQualitySpeedTopLocationListResponseResultMetaDateRangeJSON contains the +// JSON metadata for the struct +// [RadarQualitySpeedTopLocationListResponseResultMetaDateRange] +type radarQualitySpeedTopLocationListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopLocationListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfo struct { + Annotations []RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoJSON contains +// the JSON metadata for the struct +// [RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfo] +type radarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoAnnotation] +type radarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopLocationListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopLocationListResponseResultTop0 struct { + BandwidthDownload string `json:"bandwidthDownload,required"` + BandwidthUpload string `json:"bandwidthUpload,required"` + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + JitterIdle string `json:"jitterIdle,required"` + JitterLoaded string `json:"jitterLoaded,required"` + LatencyIdle string `json:"latencyIdle,required"` + LatencyLoaded string `json:"latencyLoaded,required"` + NumTests float64 `json:"numTests,required"` + RankPower float64 `json:"rankPower,required"` + JSON radarQualitySpeedTopLocationListResponseResultTop0JSON `json:"-"` +} + +// radarQualitySpeedTopLocationListResponseResultTop0JSON contains the JSON +// metadata for the struct [RadarQualitySpeedTopLocationListResponseResultTop0] +type radarQualitySpeedTopLocationListResponseResultTop0JSON struct { + BandwidthDownload apijson.Field + BandwidthUpload apijson.Field + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + JitterIdle apijson.Field + JitterLoaded apijson.Field + LatencyIdle apijson.Field + LatencyLoaded apijson.Field + NumTests apijson.Field + RankPower apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarQualitySpeedTopLocationListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarQualitySpeedTopLocationListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarQualitySpeedTopLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Metric to order the results by. + OrderBy param.Field[RadarQualitySpeedTopLocationListParamsOrderBy] `query:"orderBy"` + // Reverse the order of results. + Reverse param.Field[bool] `query:"reverse"` +} + +// URLQuery serializes [RadarQualitySpeedTopLocationListParams]'s query parameters +// as `url.Values`. +func (r RadarQualitySpeedTopLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarQualitySpeedTopLocationListParamsFormat string + +const ( + RadarQualitySpeedTopLocationListParamsFormatJson RadarQualitySpeedTopLocationListParamsFormat = "JSON" + RadarQualitySpeedTopLocationListParamsFormatCsv RadarQualitySpeedTopLocationListParamsFormat = "CSV" +) + +// Metric to order the results by. +type RadarQualitySpeedTopLocationListParamsOrderBy string + +const ( + RadarQualitySpeedTopLocationListParamsOrderByBandwidthDownload RadarQualitySpeedTopLocationListParamsOrderBy = "BANDWIDTH_DOWNLOAD" + RadarQualitySpeedTopLocationListParamsOrderByBandwidthUpload RadarQualitySpeedTopLocationListParamsOrderBy = "BANDWIDTH_UPLOAD" + RadarQualitySpeedTopLocationListParamsOrderByLatencyIdle RadarQualitySpeedTopLocationListParamsOrderBy = "LATENCY_IDLE" + RadarQualitySpeedTopLocationListParamsOrderByLatencyLoaded RadarQualitySpeedTopLocationListParamsOrderBy = "LATENCY_LOADED" + RadarQualitySpeedTopLocationListParamsOrderByJitterIdle RadarQualitySpeedTopLocationListParamsOrderBy = "JITTER_IDLE" + RadarQualitySpeedTopLocationListParamsOrderByJitterLoaded RadarQualitySpeedTopLocationListParamsOrderBy = "JITTER_LOADED" +) diff --git a/radarqualityspeedtoplocation_test.go b/radarqualityspeedtoplocation_test.go new file mode 100644 index 00000000000..b361cc49264 --- /dev/null +++ b/radarqualityspeedtoplocation_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarQualitySpeedTopLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Quality.Speed.Top.Locations.List(context.TODO(), cloudflare.RadarQualitySpeedTopLocationListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarQualitySpeedTopLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + OrderBy: cloudflare.F(cloudflare.RadarQualitySpeedTopLocationListParamsOrderByBandwidthDownload), + Reverse: cloudflare.F(true), + }) + 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/radarranking.go b/radarranking.go new file mode 100644 index 00000000000..a92e07ccbe4 --- /dev/null +++ b/radarranking.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarRankingService 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 [NewRadarRankingService] method +// instead. +type RadarRankingService struct { + Options []option.RequestOption + Domains *RadarRankingDomainService + TimeseriesGroups *RadarRankingTimeseriesGroupService + Tops *RadarRankingTopService +} + +// NewRadarRankingService 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 NewRadarRankingService(opts ...option.RequestOption) (r *RadarRankingService) { + r = &RadarRankingService{} + r.Options = opts + r.Domains = NewRadarRankingDomainService(opts...) + r.TimeseriesGroups = NewRadarRankingTimeseriesGroupService(opts...) + r.Tops = NewRadarRankingTopService(opts...) + return +} diff --git a/radarrankingdomain.go b/radarrankingdomain.go new file mode 100644 index 00000000000..b048c4f9daa --- /dev/null +++ b/radarrankingdomain.go @@ -0,0 +1,186 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarRankingDomainService 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 [NewRadarRankingDomainService] method +// instead. +type RadarRankingDomainService struct { + Options []option.RequestOption +} + +// NewRadarRankingDomainService 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 NewRadarRankingDomainService(opts ...option.RequestOption) (r *RadarRankingDomainService) { + r = &RadarRankingDomainService{} + r.Options = opts + return +} + +// Gets Domains Rank details. Cloudflare provides an ordered rank for the top 100 +// domains, but for the remainder it only provides ranking buckets like top 200 +// thousand, top one million, etc.. These are available through Radar datasets +// endpoints. +func (r *RadarRankingDomainService) Get(ctx context.Context, domain string, query RadarRankingDomainGetParams, opts ...option.RequestOption) (res *RadarRankingDomainGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("radar/ranking/domain/%s", domain) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarRankingDomainGetResponse struct { + Result RadarRankingDomainGetResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarRankingDomainGetResponseJSON `json:"-"` +} + +// radarRankingDomainGetResponseJSON contains the JSON metadata for the struct +// [RadarRankingDomainGetResponse] +type radarRankingDomainGetResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingDomainGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingDomainGetResponseResult struct { + Details0 RadarRankingDomainGetResponseResultDetails0 `json:"details_0,required"` + JSON radarRankingDomainGetResponseResultJSON `json:"-"` +} + +// radarRankingDomainGetResponseResultJSON contains the JSON metadata for the +// struct [RadarRankingDomainGetResponseResult] +type radarRankingDomainGetResponseResultJSON struct { + Details0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingDomainGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingDomainGetResponseResultDetails0 struct { + Categories []RadarRankingDomainGetResponseResultDetails0Category `json:"categories,required"` + TopLocations []RadarRankingDomainGetResponseResultDetails0TopLocation `json:"top_locations,required"` + // Only available in POPULAR ranking for the most recent ranking. + Bucket string `json:"bucket"` + Rank int64 `json:"rank"` + JSON radarRankingDomainGetResponseResultDetails0JSON `json:"-"` +} + +// radarRankingDomainGetResponseResultDetails0JSON contains the JSON metadata for +// the struct [RadarRankingDomainGetResponseResultDetails0] +type radarRankingDomainGetResponseResultDetails0JSON struct { + Categories apijson.Field + TopLocations apijson.Field + Bucket apijson.Field + Rank apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingDomainGetResponseResultDetails0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingDomainGetResponseResultDetails0Category struct { + ID float64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID float64 `json:"superCategoryId,required"` + JSON radarRankingDomainGetResponseResultDetails0CategoryJSON `json:"-"` +} + +// radarRankingDomainGetResponseResultDetails0CategoryJSON contains the JSON +// metadata for the struct [RadarRankingDomainGetResponseResultDetails0Category] +type radarRankingDomainGetResponseResultDetails0CategoryJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingDomainGetResponseResultDetails0Category) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingDomainGetResponseResultDetails0TopLocation struct { + LocationCode string `json:"locationCode,required"` + LocationName string `json:"locationName,required"` + Rank int64 `json:"rank,required"` + JSON radarRankingDomainGetResponseResultDetails0TopLocationJSON `json:"-"` +} + +// radarRankingDomainGetResponseResultDetails0TopLocationJSON contains the JSON +// metadata for the struct [RadarRankingDomainGetResponseResultDetails0TopLocation] +type radarRankingDomainGetResponseResultDetails0TopLocationJSON struct { + LocationCode apijson.Field + LocationName apijson.Field + Rank apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingDomainGetResponseResultDetails0TopLocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingDomainGetParams struct { + // Array of dates to filter the ranking. + Date param.Field[[]string] `query:"date"` + // Format results are returned in. + Format param.Field[RadarRankingDomainGetParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // The ranking type. + RankingType param.Field[RadarRankingDomainGetParamsRankingType] `query:"rankingType"` +} + +// URLQuery serializes [RadarRankingDomainGetParams]'s query parameters as +// `url.Values`. +func (r RadarRankingDomainGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarRankingDomainGetParamsFormat string + +const ( + RadarRankingDomainGetParamsFormatJson RadarRankingDomainGetParamsFormat = "JSON" + RadarRankingDomainGetParamsFormatCsv RadarRankingDomainGetParamsFormat = "CSV" +) + +// The ranking type. +type RadarRankingDomainGetParamsRankingType string + +const ( + RadarRankingDomainGetParamsRankingTypePopular RadarRankingDomainGetParamsRankingType = "POPULAR" + RadarRankingDomainGetParamsRankingTypeTrendingRise RadarRankingDomainGetParamsRankingType = "TRENDING_RISE" + RadarRankingDomainGetParamsRankingTypeTrendingSteady RadarRankingDomainGetParamsRankingType = "TRENDING_STEADY" +) diff --git a/radarrankingdomain_test.go b/radarrankingdomain_test.go new file mode 100644 index 00000000000..410d77f337d --- /dev/null +++ b/radarrankingdomain_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarRankingDomainGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Ranking.Domains.Get( + context.TODO(), + "google.com", + cloudflare.RadarRankingDomainGetParams{ + Date: cloudflare.F([]string{"string", "string", "string"}), + Format: cloudflare.F(cloudflare.RadarRankingDomainGetParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Name: cloudflare.F([]string{"string", "string", "string"}), + RankingType: cloudflare.F(cloudflare.RadarRankingDomainGetParamsRankingTypePopular), + }, + ) + 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/radarrankingtimeseriesgroup.go b/radarrankingtimeseriesgroup.go new file mode 100644 index 00000000000..90670c84afc --- /dev/null +++ b/radarrankingtimeseriesgroup.go @@ -0,0 +1,205 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarRankingTimeseriesGroupService 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 +// [NewRadarRankingTimeseriesGroupService] method instead. +type RadarRankingTimeseriesGroupService struct { + Options []option.RequestOption +} + +// NewRadarRankingTimeseriesGroupService 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 NewRadarRankingTimeseriesGroupService(opts ...option.RequestOption) (r *RadarRankingTimeseriesGroupService) { + r = &RadarRankingTimeseriesGroupService{} + r.Options = opts + return +} + +// Gets Domains Rank updates change over time. Raw values are returned. +func (r *RadarRankingTimeseriesGroupService) List(ctx context.Context, query RadarRankingTimeseriesGroupListParams, opts ...option.RequestOption) (res *RadarRankingTimeseriesGroupListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/ranking/timeseries_groups" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarRankingTimeseriesGroupListResponse struct { + Result RadarRankingTimeseriesGroupListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarRankingTimeseriesGroupListResponseJSON `json:"-"` +} + +// radarRankingTimeseriesGroupListResponseJSON contains the JSON metadata for the +// struct [RadarRankingTimeseriesGroupListResponse] +type radarRankingTimeseriesGroupListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTimeseriesGroupListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTimeseriesGroupListResponseResult struct { + Meta RadarRankingTimeseriesGroupListResponseResultMeta `json:"meta,required"` + Serie0 RadarRankingTimeseriesGroupListResponseResultSerie0 `json:"serie_0,required"` + JSON radarRankingTimeseriesGroupListResponseResultJSON `json:"-"` +} + +// radarRankingTimeseriesGroupListResponseResultJSON contains the JSON metadata for +// the struct [RadarRankingTimeseriesGroupListResponseResult] +type radarRankingTimeseriesGroupListResponseResultJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTimeseriesGroupListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTimeseriesGroupListResponseResultMeta struct { + DateRange []RadarRankingTimeseriesGroupListResponseResultMetaDateRange `json:"dateRange,required"` + JSON radarRankingTimeseriesGroupListResponseResultMetaJSON `json:"-"` +} + +// radarRankingTimeseriesGroupListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarRankingTimeseriesGroupListResponseResultMeta] +type radarRankingTimeseriesGroupListResponseResultMetaJSON struct { + DateRange apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTimeseriesGroupListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTimeseriesGroupListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarRankingTimeseriesGroupListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarRankingTimeseriesGroupListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarRankingTimeseriesGroupListResponseResultMetaDateRange] +type radarRankingTimeseriesGroupListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTimeseriesGroupListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTimeseriesGroupListResponseResultSerie0 struct { + Timestamps []string `json:"timestamps,required"` + JSON radarRankingTimeseriesGroupListResponseResultSerie0JSON `json:"-"` +} + +// radarRankingTimeseriesGroupListResponseResultSerie0JSON contains the JSON +// metadata for the struct [RadarRankingTimeseriesGroupListResponseResultSerie0] +type radarRankingTimeseriesGroupListResponseResultSerie0JSON struct { + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTimeseriesGroupListResponseResultSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTimeseriesGroupListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarRankingTimeseriesGroupListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Array of comma separated list of domains names. + Domains param.Field[[]string] `query:"domains"` + // Format results are returned in. + Format param.Field[RadarRankingTimeseriesGroupListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of locations (alpha-2 country codes). + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // The ranking type. + RankingType param.Field[RadarRankingTimeseriesGroupListParamsRankingType] `query:"rankingType"` +} + +// URLQuery serializes [RadarRankingTimeseriesGroupListParams]'s query parameters +// as `url.Values`. +func (r RadarRankingTimeseriesGroupListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarRankingTimeseriesGroupListParamsDateRange string + +const ( + RadarRankingTimeseriesGroupListParamsDateRange1d RadarRankingTimeseriesGroupListParamsDateRange = "1d" + RadarRankingTimeseriesGroupListParamsDateRange2d RadarRankingTimeseriesGroupListParamsDateRange = "2d" + RadarRankingTimeseriesGroupListParamsDateRange7d RadarRankingTimeseriesGroupListParamsDateRange = "7d" + RadarRankingTimeseriesGroupListParamsDateRange14d RadarRankingTimeseriesGroupListParamsDateRange = "14d" + RadarRankingTimeseriesGroupListParamsDateRange28d RadarRankingTimeseriesGroupListParamsDateRange = "28d" + RadarRankingTimeseriesGroupListParamsDateRange12w RadarRankingTimeseriesGroupListParamsDateRange = "12w" + RadarRankingTimeseriesGroupListParamsDateRange24w RadarRankingTimeseriesGroupListParamsDateRange = "24w" + RadarRankingTimeseriesGroupListParamsDateRange52w RadarRankingTimeseriesGroupListParamsDateRange = "52w" + RadarRankingTimeseriesGroupListParamsDateRange1dControl RadarRankingTimeseriesGroupListParamsDateRange = "1dControl" + RadarRankingTimeseriesGroupListParamsDateRange2dControl RadarRankingTimeseriesGroupListParamsDateRange = "2dControl" + RadarRankingTimeseriesGroupListParamsDateRange7dControl RadarRankingTimeseriesGroupListParamsDateRange = "7dControl" + RadarRankingTimeseriesGroupListParamsDateRange14dControl RadarRankingTimeseriesGroupListParamsDateRange = "14dControl" + RadarRankingTimeseriesGroupListParamsDateRange28dControl RadarRankingTimeseriesGroupListParamsDateRange = "28dControl" + RadarRankingTimeseriesGroupListParamsDateRange12wControl RadarRankingTimeseriesGroupListParamsDateRange = "12wControl" + RadarRankingTimeseriesGroupListParamsDateRange24wControl RadarRankingTimeseriesGroupListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarRankingTimeseriesGroupListParamsFormat string + +const ( + RadarRankingTimeseriesGroupListParamsFormatJson RadarRankingTimeseriesGroupListParamsFormat = "JSON" + RadarRankingTimeseriesGroupListParamsFormatCsv RadarRankingTimeseriesGroupListParamsFormat = "CSV" +) + +// The ranking type. +type RadarRankingTimeseriesGroupListParamsRankingType string + +const ( + RadarRankingTimeseriesGroupListParamsRankingTypePopular RadarRankingTimeseriesGroupListParamsRankingType = "POPULAR" + RadarRankingTimeseriesGroupListParamsRankingTypeTrendingRise RadarRankingTimeseriesGroupListParamsRankingType = "TRENDING_RISE" + RadarRankingTimeseriesGroupListParamsRankingTypeTrendingSteady RadarRankingTimeseriesGroupListParamsRankingType = "TRENDING_STEADY" +) diff --git a/radarrankingtimeseriesgroup_test.go b/radarrankingtimeseriesgroup_test.go new file mode 100644 index 00000000000..4aa8f4c4491 --- /dev/null +++ b/radarrankingtimeseriesgroup_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarRankingTimeseriesGroupListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Ranking.TimeseriesGroups.List(context.TODO(), cloudflare.RadarRankingTimeseriesGroupListParams{ + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarRankingTimeseriesGroupListParamsDateRange{cloudflare.RadarRankingTimeseriesGroupListParamsDateRange1d, cloudflare.RadarRankingTimeseriesGroupListParamsDateRange2d, cloudflare.RadarRankingTimeseriesGroupListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Domains: cloudflare.F([]string{"string", "string", "string"}), + Format: cloudflare.F(cloudflare.RadarRankingTimeseriesGroupListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + RankingType: cloudflare.F(cloudflare.RadarRankingTimeseriesGroupListParamsRankingTypePopular), + }) + 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/radarrankingtop.go b/radarrankingtop.go new file mode 100644 index 00000000000..d071626ef67 --- /dev/null +++ b/radarrankingtop.go @@ -0,0 +1,202 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarRankingTopService 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 [NewRadarRankingTopService] method +// instead. +type RadarRankingTopService struct { + Options []option.RequestOption +} + +// NewRadarRankingTopService 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 NewRadarRankingTopService(opts ...option.RequestOption) (r *RadarRankingTopService) { + r = &RadarRankingTopService{} + r.Options = opts + return +} + +// Get top or trending domains based on their rank. Popular domains are domains of +// broad appeal based on how people use the Internet. Trending domains are domains +// that are generating a surge in interest. For more information on top domains, +// see https://blog.cloudflare.com/radar-domain-rankings/. +func (r *RadarRankingTopService) List(ctx context.Context, query RadarRankingTopListParams, opts ...option.RequestOption) (res *RadarRankingTopListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/ranking/top" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarRankingTopListResponse struct { + Result RadarRankingTopListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarRankingTopListResponseJSON `json:"-"` +} + +// radarRankingTopListResponseJSON contains the JSON metadata for the struct +// [RadarRankingTopListResponse] +type radarRankingTopListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTopListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTopListResponseResult struct { + Meta RadarRankingTopListResponseResultMeta `json:"meta,required"` + Top0 []RadarRankingTopListResponseResultTop0 `json:"top_0,required"` + JSON radarRankingTopListResponseResultJSON `json:"-"` +} + +// radarRankingTopListResponseResultJSON contains the JSON metadata for the struct +// [RadarRankingTopListResponseResult] +type radarRankingTopListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTopListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTopListResponseResultMeta struct { + Top0 RadarRankingTopListResponseResultMetaTop0 `json:"top_0,required"` + JSON radarRankingTopListResponseResultMetaJSON `json:"-"` +} + +// radarRankingTopListResponseResultMetaJSON contains the JSON metadata for the +// struct [RadarRankingTopListResponseResultMeta] +type radarRankingTopListResponseResultMetaJSON struct { + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTopListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTopListResponseResultMetaTop0 struct { + Date string `json:"date,required"` + JSON radarRankingTopListResponseResultMetaTop0JSON `json:"-"` +} + +// radarRankingTopListResponseResultMetaTop0JSON contains the JSON metadata for the +// struct [RadarRankingTopListResponseResultMetaTop0] +type radarRankingTopListResponseResultMetaTop0JSON struct { + Date apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTopListResponseResultMetaTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTopListResponseResultTop0 struct { + Categories []RadarRankingTopListResponseResultTop0Category `json:"categories,required"` + Domain string `json:"domain,required"` + Rank int64 `json:"rank,required"` + // Only available in TRENDING rankings. + PctRankChange float64 `json:"pctRankChange"` + JSON radarRankingTopListResponseResultTop0JSON `json:"-"` +} + +// radarRankingTopListResponseResultTop0JSON contains the JSON metadata for the +// struct [RadarRankingTopListResponseResultTop0] +type radarRankingTopListResponseResultTop0JSON struct { + Categories apijson.Field + Domain apijson.Field + Rank apijson.Field + PctRankChange apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTopListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTopListResponseResultTop0Category struct { + ID float64 `json:"id,required"` + Name string `json:"name,required"` + SuperCategoryID float64 `json:"superCategoryId,required"` + JSON radarRankingTopListResponseResultTop0CategoryJSON `json:"-"` +} + +// radarRankingTopListResponseResultTop0CategoryJSON contains the JSON metadata for +// the struct [RadarRankingTopListResponseResultTop0Category] +type radarRankingTopListResponseResultTop0CategoryJSON struct { + ID apijson.Field + Name apijson.Field + SuperCategoryID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarRankingTopListResponseResultTop0Category) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarRankingTopListParams struct { + // Array of dates to filter the ranking. + Date param.Field[[]string] `query:"date"` + // Format results are returned in. + Format param.Field[RadarRankingTopListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of locations (alpha-2 country codes). + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // The ranking type. + RankingType param.Field[RadarRankingTopListParamsRankingType] `query:"rankingType"` +} + +// URLQuery serializes [RadarRankingTopListParams]'s query parameters as +// `url.Values`. +func (r RadarRankingTopListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Format results are returned in. +type RadarRankingTopListParamsFormat string + +const ( + RadarRankingTopListParamsFormatJson RadarRankingTopListParamsFormat = "JSON" + RadarRankingTopListParamsFormatCsv RadarRankingTopListParamsFormat = "CSV" +) + +// The ranking type. +type RadarRankingTopListParamsRankingType string + +const ( + RadarRankingTopListParamsRankingTypePopular RadarRankingTopListParamsRankingType = "POPULAR" + RadarRankingTopListParamsRankingTypeTrendingRise RadarRankingTopListParamsRankingType = "TRENDING_RISE" + RadarRankingTopListParamsRankingTypeTrendingSteady RadarRankingTopListParamsRankingType = "TRENDING_STEADY" +) diff --git a/radarrankingtop_test.go b/radarrankingtop_test.go new file mode 100644 index 00000000000..736cb1cc837 --- /dev/null +++ b/radarrankingtop_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarRankingTopListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Ranking.Tops.List(context.TODO(), cloudflare.RadarRankingTopListParams{ + Date: cloudflare.F([]string{"string", "string", "string"}), + Format: cloudflare.F(cloudflare.RadarRankingTopListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + RankingType: cloudflare.F(cloudflare.RadarRankingTopListParamsRankingTypePopular), + }) + 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/radarsearch.go b/radarsearch.go new file mode 100644 index 00000000000..9e986d7858d --- /dev/null +++ b/radarsearch.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarSearchService 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 [NewRadarSearchService] method +// instead. +type RadarSearchService struct { + Options []option.RequestOption + Globals *RadarSearchGlobalService +} + +// NewRadarSearchService 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 NewRadarSearchService(opts ...option.RequestOption) (r *RadarSearchService) { + r = &RadarSearchService{} + r.Options = opts + r.Globals = NewRadarSearchGlobalService(opts...) + return +} diff --git a/radarsearchglobal.go b/radarsearchglobal.go new file mode 100644 index 00000000000..1013220f433 --- /dev/null +++ b/radarsearchglobal.go @@ -0,0 +1,148 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarSearchGlobalService 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 [NewRadarSearchGlobalService] method +// instead. +type RadarSearchGlobalService struct { + Options []option.RequestOption +} + +// NewRadarSearchGlobalService 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 NewRadarSearchGlobalService(opts ...option.RequestOption) (r *RadarSearchGlobalService) { + r = &RadarSearchGlobalService{} + r.Options = opts + return +} + +// Lets you search for locations, autonomous systems (AS) and reports. +func (r *RadarSearchGlobalService) List(ctx context.Context, query RadarSearchGlobalListParams, opts ...option.RequestOption) (res *RadarSearchGlobalListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/search/global" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarSearchGlobalListResponse struct { + Result RadarSearchGlobalListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarSearchGlobalListResponseJSON `json:"-"` +} + +// radarSearchGlobalListResponseJSON contains the JSON metadata for the struct +// [RadarSearchGlobalListResponse] +type radarSearchGlobalListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarSearchGlobalListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarSearchGlobalListResponseResult struct { + Search []RadarSearchGlobalListResponseResultSearch `json:"search,required"` + JSON radarSearchGlobalListResponseResultJSON `json:"-"` +} + +// radarSearchGlobalListResponseResultJSON contains the JSON metadata for the +// struct [RadarSearchGlobalListResponseResult] +type radarSearchGlobalListResponseResultJSON struct { + Search apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarSearchGlobalListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarSearchGlobalListResponseResultSearch struct { + Code string `json:"code,required"` + Name string `json:"name,required"` + Type string `json:"type,required"` + JSON radarSearchGlobalListResponseResultSearchJSON `json:"-"` +} + +// radarSearchGlobalListResponseResultSearchJSON contains the JSON metadata for the +// struct [RadarSearchGlobalListResponseResultSearch] +type radarSearchGlobalListResponseResultSearchJSON struct { + Code apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarSearchGlobalListResponseResultSearch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarSearchGlobalListParams struct { + // Search for locations, AS and reports. + Query param.Field[string] `query:"query,required"` + // Search types to be excluded from results. + Exclude param.Field[[]RadarSearchGlobalListParamsExclude] `query:"exclude"` + // Format results are returned in. + Format param.Field[RadarSearchGlobalListParamsFormat] `query:"format"` + // Search types to be included in results. + Include param.Field[[]RadarSearchGlobalListParamsInclude] `query:"include"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Limit the number of objects per search category. + LimitPerGroup param.Field[float64] `query:"limitPerGroup"` +} + +// URLQuery serializes [RadarSearchGlobalListParams]'s query parameters as +// `url.Values`. +func (r RadarSearchGlobalListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarSearchGlobalListParamsExclude string + +const ( + RadarSearchGlobalListParamsExcludeSpecialEvents RadarSearchGlobalListParamsExclude = "SPECIAL_EVENTS" + RadarSearchGlobalListParamsExcludeNotebooks RadarSearchGlobalListParamsExclude = "NOTEBOOKS" + RadarSearchGlobalListParamsExcludeLocations RadarSearchGlobalListParamsExclude = "LOCATIONS" + RadarSearchGlobalListParamsExcludeASNs RadarSearchGlobalListParamsExclude = "ASNS" +) + +// Format results are returned in. +type RadarSearchGlobalListParamsFormat string + +const ( + RadarSearchGlobalListParamsFormatJson RadarSearchGlobalListParamsFormat = "JSON" + RadarSearchGlobalListParamsFormatCsv RadarSearchGlobalListParamsFormat = "CSV" +) + +type RadarSearchGlobalListParamsInclude string + +const ( + RadarSearchGlobalListParamsIncludeSpecialEvents RadarSearchGlobalListParamsInclude = "SPECIAL_EVENTS" + RadarSearchGlobalListParamsIncludeNotebooks RadarSearchGlobalListParamsInclude = "NOTEBOOKS" + RadarSearchGlobalListParamsIncludeLocations RadarSearchGlobalListParamsInclude = "LOCATIONS" + RadarSearchGlobalListParamsIncludeASNs RadarSearchGlobalListParamsInclude = "ASNS" +) diff --git a/radarsearchglobal_test.go b/radarsearchglobal_test.go new file mode 100644 index 00000000000..61abbc2b530 --- /dev/null +++ b/radarsearchglobal_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarSearchGlobalListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.Searches.Globals.List(context.TODO(), cloudflare.RadarSearchGlobalListParams{ + Query: cloudflare.F("United"), + Exclude: cloudflare.F([]cloudflare.RadarSearchGlobalListParamsExclude{cloudflare.RadarSearchGlobalListParamsExcludeSpecialEvents, cloudflare.RadarSearchGlobalListParamsExcludeNotebooks, cloudflare.RadarSearchGlobalListParamsExcludeLocations}), + Format: cloudflare.F(cloudflare.RadarSearchGlobalListParamsFormatJson), + Include: cloudflare.F([]cloudflare.RadarSearchGlobalListParamsInclude{cloudflare.RadarSearchGlobalListParamsIncludeSpecialEvents, cloudflare.RadarSearchGlobalListParamsIncludeNotebooks, cloudflare.RadarSearchGlobalListParamsIncludeLocations}), + Limit: cloudflare.F(int64(5)), + LimitPerGroup: cloudflare.F(0.000000), + }) + 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/radartrafficanomaly.go b/radartrafficanomaly.go new file mode 100644 index 00000000000..da6a0d4e65c --- /dev/null +++ b/radartrafficanomaly.go @@ -0,0 +1,242 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarTrafficAnomalyService 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 [NewRadarTrafficAnomalyService] +// method instead. +type RadarTrafficAnomalyService struct { + Options []option.RequestOption + Locations *RadarTrafficAnomalyLocationService +} + +// NewRadarTrafficAnomalyService 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 NewRadarTrafficAnomalyService(opts ...option.RequestOption) (r *RadarTrafficAnomalyService) { + r = &RadarTrafficAnomalyService{} + r.Options = opts + r.Locations = NewRadarTrafficAnomalyLocationService(opts...) + return +} + +// Internet traffic anomalies are signals that might point to an outage, These +// alerts are automatically detected by Radar and then manually verified by our +// team. This endpoint returns the latest alerts. +func (r *RadarTrafficAnomalyService) List(ctx context.Context, query RadarTrafficAnomalyListParams, opts ...option.RequestOption) (res *RadarTrafficAnomalyListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/traffic_anomalies" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarTrafficAnomalyListResponse struct { + Result RadarTrafficAnomalyListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarTrafficAnomalyListResponseJSON `json:"-"` +} + +// radarTrafficAnomalyListResponseJSON contains the JSON metadata for the struct +// [RadarTrafficAnomalyListResponse] +type radarTrafficAnomalyListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyListResponseResult struct { + TrafficAnomalies []RadarTrafficAnomalyListResponseResultTrafficAnomaly `json:"trafficAnomalies,required"` + JSON radarTrafficAnomalyListResponseResultJSON `json:"-"` +} + +// radarTrafficAnomalyListResponseResultJSON contains the JSON metadata for the +// struct [RadarTrafficAnomalyListResponseResult] +type radarTrafficAnomalyListResponseResultJSON struct { + TrafficAnomalies apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyListResponseResultTrafficAnomaly struct { + StartDate string `json:"startDate,required"` + Status string `json:"status,required"` + Type string `json:"type,required"` + Uuid string `json:"uuid,required"` + ASNDetails RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetails `json:"asnDetails"` + EndDate string `json:"endDate"` + LocationDetails RadarTrafficAnomalyListResponseResultTrafficAnomaliesLocationDetails `json:"locationDetails"` + VisibleInDataSources []string `json:"visibleInDataSources"` + JSON radarTrafficAnomalyListResponseResultTrafficAnomalyJSON `json:"-"` +} + +// radarTrafficAnomalyListResponseResultTrafficAnomalyJSON contains the JSON +// metadata for the struct [RadarTrafficAnomalyListResponseResultTrafficAnomaly] +type radarTrafficAnomalyListResponseResultTrafficAnomalyJSON struct { + StartDate apijson.Field + Status apijson.Field + Type apijson.Field + Uuid apijson.Field + ASNDetails apijson.Field + EndDate apijson.Field + LocationDetails apijson.Field + VisibleInDataSources apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyListResponseResultTrafficAnomaly) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetails struct { + ASN string `json:"asn,required"` + Name string `json:"name,required"` + Locations RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsLocations `json:"locations"` + JSON radarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsJSON `json:"-"` +} + +// radarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsJSON contains the +// JSON metadata for the struct +// [RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetails] +type radarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsJSON struct { + ASN apijson.Field + Name apijson.Field + Locations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetails) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsLocations struct { + Code string `json:"code,required"` + Name string `json:"name,required"` + JSON radarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsLocationsJSON `json:"-"` +} + +// radarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsLocationsJSON +// contains the JSON metadata for the struct +// [RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsLocations] +type radarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsLocationsJSON struct { + Code apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyListResponseResultTrafficAnomaliesASNDetailsLocations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyListResponseResultTrafficAnomaliesLocationDetails struct { + Code string `json:"code,required"` + Name string `json:"name,required"` + JSON radarTrafficAnomalyListResponseResultTrafficAnomaliesLocationDetailsJSON `json:"-"` +} + +// radarTrafficAnomalyListResponseResultTrafficAnomaliesLocationDetailsJSON +// contains the JSON metadata for the struct +// [RadarTrafficAnomalyListResponseResultTrafficAnomaliesLocationDetails] +type radarTrafficAnomalyListResponseResultTrafficAnomaliesLocationDetailsJSON struct { + Code apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyListResponseResultTrafficAnomaliesLocationDetails) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyListParams struct { + // Single ASN as integer. + ASN param.Field[int64] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[time.Time] `query:"dateEnd" format:"date-time"` + // Shorthand date ranges for the last X days - use when you don't need specific + // start and end dates. + DateRange param.Field[RadarTrafficAnomalyListParamsDateRange] `query:"dateRange"` + // Start of the date range (inclusive). + DateStart param.Field[time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarTrafficAnomalyListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Location Alpha2 code. + Location param.Field[string] `query:"location"` + // Number of objects to skip before grabbing results. + Offset param.Field[int64] `query:"offset"` + Status param.Field[RadarTrafficAnomalyListParamsStatus] `query:"status"` +} + +// URLQuery serializes [RadarTrafficAnomalyListParams]'s query parameters as +// `url.Values`. +func (r RadarTrafficAnomalyListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Shorthand date ranges for the last X days - use when you don't need specific +// start and end dates. +type RadarTrafficAnomalyListParamsDateRange string + +const ( + RadarTrafficAnomalyListParamsDateRange1d RadarTrafficAnomalyListParamsDateRange = "1d" + RadarTrafficAnomalyListParamsDateRange2d RadarTrafficAnomalyListParamsDateRange = "2d" + RadarTrafficAnomalyListParamsDateRange7d RadarTrafficAnomalyListParamsDateRange = "7d" + RadarTrafficAnomalyListParamsDateRange14d RadarTrafficAnomalyListParamsDateRange = "14d" + RadarTrafficAnomalyListParamsDateRange28d RadarTrafficAnomalyListParamsDateRange = "28d" + RadarTrafficAnomalyListParamsDateRange12w RadarTrafficAnomalyListParamsDateRange = "12w" + RadarTrafficAnomalyListParamsDateRange24w RadarTrafficAnomalyListParamsDateRange = "24w" + RadarTrafficAnomalyListParamsDateRange52w RadarTrafficAnomalyListParamsDateRange = "52w" + RadarTrafficAnomalyListParamsDateRange1dControl RadarTrafficAnomalyListParamsDateRange = "1dControl" + RadarTrafficAnomalyListParamsDateRange2dControl RadarTrafficAnomalyListParamsDateRange = "2dControl" + RadarTrafficAnomalyListParamsDateRange7dControl RadarTrafficAnomalyListParamsDateRange = "7dControl" + RadarTrafficAnomalyListParamsDateRange14dControl RadarTrafficAnomalyListParamsDateRange = "14dControl" + RadarTrafficAnomalyListParamsDateRange28dControl RadarTrafficAnomalyListParamsDateRange = "28dControl" + RadarTrafficAnomalyListParamsDateRange12wControl RadarTrafficAnomalyListParamsDateRange = "12wControl" + RadarTrafficAnomalyListParamsDateRange24wControl RadarTrafficAnomalyListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarTrafficAnomalyListParamsFormat string + +const ( + RadarTrafficAnomalyListParamsFormatJson RadarTrafficAnomalyListParamsFormat = "JSON" + RadarTrafficAnomalyListParamsFormatCsv RadarTrafficAnomalyListParamsFormat = "CSV" +) + +type RadarTrafficAnomalyListParamsStatus string + +const ( + RadarTrafficAnomalyListParamsStatusVerified RadarTrafficAnomalyListParamsStatus = "VERIFIED" + RadarTrafficAnomalyListParamsStatusUnverified RadarTrafficAnomalyListParamsStatus = "UNVERIFIED" +) diff --git a/radartrafficanomaly_test.go b/radartrafficanomaly_test.go new file mode 100644 index 00000000000..84ac6046d4f --- /dev/null +++ b/radartrafficanomaly_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarTrafficAnomalyListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.TrafficAnomalies.List(context.TODO(), cloudflare.RadarTrafficAnomalyListParams{ + ASN: cloudflare.F(int64(174)), + DateEnd: cloudflare.F(time.Now()), + DateRange: cloudflare.F(cloudflare.RadarTrafficAnomalyListParamsDateRange7d), + DateStart: cloudflare.F(time.Now()), + Format: cloudflare.F(cloudflare.RadarTrafficAnomalyListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F("US"), + Offset: cloudflare.F(int64(0)), + Status: cloudflare.F(cloudflare.RadarTrafficAnomalyListParamsStatusVerified), + }) + 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/radartrafficanomalylocation.go b/radartrafficanomalylocation.go new file mode 100644 index 00000000000..c61901d5fe7 --- /dev/null +++ b/radartrafficanomalylocation.go @@ -0,0 +1,163 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarTrafficAnomalyLocationService 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 +// [NewRadarTrafficAnomalyLocationService] method instead. +type RadarTrafficAnomalyLocationService struct { + Options []option.RequestOption +} + +// NewRadarTrafficAnomalyLocationService 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 NewRadarTrafficAnomalyLocationService(opts ...option.RequestOption) (r *RadarTrafficAnomalyLocationService) { + r = &RadarTrafficAnomalyLocationService{} + r.Options = opts + return +} + +// Internet traffic anomalies are signals that might point to an outage, These +// alerts are automatically detected by Radar and then manually verified by our +// team. This endpoint returns the sum of alerts grouped by location. +func (r *RadarTrafficAnomalyLocationService) List(ctx context.Context, query RadarTrafficAnomalyLocationListParams, opts ...option.RequestOption) (res *RadarTrafficAnomalyLocationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/traffic_anomalies/locations" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarTrafficAnomalyLocationListResponse struct { + Result RadarTrafficAnomalyLocationListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarTrafficAnomalyLocationListResponseJSON `json:"-"` +} + +// radarTrafficAnomalyLocationListResponseJSON contains the JSON metadata for the +// struct [RadarTrafficAnomalyLocationListResponse] +type radarTrafficAnomalyLocationListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyLocationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyLocationListResponseResult struct { + TrafficAnomalies []RadarTrafficAnomalyLocationListResponseResultTrafficAnomaly `json:"trafficAnomalies,required"` + JSON radarTrafficAnomalyLocationListResponseResultJSON `json:"-"` +} + +// radarTrafficAnomalyLocationListResponseResultJSON contains the JSON metadata for +// the struct [RadarTrafficAnomalyLocationListResponseResult] +type radarTrafficAnomalyLocationListResponseResultJSON struct { + TrafficAnomalies apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyLocationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyLocationListResponseResultTrafficAnomaly struct { + ClientCountryAlpha2 string `json:"clientCountryAlpha2,required"` + ClientCountryName string `json:"clientCountryName,required"` + Value string `json:"value,required"` + JSON radarTrafficAnomalyLocationListResponseResultTrafficAnomalyJSON `json:"-"` +} + +// radarTrafficAnomalyLocationListResponseResultTrafficAnomalyJSON contains the +// JSON metadata for the struct +// [RadarTrafficAnomalyLocationListResponseResultTrafficAnomaly] +type radarTrafficAnomalyLocationListResponseResultTrafficAnomalyJSON struct { + ClientCountryAlpha2 apijson.Field + ClientCountryName apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarTrafficAnomalyLocationListResponseResultTrafficAnomaly) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarTrafficAnomalyLocationListParams struct { + // End of the date range (inclusive). + DateEnd param.Field[time.Time] `query:"dateEnd" format:"date-time"` + // Shorthand date ranges for the last X days - use when you don't need specific + // start and end dates. + DateRange param.Field[RadarTrafficAnomalyLocationListParamsDateRange] `query:"dateRange"` + // Start of the date range (inclusive). + DateStart param.Field[time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarTrafficAnomalyLocationListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + Status param.Field[RadarTrafficAnomalyLocationListParamsStatus] `query:"status"` +} + +// URLQuery serializes [RadarTrafficAnomalyLocationListParams]'s query parameters +// as `url.Values`. +func (r RadarTrafficAnomalyLocationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Shorthand date ranges for the last X days - use when you don't need specific +// start and end dates. +type RadarTrafficAnomalyLocationListParamsDateRange string + +const ( + RadarTrafficAnomalyLocationListParamsDateRange1d RadarTrafficAnomalyLocationListParamsDateRange = "1d" + RadarTrafficAnomalyLocationListParamsDateRange2d RadarTrafficAnomalyLocationListParamsDateRange = "2d" + RadarTrafficAnomalyLocationListParamsDateRange7d RadarTrafficAnomalyLocationListParamsDateRange = "7d" + RadarTrafficAnomalyLocationListParamsDateRange14d RadarTrafficAnomalyLocationListParamsDateRange = "14d" + RadarTrafficAnomalyLocationListParamsDateRange28d RadarTrafficAnomalyLocationListParamsDateRange = "28d" + RadarTrafficAnomalyLocationListParamsDateRange12w RadarTrafficAnomalyLocationListParamsDateRange = "12w" + RadarTrafficAnomalyLocationListParamsDateRange24w RadarTrafficAnomalyLocationListParamsDateRange = "24w" + RadarTrafficAnomalyLocationListParamsDateRange52w RadarTrafficAnomalyLocationListParamsDateRange = "52w" + RadarTrafficAnomalyLocationListParamsDateRange1dControl RadarTrafficAnomalyLocationListParamsDateRange = "1dControl" + RadarTrafficAnomalyLocationListParamsDateRange2dControl RadarTrafficAnomalyLocationListParamsDateRange = "2dControl" + RadarTrafficAnomalyLocationListParamsDateRange7dControl RadarTrafficAnomalyLocationListParamsDateRange = "7dControl" + RadarTrafficAnomalyLocationListParamsDateRange14dControl RadarTrafficAnomalyLocationListParamsDateRange = "14dControl" + RadarTrafficAnomalyLocationListParamsDateRange28dControl RadarTrafficAnomalyLocationListParamsDateRange = "28dControl" + RadarTrafficAnomalyLocationListParamsDateRange12wControl RadarTrafficAnomalyLocationListParamsDateRange = "12wControl" + RadarTrafficAnomalyLocationListParamsDateRange24wControl RadarTrafficAnomalyLocationListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarTrafficAnomalyLocationListParamsFormat string + +const ( + RadarTrafficAnomalyLocationListParamsFormatJson RadarTrafficAnomalyLocationListParamsFormat = "JSON" + RadarTrafficAnomalyLocationListParamsFormatCsv RadarTrafficAnomalyLocationListParamsFormat = "CSV" +) + +type RadarTrafficAnomalyLocationListParamsStatus string + +const ( + RadarTrafficAnomalyLocationListParamsStatusVerified RadarTrafficAnomalyLocationListParamsStatus = "VERIFIED" + RadarTrafficAnomalyLocationListParamsStatusUnverified RadarTrafficAnomalyLocationListParamsStatus = "UNVERIFIED" +) diff --git a/radartrafficanomalylocation_test.go b/radartrafficanomalylocation_test.go new file mode 100644 index 00000000000..84848533288 --- /dev/null +++ b/radartrafficanomalylocation_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarTrafficAnomalyLocationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.TrafficAnomalies.Locations.List(context.TODO(), cloudflare.RadarTrafficAnomalyLocationListParams{ + DateEnd: cloudflare.F(time.Now()), + DateRange: cloudflare.F(cloudflare.RadarTrafficAnomalyLocationListParamsDateRange7d), + DateStart: cloudflare.F(time.Now()), + Format: cloudflare.F(cloudflare.RadarTrafficAnomalyLocationListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Status: cloudflare.F(cloudflare.RadarTrafficAnomalyLocationListParamsStatusVerified), + }) + 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/radarverifiedbot.go b/radarverifiedbot.go new file mode 100644 index 00000000000..74089d7a011 --- /dev/null +++ b/radarverifiedbot.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarVerifiedBotService 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 [NewRadarVerifiedBotService] method +// instead. +type RadarVerifiedBotService struct { + Options []option.RequestOption + Tops *RadarVerifiedBotTopService +} + +// NewRadarVerifiedBotService 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 NewRadarVerifiedBotService(opts ...option.RequestOption) (r *RadarVerifiedBotService) { + r = &RadarVerifiedBotService{} + r.Options = opts + r.Tops = NewRadarVerifiedBotTopService(opts...) + return +} diff --git a/radarverifiedbottop.go b/radarverifiedbottop.go new file mode 100644 index 00000000000..17b19a4ffed --- /dev/null +++ b/radarverifiedbottop.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarVerifiedBotTopService 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 [NewRadarVerifiedBotTopService] +// method instead. +type RadarVerifiedBotTopService struct { + Options []option.RequestOption + Bots *RadarVerifiedBotTopBotService + Categories *RadarVerifiedBotTopCategoryService +} + +// NewRadarVerifiedBotTopService 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 NewRadarVerifiedBotTopService(opts ...option.RequestOption) (r *RadarVerifiedBotTopService) { + r = &RadarVerifiedBotTopService{} + r.Options = opts + r.Bots = NewRadarVerifiedBotTopBotService(opts...) + r.Categories = NewRadarVerifiedBotTopCategoryService(opts...) + return +} diff --git a/radarverifiedbottopbot.go b/radarverifiedbottopbot.go new file mode 100644 index 00000000000..885fa4848be --- /dev/null +++ b/radarverifiedbottopbot.go @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarVerifiedBotTopBotService 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 [NewRadarVerifiedBotTopBotService] +// method instead. +type RadarVerifiedBotTopBotService struct { + Options []option.RequestOption +} + +// NewRadarVerifiedBotTopBotService 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 NewRadarVerifiedBotTopBotService(opts ...option.RequestOption) (r *RadarVerifiedBotTopBotService) { + r = &RadarVerifiedBotTopBotService{} + r.Options = opts + return +} + +// Get top verified bots by HTTP requests, with owner and category. +func (r *RadarVerifiedBotTopBotService) List(ctx context.Context, query RadarVerifiedBotTopBotListParams, opts ...option.RequestOption) (res *RadarVerifiedBotTopBotListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/verified_bots/top/bots" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarVerifiedBotTopBotListResponse struct { + Result RadarVerifiedBotTopBotListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarVerifiedBotTopBotListResponseJSON `json:"-"` +} + +// radarVerifiedBotTopBotListResponseJSON contains the JSON metadata for the struct +// [RadarVerifiedBotTopBotListResponse] +type radarVerifiedBotTopBotListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopBotListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopBotListResponseResult struct { + Meta RadarVerifiedBotTopBotListResponseResultMeta `json:"meta,required"` + Top0 []RadarVerifiedBotTopBotListResponseResultTop0 `json:"top_0,required"` + JSON radarVerifiedBotTopBotListResponseResultJSON `json:"-"` +} + +// radarVerifiedBotTopBotListResponseResultJSON contains the JSON metadata for the +// struct [RadarVerifiedBotTopBotListResponseResult] +type radarVerifiedBotTopBotListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopBotListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopBotListResponseResultMeta struct { + DateRange []RadarVerifiedBotTopBotListResponseResultMetaDateRange `json:"dateRange,required"` + ConfidenceInfo RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarVerifiedBotTopBotListResponseResultMetaJSON `json:"-"` +} + +// radarVerifiedBotTopBotListResponseResultMetaJSON contains the JSON metadata for +// the struct [RadarVerifiedBotTopBotListResponseResultMeta] +type radarVerifiedBotTopBotListResponseResultMetaJSON struct { + DateRange apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopBotListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopBotListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarVerifiedBotTopBotListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarVerifiedBotTopBotListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct [RadarVerifiedBotTopBotListResponseResultMetaDateRange] +type radarVerifiedBotTopBotListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopBotListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfo struct { + Annotations []RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarVerifiedBotTopBotListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarVerifiedBotTopBotListResponseResultMetaConfidenceInfoJSON contains the JSON +// metadata for the struct +// [RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfo] +type radarVerifiedBotTopBotListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarVerifiedBotTopBotListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarVerifiedBotTopBotListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfoAnnotation] +type radarVerifiedBotTopBotListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopBotListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopBotListResponseResultTop0 struct { + BotCategory string `json:"botCategory,required"` + BotName string `json:"botName,required"` + BotOwner string `json:"botOwner,required"` + Value string `json:"value,required"` + JSON radarVerifiedBotTopBotListResponseResultTop0JSON `json:"-"` +} + +// radarVerifiedBotTopBotListResponseResultTop0JSON contains the JSON metadata for +// the struct [RadarVerifiedBotTopBotListResponseResultTop0] +type radarVerifiedBotTopBotListResponseResultTop0JSON struct { + BotCategory apijson.Field + BotName apijson.Field + BotOwner apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopBotListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopBotListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarVerifiedBotTopBotListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarVerifiedBotTopBotListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarVerifiedBotTopBotListParams]'s query parameters as +// `url.Values`. +func (r RadarVerifiedBotTopBotListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarVerifiedBotTopBotListParamsDateRange string + +const ( + RadarVerifiedBotTopBotListParamsDateRange1d RadarVerifiedBotTopBotListParamsDateRange = "1d" + RadarVerifiedBotTopBotListParamsDateRange2d RadarVerifiedBotTopBotListParamsDateRange = "2d" + RadarVerifiedBotTopBotListParamsDateRange7d RadarVerifiedBotTopBotListParamsDateRange = "7d" + RadarVerifiedBotTopBotListParamsDateRange14d RadarVerifiedBotTopBotListParamsDateRange = "14d" + RadarVerifiedBotTopBotListParamsDateRange28d RadarVerifiedBotTopBotListParamsDateRange = "28d" + RadarVerifiedBotTopBotListParamsDateRange12w RadarVerifiedBotTopBotListParamsDateRange = "12w" + RadarVerifiedBotTopBotListParamsDateRange24w RadarVerifiedBotTopBotListParamsDateRange = "24w" + RadarVerifiedBotTopBotListParamsDateRange52w RadarVerifiedBotTopBotListParamsDateRange = "52w" + RadarVerifiedBotTopBotListParamsDateRange1dControl RadarVerifiedBotTopBotListParamsDateRange = "1dControl" + RadarVerifiedBotTopBotListParamsDateRange2dControl RadarVerifiedBotTopBotListParamsDateRange = "2dControl" + RadarVerifiedBotTopBotListParamsDateRange7dControl RadarVerifiedBotTopBotListParamsDateRange = "7dControl" + RadarVerifiedBotTopBotListParamsDateRange14dControl RadarVerifiedBotTopBotListParamsDateRange = "14dControl" + RadarVerifiedBotTopBotListParamsDateRange28dControl RadarVerifiedBotTopBotListParamsDateRange = "28dControl" + RadarVerifiedBotTopBotListParamsDateRange12wControl RadarVerifiedBotTopBotListParamsDateRange = "12wControl" + RadarVerifiedBotTopBotListParamsDateRange24wControl RadarVerifiedBotTopBotListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarVerifiedBotTopBotListParamsFormat string + +const ( + RadarVerifiedBotTopBotListParamsFormatJson RadarVerifiedBotTopBotListParamsFormat = "JSON" + RadarVerifiedBotTopBotListParamsFormatCsv RadarVerifiedBotTopBotListParamsFormat = "CSV" +) diff --git a/radarverifiedbottopbot_test.go b/radarverifiedbottopbot_test.go new file mode 100644 index 00000000000..a9bbbd3fa78 --- /dev/null +++ b/radarverifiedbottopbot_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarVerifiedBotTopBotListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.VerifiedBots.Tops.Bots.List(context.TODO(), cloudflare.RadarVerifiedBotTopBotListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarVerifiedBotTopBotListParamsDateRange{cloudflare.RadarVerifiedBotTopBotListParamsDateRange1d, cloudflare.RadarVerifiedBotTopBotListParamsDateRange2d, cloudflare.RadarVerifiedBotTopBotListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarVerifiedBotTopBotListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/radarverifiedbottopcategory.go b/radarverifiedbottopcategory.go new file mode 100644 index 00000000000..6378dc11e77 --- /dev/null +++ b/radarverifiedbottopcategory.go @@ -0,0 +1,253 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RadarVerifiedBotTopCategoryService 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 +// [NewRadarVerifiedBotTopCategoryService] method instead. +type RadarVerifiedBotTopCategoryService struct { + Options []option.RequestOption +} + +// NewRadarVerifiedBotTopCategoryService 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 NewRadarVerifiedBotTopCategoryService(opts ...option.RequestOption) (r *RadarVerifiedBotTopCategoryService) { + r = &RadarVerifiedBotTopCategoryService{} + r.Options = opts + return +} + +// Get top verified bot categories by HTTP requests, along with their corresponding +// percentage, over the total verified bot HTTP requests. +func (r *RadarVerifiedBotTopCategoryService) List(ctx context.Context, query RadarVerifiedBotTopCategoryListParams, opts ...option.RequestOption) (res *RadarVerifiedBotTopCategoryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := "radar/verified_bots/top/categories" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type RadarVerifiedBotTopCategoryListResponse struct { + Result RadarVerifiedBotTopCategoryListResponseResult `json:"result,required"` + Success bool `json:"success,required"` + JSON radarVerifiedBotTopCategoryListResponseJSON `json:"-"` +} + +// radarVerifiedBotTopCategoryListResponseJSON contains the JSON metadata for the +// struct [RadarVerifiedBotTopCategoryListResponse] +type radarVerifiedBotTopCategoryListResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopCategoryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopCategoryListResponseResult struct { + Meta RadarVerifiedBotTopCategoryListResponseResultMeta `json:"meta,required"` + Top0 []RadarVerifiedBotTopCategoryListResponseResultTop0 `json:"top_0,required"` + JSON radarVerifiedBotTopCategoryListResponseResultJSON `json:"-"` +} + +// radarVerifiedBotTopCategoryListResponseResultJSON contains the JSON metadata for +// the struct [RadarVerifiedBotTopCategoryListResponseResult] +type radarVerifiedBotTopCategoryListResponseResultJSON struct { + Meta apijson.Field + Top0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopCategoryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopCategoryListResponseResultMeta struct { + DateRange []RadarVerifiedBotTopCategoryListResponseResultMetaDateRange `json:"dateRange,required"` + ConfidenceInfo RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfo `json:"confidenceInfo"` + JSON radarVerifiedBotTopCategoryListResponseResultMetaJSON `json:"-"` +} + +// radarVerifiedBotTopCategoryListResponseResultMetaJSON contains the JSON metadata +// for the struct [RadarVerifiedBotTopCategoryListResponseResultMeta] +type radarVerifiedBotTopCategoryListResponseResultMetaJSON struct { + DateRange apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopCategoryListResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopCategoryListResponseResultMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON radarVerifiedBotTopCategoryListResponseResultMetaDateRangeJSON `json:"-"` +} + +// radarVerifiedBotTopCategoryListResponseResultMetaDateRangeJSON contains the JSON +// metadata for the struct +// [RadarVerifiedBotTopCategoryListResponseResultMetaDateRange] +type radarVerifiedBotTopCategoryListResponseResultMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopCategoryListResponseResultMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfo struct { + Annotations []RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON radarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoJSON `json:"-"` +} + +// radarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoJSON contains the +// JSON metadata for the struct +// [RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfo] +type radarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON radarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// radarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoAnnotationJSON +// contains the JSON metadata for the struct +// [RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoAnnotation] +type radarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopCategoryListResponseResultMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopCategoryListResponseResultTop0 struct { + BotCategory string `json:"botCategory,required"` + Value string `json:"value,required"` + JSON radarVerifiedBotTopCategoryListResponseResultTop0JSON `json:"-"` +} + +// radarVerifiedBotTopCategoryListResponseResultTop0JSON contains the JSON metadata +// for the struct [RadarVerifiedBotTopCategoryListResponseResultTop0] +type radarVerifiedBotTopCategoryListResponseResultTop0JSON struct { + BotCategory apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarVerifiedBotTopCategoryListResponseResultTop0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarVerifiedBotTopCategoryListParams struct { + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarVerifiedBotTopCategoryListParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Format results are returned in. + Format param.Field[RadarVerifiedBotTopCategoryListParamsFormat] `query:"format"` + // Limit the number of objects in the response. + Limit param.Field[int64] `query:"limit"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarVerifiedBotTopCategoryListParams]'s query parameters +// as `url.Values`. +func (r RadarVerifiedBotTopCategoryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RadarVerifiedBotTopCategoryListParamsDateRange string + +const ( + RadarVerifiedBotTopCategoryListParamsDateRange1d RadarVerifiedBotTopCategoryListParamsDateRange = "1d" + RadarVerifiedBotTopCategoryListParamsDateRange2d RadarVerifiedBotTopCategoryListParamsDateRange = "2d" + RadarVerifiedBotTopCategoryListParamsDateRange7d RadarVerifiedBotTopCategoryListParamsDateRange = "7d" + RadarVerifiedBotTopCategoryListParamsDateRange14d RadarVerifiedBotTopCategoryListParamsDateRange = "14d" + RadarVerifiedBotTopCategoryListParamsDateRange28d RadarVerifiedBotTopCategoryListParamsDateRange = "28d" + RadarVerifiedBotTopCategoryListParamsDateRange12w RadarVerifiedBotTopCategoryListParamsDateRange = "12w" + RadarVerifiedBotTopCategoryListParamsDateRange24w RadarVerifiedBotTopCategoryListParamsDateRange = "24w" + RadarVerifiedBotTopCategoryListParamsDateRange52w RadarVerifiedBotTopCategoryListParamsDateRange = "52w" + RadarVerifiedBotTopCategoryListParamsDateRange1dControl RadarVerifiedBotTopCategoryListParamsDateRange = "1dControl" + RadarVerifiedBotTopCategoryListParamsDateRange2dControl RadarVerifiedBotTopCategoryListParamsDateRange = "2dControl" + RadarVerifiedBotTopCategoryListParamsDateRange7dControl RadarVerifiedBotTopCategoryListParamsDateRange = "7dControl" + RadarVerifiedBotTopCategoryListParamsDateRange14dControl RadarVerifiedBotTopCategoryListParamsDateRange = "14dControl" + RadarVerifiedBotTopCategoryListParamsDateRange28dControl RadarVerifiedBotTopCategoryListParamsDateRange = "28dControl" + RadarVerifiedBotTopCategoryListParamsDateRange12wControl RadarVerifiedBotTopCategoryListParamsDateRange = "12wControl" + RadarVerifiedBotTopCategoryListParamsDateRange24wControl RadarVerifiedBotTopCategoryListParamsDateRange = "24wControl" +) + +// Format results are returned in. +type RadarVerifiedBotTopCategoryListParamsFormat string + +const ( + RadarVerifiedBotTopCategoryListParamsFormatJson RadarVerifiedBotTopCategoryListParamsFormat = "JSON" + RadarVerifiedBotTopCategoryListParamsFormatCsv RadarVerifiedBotTopCategoryListParamsFormat = "CSV" +) diff --git a/radarverifiedbottopcategory_test.go b/radarverifiedbottopcategory_test.go new file mode 100644 index 00000000000..2037a3e78f9 --- /dev/null +++ b/radarverifiedbottopcategory_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRadarVerifiedBotTopCategoryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Radar.VerifiedBots.Tops.Categories.List(context.TODO(), cloudflare.RadarVerifiedBotTopCategoryListParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarVerifiedBotTopCategoryListParamsDateRange{cloudflare.RadarVerifiedBotTopCategoryListParamsDateRange1d, cloudflare.RadarVerifiedBotTopCategoryListParamsDateRange2d, cloudflare.RadarVerifiedBotTopCategoryListParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + Format: cloudflare.F(cloudflare.RadarVerifiedBotTopCategoryListParamsFormatJson), + Limit: cloudflare.F(int64(5)), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + }) + 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/railgun.go b/railgun.go new file mode 100644 index 00000000000..e3f913a5d61 --- /dev/null +++ b/railgun.go @@ -0,0 +1,511 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RailgunService 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 [NewRailgunService] method instead. +type RailgunService struct { + Options []option.RequestOption + Zones *RailgunZoneService +} + +// NewRailgunService 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 NewRailgunService(opts ...option.RequestOption) (r *RailgunService) { + r = &RailgunService{} + r.Options = opts + r.Zones = NewRailgunZoneService(opts...) + return +} + +// Railgun details +func (r *RailgunService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *RailgunGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("railguns/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Enable or disable a Railgun for all zones connected to it. +func (r *RailgunService) Update(ctx context.Context, identifier string, body RailgunUpdateParams, opts ...option.RequestOption) (res *RailgunUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("railguns/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Disable and delete a Railgun. This will immediately disable that Railgun for any +// connected zones. +func (r *RailgunService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *RailgunDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("railguns/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create Railgun +func (r *RailgunService) RailgunNewRailgun(ctx context.Context, body RailgunRailgunNewRailgunParams, opts ...option.RequestOption) (res *RailgunRailgunNewRailgunResponse, err error) { + opts = append(r.Options[:], opts...) + path := "railguns" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List, search, sort and filter your Railguns. +func (r *RailgunService) RailgunListRailguns(ctx context.Context, query RailgunRailgunListRailgunsParams, opts ...option.RequestOption) (res *shared.Page[RailgunRailgunListRailgunsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "railguns" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type RailgunGetResponse struct { + Errors []RailgunGetResponseError `json:"errors"` + Messages []RailgunGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success RailgunGetResponseSuccess `json:"success"` + JSON railgunGetResponseJSON `json:"-"` +} + +// railgunGetResponseJSON contains the JSON metadata for the struct +// [RailgunGetResponse] +type railgunGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunGetResponseErrorJSON `json:"-"` +} + +// railgunGetResponseErrorJSON contains the JSON metadata for the struct +// [RailgunGetResponseError] +type railgunGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunGetResponseMessageJSON `json:"-"` +} + +// railgunGetResponseMessageJSON contains the JSON metadata for the struct +// [RailgunGetResponseMessage] +type railgunGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type RailgunGetResponseSuccess bool + +const ( + RailgunGetResponseSuccessTrue RailgunGetResponseSuccess = true +) + +type RailgunUpdateResponse struct { + Errors []RailgunUpdateResponseError `json:"errors"` + Messages []RailgunUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success RailgunUpdateResponseSuccess `json:"success"` + JSON railgunUpdateResponseJSON `json:"-"` +} + +// railgunUpdateResponseJSON contains the JSON metadata for the struct +// [RailgunUpdateResponse] +type railgunUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunUpdateResponseErrorJSON `json:"-"` +} + +// railgunUpdateResponseErrorJSON contains the JSON metadata for the struct +// [RailgunUpdateResponseError] +type railgunUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunUpdateResponseMessageJSON `json:"-"` +} + +// railgunUpdateResponseMessageJSON contains the JSON metadata for the struct +// [RailgunUpdateResponseMessage] +type railgunUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type RailgunUpdateResponseSuccess bool + +const ( + RailgunUpdateResponseSuccessTrue RailgunUpdateResponseSuccess = true +) + +type RailgunDeleteResponse struct { + Errors []RailgunDeleteResponseError `json:"errors"` + Messages []RailgunDeleteResponseMessage `json:"messages"` + Result RailgunDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success RailgunDeleteResponseSuccess `json:"success"` + JSON railgunDeleteResponseJSON `json:"-"` +} + +// railgunDeleteResponseJSON contains the JSON metadata for the struct +// [RailgunDeleteResponse] +type railgunDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunDeleteResponseErrorJSON `json:"-"` +} + +// railgunDeleteResponseErrorJSON contains the JSON metadata for the struct +// [RailgunDeleteResponseError] +type railgunDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunDeleteResponseMessageJSON `json:"-"` +} + +// railgunDeleteResponseMessageJSON contains the JSON metadata for the struct +// [RailgunDeleteResponseMessage] +type railgunDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunDeleteResponseResult struct { + // Railgun identifier tag. + ID string `json:"id"` + JSON railgunDeleteResponseResultJSON `json:"-"` +} + +// railgunDeleteResponseResultJSON contains the JSON metadata for the struct +// [RailgunDeleteResponseResult] +type railgunDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type RailgunDeleteResponseSuccess bool + +const ( + RailgunDeleteResponseSuccessTrue RailgunDeleteResponseSuccess = true +) + +type RailgunRailgunNewRailgunResponse struct { + Errors []RailgunRailgunNewRailgunResponseError `json:"errors"` + Messages []RailgunRailgunNewRailgunResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success RailgunRailgunNewRailgunResponseSuccess `json:"success"` + JSON railgunRailgunNewRailgunResponseJSON `json:"-"` +} + +// railgunRailgunNewRailgunResponseJSON contains the JSON metadata for the struct +// [RailgunRailgunNewRailgunResponse] +type railgunRailgunNewRailgunResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunRailgunNewRailgunResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunRailgunNewRailgunResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunRailgunNewRailgunResponseErrorJSON `json:"-"` +} + +// railgunRailgunNewRailgunResponseErrorJSON contains the JSON metadata for the +// struct [RailgunRailgunNewRailgunResponseError] +type railgunRailgunNewRailgunResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunRailgunNewRailgunResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunRailgunNewRailgunResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunRailgunNewRailgunResponseMessageJSON `json:"-"` +} + +// railgunRailgunNewRailgunResponseMessageJSON contains the JSON metadata for the +// struct [RailgunRailgunNewRailgunResponseMessage] +type railgunRailgunNewRailgunResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunRailgunNewRailgunResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type RailgunRailgunNewRailgunResponseSuccess bool + +const ( + RailgunRailgunNewRailgunResponseSuccessTrue RailgunRailgunNewRailgunResponseSuccess = true +) + +type RailgunRailgunListRailgunsResponse struct { + // Railgun identifier tag. + ID string `json:"id,required"` + // When the Railgun was activated. + ActivatedOn time.Time `json:"activated_on,required" format:"date-time"` + ActivationKey string `json:"activation_key,required"` + // The build identifier for the Railgun receiver. + Build string `json:"build,required"` + // When the Railgun was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Flag to determine if the Railgun is accepting connections. + Enabled bool `json:"enabled,required"` + // When the Railgun was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // Readable identifier of the Railgun. + Name string `json:"name,required"` + // The revision of the Railgun receiver. + Revision string `json:"revision,required"` + // Status of the Railgun. + Status RailgunRailgunListRailgunsResponseStatus `json:"status,required"` + // The version of the Railgun receiver. + Version string `json:"version,required"` + // The number of zones using this Railgun. + ZonesConnected float64 `json:"zones_connected,required"` + // Defined when the Railgun version is out of date from the latest release from + // Cloudflare. + UpgradeInfo RailgunRailgunListRailgunsResponseUpgradeInfo `json:"upgrade_info"` + JSON railgunRailgunListRailgunsResponseJSON `json:"-"` +} + +// railgunRailgunListRailgunsResponseJSON contains the JSON metadata for the struct +// [RailgunRailgunListRailgunsResponse] +type railgunRailgunListRailgunsResponseJSON struct { + ID apijson.Field + ActivatedOn apijson.Field + ActivationKey apijson.Field + Build apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Revision apijson.Field + Status apijson.Field + Version apijson.Field + ZonesConnected apijson.Field + UpgradeInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunRailgunListRailgunsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Railgun. +type RailgunRailgunListRailgunsResponseStatus string + +const ( + RailgunRailgunListRailgunsResponseStatusInitializing RailgunRailgunListRailgunsResponseStatus = "initializing" + RailgunRailgunListRailgunsResponseStatusActive RailgunRailgunListRailgunsResponseStatus = "active" +) + +// Defined when the Railgun version is out of date from the latest release from +// Cloudflare. +type RailgunRailgunListRailgunsResponseUpgradeInfo struct { + // An HTTP link to download the latest Railgun binary. + DownloadLink string `json:"download_link"` + // Latest version of the Railgun receiver available to install. + LatestVersion string `json:"latest_version"` + JSON railgunRailgunListRailgunsResponseUpgradeInfoJSON `json:"-"` +} + +// railgunRailgunListRailgunsResponseUpgradeInfoJSON contains the JSON metadata for +// the struct [RailgunRailgunListRailgunsResponseUpgradeInfo] +type railgunRailgunListRailgunsResponseUpgradeInfoJSON struct { + DownloadLink apijson.Field + LatestVersion apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunRailgunListRailgunsResponseUpgradeInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunUpdateParams struct { + // Flag to determine if the Railgun is accepting connections. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RailgunUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RailgunRailgunNewRailgunParams struct { + // Readable identifier of the Railgun. + Name param.Field[string] `json:"name,required"` +} + +func (r RailgunRailgunNewRailgunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RailgunRailgunListRailgunsParams struct { + // Sort Railguns in ascending or descending order. + Direction param.Field[RailgunRailgunListRailgunsParamsDirection] `query:"direction"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [RailgunRailgunListRailgunsParams]'s query parameters as +// `url.Values`. +func (r RailgunRailgunListRailgunsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Sort Railguns in ascending or descending order. +type RailgunRailgunListRailgunsParamsDirection string + +const ( + RailgunRailgunListRailgunsParamsDirectionAsc RailgunRailgunListRailgunsParamsDirection = "asc" + RailgunRailgunListRailgunsParamsDirectionDesc RailgunRailgunListRailgunsParamsDirection = "desc" +) diff --git a/railgun_test.go b/railgun_test.go new file mode 100644 index 00000000000..309feface23 --- /dev/null +++ b/railgun_test.go @@ -0,0 +1,156 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestRailgunGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Railguns.Get(context.TODO(), "e928d310693a83094309acf9ead50448") + 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 TestRailgunUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Railguns.Update( + context.TODO(), + "e928d310693a83094309acf9ead50448", + cloudflare.RailgunUpdateParams{ + Enabled: cloudflare.F(true), + }, + ) + 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 TestRailgunDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Railguns.Delete(context.TODO(), "e928d310693a83094309acf9ead50448") + 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 TestRailgunRailgunNewRailgun(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Railguns.RailgunNewRailgun(context.TODO(), cloudflare.RailgunRailgunNewRailgunParams{ + Name: cloudflare.F("My Railgun."), + }) + 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 TestRailgunRailgunListRailgunsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Railguns.RailgunListRailguns(context.TODO(), cloudflare.RailgunRailgunListRailgunsParams{ + Direction: cloudflare.F(cloudflare.RailgunRailgunListRailgunsParamsDirectionDesc), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }) + 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/railgunzone.go b/railgunzone.go new file mode 100644 index 00000000000..41294a62181 --- /dev/null +++ b/railgunzone.go @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// RailgunZoneService 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 [NewRailgunZoneService] method +// instead. +type RailgunZoneService struct { + Options []option.RequestOption +} + +// NewRailgunZoneService 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 NewRailgunZoneService(opts ...option.RequestOption) (r *RailgunZoneService) { + r = &RailgunZoneService{} + r.Options = opts + return +} + +// List the zones that are currently using this Railgun. +func (r *RailgunZoneService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *RailgunZoneListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("railguns/%s/zones", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type RailgunZoneListResponse struct { + Errors []RailgunZoneListResponseError `json:"errors"` + Messages []RailgunZoneListResponseMessage `json:"messages"` + Result []RailgunZoneListResponseResult `json:"result"` + ResultInfo RailgunZoneListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success RailgunZoneListResponseSuccess `json:"success"` + JSON railgunZoneListResponseJSON `json:"-"` +} + +// railgunZoneListResponseJSON contains the JSON metadata for the struct +// [RailgunZoneListResponse] +type railgunZoneListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunZoneListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunZoneListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunZoneListResponseErrorJSON `json:"-"` +} + +// railgunZoneListResponseErrorJSON contains the JSON metadata for the struct +// [RailgunZoneListResponseError] +type railgunZoneListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunZoneListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunZoneListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON railgunZoneListResponseMessageJSON `json:"-"` +} + +// railgunZoneListResponseMessageJSON contains the JSON metadata for the struct +// [RailgunZoneListResponseMessage] +type railgunZoneListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunZoneListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunZoneListResponseResult struct { + // Identifier + ID string `json:"id,required"` + // The last time proof of ownership was detected and the zone was made active + ActivatedOn time.Time `json:"activated_on,required,nullable" format:"date-time"` + // When the zone was created + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // The interval (in seconds) from when development mode expires (positive integer) + // or last expired (negative integer) for the domain. If development mode has never + // been enabled, this value is 0. + DevelopmentMode float64 `json:"development_mode,required"` + // When the zone was last modified + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The domain name + Name string `json:"name,required"` + // DNS host at the time of switching to Cloudflare + OriginalDnshost string `json:"original_dnshost,required,nullable"` + // Original name servers before moving to Cloudflare Notes: Is this only available + // for full zones? + OriginalNameServers []string `json:"original_name_servers,required,nullable" format:"hostname"` + // Registrar for the domain at the time of switching to Cloudflare + OriginalRegistrar string `json:"original_registrar,required,nullable"` + JSON railgunZoneListResponseResultJSON `json:"-"` +} + +// railgunZoneListResponseResultJSON contains the JSON metadata for the struct +// [RailgunZoneListResponseResult] +type railgunZoneListResponseResultJSON struct { + ID apijson.Field + ActivatedOn apijson.Field + CreatedOn apijson.Field + DevelopmentMode apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + OriginalDnshost apijson.Field + OriginalNameServers apijson.Field + OriginalRegistrar apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunZoneListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RailgunZoneListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON railgunZoneListResponseResultInfoJSON `json:"-"` +} + +// railgunZoneListResponseResultInfoJSON contains the JSON metadata for the struct +// [RailgunZoneListResponseResultInfo] +type railgunZoneListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RailgunZoneListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type RailgunZoneListResponseSuccess bool + +const ( + RailgunZoneListResponseSuccessTrue RailgunZoneListResponseSuccess = true +) diff --git a/aiopenai_test.go b/railgunzone_test.go similarity index 68% rename from aiopenai_test.go rename to railgunzone_test.go index a63763211c2..9d9d367158f 100644 --- a/aiopenai_test.go +++ b/railgunzone_test.go @@ -13,7 +13,8 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAIOpenAIWhisper(t *testing.T) { +func TestRailgunZoneList(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 @@ -23,10 +24,12 @@ func TestAIOpenAIWhisper(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.OpenAI.Whisper(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.Railguns.Zones.List(context.TODO(), "e928d310693a83094309acf9ead50448") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { diff --git a/stream.go b/stream.go new file mode 100644 index 00000000000..3f86038481e --- /dev/null +++ b/stream.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// StreamService 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 [NewStreamService] method instead. +type StreamService struct { + Options []option.RequestOption + AudioTracks *StreamAudioTrackService +} + +// NewStreamService 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 NewStreamService(opts ...option.RequestOption) (r *StreamService) { + r = &StreamService{} + r.Options = opts + r.AudioTracks = NewStreamAudioTrackService(opts...) + return +} diff --git a/streamaudiotrack.go b/streamaudiotrack.go new file mode 100644 index 00000000000..31de5a9a780 --- /dev/null +++ b/streamaudiotrack.go @@ -0,0 +1,146 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// StreamAudioTrackService 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 [NewStreamAudioTrackService] method +// instead. +type StreamAudioTrackService struct { + Options []option.RequestOption +} + +// NewStreamAudioTrackService 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 NewStreamAudioTrackService(opts ...option.RequestOption) (r *StreamAudioTrackService) { + r = &StreamAudioTrackService{} + r.Options = opts + return +} + +// Lists additional audio tracks on a video. Note this API will not return +// information for audio attached to the video upload. +func (r *StreamAudioTrackService) List(ctx context.Context, accountIdentifier string, identifier string, opts ...option.RequestOption) (res *StreamAudioTrackListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/stream/%s/audio", accountIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type StreamAudioTrackListResponse struct { + Errors []StreamAudioTrackListResponseError `json:"errors"` + Messages []StreamAudioTrackListResponseMessage `json:"messages"` + Result []StreamAudioTrackListResponseResult `json:"result"` + // Whether the API call was successful + Success StreamAudioTrackListResponseSuccess `json:"success"` + JSON streamAudioTrackListResponseJSON `json:"-"` +} + +// streamAudioTrackListResponseJSON contains the JSON metadata for the struct +// [StreamAudioTrackListResponse] +type streamAudioTrackListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *StreamAudioTrackListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type StreamAudioTrackListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON streamAudioTrackListResponseErrorJSON `json:"-"` +} + +// streamAudioTrackListResponseErrorJSON contains the JSON metadata for the struct +// [StreamAudioTrackListResponseError] +type streamAudioTrackListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *StreamAudioTrackListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type StreamAudioTrackListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON streamAudioTrackListResponseMessageJSON `json:"-"` +} + +// streamAudioTrackListResponseMessageJSON contains the JSON metadata for the +// struct [StreamAudioTrackListResponseMessage] +type streamAudioTrackListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *StreamAudioTrackListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type StreamAudioTrackListResponseResult struct { + // Denotes whether the audio track will be played by default in a player. + Default bool `json:"default"` + // A string to uniquely identify the track amongst other audio track labels for the + // specified video. + Label string `json:"label"` + // Specifies the processing status of the video. + Status StreamAudioTrackListResponseResultStatus `json:"status"` + // A Cloudflare-generated unique identifier for a media item. + Uid string `json:"uid"` + JSON streamAudioTrackListResponseResultJSON `json:"-"` +} + +// streamAudioTrackListResponseResultJSON contains the JSON metadata for the struct +// [StreamAudioTrackListResponseResult] +type streamAudioTrackListResponseResultJSON struct { + Default apijson.Field + Label apijson.Field + Status apijson.Field + Uid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *StreamAudioTrackListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies the processing status of the video. +type StreamAudioTrackListResponseResultStatus string + +const ( + StreamAudioTrackListResponseResultStatusQueued StreamAudioTrackListResponseResultStatus = "queued" + StreamAudioTrackListResponseResultStatusReady StreamAudioTrackListResponseResultStatus = "ready" + StreamAudioTrackListResponseResultStatusError StreamAudioTrackListResponseResultStatus = "error" +) + +// Whether the API call was successful +type StreamAudioTrackListResponseSuccess bool + +const ( + StreamAudioTrackListResponseSuccessTrue StreamAudioTrackListResponseSuccess = true +) diff --git a/streamaudiotrack_test.go b/streamaudiotrack_test.go new file mode 100644 index 00000000000..4e49d10e99d --- /dev/null +++ b/streamaudiotrack_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestStreamAudioTrackList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Stream.AudioTracks.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "ea95132c15732412d22c1476fa83f27a", + ) + 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/usage_test.go b/usage_test.go index 45e26bc41ea..17ea8389e05 100644 --- a/usage_test.go +++ b/usage_test.go @@ -22,8 +22,10 @@ func TestUsage(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) zoneNewResponse, err := client.Zones.New(context.TODO(), cloudflare.ZoneNewParams{ Account: cloudflare.F(cloudflare.ZoneNewParamsAccount{ diff --git a/user.go b/user.go new file mode 100644 index 00000000000..f8c33a4df8d --- /dev/null +++ b/user.go @@ -0,0 +1,217 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserService 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 [NewUserService] method instead. +type UserService struct { + Options []option.RequestOption + Billings *UserBillingService + Firewalls *UserFirewallService + Invites *UserInviteService + LoadBalancers *UserLoadBalancerService + LoadBalancingAnalytics *UserLoadBalancingAnalyticService + Organizations *UserOrganizationService + Subscriptions *UserSubscriptionService + Tokens *UserTokenService +} + +// NewUserService 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 NewUserService(opts ...option.RequestOption) (r *UserService) { + r = &UserService{} + r.Options = opts + r.Billings = NewUserBillingService(opts...) + r.Firewalls = NewUserFirewallService(opts...) + r.Invites = NewUserInviteService(opts...) + r.LoadBalancers = NewUserLoadBalancerService(opts...) + r.LoadBalancingAnalytics = NewUserLoadBalancingAnalyticService(opts...) + r.Organizations = NewUserOrganizationService(opts...) + r.Subscriptions = NewUserSubscriptionService(opts...) + r.Tokens = NewUserTokenService(opts...) + return +} + +// Edit part of your user details. +func (r *UserService) UserEditUser(ctx context.Context, body UserUserEditUserParams, opts ...option.RequestOption) (res *UserUserEditUserResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// User Details +func (r *UserService) UserUserDetails(ctx context.Context, opts ...option.RequestOption) (res *UserUserUserDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserUserEditUserResponse struct { + Errors []UserUserEditUserResponseError `json:"errors"` + Messages []UserUserEditUserResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserUserEditUserResponseSuccess `json:"success"` + JSON userUserEditUserResponseJSON `json:"-"` +} + +// userUserEditUserResponseJSON contains the JSON metadata for the struct +// [UserUserEditUserResponse] +type userUserEditUserResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserUserEditUserResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserUserEditUserResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userUserEditUserResponseErrorJSON `json:"-"` +} + +// userUserEditUserResponseErrorJSON contains the JSON metadata for the struct +// [UserUserEditUserResponseError] +type userUserEditUserResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserUserEditUserResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserUserEditUserResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userUserEditUserResponseMessageJSON `json:"-"` +} + +// userUserEditUserResponseMessageJSON contains the JSON metadata for the struct +// [UserUserEditUserResponseMessage] +type userUserEditUserResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserUserEditUserResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserUserEditUserResponseSuccess bool + +const ( + UserUserEditUserResponseSuccessTrue UserUserEditUserResponseSuccess = true +) + +type UserUserUserDetailsResponse struct { + Errors []UserUserUserDetailsResponseError `json:"errors"` + Messages []UserUserUserDetailsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserUserUserDetailsResponseSuccess `json:"success"` + JSON userUserUserDetailsResponseJSON `json:"-"` +} + +// userUserUserDetailsResponseJSON contains the JSON metadata for the struct +// [UserUserUserDetailsResponse] +type userUserUserDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserUserUserDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserUserUserDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userUserUserDetailsResponseErrorJSON `json:"-"` +} + +// userUserUserDetailsResponseErrorJSON contains the JSON metadata for the struct +// [UserUserUserDetailsResponseError] +type userUserUserDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserUserUserDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserUserUserDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userUserUserDetailsResponseMessageJSON `json:"-"` +} + +// userUserUserDetailsResponseMessageJSON contains the JSON metadata for the struct +// [UserUserUserDetailsResponseMessage] +type userUserUserDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserUserUserDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserUserUserDetailsResponseSuccess bool + +const ( + UserUserUserDetailsResponseSuccessTrue UserUserUserDetailsResponseSuccess = true +) + +type UserUserEditUserParams struct { + // The country in which the user lives. + Country param.Field[string] `json:"country"` + // User's first name + FirstName param.Field[string] `json:"first_name"` + // User's last name + LastName param.Field[string] `json:"last_name"` + // User's telephone number + Telephone param.Field[string] `json:"telephone"` + // The zipcode or postal code where the user lives. + Zipcode param.Field[string] `json:"zipcode"` +} + +func (r UserUserEditUserParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/user_test.go b/user_test.go new file mode 100644 index 00000000000..726d9fd3340 --- /dev/null +++ b/user_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserUserEditUserWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.UserEditUser(context.TODO(), cloudflare.UserUserEditUserParams{ + Country: cloudflare.F("US"), + FirstName: cloudflare.F("John"), + LastName: cloudflare.F("Appleseed"), + Telephone: cloudflare.F("+1 123-123-1234"), + Zipcode: cloudflare.F("12345"), + }) + 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 TestUserUserUserDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.UserUserDetails(context.TODO()) + 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/userbilling.go b/userbilling.go new file mode 100644 index 00000000000..b98fb2d4091 --- /dev/null +++ b/userbilling.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserBillingService 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 [NewUserBillingService] method +// instead. +type UserBillingService struct { + Options []option.RequestOption + Histories *UserBillingHistoryService + Profiles *UserBillingProfileService +} + +// NewUserBillingService 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 NewUserBillingService(opts ...option.RequestOption) (r *UserBillingService) { + r = &UserBillingService{} + r.Options = opts + r.Histories = NewUserBillingHistoryService(opts...) + r.Profiles = NewUserBillingProfileService(opts...) + return +} diff --git a/userbillinghistory.go b/userbillinghistory.go new file mode 100644 index 00000000000..06a4ad1b9a2 --- /dev/null +++ b/userbillinghistory.go @@ -0,0 +1,138 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserBillingHistoryService 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 [NewUserBillingHistoryService] method +// instead. +type UserBillingHistoryService struct { + Options []option.RequestOption +} + +// NewUserBillingHistoryService 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 NewUserBillingHistoryService(opts ...option.RequestOption) (r *UserBillingHistoryService) { + r = &UserBillingHistoryService{} + r.Options = opts + return +} + +// Accesses your billing history object. +func (r *UserBillingHistoryService) UserBillingHistoryBillingHistoryDetails(ctx context.Context, query UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParams, opts ...option.RequestOption) (res *shared.Page[UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "user/billing/history" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponse struct { + // Billing item identifier tag. + ID string `json:"id,required"` + // The billing item action. + Action string `json:"action,required"` + // The amount associated with this billing item. + Amount float64 `json:"amount,required"` + // The monetary unit in which pricing information is displayed. + Currency string `json:"currency,required"` + // The billing item description. + Description string `json:"description,required"` + // When the billing item was created. + OccurredAt time.Time `json:"occurred_at,required" format:"date-time"` + // The billing item type. + Type string `json:"type,required"` + Zone UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseZone `json:"zone,required"` + JSON userBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseJSON `json:"-"` +} + +// userBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseJSON contains +// the JSON metadata for the struct +// [UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponse] +type userBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseJSON struct { + ID apijson.Field + Action apijson.Field + Amount apijson.Field + Currency apijson.Field + Description apijson.Field + OccurredAt apijson.Field + Type apijson.Field + Zone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseZone struct { + Name interface{} `json:"name"` + JSON userBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseZoneJSON `json:"-"` +} + +// userBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseZoneJSON +// contains the JSON metadata for the struct +// [UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseZone] +type userBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseZoneJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserBillingHistoryUserBillingHistoryBillingHistoryDetailsResponseZone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParams struct { + // Field to order billing history by. + Order param.Field[UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of items per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParams]'s query +// parameters as `url.Values`. +func (r UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Field to order billing history by. +type UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrder string + +const ( + UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrderType UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrder = "type" + UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrderOccuredAt UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrder = "occured_at" + UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrderAction UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrder = "action" +) diff --git a/userbillinghistory_test.go b/userbillinghistory_test.go new file mode 100644 index 00000000000..37d1e654942 --- /dev/null +++ b/userbillinghistory_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserBillingHistoryUserBillingHistoryBillingHistoryDetailsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Billings.Histories.UserBillingHistoryBillingHistoryDetails(context.TODO(), cloudflare.UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParams{ + Order: cloudflare.F(cloudflare.UserBillingHistoryUserBillingHistoryBillingHistoryDetailsParamsOrderOccuredAt), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }) + 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/userbillingprofile.go b/userbillingprofile.go new file mode 100644 index 00000000000..96f838beeb4 --- /dev/null +++ b/userbillingprofile.go @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserBillingProfileService 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 [NewUserBillingProfileService] method +// instead. +type UserBillingProfileService struct { + Options []option.RequestOption +} + +// NewUserBillingProfileService 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 NewUserBillingProfileService(opts ...option.RequestOption) (r *UserBillingProfileService) { + r = &UserBillingProfileService{} + r.Options = opts + return +} + +// Accesses your billing profile object. +func (r *UserBillingProfileService) UserBillingProfileBillingProfileDetails(ctx context.Context, opts ...option.RequestOption) (res *UserBillingProfileUserBillingProfileBillingProfileDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/billing/profile" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserBillingProfileUserBillingProfileBillingProfileDetailsResponse struct { + Errors []UserBillingProfileUserBillingProfileBillingProfileDetailsResponseError `json:"errors"` + Messages []UserBillingProfileUserBillingProfileBillingProfileDetailsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserBillingProfileUserBillingProfileBillingProfileDetailsResponseSuccess `json:"success"` + JSON userBillingProfileUserBillingProfileBillingProfileDetailsResponseJSON `json:"-"` +} + +// userBillingProfileUserBillingProfileBillingProfileDetailsResponseJSON contains +// the JSON metadata for the struct +// [UserBillingProfileUserBillingProfileBillingProfileDetailsResponse] +type userBillingProfileUserBillingProfileBillingProfileDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserBillingProfileUserBillingProfileBillingProfileDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserBillingProfileUserBillingProfileBillingProfileDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userBillingProfileUserBillingProfileBillingProfileDetailsResponseErrorJSON `json:"-"` +} + +// userBillingProfileUserBillingProfileBillingProfileDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [UserBillingProfileUserBillingProfileBillingProfileDetailsResponseError] +type userBillingProfileUserBillingProfileBillingProfileDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserBillingProfileUserBillingProfileBillingProfileDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserBillingProfileUserBillingProfileBillingProfileDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userBillingProfileUserBillingProfileBillingProfileDetailsResponseMessageJSON `json:"-"` +} + +// userBillingProfileUserBillingProfileBillingProfileDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [UserBillingProfileUserBillingProfileBillingProfileDetailsResponseMessage] +type userBillingProfileUserBillingProfileBillingProfileDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserBillingProfileUserBillingProfileBillingProfileDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserBillingProfileUserBillingProfileBillingProfileDetailsResponseSuccess bool + +const ( + UserBillingProfileUserBillingProfileBillingProfileDetailsResponseSuccessTrue UserBillingProfileUserBillingProfileBillingProfileDetailsResponseSuccess = true +) diff --git a/userbillingprofile_test.go b/userbillingprofile_test.go new file mode 100644 index 00000000000..f3e5cd5680f --- /dev/null +++ b/userbillingprofile_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserBillingProfileUserBillingProfileBillingProfileDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Billings.Profiles.UserBillingProfileBillingProfileDetails(context.TODO()) + 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/userfirewall.go b/userfirewall.go new file mode 100644 index 00000000000..1795ab59672 --- /dev/null +++ b/userfirewall.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserFirewallService 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 [NewUserFirewallService] method +// instead. +type UserFirewallService struct { + Options []option.RequestOption + AccessRules *UserFirewallAccessRuleService +} + +// NewUserFirewallService 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 NewUserFirewallService(opts ...option.RequestOption) (r *UserFirewallService) { + r = &UserFirewallService{} + r.Options = opts + r.AccessRules = NewUserFirewallAccessRuleService(opts...) + return +} diff --git a/userfirewallaccessrule.go b/userfirewallaccessrule.go new file mode 100644 index 00000000000..3edaccb9653 --- /dev/null +++ b/userfirewallaccessrule.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserFirewallAccessRuleService 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 [NewUserFirewallAccessRuleService] +// method instead. +type UserFirewallAccessRuleService struct { + Options []option.RequestOption + Rules *UserFirewallAccessRuleRuleService +} + +// NewUserFirewallAccessRuleService 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 NewUserFirewallAccessRuleService(opts ...option.RequestOption) (r *UserFirewallAccessRuleService) { + r = &UserFirewallAccessRuleService{} + r.Options = opts + r.Rules = NewUserFirewallAccessRuleRuleService(opts...) + return +} diff --git a/userfirewallaccessrulerule.go b/userfirewallaccessrulerule.go new file mode 100644 index 00000000000..143264e68c8 --- /dev/null +++ b/userfirewallaccessrulerule.go @@ -0,0 +1,1367 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserFirewallAccessRuleRuleService 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 +// [NewUserFirewallAccessRuleRuleService] method instead. +type UserFirewallAccessRuleRuleService struct { + Options []option.RequestOption +} + +// NewUserFirewallAccessRuleRuleService 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 NewUserFirewallAccessRuleRuleService(opts ...option.RequestOption) (r *UserFirewallAccessRuleRuleService) { + r = &UserFirewallAccessRuleRuleService{} + r.Options = opts + return +} + +// Updates an IP Access rule defined at the user level. You can only update the +// rule action (`mode` parameter) and notes. +func (r *UserFirewallAccessRuleRuleService) Update(ctx context.Context, identifier string, body UserFirewallAccessRuleRuleUpdateParams, opts ...option.RequestOption) (res *UserFirewallAccessRuleRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/firewall/access_rules/rules/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes an IP Access rule at the user level. +// +// Note: Deleting a user-level rule will affect all zones owned by the user. +func (r *UserFirewallAccessRuleRuleService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserFirewallAccessRuleRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/firewall/access_rules/rules/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new IP Access rule for all zones owned by the current user. +// +// Note: To create an IP Access rule that applies to a specific zone, refer to the +// [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints. +func (r *UserFirewallAccessRuleRuleService) IPAccessRulesForAUserNewAnIPAccessRule(ctx context.Context, body UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParams, opts ...option.RequestOption) (res *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/firewall/access_rules/rules" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches IP Access rules of the user. You can filter the results using several +// optional parameters. +func (r *UserFirewallAccessRuleRuleService) IPAccessRulesForAUserListIPAccessRules(ctx context.Context, query UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParams, opts ...option.RequestOption) (res *shared.Page[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "user/firewall/access_rules/rules" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type UserFirewallAccessRuleRuleUpdateResponse struct { + Errors []UserFirewallAccessRuleRuleUpdateResponseError `json:"errors"` + Messages []UserFirewallAccessRuleRuleUpdateResponseMessage `json:"messages"` + Result UserFirewallAccessRuleRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success UserFirewallAccessRuleRuleUpdateResponseSuccess `json:"success"` + JSON userFirewallAccessRuleRuleUpdateResponseJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseJSON contains the JSON metadata for the +// struct [UserFirewallAccessRuleRuleUpdateResponse] +type userFirewallAccessRuleRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleRuleUpdateResponseErrorJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseErrorJSON contains the JSON metadata for +// the struct [UserFirewallAccessRuleRuleUpdateResponseError] +type userFirewallAccessRuleRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleRuleUpdateResponseMessageJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseMessageJSON contains the JSON metadata +// for the struct [UserFirewallAccessRuleRuleUpdateResponseMessage] +type userFirewallAccessRuleRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleUpdateResponseResult struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []UserFirewallAccessRuleRuleUpdateResponseResultAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration UserFirewallAccessRuleRuleUpdateResponseResultConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode UserFirewallAccessRuleRuleUpdateResponseResultMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON userFirewallAccessRuleRuleUpdateResponseResultJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseResultJSON contains the JSON metadata +// for the struct [UserFirewallAccessRuleRuleUpdateResponseResult] +type userFirewallAccessRuleRuleUpdateResponseResultJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleUpdateResponseResultAllowedMode string + +const ( + UserFirewallAccessRuleRuleUpdateResponseResultAllowedModeBlock UserFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "block" + UserFirewallAccessRuleRuleUpdateResponseResultAllowedModeChallenge UserFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "challenge" + UserFirewallAccessRuleRuleUpdateResponseResultAllowedModeWhitelist UserFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "whitelist" + UserFirewallAccessRuleRuleUpdateResponseResultAllowedModeJsChallenge UserFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "js_challenge" + UserFirewallAccessRuleRuleUpdateResponseResultAllowedModeManagedChallenge UserFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration], +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration], +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration], +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration] +// or +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration]. +type UserFirewallAccessRuleRuleUpdateResponseResultConfiguration interface { + implementsUserFirewallAccessRuleRuleUpdateResponseResultConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleRuleUpdateResponseResultConfiguration)(nil)).Elem(), "") +} + +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTipConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTipConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration] +type userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTipConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration) implementsUserFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTargetIP UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration] +type userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration) implementsUserFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTargetIp6 UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration] +type userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration) implementsUserFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTasnConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTasnConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration] +type userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTasnConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration) implementsUserFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTargetASN UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration] +type userFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration) implementsUserFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTargetCountry UserFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleUpdateResponseResultMode string + +const ( + UserFirewallAccessRuleRuleUpdateResponseResultModeBlock UserFirewallAccessRuleRuleUpdateResponseResultMode = "block" + UserFirewallAccessRuleRuleUpdateResponseResultModeChallenge UserFirewallAccessRuleRuleUpdateResponseResultMode = "challenge" + UserFirewallAccessRuleRuleUpdateResponseResultModeWhitelist UserFirewallAccessRuleRuleUpdateResponseResultMode = "whitelist" + UserFirewallAccessRuleRuleUpdateResponseResultModeJsChallenge UserFirewallAccessRuleRuleUpdateResponseResultMode = "js_challenge" + UserFirewallAccessRuleRuleUpdateResponseResultModeManagedChallenge UserFirewallAccessRuleRuleUpdateResponseResultMode = "managed_challenge" +) + +// Whether the API call was successful +type UserFirewallAccessRuleRuleUpdateResponseSuccess bool + +const ( + UserFirewallAccessRuleRuleUpdateResponseSuccessTrue UserFirewallAccessRuleRuleUpdateResponseSuccess = true +) + +type UserFirewallAccessRuleRuleDeleteResponse struct { + Errors []UserFirewallAccessRuleRuleDeleteResponseError `json:"errors"` + Messages []UserFirewallAccessRuleRuleDeleteResponseMessage `json:"messages"` + Result UserFirewallAccessRuleRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success UserFirewallAccessRuleRuleDeleteResponseSuccess `json:"success"` + JSON userFirewallAccessRuleRuleDeleteResponseJSON `json:"-"` +} + +// userFirewallAccessRuleRuleDeleteResponseJSON contains the JSON metadata for the +// struct [UserFirewallAccessRuleRuleDeleteResponse] +type userFirewallAccessRuleRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleRuleDeleteResponseErrorJSON `json:"-"` +} + +// userFirewallAccessRuleRuleDeleteResponseErrorJSON contains the JSON metadata for +// the struct [UserFirewallAccessRuleRuleDeleteResponseError] +type userFirewallAccessRuleRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleRuleDeleteResponseMessageJSON `json:"-"` +} + +// userFirewallAccessRuleRuleDeleteResponseMessageJSON contains the JSON metadata +// for the struct [UserFirewallAccessRuleRuleDeleteResponseMessage] +type userFirewallAccessRuleRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleDeleteResponseResult struct { + // The unique identifier of the IP Access rule. + ID string `json:"id"` + JSON userFirewallAccessRuleRuleDeleteResponseResultJSON `json:"-"` +} + +// userFirewallAccessRuleRuleDeleteResponseResultJSON contains the JSON metadata +// for the struct [UserFirewallAccessRuleRuleDeleteResponseResult] +type userFirewallAccessRuleRuleDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserFirewallAccessRuleRuleDeleteResponseSuccess bool + +const ( + UserFirewallAccessRuleRuleDeleteResponseSuccessTrue UserFirewallAccessRuleRuleDeleteResponseSuccess = true +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponse struct { + Errors []UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseError `json:"errors"` + Messages []UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseMessage `json:"messages"` + Result UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResult `json:"result"` + // Whether the API call was successful + Success UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseSuccess `json:"success"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponse] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseErrorJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseError] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseMessageJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseMessage] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResult struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResult] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedMode string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedModeBlock UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedMode = "block" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedModeChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedMode = "challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedModeWhitelist UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedMode = "whitelist" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedModeJsChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedMode = "js_challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedModeManagedChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration] +// or +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration]. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration interface { + implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration)(nil)).Elem(), "") +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTipConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTipConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTipConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTargetIP UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTargetIp6 UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTasnConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTasnConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTasnConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTargetASN UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTargetCountry UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultMode string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultModeBlock UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultMode = "block" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultModeChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultMode = "challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultModeWhitelist UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultMode = "whitelist" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultModeJsChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultMode = "js_challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultModeManagedChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseResultMode = "managed_challenge" +) + +// Whether the API call was successful +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseSuccess bool + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseSuccessTrue UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleResponseSuccess = true +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponse struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponse] +type userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedMode string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedModeBlock UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedMode = "block" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedModeChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedMode = "challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedModeWhitelist UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedMode = "whitelist" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedModeJsChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedMode = "js_challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedModeManagedChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration] +// or +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration]. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration interface { + implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration)(nil)).Elem(), "") +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTipConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTipConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTipConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTargetIP UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTargetIp6 UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTasnConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTasnConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTasnConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTargetASN UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration] +type userFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTargetCountry UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseMode string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseModeBlock UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseMode = "block" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseModeChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseMode = "challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseModeWhitelist UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseMode = "whitelist" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseModeJsChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseMode = "js_challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseModeManagedChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesResponseMode = "managed_challenge" +) + +type UserFirewallAccessRuleRuleUpdateParams struct { + // The action to apply to a matched request. + Mode param.Field[UserFirewallAccessRuleRuleUpdateParamsMode] `json:"mode"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes"` +} + +func (r UserFirewallAccessRuleRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleUpdateParamsMode string + +const ( + UserFirewallAccessRuleRuleUpdateParamsModeBlock UserFirewallAccessRuleRuleUpdateParamsMode = "block" + UserFirewallAccessRuleRuleUpdateParamsModeChallenge UserFirewallAccessRuleRuleUpdateParamsMode = "challenge" + UserFirewallAccessRuleRuleUpdateParamsModeWhitelist UserFirewallAccessRuleRuleUpdateParamsMode = "whitelist" + UserFirewallAccessRuleRuleUpdateParamsModeJsChallenge UserFirewallAccessRuleRuleUpdateParamsMode = "js_challenge" + UserFirewallAccessRuleRuleUpdateParamsModeManagedChallenge UserFirewallAccessRuleRuleUpdateParamsMode = "managed_challenge" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParams struct { + // The rule configuration. + Configuration param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration] `json:"configuration,required"` + // The action to apply to a matched request. + Mode param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsMode] `json:"mode,required"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes"` +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The rule configuration. +// +// Satisfied by +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration], +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration]. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration interface { + implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration() +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget] `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTargetIP UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget] `json:"target"` + // The IPv6 address to match. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTargetIp6 UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget] `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget] `json:"target"` + // The AS number to match. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTargetASN UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget] `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration) implementsUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTargetCountry UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsMode string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsModeBlock UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsMode = "block" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsModeChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsMode = "challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsModeWhitelist UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsMode = "whitelist" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsModeJsChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsMode = "js_challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsModeManagedChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsMode = "managed_challenge" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParams struct { + // The direction used to sort returned rules. + Direction param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsDirection] `query:"direction"` + EgsPagination param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPagination] `query:"egs-pagination"` + Filters param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFilters] `query:"filters"` + // The field used to sort returned rules. + Order param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrder] `query:"order"` + // Requested page within paginated list of results. + Page param.Field[float64] `query:"page"` + // Maximum number of results requested. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParams]'s query +// parameters as `url.Values`. +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned rules. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsDirection string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsDirectionAsc UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsDirection = "asc" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsDirectionDesc UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsDirection = "desc" +) + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPagination struct { + Json param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPaginationJson] `query:"json"` +} + +// URLQuery serializes +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPagination]'s +// query parameters as `url.Values`. +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPagination) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPaginationJson struct { + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The maximum number of results per page. You can only set the value to `1` or to + // a multiple of 5 such as `5`, `10`, `15`, or `20`. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPaginationJson]'s +// query parameters as `url.Values`. +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPaginationJson) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFilters struct { + // The target to search in existing rules. + ConfigurationTarget param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTarget] `query:"configuration.target"` + // The target value to search for in existing rules: an IP address, an IP address + // range, or a country code, depending on the provided `configuration.target`. + // Notes: You can search for a single IPv4 address, an IP address range with a + // subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code. + ConfigurationValue param.Field[string] `query:"configuration.value"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMatch] `query:"match"` + // The action to apply to a matched request. + Mode param.Field[UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMode] `query:"mode"` + // The string to search for in the notes of existing IP Access rules. Notes: For + // example, the string 'attack' would match IP Access rules with notes 'Attack + // 26/02' and 'Attack 27/02'. The search is case insensitive. + Notes param.Field[string] `query:"notes"` +} + +// URLQuery serializes +// [UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFilters]'s +// query parameters as `url.Values`. +func (r UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFilters) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The target to search in existing rules. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTarget string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTargetIP UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTarget = "ip" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTargetIPRange UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTarget = "ip_range" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTargetASN UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTarget = "asn" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTargetCountry UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTarget = "country" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMatch string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMatchAny UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMatch = "any" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMatchAll UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMatch = "all" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMode string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersModeBlock UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMode = "block" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersModeChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMode = "challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersModeWhitelist UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMode = "whitelist" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersModeJsChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMode = "js_challenge" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersModeManagedChallenge UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMode = "managed_challenge" +) + +// The field used to sort returned rules. +type UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrder string + +const ( + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrderConfigurationTarget UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrder = "configuration.target" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrderConfigurationValue UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrder = "configuration.value" + UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrderMode UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrder = "mode" +) diff --git a/userfirewallaccessrulerule_test.go b/userfirewallaccessrulerule_test.go new file mode 100644 index 00000000000..60e6930f4a9 --- /dev/null +++ b/userfirewallaccessrulerule_test.go @@ -0,0 +1,150 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserFirewallAccessRuleRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Firewalls.AccessRules.Rules.Update( + context.TODO(), + "92f17202ed8bd63d69a66b86a49a8f6b", + cloudflare.UserFirewallAccessRuleRuleUpdateParams{ + Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleUpdateParamsModeChallenge), + Notes: cloudflare.F("This rule is enabled because of an event that occurred on date 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()) + } +} + +func TestUserFirewallAccessRuleRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Firewalls.AccessRules.Rules.Delete(context.TODO(), "92f17202ed8bd63d69a66b86a49a8f6b") + 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 TestUserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Firewalls.AccessRules.Rules.IPAccessRulesForAUserNewAnIPAccessRule(context.TODO(), cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParams{ + Configuration: cloudflare.F[cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfiguration](cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration{ + Target: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTargetIP), + Value: cloudflare.F("198.51.100.4"), + })), + Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserNewAnIPAccessRuleParamsModeChallenge), + Notes: cloudflare.F("This rule is enabled because of an event that occurred on date 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()) + } +} + +func TestUserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Firewalls.AccessRules.Rules.IPAccessRulesForAUserListIPAccessRules(context.TODO(), cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParams{ + Direction: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsDirectionDesc), + EgsPagination: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPagination{ + Json: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsEgsPaginationJson{ + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + }), + }), + Filters: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFilters{ + ConfigurationTarget: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersConfigurationTargetIP), + ConfigurationValue: cloudflare.F("198.51.100.4"), + Match: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersMatchAny), + Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsFiltersModeChallenge), + Notes: cloudflare.F("my note"), + }), + Order: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleIPAccessRulesForAUserListIPAccessRulesParamsOrderMode), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(20.000000), + }) + 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/userinvite.go b/userinvite.go new file mode 100644 index 00000000000..8d3d3ee2bcc --- /dev/null +++ b/userinvite.go @@ -0,0 +1,393 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserInviteService 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 [NewUserInviteService] method instead. +type UserInviteService struct { + Options []option.RequestOption +} + +// NewUserInviteService 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 NewUserInviteService(opts ...option.RequestOption) (r *UserInviteService) { + r = &UserInviteService{} + r.Options = opts + return +} + +// Gets the details of an invitation. +func (r *UserInviteService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserInviteGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/invites/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Responds to an invitation. +func (r *UserInviteService) Update(ctx context.Context, identifier string, body UserInviteUpdateParams, opts ...option.RequestOption) (res *UserInviteUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/invites/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Lists all invitations associated with my user. +func (r *UserInviteService) UserSInvitesListInvitations(ctx context.Context, opts ...option.RequestOption) (res *UserInviteUserSInvitesListInvitationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/invites" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserInviteGetResponse struct { + Errors []UserInviteGetResponseError `json:"errors"` + Messages []UserInviteGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserInviteGetResponseSuccess `json:"success"` + JSON userInviteGetResponseJSON `json:"-"` +} + +// userInviteGetResponseJSON contains the JSON metadata for the struct +// [UserInviteGetResponse] +type userInviteGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userInviteGetResponseErrorJSON `json:"-"` +} + +// userInviteGetResponseErrorJSON contains the JSON metadata for the struct +// [UserInviteGetResponseError] +type userInviteGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userInviteGetResponseMessageJSON `json:"-"` +} + +// userInviteGetResponseMessageJSON contains the JSON metadata for the struct +// [UserInviteGetResponseMessage] +type userInviteGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserInviteGetResponseSuccess bool + +const ( + UserInviteGetResponseSuccessTrue UserInviteGetResponseSuccess = true +) + +type UserInviteUpdateResponse struct { + Errors []UserInviteUpdateResponseError `json:"errors"` + Messages []UserInviteUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserInviteUpdateResponseSuccess `json:"success"` + JSON userInviteUpdateResponseJSON `json:"-"` +} + +// userInviteUpdateResponseJSON contains the JSON metadata for the struct +// [UserInviteUpdateResponse] +type userInviteUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userInviteUpdateResponseErrorJSON `json:"-"` +} + +// userInviteUpdateResponseErrorJSON contains the JSON metadata for the struct +// [UserInviteUpdateResponseError] +type userInviteUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userInviteUpdateResponseMessageJSON `json:"-"` +} + +// userInviteUpdateResponseMessageJSON contains the JSON metadata for the struct +// [UserInviteUpdateResponseMessage] +type userInviteUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserInviteUpdateResponseSuccess bool + +const ( + UserInviteUpdateResponseSuccessTrue UserInviteUpdateResponseSuccess = true +) + +type UserInviteUserSInvitesListInvitationsResponse struct { + Errors []UserInviteUserSInvitesListInvitationsResponseError `json:"errors"` + Messages []UserInviteUserSInvitesListInvitationsResponseMessage `json:"messages"` + Result []UserInviteUserSInvitesListInvitationsResponseResult `json:"result"` + ResultInfo UserInviteUserSInvitesListInvitationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserInviteUserSInvitesListInvitationsResponseSuccess `json:"success"` + JSON userInviteUserSInvitesListInvitationsResponseJSON `json:"-"` +} + +// userInviteUserSInvitesListInvitationsResponseJSON contains the JSON metadata for +// the struct [UserInviteUserSInvitesListInvitationsResponse] +type userInviteUserSInvitesListInvitationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUserSInvitesListInvitationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteUserSInvitesListInvitationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userInviteUserSInvitesListInvitationsResponseErrorJSON `json:"-"` +} + +// userInviteUserSInvitesListInvitationsResponseErrorJSON contains the JSON +// metadata for the struct [UserInviteUserSInvitesListInvitationsResponseError] +type userInviteUserSInvitesListInvitationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUserSInvitesListInvitationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteUserSInvitesListInvitationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userInviteUserSInvitesListInvitationsResponseMessageJSON `json:"-"` +} + +// userInviteUserSInvitesListInvitationsResponseMessageJSON contains the JSON +// metadata for the struct [UserInviteUserSInvitesListInvitationsResponseMessage] +type userInviteUserSInvitesListInvitationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUserSInvitesListInvitationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteUserSInvitesListInvitationsResponseResult struct { + // Invite identifier tag. + ID string `json:"id"` + // When the invite is no longer active. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The email address of the user who created the invite. + InvitedBy string `json:"invited_by"` + // Email address of the user to add to the organization. + InvitedMemberEmail string `json:"invited_member_email"` + // ID of the user to add to the organization. + InvitedMemberID string `json:"invited_member_id,nullable"` + // When the invite was sent. + InvitedOn time.Time `json:"invited_on" format:"date-time"` + // ID of the organization the user will be added to. + OrganizationID string `json:"organization_id"` + // Organization name. + OrganizationName string `json:"organization_name"` + // Roles to be assigned to this user. + Roles []UserInviteUserSInvitesListInvitationsResponseResultRole `json:"roles"` + // Current status of the invitation. + Status UserInviteUserSInvitesListInvitationsResponseResultStatus `json:"status"` + JSON userInviteUserSInvitesListInvitationsResponseResultJSON `json:"-"` +} + +// userInviteUserSInvitesListInvitationsResponseResultJSON contains the JSON +// metadata for the struct [UserInviteUserSInvitesListInvitationsResponseResult] +type userInviteUserSInvitesListInvitationsResponseResultJSON struct { + ID apijson.Field + ExpiresOn apijson.Field + InvitedBy apijson.Field + InvitedMemberEmail apijson.Field + InvitedMemberID apijson.Field + InvitedOn apijson.Field + OrganizationID apijson.Field + OrganizationName apijson.Field + Roles apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUserSInvitesListInvitationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserInviteUserSInvitesListInvitationsResponseResultRole struct { + // Role identifier tag. + ID string `json:"id,required"` + // Description of role's permissions. + Description string `json:"description,required"` + // Role Name. + Name string `json:"name,required"` + // Access permissions for this User. + Permissions []string `json:"permissions,required"` + JSON userInviteUserSInvitesListInvitationsResponseResultRoleJSON `json:"-"` +} + +// userInviteUserSInvitesListInvitationsResponseResultRoleJSON contains the JSON +// metadata for the struct +// [UserInviteUserSInvitesListInvitationsResponseResultRole] +type userInviteUserSInvitesListInvitationsResponseResultRoleJSON struct { + ID apijson.Field + Description apijson.Field + Name apijson.Field + Permissions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUserSInvitesListInvitationsResponseResultRole) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Current status of the invitation. +type UserInviteUserSInvitesListInvitationsResponseResultStatus string + +const ( + UserInviteUserSInvitesListInvitationsResponseResultStatusPending UserInviteUserSInvitesListInvitationsResponseResultStatus = "pending" + UserInviteUserSInvitesListInvitationsResponseResultStatusAccepted UserInviteUserSInvitesListInvitationsResponseResultStatus = "accepted" + UserInviteUserSInvitesListInvitationsResponseResultStatusRejected UserInviteUserSInvitesListInvitationsResponseResultStatus = "rejected" + UserInviteUserSInvitesListInvitationsResponseResultStatusExpired UserInviteUserSInvitesListInvitationsResponseResultStatus = "expired" +) + +type UserInviteUserSInvitesListInvitationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userInviteUserSInvitesListInvitationsResponseResultInfoJSON `json:"-"` +} + +// userInviteUserSInvitesListInvitationsResponseResultInfoJSON contains the JSON +// metadata for the struct +// [UserInviteUserSInvitesListInvitationsResponseResultInfo] +type userInviteUserSInvitesListInvitationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserInviteUserSInvitesListInvitationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserInviteUserSInvitesListInvitationsResponseSuccess bool + +const ( + UserInviteUserSInvitesListInvitationsResponseSuccessTrue UserInviteUserSInvitesListInvitationsResponseSuccess = true +) + +type UserInviteUpdateParams struct { + // Status of your response to the invitation (rejected or accepted). + Status param.Field[UserInviteUpdateParamsStatus] `json:"status,required"` +} + +func (r UserInviteUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Status of your response to the invitation (rejected or accepted). +type UserInviteUpdateParamsStatus string + +const ( + UserInviteUpdateParamsStatusAccepted UserInviteUpdateParamsStatus = "accepted" + UserInviteUpdateParamsStatusRejected UserInviteUpdateParamsStatus = "rejected" +) diff --git a/userinvite_test.go b/userinvite_test.go new file mode 100644 index 00000000000..5ea8f35622a --- /dev/null +++ b/userinvite_test.go @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserInviteGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Invites.Get(context.TODO(), "4f5f0c14a2a41d5063dd301b2f829f04") + 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 TestUserInviteUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Invites.Update( + context.TODO(), + "4f5f0c14a2a41d5063dd301b2f829f04", + cloudflare.UserInviteUpdateParams{ + Status: cloudflare.F(cloudflare.UserInviteUpdateParamsStatusAccepted), + }, + ) + 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 TestUserInviteUserSInvitesListInvitations(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Invites.UserSInvitesListInvitations(context.TODO()) + 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/userloadbalancer.go b/userloadbalancer.go new file mode 100644 index 00000000000..c44ec9906ae --- /dev/null +++ b/userloadbalancer.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerService 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 [NewUserLoadBalancerService] method +// instead. +type UserLoadBalancerService struct { + Options []option.RequestOption + Monitors *UserLoadBalancerMonitorService + Pools *UserLoadBalancerPoolService + Previews *UserLoadBalancerPreviewService +} + +// NewUserLoadBalancerService 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 NewUserLoadBalancerService(opts ...option.RequestOption) (r *UserLoadBalancerService) { + r = &UserLoadBalancerService{} + r.Options = opts + r.Monitors = NewUserLoadBalancerMonitorService(opts...) + r.Pools = NewUserLoadBalancerPoolService(opts...) + r.Previews = NewUserLoadBalancerPreviewService(opts...) + return +} diff --git a/userloadbalancermonitor.go b/userloadbalancermonitor.go new file mode 100644 index 00000000000..a8e6a0fd2f8 --- /dev/null +++ b/userloadbalancermonitor.go @@ -0,0 +1,580 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerMonitorService 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 +// [NewUserLoadBalancerMonitorService] method instead. +type UserLoadBalancerMonitorService struct { + Options []option.RequestOption + Previews *UserLoadBalancerMonitorPreviewService + References *UserLoadBalancerMonitorReferenceService +} + +// NewUserLoadBalancerMonitorService 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 NewUserLoadBalancerMonitorService(opts ...option.RequestOption) (r *UserLoadBalancerMonitorService) { + r = &UserLoadBalancerMonitorService{} + r.Options = opts + r.Previews = NewUserLoadBalancerMonitorPreviewService(opts...) + r.References = NewUserLoadBalancerMonitorReferenceService(opts...) + return +} + +// List a single configured monitor for a user. +func (r *UserLoadBalancerMonitorService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/monitors/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify a configured monitor. +func (r *UserLoadBalancerMonitorService) Update(ctx context.Context, identifier string, body UserLoadBalancerMonitorUpdateParams, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/monitors/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete a configured monitor. +func (r *UserLoadBalancerMonitorService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserLoadBalancerMonitorDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/monitors/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a configured monitor. +func (r *UserLoadBalancerMonitorService) LoadBalancerMonitorsNewMonitor(ctx context.Context, body UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParams, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := "user/load_balancers/monitors" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List configured monitors for a user. +func (r *UserLoadBalancerMonitorService) LoadBalancerMonitorsListMonitors(ctx context.Context, opts ...option.RequestOption) (res *UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/load_balancers/monitors" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Apply changes to an existing monitor, overwriting the supplied properties. +func (r *UserLoadBalancerMonitorService) Patch(ctx context.Context, identifier string, body UserLoadBalancerMonitorPatchParams, opts ...option.RequestOption) (res *Monitor, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/monitors/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type UserLoadBalancerMonitorDeleteResponse struct { + Errors []UserLoadBalancerMonitorDeleteResponseError `json:"errors"` + Messages []UserLoadBalancerMonitorDeleteResponseMessage `json:"messages"` + Result UserLoadBalancerMonitorDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success UserLoadBalancerMonitorDeleteResponseSuccess `json:"success"` + JSON userLoadBalancerMonitorDeleteResponseJSON `json:"-"` +} + +// userLoadBalancerMonitorDeleteResponseJSON contains the JSON metadata for the +// struct [UserLoadBalancerMonitorDeleteResponse] +type userLoadBalancerMonitorDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorDeleteResponseErrorJSON `json:"-"` +} + +// userLoadBalancerMonitorDeleteResponseErrorJSON contains the JSON metadata for +// the struct [UserLoadBalancerMonitorDeleteResponseError] +type userLoadBalancerMonitorDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorDeleteResponseMessageJSON `json:"-"` +} + +// userLoadBalancerMonitorDeleteResponseMessageJSON contains the JSON metadata for +// the struct [UserLoadBalancerMonitorDeleteResponseMessage] +type userLoadBalancerMonitorDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorDeleteResponseResult struct { + ID string `json:"id"` + JSON userLoadBalancerMonitorDeleteResponseResultJSON `json:"-"` +} + +// userLoadBalancerMonitorDeleteResponseResultJSON contains the JSON metadata for +// the struct [UserLoadBalancerMonitorDeleteResponseResult] +type userLoadBalancerMonitorDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerMonitorDeleteResponseSuccess bool + +const ( + UserLoadBalancerMonitorDeleteResponseSuccessTrue UserLoadBalancerMonitorDeleteResponseSuccess = true +) + +type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponse struct { + Errors []UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseError `json:"errors"` + Messages []UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseMessage `json:"messages"` + Result []UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResult `json:"result"` + ResultInfo UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseSuccess `json:"success"` + JSON userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseJSON `json:"-"` +} + +// userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponse] +type userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseErrorJSON `json:"-"` +} + +// userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseErrorJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseError] +type userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseMessageJSON `json:"-"` +} + +// userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseMessageJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseMessage] +type userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResult struct { + ID string `json:"id"` + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure bool `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown int64 `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp int64 `json:"consecutive_up"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Object description. + Description string `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody string `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes string `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects bool `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header interface{} `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval int64 `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method string `json:"method"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path string `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port int64 `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone string `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries int64 `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout int64 `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType `json:"type"` + JSON userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultJSON `json:"-"` +} + +// userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResult] +type userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultJSON struct { + ID apijson.Field + AllowInsecure apijson.Field + ConsecutiveDown apijson.Field + ConsecutiveUp apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ExpectedBody apijson.Field + ExpectedCodes apijson.Field + FollowRedirects apijson.Field + Header apijson.Field + Interval apijson.Field + Method apijson.Field + ModifiedOn apijson.Field + Path apijson.Field + Port apijson.Field + ProbeZone apijson.Field + Retries apijson.Field + Timeout apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType string + +const ( + UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultTypeHTTP UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType = "http" + UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultTypeHTTPs UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType = "https" + UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultTypeTcp UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType = "tcp" + UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultTypeUdpIcmp UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType = "udp_icmp" + UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultTypeIcmpPing UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType = "icmp_ping" + UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultTypeSmtp UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultType = "smtp" +) + +type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultInfoJSON `json:"-"` +} + +// userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultInfo] +type userLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseSuccess bool + +const ( + UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseSuccessTrue UserLoadBalancerMonitorLoadBalancerMonitorsListMonitorsResponseSuccess = true +) + +type UserLoadBalancerMonitorUpdateParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[UserLoadBalancerMonitorUpdateParamsType] `json:"type"` +} + +func (r UserLoadBalancerMonitorUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type UserLoadBalancerMonitorUpdateParamsType string + +const ( + UserLoadBalancerMonitorUpdateParamsTypeHTTP UserLoadBalancerMonitorUpdateParamsType = "http" + UserLoadBalancerMonitorUpdateParamsTypeHTTPs UserLoadBalancerMonitorUpdateParamsType = "https" + UserLoadBalancerMonitorUpdateParamsTypeTcp UserLoadBalancerMonitorUpdateParamsType = "tcp" + UserLoadBalancerMonitorUpdateParamsTypeUdpIcmp UserLoadBalancerMonitorUpdateParamsType = "udp_icmp" + UserLoadBalancerMonitorUpdateParamsTypeIcmpPing UserLoadBalancerMonitorUpdateParamsType = "icmp_ping" + UserLoadBalancerMonitorUpdateParamsTypeSmtp UserLoadBalancerMonitorUpdateParamsType = "smtp" +) + +type UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType] `json:"type"` +} + +func (r UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType string + +const ( + UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsTypeHTTP UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType = "http" + UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsTypeHTTPs UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType = "https" + UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsTypeTcp UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType = "tcp" + UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsTypeUdpIcmp UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType = "udp_icmp" + UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsTypeIcmpPing UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType = "icmp_ping" + UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsTypeSmtp UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsType = "smtp" +) + +type UserLoadBalancerMonitorPatchParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[UserLoadBalancerMonitorPatchParamsType] `json:"type"` +} + +func (r UserLoadBalancerMonitorPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type UserLoadBalancerMonitorPatchParamsType string + +const ( + UserLoadBalancerMonitorPatchParamsTypeHTTP UserLoadBalancerMonitorPatchParamsType = "http" + UserLoadBalancerMonitorPatchParamsTypeHTTPs UserLoadBalancerMonitorPatchParamsType = "https" + UserLoadBalancerMonitorPatchParamsTypeTcp UserLoadBalancerMonitorPatchParamsType = "tcp" + UserLoadBalancerMonitorPatchParamsTypeUdpIcmp UserLoadBalancerMonitorPatchParamsType = "udp_icmp" + UserLoadBalancerMonitorPatchParamsTypeIcmpPing UserLoadBalancerMonitorPatchParamsType = "icmp_ping" + UserLoadBalancerMonitorPatchParamsTypeSmtp UserLoadBalancerMonitorPatchParamsType = "smtp" +) diff --git a/userloadbalancermonitor_test.go b/userloadbalancermonitor_test.go new file mode 100644 index 00000000000..f270ba95604 --- /dev/null +++ b/userloadbalancermonitor_test.go @@ -0,0 +1,250 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerMonitorGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.Get(context.TODO(), "f1aba936b94213e5b8dca0c0dbf1f9cc") + 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 TestUserLoadBalancerMonitorUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.Update( + context.TODO(), + "f1aba936b94213e5b8dca0c0dbf1f9cc", + cloudflare.UserLoadBalancerMonitorUpdateParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.UserLoadBalancerMonitorUpdateParamsTypeHTTPs), + }, + ) + 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 TestUserLoadBalancerMonitorDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.Delete(context.TODO(), "f1aba936b94213e5b8dca0c0dbf1f9cc") + 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 TestUserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.LoadBalancerMonitorsNewMonitor(context.TODO(), cloudflare.UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.UserLoadBalancerMonitorLoadBalancerMonitorsNewMonitorParamsTypeHTTPs), + }) + 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 TestUserLoadBalancerMonitorLoadBalancerMonitorsListMonitors(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.LoadBalancerMonitorsListMonitors(context.TODO()) + 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 TestUserLoadBalancerMonitorPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.Patch( + context.TODO(), + "f1aba936b94213e5b8dca0c0dbf1f9cc", + cloudflare.UserLoadBalancerMonitorPatchParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.UserLoadBalancerMonitorPatchParamsTypeHTTPs), + }, + ) + 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/userloadbalancermonitorpreview.go b/userloadbalancermonitorpreview.go new file mode 100644 index 00000000000..d61121d2a57 --- /dev/null +++ b/userloadbalancermonitorpreview.go @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerMonitorPreviewService 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 +// [NewUserLoadBalancerMonitorPreviewService] method instead. +type UserLoadBalancerMonitorPreviewService struct { + Options []option.RequestOption +} + +// NewUserLoadBalancerMonitorPreviewService 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 NewUserLoadBalancerMonitorPreviewService(opts ...option.RequestOption) (r *UserLoadBalancerMonitorPreviewService) { + r = &UserLoadBalancerMonitorPreviewService{} + r.Options = opts + return +} + +// Preview pools using the specified monitor with provided monitor details. The +// returned preview_id can be used in the preview endpoint to retrieve the results. +func (r *UserLoadBalancerMonitorPreviewService) LoadBalancerMonitorsPreviewMonitor(ctx context.Context, identifier string, body UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParams, opts ...option.RequestOption) (res *UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/monitors/%s/preview", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponse struct { + Errors []UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseError `json:"errors"` + Messages []UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseMessage `json:"messages"` + Result UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseResult `json:"result"` + // Whether the API call was successful + Success UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseSuccess `json:"success"` + JSON userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseJSON `json:"-"` +} + +// userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponse] +type userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseErrorJSON `json:"-"` +} + +// userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseErrorJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseError] +type userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseMessageJSON `json:"-"` +} + +// userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseMessageJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseMessage] +type userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseResult struct { + // Monitored pool IDs mapped to their respective names. + Pools interface{} `json:"pools"` + PreviewID string `json:"preview_id"` + JSON userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseResultJSON `json:"-"` +} + +// userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseResultJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseResult] +type userLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseResultJSON struct { + Pools apijson.Field + PreviewID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseSuccess bool + +const ( + UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseSuccessTrue UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorResponseSuccess = true +) + +type UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType] `json:"type"` +} + +func (r UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType string + +const ( + UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsTypeHTTP UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType = "http" + UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsTypeHTTPs UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType = "https" + UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsTypeTcp UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType = "tcp" + UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsTypeUdpIcmp UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType = "udp_icmp" + UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsTypeIcmpPing UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType = "icmp_ping" + UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsTypeSmtp UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsType = "smtp" +) diff --git a/userloadbalancermonitorpreview_test.go b/userloadbalancermonitorpreview_test.go new file mode 100644 index 00000000000..a7ea06bf168 --- /dev/null +++ b/userloadbalancermonitorpreview_test.go @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.Previews.LoadBalancerMonitorsPreviewMonitor( + context.TODO(), + "f1aba936b94213e5b8dca0c0dbf1f9cc", + cloudflare.UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.UserLoadBalancerMonitorPreviewLoadBalancerMonitorsPreviewMonitorParamsTypeHTTPs), + }, + ) + 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/userloadbalancermonitorreference.go b/userloadbalancermonitorreference.go new file mode 100644 index 00000000000..638f275f848 --- /dev/null +++ b/userloadbalancermonitorreference.go @@ -0,0 +1,174 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerMonitorReferenceService 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 +// [NewUserLoadBalancerMonitorReferenceService] method instead. +type UserLoadBalancerMonitorReferenceService struct { + Options []option.RequestOption +} + +// NewUserLoadBalancerMonitorReferenceService 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 NewUserLoadBalancerMonitorReferenceService(opts ...option.RequestOption) (r *UserLoadBalancerMonitorReferenceService) { + r = &UserLoadBalancerMonitorReferenceService{} + r.Options = opts + return +} + +// Get the list of resources that reference the provided monitor. +func (r *UserLoadBalancerMonitorReferenceService) LoadBalancerMonitorsListMonitorReferences(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/monitors/%s/references", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponse struct { + Errors []UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseError `json:"errors"` + Messages []UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseMessage `json:"messages"` + // List of resources that reference a given monitor. + Result []UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResult `json:"result"` + ResultInfo UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseSuccess `json:"success"` + JSON userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseJSON `json:"-"` +} + +// userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponse] +type userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseErrorJSON `json:"-"` +} + +// userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseErrorJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseError] +type userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseMessageJSON `json:"-"` +} + +// userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseMessageJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseMessage] +type userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResult struct { + ReferenceType UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType `json:"reference_type"` + ResourceID string `json:"resource_id"` + ResourceName string `json:"resource_name"` + ResourceType string `json:"resource_type"` + JSON userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultJSON `json:"-"` +} + +// userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResult] +type userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultJSON struct { + ReferenceType apijson.Field + ResourceID apijson.Field + ResourceName apijson.Field + ResourceType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType string + +const ( + UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceTypeStar UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType = "*" + UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceTypeReferral UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType = "referral" + UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceTypeReferrer UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultReferenceType = "referrer" +) + +type UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultInfoJSON `json:"-"` +} + +// userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultInfo] +type userLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseSuccess bool + +const ( + UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseSuccessTrue UserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferencesResponseSuccess = true +) diff --git a/userloadbalancermonitorreference_test.go b/userloadbalancermonitorreference_test.go new file mode 100644 index 00000000000..e96af4fadc4 --- /dev/null +++ b/userloadbalancermonitorreference_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerMonitorReferenceLoadBalancerMonitorsListMonitorReferences(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Monitors.References.LoadBalancerMonitorsListMonitorReferences(context.TODO(), "f1aba936b94213e5b8dca0c0dbf1f9cc") + 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/userloadbalancerpool.go b/userloadbalancerpool.go new file mode 100644 index 00000000000..738453a709b --- /dev/null +++ b/userloadbalancerpool.go @@ -0,0 +1,1893 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerPoolService 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 [NewUserLoadBalancerPoolService] +// method instead. +type UserLoadBalancerPoolService struct { + Options []option.RequestOption + Health *UserLoadBalancerPoolHealthService + Previews *UserLoadBalancerPoolPreviewService + References *UserLoadBalancerPoolReferenceService +} + +// NewUserLoadBalancerPoolService 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 NewUserLoadBalancerPoolService(opts ...option.RequestOption) (r *UserLoadBalancerPoolService) { + r = &UserLoadBalancerPoolService{} + r.Options = opts + r.Health = NewUserLoadBalancerPoolHealthService(opts...) + r.Previews = NewUserLoadBalancerPoolPreviewService(opts...) + r.References = NewUserLoadBalancerPoolReferenceService(opts...) + return +} + +// Fetch a single configured pool. +func (r *UserLoadBalancerPoolService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/pools/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify a configured pool. +func (r *UserLoadBalancerPoolService) Update(ctx context.Context, identifier string, body UserLoadBalancerPoolUpdateParams, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/pools/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete a configured pool. +func (r *UserLoadBalancerPoolService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserLoadBalancerPoolDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/pools/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new pool. +func (r *UserLoadBalancerPoolService) LoadBalancerPoolsNewPool(ctx context.Context, body UserLoadBalancerPoolLoadBalancerPoolsNewPoolParams, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := "user/load_balancers/pools" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List configured pools. +func (r *UserLoadBalancerPoolService) LoadBalancerPoolsListPools(ctx context.Context, query UserLoadBalancerPoolLoadBalancerPoolsListPoolsParams, opts ...option.RequestOption) (res *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/load_balancers/pools" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Apply changes to a number of existing pools, overwriting the supplied +// properties. Pools are ordered by ascending `name`. Returns the list of affected +// pools. Supports the standard pagination query parameters, either +// `limit`/`offset` or `per_page`/`page`. +func (r *UserLoadBalancerPoolService) LoadBalancerPoolsPatchPools(ctx context.Context, body UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParams, opts ...option.RequestOption) (res *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/load_balancers/pools" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Apply changes to an existing pool, overwriting the supplied properties. +func (r *UserLoadBalancerPoolService) Patch(ctx context.Context, identifier string, body UserLoadBalancerPoolPatchParams, opts ...option.RequestOption) (res *Pool, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/pools/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type UserLoadBalancerPoolDeleteResponse struct { + Errors []UserLoadBalancerPoolDeleteResponseError `json:"errors"` + Messages []UserLoadBalancerPoolDeleteResponseMessage `json:"messages"` + Result UserLoadBalancerPoolDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success UserLoadBalancerPoolDeleteResponseSuccess `json:"success"` + JSON userLoadBalancerPoolDeleteResponseJSON `json:"-"` +} + +// userLoadBalancerPoolDeleteResponseJSON contains the JSON metadata for the struct +// [UserLoadBalancerPoolDeleteResponse] +type userLoadBalancerPoolDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolDeleteResponseErrorJSON `json:"-"` +} + +// userLoadBalancerPoolDeleteResponseErrorJSON contains the JSON metadata for the +// struct [UserLoadBalancerPoolDeleteResponseError] +type userLoadBalancerPoolDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolDeleteResponseMessageJSON `json:"-"` +} + +// userLoadBalancerPoolDeleteResponseMessageJSON contains the JSON metadata for the +// struct [UserLoadBalancerPoolDeleteResponseMessage] +type userLoadBalancerPoolDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolDeleteResponseResult struct { + ID string `json:"id"` + JSON userLoadBalancerPoolDeleteResponseResultJSON `json:"-"` +} + +// userLoadBalancerPoolDeleteResponseResultJSON contains the JSON metadata for the +// struct [UserLoadBalancerPoolDeleteResponseResult] +type userLoadBalancerPoolDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerPoolDeleteResponseSuccess bool + +const ( + UserLoadBalancerPoolDeleteResponseSuccessTrue UserLoadBalancerPoolDeleteResponseSuccess = true +) + +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponse struct { + Errors []UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseError `json:"errors"` + Messages []UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseMessage `json:"messages"` + Result []UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResult `json:"result"` + ResultInfo UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseSuccess `json:"success"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseJSON contains the JSON +// metadata for the struct [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponse] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseErrorJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseErrorJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseError] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseMessageJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseMessageJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseMessage] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResult struct { + ID string `json:"id"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions []UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion `json:"check_regions,nullable"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // A human-readable description of the pool. + Description string `json:"description"` + // This field shows up only if the pool is disabled. This field is set with the + // time the pool was disabled at. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled bool `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude float64 `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadShedding `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude float64 `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins int64 `json:"minimum_origins"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor interface{} `json:"monitor"` + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name string `json:"name"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail string `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilter `json:"notification_filter,nullable"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteering `json:"origin_steering"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins []UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOrigin `json:"origins"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResult] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultJSON struct { + ID apijson.Field + CheckRegions apijson.Field + CreatedOn apijson.Field + Description apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Latitude apijson.Field + LoadShedding apijson.Field + Longitude apijson.Field + MinimumOrigins apijson.Field + ModifiedOn apijson.Field + Monitor apijson.Field + Name apijson.Field + NotificationEmail apijson.Field + NotificationFilter apijson.Field + OriginSteering apijson.Field + Origins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionWnam UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "WNAM" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionEnam UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "ENAM" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionWeu UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "WEU" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionEeu UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "EEU" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionNsam UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "NSAM" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionSsam UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SSAM" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionOc UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "OC" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionMe UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "ME" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionNaf UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "NAF" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionSaf UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SAF" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionSas UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SAS" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionSeas UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "SEAS" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionNeas UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "NEAS" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegionAllRegions UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent float64 `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent float64 `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicy `json:"session_policy"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadShedding] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingJSON struct { + DefaultPercent apijson.Field + DefaultPolicy apijson.Field + SessionPercent apijson.Field + SessionPolicy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadShedding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicyRandom UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy = "random" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicyHash UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicyHash UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin `json:"origin,nullable"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool `json:"pool,nullable"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilter] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterJSON struct { + Origin apijson.Field + Pool apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterOriginJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterOriginJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterOriginJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterPoolJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterPoolJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterPoolJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultNotificationFilterPool) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy `json:"policy"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteering] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringJSON struct { + Policy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyRandom UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "random" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyHash UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "hash" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyLeastOutstandingRequests UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "least_outstanding_requests" + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicyLeastConnections UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginSteeringPolicy = "least_connections" +) + +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address string `json:"address"` + // This field shows up only if the origin is disabled. This field is set with the + // time the origin was disabled. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled bool `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginsHeader `json:"header"` + // A human-identifiable name for the origin. + Name string `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID string `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight float64 `json:"weight"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginJSON contains +// the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOrigin] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginJSON struct { + Address apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Header apijson.Field + Name apijson.Field + VirtualNetworkID apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host []string `json:"Host"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginsHeaderJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginsHeaderJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginsHeader] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginsHeaderJSON struct { + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultOriginsHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultInfoJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultInfoJSON contains +// the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultInfo] +type userLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseSuccess bool + +const ( + UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseSuccessTrue UserLoadBalancerPoolLoadBalancerPoolsListPoolsResponseSuccess = true +) + +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponse struct { + Errors []UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseError `json:"errors"` + Messages []UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseMessage `json:"messages"` + Result []UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResult `json:"result"` + ResultInfo UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseSuccess `json:"success"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseJSON contains the JSON +// metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponse] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseErrorJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseErrorJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseError] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseMessageJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseMessageJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseMessage] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResult struct { + ID string `json:"id"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions []UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion `json:"check_regions,nullable"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // A human-readable description of the pool. + Description string `json:"description"` + // This field shows up only if the pool is disabled. This field is set with the + // time the pool was disabled at. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled bool `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude float64 `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadShedding `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude float64 `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins int64 `json:"minimum_origins"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor interface{} `json:"monitor"` + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name string `json:"name"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail string `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter `json:"notification_filter,nullable"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteering `json:"origin_steering"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins []UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOrigin `json:"origins"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResult] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultJSON struct { + ID apijson.Field + CheckRegions apijson.Field + CreatedOn apijson.Field + Description apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Latitude apijson.Field + LoadShedding apijson.Field + Longitude apijson.Field + MinimumOrigins apijson.Field + ModifiedOn apijson.Field + Monitor apijson.Field + Name apijson.Field + NotificationEmail apijson.Field + NotificationFilter apijson.Field + OriginSteering apijson.Field + Origins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionWnam UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "WNAM" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionEnam UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "ENAM" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionWeu UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "WEU" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionEeu UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "EEU" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionNsam UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "NSAM" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSsam UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SSAM" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionOc UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "OC" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionMe UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "ME" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionNaf UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "NAF" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSaf UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SAF" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSas UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SAS" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionSeas UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "SEAS" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionNeas UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "NEAS" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegionAllRegions UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent float64 `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent float64 `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicy `json:"session_policy"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadShedding] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingJSON struct { + DefaultPercent apijson.Field + DefaultPolicy apijson.Field + SessionPercent apijson.Field + SessionPolicy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadShedding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicyRandom UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy = "random" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicyHash UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicyHash UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin `json:"origin,nullable"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool `json:"pool,nullable"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterJSON struct { + Origin apijson.Field + Pool apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOriginJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOriginJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOriginJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable bool `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy bool `json:"healthy,nullable"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPoolJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPoolJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPoolJSON struct { + Disable apijson.Field + Healthy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultNotificationFilterPool) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy `json:"policy"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteering] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringJSON struct { + Policy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyRandom UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "random" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyHash UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "hash" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyLeastOutstandingRequests UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "least_outstanding_requests" + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicyLeastConnections UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginSteeringPolicy = "least_connections" +) + +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address string `json:"address"` + // This field shows up only if the origin is disabled. This field is set with the + // time the origin was disabled. + DisabledAt time.Time `json:"disabled_at" format:"date-time"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled bool `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader `json:"header"` + // A human-identifiable name for the origin. + Name string `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID string `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight float64 `json:"weight"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginJSON contains +// the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOrigin] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginJSON struct { + Address apijson.Field + DisabledAt apijson.Field + Enabled apijson.Field + Header apijson.Field + Name apijson.Field + VirtualNetworkID apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host []string `json:"Host"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginsHeaderJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginsHeaderJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginsHeaderJSON struct { + Host apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultOriginsHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultInfoJSON `json:"-"` +} + +// userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultInfoJSON contains +// the JSON metadata for the struct +// [UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultInfo] +type userLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseSuccess bool + +const ( + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseSuccessTrue UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsResponseSuccess = true +) + +type UserLoadBalancerPoolUpdateParams struct { + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins param.Field[[]UserLoadBalancerPoolUpdateParamsOrigin] `json:"origins,required"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions param.Field[[]UserLoadBalancerPoolUpdateParamsCheckRegion] `json:"check_regions"` + // A human-readable description of the pool. + Description param.Field[string] `json:"description"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled param.Field[bool] `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude param.Field[float64] `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding param.Field[UserLoadBalancerPoolUpdateParamsLoadShedding] `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude param.Field[float64] `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins param.Field[int64] `json:"minimum_origins"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `json:"monitor"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail param.Field[string] `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter param.Field[UserLoadBalancerPoolUpdateParamsNotificationFilter] `json:"notification_filter"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering param.Field[UserLoadBalancerPoolUpdateParamsOriginSteering] `json:"origin_steering"` +} + +func (r UserLoadBalancerPoolUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserLoadBalancerPoolUpdateParamsOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address param.Field[string] `json:"address"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled param.Field[bool] `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header param.Field[UserLoadBalancerPoolUpdateParamsOriginsHeader] `json:"header"` + // A human-identifiable name for the origin. + Name param.Field[string] `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID param.Field[string] `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight param.Field[float64] `json:"weight"` +} + +func (r UserLoadBalancerPoolUpdateParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type UserLoadBalancerPoolUpdateParamsOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host param.Field[[]string] `json:"Host"` +} + +func (r UserLoadBalancerPoolUpdateParamsOriginsHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type UserLoadBalancerPoolUpdateParamsCheckRegion string + +const ( + UserLoadBalancerPoolUpdateParamsCheckRegionWnam UserLoadBalancerPoolUpdateParamsCheckRegion = "WNAM" + UserLoadBalancerPoolUpdateParamsCheckRegionEnam UserLoadBalancerPoolUpdateParamsCheckRegion = "ENAM" + UserLoadBalancerPoolUpdateParamsCheckRegionWeu UserLoadBalancerPoolUpdateParamsCheckRegion = "WEU" + UserLoadBalancerPoolUpdateParamsCheckRegionEeu UserLoadBalancerPoolUpdateParamsCheckRegion = "EEU" + UserLoadBalancerPoolUpdateParamsCheckRegionNsam UserLoadBalancerPoolUpdateParamsCheckRegion = "NSAM" + UserLoadBalancerPoolUpdateParamsCheckRegionSsam UserLoadBalancerPoolUpdateParamsCheckRegion = "SSAM" + UserLoadBalancerPoolUpdateParamsCheckRegionOc UserLoadBalancerPoolUpdateParamsCheckRegion = "OC" + UserLoadBalancerPoolUpdateParamsCheckRegionMe UserLoadBalancerPoolUpdateParamsCheckRegion = "ME" + UserLoadBalancerPoolUpdateParamsCheckRegionNaf UserLoadBalancerPoolUpdateParamsCheckRegion = "NAF" + UserLoadBalancerPoolUpdateParamsCheckRegionSaf UserLoadBalancerPoolUpdateParamsCheckRegion = "SAF" + UserLoadBalancerPoolUpdateParamsCheckRegionSas UserLoadBalancerPoolUpdateParamsCheckRegion = "SAS" + UserLoadBalancerPoolUpdateParamsCheckRegionSeas UserLoadBalancerPoolUpdateParamsCheckRegion = "SEAS" + UserLoadBalancerPoolUpdateParamsCheckRegionNeas UserLoadBalancerPoolUpdateParamsCheckRegion = "NEAS" + UserLoadBalancerPoolUpdateParamsCheckRegionAllRegions UserLoadBalancerPoolUpdateParamsCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type UserLoadBalancerPoolUpdateParamsLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent param.Field[float64] `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy param.Field[UserLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy] `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent param.Field[float64] `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy param.Field[UserLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicy] `json:"session_policy"` +} + +func (r UserLoadBalancerPoolUpdateParamsLoadShedding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type UserLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy string + +const ( + UserLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicyRandom UserLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy = "random" + UserLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicyHash UserLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type UserLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicy string + +const ( + UserLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicyHash UserLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type UserLoadBalancerPoolUpdateParamsNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin param.Field[UserLoadBalancerPoolUpdateParamsNotificationFilterOrigin] `json:"origin"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool param.Field[UserLoadBalancerPoolUpdateParamsNotificationFilterPool] `json:"pool"` +} + +func (r UserLoadBalancerPoolUpdateParamsNotificationFilter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolUpdateParamsNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r UserLoadBalancerPoolUpdateParamsNotificationFilterOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolUpdateParamsNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r UserLoadBalancerPoolUpdateParamsNotificationFilterPool) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type UserLoadBalancerPoolUpdateParamsOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy param.Field[UserLoadBalancerPoolUpdateParamsOriginSteeringPolicy] `json:"policy"` +} + +func (r UserLoadBalancerPoolUpdateParamsOriginSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type UserLoadBalancerPoolUpdateParamsOriginSteeringPolicy string + +const ( + UserLoadBalancerPoolUpdateParamsOriginSteeringPolicyRandom UserLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "random" + UserLoadBalancerPoolUpdateParamsOriginSteeringPolicyHash UserLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "hash" + UserLoadBalancerPoolUpdateParamsOriginSteeringPolicyLeastOutstandingRequests UserLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "least_outstanding_requests" + UserLoadBalancerPoolUpdateParamsOriginSteeringPolicyLeastConnections UserLoadBalancerPoolUpdateParamsOriginSteeringPolicy = "least_connections" +) + +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParams struct { + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins param.Field[[]UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOrigin] `json:"origins,required"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions param.Field[[]UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion] `json:"check_regions"` + // A human-readable description of the pool. + Description param.Field[string] `json:"description"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled param.Field[bool] `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude param.Field[float64] `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadShedding] `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude param.Field[float64] `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins param.Field[int64] `json:"minimum_origins"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `json:"monitor"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail param.Field[string] `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilter] `json:"notification_filter"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteering] `json:"origin_steering"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address param.Field[string] `json:"address"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled param.Field[bool] `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginsHeader] `json:"header"` + // A human-identifiable name for the origin. + Name param.Field[string] `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID param.Field[string] `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight param.Field[float64] `json:"weight"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host param.Field[[]string] `json:"Host"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginsHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionWnam UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "WNAM" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionEnam UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "ENAM" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionWeu UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "WEU" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionEeu UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "EEU" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionNsam UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "NSAM" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionSsam UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "SSAM" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionOc UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "OC" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionMe UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "ME" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionNaf UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "NAF" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionSaf UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "SAF" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionSas UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "SAS" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionSeas UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "SEAS" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionNeas UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "NEAS" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionAllRegions UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent param.Field[float64] `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy] `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent param.Field[float64] `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicy] `json:"session_policy"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadShedding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicyRandom UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy = "random" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicyHash UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicyHash UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin] `json:"origin"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterPool] `json:"pool"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterPool) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy param.Field[UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy] `json:"policy"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyRandom UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "random" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyHash UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "hash" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyLeastOutstandingRequests UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "least_outstanding_requests" + UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyLeastConnections UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicy = "least_connections" +) + +type UserLoadBalancerPoolLoadBalancerPoolsListPoolsParams struct { + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `query:"monitor"` +} + +// URLQuery serializes [UserLoadBalancerPoolLoadBalancerPoolsListPoolsParams]'s +// query parameters as `url.Values`. +func (r UserLoadBalancerPoolLoadBalancerPoolsListPoolsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParams struct { + // The email address to send health status notifications to. This field is now + // deprecated in favor of Cloudflare Notifications for Load Balancing, so only + // resetting this field with an empty string `""` is accepted. + NotificationEmail param.Field[UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParamsNotificationEmail] `json:"notification_email"` +} + +func (r UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The email address to send health status notifications to. This field is now +// deprecated in favor of Cloudflare Notifications for Load Balancing, so only +// resetting this field with an empty string `""` is accepted. +type UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParamsNotificationEmail string + +const ( + UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParamsNotificationEmailEmpty UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParamsNotificationEmail = "\"\"" +) + +type UserLoadBalancerPoolPatchParams struct { + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + CheckRegions param.Field[[]UserLoadBalancerPoolPatchParamsCheckRegion] `json:"check_regions"` + // A human-readable description of the pool. + Description param.Field[string] `json:"description"` + // Whether to enable (the default) or disable this pool. Disabled pools will not + // receive traffic and are excluded from health checks. Disabling a pool will cause + // any load balancers using it to failover to the next pool (if any). + Enabled param.Field[bool] `json:"enabled"` + // The latitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, longitude must also be set. + Latitude param.Field[float64] `json:"latitude"` + // Configures load shedding policies and percentages for the pool. + LoadShedding param.Field[UserLoadBalancerPoolPatchParamsLoadShedding] `json:"load_shedding"` + // The longitude of the data center containing the origins used in this pool in + // decimal degrees. If this is set, latitude must also be set. + Longitude param.Field[float64] `json:"longitude"` + // The minimum number of origins that must be healthy for this pool to serve + // traffic. If the number of healthy origins falls below this number, the pool will + // be marked unhealthy and will failover to the next available pool. + MinimumOrigins param.Field[int64] `json:"minimum_origins"` + // The ID of the Monitor to use for checking the health of origins within this + // pool. + Monitor param.Field[interface{}] `json:"monitor"` + // A short name (tag) for the pool. Only alphanumeric characters, hyphens, and + // underscores are allowed. + Name param.Field[string] `json:"name"` + // This field is now deprecated. It has been moved to Cloudflare's Centralized + // Notification service + // https://developers.cloudflare.com/fundamentals/notifications/. The email address + // to send health status notifications to. This can be an individual mailbox or a + // mailing list. Multiple emails can be supplied as a comma delimited list. + NotificationEmail param.Field[string] `json:"notification_email"` + // Filter pool and origin health notifications by resource type or health status. + // Use null to reset. + NotificationFilter param.Field[UserLoadBalancerPoolPatchParamsNotificationFilter] `json:"notification_filter"` + // Configures origin steering for the pool. Controls how origins are selected for + // new sessions and traffic without session affinity. + OriginSteering param.Field[UserLoadBalancerPoolPatchParamsOriginSteering] `json:"origin_steering"` + // The list of origins within this pool. Traffic directed at this pool is balanced + // across all currently healthy origins, provided the pool itself is healthy. + Origins param.Field[[]UserLoadBalancerPoolPatchParamsOrigin] `json:"origins"` +} + +func (r UserLoadBalancerPoolPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: +// Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all +// regions (ENTERPRISE customers only). +type UserLoadBalancerPoolPatchParamsCheckRegion string + +const ( + UserLoadBalancerPoolPatchParamsCheckRegionWnam UserLoadBalancerPoolPatchParamsCheckRegion = "WNAM" + UserLoadBalancerPoolPatchParamsCheckRegionEnam UserLoadBalancerPoolPatchParamsCheckRegion = "ENAM" + UserLoadBalancerPoolPatchParamsCheckRegionWeu UserLoadBalancerPoolPatchParamsCheckRegion = "WEU" + UserLoadBalancerPoolPatchParamsCheckRegionEeu UserLoadBalancerPoolPatchParamsCheckRegion = "EEU" + UserLoadBalancerPoolPatchParamsCheckRegionNsam UserLoadBalancerPoolPatchParamsCheckRegion = "NSAM" + UserLoadBalancerPoolPatchParamsCheckRegionSsam UserLoadBalancerPoolPatchParamsCheckRegion = "SSAM" + UserLoadBalancerPoolPatchParamsCheckRegionOc UserLoadBalancerPoolPatchParamsCheckRegion = "OC" + UserLoadBalancerPoolPatchParamsCheckRegionMe UserLoadBalancerPoolPatchParamsCheckRegion = "ME" + UserLoadBalancerPoolPatchParamsCheckRegionNaf UserLoadBalancerPoolPatchParamsCheckRegion = "NAF" + UserLoadBalancerPoolPatchParamsCheckRegionSaf UserLoadBalancerPoolPatchParamsCheckRegion = "SAF" + UserLoadBalancerPoolPatchParamsCheckRegionSas UserLoadBalancerPoolPatchParamsCheckRegion = "SAS" + UserLoadBalancerPoolPatchParamsCheckRegionSeas UserLoadBalancerPoolPatchParamsCheckRegion = "SEAS" + UserLoadBalancerPoolPatchParamsCheckRegionNeas UserLoadBalancerPoolPatchParamsCheckRegion = "NEAS" + UserLoadBalancerPoolPatchParamsCheckRegionAllRegions UserLoadBalancerPoolPatchParamsCheckRegion = "ALL_REGIONS" +) + +// Configures load shedding policies and percentages for the pool. +type UserLoadBalancerPoolPatchParamsLoadShedding struct { + // The percent of traffic to shed from the pool, according to the default policy. + // Applies to new sessions and traffic without session affinity. + DefaultPercent param.Field[float64] `json:"default_percent"` + // The default policy to use when load shedding. A random policy randomly sheds a + // given percent of requests. A hash policy computes a hash over the + // CF-Connecting-IP address and sheds all requests originating from a percent of + // IPs. + DefaultPolicy param.Field[UserLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy] `json:"default_policy"` + // The percent of existing sessions to shed from the pool, according to the session + // policy. + SessionPercent param.Field[float64] `json:"session_percent"` + // Only the hash policy is supported for existing sessions (to avoid exponential + // decay). + SessionPolicy param.Field[UserLoadBalancerPoolPatchParamsLoadSheddingSessionPolicy] `json:"session_policy"` +} + +func (r UserLoadBalancerPoolPatchParamsLoadShedding) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default policy to use when load shedding. A random policy randomly sheds a +// given percent of requests. A hash policy computes a hash over the +// CF-Connecting-IP address and sheds all requests originating from a percent of +// IPs. +type UserLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy string + +const ( + UserLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicyRandom UserLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy = "random" + UserLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicyHash UserLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicy = "hash" +) + +// Only the hash policy is supported for existing sessions (to avoid exponential +// decay). +type UserLoadBalancerPoolPatchParamsLoadSheddingSessionPolicy string + +const ( + UserLoadBalancerPoolPatchParamsLoadSheddingSessionPolicyHash UserLoadBalancerPoolPatchParamsLoadSheddingSessionPolicy = "hash" +) + +// Filter pool and origin health notifications by resource type or health status. +// Use null to reset. +type UserLoadBalancerPoolPatchParamsNotificationFilter struct { + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Origin param.Field[UserLoadBalancerPoolPatchParamsNotificationFilterOrigin] `json:"origin"` + // Filter options for a particular resource type (pool or origin). Use null to + // reset. + Pool param.Field[UserLoadBalancerPoolPatchParamsNotificationFilterPool] `json:"pool"` +} + +func (r UserLoadBalancerPoolPatchParamsNotificationFilter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolPatchParamsNotificationFilterOrigin struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r UserLoadBalancerPoolPatchParamsNotificationFilterOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Filter options for a particular resource type (pool or origin). Use null to +// reset. +type UserLoadBalancerPoolPatchParamsNotificationFilterPool struct { + // If set true, disable notifications for this type of resource (pool or origin). + Disable param.Field[bool] `json:"disable"` + // If present, send notifications only for this health status (e.g. false for only + // DOWN events). Use null to reset (all events). + Healthy param.Field[bool] `json:"healthy"` +} + +func (r UserLoadBalancerPoolPatchParamsNotificationFilterPool) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures origin steering for the pool. Controls how origins are selected for +// new sessions and traffic without session affinity. +type UserLoadBalancerPoolPatchParamsOriginSteering struct { + // The type of origin steering policy to use. + // + // - `"random"`: Select an origin randomly. + // - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP + // address. + // - `"least_outstanding_requests"`: Select an origin by taking into consideration + // origin weights, as well as each origin's number of outstanding requests. + // Origins with more pending requests are weighted proportionately less relative + // to others. + // - `"least_connections"`: Select an origin by taking into consideration origin + // weights, as well as each origin's number of open connections. Origins with + // more open connections are weighted proportionately less relative to others. + // Supported for HTTP/1 and HTTP/2 connections. + Policy param.Field[UserLoadBalancerPoolPatchParamsOriginSteeringPolicy] `json:"policy"` +} + +func (r UserLoadBalancerPoolPatchParamsOriginSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of origin steering policy to use. +// +// - `"random"`: Select an origin randomly. +// - `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP +// address. +// - `"least_outstanding_requests"`: Select an origin by taking into consideration +// origin weights, as well as each origin's number of outstanding requests. +// Origins with more pending requests are weighted proportionately less relative +// to others. +// - `"least_connections"`: Select an origin by taking into consideration origin +// weights, as well as each origin's number of open connections. Origins with +// more open connections are weighted proportionately less relative to others. +// Supported for HTTP/1 and HTTP/2 connections. +type UserLoadBalancerPoolPatchParamsOriginSteeringPolicy string + +const ( + UserLoadBalancerPoolPatchParamsOriginSteeringPolicyRandom UserLoadBalancerPoolPatchParamsOriginSteeringPolicy = "random" + UserLoadBalancerPoolPatchParamsOriginSteeringPolicyHash UserLoadBalancerPoolPatchParamsOriginSteeringPolicy = "hash" + UserLoadBalancerPoolPatchParamsOriginSteeringPolicyLeastOutstandingRequests UserLoadBalancerPoolPatchParamsOriginSteeringPolicy = "least_outstanding_requests" + UserLoadBalancerPoolPatchParamsOriginSteeringPolicyLeastConnections UserLoadBalancerPoolPatchParamsOriginSteeringPolicy = "least_connections" +) + +type UserLoadBalancerPoolPatchParamsOrigin struct { + // The IP address (IPv4 or IPv6) of the origin, or its publicly addressable + // hostname. Hostnames entered here should resolve directly to the origin, and not + // be a hostname proxied by Cloudflare. To set an internal/reserved address, + // virtual_network_id must also be set. + Address param.Field[string] `json:"address"` + // Whether to enable (the default) this origin within the pool. Disabled origins + // will not receive traffic and are excluded from health checks. The origin will + // only be disabled for the current pool. + Enabled param.Field[bool] `json:"enabled"` + // The request header is used to pass additional information with an HTTP request. + // Currently supported header is 'Host'. + Header param.Field[UserLoadBalancerPoolPatchParamsOriginsHeader] `json:"header"` + // A human-identifiable name for the origin. + Name param.Field[string] `json:"name"` + // The virtual network subnet ID the origin belongs in. Virtual network must also + // belong to the account. + VirtualNetworkID param.Field[string] `json:"virtual_network_id"` + // The weight of this origin relative to other origins in the pool. Based on the + // configured weight the total traffic is distributed among origins within the + // pool. + // + // - `origin_steering.policy="least_outstanding_requests"`: Use weight to scale the + // origin's outstanding requests. + // - `origin_steering.policy="least_connections"`: Use weight to scale the origin's + // open connections. + Weight param.Field[float64] `json:"weight"` +} + +func (r UserLoadBalancerPoolPatchParamsOrigin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The request header is used to pass additional information with an HTTP request. +// Currently supported header is 'Host'. +type UserLoadBalancerPoolPatchParamsOriginsHeader struct { + // The 'Host' header allows to override the hostname set in the HTTP request. + // Current support is 1 'Host' header override per origin. + Host param.Field[[]string] `json:"Host"` +} + +func (r UserLoadBalancerPoolPatchParamsOriginsHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/userloadbalancerpool_test.go b/userloadbalancerpool_test.go new file mode 100644 index 00000000000..c371b309a03 --- /dev/null +++ b/userloadbalancerpool_test.go @@ -0,0 +1,379 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerPoolGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.Get(context.TODO(), "17b5962d775c646f3f9725cbc7a53df4") + 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 TestUserLoadBalancerPoolUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.Update( + context.TODO(), + "17b5962d775c646f3f9725cbc7a53df4", + cloudflare.UserLoadBalancerPoolUpdateParams{ + Name: cloudflare.F("primary-dc-1"), + Origins: cloudflare.F([]cloudflare.UserLoadBalancerPoolUpdateParamsOrigin{{ + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }}), + CheckRegions: cloudflare.F([]cloudflare.UserLoadBalancerPoolUpdateParamsCheckRegion{cloudflare.UserLoadBalancerPoolUpdateParamsCheckRegionWeu, cloudflare.UserLoadBalancerPoolUpdateParamsCheckRegionEnam}), + Description: cloudflare.F("Primary data center - Provider XYZ"), + Enabled: cloudflare.F(false), + Latitude: cloudflare.F(0.000000), + LoadShedding: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsLoadShedding{ + DefaultPercent: cloudflare.F(0.000000), + DefaultPolicy: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsLoadSheddingDefaultPolicyRandom), + SessionPercent: cloudflare.F(0.000000), + SessionPolicy: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsLoadSheddingSessionPolicyHash), + }), + Longitude: cloudflare.F(0.000000), + MinimumOrigins: cloudflare.F(int64(0)), + Monitor: cloudflare.F[any](map[string]interface{}{}), + NotificationEmail: cloudflare.F("someone@example.com,sometwo@example.com"), + NotificationFilter: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsNotificationFilter{ + Origin: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsNotificationFilterOrigin{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(true), + }), + Pool: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsNotificationFilterPool{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(false), + }), + }), + OriginSteering: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsOriginSteering{ + Policy: cloudflare.F(cloudflare.UserLoadBalancerPoolUpdateParamsOriginSteeringPolicyRandom), + }), + }, + ) + 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 TestUserLoadBalancerPoolDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.Delete(context.TODO(), "17b5962d775c646f3f9725cbc7a53df4") + 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 TestUserLoadBalancerPoolLoadBalancerPoolsNewPoolWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.LoadBalancerPoolsNewPool(context.TODO(), cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParams{ + Name: cloudflare.F("primary-dc-1"), + Origins: cloudflare.F([]cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOrigin{{ + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }}), + CheckRegions: cloudflare.F([]cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegion{cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionWeu, cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsCheckRegionEnam}), + Description: cloudflare.F("Primary data center - Provider XYZ"), + Enabled: cloudflare.F(false), + Latitude: cloudflare.F(0.000000), + LoadShedding: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadShedding{ + DefaultPercent: cloudflare.F(0.000000), + DefaultPolicy: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingDefaultPolicyRandom), + SessionPercent: cloudflare.F(0.000000), + SessionPolicy: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsLoadSheddingSessionPolicyHash), + }), + Longitude: cloudflare.F(0.000000), + MinimumOrigins: cloudflare.F(int64(0)), + Monitor: cloudflare.F[any](map[string]interface{}{}), + NotificationEmail: cloudflare.F("someone@example.com,sometwo@example.com"), + NotificationFilter: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilter{ + Origin: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterOrigin{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(true), + }), + Pool: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsNotificationFilterPool{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(false), + }), + }), + OriginSteering: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteering{ + Policy: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsNewPoolParamsOriginSteeringPolicyRandom), + }), + }) + 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 TestUserLoadBalancerPoolLoadBalancerPoolsListPoolsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.LoadBalancerPoolsListPools(context.TODO(), cloudflare.UserLoadBalancerPoolLoadBalancerPoolsListPoolsParams{ + Monitor: cloudflare.F[any](map[string]interface{}{}), + }) + 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 TestUserLoadBalancerPoolLoadBalancerPoolsPatchPoolsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.LoadBalancerPoolsPatchPools(context.TODO(), cloudflare.UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParams{ + NotificationEmail: cloudflare.F(cloudflare.UserLoadBalancerPoolLoadBalancerPoolsPatchPoolsParamsNotificationEmailEmpty), + }) + 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 TestUserLoadBalancerPoolPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.Patch( + context.TODO(), + "17b5962d775c646f3f9725cbc7a53df4", + cloudflare.UserLoadBalancerPoolPatchParams{ + CheckRegions: cloudflare.F([]cloudflare.UserLoadBalancerPoolPatchParamsCheckRegion{cloudflare.UserLoadBalancerPoolPatchParamsCheckRegionWeu, cloudflare.UserLoadBalancerPoolPatchParamsCheckRegionEnam}), + Description: cloudflare.F("Primary data center - Provider XYZ"), + Enabled: cloudflare.F(false), + Latitude: cloudflare.F(0.000000), + LoadShedding: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsLoadShedding{ + DefaultPercent: cloudflare.F(0.000000), + DefaultPolicy: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsLoadSheddingDefaultPolicyRandom), + SessionPercent: cloudflare.F(0.000000), + SessionPolicy: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsLoadSheddingSessionPolicyHash), + }), + Longitude: cloudflare.F(0.000000), + MinimumOrigins: cloudflare.F(int64(0)), + Monitor: cloudflare.F[any](map[string]interface{}{}), + Name: cloudflare.F("primary-dc-1"), + NotificationEmail: cloudflare.F("someone@example.com,sometwo@example.com"), + NotificationFilter: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsNotificationFilter{ + Origin: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsNotificationFilterOrigin{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(true), + }), + Pool: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsNotificationFilterPool{ + Disable: cloudflare.F(true), + Healthy: cloudflare.F(false), + }), + }), + OriginSteering: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsOriginSteering{ + Policy: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsOriginSteeringPolicyRandom), + }), + Origins: cloudflare.F([]cloudflare.UserLoadBalancerPoolPatchParamsOrigin{{ + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }, { + Address: cloudflare.F("0.0.0.0"), + Enabled: cloudflare.F(true), + Header: cloudflare.F(cloudflare.UserLoadBalancerPoolPatchParamsOriginsHeader{ + Host: cloudflare.F([]string{"example.com", "example.com", "example.com"}), + }), + Name: cloudflare.F("app-server-1"), + VirtualNetworkID: cloudflare.F("a5624d4e-044a-4ff0-b3e1-e2465353d4b4"), + Weight: cloudflare.F(0.600000), + }}), + }, + ) + 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/userloadbalancerpoolhealth.go b/userloadbalancerpoolhealth.go new file mode 100644 index 00000000000..bacab686076 --- /dev/null +++ b/userloadbalancerpoolhealth.go @@ -0,0 +1,113 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerPoolHealthService 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 +// [NewUserLoadBalancerPoolHealthService] method instead. +type UserLoadBalancerPoolHealthService struct { + Options []option.RequestOption +} + +// NewUserLoadBalancerPoolHealthService 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 NewUserLoadBalancerPoolHealthService(opts ...option.RequestOption) (r *UserLoadBalancerPoolHealthService) { + r = &UserLoadBalancerPoolHealthService{} + r.Options = opts + return +} + +// Fetch the latest pool health status for a single pool. +func (r *UserLoadBalancerPoolHealthService) LoadBalancerPoolsPoolHealthDetails(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/pools/%s/health", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponse struct { + Errors []UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseError `json:"errors"` + Messages []UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseMessage `json:"messages"` + // A list of regions from which to run health checks. Null means every Cloudflare + // data center. + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseSuccess `json:"success"` + JSON userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseJSON `json:"-"` +} + +// userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponse] +type userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseErrorJSON `json:"-"` +} + +// userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseError] +type userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseMessageJSON `json:"-"` +} + +// userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseMessage] +type userLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseSuccess bool + +const ( + UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseSuccessTrue UserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetailsResponseSuccess = true +) diff --git a/userloadbalancerpoolhealth_test.go b/userloadbalancerpoolhealth_test.go new file mode 100644 index 00000000000..6b753c45b45 --- /dev/null +++ b/userloadbalancerpoolhealth_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerPoolHealthLoadBalancerPoolsPoolHealthDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.Health.LoadBalancerPoolsPoolHealthDetails(context.TODO(), "17b5962d775c646f3f9725cbc7a53df4") + 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/userloadbalancerpoolpreview.go b/userloadbalancerpoolpreview.go new file mode 100644 index 00000000000..a7ae929b89f --- /dev/null +++ b/userloadbalancerpoolpreview.go @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerPoolPreviewService 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 +// [NewUserLoadBalancerPoolPreviewService] method instead. +type UserLoadBalancerPoolPreviewService struct { + Options []option.RequestOption +} + +// NewUserLoadBalancerPoolPreviewService 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 NewUserLoadBalancerPoolPreviewService(opts ...option.RequestOption) (r *UserLoadBalancerPoolPreviewService) { + r = &UserLoadBalancerPoolPreviewService{} + r.Options = opts + return +} + +// Preview pool health using provided monitor details. The returned preview_id can +// be used in the preview endpoint to retrieve the results. +func (r *UserLoadBalancerPoolPreviewService) LoadBalancerPoolsPreviewPool(ctx context.Context, identifier string, body UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParams, opts ...option.RequestOption) (res *UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/pools/%s/preview", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponse struct { + Errors []UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseError `json:"errors"` + Messages []UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseMessage `json:"messages"` + Result UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseResult `json:"result"` + // Whether the API call was successful + Success UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseSuccess `json:"success"` + JSON userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseJSON `json:"-"` +} + +// userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseJSON contains the +// JSON metadata for the struct +// [UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponse] +type userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseErrorJSON `json:"-"` +} + +// userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseErrorJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseError] +type userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseMessageJSON `json:"-"` +} + +// userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseMessageJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseMessage] +type userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseResult struct { + // Monitored pool IDs mapped to their respective names. + Pools interface{} `json:"pools"` + PreviewID string `json:"preview_id"` + JSON userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseResultJSON `json:"-"` +} + +// userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseResultJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseResult] +type userLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseResultJSON struct { + Pools apijson.Field + PreviewID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseSuccess bool + +const ( + UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseSuccessTrue UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolResponseSuccess = true +) + +type UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParams struct { + // Do not validate the certificate when monitor use HTTPS. This parameter is + // currently only valid for HTTP and HTTPS monitors. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // To be marked unhealthy the monitored origin must fail this healthcheck N + // consecutive times. + ConsecutiveDown param.Field[int64] `json:"consecutive_down"` + // To be marked healthy the monitored origin must pass this healthcheck N + // consecutive times. + ConsecutiveUp param.Field[int64] `json:"consecutive_up"` + // Object description. + Description param.Field[string] `json:"description"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. This parameter is only + // valid for HTTP and HTTPS monitors. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response code or code range of the health check. This + // parameter is only valid for HTTP and HTTPS monitors. + ExpectedCodes param.Field[string] `json:"expected_codes"` + // Follow redirects if returned by the origin. This parameter is only valid for + // HTTP and HTTPS monitors. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. This + // parameter is only valid for HTTP and HTTPS monitors. + Header param.Field[interface{}] `json:"header"` + // The interval between each health check. Shorter intervals may improve failover + // time, but will increase load on the origins as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS + // based checks and 'connection_established' for TCP based health checks. + Method param.Field[string] `json:"method"` + // The endpoint path you want to conduct a health check against. This parameter is + // only valid for HTTP and HTTPS monitors. + Path param.Field[string] `json:"path"` + // The port number to connect to for the health check. Required for TCP, UDP, and + // SMTP checks. HTTP and HTTPS checks should only define the port when using a + // non-standard port (HTTP: default 80, HTTPS: default 443). + Port param.Field[int64] `json:"port"` + // Assign this monitor to emulate the specified zone while probing. This parameter + // is only valid for HTTP and HTTPS monitors. + ProbeZone param.Field[string] `json:"probe_zone"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. + Type param.Field[UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType] `json:"type"` +} + +func (r UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The protocol to use for the health check. Currently supported protocols are +// 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. +type UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType string + +const ( + UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsTypeHTTP UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType = "http" + UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsTypeHTTPs UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType = "https" + UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsTypeTcp UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType = "tcp" + UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsTypeUdpIcmp UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType = "udp_icmp" + UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsTypeIcmpPing UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType = "icmp_ping" + UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsTypeSmtp UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsType = "smtp" +) diff --git a/userloadbalancerpoolpreview_test.go b/userloadbalancerpoolpreview_test.go new file mode 100644 index 00000000000..42744613c84 --- /dev/null +++ b/userloadbalancerpoolpreview_test.go @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.Previews.LoadBalancerPoolsPreviewPool( + context.TODO(), + "17b5962d775c646f3f9725cbc7a53df4", + cloudflare.UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParams{ + AllowInsecure: cloudflare.F(true), + ConsecutiveDown: cloudflare.F(int64(0)), + ConsecutiveUp: cloudflare.F(int64(0)), + Description: cloudflare.F("Login page monitor"), + ExpectedBody: cloudflare.F("alive"), + ExpectedCodes: cloudflare.F("2xx"), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Interval: cloudflare.F(int64(0)), + Method: cloudflare.F("GET"), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + ProbeZone: cloudflare.F("example.com"), + Retries: cloudflare.F(int64(0)), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F(cloudflare.UserLoadBalancerPoolPreviewLoadBalancerPoolsPreviewPoolParamsTypeHTTPs), + }, + ) + 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/userloadbalancerpoolreference.go b/userloadbalancerpoolreference.go new file mode 100644 index 00000000000..3fdb70984df --- /dev/null +++ b/userloadbalancerpoolreference.go @@ -0,0 +1,174 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerPoolReferenceService 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 +// [NewUserLoadBalancerPoolReferenceService] method instead. +type UserLoadBalancerPoolReferenceService struct { + Options []option.RequestOption +} + +// NewUserLoadBalancerPoolReferenceService 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 NewUserLoadBalancerPoolReferenceService(opts ...option.RequestOption) (r *UserLoadBalancerPoolReferenceService) { + r = &UserLoadBalancerPoolReferenceService{} + r.Options = opts + return +} + +// Get the list of resources that reference the provided pool. +func (r *UserLoadBalancerPoolReferenceService) LoadBalancerPoolsListPoolReferences(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/pools/%s/references", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponse struct { + Errors []UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseError `json:"errors"` + Messages []UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseMessage `json:"messages"` + // List of resources that reference a given pool. + Result []UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResult `json:"result"` + ResultInfo UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseSuccess `json:"success"` + JSON userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseJSON `json:"-"` +} + +// userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponse] +type userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseErrorJSON `json:"-"` +} + +// userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseErrorJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseError] +type userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseMessageJSON `json:"-"` +} + +// userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseMessageJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseMessage] +type userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResult struct { + ReferenceType UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceType `json:"reference_type"` + ResourceID string `json:"resource_id"` + ResourceName string `json:"resource_name"` + ResourceType string `json:"resource_type"` + JSON userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultJSON `json:"-"` +} + +// userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResult] +type userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultJSON struct { + ReferenceType apijson.Field + ResourceID apijson.Field + ResourceName apijson.Field + ResourceType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceType string + +const ( + UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceTypeStar UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceType = "*" + UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceTypeReferral UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceType = "referral" + UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceTypeReferrer UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultReferenceType = "referrer" +) + +type UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultInfoJSON `json:"-"` +} + +// userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultInfo] +type userLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseSuccess bool + +const ( + UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseSuccessTrue UserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferencesResponseSuccess = true +) diff --git a/userloadbalancerpoolreference_test.go b/userloadbalancerpoolreference_test.go new file mode 100644 index 00000000000..73a3e6b095e --- /dev/null +++ b/userloadbalancerpoolreference_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerPoolReferenceLoadBalancerPoolsListPoolReferences(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Pools.References.LoadBalancerPoolsListPoolReferences(context.TODO(), "17b5962d775c646f3f9725cbc7a53df4") + 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/userloadbalancerpreview.go b/userloadbalancerpreview.go new file mode 100644 index 00000000000..77405ec442d --- /dev/null +++ b/userloadbalancerpreview.go @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancerPreviewService 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 +// [NewUserLoadBalancerPreviewService] method instead. +type UserLoadBalancerPreviewService struct { + Options []option.RequestOption +} + +// NewUserLoadBalancerPreviewService 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 NewUserLoadBalancerPreviewService(opts ...option.RequestOption) (r *UserLoadBalancerPreviewService) { + r = &UserLoadBalancerPreviewService{} + r.Options = opts + return +} + +// Get the result of a previous preview operation using the provided preview_id. +func (r *UserLoadBalancerPreviewService) Get(ctx context.Context, previewID interface{}, opts ...option.RequestOption) (res *UserLoadBalancerPreviewGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/load_balancers/preview/%v", previewID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserLoadBalancerPreviewGetResponse struct { + Errors []UserLoadBalancerPreviewGetResponseError `json:"errors"` + Messages []UserLoadBalancerPreviewGetResponseMessage `json:"messages"` + // Resulting health data from a preview operation. + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserLoadBalancerPreviewGetResponseSuccess `json:"success"` + JSON userLoadBalancerPreviewGetResponseJSON `json:"-"` +} + +// userLoadBalancerPreviewGetResponseJSON contains the JSON metadata for the struct +// [UserLoadBalancerPreviewGetResponse] +type userLoadBalancerPreviewGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPreviewGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPreviewGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPreviewGetResponseErrorJSON `json:"-"` +} + +// userLoadBalancerPreviewGetResponseErrorJSON contains the JSON metadata for the +// struct [UserLoadBalancerPreviewGetResponseError] +type userLoadBalancerPreviewGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPreviewGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancerPreviewGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancerPreviewGetResponseMessageJSON `json:"-"` +} + +// userLoadBalancerPreviewGetResponseMessageJSON contains the JSON metadata for the +// struct [UserLoadBalancerPreviewGetResponseMessage] +type userLoadBalancerPreviewGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancerPreviewGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancerPreviewGetResponseSuccess bool + +const ( + UserLoadBalancerPreviewGetResponseSuccessTrue UserLoadBalancerPreviewGetResponseSuccess = true +) diff --git a/userloadbalancerpreview_test.go b/userloadbalancerpreview_test.go new file mode 100644 index 00000000000..74d4fa9f5ba --- /dev/null +++ b/userloadbalancerpreview_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancerPreviewGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancers.Previews.Get(context.TODO(), "f1aba936b94213e5b8dca0c0dbf1f9cc") + 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/userloadbalancinganalytic.go b/userloadbalancinganalytic.go new file mode 100644 index 00000000000..ea3787371a9 --- /dev/null +++ b/userloadbalancinganalytic.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancingAnalyticService 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 +// [NewUserLoadBalancingAnalyticService] method instead. +type UserLoadBalancingAnalyticService struct { + Options []option.RequestOption + Events *UserLoadBalancingAnalyticEventService +} + +// NewUserLoadBalancingAnalyticService 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 NewUserLoadBalancingAnalyticService(opts ...option.RequestOption) (r *UserLoadBalancingAnalyticService) { + r = &UserLoadBalancingAnalyticService{} + r.Options = opts + r.Events = NewUserLoadBalancingAnalyticEventService(opts...) + return +} diff --git a/userloadbalancinganalyticevent.go b/userloadbalancinganalyticevent.go new file mode 100644 index 00000000000..a49ae1ab9c8 --- /dev/null +++ b/userloadbalancinganalyticevent.go @@ -0,0 +1,196 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserLoadBalancingAnalyticEventService 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 +// [NewUserLoadBalancingAnalyticEventService] method instead. +type UserLoadBalancingAnalyticEventService struct { + Options []option.RequestOption +} + +// NewUserLoadBalancingAnalyticEventService 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 NewUserLoadBalancingAnalyticEventService(opts ...option.RequestOption) (r *UserLoadBalancingAnalyticEventService) { + r = &UserLoadBalancingAnalyticEventService{} + r.Options = opts + return +} + +// List origin health changes. +func (r *UserLoadBalancingAnalyticEventService) LoadBalancerHealthcheckEventsListHealthcheckEvents(ctx context.Context, query UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsParams, opts ...option.RequestOption) (res *UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/load_balancing_analytics/events" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponse struct { + Errors []UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseError `json:"errors"` + Messages []UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseMessage `json:"messages"` + Result []UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResult `json:"result"` + ResultInfo UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseSuccess `json:"success"` + JSON userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseJSON `json:"-"` +} + +// userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseJSON +// contains the JSON metadata for the struct +// [UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponse] +type userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseErrorJSON `json:"-"` +} + +// userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseErrorJSON +// contains the JSON metadata for the struct +// [UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseError] +type userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseMessageJSON `json:"-"` +} + +// userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseMessageJSON +// contains the JSON metadata for the struct +// [UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseMessage] +type userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResult struct { + ID int64 `json:"id"` + Origins []interface{} `json:"origins"` + Pool interface{} `json:"pool"` + Timestamp time.Time `json:"timestamp" format:"date-time"` + JSON userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultJSON `json:"-"` +} + +// userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultJSON +// contains the JSON metadata for the struct +// [UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResult] +type userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultJSON struct { + ID apijson.Field + Origins apijson.Field + Pool apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultInfoJSON `json:"-"` +} + +// userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultInfo] +type userLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseSuccess bool + +const ( + UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseSuccessTrue UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsResponseSuccess = true +) + +type UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsParams struct { + Identifier param.Field[string] `query:"identifier"` + // If true, filter events where the origin status is healthy. If false, filter + // events where the origin status is unhealthy. + OriginHealthy param.Field[bool] `query:"origin_healthy"` + // The name for the origin to filter. + OriginName param.Field[string] `query:"origin_name"` + // If true, filter events where the pool status is healthy. If false, filter events + // where the pool status is unhealthy. + PoolHealthy param.Field[bool] `query:"pool_healthy"` + // The name for the pool to filter. + PoolName param.Field[string] `query:"pool_name"` + // Start date and time of requesting data period in the ISO8601 format. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // End date and time of requesting data period in the ISO8601 format. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes +// [UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsParams]'s +// query parameters as `url.Values`. +func (r UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/userloadbalancinganalyticevent_test.go b/userloadbalancinganalyticevent_test.go new file mode 100644 index 00000000000..1df6ec8ab32 --- /dev/null +++ b/userloadbalancinganalyticevent_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.LoadBalancingAnalytics.Events.LoadBalancerHealthcheckEventsListHealthcheckEvents(context.TODO(), cloudflare.UserLoadBalancingAnalyticEventLoadBalancerHealthcheckEventsListHealthcheckEventsParams{ + Identifier: cloudflare.F("17b5962d775c646f3f9725cbc7a53df4"), + OriginHealthy: cloudflare.F(true), + OriginName: cloudflare.F("primary-dc-1"), + PoolHealthy: cloudflare.F(true), + PoolName: cloudflare.F("primary-dc"), + Since: cloudflare.F(time.Now()), + Until: cloudflare.F(time.Now()), + }) + 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/userorganization.go b/userorganization.go new file mode 100644 index 00000000000..a19750ee491 --- /dev/null +++ b/userorganization.go @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserOrganizationService 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 [NewUserOrganizationService] method +// instead. +type UserOrganizationService struct { + Options []option.RequestOption +} + +// NewUserOrganizationService 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 NewUserOrganizationService(opts ...option.RequestOption) (r *UserOrganizationService) { + r = &UserOrganizationService{} + r.Options = opts + return +} + +// Gets a specific organization the user is associated with. +func (r *UserOrganizationService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserOrganizationGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/organizations/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Removes association to an organization. +func (r *UserOrganizationService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserOrganizationDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/organizations/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists organizations the user is associated with. +func (r *UserOrganizationService) UserSOrganizationsListOrganizations(ctx context.Context, query UserOrganizationUserSOrganizationsListOrganizationsParams, opts ...option.RequestOption) (res *shared.Page[UserOrganizationUserSOrganizationsListOrganizationsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "user/organizations" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type UserOrganizationGetResponse struct { + Errors []UserOrganizationGetResponseError `json:"errors"` + Messages []UserOrganizationGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserOrganizationGetResponseSuccess `json:"success"` + JSON userOrganizationGetResponseJSON `json:"-"` +} + +// userOrganizationGetResponseJSON contains the JSON metadata for the struct +// [UserOrganizationGetResponse] +type userOrganizationGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserOrganizationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserOrganizationGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userOrganizationGetResponseErrorJSON `json:"-"` +} + +// userOrganizationGetResponseErrorJSON contains the JSON metadata for the struct +// [UserOrganizationGetResponseError] +type userOrganizationGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserOrganizationGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserOrganizationGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userOrganizationGetResponseMessageJSON `json:"-"` +} + +// userOrganizationGetResponseMessageJSON contains the JSON metadata for the struct +// [UserOrganizationGetResponseMessage] +type userOrganizationGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserOrganizationGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserOrganizationGetResponseSuccess bool + +const ( + UserOrganizationGetResponseSuccessTrue UserOrganizationGetResponseSuccess = true +) + +type UserOrganizationDeleteResponse struct { + // Identifier + ID string `json:"id"` + JSON userOrganizationDeleteResponseJSON `json:"-"` +} + +// userOrganizationDeleteResponseJSON contains the JSON metadata for the struct +// [UserOrganizationDeleteResponse] +type userOrganizationDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserOrganizationDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserOrganizationUserSOrganizationsListOrganizationsResponse struct { + // Identifier + ID string `json:"id"` + // Organization name. + Name string `json:"name"` + // Access permissions for this User. + Permissions []string `json:"permissions"` + // List of roles that a user has within an organization. + Roles []string `json:"roles"` + // Whether the user is a member of the organization or has an inivitation pending. + Status UserOrganizationUserSOrganizationsListOrganizationsResponseStatus `json:"status"` + JSON userOrganizationUserSOrganizationsListOrganizationsResponseJSON `json:"-"` +} + +// userOrganizationUserSOrganizationsListOrganizationsResponseJSON contains the +// JSON metadata for the struct +// [UserOrganizationUserSOrganizationsListOrganizationsResponse] +type userOrganizationUserSOrganizationsListOrganizationsResponseJSON struct { + ID apijson.Field + Name apijson.Field + Permissions apijson.Field + Roles apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserOrganizationUserSOrganizationsListOrganizationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the user is a member of the organization or has an inivitation pending. +type UserOrganizationUserSOrganizationsListOrganizationsResponseStatus string + +const ( + UserOrganizationUserSOrganizationsListOrganizationsResponseStatusMember UserOrganizationUserSOrganizationsListOrganizationsResponseStatus = "member" + UserOrganizationUserSOrganizationsListOrganizationsResponseStatusInvited UserOrganizationUserSOrganizationsListOrganizationsResponseStatus = "invited" +) + +type UserOrganizationUserSOrganizationsListOrganizationsParams struct { + // Direction to order organizations. + Direction param.Field[UserOrganizationUserSOrganizationsListOrganizationsParamsDirection] `query:"direction"` + // Whether to match all search requirements or at least one (any). + Match param.Field[UserOrganizationUserSOrganizationsListOrganizationsParamsMatch] `query:"match"` + // Organization name. + Name param.Field[string] `query:"name"` + // Field to order organizations by. + Order param.Field[UserOrganizationUserSOrganizationsListOrganizationsParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of organizations per page. + PerPage param.Field[float64] `query:"per_page"` + // Whether the user is a member of the organization or has an inivitation pending. + Status param.Field[UserOrganizationUserSOrganizationsListOrganizationsParamsStatus] `query:"status"` +} + +// URLQuery serializes +// [UserOrganizationUserSOrganizationsListOrganizationsParams]'s query parameters +// as `url.Values`. +func (r UserOrganizationUserSOrganizationsListOrganizationsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order organizations. +type UserOrganizationUserSOrganizationsListOrganizationsParamsDirection string + +const ( + UserOrganizationUserSOrganizationsListOrganizationsParamsDirectionAsc UserOrganizationUserSOrganizationsListOrganizationsParamsDirection = "asc" + UserOrganizationUserSOrganizationsListOrganizationsParamsDirectionDesc UserOrganizationUserSOrganizationsListOrganizationsParamsDirection = "desc" +) + +// Whether to match all search requirements or at least one (any). +type UserOrganizationUserSOrganizationsListOrganizationsParamsMatch string + +const ( + UserOrganizationUserSOrganizationsListOrganizationsParamsMatchAny UserOrganizationUserSOrganizationsListOrganizationsParamsMatch = "any" + UserOrganizationUserSOrganizationsListOrganizationsParamsMatchAll UserOrganizationUserSOrganizationsListOrganizationsParamsMatch = "all" +) + +// Field to order organizations by. +type UserOrganizationUserSOrganizationsListOrganizationsParamsOrder string + +const ( + UserOrganizationUserSOrganizationsListOrganizationsParamsOrderID UserOrganizationUserSOrganizationsListOrganizationsParamsOrder = "id" + UserOrganizationUserSOrganizationsListOrganizationsParamsOrderName UserOrganizationUserSOrganizationsListOrganizationsParamsOrder = "name" + UserOrganizationUserSOrganizationsListOrganizationsParamsOrderStatus UserOrganizationUserSOrganizationsListOrganizationsParamsOrder = "status" +) + +// Whether the user is a member of the organization or has an inivitation pending. +type UserOrganizationUserSOrganizationsListOrganizationsParamsStatus string + +const ( + UserOrganizationUserSOrganizationsListOrganizationsParamsStatusMember UserOrganizationUserSOrganizationsListOrganizationsParamsStatus = "member" + UserOrganizationUserSOrganizationsListOrganizationsParamsStatusInvited UserOrganizationUserSOrganizationsListOrganizationsParamsStatus = "invited" +) diff --git a/userorganization_test.go b/userorganization_test.go new file mode 100644 index 00000000000..b7b0822438c --- /dev/null +++ b/userorganization_test.go @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserOrganizationGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Organizations.Get(context.TODO(), "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()) + } +} + +func TestUserOrganizationDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Organizations.Delete(context.TODO(), "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()) + } +} + +func TestUserOrganizationUserSOrganizationsListOrganizationsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Organizations.UserSOrganizationsListOrganizations(context.TODO(), cloudflare.UserOrganizationUserSOrganizationsListOrganizationsParams{ + Direction: cloudflare.F(cloudflare.UserOrganizationUserSOrganizationsListOrganizationsParamsDirectionDesc), + Match: cloudflare.F(cloudflare.UserOrganizationUserSOrganizationsListOrganizationsParamsMatchAny), + Name: cloudflare.F("Cloudflare, Inc."), + Order: cloudflare.F(cloudflare.UserOrganizationUserSOrganizationsListOrganizationsParamsOrderStatus), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Status: cloudflare.F(cloudflare.UserOrganizationUserSOrganizationsListOrganizationsParamsStatusMember), + }) + 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/usersubscription.go b/usersubscription.go new file mode 100644 index 00000000000..539b137afe7 --- /dev/null +++ b/usersubscription.go @@ -0,0 +1,508 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserSubscriptionService 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 [NewUserSubscriptionService] method +// instead. +type UserSubscriptionService struct { + Options []option.RequestOption +} + +// NewUserSubscriptionService 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 NewUserSubscriptionService(opts ...option.RequestOption) (r *UserSubscriptionService) { + r = &UserSubscriptionService{} + r.Options = opts + return +} + +// Updates a user's subscriptions. +func (r *UserSubscriptionService) Update(ctx context.Context, identifier string, body UserSubscriptionUpdateParams, opts ...option.RequestOption) (res *UserSubscriptionUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/subscriptions/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a user's subscription. +func (r *UserSubscriptionService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserSubscriptionDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/subscriptions/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists all of a user's subscriptions. +func (r *UserSubscriptionService) UserSubscriptionGetUserSubscriptions(ctx context.Context, opts ...option.RequestOption) (res *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/subscriptions" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserSubscriptionUpdateResponse struct { + Errors []UserSubscriptionUpdateResponseError `json:"errors"` + Messages []UserSubscriptionUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserSubscriptionUpdateResponseSuccess `json:"success"` + JSON userSubscriptionUpdateResponseJSON `json:"-"` +} + +// userSubscriptionUpdateResponseJSON contains the JSON metadata for the struct +// [UserSubscriptionUpdateResponse] +type userSubscriptionUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userSubscriptionUpdateResponseErrorJSON `json:"-"` +} + +// userSubscriptionUpdateResponseErrorJSON contains the JSON metadata for the +// struct [UserSubscriptionUpdateResponseError] +type userSubscriptionUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userSubscriptionUpdateResponseMessageJSON `json:"-"` +} + +// userSubscriptionUpdateResponseMessageJSON contains the JSON metadata for the +// struct [UserSubscriptionUpdateResponseMessage] +type userSubscriptionUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserSubscriptionUpdateResponseSuccess bool + +const ( + UserSubscriptionUpdateResponseSuccessTrue UserSubscriptionUpdateResponseSuccess = true +) + +type UserSubscriptionDeleteResponse struct { + // Subscription identifier tag. + SubscriptionID string `json:"subscription_id"` + JSON userSubscriptionDeleteResponseJSON `json:"-"` +} + +// userSubscriptionDeleteResponseJSON contains the JSON metadata for the struct +// [UserSubscriptionDeleteResponse] +type userSubscriptionDeleteResponseJSON struct { + SubscriptionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponse struct { + Errors []UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseError `json:"errors"` + Messages []UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseMessage `json:"messages"` + Result []UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResult `json:"result"` + ResultInfo UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseSuccess `json:"success"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseJSON contains the +// JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponse] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseErrorJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseErrorJSON contains +// the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseError] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseMessageJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseMessageJSON contains +// the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseMessage] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResult struct { + // Subscription identifier tag. + ID string `json:"id"` + App UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultApp `json:"app"` + // The list of add-ons subscribed to. + ComponentValues []UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultComponentValue `json:"component_values"` + // The monetary unit in which pricing information is displayed. + Currency string `json:"currency"` + // The end of the current period and also when the next billing is due. + CurrentPeriodEnd time.Time `json:"current_period_end" format:"date-time"` + // When the current billing period started. May match initial_period_start if this + // is the first period. + CurrentPeriodStart time.Time `json:"current_period_start" format:"date-time"` + // How often the subscription is renewed automatically. + Frequency UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequency `json:"frequency"` + // The price of the subscription that will be billed, in US dollars. + Price float64 `json:"price"` + // The rate plan applied to the subscription. + RatePlan UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultRatePlan `json:"rate_plan"` + // The state that the subscription is in. + State UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState `json:"state"` + // A simple zone object. May have null properties if not a zone subscription. + Zone UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultZone `json:"zone"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultJSON contains +// the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResult] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultJSON struct { + ID apijson.Field + App apijson.Field + ComponentValues apijson.Field + Currency apijson.Field + CurrentPeriodEnd apijson.Field + CurrentPeriodStart apijson.Field + Frequency apijson.Field + Price apijson.Field + RatePlan apijson.Field + State apijson.Field + Zone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultApp struct { + // app install id. + InstallID string `json:"install_id"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultAppJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultAppJSON +// contains the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultApp] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultAppJSON struct { + InstallID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultApp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A component value for a subscription. +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultComponentValue struct { + // The default amount assigned. + Default float64 `json:"default"` + // The name of the component value. + Name string `json:"name"` + // The unit price for the component value. + Price float64 `json:"price"` + // The amount of the component value assigned. + Value float64 `json:"value"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultComponentValueJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultComponentValueJSON +// contains the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultComponentValue] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultComponentValueJSON struct { + Default apijson.Field + Name apijson.Field + Price apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultComponentValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How often the subscription is renewed automatically. +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequency string + +const ( + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequencyWeekly UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequency = "weekly" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequencyMonthly UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequency = "monthly" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequencyQuarterly UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequency = "quarterly" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequencyYearly UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultFrequency = "yearly" +) + +// The rate plan applied to the subscription. +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultRatePlan struct { + // The ID of the rate plan. + ID interface{} `json:"id"` + // The currency applied to the rate plan subscription. + Currency string `json:"currency"` + // Whether this rate plan is managed externally from Cloudflare. + ExternallyManaged bool `json:"externally_managed"` + // Whether a rate plan is enterprise-based (or newly adopted term contract). + IsContract bool `json:"is_contract"` + // The full name of the rate plan. + PublicName string `json:"public_name"` + // The scope that this rate plan applies to. + Scope string `json:"scope"` + // The list of sets this rate plan applies to. + Sets []string `json:"sets"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultRatePlanJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultRatePlanJSON +// contains the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultRatePlan] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultRatePlanJSON struct { + ID apijson.Field + Currency apijson.Field + ExternallyManaged apijson.Field + IsContract apijson.Field + PublicName apijson.Field + Scope apijson.Field + Sets apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultRatePlan) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The state that the subscription is in. +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState string + +const ( + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultStateTrial UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState = "Trial" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultStateProvisioned UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState = "Provisioned" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultStatePaid UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState = "Paid" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultStateAwaitingPayment UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState = "AwaitingPayment" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultStateCancelled UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState = "Cancelled" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultStateFailed UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState = "Failed" + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultStateExpired UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultState = "Expired" +) + +// A simple zone object. May have null properties if not a zone subscription. +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultZone struct { + // Identifier + ID string `json:"id"` + // The domain name + Name string `json:"name"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultZoneJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultZoneJSON +// contains the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultZone] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultZoneJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultZone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultInfoJSON `json:"-"` +} + +// userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultInfo] +type userSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseSuccess bool + +const ( + UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseSuccessTrue UserSubscriptionUserSubscriptionGetUserSubscriptionsResponseSuccess = true +) + +type UserSubscriptionUpdateParams struct { + App param.Field[UserSubscriptionUpdateParamsApp] `json:"app"` + // The list of add-ons subscribed to. + ComponentValues param.Field[[]UserSubscriptionUpdateParamsComponentValue] `json:"component_values"` + // How often the subscription is renewed automatically. + Frequency param.Field[UserSubscriptionUpdateParamsFrequency] `json:"frequency"` + // The rate plan applied to the subscription. + RatePlan param.Field[UserSubscriptionUpdateParamsRatePlan] `json:"rate_plan"` + // A simple zone object. May have null properties if not a zone subscription. + Zone param.Field[UserSubscriptionUpdateParamsZone] `json:"zone"` +} + +func (r UserSubscriptionUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserSubscriptionUpdateParamsApp struct { + // app install id. + InstallID param.Field[string] `json:"install_id"` +} + +func (r UserSubscriptionUpdateParamsApp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A component value for a subscription. +type UserSubscriptionUpdateParamsComponentValue struct { + // The default amount assigned. + Default param.Field[float64] `json:"default"` + // The name of the component value. + Name param.Field[string] `json:"name"` + // The unit price for the component value. + Price param.Field[float64] `json:"price"` + // The amount of the component value assigned. + Value param.Field[float64] `json:"value"` +} + +func (r UserSubscriptionUpdateParamsComponentValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// How often the subscription is renewed automatically. +type UserSubscriptionUpdateParamsFrequency string + +const ( + UserSubscriptionUpdateParamsFrequencyWeekly UserSubscriptionUpdateParamsFrequency = "weekly" + UserSubscriptionUpdateParamsFrequencyMonthly UserSubscriptionUpdateParamsFrequency = "monthly" + UserSubscriptionUpdateParamsFrequencyQuarterly UserSubscriptionUpdateParamsFrequency = "quarterly" + UserSubscriptionUpdateParamsFrequencyYearly UserSubscriptionUpdateParamsFrequency = "yearly" +) + +// The rate plan applied to the subscription. +type UserSubscriptionUpdateParamsRatePlan struct { + // The ID of the rate plan. + ID param.Field[interface{}] `json:"id"` + // The currency applied to the rate plan subscription. + Currency param.Field[string] `json:"currency"` + // Whether this rate plan is managed externally from Cloudflare. + ExternallyManaged param.Field[bool] `json:"externally_managed"` + // Whether a rate plan is enterprise-based (or newly adopted term contract). + IsContract param.Field[bool] `json:"is_contract"` + // The full name of the rate plan. + PublicName param.Field[string] `json:"public_name"` + // The scope that this rate plan applies to. + Scope param.Field[string] `json:"scope"` + // The list of sets this rate plan applies to. + Sets param.Field[[]string] `json:"sets"` +} + +func (r UserSubscriptionUpdateParamsRatePlan) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A simple zone object. May have null properties if not a zone subscription. +type UserSubscriptionUpdateParamsZone struct { +} + +func (r UserSubscriptionUpdateParamsZone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/usersubscription_test.go b/usersubscription_test.go new file mode 100644 index 00000000000..749a4068fe5 --- /dev/null +++ b/usersubscription_test.go @@ -0,0 +1,127 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserSubscriptionUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Subscriptions.Update( + context.TODO(), + "506e3185e9c882d175a2d0cb0093d9f2", + cloudflare.UserSubscriptionUpdateParams{ + App: cloudflare.F(cloudflare.UserSubscriptionUpdateParamsApp{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]cloudflare.UserSubscriptionUpdateParamsComponentValue{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(cloudflare.UserSubscriptionUpdateParamsFrequencyMonthly), + RatePlan: cloudflare.F(cloudflare.UserSubscriptionUpdateParamsRatePlan{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F[any]("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(cloudflare.UserSubscriptionUpdateParamsZone{}), + }, + ) + 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 TestUserSubscriptionDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Subscriptions.Delete(context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2") + 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 TestUserSubscriptionUserSubscriptionGetUserSubscriptions(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Subscriptions.UserSubscriptionGetUserSubscriptions(context.TODO()) + 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/usertoken.go b/usertoken.go new file mode 100644 index 00000000000..7aa87d1889c --- /dev/null +++ b/usertoken.go @@ -0,0 +1,578 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserTokenService 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 [NewUserTokenService] method instead. +type UserTokenService struct { + Options []option.RequestOption + PermissionGroups *UserTokenPermissionGroupService + Verifies *UserTokenVerifyService + Values *UserTokenValueService +} + +// NewUserTokenService 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 NewUserTokenService(opts ...option.RequestOption) (r *UserTokenService) { + r = &UserTokenService{} + r.Options = opts + r.PermissionGroups = NewUserTokenPermissionGroupService(opts...) + r.Verifies = NewUserTokenVerifyService(opts...) + r.Values = NewUserTokenValueService(opts...) + return +} + +// Get information about a specific token. +func (r *UserTokenService) Get(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *UserTokenGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/tokens/%v", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update an existing token. +func (r *UserTokenService) Update(ctx context.Context, identifier interface{}, body UserTokenUpdateParams, opts ...option.RequestOption) (res *UserTokenUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/tokens/%v", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Destroy a token. +func (r *UserTokenService) Delete(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *UserTokenDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/tokens/%v", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new access token. +func (r *UserTokenService) UserAPITokensNewToken(ctx context.Context, body UserTokenUserAPITokensNewTokenParams, opts ...option.RequestOption) (res *UserTokenUserAPITokensNewTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/tokens" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all access tokens you created. +func (r *UserTokenService) UserAPITokensListTokens(ctx context.Context, query UserTokenUserAPITokensListTokensParams, opts ...option.RequestOption) (res *shared.Page[UserTokenUserAPITokensListTokensResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "user/tokens" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type UserTokenGetResponse struct { + Errors []UserTokenGetResponseError `json:"errors"` + Messages []UserTokenGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserTokenGetResponseSuccess `json:"success"` + JSON userTokenGetResponseJSON `json:"-"` +} + +// userTokenGetResponseJSON contains the JSON metadata for the struct +// [UserTokenGetResponse] +type userTokenGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenGetResponseErrorJSON `json:"-"` +} + +// userTokenGetResponseErrorJSON contains the JSON metadata for the struct +// [UserTokenGetResponseError] +type userTokenGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenGetResponseMessageJSON `json:"-"` +} + +// userTokenGetResponseMessageJSON contains the JSON metadata for the struct +// [UserTokenGetResponseMessage] +type userTokenGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserTokenGetResponseSuccess bool + +const ( + UserTokenGetResponseSuccessTrue UserTokenGetResponseSuccess = true +) + +type UserTokenUpdateResponse struct { + Errors []UserTokenUpdateResponseError `json:"errors"` + Messages []UserTokenUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success UserTokenUpdateResponseSuccess `json:"success"` + JSON userTokenUpdateResponseJSON `json:"-"` +} + +// userTokenUpdateResponseJSON contains the JSON metadata for the struct +// [UserTokenUpdateResponse] +type userTokenUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenUpdateResponseErrorJSON `json:"-"` +} + +// userTokenUpdateResponseErrorJSON contains the JSON metadata for the struct +// [UserTokenUpdateResponseError] +type userTokenUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenUpdateResponseMessageJSON `json:"-"` +} + +// userTokenUpdateResponseMessageJSON contains the JSON metadata for the struct +// [UserTokenUpdateResponseMessage] +type userTokenUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserTokenUpdateResponseSuccess bool + +const ( + UserTokenUpdateResponseSuccessTrue UserTokenUpdateResponseSuccess = true +) + +type UserTokenDeleteResponse struct { + Errors []UserTokenDeleteResponseError `json:"errors"` + Messages []UserTokenDeleteResponseMessage `json:"messages"` + Result UserTokenDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success UserTokenDeleteResponseSuccess `json:"success"` + JSON userTokenDeleteResponseJSON `json:"-"` +} + +// userTokenDeleteResponseJSON contains the JSON metadata for the struct +// [UserTokenDeleteResponse] +type userTokenDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenDeleteResponseErrorJSON `json:"-"` +} + +// userTokenDeleteResponseErrorJSON contains the JSON metadata for the struct +// [UserTokenDeleteResponseError] +type userTokenDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenDeleteResponseMessageJSON `json:"-"` +} + +// userTokenDeleteResponseMessageJSON contains the JSON metadata for the struct +// [UserTokenDeleteResponseMessage] +type userTokenDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON userTokenDeleteResponseResultJSON `json:"-"` +} + +// userTokenDeleteResponseResultJSON contains the JSON metadata for the struct +// [UserTokenDeleteResponseResult] +type userTokenDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserTokenDeleteResponseSuccess bool + +const ( + UserTokenDeleteResponseSuccessTrue UserTokenDeleteResponseSuccess = true +) + +type UserTokenUserAPITokensNewTokenResponse struct { + Errors []UserTokenUserAPITokensNewTokenResponseError `json:"errors"` + Messages []UserTokenUserAPITokensNewTokenResponseMessage `json:"messages"` + Result UserTokenUserAPITokensNewTokenResponseResult `json:"result"` + // Whether the API call was successful + Success UserTokenUserAPITokensNewTokenResponseSuccess `json:"success"` + JSON userTokenUserAPITokensNewTokenResponseJSON `json:"-"` +} + +// userTokenUserAPITokensNewTokenResponseJSON contains the JSON metadata for the +// struct [UserTokenUserAPITokensNewTokenResponse] +type userTokenUserAPITokensNewTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenUserAPITokensNewTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenUserAPITokensNewTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenUserAPITokensNewTokenResponseErrorJSON `json:"-"` +} + +// userTokenUserAPITokensNewTokenResponseErrorJSON contains the JSON metadata for +// the struct [UserTokenUserAPITokensNewTokenResponseError] +type userTokenUserAPITokensNewTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenUserAPITokensNewTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenUserAPITokensNewTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenUserAPITokensNewTokenResponseMessageJSON `json:"-"` +} + +// userTokenUserAPITokensNewTokenResponseMessageJSON contains the JSON metadata for +// the struct [UserTokenUserAPITokensNewTokenResponseMessage] +type userTokenUserAPITokensNewTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenUserAPITokensNewTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenUserAPITokensNewTokenResponseResult struct { + // The token value. + Value string `json:"value"` + JSON userTokenUserAPITokensNewTokenResponseResultJSON `json:"-"` +} + +// userTokenUserAPITokensNewTokenResponseResultJSON contains the JSON metadata for +// the struct [UserTokenUserAPITokensNewTokenResponseResult] +type userTokenUserAPITokensNewTokenResponseResultJSON struct { + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenUserAPITokensNewTokenResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserTokenUserAPITokensNewTokenResponseSuccess bool + +const ( + UserTokenUserAPITokensNewTokenResponseSuccessTrue UserTokenUserAPITokensNewTokenResponseSuccess = true +) + +type UserTokenUserAPITokensListTokensResponse = interface{} + +type UserTokenUpdateParams struct { + // Token name. + Name param.Field[string] `json:"name,required"` + // List of access policies assigned to the token. + Policies param.Field[[]UserTokenUpdateParamsPolicy] `json:"policies,required"` + // Status of the token. + Status param.Field[UserTokenUpdateParamsStatus] `json:"status,required"` + Condition param.Field[UserTokenUpdateParamsCondition] `json:"condition"` + // The expiration time on or after which the JWT MUST NOT be accepted for + // processing. + ExpiresOn param.Field[time.Time] `json:"expires_on" format:"date-time"` + // The time before which the token MUST NOT be accepted for processing. + NotBefore param.Field[time.Time] `json:"not_before" format:"date-time"` +} + +func (r UserTokenUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserTokenUpdateParamsPolicy struct { + // Allow or deny operations against the resources. + Effect param.Field[UserTokenUpdateParamsPoliciesEffect] `json:"effect,required"` + // A set of permission groups that are specified to the policy. + PermissionGroups param.Field[[]UserTokenUpdateParamsPoliciesPermissionGroup] `json:"permission_groups,required"` + // A list of resource names that the policy applies to. + Resources param.Field[interface{}] `json:"resources,required"` +} + +func (r UserTokenUpdateParamsPolicy) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Allow or deny operations against the resources. +type UserTokenUpdateParamsPoliciesEffect string + +const ( + UserTokenUpdateParamsPoliciesEffectAllow UserTokenUpdateParamsPoliciesEffect = "allow" + UserTokenUpdateParamsPoliciesEffectDeny UserTokenUpdateParamsPoliciesEffect = "deny" +) + +// A named group of permissions that map to a group of operations against +// resources. +type UserTokenUpdateParamsPoliciesPermissionGroup struct { +} + +func (r UserTokenUpdateParamsPoliciesPermissionGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Status of the token. +type UserTokenUpdateParamsStatus string + +const ( + UserTokenUpdateParamsStatusActive UserTokenUpdateParamsStatus = "active" + UserTokenUpdateParamsStatusDisabled UserTokenUpdateParamsStatus = "disabled" + UserTokenUpdateParamsStatusExpired UserTokenUpdateParamsStatus = "expired" +) + +type UserTokenUpdateParamsCondition struct { + // Client IP restrictions. + RequestIP param.Field[UserTokenUpdateParamsConditionRequestIP] `json:"request.ip"` +} + +func (r UserTokenUpdateParamsCondition) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Client IP restrictions. +type UserTokenUpdateParamsConditionRequestIP struct { + // List of IPv4/IPv6 CIDR addresses. + In param.Field[[]string] `json:"in"` + // List of IPv4/IPv6 CIDR addresses. + NotIn param.Field[[]string] `json:"not_in"` +} + +func (r UserTokenUpdateParamsConditionRequestIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserTokenUserAPITokensNewTokenParams struct { + // Token name. + Name param.Field[string] `json:"name,required"` + // List of access policies assigned to the token. + Policies param.Field[[]UserTokenUserAPITokensNewTokenParamsPolicy] `json:"policies,required"` + Condition param.Field[UserTokenUserAPITokensNewTokenParamsCondition] `json:"condition"` + // The expiration time on or after which the JWT MUST NOT be accepted for + // processing. + ExpiresOn param.Field[time.Time] `json:"expires_on" format:"date-time"` + // The time before which the token MUST NOT be accepted for processing. + NotBefore param.Field[time.Time] `json:"not_before" format:"date-time"` +} + +func (r UserTokenUserAPITokensNewTokenParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserTokenUserAPITokensNewTokenParamsPolicy struct { + // Allow or deny operations against the resources. + Effect param.Field[UserTokenUserAPITokensNewTokenParamsPoliciesEffect] `json:"effect,required"` + // A set of permission groups that are specified to the policy. + PermissionGroups param.Field[[]UserTokenUserAPITokensNewTokenParamsPoliciesPermissionGroup] `json:"permission_groups,required"` + // A list of resource names that the policy applies to. + Resources param.Field[interface{}] `json:"resources,required"` +} + +func (r UserTokenUserAPITokensNewTokenParamsPolicy) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Allow or deny operations against the resources. +type UserTokenUserAPITokensNewTokenParamsPoliciesEffect string + +const ( + UserTokenUserAPITokensNewTokenParamsPoliciesEffectAllow UserTokenUserAPITokensNewTokenParamsPoliciesEffect = "allow" + UserTokenUserAPITokensNewTokenParamsPoliciesEffectDeny UserTokenUserAPITokensNewTokenParamsPoliciesEffect = "deny" +) + +// A named group of permissions that map to a group of operations against +// resources. +type UserTokenUserAPITokensNewTokenParamsPoliciesPermissionGroup struct { +} + +func (r UserTokenUserAPITokensNewTokenParamsPoliciesPermissionGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserTokenUserAPITokensNewTokenParamsCondition struct { + // Client IP restrictions. + RequestIP param.Field[UserTokenUserAPITokensNewTokenParamsConditionRequestIP] `json:"request.ip"` +} + +func (r UserTokenUserAPITokensNewTokenParamsCondition) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Client IP restrictions. +type UserTokenUserAPITokensNewTokenParamsConditionRequestIP struct { + // List of IPv4/IPv6 CIDR addresses. + In param.Field[[]string] `json:"in"` + // List of IPv4/IPv6 CIDR addresses. + NotIn param.Field[[]string] `json:"not_in"` +} + +func (r UserTokenUserAPITokensNewTokenParamsConditionRequestIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type UserTokenUserAPITokensListTokensParams struct { + // Direction to order results. + Direction param.Field[UserTokenUserAPITokensListTokensParamsDirection] `query:"direction"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [UserTokenUserAPITokensListTokensParams]'s query parameters +// as `url.Values`. +func (r UserTokenUserAPITokensListTokensParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order results. +type UserTokenUserAPITokensListTokensParamsDirection string + +const ( + UserTokenUserAPITokensListTokensParamsDirectionAsc UserTokenUserAPITokensListTokensParamsDirection = "asc" + UserTokenUserAPITokensListTokensParamsDirectionDesc UserTokenUserAPITokensListTokensParamsDirection = "desc" +) diff --git a/usertoken_test.go b/usertoken_test.go new file mode 100644 index 00000000000..3cf11db523b --- /dev/null +++ b/usertoken_test.go @@ -0,0 +1,218 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserTokenGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.Get(context.TODO(), map[string]interface{}{}) + 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 TestUserTokenUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.Update( + context.TODO(), + map[string]interface{}{}, + cloudflare.UserTokenUpdateParams{ + Name: cloudflare.F("readonly token"), + Policies: cloudflare.F([]cloudflare.UserTokenUpdateParamsPolicy{{ + Effect: cloudflare.F(cloudflare.UserTokenUpdateParamsPoliciesEffectAllow), + PermissionGroups: cloudflare.F([]cloudflare.UserTokenUpdateParamsPoliciesPermissionGroup{{}, {}}), + Resources: cloudflare.F[any](map[string]interface{}{ + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }), + }, { + Effect: cloudflare.F(cloudflare.UserTokenUpdateParamsPoliciesEffectAllow), + PermissionGroups: cloudflare.F([]cloudflare.UserTokenUpdateParamsPoliciesPermissionGroup{{}, {}}), + Resources: cloudflare.F[any](map[string]interface{}{ + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }), + }, { + Effect: cloudflare.F(cloudflare.UserTokenUpdateParamsPoliciesEffectAllow), + PermissionGroups: cloudflare.F([]cloudflare.UserTokenUpdateParamsPoliciesPermissionGroup{{}, {}}), + Resources: cloudflare.F[any](map[string]interface{}{ + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }), + }}), + Status: cloudflare.F(cloudflare.UserTokenUpdateParamsStatusActive), + Condition: cloudflare.F(cloudflare.UserTokenUpdateParamsCondition{ + RequestIP: cloudflare.F(cloudflare.UserTokenUpdateParamsConditionRequestIP{ + In: cloudflare.F([]string{"123.123.123.0/24", "2606:4700::/32"}), + NotIn: cloudflare.F([]string{"123.123.123.100/24", "2606:4700:4700::/48"}), + }), + }), + ExpiresOn: cloudflare.F(time.Now()), + NotBefore: cloudflare.F(time.Now()), + }, + ) + 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 TestUserTokenDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.Delete(context.TODO(), map[string]interface{}{}) + 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 TestUserTokenUserAPITokensNewTokenWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.UserAPITokensNewToken(context.TODO(), cloudflare.UserTokenUserAPITokensNewTokenParams{ + Name: cloudflare.F("readonly token"), + Policies: cloudflare.F([]cloudflare.UserTokenUserAPITokensNewTokenParamsPolicy{{ + Effect: cloudflare.F(cloudflare.UserTokenUserAPITokensNewTokenParamsPoliciesEffectAllow), + PermissionGroups: cloudflare.F([]cloudflare.UserTokenUserAPITokensNewTokenParamsPoliciesPermissionGroup{{}, {}}), + Resources: cloudflare.F[any](map[string]interface{}{ + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }), + }, { + Effect: cloudflare.F(cloudflare.UserTokenUserAPITokensNewTokenParamsPoliciesEffectAllow), + PermissionGroups: cloudflare.F([]cloudflare.UserTokenUserAPITokensNewTokenParamsPoliciesPermissionGroup{{}, {}}), + Resources: cloudflare.F[any](map[string]interface{}{ + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }), + }, { + Effect: cloudflare.F(cloudflare.UserTokenUserAPITokensNewTokenParamsPoliciesEffectAllow), + PermissionGroups: cloudflare.F([]cloudflare.UserTokenUserAPITokensNewTokenParamsPoliciesPermissionGroup{{}, {}}), + Resources: cloudflare.F[any](map[string]interface{}{ + "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", + "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", + }), + }}), + Condition: cloudflare.F(cloudflare.UserTokenUserAPITokensNewTokenParamsCondition{ + RequestIP: cloudflare.F(cloudflare.UserTokenUserAPITokensNewTokenParamsConditionRequestIP{ + In: cloudflare.F([]string{"123.123.123.0/24", "2606:4700::/32"}), + NotIn: cloudflare.F([]string{"123.123.123.100/24", "2606:4700:4700::/48"}), + }), + }), + ExpiresOn: cloudflare.F(time.Now()), + NotBefore: cloudflare.F(time.Now()), + }) + 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 TestUserTokenUserAPITokensListTokensWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.UserAPITokensListTokens(context.TODO(), cloudflare.UserTokenUserAPITokensListTokensParams{ + Direction: cloudflare.F(cloudflare.UserTokenUserAPITokensListTokensParamsDirectionDesc), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }) + 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/usertokenpermissiongroup.go b/usertokenpermissiongroup.go new file mode 100644 index 00000000000..8a80bf766e6 --- /dev/null +++ b/usertokenpermissiongroup.go @@ -0,0 +1,140 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserTokenPermissionGroupService 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 +// [NewUserTokenPermissionGroupService] method instead. +type UserTokenPermissionGroupService struct { + Options []option.RequestOption +} + +// NewUserTokenPermissionGroupService 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 NewUserTokenPermissionGroupService(opts ...option.RequestOption) (r *UserTokenPermissionGroupService) { + r = &UserTokenPermissionGroupService{} + r.Options = opts + return +} + +// Find all available permission groups. +func (r *UserTokenPermissionGroupService) PermissionGroupsListPermissionGroups(ctx context.Context, opts ...option.RequestOption) (res *UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/tokens/permission_groups" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponse struct { + Errors []UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseError `json:"errors"` + Messages []UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseSuccess `json:"success"` + JSON userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseJSON `json:"-"` +} + +// userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseJSON +// contains the JSON metadata for the struct +// [UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponse] +type userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseErrorJSON `json:"-"` +} + +// userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseErrorJSON +// contains the JSON metadata for the struct +// [UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseError] +type userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseMessageJSON `json:"-"` +} + +// userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseMessageJSON +// contains the JSON metadata for the struct +// [UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseMessage] +type userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseResultInfoJSON `json:"-"` +} + +// userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseResultInfo] +type userTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseSuccess bool + +const ( + UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseSuccessTrue UserTokenPermissionGroupPermissionGroupsListPermissionGroupsResponseSuccess = true +) diff --git a/usertokenpermissiongroup_test.go b/usertokenpermissiongroup_test.go new file mode 100644 index 00000000000..dd213b9dcfa --- /dev/null +++ b/usertokenpermissiongroup_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserTokenPermissionGroupPermissionGroupsListPermissionGroups(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.PermissionGroups.PermissionGroupsListPermissionGroups(context.TODO()) + 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/usertokenvalue.go b/usertokenvalue.go new file mode 100644 index 00000000000..d8f88f19b66 --- /dev/null +++ b/usertokenvalue.go @@ -0,0 +1,118 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserTokenValueService 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 [NewUserTokenValueService] method +// instead. +type UserTokenValueService struct { + Options []option.RequestOption +} + +// NewUserTokenValueService 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 NewUserTokenValueService(opts ...option.RequestOption) (r *UserTokenValueService) { + r = &UserTokenValueService{} + r.Options = opts + return +} + +// Roll the token secret. +func (r *UserTokenValueService) UserAPITokensRollToken(ctx context.Context, identifier interface{}, body UserTokenValueUserAPITokensRollTokenParams, opts ...option.RequestOption) (res *UserTokenValueUserAPITokensRollTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("user/tokens/%v/value", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type UserTokenValueUserAPITokensRollTokenResponse struct { + Errors []UserTokenValueUserAPITokensRollTokenResponseError `json:"errors"` + Messages []UserTokenValueUserAPITokensRollTokenResponseMessage `json:"messages"` + // The token value. + Result string `json:"result"` + // Whether the API call was successful + Success UserTokenValueUserAPITokensRollTokenResponseSuccess `json:"success"` + JSON userTokenValueUserAPITokensRollTokenResponseJSON `json:"-"` +} + +// userTokenValueUserAPITokensRollTokenResponseJSON contains the JSON metadata for +// the struct [UserTokenValueUserAPITokensRollTokenResponse] +type userTokenValueUserAPITokensRollTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenValueUserAPITokensRollTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenValueUserAPITokensRollTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenValueUserAPITokensRollTokenResponseErrorJSON `json:"-"` +} + +// userTokenValueUserAPITokensRollTokenResponseErrorJSON contains the JSON metadata +// for the struct [UserTokenValueUserAPITokensRollTokenResponseError] +type userTokenValueUserAPITokensRollTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenValueUserAPITokensRollTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenValueUserAPITokensRollTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenValueUserAPITokensRollTokenResponseMessageJSON `json:"-"` +} + +// userTokenValueUserAPITokensRollTokenResponseMessageJSON contains the JSON +// metadata for the struct [UserTokenValueUserAPITokensRollTokenResponseMessage] +type userTokenValueUserAPITokensRollTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenValueUserAPITokensRollTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserTokenValueUserAPITokensRollTokenResponseSuccess bool + +const ( + UserTokenValueUserAPITokensRollTokenResponseSuccessTrue UserTokenValueUserAPITokensRollTokenResponseSuccess = true +) + +type UserTokenValueUserAPITokensRollTokenParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r UserTokenValueUserAPITokensRollTokenParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/usertokenvalue_test.go b/usertokenvalue_test.go new file mode 100644 index 00000000000..d578e27c374 --- /dev/null +++ b/usertokenvalue_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserTokenValueUserAPITokensRollToken(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.Values.UserAPITokensRollToken( + context.TODO(), + map[string]interface{}{}, + cloudflare.UserTokenValueUserAPITokensRollTokenParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/usertokenverify.go b/usertokenverify.go new file mode 100644 index 00000000000..d247fe0e798 --- /dev/null +++ b/usertokenverify.go @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// UserTokenVerifyService 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 [NewUserTokenVerifyService] method +// instead. +type UserTokenVerifyService struct { + Options []option.RequestOption +} + +// NewUserTokenVerifyService 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 NewUserTokenVerifyService(opts ...option.RequestOption) (r *UserTokenVerifyService) { + r = &UserTokenVerifyService{} + r.Options = opts + return +} + +// Test whether a token works. +func (r *UserTokenVerifyService) UserAPITokensVerifyToken(ctx context.Context, opts ...option.RequestOption) (res *UserTokenVerifyUserAPITokensVerifyTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := "user/tokens/verify" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type UserTokenVerifyUserAPITokensVerifyTokenResponse struct { + Errors []UserTokenVerifyUserAPITokensVerifyTokenResponseError `json:"errors"` + Messages []UserTokenVerifyUserAPITokensVerifyTokenResponseMessage `json:"messages"` + Result UserTokenVerifyUserAPITokensVerifyTokenResponseResult `json:"result"` + // Whether the API call was successful + Success UserTokenVerifyUserAPITokensVerifyTokenResponseSuccess `json:"success"` + JSON userTokenVerifyUserAPITokensVerifyTokenResponseJSON `json:"-"` +} + +// userTokenVerifyUserAPITokensVerifyTokenResponseJSON contains the JSON metadata +// for the struct [UserTokenVerifyUserAPITokensVerifyTokenResponse] +type userTokenVerifyUserAPITokensVerifyTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenVerifyUserAPITokensVerifyTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenVerifyUserAPITokensVerifyTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenVerifyUserAPITokensVerifyTokenResponseErrorJSON `json:"-"` +} + +// userTokenVerifyUserAPITokensVerifyTokenResponseErrorJSON contains the JSON +// metadata for the struct [UserTokenVerifyUserAPITokensVerifyTokenResponseError] +type userTokenVerifyUserAPITokensVerifyTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenVerifyUserAPITokensVerifyTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenVerifyUserAPITokensVerifyTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userTokenVerifyUserAPITokensVerifyTokenResponseMessageJSON `json:"-"` +} + +// userTokenVerifyUserAPITokensVerifyTokenResponseMessageJSON contains the JSON +// metadata for the struct [UserTokenVerifyUserAPITokensVerifyTokenResponseMessage] +type userTokenVerifyUserAPITokensVerifyTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenVerifyUserAPITokensVerifyTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserTokenVerifyUserAPITokensVerifyTokenResponseResult struct { + // Token identifier tag. + ID string `json:"id,required"` + // Status of the token. + Status UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatus `json:"status,required"` + // The expiration time on or after which the JWT MUST NOT be accepted for + // processing. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The time before which the token MUST NOT be accepted for processing. + NotBefore time.Time `json:"not_before" format:"date-time"` + JSON userTokenVerifyUserAPITokensVerifyTokenResponseResultJSON `json:"-"` +} + +// userTokenVerifyUserAPITokensVerifyTokenResponseResultJSON contains the JSON +// metadata for the struct [UserTokenVerifyUserAPITokensVerifyTokenResponseResult] +type userTokenVerifyUserAPITokensVerifyTokenResponseResultJSON struct { + ID apijson.Field + Status apijson.Field + ExpiresOn apijson.Field + NotBefore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserTokenVerifyUserAPITokensVerifyTokenResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the token. +type UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatus string + +const ( + UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatusActive UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatus = "active" + UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatusDisabled UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatus = "disabled" + UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatusExpired UserTokenVerifyUserAPITokensVerifyTokenResponseResultStatus = "expired" +) + +// Whether the API call was successful +type UserTokenVerifyUserAPITokensVerifyTokenResponseSuccess bool + +const ( + UserTokenVerifyUserAPITokensVerifyTokenResponseSuccessTrue UserTokenVerifyUserAPITokensVerifyTokenResponseSuccess = true +) diff --git a/usertokenverify_test.go b/usertokenverify_test.go new file mode 100644 index 00000000000..8f27e11866e --- /dev/null +++ b/usertokenverify_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestUserTokenVerifyUserAPITokensVerifyToken(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.User.Tokens.Verifies.UserAPITokensVerifyToken(context.TODO()) + 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/webanalytic.go b/webanalytic.go new file mode 100644 index 00000000000..bd09d61774b --- /dev/null +++ b/webanalytic.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// WebAnalyticService 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 [NewWebAnalyticService] method +// instead. +type WebAnalyticService struct { + Options []option.RequestOption + SiteInfo *WebAnalyticSiteInfoService + Rules *WebAnalyticRuleService +} + +// NewWebAnalyticService 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 NewWebAnalyticService(opts ...option.RequestOption) (r *WebAnalyticService) { + r = &WebAnalyticService{} + r.Options = opts + r.SiteInfo = NewWebAnalyticSiteInfoService(opts...) + r.Rules = NewWebAnalyticRuleService(opts...) + return +} diff --git a/webanalyticrule.go b/webanalyticrule.go new file mode 100644 index 00000000000..41b7896dd55 --- /dev/null +++ b/webanalyticrule.go @@ -0,0 +1,466 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// WebAnalyticRuleService 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 [NewWebAnalyticRuleService] method +// instead. +type WebAnalyticRuleService struct { + Options []option.RequestOption +} + +// NewWebAnalyticRuleService 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 NewWebAnalyticRuleService(opts ...option.RequestOption) (r *WebAnalyticRuleService) { + r = &WebAnalyticRuleService{} + r.Options = opts + return +} + +// Creates a new rule in a Web Analytics ruleset. +func (r *WebAnalyticRuleService) New(ctx context.Context, accountIdentifier string, rulesetIdentifier string, body WebAnalyticRuleNewParams, opts ...option.RequestOption) (res *Rule, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/v2/%s/rule", accountIdentifier, rulesetIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Modifies one or more rules in a Web Analytics ruleset with a single request. +func (r *WebAnalyticRuleService) Update(ctx context.Context, accountIdentifier string, rulesetIdentifier string, body WebAnalyticRuleUpdateParams, opts ...option.RequestOption) (res *WebAnalyticRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/v2/%s/rules", accountIdentifier, rulesetIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all the rules in a Web Analytics ruleset. +func (r *WebAnalyticRuleService) List(ctx context.Context, accountIdentifier string, rulesetIdentifier string, opts ...option.RequestOption) (res *WebAnalyticRuleListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/v2/%s/rules", accountIdentifier, rulesetIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an existing rule from a Web Analytics ruleset. +func (r *WebAnalyticRuleService) Delete(ctx context.Context, accountIdentifier string, rulesetIdentifier string, ruleIdentifier string, opts ...option.RequestOption) (res *WebAnalyticRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/v2/%s/rule/%s", accountIdentifier, rulesetIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type WebAnalyticRuleUpdateResponse struct { + Errors []WebAnalyticRuleUpdateResponseError `json:"errors"` + Messages []WebAnalyticRuleUpdateResponseMessage `json:"messages"` + Result WebAnalyticRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON webAnalyticRuleUpdateResponseJSON `json:"-"` +} + +// webAnalyticRuleUpdateResponseJSON contains the JSON metadata for the struct +// [WebAnalyticRuleUpdateResponse] +type webAnalyticRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticRuleUpdateResponseErrorJSON `json:"-"` +} + +// webAnalyticRuleUpdateResponseErrorJSON contains the JSON metadata for the struct +// [WebAnalyticRuleUpdateResponseError] +type webAnalyticRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticRuleUpdateResponseMessageJSON `json:"-"` +} + +// webAnalyticRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [WebAnalyticRuleUpdateResponseMessage] +type webAnalyticRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleUpdateResponseResult struct { + // A list of rules. + Rules []WebAnalyticRuleUpdateResponseResultRule `json:"rules"` + Ruleset WebAnalyticRuleUpdateResponseResultRuleset `json:"ruleset"` + JSON webAnalyticRuleUpdateResponseResultJSON `json:"-"` +} + +// webAnalyticRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [WebAnalyticRuleUpdateResponseResult] +type webAnalyticRuleUpdateResponseResultJSON struct { + Rules apijson.Field + Ruleset apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleUpdateResponseResultRule struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + Created time.Time `json:"created" format:"date-time"` + // The hostname the rule will be applied to. + Host string `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive bool `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused bool `json:"is_paused"` + // The paths the rule will be applied to. + Paths []string `json:"paths"` + Priority float64 `json:"priority"` + JSON webAnalyticRuleUpdateResponseResultRuleJSON `json:"-"` +} + +// webAnalyticRuleUpdateResponseResultRuleJSON contains the JSON metadata for the +// struct [WebAnalyticRuleUpdateResponseResultRule] +type webAnalyticRuleUpdateResponseResultRuleJSON struct { + ID apijson.Field + Created apijson.Field + Host apijson.Field + Inclusive apijson.Field + IsPaused apijson.Field + Paths apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleUpdateResponseResultRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleUpdateResponseResultRuleset struct { + // The Web Analytics ruleset identifier. + ID string `json:"id"` + // Whether the ruleset is enabled. + Enabled bool `json:"enabled"` + ZoneName string `json:"zone_name"` + // The zone identifier. + ZoneTag string `json:"zone_tag"` + JSON webAnalyticRuleUpdateResponseResultRulesetJSON `json:"-"` +} + +// webAnalyticRuleUpdateResponseResultRulesetJSON contains the JSON metadata for +// the struct [WebAnalyticRuleUpdateResponseResultRuleset] +type webAnalyticRuleUpdateResponseResultRulesetJSON struct { + ID apijson.Field + Enabled apijson.Field + ZoneName apijson.Field + ZoneTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleUpdateResponseResultRuleset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleListResponse struct { + Errors []WebAnalyticRuleListResponseError `json:"errors"` + Messages []WebAnalyticRuleListResponseMessage `json:"messages"` + Result WebAnalyticRuleListResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON webAnalyticRuleListResponseJSON `json:"-"` +} + +// webAnalyticRuleListResponseJSON contains the JSON metadata for the struct +// [WebAnalyticRuleListResponse] +type webAnalyticRuleListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticRuleListResponseErrorJSON `json:"-"` +} + +// webAnalyticRuleListResponseErrorJSON contains the JSON metadata for the struct +// [WebAnalyticRuleListResponseError] +type webAnalyticRuleListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticRuleListResponseMessageJSON `json:"-"` +} + +// webAnalyticRuleListResponseMessageJSON contains the JSON metadata for the struct +// [WebAnalyticRuleListResponseMessage] +type webAnalyticRuleListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleListResponseResult struct { + // A list of rules. + Rules []WebAnalyticRuleListResponseResultRule `json:"rules"` + Ruleset WebAnalyticRuleListResponseResultRuleset `json:"ruleset"` + JSON webAnalyticRuleListResponseResultJSON `json:"-"` +} + +// webAnalyticRuleListResponseResultJSON contains the JSON metadata for the struct +// [WebAnalyticRuleListResponseResult] +type webAnalyticRuleListResponseResultJSON struct { + Rules apijson.Field + Ruleset apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleListResponseResultRule struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + Created time.Time `json:"created" format:"date-time"` + // The hostname the rule will be applied to. + Host string `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive bool `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused bool `json:"is_paused"` + // The paths the rule will be applied to. + Paths []string `json:"paths"` + Priority float64 `json:"priority"` + JSON webAnalyticRuleListResponseResultRuleJSON `json:"-"` +} + +// webAnalyticRuleListResponseResultRuleJSON contains the JSON metadata for the +// struct [WebAnalyticRuleListResponseResultRule] +type webAnalyticRuleListResponseResultRuleJSON struct { + ID apijson.Field + Created apijson.Field + Host apijson.Field + Inclusive apijson.Field + IsPaused apijson.Field + Paths apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleListResponseResultRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleListResponseResultRuleset struct { + // The Web Analytics ruleset identifier. + ID string `json:"id"` + // Whether the ruleset is enabled. + Enabled bool `json:"enabled"` + ZoneName string `json:"zone_name"` + // The zone identifier. + ZoneTag string `json:"zone_tag"` + JSON webAnalyticRuleListResponseResultRulesetJSON `json:"-"` +} + +// webAnalyticRuleListResponseResultRulesetJSON contains the JSON metadata for the +// struct [WebAnalyticRuleListResponseResultRuleset] +type webAnalyticRuleListResponseResultRulesetJSON struct { + ID apijson.Field + Enabled apijson.Field + ZoneName apijson.Field + ZoneTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleListResponseResultRuleset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleDeleteResponse struct { + Errors []WebAnalyticRuleDeleteResponseError `json:"errors"` + Messages []WebAnalyticRuleDeleteResponseMessage `json:"messages"` + Result WebAnalyticRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON webAnalyticRuleDeleteResponseJSON `json:"-"` +} + +// webAnalyticRuleDeleteResponseJSON contains the JSON metadata for the struct +// [WebAnalyticRuleDeleteResponse] +type webAnalyticRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticRuleDeleteResponseErrorJSON `json:"-"` +} + +// webAnalyticRuleDeleteResponseErrorJSON contains the JSON metadata for the struct +// [WebAnalyticRuleDeleteResponseError] +type webAnalyticRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticRuleDeleteResponseMessageJSON `json:"-"` +} + +// webAnalyticRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [WebAnalyticRuleDeleteResponseMessage] +type webAnalyticRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleDeleteResponseResult struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + JSON webAnalyticRuleDeleteResponseResultJSON `json:"-"` +} + +// webAnalyticRuleDeleteResponseResultJSON contains the JSON metadata for the +// struct [WebAnalyticRuleDeleteResponseResult] +type webAnalyticRuleDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticRuleNewParams struct { + Host param.Field[string] `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive param.Field[bool] `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused param.Field[bool] `json:"is_paused"` + Paths param.Field[[]string] `json:"paths"` +} + +func (r WebAnalyticRuleNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type WebAnalyticRuleUpdateParams struct { + // A list of rule identifiers to delete. + DeleteRules param.Field[[]string] `json:"delete_rules"` + // A list of rules to create or update. + Rules param.Field[[]WebAnalyticRuleUpdateParamsRule] `json:"rules"` +} + +func (r WebAnalyticRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type WebAnalyticRuleUpdateParamsRule struct { + // The Web Analytics rule identifier. + ID param.Field[string] `json:"id"` + Host param.Field[string] `json:"host"` + Inclusive param.Field[bool] `json:"inclusive"` + IsPaused param.Field[bool] `json:"is_paused"` + Paths param.Field[[]string] `json:"paths"` +} + +func (r WebAnalyticRuleUpdateParamsRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/webanalyticrule_test.go b/webanalyticrule_test.go new file mode 100644 index 00000000000..0ae91d5b322 --- /dev/null +++ b/webanalyticrule_test.go @@ -0,0 +1,163 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestWebAnalyticRuleNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.Rules.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.WebAnalyticRuleNewParams{ + Host: cloudflare.F("example.com"), + Inclusive: cloudflare.F(true), + IsPaused: cloudflare.F(false), + Paths: cloudflare.F([]string{"*"}), + }, + ) + 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 TestWebAnalyticRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.Rules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.WebAnalyticRuleUpdateParams{ + DeleteRules: cloudflare.F([]string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}), + Rules: cloudflare.F([]cloudflare.WebAnalyticRuleUpdateParamsRule{{ + Host: cloudflare.F("example.com"), + ID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + Inclusive: cloudflare.F(true), + IsPaused: cloudflare.F(false), + Paths: cloudflare.F([]string{"*"}), + }, { + Host: cloudflare.F("example.com"), + ID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + Inclusive: cloudflare.F(true), + IsPaused: cloudflare.F(false), + Paths: cloudflare.F([]string{"*"}), + }, { + Host: cloudflare.F("example.com"), + ID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), + Inclusive: cloudflare.F(true), + IsPaused: cloudflare.F(false), + Paths: cloudflare.F([]string{"*"}), + }}), + }, + ) + 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 TestWebAnalyticRuleList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.Rules.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestWebAnalyticRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.Rules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/webanalyticsiteinfo.go b/webanalyticsiteinfo.go new file mode 100644 index 00000000000..8b0d434c179 --- /dev/null +++ b/webanalyticsiteinfo.go @@ -0,0 +1,607 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// WebAnalyticSiteInfoService 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 [NewWebAnalyticSiteInfoService] +// method instead. +type WebAnalyticSiteInfoService struct { + Options []option.RequestOption +} + +// NewWebAnalyticSiteInfoService 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 NewWebAnalyticSiteInfoService(opts ...option.RequestOption) (r *WebAnalyticSiteInfoService) { + r = &WebAnalyticSiteInfoService{} + r.Options = opts + return +} + +// Retrieves a Web Analytics site. +func (r *WebAnalyticSiteInfoService) Get(ctx context.Context, accountIdentifier string, siteIdentifier string, opts ...option.RequestOption) (res *WebAnalyticSiteInfoGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/site_info/%s", accountIdentifier, siteIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an existing Web Analytics site. +func (r *WebAnalyticSiteInfoService) Update(ctx context.Context, accountIdentifier string, siteIdentifier string, body WebAnalyticSiteInfoUpdateParams, opts ...option.RequestOption) (res *WebAnalyticSiteInfoUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/site_info/%s", accountIdentifier, siteIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists all Web Analytics sites of an account. +func (r *WebAnalyticSiteInfoService) List(ctx context.Context, accountIdentifier string, query WebAnalyticSiteInfoListParams, opts ...option.RequestOption) (res *shared.Page[WebAnalyticSiteInfoListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/rum/site_info/list", accountIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Deletes an existing Web Analytics site. +func (r *WebAnalyticSiteInfoService) Delete(ctx context.Context, accountIdentifier string, siteIdentifier string, opts ...option.RequestOption) (res *WebAnalyticSiteInfoDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/rum/site_info/%s", accountIdentifier, siteIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type WebAnalyticSiteInfoGetResponse struct { + Errors []WebAnalyticSiteInfoGetResponseError `json:"errors"` + Messages []WebAnalyticSiteInfoGetResponseMessage `json:"messages"` + Result WebAnalyticSiteInfoGetResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON webAnalyticSiteInfoGetResponseJSON `json:"-"` +} + +// webAnalyticSiteInfoGetResponseJSON contains the JSON metadata for the struct +// [WebAnalyticSiteInfoGetResponse] +type webAnalyticSiteInfoGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticSiteInfoGetResponseErrorJSON `json:"-"` +} + +// webAnalyticSiteInfoGetResponseErrorJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoGetResponseError] +type webAnalyticSiteInfoGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticSiteInfoGetResponseMessageJSON `json:"-"` +} + +// webAnalyticSiteInfoGetResponseMessageJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoGetResponseMessage] +type webAnalyticSiteInfoGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoGetResponseResult struct { + // If enabled, the JavaScript snippet is automatically injected for orange-clouded + // sites. + AutoInstall bool `json:"auto_install"` + Created time.Time `json:"created" format:"date-time"` + // A list of rules. + Rules []WebAnalyticSiteInfoGetResponseResultRule `json:"rules"` + Ruleset WebAnalyticSiteInfoGetResponseResultRuleset `json:"ruleset"` + // The Web Analytics site identifier. + SiteTag string `json:"site_tag"` + // The Web Analytics site token. + SiteToken string `json:"site_token"` + // Encoded JavaScript snippet. + Snippet string `json:"snippet"` + JSON webAnalyticSiteInfoGetResponseResultJSON `json:"-"` +} + +// webAnalyticSiteInfoGetResponseResultJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoGetResponseResult] +type webAnalyticSiteInfoGetResponseResultJSON struct { + AutoInstall apijson.Field + Created apijson.Field + Rules apijson.Field + Ruleset apijson.Field + SiteTag apijson.Field + SiteToken apijson.Field + Snippet apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoGetResponseResultRule struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + Created time.Time `json:"created" format:"date-time"` + // The hostname the rule will be applied to. + Host string `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive bool `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused bool `json:"is_paused"` + // The paths the rule will be applied to. + Paths []string `json:"paths"` + Priority float64 `json:"priority"` + JSON webAnalyticSiteInfoGetResponseResultRuleJSON `json:"-"` +} + +// webAnalyticSiteInfoGetResponseResultRuleJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoGetResponseResultRule] +type webAnalyticSiteInfoGetResponseResultRuleJSON struct { + ID apijson.Field + Created apijson.Field + Host apijson.Field + Inclusive apijson.Field + IsPaused apijson.Field + Paths apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoGetResponseResultRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoGetResponseResultRuleset struct { + // The Web Analytics ruleset identifier. + ID string `json:"id"` + // Whether the ruleset is enabled. + Enabled bool `json:"enabled"` + ZoneName string `json:"zone_name"` + // The zone identifier. + ZoneTag string `json:"zone_tag"` + JSON webAnalyticSiteInfoGetResponseResultRulesetJSON `json:"-"` +} + +// webAnalyticSiteInfoGetResponseResultRulesetJSON contains the JSON metadata for +// the struct [WebAnalyticSiteInfoGetResponseResultRuleset] +type webAnalyticSiteInfoGetResponseResultRulesetJSON struct { + ID apijson.Field + Enabled apijson.Field + ZoneName apijson.Field + ZoneTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoGetResponseResultRuleset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoUpdateResponse struct { + Errors []WebAnalyticSiteInfoUpdateResponseError `json:"errors"` + Messages []WebAnalyticSiteInfoUpdateResponseMessage `json:"messages"` + Result WebAnalyticSiteInfoUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON webAnalyticSiteInfoUpdateResponseJSON `json:"-"` +} + +// webAnalyticSiteInfoUpdateResponseJSON contains the JSON metadata for the struct +// [WebAnalyticSiteInfoUpdateResponse] +type webAnalyticSiteInfoUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticSiteInfoUpdateResponseErrorJSON `json:"-"` +} + +// webAnalyticSiteInfoUpdateResponseErrorJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoUpdateResponseError] +type webAnalyticSiteInfoUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticSiteInfoUpdateResponseMessageJSON `json:"-"` +} + +// webAnalyticSiteInfoUpdateResponseMessageJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoUpdateResponseMessage] +type webAnalyticSiteInfoUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoUpdateResponseResult struct { + // If enabled, the JavaScript snippet is automatically injected for orange-clouded + // sites. + AutoInstall bool `json:"auto_install"` + Created time.Time `json:"created" format:"date-time"` + // A list of rules. + Rules []WebAnalyticSiteInfoUpdateResponseResultRule `json:"rules"` + Ruleset WebAnalyticSiteInfoUpdateResponseResultRuleset `json:"ruleset"` + // The Web Analytics site identifier. + SiteTag string `json:"site_tag"` + // The Web Analytics site token. + SiteToken string `json:"site_token"` + // Encoded JavaScript snippet. + Snippet string `json:"snippet"` + JSON webAnalyticSiteInfoUpdateResponseResultJSON `json:"-"` +} + +// webAnalyticSiteInfoUpdateResponseResultJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoUpdateResponseResult] +type webAnalyticSiteInfoUpdateResponseResultJSON struct { + AutoInstall apijson.Field + Created apijson.Field + Rules apijson.Field + Ruleset apijson.Field + SiteTag apijson.Field + SiteToken apijson.Field + Snippet apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoUpdateResponseResultRule struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + Created time.Time `json:"created" format:"date-time"` + // The hostname the rule will be applied to. + Host string `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive bool `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused bool `json:"is_paused"` + // The paths the rule will be applied to. + Paths []string `json:"paths"` + Priority float64 `json:"priority"` + JSON webAnalyticSiteInfoUpdateResponseResultRuleJSON `json:"-"` +} + +// webAnalyticSiteInfoUpdateResponseResultRuleJSON contains the JSON metadata for +// the struct [WebAnalyticSiteInfoUpdateResponseResultRule] +type webAnalyticSiteInfoUpdateResponseResultRuleJSON struct { + ID apijson.Field + Created apijson.Field + Host apijson.Field + Inclusive apijson.Field + IsPaused apijson.Field + Paths apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoUpdateResponseResultRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoUpdateResponseResultRuleset struct { + // The Web Analytics ruleset identifier. + ID string `json:"id"` + // Whether the ruleset is enabled. + Enabled bool `json:"enabled"` + ZoneName string `json:"zone_name"` + // The zone identifier. + ZoneTag string `json:"zone_tag"` + JSON webAnalyticSiteInfoUpdateResponseResultRulesetJSON `json:"-"` +} + +// webAnalyticSiteInfoUpdateResponseResultRulesetJSON contains the JSON metadata +// for the struct [WebAnalyticSiteInfoUpdateResponseResultRuleset] +type webAnalyticSiteInfoUpdateResponseResultRulesetJSON struct { + ID apijson.Field + Enabled apijson.Field + ZoneName apijson.Field + ZoneTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoUpdateResponseResultRuleset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoListResponse struct { + // If enabled, the JavaScript snippet is automatically injected for orange-clouded + // sites. + AutoInstall bool `json:"auto_install"` + Created time.Time `json:"created" format:"date-time"` + // A list of rules. + Rules []WebAnalyticSiteInfoListResponseRule `json:"rules"` + Ruleset WebAnalyticSiteInfoListResponseRuleset `json:"ruleset"` + // The Web Analytics site identifier. + SiteTag string `json:"site_tag"` + // The Web Analytics site token. + SiteToken string `json:"site_token"` + // Encoded JavaScript snippet. + Snippet string `json:"snippet"` + JSON webAnalyticSiteInfoListResponseJSON `json:"-"` +} + +// webAnalyticSiteInfoListResponseJSON contains the JSON metadata for the struct +// [WebAnalyticSiteInfoListResponse] +type webAnalyticSiteInfoListResponseJSON struct { + AutoInstall apijson.Field + Created apijson.Field + Rules apijson.Field + Ruleset apijson.Field + SiteTag apijson.Field + SiteToken apijson.Field + Snippet apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoListResponseRule struct { + // The Web Analytics rule identifier. + ID string `json:"id"` + Created time.Time `json:"created" format:"date-time"` + // The hostname the rule will be applied to. + Host string `json:"host"` + // Whether the rule includes or excludes traffic from being measured. + Inclusive bool `json:"inclusive"` + // Whether the rule is paused or not. + IsPaused bool `json:"is_paused"` + // The paths the rule will be applied to. + Paths []string `json:"paths"` + Priority float64 `json:"priority"` + JSON webAnalyticSiteInfoListResponseRuleJSON `json:"-"` +} + +// webAnalyticSiteInfoListResponseRuleJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoListResponseRule] +type webAnalyticSiteInfoListResponseRuleJSON struct { + ID apijson.Field + Created apijson.Field + Host apijson.Field + Inclusive apijson.Field + IsPaused apijson.Field + Paths apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoListResponseRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoListResponseRuleset struct { + // The Web Analytics ruleset identifier. + ID string `json:"id"` + // Whether the ruleset is enabled. + Enabled bool `json:"enabled"` + ZoneName string `json:"zone_name"` + // The zone identifier. + ZoneTag string `json:"zone_tag"` + JSON webAnalyticSiteInfoListResponseRulesetJSON `json:"-"` +} + +// webAnalyticSiteInfoListResponseRulesetJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoListResponseRuleset] +type webAnalyticSiteInfoListResponseRulesetJSON struct { + ID apijson.Field + Enabled apijson.Field + ZoneName apijson.Field + ZoneTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoListResponseRuleset) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoDeleteResponse struct { + Errors []WebAnalyticSiteInfoDeleteResponseError `json:"errors"` + Messages []WebAnalyticSiteInfoDeleteResponseMessage `json:"messages"` + Result WebAnalyticSiteInfoDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON webAnalyticSiteInfoDeleteResponseJSON `json:"-"` +} + +// webAnalyticSiteInfoDeleteResponseJSON contains the JSON metadata for the struct +// [WebAnalyticSiteInfoDeleteResponse] +type webAnalyticSiteInfoDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticSiteInfoDeleteResponseErrorJSON `json:"-"` +} + +// webAnalyticSiteInfoDeleteResponseErrorJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoDeleteResponseError] +type webAnalyticSiteInfoDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON webAnalyticSiteInfoDeleteResponseMessageJSON `json:"-"` +} + +// webAnalyticSiteInfoDeleteResponseMessageJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoDeleteResponseMessage] +type webAnalyticSiteInfoDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoDeleteResponseResult struct { + // The Web Analytics site identifier. + SiteTag string `json:"site_tag"` + JSON webAnalyticSiteInfoDeleteResponseResultJSON `json:"-"` +} + +// webAnalyticSiteInfoDeleteResponseResultJSON contains the JSON metadata for the +// struct [WebAnalyticSiteInfoDeleteResponseResult] +type webAnalyticSiteInfoDeleteResponseResultJSON struct { + SiteTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WebAnalyticSiteInfoDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type WebAnalyticSiteInfoUpdateParams struct { + // If enabled, the JavaScript snippet is automatically injected for orange-clouded + // sites. + AutoInstall param.Field[bool] `json:"auto_install"` + // The hostname to use for gray-clouded sites. + Host param.Field[string] `json:"host"` + // The zone identifier. + ZoneTag param.Field[string] `json:"zone_tag"` +} + +func (r WebAnalyticSiteInfoUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type WebAnalyticSiteInfoListParams struct { + // The property used to sort the list of results. + OrderBy param.Field[WebAnalyticSiteInfoListParamsOrderBy] `query:"order_by"` + // Current page within the paginated list of results. + Page param.Field[float64] `query:"page"` + // Number of items to return per page of results. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [WebAnalyticSiteInfoListParams]'s query parameters as +// `url.Values`. +func (r WebAnalyticSiteInfoListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The property used to sort the list of results. +type WebAnalyticSiteInfoListParamsOrderBy string + +const ( + WebAnalyticSiteInfoListParamsOrderByHost WebAnalyticSiteInfoListParamsOrderBy = "host" + WebAnalyticSiteInfoListParamsOrderByCreated WebAnalyticSiteInfoListParamsOrderBy = "created" +) diff --git a/webanalyticsiteinfo_test.go b/webanalyticsiteinfo_test.go new file mode 100644 index 00000000000..27a72ed21e8 --- /dev/null +++ b/webanalyticsiteinfo_test.go @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestWebAnalyticSiteInfoGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.SiteInfo.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestWebAnalyticSiteInfoUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.SiteInfo.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.WebAnalyticSiteInfoUpdateParams{ + AutoInstall: cloudflare.F(true), + Host: cloudflare.F("example.com"), + ZoneTag: 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()) + } +} + +func TestWebAnalyticSiteInfoListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.SiteInfo.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.WebAnalyticSiteInfoListParams{ + OrderBy: cloudflare.F(cloudflare.WebAnalyticSiteInfoListParamsOrderByHost), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(10.000000), + }, + ) + 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 TestWebAnalyticSiteInfoDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.WebAnalytics.SiteInfo.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/zone.go b/zone.go index 68d3af64ce8..41679518f54 100644 --- a/zone.go +++ b/zone.go @@ -13,6 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" "github.com/cloudflare/cloudflare-sdk-go/internal/param" "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" "github.com/cloudflare/cloudflare-sdk-go/option" ) @@ -21,11 +22,58 @@ import ( // from the environment automatically. You should not instantiate this service // directly, and instead use the [NewZoneService] method instead. type ZoneService struct { - Options []option.RequestOption - LoadBalancers *ZoneLoadBalancerService - Dnssecs *ZoneDnssecService - RateLimits *ZoneRateLimitService - Settings *ZoneSettingService + Options []option.RequestOption + LoadBalancers *ZoneLoadBalancerService + Accesses *ZoneAccessService + DNSAnalytics *ZoneDNSAnalyticService + PurgeCaches *ZonePurgeCachService + Ssls *ZoneSslService + Subscriptions *ZoneSubscriptionService + Acms *ZoneAcmService + Analytics *ZoneAnalyticsService + Argos *ZoneArgoService + AvailablePlans *ZoneAvailablePlanService + AvailableRatePlans *ZoneAvailableRatePlanService + Caches *ZoneCachService + CertificateAuthorities *ZoneCertificateAuthorityService + ClientCertificates *ZoneClientCertificateService + CustomCertificates *ZoneCustomCertificateService + CustomHostnames *ZoneCustomHostnameService + CustomNs *ZoneCustomNService + CustomPages *ZoneCustomPageService + DNSRecords *ZoneDNSRecordService + Dnssecs *ZoneDnssecService + Emails *ZoneEmailService + Filters *ZoneFilterService + Firewalls *ZoneFirewallService + Healthchecks *ZoneHealthcheckService + KeylessCertificates *ZoneKeylessCertificateService + Logpushes *ZoneLogpushService + Logs *ZoneLogService + OriginTlsClientAuths *ZoneOriginTlsClientAuthService + Pagerules *ZonePageruleService + Railguns *ZoneRailgunService + RateLimits *ZoneRateLimitService + SecondaryDNS *ZoneSecondaryDNSService + Settings *ZoneSettingService + WaitingRooms *ZoneWaitingRoomService + Web3s *ZoneWeb3Service + Workers *ZoneWorkerService + ActivationChecks *ZoneActivationCheckService + APIGateway *ZoneAPIGatewayService + ManagedHeaders *ZoneManagedHeaderService + Rulesets *ZoneRulesetService + URLNormalizations *ZoneURLNormalizationService + Spectrums *ZoneSpectrumService + Holds *ZoneHoldService + PageShield *ZonePageShieldService + BotManagement *ZoneBotManagementService + Cache *ZoneCacheService + DcvDelegations *ZoneDcvDelegationService + Zarazs *ZoneZarazService + Snippets *ZoneSnippetService + SnippetsRules *ZoneSnippetsRuleService + SpeedAPI *ZoneSpeedAPIService } // NewZoneService generates a new service that applies the given options to each @@ -35,9 +83,56 @@ func NewZoneService(opts ...option.RequestOption) (r *ZoneService) { r = &ZoneService{} r.Options = opts r.LoadBalancers = NewZoneLoadBalancerService(opts...) + r.Accesses = NewZoneAccessService(opts...) + r.DNSAnalytics = NewZoneDNSAnalyticService(opts...) + r.PurgeCaches = NewZonePurgeCachService(opts...) + r.Ssls = NewZoneSslService(opts...) + r.Subscriptions = NewZoneSubscriptionService(opts...) + r.Acms = NewZoneAcmService(opts...) + r.Analytics = NewZoneAnalyticsService(opts...) + r.Argos = NewZoneArgoService(opts...) + r.AvailablePlans = NewZoneAvailablePlanService(opts...) + r.AvailableRatePlans = NewZoneAvailableRatePlanService(opts...) + r.Caches = NewZoneCachService(opts...) + r.CertificateAuthorities = NewZoneCertificateAuthorityService(opts...) + r.ClientCertificates = NewZoneClientCertificateService(opts...) + r.CustomCertificates = NewZoneCustomCertificateService(opts...) + r.CustomHostnames = NewZoneCustomHostnameService(opts...) + r.CustomNs = NewZoneCustomNService(opts...) + r.CustomPages = NewZoneCustomPageService(opts...) + r.DNSRecords = NewZoneDNSRecordService(opts...) r.Dnssecs = NewZoneDnssecService(opts...) + r.Emails = NewZoneEmailService(opts...) + r.Filters = NewZoneFilterService(opts...) + r.Firewalls = NewZoneFirewallService(opts...) + r.Healthchecks = NewZoneHealthcheckService(opts...) + r.KeylessCertificates = NewZoneKeylessCertificateService(opts...) + r.Logpushes = NewZoneLogpushService(opts...) + r.Logs = NewZoneLogService(opts...) + r.OriginTlsClientAuths = NewZoneOriginTlsClientAuthService(opts...) + r.Pagerules = NewZonePageruleService(opts...) + r.Railguns = NewZoneRailgunService(opts...) r.RateLimits = NewZoneRateLimitService(opts...) + r.SecondaryDNS = NewZoneSecondaryDNSService(opts...) r.Settings = NewZoneSettingService(opts...) + r.WaitingRooms = NewZoneWaitingRoomService(opts...) + r.Web3s = NewZoneWeb3Service(opts...) + r.Workers = NewZoneWorkerService(opts...) + r.ActivationChecks = NewZoneActivationCheckService(opts...) + r.APIGateway = NewZoneAPIGatewayService(opts...) + r.ManagedHeaders = NewZoneManagedHeaderService(opts...) + r.Rulesets = NewZoneRulesetService(opts...) + r.URLNormalizations = NewZoneURLNormalizationService(opts...) + r.Spectrums = NewZoneSpectrumService(opts...) + r.Holds = NewZoneHoldService(opts...) + r.PageShield = NewZonePageShieldService(opts...) + r.BotManagement = NewZoneBotManagementService(opts...) + r.Cache = NewZoneCacheService(opts...) + r.DcvDelegations = NewZoneDcvDelegationService(opts...) + r.Zarazs = NewZoneZarazService(opts...) + r.Snippets = NewZoneSnippetService(opts...) + r.SnippetsRules = NewZoneSnippetsRuleService(opts...) + r.SpeedAPI = NewZoneSpeedAPIService(opts...) return } @@ -57,7 +152,7 @@ func (r *ZoneService) Get(ctx context.Context, identifier string, opts ...option return } -// Editz a zone. Only one zone property can be changed at a time. +// Edits a zone. Only one zone property can be changed at a time. func (r *ZoneService) Update(ctx context.Context, identifier string, body ZoneUpdateParams, opts ...option.RequestOption) (res *ZoneUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("zones/%s", identifier) @@ -66,120 +161,31 @@ func (r *ZoneService) Update(ctx context.Context, identifier string, body ZoneUp } // Lists, searches, sorts, and filters your zones. -func (r *ZoneService) List(ctx context.Context, query ZoneListParams, opts ...option.RequestOption) (res *ZoneListResponse, err error) { - opts = append(r.Options[:], opts...) +func (r *ZoneService) List(ctx context.Context, query ZoneListParams, opts ...option.RequestOption) (res *shared.Page[ZoneListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "zones" - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) - return + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil } // Deletes an existing zone. -func (r *ZoneService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneAPIResponseSingleID, err error) { +func (r *ZoneService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("zones/%s", identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } -// The session_affinity specifies the type of session affinity the load balancer -// should use unless specified as "none" or ""(default). The supported types are -// "cookie" and "ip_cookie". "cookie" - On the first request to a proxied load -// balancer, a cookie is generated, encoding information of which origin the -// request will be forwarded to. Subsequent requests, by the same client to the -// same load balancer, will be sent to the origin server the cookie encodes, for -// the duration of the cookie and as long as the origin server remains healthy. If -// the cookie has expired or the origin server is unhealthy then a new origin -// server is calculated and used. "ip_cookie" behaves the same as "cookie" except -// the initial origin selection is stable and based on the client’s ip address. -type SessionAffinity string - -const ( - SessionAffinityNone SessionAffinity = "none" - SessionAffinityCookie SessionAffinity = "cookie" - SessionAffinityIPCookie SessionAffinity = "ip_cookie" - SessionAffinityEmpty SessionAffinity = "\"\"" -) - -type ZoneAPIResponseSingleID struct { - Errors []ZoneAPIResponseSingleIDError `json:"errors"` - Messages []ZoneAPIResponseSingleIDMessage `json:"messages"` - Result ZoneAPIResponseSingleIDResult `json:"result,nullable"` - // Whether the API call was successful - Success bool `json:"success"` - JSON zoneAPIResponseSingleIDJSON `json:"-"` -} - -// zoneAPIResponseSingleIDJSON contains the JSON metadata for the struct -// [ZoneAPIResponseSingleID] -type zoneAPIResponseSingleIDJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneAPIResponseSingleID) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ZoneAPIResponseSingleIDError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneAPIResponseSingleIDErrorJSON `json:"-"` -} - -// zoneAPIResponseSingleIDErrorJSON contains the JSON metadata for the struct -// [ZoneAPIResponseSingleIDError] -type zoneAPIResponseSingleIDErrorJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneAPIResponseSingleIDError) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ZoneAPIResponseSingleIDMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneAPIResponseSingleIDMessageJSON `json:"-"` -} - -// zoneAPIResponseSingleIDMessageJSON contains the JSON metadata for the struct -// [ZoneAPIResponseSingleIDMessage] -type zoneAPIResponseSingleIDMessageJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneAPIResponseSingleIDMessage) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ZoneAPIResponseSingleIDResult struct { - // Identifier - ID string `json:"id,required"` - JSON zoneAPIResponseSingleIDResultJSON `json:"-"` -} - -// zoneAPIResponseSingleIDResultJSON contains the JSON metadata for the struct -// [ZoneAPIResponseSingleIDResult] -type zoneAPIResponseSingleIDResultJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneAPIResponseSingleIDResult) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - type ZoneNewResponse struct { Errors []ZoneNewResponseError `json:"errors"` Messages []ZoneNewResponseMessage `json:"messages"` @@ -244,6 +250,8 @@ func (r *ZoneNewResponseMessage) UnmarshalJSON(data []byte) (err error) { type ZoneNewResponseResult struct { // Identifier ID string `json:"id,required"` + // The account the zone belongs to + Account ZoneNewResponseResultAccount `json:"account,required"` // The last time proof of ownership was detected and the zone was made active ActivatedOn time.Time `json:"activated_on,required,nullable" format:"date-time"` // When the zone was created @@ -252,6 +260,8 @@ type ZoneNewResponseResult struct { // or last expired (negative integer) for the domain. If development mode has never // been enabled, this value is 0. DevelopmentMode float64 `json:"development_mode,required"` + // Metadata about the zone + Meta ZoneNewResponseResultMeta `json:"meta,required"` // When the zone was last modified ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` // The domain name @@ -262,7 +272,12 @@ type ZoneNewResponseResult struct { // for full zones? OriginalNameServers []string `json:"original_name_servers,required,nullable" format:"hostname"` // Registrar for the domain at the time of switching to Cloudflare - OriginalRegistrar string `json:"original_registrar,required,nullable"` + OriginalRegistrar string `json:"original_registrar,required,nullable"` + // The owner of the zone + Owner ZoneNewResponseResultOwner `json:"owner,required"` + // An array of domains used for custom name servers. This is only available for + // Business and Enterprise plans. + VanityNameServers []string `json:"vanity_name_servers" format:"hostname"` JSON zoneNewResponseResultJSON `json:"-"` } @@ -270,14 +285,18 @@ type ZoneNewResponseResult struct { // [ZoneNewResponseResult] type zoneNewResponseResultJSON struct { ID apijson.Field + Account apijson.Field ActivatedOn apijson.Field CreatedOn apijson.Field DevelopmentMode apijson.Field + Meta apijson.Field ModifiedOn apijson.Field Name apijson.Field OriginalDnshost apijson.Field OriginalNameServers apijson.Field OriginalRegistrar apijson.Field + Owner apijson.Field + VanityNameServers apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -286,6 +305,89 @@ func (r *ZoneNewResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } +// The account the zone belongs to +type ZoneNewResponseResultAccount struct { + // Identifier + ID string `json:"id"` + // The name of the account + Name string `json:"name"` + JSON zoneNewResponseResultAccountJSON `json:"-"` +} + +// zoneNewResponseResultAccountJSON contains the JSON metadata for the struct +// [ZoneNewResponseResultAccount] +type zoneNewResponseResultAccountJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneNewResponseResultAccount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Metadata about the zone +type ZoneNewResponseResultMeta struct { + // The zone is only configured for CDN + CdnOnly bool `json:"cdn_only"` + // Number of Custom Certificates the zone can have + CustomCertificateQuota int64 `json:"custom_certificate_quota"` + // The zone is only configured for DNS + DNSOnly bool `json:"dns_only"` + // The zone is setup with Foundation DNS + FoundationDNS bool `json:"foundation_dns"` + // Number of Page Rules a zone can have + PageRuleQuota int64 `json:"page_rule_quota"` + // The zone has been flagged for phishing + PhishingDetected bool `json:"phishing_detected"` + Step int64 `json:"step"` + JSON zoneNewResponseResultMetaJSON `json:"-"` +} + +// zoneNewResponseResultMetaJSON contains the JSON metadata for the struct +// [ZoneNewResponseResultMeta] +type zoneNewResponseResultMetaJSON struct { + CdnOnly apijson.Field + CustomCertificateQuota apijson.Field + DNSOnly apijson.Field + FoundationDNS apijson.Field + PageRuleQuota apijson.Field + PhishingDetected apijson.Field + Step apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneNewResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The owner of the zone +type ZoneNewResponseResultOwner struct { + // Identifier + ID string `json:"id"` + // Name of the owner + Name string `json:"name"` + // The type of owner + Type string `json:"type"` + JSON zoneNewResponseResultOwnerJSON `json:"-"` +} + +// zoneNewResponseResultOwnerJSON contains the JSON metadata for the struct +// [ZoneNewResponseResultOwner] +type zoneNewResponseResultOwnerJSON struct { + ID apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneNewResponseResultOwner) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + type ZoneGetResponse struct { Errors []ZoneGetResponseError `json:"errors"` Messages []ZoneGetResponseMessage `json:"messages"` @@ -350,6 +452,8 @@ func (r *ZoneGetResponseMessage) UnmarshalJSON(data []byte) (err error) { type ZoneGetResponseResult struct { // Identifier ID string `json:"id,required"` + // The account the zone belongs to + Account ZoneGetResponseResultAccount `json:"account,required"` // The last time proof of ownership was detected and the zone was made active ActivatedOn time.Time `json:"activated_on,required,nullable" format:"date-time"` // When the zone was created @@ -358,6 +462,8 @@ type ZoneGetResponseResult struct { // or last expired (negative integer) for the domain. If development mode has never // been enabled, this value is 0. DevelopmentMode float64 `json:"development_mode,required"` + // Metadata about the zone + Meta ZoneGetResponseResultMeta `json:"meta,required"` // When the zone was last modified ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` // The domain name @@ -368,7 +474,12 @@ type ZoneGetResponseResult struct { // for full zones? OriginalNameServers []string `json:"original_name_servers,required,nullable" format:"hostname"` // Registrar for the domain at the time of switching to Cloudflare - OriginalRegistrar string `json:"original_registrar,required,nullable"` + OriginalRegistrar string `json:"original_registrar,required,nullable"` + // The owner of the zone + Owner ZoneGetResponseResultOwner `json:"owner,required"` + // An array of domains used for custom name servers. This is only available for + // Business and Enterprise plans. + VanityNameServers []string `json:"vanity_name_servers" format:"hostname"` JSON zoneGetResponseResultJSON `json:"-"` } @@ -376,14 +487,18 @@ type ZoneGetResponseResult struct { // [ZoneGetResponseResult] type zoneGetResponseResultJSON struct { ID apijson.Field + Account apijson.Field ActivatedOn apijson.Field CreatedOn apijson.Field DevelopmentMode apijson.Field + Meta apijson.Field ModifiedOn apijson.Field Name apijson.Field OriginalDnshost apijson.Field OriginalNameServers apijson.Field OriginalRegistrar apijson.Field + Owner apijson.Field + VanityNameServers apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -392,6 +507,89 @@ func (r *ZoneGetResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } +// The account the zone belongs to +type ZoneGetResponseResultAccount struct { + // Identifier + ID string `json:"id"` + // The name of the account + Name string `json:"name"` + JSON zoneGetResponseResultAccountJSON `json:"-"` +} + +// zoneGetResponseResultAccountJSON contains the JSON metadata for the struct +// [ZoneGetResponseResultAccount] +type zoneGetResponseResultAccountJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneGetResponseResultAccount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Metadata about the zone +type ZoneGetResponseResultMeta struct { + // The zone is only configured for CDN + CdnOnly bool `json:"cdn_only"` + // Number of Custom Certificates the zone can have + CustomCertificateQuota int64 `json:"custom_certificate_quota"` + // The zone is only configured for DNS + DNSOnly bool `json:"dns_only"` + // The zone is setup with Foundation DNS + FoundationDNS bool `json:"foundation_dns"` + // Number of Page Rules a zone can have + PageRuleQuota int64 `json:"page_rule_quota"` + // The zone has been flagged for phishing + PhishingDetected bool `json:"phishing_detected"` + Step int64 `json:"step"` + JSON zoneGetResponseResultMetaJSON `json:"-"` +} + +// zoneGetResponseResultMetaJSON contains the JSON metadata for the struct +// [ZoneGetResponseResultMeta] +type zoneGetResponseResultMetaJSON struct { + CdnOnly apijson.Field + CustomCertificateQuota apijson.Field + DNSOnly apijson.Field + FoundationDNS apijson.Field + PageRuleQuota apijson.Field + PhishingDetected apijson.Field + Step apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneGetResponseResultMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The owner of the zone +type ZoneGetResponseResultOwner struct { + // Identifier + ID string `json:"id"` + // Name of the owner + Name string `json:"name"` + // The type of owner + Type string `json:"type"` + JSON zoneGetResponseResultOwnerJSON `json:"-"` +} + +// zoneGetResponseResultOwnerJSON contains the JSON metadata for the struct +// [ZoneGetResponseResultOwner] +type zoneGetResponseResultOwnerJSON struct { + ID apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneGetResponseResultOwner) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + type ZoneUpdateResponse struct { Errors []ZoneUpdateResponseError `json:"errors"` Messages []ZoneUpdateResponseMessage `json:"messages"` @@ -457,6 +655,8 @@ func (r *ZoneUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { type ZoneUpdateResponseResult struct { // Identifier ID string `json:"id,required"` + // The account the zone belongs to + Account ZoneUpdateResponseResultAccount `json:"account,required"` // The last time proof of ownership was detected and the zone was made active ActivatedOn time.Time `json:"activated_on,required,nullable" format:"date-time"` // When the zone was created @@ -465,6 +665,8 @@ type ZoneUpdateResponseResult struct { // or last expired (negative integer) for the domain. If development mode has never // been enabled, this value is 0. DevelopmentMode float64 `json:"development_mode,required"` + // Metadata about the zone + Meta ZoneUpdateResponseResultMeta `json:"meta,required"` // When the zone was last modified ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` // The domain name @@ -475,7 +677,12 @@ type ZoneUpdateResponseResult struct { // for full zones? OriginalNameServers []string `json:"original_name_servers,required,nullable" format:"hostname"` // Registrar for the domain at the time of switching to Cloudflare - OriginalRegistrar string `json:"original_registrar,required,nullable"` + OriginalRegistrar string `json:"original_registrar,required,nullable"` + // The owner of the zone + Owner ZoneUpdateResponseResultOwner `json:"owner,required"` + // An array of domains used for custom name servers. This is only available for + // Business and Enterprise plans. + VanityNameServers []string `json:"vanity_name_servers" format:"hostname"` JSON zoneUpdateResponseResultJSON `json:"-"` } @@ -483,14 +690,18 @@ type ZoneUpdateResponseResult struct { // [ZoneUpdateResponseResult] type zoneUpdateResponseResultJSON struct { ID apijson.Field + Account apijson.Field ActivatedOn apijson.Field CreatedOn apijson.Field DevelopmentMode apijson.Field + Meta apijson.Field ModifiedOn apijson.Field Name apijson.Field OriginalDnshost apijson.Field OriginalNameServers apijson.Field OriginalRegistrar apijson.Field + Owner apijson.Field + VanityNameServers apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -499,73 +710,94 @@ func (r *ZoneUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZoneListResponse struct { - Errors []ZoneListResponseError `json:"errors"` - Messages []ZoneListResponseMessage `json:"messages"` - Result []ZoneListResponseResult `json:"result"` - ResultInfo ZoneListResponseResultInfo `json:"result_info"` - // Whether the API call was successful - Success bool `json:"success"` - JSON zoneListResponseJSON `json:"-"` +// The account the zone belongs to +type ZoneUpdateResponseResultAccount struct { + // Identifier + ID string `json:"id"` + // The name of the account + Name string `json:"name"` + JSON zoneUpdateResponseResultAccountJSON `json:"-"` } -// zoneListResponseJSON contains the JSON metadata for the struct -// [ZoneListResponse] -type zoneListResponseJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - ResultInfo apijson.Field - Success apijson.Field +// zoneUpdateResponseResultAccountJSON contains the JSON metadata for the struct +// [ZoneUpdateResponseResultAccount] +type zoneUpdateResponseResultAccountJSON struct { + ID apijson.Field + Name apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneUpdateResponseResultAccount) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZoneListResponseError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneListResponseErrorJSON `json:"-"` -} - -// zoneListResponseErrorJSON contains the JSON metadata for the struct -// [ZoneListResponseError] -type zoneListResponseErrorJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneListResponseError) UnmarshalJSON(data []byte) (err error) { +// Metadata about the zone +type ZoneUpdateResponseResultMeta struct { + // The zone is only configured for CDN + CdnOnly bool `json:"cdn_only"` + // Number of Custom Certificates the zone can have + CustomCertificateQuota int64 `json:"custom_certificate_quota"` + // The zone is only configured for DNS + DNSOnly bool `json:"dns_only"` + // The zone is setup with Foundation DNS + FoundationDNS bool `json:"foundation_dns"` + // Number of Page Rules a zone can have + PageRuleQuota int64 `json:"page_rule_quota"` + // The zone has been flagged for phishing + PhishingDetected bool `json:"phishing_detected"` + Step int64 `json:"step"` + JSON zoneUpdateResponseResultMetaJSON `json:"-"` +} + +// zoneUpdateResponseResultMetaJSON contains the JSON metadata for the struct +// [ZoneUpdateResponseResultMeta] +type zoneUpdateResponseResultMetaJSON struct { + CdnOnly apijson.Field + CustomCertificateQuota apijson.Field + DNSOnly apijson.Field + FoundationDNS apijson.Field + PageRuleQuota apijson.Field + PhishingDetected apijson.Field + Step apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneUpdateResponseResultMeta) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZoneListResponseMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneListResponseMessageJSON `json:"-"` +// The owner of the zone +type ZoneUpdateResponseResultOwner struct { + // Identifier + ID string `json:"id"` + // Name of the owner + Name string `json:"name"` + // The type of owner + Type string `json:"type"` + JSON zoneUpdateResponseResultOwnerJSON `json:"-"` } -// zoneListResponseMessageJSON contains the JSON metadata for the struct -// [ZoneListResponseMessage] -type zoneListResponseMessageJSON struct { - Code apijson.Field - Message apijson.Field +// zoneUpdateResponseResultOwnerJSON contains the JSON metadata for the struct +// [ZoneUpdateResponseResultOwner] +type zoneUpdateResponseResultOwnerJSON struct { + ID apijson.Field + Name apijson.Field + Type apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneListResponseMessage) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneUpdateResponseResultOwner) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZoneListResponseResult struct { +type ZoneListResponse struct { // Identifier ID string `json:"id,required"` + // The account the zone belongs to + Account ZoneListResponseAccount `json:"account,required"` // The last time proof of ownership was detected and the zone was made active ActivatedOn time.Time `json:"activated_on,required,nullable" format:"date-time"` // When the zone was created @@ -574,6 +806,8 @@ type ZoneListResponseResult struct { // or last expired (negative integer) for the domain. If development mode has never // been enabled, this value is 0. DevelopmentMode float64 `json:"development_mode,required"` + // Metadata about the zone + Meta ZoneListResponseMeta `json:"meta,required"` // When the zone was last modified ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` // The domain name @@ -584,54 +818,199 @@ type ZoneListResponseResult struct { // for full zones? OriginalNameServers []string `json:"original_name_servers,required,nullable" format:"hostname"` // Registrar for the domain at the time of switching to Cloudflare - OriginalRegistrar string `json:"original_registrar,required,nullable"` - JSON zoneListResponseResultJSON `json:"-"` + OriginalRegistrar string `json:"original_registrar,required,nullable"` + // The owner of the zone + Owner ZoneListResponseOwner `json:"owner,required"` + // An array of domains used for custom name servers. This is only available for + // Business and Enterprise plans. + VanityNameServers []string `json:"vanity_name_servers" format:"hostname"` + JSON zoneListResponseJSON `json:"-"` } -// zoneListResponseResultJSON contains the JSON metadata for the struct -// [ZoneListResponseResult] -type zoneListResponseResultJSON struct { +// zoneListResponseJSON contains the JSON metadata for the struct +// [ZoneListResponse] +type zoneListResponseJSON struct { ID apijson.Field + Account apijson.Field ActivatedOn apijson.Field CreatedOn apijson.Field DevelopmentMode apijson.Field + Meta apijson.Field ModifiedOn apijson.Field Name apijson.Field OriginalDnshost apijson.Field OriginalNameServers apijson.Field OriginalRegistrar apijson.Field + Owner apijson.Field + VanityNameServers apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneListResponseResult) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The account the zone belongs to +type ZoneListResponseAccount struct { + // Identifier + ID string `json:"id"` + // The name of the account + Name string `json:"name"` + JSON zoneListResponseAccountJSON `json:"-"` +} + +// zoneListResponseAccountJSON contains the JSON metadata for the struct +// [ZoneListResponseAccount] +type zoneListResponseAccountJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneListResponseAccount) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Metadata about the zone +type ZoneListResponseMeta struct { + // The zone is only configured for CDN + CdnOnly bool `json:"cdn_only"` + // Number of Custom Certificates the zone can have + CustomCertificateQuota int64 `json:"custom_certificate_quota"` + // The zone is only configured for DNS + DNSOnly bool `json:"dns_only"` + // The zone is setup with Foundation DNS + FoundationDNS bool `json:"foundation_dns"` + // Number of Page Rules a zone can have + PageRuleQuota int64 `json:"page_rule_quota"` + // The zone has been flagged for phishing + PhishingDetected bool `json:"phishing_detected"` + Step int64 `json:"step"` + JSON zoneListResponseMetaJSON `json:"-"` +} + +// zoneListResponseMetaJSON contains the JSON metadata for the struct +// [ZoneListResponseMeta] +type zoneListResponseMetaJSON struct { + CdnOnly apijson.Field + CustomCertificateQuota apijson.Field + DNSOnly apijson.Field + FoundationDNS apijson.Field + PageRuleQuota apijson.Field + PhishingDetected apijson.Field + Step apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneListResponseMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The owner of the zone +type ZoneListResponseOwner struct { + // Identifier + ID string `json:"id"` + // Name of the owner + Name string `json:"name"` + // The type of owner + Type string `json:"type"` + JSON zoneListResponseOwnerJSON `json:"-"` +} + +// zoneListResponseOwnerJSON contains the JSON metadata for the struct +// [ZoneListResponseOwner] +type zoneListResponseOwnerJSON struct { + ID apijson.Field + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneListResponseOwner) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDeleteResponse struct { + Errors []ZoneDeleteResponseError `json:"errors"` + Messages []ZoneDeleteResponseMessage `json:"messages"` + Result ZoneDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneDeleteResponseJSON `json:"-"` +} + +// zoneDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneDeleteResponse] +type zoneDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDeleteResponseErrorJSON `json:"-"` +} + +// zoneDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneDeleteResponseError] +type zoneDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDeleteResponseError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZoneListResponseResultInfo struct { - // Total number of results for the requested service - Count float64 `json:"count"` - // Current page within paginated list of results - Page float64 `json:"page"` - // Number of results per page of results - PerPage float64 `json:"per_page"` - // Total results available without any search parameters - TotalCount float64 `json:"total_count"` - JSON zoneListResponseResultInfoJSON `json:"-"` -} - -// zoneListResponseResultInfoJSON contains the JSON metadata for the struct -// [ZoneListResponseResultInfo] -type zoneListResponseResultInfoJSON struct { - Count apijson.Field - Page apijson.Field - PerPage apijson.Field - TotalCount apijson.Field +type ZoneDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDeleteResponseMessageJSON `json:"-"` +} + +// zoneDeleteResponseMessageJSON contains the JSON metadata for the struct +// [ZoneDeleteResponseMessage] +type zoneDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON zoneDeleteResponseResultJSON `json:"-"` +} + +// zoneDeleteResponseResultJSON contains the JSON metadata for the struct +// [ZoneDeleteResponseResult] +type zoneDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } @@ -662,8 +1041,9 @@ func (r ZoneNewParamsAccount) MarshalJSON() (data []byte, err error) { type ZoneNewParamsType string const ( - ZoneNewParamsTypeFull ZoneNewParamsType = "full" - ZoneNewParamsTypePartial ZoneNewParamsType = "partial" + ZoneNewParamsTypeFull ZoneNewParamsType = "full" + ZoneNewParamsTypePartial ZoneNewParamsType = "partial" + ZoneNewParamsTypeSecondary ZoneNewParamsType = "secondary" ) type ZoneUpdateParams struct { @@ -704,8 +1084,9 @@ func (r ZoneUpdateParamsPlan) MarshalJSON() (data []byte, err error) { type ZoneUpdateParamsType string const ( - ZoneUpdateParamsTypeFull ZoneUpdateParamsType = "full" - ZoneUpdateParamsTypePartial ZoneUpdateParamsType = "partial" + ZoneUpdateParamsTypeFull ZoneUpdateParamsType = "full" + ZoneUpdateParamsTypePartial ZoneUpdateParamsType = "partial" + ZoneUpdateParamsTypeSecondary ZoneUpdateParamsType = "secondary" ) type ZoneListParams struct { @@ -714,15 +1095,26 @@ type ZoneListParams struct { Direction param.Field[ZoneListParamsDirection] `query:"direction"` // Whether to match all search requirements or at least one (any). Match param.Field[ZoneListParamsMatch] `query:"match"` - // A domain name. - Name param.Field[string] `query:"name" format:"hostname"` + // A domain name. Optional filter operators can be provided to extend refine the + // search: + // + // - `equal` (default) + // - `not_equal` + // - `starts_with` + // - `ends_with` + // - `contains` + // - `starts_with_case_sensitive` + // - `ends_with_case_sensitive` + // - `contains_case_sensitive` + Name param.Field[string] `query:"name"` // Field to order zones by. Order param.Field[ZoneListParamsOrder] `query:"order"` // Page number of paginated results. Page param.Field[float64] `query:"page"` // Number of zones per page. PerPage param.Field[float64] `query:"per_page"` - Status param.Field[string] `query:"status"` + // A zone status + Status param.Field[ZoneListParamsStatus] `query:"status"` } // URLQuery serializes [ZoneListParams]'s query parameters as `url.Values`. @@ -734,7 +1126,19 @@ func (r ZoneListParams) URLQuery() (v url.Values) { } type ZoneListParamsAccount struct { - ID param.Field[string] `query:"id"` + // An account ID + ID param.Field[string] `query:"id"` + // An account Name. Optional filter operators can be provided to extend refine the + // search: + // + // - `equal` (default) + // - `not_equal` + // - `starts_with` + // - `ends_with` + // - `contains` + // - `starts_with_case_sensitive` + // - `ends_with_case_sensitive` + // - `contains_case_sensitive` Name param.Field[string] `query:"name"` } @@ -771,3 +1175,13 @@ const ( ZoneListParamsOrderAccountID ZoneListParamsOrder = "account.id" ZoneListParamsOrderAccountName ZoneListParamsOrder = "account.name" ) + +// A zone status +type ZoneListParamsStatus string + +const ( + ZoneListParamsStatusInitializing ZoneListParamsStatus = "initializing" + ZoneListParamsStatusPending ZoneListParamsStatus = "pending" + ZoneListParamsStatusActive ZoneListParamsStatus = "active" + ZoneListParamsStatusMoved ZoneListParamsStatus = "moved" +) diff --git a/zone_test.go b/zone_test.go index c01e7ce3475..6540c3d3181 100644 --- a/zone_test.go +++ b/zone_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneNewWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneNewWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.New(context.TODO(), cloudflare.ZoneNewParams{ Account: cloudflare.F(cloudflare.ZoneNewParamsAccount{ @@ -43,6 +46,7 @@ func TestZoneNewWithOptionalParams(t *testing.T) { } func TestZoneGet(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 @@ -52,8 +56,10 @@ func TestZoneGet(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Get(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { @@ -66,6 +72,7 @@ func TestZoneGet(t *testing.T) { } func TestZoneUpdateWithOptionalParams(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 @@ -75,8 +82,10 @@ func TestZoneUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Update( context.TODO(), @@ -99,6 +108,7 @@ func TestZoneUpdateWithOptionalParams(t *testing.T) { } func TestZoneListWithOptionalParams(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 @@ -108,8 +118,10 @@ func TestZoneListWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.List(context.TODO(), cloudflare.ZoneListParams{ Account: cloudflare.F(cloudflare.ZoneListParamsAccount{ @@ -118,11 +130,11 @@ func TestZoneListWithOptionalParams(t *testing.T) { }), Direction: cloudflare.F(cloudflare.ZoneListParamsDirectionDesc), Match: cloudflare.F(cloudflare.ZoneListParamsMatchAny), - Name: cloudflare.F("example.com"), + Name: cloudflare.F("string"), Order: cloudflare.F(cloudflare.ZoneListParamsOrderStatus), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(5.000000), - Status: cloudflare.F("string"), + Status: cloudflare.F(cloudflare.ZoneListParamsStatusInitializing), }) if err != nil { var apierr *cloudflare.Error @@ -144,8 +156,10 @@ func TestZoneDelete(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Delete(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zoneaccess.go b/zoneaccess.go new file mode 100644 index 00000000000..2f07ad56a5e --- /dev/null +++ b/zoneaccess.go @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAccessService 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 [NewZoneAccessService] method instead. +type ZoneAccessService struct { + Options []option.RequestOption + Certificates *ZoneAccessCertificateService + Groups *ZoneAccessGroupService + IdentityProviders *ZoneAccessIdentityProviderService + Organizations *ZoneAccessOrganizationService + ServiceTokens *ZoneAccessServiceTokenService +} + +// NewZoneAccessService 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 NewZoneAccessService(opts ...option.RequestOption) (r *ZoneAccessService) { + r = &ZoneAccessService{} + r.Options = opts + r.Certificates = NewZoneAccessCertificateService(opts...) + r.Groups = NewZoneAccessGroupService(opts...) + r.IdentityProviders = NewZoneAccessIdentityProviderService(opts...) + r.Organizations = NewZoneAccessOrganizationService(opts...) + r.ServiceTokens = NewZoneAccessServiceTokenService(opts...) + return +} diff --git a/zoneaccesscertificate.go b/zoneaccesscertificate.go new file mode 100644 index 00000000000..26e6318d0a9 --- /dev/null +++ b/zoneaccesscertificate.go @@ -0,0 +1,623 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAccessCertificateService 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 [NewZoneAccessCertificateService] +// method instead. +type ZoneAccessCertificateService struct { + Options []option.RequestOption + Settings *ZoneAccessCertificateSettingService +} + +// NewZoneAccessCertificateService 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 NewZoneAccessCertificateService(opts ...option.RequestOption) (r *ZoneAccessCertificateService) { + r = &ZoneAccessCertificateService{} + r.Options = opts + r.Settings = NewZoneAccessCertificateSettingService(opts...) + return +} + +// Fetches a single mTLS certificate. +func (r *ZoneAccessCertificateService) Get(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *ZoneAccessCertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/certificates/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured mTLS certificate. +func (r *ZoneAccessCertificateService) Update(ctx context.Context, identifier string, uuid string, body ZoneAccessCertificateUpdateParams, opts ...option.RequestOption) (res *ZoneAccessCertificateUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/certificates/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists all mTLS certificates. +func (r *ZoneAccessCertificateService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneAccessCertificateListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/certificates", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an mTLS certificate. +func (r *ZoneAccessCertificateService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *ZoneAccessCertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/certificates/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds a new mTLS root certificate to Access. +func (r *ZoneAccessCertificateService) Add(ctx context.Context, identifier string, body ZoneAccessCertificateAddParams, opts ...option.RequestOption) (res *ZoneAccessCertificateAddResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/certificates", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneAccessCertificateGetResponse struct { + Errors []ZoneAccessCertificateGetResponseError `json:"errors"` + Messages []ZoneAccessCertificateGetResponseMessage `json:"messages"` + Result ZoneAccessCertificateGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessCertificateGetResponseSuccess `json:"success"` + JSON zoneAccessCertificateGetResponseJSON `json:"-"` +} + +// zoneAccessCertificateGetResponseJSON contains the JSON metadata for the struct +// [ZoneAccessCertificateGetResponse] +type zoneAccessCertificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateGetResponseErrorJSON `json:"-"` +} + +// zoneAccessCertificateGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateGetResponseError] +type zoneAccessCertificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateGetResponseMessageJSON `json:"-"` +} + +// zoneAccessCertificateGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateGetResponseMessage] +type zoneAccessCertificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateGetResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessCertificateGetResponseResultJSON `json:"-"` +} + +// zoneAccessCertificateGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateGetResponseResult] +type zoneAccessCertificateGetResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessCertificateGetResponseSuccess bool + +const ( + ZoneAccessCertificateGetResponseSuccessTrue ZoneAccessCertificateGetResponseSuccess = true +) + +type ZoneAccessCertificateUpdateResponse struct { + Errors []ZoneAccessCertificateUpdateResponseError `json:"errors"` + Messages []ZoneAccessCertificateUpdateResponseMessage `json:"messages"` + Result ZoneAccessCertificateUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessCertificateUpdateResponseSuccess `json:"success"` + JSON zoneAccessCertificateUpdateResponseJSON `json:"-"` +} + +// zoneAccessCertificateUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateUpdateResponse] +type zoneAccessCertificateUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateUpdateResponseErrorJSON `json:"-"` +} + +// zoneAccessCertificateUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateUpdateResponseError] +type zoneAccessCertificateUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateUpdateResponseMessageJSON `json:"-"` +} + +// zoneAccessCertificateUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAccessCertificateUpdateResponseMessage] +type zoneAccessCertificateUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateUpdateResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessCertificateUpdateResponseResultJSON `json:"-"` +} + +// zoneAccessCertificateUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateUpdateResponseResult] +type zoneAccessCertificateUpdateResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessCertificateUpdateResponseSuccess bool + +const ( + ZoneAccessCertificateUpdateResponseSuccessTrue ZoneAccessCertificateUpdateResponseSuccess = true +) + +type ZoneAccessCertificateListResponse struct { + Errors []ZoneAccessCertificateListResponseError `json:"errors"` + Messages []ZoneAccessCertificateListResponseMessage `json:"messages"` + Result []ZoneAccessCertificateListResponseResult `json:"result"` + ResultInfo ZoneAccessCertificateListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneAccessCertificateListResponseSuccess `json:"success"` + JSON zoneAccessCertificateListResponseJSON `json:"-"` +} + +// zoneAccessCertificateListResponseJSON contains the JSON metadata for the struct +// [ZoneAccessCertificateListResponse] +type zoneAccessCertificateListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateListResponseErrorJSON `json:"-"` +} + +// zoneAccessCertificateListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateListResponseError] +type zoneAccessCertificateListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateListResponseMessageJSON `json:"-"` +} + +// zoneAccessCertificateListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateListResponseMessage] +type zoneAccessCertificateListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateListResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessCertificateListResponseResultJSON `json:"-"` +} + +// zoneAccessCertificateListResponseResultJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateListResponseResult] +type zoneAccessCertificateListResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAccessCertificateListResponseResultInfoJSON `json:"-"` +} + +// zoneAccessCertificateListResponseResultInfoJSON contains the JSON metadata for +// the struct [ZoneAccessCertificateListResponseResultInfo] +type zoneAccessCertificateListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessCertificateListResponseSuccess bool + +const ( + ZoneAccessCertificateListResponseSuccessTrue ZoneAccessCertificateListResponseSuccess = true +) + +type ZoneAccessCertificateDeleteResponse struct { + Errors []ZoneAccessCertificateDeleteResponseError `json:"errors"` + Messages []ZoneAccessCertificateDeleteResponseMessage `json:"messages"` + Result ZoneAccessCertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessCertificateDeleteResponseSuccess `json:"success"` + JSON zoneAccessCertificateDeleteResponseJSON `json:"-"` +} + +// zoneAccessCertificateDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateDeleteResponse] +type zoneAccessCertificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateDeleteResponseErrorJSON `json:"-"` +} + +// zoneAccessCertificateDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateDeleteResponseError] +type zoneAccessCertificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateDeleteResponseMessageJSON `json:"-"` +} + +// zoneAccessCertificateDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAccessCertificateDeleteResponseMessage] +type zoneAccessCertificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON zoneAccessCertificateDeleteResponseResultJSON `json:"-"` +} + +// zoneAccessCertificateDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateDeleteResponseResult] +type zoneAccessCertificateDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessCertificateDeleteResponseSuccess bool + +const ( + ZoneAccessCertificateDeleteResponseSuccessTrue ZoneAccessCertificateDeleteResponseSuccess = true +) + +type ZoneAccessCertificateAddResponse struct { + Errors []ZoneAccessCertificateAddResponseError `json:"errors"` + Messages []ZoneAccessCertificateAddResponseMessage `json:"messages"` + Result ZoneAccessCertificateAddResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessCertificateAddResponseSuccess `json:"success"` + JSON zoneAccessCertificateAddResponseJSON `json:"-"` +} + +// zoneAccessCertificateAddResponseJSON contains the JSON metadata for the struct +// [ZoneAccessCertificateAddResponse] +type zoneAccessCertificateAddResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateAddResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateAddResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateAddResponseErrorJSON `json:"-"` +} + +// zoneAccessCertificateAddResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateAddResponseError] +type zoneAccessCertificateAddResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateAddResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateAddResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateAddResponseMessageJSON `json:"-"` +} + +// zoneAccessCertificateAddResponseMessageJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateAddResponseMessage] +type zoneAccessCertificateAddResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateAddResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateAddResponseResult struct { + // The ID of the application that will use this certificate. + ID interface{} `json:"id"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames []string `json:"associated_hostnames"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The MD5 fingerprint of the certificate. + Fingerprint string `json:"fingerprint"` + // The name of the certificate. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessCertificateAddResponseResultJSON `json:"-"` +} + +// zoneAccessCertificateAddResponseResultJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateAddResponseResult] +type zoneAccessCertificateAddResponseResultJSON struct { + ID apijson.Field + AssociatedHostnames apijson.Field + CreatedAt apijson.Field + ExpiresOn apijson.Field + Fingerprint apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateAddResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessCertificateAddResponseSuccess bool + +const ( + ZoneAccessCertificateAddResponseSuccessTrue ZoneAccessCertificateAddResponseSuccess = true +) + +type ZoneAccessCertificateUpdateParams struct { + // The hostnames of the applications that will use this certificate. + AssociatedHostnames param.Field[[]string] `json:"associated_hostnames,required"` + // The name of the certificate. + Name param.Field[string] `json:"name"` +} + +func (r ZoneAccessCertificateUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessCertificateAddParams struct { + // The certificate content. + Certificate param.Field[string] `json:"certificate,required"` + // The name of the certificate. + Name param.Field[string] `json:"name,required"` + // The hostnames of the applications that will use this certificate. + AssociatedHostnames param.Field[[]string] `json:"associated_hostnames"` +} + +func (r ZoneAccessCertificateAddParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneaccesscertificate_test.go b/zoneaccesscertificate_test.go new file mode 100644 index 00000000000..864bc4557c5 --- /dev/null +++ b/zoneaccesscertificate_test.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAccessCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Certificates.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestZoneAccessCertificateUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Certificates.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.ZoneAccessCertificateUpdateParams{ + AssociatedHostnames: cloudflare.F([]string{"admin.example.com", "admin.example.com", "admin.example.com"}), + Name: cloudflare.F("Allow devs"), + }, + ) + 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 TestZoneAccessCertificateList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Certificates.List(context.TODO(), "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()) + } +} + +func TestZoneAccessCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Certificates.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestZoneAccessCertificateAddWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Certificates.Add( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAccessCertificateAddParams{ + Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIGAjCCA+qgAwIBAgIJAI7kymlF7CWT...N4RI7KKB7nikiuUf8vhULKy5IX10\nDrUtmu/B\n-----END CERTIFICATE-----"), + Name: cloudflare.F("Allow devs"), + AssociatedHostnames: cloudflare.F([]string{"admin.example.com", "admin.example.com", "admin.example.com"}), + }, + ) + 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/zoneaccesscertificatesetting.go b/zoneaccesscertificatesetting.go new file mode 100644 index 00000000000..502ade2a6ca --- /dev/null +++ b/zoneaccesscertificatesetting.go @@ -0,0 +1,164 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAccessCertificateSettingService 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 +// [NewZoneAccessCertificateSettingService] method instead. +type ZoneAccessCertificateSettingService struct { + Options []option.RequestOption +} + +// NewZoneAccessCertificateSettingService 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 NewZoneAccessCertificateSettingService(opts ...option.RequestOption) (r *ZoneAccessCertificateSettingService) { + r = &ZoneAccessCertificateSettingService{} + r.Options = opts + return +} + +// List all mTLS hostname settings for this zone. +func (r *ZoneAccessCertificateSettingService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneAccessCertificateSettingListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/certificates/settings", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneAccessCertificateSettingListResponse struct { + Errors []ZoneAccessCertificateSettingListResponseError `json:"errors"` + Messages []ZoneAccessCertificateSettingListResponseMessage `json:"messages"` + Result []ZoneAccessCertificateSettingListResponseResult `json:"result"` + ResultInfo ZoneAccessCertificateSettingListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneAccessCertificateSettingListResponseSuccess `json:"success"` + JSON zoneAccessCertificateSettingListResponseJSON `json:"-"` +} + +// zoneAccessCertificateSettingListResponseJSON contains the JSON metadata for the +// struct [ZoneAccessCertificateSettingListResponse] +type zoneAccessCertificateSettingListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateSettingListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateSettingListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateSettingListResponseErrorJSON `json:"-"` +} + +// zoneAccessCertificateSettingListResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAccessCertificateSettingListResponseError] +type zoneAccessCertificateSettingListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateSettingListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateSettingListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessCertificateSettingListResponseMessageJSON `json:"-"` +} + +// zoneAccessCertificateSettingListResponseMessageJSON contains the JSON metadata +// for the struct [ZoneAccessCertificateSettingListResponseMessage] +type zoneAccessCertificateSettingListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateSettingListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateSettingListResponseResult struct { + // Request client certificates for this hostname in China. Can only be set to true + // if this zone is china network enabled. + ChinaNetwork bool `json:"china_network,required"` + // Client Certificate Forwarding is a feature that takes the client cert provided + // by the eyeball to the edge, and forwards it to the origin as a HTTP header to + // allow logging on the origin. + ClientCertificateForwarding bool `json:"client_certificate_forwarding,required"` + // The hostname that these settings apply to. + Hostname string `json:"hostname,required"` + JSON zoneAccessCertificateSettingListResponseResultJSON `json:"-"` +} + +// zoneAccessCertificateSettingListResponseResultJSON contains the JSON metadata +// for the struct [ZoneAccessCertificateSettingListResponseResult] +type zoneAccessCertificateSettingListResponseResultJSON struct { + ChinaNetwork apijson.Field + ClientCertificateForwarding apijson.Field + Hostname apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateSettingListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessCertificateSettingListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAccessCertificateSettingListResponseResultInfoJSON `json:"-"` +} + +// zoneAccessCertificateSettingListResponseResultInfoJSON contains the JSON +// metadata for the struct [ZoneAccessCertificateSettingListResponseResultInfo] +type zoneAccessCertificateSettingListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessCertificateSettingListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessCertificateSettingListResponseSuccess bool + +const ( + ZoneAccessCertificateSettingListResponseSuccessTrue ZoneAccessCertificateSettingListResponseSuccess = true +) diff --git a/zoneaccesscertificatesetting_test.go b/zoneaccesscertificatesetting_test.go new file mode 100644 index 00000000000..07b5208b758 --- /dev/null +++ b/zoneaccesscertificatesetting_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAccessCertificateSettingList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Certificates.Settings.List(context.TODO(), "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/zoneaccessgroup.go b/zoneaccessgroup.go new file mode 100644 index 00000000000..3fc6540b1eb --- /dev/null +++ b/zoneaccessgroup.go @@ -0,0 +1,12395 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAccessGroupService 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 [NewZoneAccessGroupService] method +// instead. +type ZoneAccessGroupService struct { + Options []option.RequestOption +} + +// NewZoneAccessGroupService 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 NewZoneAccessGroupService(opts ...option.RequestOption) (r *ZoneAccessGroupService) { + r = &ZoneAccessGroupService{} + r.Options = opts + return +} + +// Creates a new Access group. +func (r *ZoneAccessGroupService) New(ctx context.Context, identifier string, body ZoneAccessGroupNewParams, opts ...option.RequestOption) (res *ZoneAccessGroupNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/groups", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches a single Access group. +func (r *ZoneAccessGroupService) Get(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *ZoneAccessGroupGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/groups/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured Access group. +func (r *ZoneAccessGroupService) Update(ctx context.Context, identifier string, uuid string, body ZoneAccessGroupUpdateParams, opts ...option.RequestOption) (res *ZoneAccessGroupUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/groups/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists all Access groups. +func (r *ZoneAccessGroupService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneAccessGroupListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/groups", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an Access group. +func (r *ZoneAccessGroupService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *ZoneAccessGroupDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/groups/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type ZoneAccessGroupNewResponse struct { + Errors []ZoneAccessGroupNewResponseError `json:"errors"` + Messages []ZoneAccessGroupNewResponseMessage `json:"messages"` + Result ZoneAccessGroupNewResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessGroupNewResponseSuccess `json:"success"` + JSON zoneAccessGroupNewResponseJSON `json:"-"` +} + +// zoneAccessGroupNewResponseJSON contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponse] +type zoneAccessGroupNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupNewResponseErrorJSON `json:"-"` +} + +// zoneAccessGroupNewResponseErrorJSON contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseError] +type zoneAccessGroupNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupNewResponseMessageJSON `json:"-"` +} + +// zoneAccessGroupNewResponseMessageJSON contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseMessage] +type zoneAccessGroupNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupNewResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []ZoneAccessGroupNewResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []ZoneAccessGroupNewResponseResultInclude `json:"include"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []ZoneAccessGroupNewResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessGroupNewResponseResultJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultJSON contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResult] +type zoneAccessGroupNewResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqIPRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqCertificateRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRule], +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRule]. +type ZoneAccessGroupNewResponseResultExclude interface { + implementsZoneAccessGroupNewResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupNewResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRule struct { + Email ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleEmail] +type zoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqEveryoneRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupNewResponseResultExcludePajwohLqIPRule struct { + IP ZoneAccessGroupNewResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupNewResponseResultExcludePajwohLqIPRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqIPRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqIPRuleIP] +type zoneAccessGroupNewResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRule struct { + IPList ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleIPListJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleIPList] +type zoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupNewResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqCertificateRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqCertificateRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +// Matches an Access group. +type ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleGroupJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRule struct { + Geo ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleGeo] +type zoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRule] +type zoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRule) implementsZoneAccessGroupNewResponseResultExclude() { +} + +type ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqIPRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqCertificateRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRule], +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRule]. +type ZoneAccessGroupNewResponseResultInclude interface { + implementsZoneAccessGroupNewResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupNewResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRule struct { + Email ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleEmail] +type zoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqEveryoneRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupNewResponseResultIncludePajwohLqIPRule struct { + IP ZoneAccessGroupNewResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupNewResponseResultIncludePajwohLqIPRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqIPRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqIPRuleIP] +type zoneAccessGroupNewResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRule struct { + IPList ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleIPListJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleIPList] +type zoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupNewResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqCertificateRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqCertificateRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +// Matches an Access group. +type ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleGroupJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRule struct { + Geo ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleGeo] +type zoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRule] +type zoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRule) implementsZoneAccessGroupNewResponseResultInclude() { +} + +type ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqIPRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqCertificateRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRule], +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRule]. +type ZoneAccessGroupNewResponseResultRequire interface { + implementsZoneAccessGroupNewResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupNewResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRule struct { + Email ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleEmail] +type zoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleEmailList] +type zoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqEveryoneRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +// Matches an IP address block. +type ZoneAccessGroupNewResponseResultRequirePajwohLqIPRule struct { + IP ZoneAccessGroupNewResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupNewResponseResultRequirePajwohLqIPRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqIPRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqIPRuleIP] +type zoneAccessGroupNewResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRule struct { + IPList ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleIPListJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleIPList] +type zoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupNewResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqCertificateRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqCertificateRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +// Matches an Access group. +type ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleGroupJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRule struct { + Geo ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleGeo] +type zoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRule] +type zoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRule) implementsZoneAccessGroupNewResponseResultRequire() { +} + +type ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupNewResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessGroupNewResponseSuccess bool + +const ( + ZoneAccessGroupNewResponseSuccessTrue ZoneAccessGroupNewResponseSuccess = true +) + +type ZoneAccessGroupGetResponse struct { + Errors []ZoneAccessGroupGetResponseError `json:"errors"` + Messages []ZoneAccessGroupGetResponseMessage `json:"messages"` + Result ZoneAccessGroupGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessGroupGetResponseSuccess `json:"success"` + JSON zoneAccessGroupGetResponseJSON `json:"-"` +} + +// zoneAccessGroupGetResponseJSON contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponse] +type zoneAccessGroupGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupGetResponseErrorJSON `json:"-"` +} + +// zoneAccessGroupGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseError] +type zoneAccessGroupGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupGetResponseMessageJSON `json:"-"` +} + +// zoneAccessGroupGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseMessage] +type zoneAccessGroupGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupGetResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []ZoneAccessGroupGetResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []ZoneAccessGroupGetResponseResultInclude `json:"include"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []ZoneAccessGroupGetResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessGroupGetResponseResultJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResult] +type zoneAccessGroupGetResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqIPRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqCertificateRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRule], +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule]. +type ZoneAccessGroupGetResponseResultExclude interface { + implementsZoneAccessGroupGetResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupGetResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRule struct { + Email ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail] +type zoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqEveryoneRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupGetResponseResultExcludePajwohLqIPRule struct { + IP ZoneAccessGroupGetResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupGetResponseResultExcludePajwohLqIPRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqIPRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqIPRuleIP] +type zoneAccessGroupGetResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRule struct { + IPList ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPListJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList] +type zoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupGetResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqCertificateRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqCertificateRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +// Matches an Access group. +type ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroupJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRule struct { + Geo ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo] +type zoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule] +type zoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRule) implementsZoneAccessGroupGetResponseResultExclude() { +} + +type ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqIPRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqCertificateRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRule], +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule]. +type ZoneAccessGroupGetResponseResultInclude interface { + implementsZoneAccessGroupGetResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupGetResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRule struct { + Email ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail] +type zoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqEveryoneRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupGetResponseResultIncludePajwohLqIPRule struct { + IP ZoneAccessGroupGetResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupGetResponseResultIncludePajwohLqIPRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqIPRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqIPRuleIP] +type zoneAccessGroupGetResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRule struct { + IPList ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPListJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList] +type zoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupGetResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqCertificateRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqCertificateRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +// Matches an Access group. +type ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroupJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRule struct { + Geo ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo] +type zoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule] +type zoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRule) implementsZoneAccessGroupGetResponseResultInclude() { +} + +type ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqIPRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqCertificateRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRule], +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule]. +type ZoneAccessGroupGetResponseResultRequire interface { + implementsZoneAccessGroupGetResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupGetResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRule struct { + Email ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail] +type zoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList] +type zoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqEveryoneRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +// Matches an IP address block. +type ZoneAccessGroupGetResponseResultRequirePajwohLqIPRule struct { + IP ZoneAccessGroupGetResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupGetResponseResultRequirePajwohLqIPRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqIPRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqIPRuleIP] +type zoneAccessGroupGetResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRule struct { + IPList ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPListJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList] +type zoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupGetResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqCertificateRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqCertificateRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +// Matches an Access group. +type ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroupJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRule struct { + Geo ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo] +type zoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule] +type zoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRule) implementsZoneAccessGroupGetResponseResultRequire() { +} + +type ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupGetResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessGroupGetResponseSuccess bool + +const ( + ZoneAccessGroupGetResponseSuccessTrue ZoneAccessGroupGetResponseSuccess = true +) + +type ZoneAccessGroupUpdateResponse struct { + Errors []ZoneAccessGroupUpdateResponseError `json:"errors"` + Messages []ZoneAccessGroupUpdateResponseMessage `json:"messages"` + Result ZoneAccessGroupUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessGroupUpdateResponseSuccess `json:"success"` + JSON zoneAccessGroupUpdateResponseJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponse] +type zoneAccessGroupUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupUpdateResponseErrorJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseError] +type zoneAccessGroupUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupUpdateResponseMessageJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneAccessGroupUpdateResponseMessage] +type zoneAccessGroupUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupUpdateResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []ZoneAccessGroupUpdateResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []ZoneAccessGroupUpdateResponseResultInclude `json:"include"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []ZoneAccessGroupUpdateResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessGroupUpdateResponseResultJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneAccessGroupUpdateResponseResult] +type zoneAccessGroupUpdateResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRule], +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule]. +type ZoneAccessGroupUpdateResponseResultExclude interface { + implementsZoneAccessGroupUpdateResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupUpdateResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRule struct { + Email ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqEveryoneRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRule struct { + IP ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRule struct { + IPList ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqCertificateRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +// Matches an Access group. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRule struct { + Geo ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRule) implementsZoneAccessGroupUpdateResponseResultExclude() { +} + +type ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRule], +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule]. +type ZoneAccessGroupUpdateResponseResultInclude interface { + implementsZoneAccessGroupUpdateResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupUpdateResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRule struct { + Email ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqEveryoneRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRule struct { + IP ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRule struct { + IPList ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqCertificateRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +// Matches an Access group. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRule struct { + Geo ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRule) implementsZoneAccessGroupUpdateResponseResultInclude() { +} + +type ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRule], +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule]. +type ZoneAccessGroupUpdateResponseResultRequire interface { + implementsZoneAccessGroupUpdateResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupUpdateResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRule struct { + Email ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmailJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqEveryoneRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +// Matches an IP address block. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRule struct { + IP ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRule struct { + IPList ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqCertificateRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +// Matches an Access group. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRule struct { + Geo ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeoJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRule) implementsZoneAccessGroupUpdateResponseResultRequire() { +} + +type ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupUpdateResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessGroupUpdateResponseSuccess bool + +const ( + ZoneAccessGroupUpdateResponseSuccessTrue ZoneAccessGroupUpdateResponseSuccess = true +) + +type ZoneAccessGroupListResponse struct { + Errors []ZoneAccessGroupListResponseError `json:"errors"` + Messages []ZoneAccessGroupListResponseMessage `json:"messages"` + Result []ZoneAccessGroupListResponseResult `json:"result"` + ResultInfo ZoneAccessGroupListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneAccessGroupListResponseSuccess `json:"success"` + JSON zoneAccessGroupListResponseJSON `json:"-"` +} + +// zoneAccessGroupListResponseJSON contains the JSON metadata for the struct +// [ZoneAccessGroupListResponse] +type zoneAccessGroupListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupListResponseErrorJSON `json:"-"` +} + +// zoneAccessGroupListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseError] +type zoneAccessGroupListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupListResponseMessageJSON `json:"-"` +} + +// zoneAccessGroupListResponseMessageJSON contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseMessage] +type zoneAccessGroupListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupListResponseResult struct { + // UUID + ID string `json:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude []ZoneAccessGroupListResponseResultExclude `json:"exclude"` + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include []ZoneAccessGroupListResponseResultInclude `json:"include"` + // The name of the Access group. + Name string `json:"name"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require []ZoneAccessGroupListResponseResultRequire `json:"require"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessGroupListResponseResultJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultJSON contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResult] +type zoneAccessGroupListResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Exclude apijson.Field + Include apijson.Field + Name apijson.Field + Require apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupListResponseResultExcludePajwohLqEmailRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqDomainRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqEveryoneRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqIPRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqIPListRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqCertificateRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqCountryRule], +// [ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRule]. +type ZoneAccessGroupListResponseResultExclude interface { + implementsZoneAccessGroupListResponseResultExclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupListResponseResultExclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupListResponseResultExcludePajwohLqEmailRule struct { + Email ZoneAccessGroupListResponseResultExcludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqEmailRule] +type zoneAccessGroupListResponseResultExcludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqEmailRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqEmailRuleEmail] +type zoneAccessGroupListResponseResultExcludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRule] +type zoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupListResponseResultExcludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupListResponseResultExcludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqDomainRule] +type zoneAccessGroupListResponseResultExcludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqDomainRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupListResponseResultExcludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupListResponseResultExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqEveryoneRule] +type zoneAccessGroupListResponseResultExcludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqEveryoneRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupListResponseResultExcludePajwohLqIPRule struct { + IP ZoneAccessGroupListResponseResultExcludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupListResponseResultExcludePajwohLqIPRule] +type zoneAccessGroupListResponseResultExcludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqIPRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqIPRuleIP] +type zoneAccessGroupListResponseResultExcludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupListResponseResultExcludePajwohLqIPListRule struct { + IPList ZoneAccessGroupListResponseResultExcludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqIPListRule] +type zoneAccessGroupListResponseResultExcludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqIPListRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqIPListRuleIPList] +type zoneAccessGroupListResponseResultExcludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupListResponseResultExcludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqCertificateRule] +type zoneAccessGroupListResponseResultExcludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqCertificateRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +// Matches an Access group. +type ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRule] +type zoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRule] +type zoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRule] +type zoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRule] +type zoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRule] +type zoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRule] +type zoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRule] +type zoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupListResponseResultExcludePajwohLqCountryRule struct { + Geo ZoneAccessGroupListResponseResultExcludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqCountryRule] +type zoneAccessGroupListResponseResultExcludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqCountryRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqCountryRuleGeo] +type zoneAccessGroupListResponseResultExcludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRule] +type zoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRule) implementsZoneAccessGroupListResponseResultExclude() { +} + +type ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultExcludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupListResponseResultIncludePajwohLqEmailRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqDomainRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqEveryoneRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqIPRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqIPListRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqCertificateRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqCountryRule], +// [ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRule]. +type ZoneAccessGroupListResponseResultInclude interface { + implementsZoneAccessGroupListResponseResultInclude() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupListResponseResultInclude)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupListResponseResultIncludePajwohLqEmailRule struct { + Email ZoneAccessGroupListResponseResultIncludePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqEmailRule] +type zoneAccessGroupListResponseResultIncludePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqEmailRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqEmailRuleEmail] +type zoneAccessGroupListResponseResultIncludePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRule] +type zoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleEmailList] +type zoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupListResponseResultIncludePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupListResponseResultIncludePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqDomainRule] +type zoneAccessGroupListResponseResultIncludePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqDomainRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupListResponseResultIncludePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupListResponseResultIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqEveryoneRule] +type zoneAccessGroupListResponseResultIncludePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqEveryoneRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupListResponseResultIncludePajwohLqIPRule struct { + IP ZoneAccessGroupListResponseResultIncludePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupListResponseResultIncludePajwohLqIPRule] +type zoneAccessGroupListResponseResultIncludePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqIPRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqIPRuleIP] +type zoneAccessGroupListResponseResultIncludePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupListResponseResultIncludePajwohLqIPListRule struct { + IPList ZoneAccessGroupListResponseResultIncludePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqIPListRule] +type zoneAccessGroupListResponseResultIncludePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqIPListRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqIPListRuleIPList] +type zoneAccessGroupListResponseResultIncludePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupListResponseResultIncludePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqCertificateRule] +type zoneAccessGroupListResponseResultIncludePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqCertificateRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +// Matches an Access group. +type ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRule] +type zoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRule] +type zoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRule] +type zoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRule] +type zoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRule] +type zoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRule] +type zoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRule] +type zoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRule] +type zoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupListResponseResultIncludePajwohLqCountryRule struct { + Geo ZoneAccessGroupListResponseResultIncludePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqCountryRule] +type zoneAccessGroupListResponseResultIncludePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqCountryRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqCountryRuleGeo] +type zoneAccessGroupListResponseResultIncludePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRule] +type zoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRule] +type zoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRule) implementsZoneAccessGroupListResponseResultInclude() { +} + +type ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultIncludePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific email. +// +// Union satisfied by [ZoneAccessGroupListResponseResultRequirePajwohLqEmailRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqDomainRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqEveryoneRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqIPRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqIPListRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqCertificateRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqCountryRule], +// [ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRule] or +// [ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRule]. +type ZoneAccessGroupListResponseResultRequire interface { + implementsZoneAccessGroupListResponseResultRequire() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessGroupListResponseResultRequire)(nil)).Elem(), "") +} + +// Matches a specific email. +type ZoneAccessGroupListResponseResultRequirePajwohLqEmailRule struct { + Email ZoneAccessGroupListResponseResultRequirePajwohLqEmailRuleEmail `json:"email,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqEmailRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqEmailRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqEmailRule] +type zoneAccessGroupListResponseResultRequirePajwohLqEmailRuleJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqEmailRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqEmailRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email string `json:"email,required" format:"email"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqEmailRuleEmailJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqEmailRuleEmailJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqEmailRuleEmail] +type zoneAccessGroupListResponseResultRequirePajwohLqEmailRuleEmailJSON struct { + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqEmailRuleEmail) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an email address from a list. +type ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRule struct { + EmailList ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleEmailList `json:"email_list,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRule] +type zoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleJSON struct { + EmailList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleEmailListJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleEmailListJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleEmailList] +type zoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleEmailListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqEmailListRuleEmailList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Match an entire email domain. +type ZoneAccessGroupListResponseResultRequirePajwohLqDomainRule struct { + EmailDomain ZoneAccessGroupListResponseResultRequirePajwohLqDomainRuleEmailDomain `json:"email_domain,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqDomainRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqDomainRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqDomainRule] +type zoneAccessGroupListResponseResultRequirePajwohLqDomainRuleJSON struct { + EmailDomain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqDomainRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqDomainRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain string `json:"domain,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqDomainRuleEmailDomainJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqDomainRuleEmailDomainJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqDomainRuleEmailDomain] +type zoneAccessGroupListResponseResultRequirePajwohLqDomainRuleEmailDomainJSON struct { + Domain apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqDomainRuleEmailDomain) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches everyone. +type ZoneAccessGroupListResponseResultRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone interface{} `json:"everyone,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqEveryoneRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqEveryoneRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqEveryoneRule] +type zoneAccessGroupListResponseResultRequirePajwohLqEveryoneRuleJSON struct { + Everyone apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqEveryoneRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqEveryoneRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +// Matches an IP address block. +type ZoneAccessGroupListResponseResultRequirePajwohLqIPRule struct { + IP ZoneAccessGroupListResponseResultRequirePajwohLqIPRuleIP `json:"ip,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqIPRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqIPRuleJSON contains the JSON +// metadata for the struct [ZoneAccessGroupListResponseResultRequirePajwohLqIPRule] +type zoneAccessGroupListResponseResultRequirePajwohLqIPRuleJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqIPRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqIPRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP string `json:"ip,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqIPRuleIPJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqIPRuleIPJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqIPRuleIP] +type zoneAccessGroupListResponseResultRequirePajwohLqIPRuleIPJSON struct { + IP apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqIPRuleIP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupListResponseResultRequirePajwohLqIPListRule struct { + IPList ZoneAccessGroupListResponseResultRequirePajwohLqIPListRuleIPList `json:"ip_list,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqIPListRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqIPListRuleJSON contains the JSON +// metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqIPListRule] +type zoneAccessGroupListResponseResultRequirePajwohLqIPListRuleJSON struct { + IPList apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqIPListRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqIPListRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqIPListRuleIPListJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqIPListRuleIPListJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqIPListRuleIPList] +type zoneAccessGroupListResponseResultRequirePajwohLqIPListRuleIPListJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqIPListRuleIPList) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupListResponseResultRequirePajwohLqCertificateRule struct { + Certificate interface{} `json:"certificate,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqCertificateRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqCertificateRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqCertificateRule] +type zoneAccessGroupListResponseResultRequirePajwohLqCertificateRuleJSON struct { + Certificate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqCertificateRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqCertificateRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +// Matches an Access group. +type ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRule struct { + Group ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleGroup `json:"group,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRule] +type zoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleJSON struct { + Group apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID string `json:"id,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleGroupJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleGroup] +type zoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleGroupJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqAccessGroupRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRule struct { + AzureAd ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleAzureAd `json:"azureAD,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRule] +type zoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleJSON struct { + AzureAd apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID string `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID string `json:"connection_id,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleAzureAd] +type zoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleAzureAdJSON struct { + ID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqAzureGroupRuleAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization `json:"github-organization,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRule] +type zoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleJSON struct { + GitHubOrganization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID string `json:"connection_id,required"` + // The name of the organization. + Name string `json:"name,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] +type zoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganizationJSON struct { + ConnectionID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRule struct { + Gsuite ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleGsuite `json:"gsuite,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRule] +type zoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleJSON struct { + Gsuite apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Google Workspace group. + Email string `json:"email,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleGsuite] +type zoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleGsuiteJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqGsuiteGroupRuleGsuite) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRule struct { + Okta ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleOkta `json:"okta,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRule] +type zoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleJSON struct { + Okta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID string `json:"connection_id,required"` + // The email of the Okta group. + Email string `json:"email,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleOktaJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleOkta] +type zoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleOktaJSON struct { + ConnectionID apijson.Field + Email apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqOktaGroupRuleOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRule struct { + Saml ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleSaml `json:"saml,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRule] +type zoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleJSON struct { + Saml apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName string `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue string `json:"attribute_value,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleSamlJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleSaml] +type zoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleSamlJSON struct { + AttributeName apijson.Field + AttributeValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqSamlGroupRuleSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRule struct { + ServiceToken ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleServiceToken `json:"service_token,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRule] +type zoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleJSON struct { + ServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID string `json:"token_id,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleServiceToken] +type zoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleServiceTokenJSON struct { + TokenID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqServiceTokenRuleServiceToken) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken interface{} `json:"any_valid_service_token,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRule] +type zoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRuleJSON struct { + AnyValidServiceToken apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation `json:"external_evaluation,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRule] +type zoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleJSON struct { + ExternalEvaluation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL string `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL string `json:"keys_url,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation] +type zoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluationJSON struct { + EvaluateURL apijson.Field + KeysURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqExternalEvaluationRuleExternalEvaluation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Matches a specific country +type ZoneAccessGroupListResponseResultRequirePajwohLqCountryRule struct { + Geo ZoneAccessGroupListResponseResultRequirePajwohLqCountryRuleGeo `json:"geo,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqCountryRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqCountryRuleJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqCountryRule] +type zoneAccessGroupListResponseResultRequirePajwohLqCountryRuleJSON struct { + Geo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqCountryRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqCountryRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode string `json:"country_code,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqCountryRuleGeoJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqCountryRuleGeoJSON contains the +// JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqCountryRuleGeo] +type zoneAccessGroupListResponseResultRequirePajwohLqCountryRuleGeoJSON struct { + CountryCode apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqCountryRuleGeo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforce different MFA options +type ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod `json:"auth_method,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRule] +type zoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod string `json:"auth_method,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod] +type zoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethodJSON struct { + AuthMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRule struct { + DevicePosture ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleDevicePosture `json:"device_posture,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleJSON contains +// the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRule] +type zoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleJSON struct { + DevicePosture apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRule) implementsZoneAccessGroupListResponseResultRequire() { +} + +type ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid string `json:"integration_uid,required"` + JSON zoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON +// contains the JSON metadata for the struct +// [ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleDevicePosture] +type zoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleDevicePostureJSON struct { + IntegrationUid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultRequirePajwohLqDevicePostureRuleDevicePosture) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAccessGroupListResponseResultInfoJSON `json:"-"` +} + +// zoneAccessGroupListResponseResultInfoJSON contains the JSON metadata for the +// struct [ZoneAccessGroupListResponseResultInfo] +type zoneAccessGroupListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessGroupListResponseSuccess bool + +const ( + ZoneAccessGroupListResponseSuccessTrue ZoneAccessGroupListResponseSuccess = true +) + +type ZoneAccessGroupDeleteResponse struct { + Errors []ZoneAccessGroupDeleteResponseError `json:"errors"` + Messages []ZoneAccessGroupDeleteResponseMessage `json:"messages"` + Result ZoneAccessGroupDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessGroupDeleteResponseSuccess `json:"success"` + JSON zoneAccessGroupDeleteResponseJSON `json:"-"` +} + +// zoneAccessGroupDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneAccessGroupDeleteResponse] +type zoneAccessGroupDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupDeleteResponseErrorJSON `json:"-"` +} + +// zoneAccessGroupDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneAccessGroupDeleteResponseError] +type zoneAccessGroupDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessGroupDeleteResponseMessageJSON `json:"-"` +} + +// zoneAccessGroupDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneAccessGroupDeleteResponseMessage] +type zoneAccessGroupDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessGroupDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON zoneAccessGroupDeleteResponseResultJSON `json:"-"` +} + +// zoneAccessGroupDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneAccessGroupDeleteResponseResult] +type zoneAccessGroupDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessGroupDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessGroupDeleteResponseSuccess bool + +const ( + ZoneAccessGroupDeleteResponseSuccessTrue ZoneAccessGroupDeleteResponseSuccess = true +) + +type ZoneAccessGroupNewParams struct { + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include param.Field[[]ZoneAccessGroupNewParamsInclude] `json:"include,required"` + // The name of the Access group. + Name param.Field[string] `json:"name,required"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude param.Field[[]ZoneAccessGroupNewParamsExclude] `json:"exclude"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require param.Field[[]ZoneAccessGroupNewParamsRequire] `json:"require"` +} + +func (r ZoneAccessGroupNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [ZoneAccessGroupNewParamsIncludePajwohLqEmailRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqEmailListRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqDomainRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqEveryoneRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqIPRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqIPListRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqCertificateRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqAccessGroupRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqAzureGroupRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqOktaGroupRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqSamlGroupRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqServiceTokenRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqCountryRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqAuthenticationMethodRule], +// [ZoneAccessGroupNewParamsIncludePajwohLqDevicePostureRule]. +type ZoneAccessGroupNewParamsInclude interface { + implementsZoneAccessGroupNewParamsInclude() +} + +// Matches a specific email. +type ZoneAccessGroupNewParamsIncludePajwohLqEmailRule struct { + Email param.Field[ZoneAccessGroupNewParamsIncludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEmailRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type ZoneAccessGroupNewParamsIncludePajwohLqEmailListRule struct { + EmailList param.Field[ZoneAccessGroupNewParamsIncludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEmailListRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type ZoneAccessGroupNewParamsIncludePajwohLqDomainRule struct { + EmailDomain param.Field[ZoneAccessGroupNewParamsIncludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqDomainRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type ZoneAccessGroupNewParamsIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqEveryoneRule) implementsZoneAccessGroupNewParamsInclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupNewParamsIncludePajwohLqIPRule struct { + IP param.Field[ZoneAccessGroupNewParamsIncludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqIPRule) implementsZoneAccessGroupNewParamsInclude() {} + +type ZoneAccessGroupNewParamsIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupNewParamsIncludePajwohLqIPListRule struct { + IPList param.Field[ZoneAccessGroupNewParamsIncludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqIPListRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupNewParamsIncludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqCertificateRule) implementsZoneAccessGroupNewParamsInclude() { +} + +// Matches an Access group. +type ZoneAccessGroupNewParamsIncludePajwohLqAccessGroupRule struct { + Group param.Field[ZoneAccessGroupNewParamsIncludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAccessGroupRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupNewParamsIncludePajwohLqAzureGroupRule struct { + AzureAd param.Field[ZoneAccessGroupNewParamsIncludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAzureGroupRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupNewParamsIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[ZoneAccessGroupNewParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupNewParamsIncludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[ZoneAccessGroupNewParamsIncludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupNewParamsIncludePajwohLqOktaGroupRule struct { + Okta param.Field[ZoneAccessGroupNewParamsIncludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqOktaGroupRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupNewParamsIncludePajwohLqSamlGroupRule struct { + Saml param.Field[ZoneAccessGroupNewParamsIncludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqSamlGroupRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupNewParamsIncludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[ZoneAccessGroupNewParamsIncludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqServiceTokenRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupNewParamsIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupNewParamsInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupNewParamsIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[ZoneAccessGroupNewParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type ZoneAccessGroupNewParamsIncludePajwohLqCountryRule struct { + Geo param.Field[ZoneAccessGroupNewParamsIncludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqCountryRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type ZoneAccessGroupNewParamsIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[ZoneAccessGroupNewParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupNewParamsIncludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[ZoneAccessGroupNewParamsIncludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqDevicePostureRule) implementsZoneAccessGroupNewParamsInclude() { +} + +type ZoneAccessGroupNewParamsIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r ZoneAccessGroupNewParamsIncludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [ZoneAccessGroupNewParamsExcludePajwohLqEmailRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqEmailListRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqDomainRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqEveryoneRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqIPRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqIPListRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqCertificateRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqAccessGroupRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqAzureGroupRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqOktaGroupRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqSamlGroupRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqServiceTokenRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqCountryRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqAuthenticationMethodRule], +// [ZoneAccessGroupNewParamsExcludePajwohLqDevicePostureRule]. +type ZoneAccessGroupNewParamsExclude interface { + implementsZoneAccessGroupNewParamsExclude() +} + +// Matches a specific email. +type ZoneAccessGroupNewParamsExcludePajwohLqEmailRule struct { + Email param.Field[ZoneAccessGroupNewParamsExcludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEmailRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type ZoneAccessGroupNewParamsExcludePajwohLqEmailListRule struct { + EmailList param.Field[ZoneAccessGroupNewParamsExcludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEmailListRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type ZoneAccessGroupNewParamsExcludePajwohLqDomainRule struct { + EmailDomain param.Field[ZoneAccessGroupNewParamsExcludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqDomainRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type ZoneAccessGroupNewParamsExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqEveryoneRule) implementsZoneAccessGroupNewParamsExclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupNewParamsExcludePajwohLqIPRule struct { + IP param.Field[ZoneAccessGroupNewParamsExcludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqIPRule) implementsZoneAccessGroupNewParamsExclude() {} + +type ZoneAccessGroupNewParamsExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupNewParamsExcludePajwohLqIPListRule struct { + IPList param.Field[ZoneAccessGroupNewParamsExcludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqIPListRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupNewParamsExcludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqCertificateRule) implementsZoneAccessGroupNewParamsExclude() { +} + +// Matches an Access group. +type ZoneAccessGroupNewParamsExcludePajwohLqAccessGroupRule struct { + Group param.Field[ZoneAccessGroupNewParamsExcludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAccessGroupRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupNewParamsExcludePajwohLqAzureGroupRule struct { + AzureAd param.Field[ZoneAccessGroupNewParamsExcludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAzureGroupRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupNewParamsExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[ZoneAccessGroupNewParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupNewParamsExcludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[ZoneAccessGroupNewParamsExcludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupNewParamsExcludePajwohLqOktaGroupRule struct { + Okta param.Field[ZoneAccessGroupNewParamsExcludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqOktaGroupRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupNewParamsExcludePajwohLqSamlGroupRule struct { + Saml param.Field[ZoneAccessGroupNewParamsExcludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqSamlGroupRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupNewParamsExcludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[ZoneAccessGroupNewParamsExcludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqServiceTokenRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupNewParamsExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupNewParamsExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupNewParamsExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[ZoneAccessGroupNewParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type ZoneAccessGroupNewParamsExcludePajwohLqCountryRule struct { + Geo param.Field[ZoneAccessGroupNewParamsExcludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqCountryRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type ZoneAccessGroupNewParamsExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[ZoneAccessGroupNewParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupNewParamsExcludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[ZoneAccessGroupNewParamsExcludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqDevicePostureRule) implementsZoneAccessGroupNewParamsExclude() { +} + +type ZoneAccessGroupNewParamsExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r ZoneAccessGroupNewParamsExcludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [ZoneAccessGroupNewParamsRequirePajwohLqEmailRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqEmailListRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqDomainRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqEveryoneRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqIPRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqIPListRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqCertificateRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqAccessGroupRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqAzureGroupRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqOktaGroupRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqSamlGroupRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqServiceTokenRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqCountryRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqAuthenticationMethodRule], +// [ZoneAccessGroupNewParamsRequirePajwohLqDevicePostureRule]. +type ZoneAccessGroupNewParamsRequire interface { + implementsZoneAccessGroupNewParamsRequire() +} + +// Matches a specific email. +type ZoneAccessGroupNewParamsRequirePajwohLqEmailRule struct { + Email param.Field[ZoneAccessGroupNewParamsRequirePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEmailRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type ZoneAccessGroupNewParamsRequirePajwohLqEmailListRule struct { + EmailList param.Field[ZoneAccessGroupNewParamsRequirePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEmailListRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type ZoneAccessGroupNewParamsRequirePajwohLqDomainRule struct { + EmailDomain param.Field[ZoneAccessGroupNewParamsRequirePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqDomainRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type ZoneAccessGroupNewParamsRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqEveryoneRule) implementsZoneAccessGroupNewParamsRequire() { +} + +// Matches an IP address block. +type ZoneAccessGroupNewParamsRequirePajwohLqIPRule struct { + IP param.Field[ZoneAccessGroupNewParamsRequirePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqIPRule) implementsZoneAccessGroupNewParamsRequire() {} + +type ZoneAccessGroupNewParamsRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupNewParamsRequirePajwohLqIPListRule struct { + IPList param.Field[ZoneAccessGroupNewParamsRequirePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqIPListRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupNewParamsRequirePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqCertificateRule) implementsZoneAccessGroupNewParamsRequire() { +} + +// Matches an Access group. +type ZoneAccessGroupNewParamsRequirePajwohLqAccessGroupRule struct { + Group param.Field[ZoneAccessGroupNewParamsRequirePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAccessGroupRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupNewParamsRequirePajwohLqAzureGroupRule struct { + AzureAd param.Field[ZoneAccessGroupNewParamsRequirePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAzureGroupRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupNewParamsRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[ZoneAccessGroupNewParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupNewParamsRequirePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[ZoneAccessGroupNewParamsRequirePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqGsuiteGroupRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupNewParamsRequirePajwohLqOktaGroupRule struct { + Okta param.Field[ZoneAccessGroupNewParamsRequirePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqOktaGroupRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupNewParamsRequirePajwohLqSamlGroupRule struct { + Saml param.Field[ZoneAccessGroupNewParamsRequirePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqSamlGroupRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupNewParamsRequirePajwohLqServiceTokenRule struct { + ServiceToken param.Field[ZoneAccessGroupNewParamsRequirePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqServiceTokenRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupNewParamsRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupNewParamsRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupNewParamsRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[ZoneAccessGroupNewParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqExternalEvaluationRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type ZoneAccessGroupNewParamsRequirePajwohLqCountryRule struct { + Geo param.Field[ZoneAccessGroupNewParamsRequirePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqCountryRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type ZoneAccessGroupNewParamsRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[ZoneAccessGroupNewParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupNewParamsRequirePajwohLqDevicePostureRule struct { + DevicePosture param.Field[ZoneAccessGroupNewParamsRequirePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqDevicePostureRule) implementsZoneAccessGroupNewParamsRequire() { +} + +type ZoneAccessGroupNewParamsRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r ZoneAccessGroupNewParamsRequirePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessGroupUpdateParams struct { + // Rules evaluated with an OR logical operator. A user needs to meet only one of + // the Include rules. + Include param.Field[[]ZoneAccessGroupUpdateParamsInclude] `json:"include,required"` + // The name of the Access group. + Name param.Field[string] `json:"name,required"` + // Rules evaluated with a NOT logical operator. To match a policy, a user cannot + // meet any of the Exclude rules. + Exclude param.Field[[]ZoneAccessGroupUpdateParamsExclude] `json:"exclude"` + // Rules evaluated with an AND logical operator. To match a policy, a user must + // meet all of the Require rules. + Require param.Field[[]ZoneAccessGroupUpdateParamsRequire] `json:"require"` +} + +func (r ZoneAccessGroupUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqEmailListRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqDomainRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqEveryoneRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqIPRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqIPListRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqCertificateRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqCountryRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule], +// [ZoneAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule]. +type ZoneAccessGroupUpdateParamsInclude interface { + implementsZoneAccessGroupUpdateParamsInclude() +} + +// Matches a specific email. +type ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule struct { + Email param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type ZoneAccessGroupUpdateParamsIncludePajwohLqEmailListRule struct { + EmailList param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEmailListRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type ZoneAccessGroupUpdateParamsIncludePajwohLqDomainRule struct { + EmailDomain param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqDomainRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type ZoneAccessGroupUpdateParamsIncludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqEveryoneRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupUpdateParamsIncludePajwohLqIPRule struct { + IP param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqIPRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupUpdateParamsIncludePajwohLqIPListRule struct { + IPList param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqIPListRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupUpdateParamsIncludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqCertificateRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +// Matches an Access group. +type ZoneAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule struct { + Group param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAccessGroupRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule struct { + AzureAd param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAzureGroupRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule struct { + Okta param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqOktaGroupRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule struct { + Saml param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqSamlGroupRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqServiceTokenRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type ZoneAccessGroupUpdateParamsIncludePajwohLqCountryRule struct { + Geo param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqCountryRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type ZoneAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[ZoneAccessGroupUpdateParamsIncludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqDevicePostureRule) implementsZoneAccessGroupUpdateParamsInclude() { +} + +type ZoneAccessGroupUpdateParamsIncludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r ZoneAccessGroupUpdateParamsIncludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqEmailListRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqDomainRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqEveryoneRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqIPRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqIPListRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqCertificateRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqCountryRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule], +// [ZoneAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule]. +type ZoneAccessGroupUpdateParamsExclude interface { + implementsZoneAccessGroupUpdateParamsExclude() +} + +// Matches a specific email. +type ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule struct { + Email param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type ZoneAccessGroupUpdateParamsExcludePajwohLqEmailListRule struct { + EmailList param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEmailListRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type ZoneAccessGroupUpdateParamsExcludePajwohLqDomainRule struct { + EmailDomain param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqDomainRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type ZoneAccessGroupUpdateParamsExcludePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqEveryoneRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +// Matches an IP address block. +type ZoneAccessGroupUpdateParamsExcludePajwohLqIPRule struct { + IP param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqIPRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupUpdateParamsExcludePajwohLqIPListRule struct { + IPList param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqIPListRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupUpdateParamsExcludePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqCertificateRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +// Matches an Access group. +type ZoneAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule struct { + Group param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAccessGroupRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule struct { + AzureAd param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAzureGroupRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule struct { + Okta param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqOktaGroupRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule struct { + Saml param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqSamlGroupRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule struct { + ServiceToken param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqServiceTokenRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type ZoneAccessGroupUpdateParamsExcludePajwohLqCountryRule struct { + Geo param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqCountryRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type ZoneAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule struct { + DevicePosture param.Field[ZoneAccessGroupUpdateParamsExcludePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqDevicePostureRule) implementsZoneAccessGroupUpdateParamsExclude() { +} + +type ZoneAccessGroupUpdateParamsExcludePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r ZoneAccessGroupUpdateParamsExcludePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific email. +// +// Satisfied by [ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqEmailListRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqDomainRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqEveryoneRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqIPRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqIPListRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqCertificateRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqCountryRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule], +// [ZoneAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule]. +type ZoneAccessGroupUpdateParamsRequire interface { + implementsZoneAccessGroupUpdateParamsRequire() +} + +// Matches a specific email. +type ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule struct { + Email param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail struct { + // The email of the user. + Email param.Field[string] `json:"email,required" format:"email"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an email address from a list. +type ZoneAccessGroupUpdateParamsRequirePajwohLqEmailListRule struct { + EmailList param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqEmailListRuleEmailList] `json:"email_list,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEmailListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEmailListRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqEmailListRuleEmailList struct { + // The ID of a previously created email list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEmailListRuleEmailList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Match an entire email domain. +type ZoneAccessGroupUpdateParamsRequirePajwohLqDomainRule struct { + EmailDomain param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqDomainRuleEmailDomain] `json:"email_domain,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqDomainRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqDomainRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqDomainRuleEmailDomain struct { + // The email domain to match. + Domain param.Field[string] `json:"domain,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqDomainRuleEmailDomain) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches everyone. +type ZoneAccessGroupUpdateParamsRequirePajwohLqEveryoneRule struct { + // An empty object which matches on all users. + Everyone param.Field[interface{}] `json:"everyone,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEveryoneRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqEveryoneRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +// Matches an IP address block. +type ZoneAccessGroupUpdateParamsRequirePajwohLqIPRule struct { + IP param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqIPRuleIP] `json:"ip,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqIPRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqIPRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqIPRuleIP struct { + // An IPv4 or IPv6 CIDR block. + IP param.Field[string] `json:"ip,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqIPRuleIP) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an IP address from a list. +type ZoneAccessGroupUpdateParamsRequirePajwohLqIPListRule struct { + IPList param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqIPListRuleIPList] `json:"ip_list,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqIPListRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqIPListRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqIPListRuleIPList struct { + // The ID of a previously created IP list. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqIPListRuleIPList) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid client certificate. +type ZoneAccessGroupUpdateParamsRequirePajwohLqCertificateRule struct { + Certificate param.Field[interface{}] `json:"certificate,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqCertificateRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqCertificateRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +// Matches an Access group. +type ZoneAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule struct { + Group param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqAccessGroupRuleGroup] `json:"group,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAccessGroupRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqAccessGroupRuleGroup struct { + // The ID of a previously created Access group. + ID param.Field[string] `json:"id,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAccessGroupRuleGroup) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Azure group. Requires an Azure identity provider. +type ZoneAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule struct { + AzureAd param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqAzureGroupRuleAzureAd] `json:"azureAD,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAzureGroupRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqAzureGroupRuleAzureAd struct { + // The ID of an Azure group. + ID param.Field[string] `json:"id,required"` + // The ID of your Azure identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAzureGroupRuleAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a Github organization. Requires a Github identity provider. +type ZoneAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule struct { + GitHubOrganization param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization] `json:"github-organization,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization struct { + // The ID of your Github identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The name of the organization. + Name param.Field[string] `json:"name,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqGitHubOrganizationRuleGitHubOrganization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a group in Google Workspace. Requires a Google Workspace identity +// provider. +type ZoneAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule struct { + Gsuite param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRuleGsuite] `json:"gsuite,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRuleGsuite struct { + // The ID of your Google Workspace identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Google Workspace group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqGsuiteGroupRuleGsuite) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches an Okta group. Requires an Okta identity provider. +type ZoneAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule struct { + Okta param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqOktaGroupRuleOkta] `json:"okta,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqOktaGroupRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqOktaGroupRuleOkta struct { + // The ID of your Okta identity provider. + ConnectionID param.Field[string] `json:"connection_id,required"` + // The email of the Okta group. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqOktaGroupRuleOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a SAML group. Requires a SAML identity provider. +type ZoneAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule struct { + Saml param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqSamlGroupRuleSaml] `json:"saml,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqSamlGroupRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqSamlGroupRuleSaml struct { + // The name of the SAML attribute. + AttributeName param.Field[string] `json:"attribute_name,required"` + // The SAML attribute value to look for. + AttributeValue param.Field[string] `json:"attribute_value,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqSamlGroupRuleSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific Access Service Token +type ZoneAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule struct { + ServiceToken param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqServiceTokenRuleServiceToken] `json:"service_token,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqServiceTokenRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqServiceTokenRuleServiceToken struct { + // The ID of a Service Token. + TokenID param.Field[string] `json:"token_id,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqServiceTokenRuleServiceToken) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches any valid Access Service Token +type ZoneAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule struct { + // An empty object which matches on all service tokens. + AnyValidServiceToken param.Field[interface{}] `json:"any_valid_service_token,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAnyValidServiceTokenRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +// Create Allow or Block policies which evaluate the user based on custom criteria. +type ZoneAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule struct { + ExternalEvaluation param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation] `json:"external_evaluation,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation struct { + // The API endpoint containing your business logic. + EvaluateURL param.Field[string] `json:"evaluate_url,required"` + // The API endpoint containing the key that Access uses to verify that the response + // came from your API. + KeysURL param.Field[string] `json:"keys_url,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqExternalEvaluationRuleExternalEvaluation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Matches a specific country +type ZoneAccessGroupUpdateParamsRequirePajwohLqCountryRule struct { + Geo param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqCountryRuleGeo] `json:"geo,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqCountryRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqCountryRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqCountryRuleGeo struct { + // The country code that should be matched. + CountryCode param.Field[string] `json:"country_code,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqCountryRuleGeo) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforce different MFA options +type ZoneAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule struct { + AuthMethod param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod struct { + // The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176. + AuthMethod param.Field[string] `json:"auth_method,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqAuthenticationMethodRuleAuthMethod) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enforces a device posture rule has run successfully +type ZoneAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule struct { + DevicePosture param.Field[ZoneAccessGroupUpdateParamsRequirePajwohLqDevicePostureRuleDevicePosture] `json:"device_posture,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqDevicePostureRule) implementsZoneAccessGroupUpdateParamsRequire() { +} + +type ZoneAccessGroupUpdateParamsRequirePajwohLqDevicePostureRuleDevicePosture struct { + // The ID of a device posture integration. + IntegrationUid param.Field[string] `json:"integration_uid,required"` +} + +func (r ZoneAccessGroupUpdateParamsRequirePajwohLqDevicePostureRuleDevicePosture) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneaccessgroup_test.go b/zoneaccessgroup_test.go new file mode 100644 index 00000000000..3b464110d77 --- /dev/null +++ b/zoneaccessgroup_test.go @@ -0,0 +1,243 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAccessGroupNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Groups.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAccessGroupNewParams{ + Include: cloudflare.F([]cloudflare.ZoneAccessGroupNewParamsInclude{cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + Name: cloudflare.F("Allow devs"), + Exclude: cloudflare.F([]cloudflare.ZoneAccessGroupNewParamsExclude{cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + Require: cloudflare.F([]cloudflare.ZoneAccessGroupNewParamsRequire{cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRule(cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupNewParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + }, + ) + 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 TestZoneAccessGroupGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Groups.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestZoneAccessGroupUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Groups.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.ZoneAccessGroupUpdateParams{ + Include: cloudflare.F([]cloudflare.ZoneAccessGroupUpdateParamsInclude{cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsIncludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + Name: cloudflare.F("Allow devs"), + Exclude: cloudflare.F([]cloudflare.ZoneAccessGroupUpdateParamsExclude{cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsExcludePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + Require: cloudflare.F([]cloudflare.ZoneAccessGroupUpdateParamsRequire{cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + }), cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule(cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRule{ + Email: cloudflare.F(cloudflare.ZoneAccessGroupUpdateParamsRequirePajwohLqEmailRuleEmail{ + Email: cloudflare.F("test@example.com"), + }), + })}), + }, + ) + 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 TestZoneAccessGroupList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Groups.List(context.TODO(), "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()) + } +} + +func TestZoneAccessGroupDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Groups.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/zoneaccessidentityprovider.go b/zoneaccessidentityprovider.go new file mode 100644 index 00000000000..c48a953ff01 --- /dev/null +++ b/zoneaccessidentityprovider.go @@ -0,0 +1,9427 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAccessIdentityProviderService 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 +// [NewZoneAccessIdentityProviderService] method instead. +type ZoneAccessIdentityProviderService struct { + Options []option.RequestOption +} + +// NewZoneAccessIdentityProviderService 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 NewZoneAccessIdentityProviderService(opts ...option.RequestOption) (r *ZoneAccessIdentityProviderService) { + r = &ZoneAccessIdentityProviderService{} + r.Options = opts + return +} + +// Fetches a configured identity provider. +func (r *ZoneAccessIdentityProviderService) Get(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *ZoneAccessIdentityProviderGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/identity_providers/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured identity provider. +func (r *ZoneAccessIdentityProviderService) Update(ctx context.Context, identifier string, uuid string, body ZoneAccessIdentityProviderUpdateParams, opts ...option.RequestOption) (res *ZoneAccessIdentityProviderUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/identity_providers/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists all configured identity providers. +func (r *ZoneAccessIdentityProviderService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneAccessIdentityProviderListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/identity_providers", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an identity provider from Access. +func (r *ZoneAccessIdentityProviderService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *ZoneAccessIdentityProviderDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/identity_providers/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds a new identity provider to Access. +func (r *ZoneAccessIdentityProviderService) Add(ctx context.Context, identifier string, body ZoneAccessIdentityProviderAddParams, opts ...option.RequestOption) (res *ZoneAccessIdentityProviderAddResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/identity_providers", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneAccessIdentityProviderGetResponse struct { + Errors []ZoneAccessIdentityProviderGetResponseError `json:"errors"` + Messages []ZoneAccessIdentityProviderGetResponseMessage `json:"messages"` + Result ZoneAccessIdentityProviderGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessIdentityProviderGetResponseSuccess `json:"success"` + JSON zoneAccessIdentityProviderGetResponseJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseJSON contains the JSON metadata for the +// struct [ZoneAccessIdentityProviderGetResponse] +type zoneAccessIdentityProviderGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderGetResponseErrorJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderGetResponseError] +type zoneAccessIdentityProviderGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderGetResponseMessageJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderGetResponseMessage] +type zoneAccessIdentityProviderGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAd], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrify], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebook], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHub], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogle], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleApps], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedin], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidc], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOkta], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOnelogin], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingone], +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSaml] or +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandex]. +type ZoneAccessIdentityProviderGetResponseResult interface { + implementsZoneAccessIdentityProviderGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessIdentityProviderGetResponseResult)(nil)).Elem(), "") +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAd struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAd] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAd) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasAzureAdType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrify struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrify] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrify) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasCentrifyType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebook struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebook] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebook) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasFacebookType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHub struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHub] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHub) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGitHubType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogle struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogle] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogle) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleApps struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleApps] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleApps) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasGoogleAppsType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedin] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedin) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasLinkedinType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidc struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidc] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidc) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // List of custom claims that will be pulled from your id_token and added to your + // signed Access JWT token. + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOidcType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOkta struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOkta] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOkta) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOktaType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOnelogin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOnelogin] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOnelogin) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasOneloginType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingone struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingone] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingone) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasPingoneType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSaml struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSaml] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSaml) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigHeaderAttribute] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasSamlType = "yandex" +) + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandex struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType `json:"type"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandex] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandex) implementsZoneAccessIdentityProviderGetResponseResult() { +} + +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexScimConfig] +type zoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType string + +const ( + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeOnetimepin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "onetimepin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeAzureAd ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "azureAD" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeSaml ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "saml" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeCentrify ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "centrify" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeFacebook ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "facebook" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeGitHub ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "github" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeGoogleApps ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "google-apps" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeGoogle ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "google" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeLinkedin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "linkedin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeOidc ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "oidc" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeOkta ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "okta" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeOnelogin ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "onelogin" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypePingone ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "pingone" + ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexTypeYandex ZoneAccessIdentityProviderGetResponseResultPajwohLqSchemasYandexType = "yandex" +) + +// Whether the API call was successful +type ZoneAccessIdentityProviderGetResponseSuccess bool + +const ( + ZoneAccessIdentityProviderGetResponseSuccessTrue ZoneAccessIdentityProviderGetResponseSuccess = true +) + +type ZoneAccessIdentityProviderUpdateResponse struct { + Errors []ZoneAccessIdentityProviderUpdateResponseError `json:"errors"` + Messages []ZoneAccessIdentityProviderUpdateResponseMessage `json:"messages"` + Result ZoneAccessIdentityProviderUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessIdentityProviderUpdateResponseSuccess `json:"success"` + JSON zoneAccessIdentityProviderUpdateResponseJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneAccessIdentityProviderUpdateResponse] +type zoneAccessIdentityProviderUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderUpdateResponseErrorJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderUpdateResponseError] +type zoneAccessIdentityProviderUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderUpdateResponseMessageJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseMessageJSON contains the JSON metadata +// for the struct [ZoneAccessIdentityProviderUpdateResponseMessage] +type zoneAccessIdentityProviderUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAd], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrify], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebook], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHub], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogle], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleApps], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedin], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidc], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOkta], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOnelogin], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingone], +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSaml] or +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandex]. +type ZoneAccessIdentityProviderUpdateResponseResult interface { + implementsZoneAccessIdentityProviderUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessIdentityProviderUpdateResponseResult)(nil)).Elem(), "") +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAd struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAd] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAd) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasAzureAdType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrify struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrify] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrify) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasCentrifyType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebook struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebook] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebook) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasFacebookType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHub struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHub] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHub) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGitHubType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogle struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogle] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogle) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleApps struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleApps] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleApps) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasGoogleAppsType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedin] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedin) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasLinkedinType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidc struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidc] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidc) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // List of custom claims that will be pulled from your id_token and added to your + // signed Access JWT token. + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOidcType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOkta struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOkta] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOkta) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOktaType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOnelogin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOnelogin] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOnelogin) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasOneloginType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingone struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingone] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingone) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasPingoneType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSaml struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSaml] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSaml) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigHeaderAttribute] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasSamlType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandex struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType `json:"type"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandex] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandex) implementsZoneAccessIdentityProviderUpdateResponseResult() { +} + +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexScimConfig] +type zoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType string + +const ( + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeOnetimepin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "onetimepin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeAzureAd ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "azureAD" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeSaml ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "saml" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeCentrify ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "centrify" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeFacebook ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "facebook" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeGitHub ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "github" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeGoogleApps ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "google-apps" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeGoogle ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "google" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeLinkedin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "linkedin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeOidc ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "oidc" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeOkta ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "okta" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeOnelogin ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "onelogin" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypePingone ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "pingone" + ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexTypeYandex ZoneAccessIdentityProviderUpdateResponseResultPajwohLqSchemasYandexType = "yandex" +) + +// Whether the API call was successful +type ZoneAccessIdentityProviderUpdateResponseSuccess bool + +const ( + ZoneAccessIdentityProviderUpdateResponseSuccessTrue ZoneAccessIdentityProviderUpdateResponseSuccess = true +) + +type ZoneAccessIdentityProviderListResponse struct { + Errors []ZoneAccessIdentityProviderListResponseError `json:"errors"` + Messages []ZoneAccessIdentityProviderListResponseMessage `json:"messages"` + Result []ZoneAccessIdentityProviderListResponseResult `json:"result"` + ResultInfo ZoneAccessIdentityProviderListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneAccessIdentityProviderListResponseSuccess `json:"success"` + JSON zoneAccessIdentityProviderListResponseJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseJSON contains the JSON metadata for the +// struct [ZoneAccessIdentityProviderListResponse] +type zoneAccessIdentityProviderListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderListResponseErrorJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderListResponseError] +type zoneAccessIdentityProviderListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderListResponseMessageJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderListResponseMessage] +type zoneAccessIdentityProviderListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAd], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrify], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebook], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHub], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogle], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleApps], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedin], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidc], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOkta], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnelogin], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingone], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSaml], +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandex] or +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepin]. +type ZoneAccessIdentityProviderListResponseResult interface { + implementsZoneAccessIdentityProviderListResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessIdentityProviderListResponseResult)(nil)).Elem(), "") +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAd struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAd] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAd) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasAzureAdType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrify struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrify] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrify) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasCentrifyType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebook struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebook] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebook) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasFacebookType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHub struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHub] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHub) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGitHubType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogle struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogle] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogle) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleApps struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleApps] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleApps) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasGoogleAppsType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedin] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedin) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasLinkedinType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidc struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidc] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidc) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // List of custom claims that will be pulled from your id_token and added to your + // signed Access JWT token. + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOidcType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOkta struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOkta] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOkta) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOktaType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnelogin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnelogin] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnelogin) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOneloginType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingone struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingone] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingone) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasPingoneType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSaml struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSaml] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSaml) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigHeaderAttribute] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasSamlType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandex struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandex] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandex) implementsZoneAccessIdentityProviderListResponseResult() { +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "onetimepin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeAzureAd ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "azureAD" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeSaml ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "saml" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeCentrify ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "centrify" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeFacebook ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "facebook" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeGitHub ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "github" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeGoogleApps ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "google-apps" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeGoogle ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "google" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeLinkedin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "linkedin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeOidc ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "oidc" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeOkta ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "okta" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeOnelogin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "onelogin" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypePingone ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "pingone" + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexTypeYandex ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasYandexType = "yandex" +) + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepin struct { + // UUID + ID string `json:"id"` + Config interface{} `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinScimConfig `json:"scim_config"` + Type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinType `json:"type"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepin] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepin) implementsZoneAccessIdentityProviderListResponseResult() { +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinScimConfig] +type zoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinType string + +const ( + ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinTypeOnetimepin ZoneAccessIdentityProviderListResponseResultPajwohLqSchemasOnetimepinType = "onetimepin" +) + +type ZoneAccessIdentityProviderListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAccessIdentityProviderListResponseResultInfoJSON `json:"-"` +} + +// zoneAccessIdentityProviderListResponseResultInfoJSON contains the JSON metadata +// for the struct [ZoneAccessIdentityProviderListResponseResultInfo] +type zoneAccessIdentityProviderListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessIdentityProviderListResponseSuccess bool + +const ( + ZoneAccessIdentityProviderListResponseSuccessTrue ZoneAccessIdentityProviderListResponseSuccess = true +) + +type ZoneAccessIdentityProviderDeleteResponse struct { + Errors []ZoneAccessIdentityProviderDeleteResponseError `json:"errors"` + Messages []ZoneAccessIdentityProviderDeleteResponseMessage `json:"messages"` + Result ZoneAccessIdentityProviderDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessIdentityProviderDeleteResponseSuccess `json:"success"` + JSON zoneAccessIdentityProviderDeleteResponseJSON `json:"-"` +} + +// zoneAccessIdentityProviderDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneAccessIdentityProviderDeleteResponse] +type zoneAccessIdentityProviderDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderDeleteResponseErrorJSON `json:"-"` +} + +// zoneAccessIdentityProviderDeleteResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderDeleteResponseError] +type zoneAccessIdentityProviderDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderDeleteResponseMessageJSON `json:"-"` +} + +// zoneAccessIdentityProviderDeleteResponseMessageJSON contains the JSON metadata +// for the struct [ZoneAccessIdentityProviderDeleteResponseMessage] +type zoneAccessIdentityProviderDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderDeleteResponseResult struct { + // UUID + ID string `json:"id"` + JSON zoneAccessIdentityProviderDeleteResponseResultJSON `json:"-"` +} + +// zoneAccessIdentityProviderDeleteResponseResultJSON contains the JSON metadata +// for the struct [ZoneAccessIdentityProviderDeleteResponseResult] +type zoneAccessIdentityProviderDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessIdentityProviderDeleteResponseSuccess bool + +const ( + ZoneAccessIdentityProviderDeleteResponseSuccessTrue ZoneAccessIdentityProviderDeleteResponseSuccess = true +) + +type ZoneAccessIdentityProviderAddResponse struct { + Errors []ZoneAccessIdentityProviderAddResponseError `json:"errors"` + Messages []ZoneAccessIdentityProviderAddResponseMessage `json:"messages"` + Result ZoneAccessIdentityProviderAddResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessIdentityProviderAddResponseSuccess `json:"success"` + JSON zoneAccessIdentityProviderAddResponseJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseJSON contains the JSON metadata for the +// struct [ZoneAccessIdentityProviderAddResponse] +type zoneAccessIdentityProviderAddResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderAddResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderAddResponseErrorJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderAddResponseError] +type zoneAccessIdentityProviderAddResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderAddResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessIdentityProviderAddResponseMessageJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAccessIdentityProviderAddResponseMessage] +type zoneAccessIdentityProviderAddResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAd], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrify], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebook], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHub], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogle], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleApps], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedin], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidc], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOkta], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOnelogin], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingone], +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSaml] or +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandex]. +type ZoneAccessIdentityProviderAddResponseResult interface { + implementsZoneAccessIdentityProviderAddResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAccessIdentityProviderAddResponseResult)(nil)).Elem(), "") +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAd struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAd] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAd) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAd) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled bool `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID string `json:"directory_id"` + // Should Cloudflare try to load groups from your account + SupportGroups bool `json:"support_groups"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + ConditionalAccessEnabled apijson.Field + DirectoryID apijson.Field + SupportGroups apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasAzureAdType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrify struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrify] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrify) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyConfig struct { + // Your centrify account url + CentrifyAccount string `json:"centrify_account"` + // Your centrify app id + CentrifyAppID string `json:"centrify_app_id"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasCentrifyType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebook struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebook] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebook) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasFacebookType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHub struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHub] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHub) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGitHubType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogle struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogle] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogle) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleApps struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleApps] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleApps) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsConfig struct { + // Your companies TLD + AppsDomain string `json:"apps_domain"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasGoogleAppsType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedin] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedin) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasLinkedinType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidc struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidc] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidc) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidc) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL string `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL string `json:"certs_url"` + // List of custom claims that will be pulled from your id_token and added to your + // signed Access JWT token. + Claims []string `json:"claims"` + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // OAuth scopes + Scopes []string `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL string `json:"token_url"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcConfigJSON struct { + AuthURL apijson.Field + CertsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOidcType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOkta struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOkta] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOkta) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your okta account url + OktaAccount string `json:"okta_account"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOktaType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOnelogin struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOnelogin] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOnelogin) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your OneLogin account url + OneloginAccount string `json:"onelogin_account"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasOneloginType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingone struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingone] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingone) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + // Your PingOne environment identifier + PingEnvID string `json:"ping_env_id"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasPingoneType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSaml struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlJSON contains the +// JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSaml] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSaml) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSaml) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes []string `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName string `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes []ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigHeaderAttribute `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts []string `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL string `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest bool `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL string `json:"sso_target_url"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IdpPublicCerts apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName string `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName string `json:"header_name"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigHeaderAttribute] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasSamlType = "yandex" +) + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandex struct { + // UUID + ID string `json:"id"` + Config ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexConfig `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name string `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexScimConfig `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType `json:"type"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexJSON contains +// the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandex] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexJSON struct { + ID apijson.Field + Config apijson.Field + Name apijson.Field + ScimConfig apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandex) implementsZoneAccessIdentityProviderAddResponseResult() { +} + +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexConfig struct { + // Your OAuth Client ID + ClientID string `json:"client_id"` + // Your OAuth Client Secret + ClientSecret string `json:"client_secret"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexConfigJSON struct { + ClientID apijson.Field + ClientSecret apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled bool `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision bool `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision bool `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret string `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision bool `json:"user_deprovision"` + JSON zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexScimConfigJSON `json:"-"` +} + +// zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexScimConfigJSON +// contains the JSON metadata for the struct +// [ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexScimConfig] +type zoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexScimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexScimConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType string + +const ( + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeOnetimepin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "onetimepin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeAzureAd ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "azureAD" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeSaml ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "saml" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeCentrify ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "centrify" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeFacebook ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "facebook" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeGitHub ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "github" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeGoogleApps ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "google-apps" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeGoogle ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "google" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeLinkedin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "linkedin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeOidc ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "oidc" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeOkta ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "okta" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeOnelogin ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "onelogin" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypePingone ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "pingone" + ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexTypeYandex ZoneAccessIdentityProviderAddResponseResultPajwohLqSchemasYandexType = "yandex" +) + +// Whether the API call was successful +type ZoneAccessIdentityProviderAddResponseSuccess bool + +const ( + ZoneAccessIdentityProviderAddResponseSuccessTrue ZoneAccessIdentityProviderAddResponseSuccess = true +) + +// This interface is a union satisfied by one of the following: +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAd], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrify], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebook], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHub], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogle], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleApps], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedin], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidc], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOkta], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOnelogin], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingone], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSaml], +// [ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandex]. +type ZoneAccessIdentityProviderUpdateParams interface { + ImplementsZoneAccessIdentityProviderUpdateParams() +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAd struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAd) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled param.Field[bool] `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID param.Field[string] `json:"directory_id"` + // Should Cloudflare try to load groups from your account + SupportGroups param.Field[bool] `json:"support_groups"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrify struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrify) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrify) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyConfig struct { + // Your centrify account url + CentrifyAccount param.Field[string] `json:"centrify_account"` + // Your centrify app id + CentrifyAppID param.Field[string] `json:"centrify_app_id"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasCentrifyType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebook struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebook) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebook) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasFacebookType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHub struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHub) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHub) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGitHubType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogle struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogle) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogle) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleApps struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleApps) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleApps) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsConfig struct { + // Your companies TLD + AppsDomain param.Field[string] `json:"apps_domain"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasGoogleAppsType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedin struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedin) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasLinkedinType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidc struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidc) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidc) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL param.Field[string] `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL param.Field[string] `json:"certs_url"` + // List of custom claims that will be pulled from your id_token and added to your + // signed Access JWT token. + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // OAuth scopes + Scopes param.Field[[]string] `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL param.Field[string] `json:"token_url"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOidcType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOkta struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOkta) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Your okta account url + OktaAccount param.Field[string] `json:"okta_account"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOktaType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOnelogin struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOnelogin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOnelogin) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Your OneLogin account url + OneloginAccount param.Field[string] `json:"onelogin_account"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasOneloginType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingone struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingone) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Your PingOne environment identifier + PingEnvID param.Field[string] `json:"ping_env_id"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasPingoneType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSaml struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSaml) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes param.Field[[]string] `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName param.Field[string] `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes param.Field[[]ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlConfigHeaderAttribute] `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts param.Field[[]string] `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL param.Field[string] `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest param.Field[bool] `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL param.Field[string] `json:"sso_target_url"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName param.Field[string] `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName param.Field[string] `json:"header_name"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasSamlType = "yandex" +) + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandex struct { + Config param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandex) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandex) ImplementsZoneAccessIdentityProviderUpdateParams() { + +} + +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType string + +const ( + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeOnetimepin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "onetimepin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeAzureAd ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "azureAD" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeSaml ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "saml" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeCentrify ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "centrify" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeFacebook ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "facebook" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeGitHub ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "github" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeGoogleApps ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "google-apps" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeGoogle ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "google" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeLinkedin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "linkedin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeOidc ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "oidc" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeOkta ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "okta" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeOnelogin ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "onelogin" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypePingone ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "pingone" + ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexTypeYandex ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasYandexType = "yandex" +) + +// This interface is a union satisfied by one of the following: +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAd], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrify], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebook], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHub], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogle], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleApps], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedin], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidc], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOkta], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOnelogin], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingone], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSaml], +// [ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandex]. +type ZoneAccessIdentityProviderAddParams interface { + ImplementsZoneAccessIdentityProviderAddParams() +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAd struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAd) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled param.Field[bool] `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID param.Field[string] `json:"directory_id"` + // Should Cloudflare try to load groups from your account + SupportGroups param.Field[bool] `json:"support_groups"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrify struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrify) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrify) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyConfig struct { + // Your centrify account url + CentrifyAccount param.Field[string] `json:"centrify_account"` + // Your centrify app id + CentrifyAppID param.Field[string] `json:"centrify_app_id"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasCentrifyType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebook struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebook) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebook) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasFacebookType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHub struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHub) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHub) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGitHubType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogle struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogle) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogle) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleApps struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleApps) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleApps) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsConfig struct { + // Your companies TLD + AppsDomain param.Field[string] `json:"apps_domain"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasGoogleAppsType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedin struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedin) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasLinkedinType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidc struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidc) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidc) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL param.Field[string] `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CertsURL param.Field[string] `json:"certs_url"` + // List of custom claims that will be pulled from your id_token and added to your + // signed Access JWT token. + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // OAuth scopes + Scopes param.Field[[]string] `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL param.Field[string] `json:"token_url"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOidcType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOkta struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOkta) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Your okta account url + OktaAccount param.Field[string] `json:"okta_account"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOktaType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOnelogin struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOnelogin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOnelogin) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Your OneLogin account url + OneloginAccount param.Field[string] `json:"onelogin_account"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasOneloginType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingone struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingone) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Your PingOne environment identifier + PingEnvID param.Field[string] `json:"ping_env_id"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasPingoneType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSaml struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSaml) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes param.Field[[]string] `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName param.Field[string] `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes param.Field[[]ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlConfigHeaderAttribute] `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IdpPublicCerts param.Field[[]string] `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL param.Field[string] `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest param.Field[bool] `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL param.Field[string] `json:"sso_target_url"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName param.Field[string] `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName param.Field[string] `json:"header_name"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasSamlType = "yandex" +) + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandex struct { + Config param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexConfig] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexScimConfig] `json:"scim_config"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType] `json:"type"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandex) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandex) ImplementsZoneAccessIdentityProviderAddParams() { + +} + +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType string + +const ( + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeOnetimepin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "onetimepin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeAzureAd ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "azureAD" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeSaml ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "saml" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeCentrify ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "centrify" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeFacebook ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "facebook" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeGitHub ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "github" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeGoogleApps ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "google-apps" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeGoogle ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "google" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeLinkedin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "linkedin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeOidc ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "oidc" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeOkta ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "okta" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeOnelogin ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "onelogin" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypePingone ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "pingone" + ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexTypeYandex ZoneAccessIdentityProviderAddParamsPajwohLqSchemasYandexType = "yandex" +) diff --git a/zoneaccessidentityprovider_test.go b/zoneaccessidentityprovider_test.go new file mode 100644 index 00000000000..bdc2384f09b --- /dev/null +++ b/zoneaccessidentityprovider_test.go @@ -0,0 +1,195 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAccessIdentityProviderGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.IdentityProviders.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestZoneAccessIdentityProviderUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.IdentityProviders.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAd{ + Config: cloudflare.F(cloudflare.ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdConfig{ + ClientID: cloudflare.F(""), + ClientSecret: cloudflare.F(""), + ConditionalAccessEnabled: cloudflare.F(true), + DirectoryID: cloudflare.F(""), + SupportGroups: cloudflare.F(true), + }), + Name: cloudflare.F("Widget Corps IDP"), + ScimConfig: cloudflare.F(cloudflare.ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdScimConfig{ + Enabled: cloudflare.F(true), + GroupMemberDeprovision: cloudflare.F(true), + SeatDeprovision: cloudflare.F(true), + Secret: cloudflare.F("string"), + UserDeprovision: cloudflare.F(true), + }), + Type: cloudflare.F(cloudflare.ZoneAccessIdentityProviderUpdateParamsPajwohLqSchemasAzureAdTypeOnetimepin), + }, + ) + 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 TestZoneAccessIdentityProviderList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.IdentityProviders.List(context.TODO(), "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()) + } +} + +func TestZoneAccessIdentityProviderDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.IdentityProviders.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestZoneAccessIdentityProviderAddWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.IdentityProviders.Add( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAd{ + Config: cloudflare.F(cloudflare.ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdConfig{ + ClientID: cloudflare.F(""), + ClientSecret: cloudflare.F(""), + ConditionalAccessEnabled: cloudflare.F(true), + DirectoryID: cloudflare.F(""), + SupportGroups: cloudflare.F(true), + }), + Name: cloudflare.F("Widget Corps IDP"), + ScimConfig: cloudflare.F(cloudflare.ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdScimConfig{ + Enabled: cloudflare.F(true), + GroupMemberDeprovision: cloudflare.F(true), + SeatDeprovision: cloudflare.F(true), + Secret: cloudflare.F("string"), + UserDeprovision: cloudflare.F(true), + }), + Type: cloudflare.F(cloudflare.ZoneAccessIdentityProviderAddParamsPajwohLqSchemasAzureAdTypeOnetimepin), + }, + ) + 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/zoneaccessorganization.go b/zoneaccessorganization.go new file mode 100644 index 00000000000..dda1ac45673 --- /dev/null +++ b/zoneaccessorganization.go @@ -0,0 +1,617 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAccessOrganizationService 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 [NewZoneAccessOrganizationService] +// method instead. +type ZoneAccessOrganizationService struct { + Options []option.RequestOption +} + +// NewZoneAccessOrganizationService 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 NewZoneAccessOrganizationService(opts ...option.RequestOption) (r *ZoneAccessOrganizationService) { + r = &ZoneAccessOrganizationService{} + r.Options = opts + return +} + +// Revokes a user's access across all applications. +func (r *ZoneAccessOrganizationService) RevokeUser(ctx context.Context, identifier interface{}, body ZoneAccessOrganizationRevokeUserParams, opts ...option.RequestOption) (res *ZoneAccessOrganizationRevokeUserResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/access/organizations/revoke_user", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Sets up a Zero Trust organization for your account. +func (r *ZoneAccessOrganizationService) ZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganization(ctx context.Context, identifier interface{}, body ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParams, opts ...option.RequestOption) (res *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/access/organizations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Returns the configuration for your Zero Trust organization. +func (r *ZoneAccessOrganizationService) ZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganization(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/access/organizations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the configuration for your Zero Trust organization. +func (r *ZoneAccessOrganizationService) ZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganization(ctx context.Context, identifier interface{}, body ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams, opts ...option.RequestOption) (res *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/access/organizations", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneAccessOrganizationRevokeUserResponse struct { + Result ZoneAccessOrganizationRevokeUserResponseResult `json:"result"` + Success ZoneAccessOrganizationRevokeUserResponseSuccess `json:"success"` + JSON zoneAccessOrganizationRevokeUserResponseJSON `json:"-"` +} + +// zoneAccessOrganizationRevokeUserResponseJSON contains the JSON metadata for the +// struct [ZoneAccessOrganizationRevokeUserResponse] +type zoneAccessOrganizationRevokeUserResponseJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationRevokeUserResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationRevokeUserResponseResult bool + +const ( + ZoneAccessOrganizationRevokeUserResponseResultTrue ZoneAccessOrganizationRevokeUserResponseResult = true + ZoneAccessOrganizationRevokeUserResponseResultFalse ZoneAccessOrganizationRevokeUserResponseResult = false +) + +type ZoneAccessOrganizationRevokeUserResponseSuccess bool + +const ( + ZoneAccessOrganizationRevokeUserResponseSuccessTrue ZoneAccessOrganizationRevokeUserResponseSuccess = true + ZoneAccessOrganizationRevokeUserResponseSuccessFalse ZoneAccessOrganizationRevokeUserResponseSuccess = false +) + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponse struct { + Errors []ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError `json:"errors"` + Messages []ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage `json:"messages"` + Result ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccess `json:"success"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponse] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseErrorJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessageJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain string `json:"auth_domain"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly bool `json:"is_ui_read_only"` + LoginDesign ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign `json:"login_design"` + // The name of your Zero Trust organization. + Name string `json:"name"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason string `json:"ui_read_only_toggle_reason"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultJSON struct { + AuthDomain apijson.Field + CreatedAt apijson.Field + IsUiReadOnly apijson.Field + LoginDesign apijson.Field + Name apijson.Field + UiReadOnlyToggleReason apijson.Field + UpdatedAt apijson.Field + UserSeatExpirationInactiveTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign struct { + // The background color on your login page. + BackgroundColor string `json:"background_color"` + // The text at the bottom of your login page. + FooterText string `json:"footer_text"` + // The text at the top of your login page. + HeaderText string `json:"header_text"` + // The URL of the logo on your login page. + LogoPath string `json:"logo_path"` + // The text color on your login page. + TextColor string `json:"text_color"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesignJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesignJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesignJSON struct { + BackgroundColor apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + TextColor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseResultLoginDesign) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccess bool + +const ( + ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccessTrue ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationResponseSuccess = true +) + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponse struct { + Errors []ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError `json:"errors"` + Messages []ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage `json:"messages"` + Result ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccess `json:"success"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponse] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseErrorJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessageJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain string `json:"auth_domain"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly bool `json:"is_ui_read_only"` + LoginDesign ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign `json:"login_design"` + // The name of your Zero Trust organization. + Name string `json:"name"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason string `json:"ui_read_only_toggle_reason"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultJSON struct { + AuthDomain apijson.Field + CreatedAt apijson.Field + IsUiReadOnly apijson.Field + LoginDesign apijson.Field + Name apijson.Field + UiReadOnlyToggleReason apijson.Field + UpdatedAt apijson.Field + UserSeatExpirationInactiveTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign struct { + // The background color on your login page. + BackgroundColor string `json:"background_color"` + // The text at the bottom of your login page. + FooterText string `json:"footer_text"` + // The text at the top of your login page. + HeaderText string `json:"header_text"` + // The URL of the logo on your login page. + LogoPath string `json:"logo_path"` + // The text color on your login page. + TextColor string `json:"text_color"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesignJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesignJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesignJSON struct { + BackgroundColor apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + TextColor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseResultLoginDesign) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccess bool + +const ( + ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccessTrue ZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganizationResponseSuccess = true +) + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse struct { + Errors []ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError `json:"errors"` + Messages []ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage `json:"messages"` + Result ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccess `json:"success"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseErrorJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessageJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain string `json:"auth_domain"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly bool `json:"is_ui_read_only"` + LoginDesign ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign `json:"login_design"` + // The name of your Zero Trust organization. + Name string `json:"name"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason string `json:"ui_read_only_toggle_reason"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultJSON struct { + AuthDomain apijson.Field + CreatedAt apijson.Field + IsUiReadOnly apijson.Field + LoginDesign apijson.Field + Name apijson.Field + UiReadOnlyToggleReason apijson.Field + UpdatedAt apijson.Field + UserSeatExpirationInactiveTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign struct { + // The background color on your login page. + BackgroundColor string `json:"background_color"` + // The text at the bottom of your login page. + FooterText string `json:"footer_text"` + // The text at the top of your login page. + HeaderText string `json:"header_text"` + // The URL of the logo on your login page. + LogoPath string `json:"logo_path"` + // The text color on your login page. + TextColor string `json:"text_color"` + JSON zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesignJSON `json:"-"` +} + +// zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesignJSON +// contains the JSON metadata for the struct +// [ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign] +type zoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesignJSON struct { + BackgroundColor apijson.Field + FooterText apijson.Field + HeaderText apijson.Field + LogoPath apijson.Field + TextColor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseResultLoginDesign) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccess bool + +const ( + ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccessTrue ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationResponseSuccess = true +) + +type ZoneAccessOrganizationRevokeUserParams struct { + // The email of the user to revoke. + Email param.Field[string] `json:"email,required"` +} + +func (r ZoneAccessOrganizationRevokeUserParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParams struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain param.Field[string] `json:"auth_domain,required"` + // The name of your Zero Trust organization. + Name param.Field[string] `json:"name,required"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly param.Field[bool] `json:"is_ui_read_only"` + LoginDesign param.Field[ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign] `json:"login_design"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason param.Field[string] `json:"ui_read_only_toggle_reason"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime param.Field[string] `json:"user_seat_expiration_inactive_time"` +} + +func (r ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign struct { + // The background color on your login page. + BackgroundColor param.Field[string] `json:"background_color"` + // The text at the bottom of your login page. + FooterText param.Field[string] `json:"footer_text"` + // The text at the top of your login page. + HeaderText param.Field[string] `json:"header_text"` + // The URL of the logo on your login page. + LogoPath param.Field[string] `json:"logo_path"` + // The text color on your login page. + TextColor param.Field[string] `json:"text_color"` +} + +func (r ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams struct { + // The unique subdomain assigned to your Zero Trust organization. + AuthDomain param.Field[string] `json:"auth_domain"` + // Lock all settings as Read-Only in the Dashboard, regardless of user permission. + // Updates may only be made via the API or Terraform for this account when enabled. + IsUiReadOnly param.Field[bool] `json:"is_ui_read_only"` + LoginDesign param.Field[ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign] `json:"login_design"` + // The name of your Zero Trust organization. + Name param.Field[string] `json:"name"` + // A description of the reason why the UI read only field is being toggled. + UiReadOnlyToggleReason param.Field[string] `json:"ui_read_only_toggle_reason"` + // The amount of time a user seat is inactive before it expires. When the user seat + // exceeds the set time of inactivity, the user is removed as an active seat and no + // longer counts against your Teams seat count. Must be in the format `300ms` or + // `2h45m`. Valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. + UserSeatExpirationInactiveTime param.Field[string] `json:"user_seat_expiration_inactive_time"` +} + +func (r ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign struct { + // The background color on your login page. + BackgroundColor param.Field[string] `json:"background_color"` + // The text at the bottom of your login page. + FooterText param.Field[string] `json:"footer_text"` + // The text at the top of your login page. + HeaderText param.Field[string] `json:"header_text"` + // The URL of the logo on your login page. + LogoPath param.Field[string] `json:"logo_path"` + // The text color on your login page. + TextColor param.Field[string] `json:"text_color"` +} + +func (r ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneaccessorganization_test.go b/zoneaccessorganization_test.go new file mode 100644 index 00000000000..aaefd92ff76 --- /dev/null +++ b/zoneaccessorganization_test.go @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAccessOrganizationRevokeUser(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Organizations.RevokeUser( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneAccessOrganizationRevokeUserParams{ + Email: cloudflare.F("test@example.com"), + }, + ) + 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 TestZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Organizations.ZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganization( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParams{ + AuthDomain: cloudflare.F("test.cloudflareaccess.com"), + Name: cloudflare.F("Widget Corps Internal Applications"), + IsUiReadOnly: cloudflare.F(true), + LoginDesign: cloudflare.F(cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationNewYourZeroTrustOrganizationParamsLoginDesign{ + BackgroundColor: cloudflare.F("#c5ed1b"), + FooterText: cloudflare.F("This is an example description."), + HeaderText: cloudflare.F("This is an example description."), + LogoPath: cloudflare.F("https://example.com/logo.png"), + TextColor: cloudflare.F("#c5ed1b"), + }), + UiReadOnlyToggleReason: cloudflare.F("Temporarily turn off the UI read only lock to make a change via the UI"), + UserSeatExpirationInactiveTime: cloudflare.F("720h"), + }, + ) + 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 TestZoneAccessOrganizationZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganization(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Organizations.ZoneLevelZeroTrustOrganizationGetYourZeroTrustOrganization(context.TODO(), "699d98642c564d2e855e9661899b7252") + 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 TestZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.Organizations.ZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganization( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParams{ + AuthDomain: cloudflare.F("test.cloudflareaccess.com"), + IsUiReadOnly: cloudflare.F(true), + LoginDesign: cloudflare.F(cloudflare.ZoneAccessOrganizationZoneLevelZeroTrustOrganizationUpdateYourZeroTrustOrganizationParamsLoginDesign{ + BackgroundColor: cloudflare.F("#c5ed1b"), + FooterText: cloudflare.F("This is an example description."), + HeaderText: cloudflare.F("This is an example description."), + LogoPath: cloudflare.F("https://example.com/logo.png"), + TextColor: cloudflare.F("#c5ed1b"), + }), + Name: cloudflare.F("Widget Corps Internal Applications"), + UiReadOnlyToggleReason: cloudflare.F("Temporarily turn off the UI read only lock to make a change via the UI"), + UserSeatExpirationInactiveTime: cloudflare.F("720h"), + }, + ) + 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/zoneaccessservicetoken.go b/zoneaccessservicetoken.go new file mode 100644 index 00000000000..45ab27c994c --- /dev/null +++ b/zoneaccessservicetoken.go @@ -0,0 +1,547 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAccessServiceTokenService 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 [NewZoneAccessServiceTokenService] +// method instead. +type ZoneAccessServiceTokenService struct { + Options []option.RequestOption +} + +// NewZoneAccessServiceTokenService 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 NewZoneAccessServiceTokenService(opts ...option.RequestOption) (r *ZoneAccessServiceTokenService) { + r = &ZoneAccessServiceTokenService{} + r.Options = opts + return +} + +// Updates a configured service token. +func (r *ZoneAccessServiceTokenService) Update(ctx context.Context, identifier string, uuid string, body ZoneAccessServiceTokenUpdateParams, opts ...option.RequestOption) (res *ZoneAccessServiceTokenUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/service_tokens/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a service token. +func (r *ZoneAccessServiceTokenService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *ZoneAccessServiceTokenDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/service_tokens/%s", identifier, uuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Generates a new service token. **Note:** This is the only time you can get the +// Client Secret. If you lose the Client Secret, you will have to create a new +// service token. +func (r *ZoneAccessServiceTokenService) ZoneLevelAccessServiceTokensNewAServiceToken(ctx context.Context, identifier string, body ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenParams, opts ...option.RequestOption) (res *ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/service_tokens", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists all service tokens. +func (r *ZoneAccessServiceTokenService) ZoneLevelAccessServiceTokensListServiceTokens(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/access/service_tokens", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneAccessServiceTokenUpdateResponse struct { + Errors []ZoneAccessServiceTokenUpdateResponseError `json:"errors"` + Messages []ZoneAccessServiceTokenUpdateResponseMessage `json:"messages"` + Result ZoneAccessServiceTokenUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessServiceTokenUpdateResponseSuccess `json:"success"` + JSON zoneAccessServiceTokenUpdateResponseJSON `json:"-"` +} + +// zoneAccessServiceTokenUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneAccessServiceTokenUpdateResponse] +type zoneAccessServiceTokenUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenUpdateResponseErrorJSON `json:"-"` +} + +// zoneAccessServiceTokenUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAccessServiceTokenUpdateResponseError] +type zoneAccessServiceTokenUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenUpdateResponseMessageJSON `json:"-"` +} + +// zoneAccessServiceTokenUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAccessServiceTokenUpdateResponseMessage] +type zoneAccessServiceTokenUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenUpdateResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessServiceTokenUpdateResponseResultJSON `json:"-"` +} + +// zoneAccessServiceTokenUpdateResponseResultJSON contains the JSON metadata for +// the struct [ZoneAccessServiceTokenUpdateResponseResult] +type zoneAccessServiceTokenUpdateResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessServiceTokenUpdateResponseSuccess bool + +const ( + ZoneAccessServiceTokenUpdateResponseSuccessTrue ZoneAccessServiceTokenUpdateResponseSuccess = true +) + +type ZoneAccessServiceTokenDeleteResponse struct { + Errors []ZoneAccessServiceTokenDeleteResponseError `json:"errors"` + Messages []ZoneAccessServiceTokenDeleteResponseMessage `json:"messages"` + Result ZoneAccessServiceTokenDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessServiceTokenDeleteResponseSuccess `json:"success"` + JSON zoneAccessServiceTokenDeleteResponseJSON `json:"-"` +} + +// zoneAccessServiceTokenDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneAccessServiceTokenDeleteResponse] +type zoneAccessServiceTokenDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenDeleteResponseErrorJSON `json:"-"` +} + +// zoneAccessServiceTokenDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAccessServiceTokenDeleteResponseError] +type zoneAccessServiceTokenDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenDeleteResponseMessageJSON `json:"-"` +} + +// zoneAccessServiceTokenDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAccessServiceTokenDeleteResponseMessage] +type zoneAccessServiceTokenDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenDeleteResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessServiceTokenDeleteResponseResultJSON `json:"-"` +} + +// zoneAccessServiceTokenDeleteResponseResultJSON contains the JSON metadata for +// the struct [ZoneAccessServiceTokenDeleteResponseResult] +type zoneAccessServiceTokenDeleteResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessServiceTokenDeleteResponseSuccess bool + +const ( + ZoneAccessServiceTokenDeleteResponseSuccessTrue ZoneAccessServiceTokenDeleteResponseSuccess = true +) + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponse struct { + Errors []ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseError `json:"errors"` + Messages []ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseMessage `json:"messages"` + Result ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseSuccess `json:"success"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponse] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseErrorJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseError] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseMessageJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseMessage] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + // The Client Secret for the service token. Access will check for this value in the + // `CF-Access-Client-Secret` request header. + ClientSecret string `json:"client_secret"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseResultJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseResult] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseSuccess bool + +const ( + ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseSuccessTrue ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenResponseSuccess = true +) + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponse struct { + Errors []ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseError `json:"errors"` + Messages []ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseMessage `json:"messages"` + Result []ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResult `json:"result"` + ResultInfo ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseSuccess `json:"success"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponse] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseErrorJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseError] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseMessageJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseMessage] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResult struct { + // The ID of the service token. + ID interface{} `json:"id"` + // The Client ID for the service token. Access will check for this value in the + // `CF-Access-Client-ID` request header. + ClientID string `json:"client_id"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + // 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"` + // The name of the service token. + Name string `json:"name"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResult] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultJSON struct { + ID apijson.Field + ClientID apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Name apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultInfoJSON `json:"-"` +} + +// zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultInfo] +type zoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseSuccess bool + +const ( + ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseSuccessTrue ZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokensResponseSuccess = true +) + +type ZoneAccessServiceTokenUpdateParams struct { + // 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 param.Field[string] `json:"duration"` + // The name of the service token. + Name param.Field[string] `json:"name"` +} + +func (r ZoneAccessServiceTokenUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenParams struct { + // The name of the service token. + Name param.Field[string] `json:"name,required"` + // 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 param.Field[string] `json:"duration"` +} + +func (r ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneaccessservicetoken_test.go b/zoneaccessservicetoken_test.go new file mode 100644 index 00000000000..aa13442f7b0 --- /dev/null +++ b/zoneaccessservicetoken_test.go @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAccessServiceTokenUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.ServiceTokens.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.ZoneAccessServiceTokenUpdateParams{ + Duration: cloudflare.F("60m"), + Name: cloudflare.F("CI/CD token"), + }, + ) + 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 TestZoneAccessServiceTokenDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.ServiceTokens.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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 TestZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.ServiceTokens.ZoneLevelAccessServiceTokensNewAServiceToken( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAccessServiceTokenZoneLevelAccessServiceTokensNewAServiceTokenParams{ + Name: cloudflare.F("CI/CD token"), + Duration: cloudflare.F("60m"), + }, + ) + 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 TestZoneAccessServiceTokenZoneLevelAccessServiceTokensListServiceTokens(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Accesses.ServiceTokens.ZoneLevelAccessServiceTokensListServiceTokens(context.TODO(), "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/zoneacm.go b/zoneacm.go new file mode 100644 index 00000000000..5a6c412013f --- /dev/null +++ b/zoneacm.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAcmService 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 [NewZoneAcmService] method instead. +type ZoneAcmService struct { + Options []option.RequestOption + TotalTls *ZoneAcmTotalTlService +} + +// NewZoneAcmService 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 NewZoneAcmService(opts ...option.RequestOption) (r *ZoneAcmService) { + r = &ZoneAcmService{} + r.Options = opts + r.TotalTls = NewZoneAcmTotalTlService(opts...) + return +} diff --git a/zoneacmtotaltl.go b/zoneacmtotaltl.go new file mode 100644 index 00000000000..d16efd6042f --- /dev/null +++ b/zoneacmtotaltl.go @@ -0,0 +1,292 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAcmTotalTlService 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 [NewZoneAcmTotalTlService] method +// instead. +type ZoneAcmTotalTlService struct { + Options []option.RequestOption +} + +// NewZoneAcmTotalTlService 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 NewZoneAcmTotalTlService(opts ...option.RequestOption) (r *ZoneAcmTotalTlService) { + r = &ZoneAcmTotalTlService{} + r.Options = opts + return +} + +// Set Total TLS Settings or disable the feature for a Zone. +func (r *ZoneAcmTotalTlService) TotalTlsEnableOrDisableTotalTls(ctx context.Context, zoneIdentifier string, body ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParams, opts ...option.RequestOption) (res *ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/acm/total_tls", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get Total TLS Settings for a Zone. +func (r *ZoneAcmTotalTlService) TotalTlsTotalTlsSettingsDetails(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/acm/total_tls", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponse struct { + Errors []ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseError `json:"errors"` + Messages []ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseMessage `json:"messages"` + Result ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseSuccess `json:"success"` + JSON zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseJSON contains the JSON +// metadata for the struct [ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponse] +type zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseErrorJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseError] +type zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseMessageJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseMessage] +type zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResult struct { + // The Certificate Authority that Total TLS certificates will be issued through. + CertificateAuthority ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultCertificateAuthority `json:"certificate_authority"` + // If enabled, Total TLS will order a hostname specific TLS certificate for any + // proxied A, AAAA, or CNAME record in your zone. + Enabled bool `json:"enabled"` + // The validity period in days for the certificates ordered via Total TLS. + ValidityDays ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultValidityDays `json:"validity_days"` + JSON zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResult] +type zoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultJSON struct { + CertificateAuthority apijson.Field + Enabled apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The Certificate Authority that Total TLS certificates will be issued through. +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultCertificateAuthority string + +const ( + ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultCertificateAuthorityGoogle ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultCertificateAuthority = "google" + ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultCertificateAuthorityLetsEncrypt ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultCertificateAuthority = "lets_encrypt" +) + +// The validity period in days for the certificates ordered via Total TLS. +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultValidityDays int64 + +const ( + ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultValidityDays90 ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseResultValidityDays = 90 +) + +// Whether the API call was successful +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseSuccess bool + +const ( + ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseSuccessTrue ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsResponseSuccess = true +) + +type ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponse struct { + Errors []ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseError `json:"errors"` + Messages []ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseMessage `json:"messages"` + Result ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseSuccess `json:"success"` + JSON zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseJSON contains the JSON +// metadata for the struct [ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponse] +type zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseErrorJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseError] +type zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseMessageJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseMessage] +type zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResult struct { + // The Certificate Authority that Total TLS certificates will be issued through. + CertificateAuthority ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultCertificateAuthority `json:"certificate_authority"` + // If enabled, Total TLS will order a hostname specific TLS certificate for any + // proxied A, AAAA, or CNAME record in your zone. + Enabled bool `json:"enabled"` + // The validity period in days for the certificates ordered via Total TLS. + ValidityDays ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultValidityDays `json:"validity_days"` + JSON zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultJSON `json:"-"` +} + +// zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResult] +type zoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultJSON struct { + CertificateAuthority apijson.Field + Enabled apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The Certificate Authority that Total TLS certificates will be issued through. +type ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultCertificateAuthority string + +const ( + ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultCertificateAuthorityGoogle ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultCertificateAuthority = "google" + ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultCertificateAuthorityLetsEncrypt ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultCertificateAuthority = "lets_encrypt" +) + +// The validity period in days for the certificates ordered via Total TLS. +type ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultValidityDays int64 + +const ( + ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultValidityDays90 ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseResultValidityDays = 90 +) + +// Whether the API call was successful +type ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseSuccess bool + +const ( + ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseSuccessTrue ZoneAcmTotalTlTotalTlsTotalTlsSettingsDetailsResponseSuccess = true +) + +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParams struct { + // If enabled, Total TLS will order a hostname specific TLS certificate for any + // proxied A, AAAA, or CNAME record in your zone. + Enabled param.Field[bool] `json:"enabled,required"` + // The Certificate Authority that Total TLS certificates will be issued through. + CertificateAuthority param.Field[ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParamsCertificateAuthority] `json:"certificate_authority"` +} + +func (r ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The Certificate Authority that Total TLS certificates will be issued through. +type ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParamsCertificateAuthority string + +const ( + ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParamsCertificateAuthorityGoogle ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParamsCertificateAuthority = "google" + ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParamsCertificateAuthorityLetsEncrypt ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParamsCertificateAuthority = "lets_encrypt" +) diff --git a/zoneacmtotaltl_test.go b/zoneacmtotaltl_test.go new file mode 100644 index 00000000000..5e5f6264d69 --- /dev/null +++ b/zoneacmtotaltl_test.go @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Acms.TotalTls.TotalTlsEnableOrDisableTotalTls( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParams{ + Enabled: cloudflare.F(true), + CertificateAuthority: cloudflare.F(cloudflare.ZoneAcmTotalTlTotalTlsEnableOrDisableTotalTlsParamsCertificateAuthorityGoogle), + }, + ) + 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 TestZoneAcmTotalTlTotalTlsTotalTlsSettingsDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Acms.TotalTls.TotalTlsTotalTlsSettingsDetails(context.TODO(), "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/zoneactivationcheck.go b/zoneactivationcheck.go new file mode 100644 index 00000000000..89cb663c552 --- /dev/null +++ b/zoneactivationcheck.go @@ -0,0 +1,131 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneActivationCheckService 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 [NewZoneActivationCheckService] +// method instead. +type ZoneActivationCheckService struct { + Options []option.RequestOption +} + +// NewZoneActivationCheckService 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 NewZoneActivationCheckService(opts ...option.RequestOption) (r *ZoneActivationCheckService) { + r = &ZoneActivationCheckService{} + r.Options = opts + return +} + +// Triggeres a new activation check for a PENDING Zone. This can be triggered every +// 5 min for paygo/ent customers, every hour for FREE Zones. +func (r *ZoneActivationCheckService) PutZonesZoneIDActivationCheck(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneActivationCheckPutZonesZoneIDActivationCheckResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/activation_check", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +type ZoneActivationCheckPutZonesZoneIDActivationCheckResponse struct { + Errors []ZoneActivationCheckPutZonesZoneIDActivationCheckResponseError `json:"errors"` + Messages []ZoneActivationCheckPutZonesZoneIDActivationCheckResponseMessage `json:"messages"` + Result ZoneActivationCheckPutZonesZoneIDActivationCheckResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneActivationCheckPutZonesZoneIDActivationCheckResponseSuccess `json:"success"` + JSON zoneActivationCheckPutZonesZoneIDActivationCheckResponseJSON `json:"-"` +} + +// zoneActivationCheckPutZonesZoneIDActivationCheckResponseJSON contains the JSON +// metadata for the struct +// [ZoneActivationCheckPutZonesZoneIDActivationCheckResponse] +type zoneActivationCheckPutZonesZoneIDActivationCheckResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckPutZonesZoneIDActivationCheckResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneActivationCheckPutZonesZoneIDActivationCheckResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneActivationCheckPutZonesZoneIDActivationCheckResponseErrorJSON `json:"-"` +} + +// zoneActivationCheckPutZonesZoneIDActivationCheckResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneActivationCheckPutZonesZoneIDActivationCheckResponseError] +type zoneActivationCheckPutZonesZoneIDActivationCheckResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckPutZonesZoneIDActivationCheckResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneActivationCheckPutZonesZoneIDActivationCheckResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneActivationCheckPutZonesZoneIDActivationCheckResponseMessageJSON `json:"-"` +} + +// zoneActivationCheckPutZonesZoneIDActivationCheckResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneActivationCheckPutZonesZoneIDActivationCheckResponseMessage] +type zoneActivationCheckPutZonesZoneIDActivationCheckResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckPutZonesZoneIDActivationCheckResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneActivationCheckPutZonesZoneIDActivationCheckResponseResult struct { + // Identifier + ID string `json:"id"` + JSON zoneActivationCheckPutZonesZoneIDActivationCheckResponseResultJSON `json:"-"` +} + +// zoneActivationCheckPutZonesZoneIDActivationCheckResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneActivationCheckPutZonesZoneIDActivationCheckResponseResult] +type zoneActivationCheckPutZonesZoneIDActivationCheckResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckPutZonesZoneIDActivationCheckResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneActivationCheckPutZonesZoneIDActivationCheckResponseSuccess bool + +const ( + ZoneActivationCheckPutZonesZoneIDActivationCheckResponseSuccessTrue ZoneActivationCheckPutZonesZoneIDActivationCheckResponseSuccess = true +) diff --git a/zoneactivationcheck_test.go b/zoneactivationcheck_test.go new file mode 100644 index 00000000000..35cec49003b --- /dev/null +++ b/zoneactivationcheck_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneActivationCheckPutZonesZoneIDActivationCheck(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ActivationChecks.PutZonesZoneIDActivationCheck(context.TODO(), "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/zoneanalytics.go b/zoneanalytics.go new file mode 100644 index 00000000000..496f8f7cb7f --- /dev/null +++ b/zoneanalytics.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAnalyticsService 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 [NewZoneAnalyticsService] method +// instead. +type ZoneAnalyticsService struct { + Options []option.RequestOption + Colo *ZoneAnalyticsColoService + Dashboards *ZoneAnalyticsDashboardService + Latencies *ZoneAnalyticsLatencyService +} + +// NewZoneAnalyticsService 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 NewZoneAnalyticsService(opts ...option.RequestOption) (r *ZoneAnalyticsService) { + r = &ZoneAnalyticsService{} + r.Options = opts + r.Colo = NewZoneAnalyticsColoService(opts...) + r.Dashboards = NewZoneAnalyticsDashboardService(opts...) + r.Latencies = NewZoneAnalyticsLatencyService(opts...) + return +} diff --git a/zoneanalyticscolo.go b/zoneanalyticscolo.go new file mode 100644 index 00000000000..8b87a274550 --- /dev/null +++ b/zoneanalyticscolo.go @@ -0,0 +1,726 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneAnalyticsColoService 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 [NewZoneAnalyticsColoService] method +// instead. +type ZoneAnalyticsColoService struct { + Options []option.RequestOption +} + +// NewZoneAnalyticsColoService 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 NewZoneAnalyticsColoService(opts ...option.RequestOption) (r *ZoneAnalyticsColoService) { + r = &ZoneAnalyticsColoService{} + r.Options = opts + return +} + +// This view provides a breakdown of analytics data by datacenter. Note: This is +// available to Enterprise customers only. +func (r *ZoneAnalyticsColoService) ZoneAnalyticsDeprecatedGetAnalyticsByCoLocations(ctx context.Context, zoneIdentifier string, query ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams, opts ...option.RequestOption) (res *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/analytics/colos", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse struct { + Errors []ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseError `json:"errors"` + Messages []ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseMessage `json:"messages"` + // The exact parameters/timestamps the analytics service used to return data. + Query ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuery `json:"query"` + // A breakdown of all dashboard analytics data by co-locations. This is limited to + // Enterprise zones only. + Result []ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseSuccess `json:"success"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Query apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseErrorJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseError] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseMessageJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseMessage] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The exact parameters/timestamps the analytics service used to return data. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuery struct { + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuerySince `json:"since"` + // The amount of time (in minutes) that each data point in the timeseries + // represents. The granularity of the time-series returned (e.g. each bucket in the + // time series representing 1-minute vs 1-day) is calculated by the API based on + // the time-range provided to the API. + TimeDelta int64 `json:"time_delta"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryUntil `json:"until"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuery] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryJSON struct { + Since apijson.Field + TimeDelta apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuerySince interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuerySince() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQuerySince)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryUntil interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryUntil() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseQueryUntil)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResult struct { + // The airport code identifer for the co-location. + ColoID string `json:"colo_id"` + // Time deltas containing metadata about each bucket of time. The number of buckets + // (resolution) is determined by the amount of time between the since and until + // parameters. + Timeseries []ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimesery `json:"timeseries"` + // Breakdown of totals by data type. + Totals ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotals `json:"totals"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResult] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultJSON struct { + ColoID apijson.Field + Timeseries apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimesery struct { + // Breakdown of totals for bandwidth in the form of bytes. + Bandwidth ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesBandwidth `json:"bandwidth"` + // Breakdown of totals for requests. + Requests ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesRequests `json:"requests"` + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesSince `json:"since"` + // Breakdown of totals for threats. + Threats ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesThreats `json:"threats"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesUntil `json:"until"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseryJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseryJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimesery] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseryJSON struct { + Bandwidth apijson.Field + Requests apijson.Field + Since apijson.Field + Threats apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimesery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for bandwidth in the form of bytes. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesBandwidth struct { + // The total number of bytes served within the time frame. + All int64 `json:"all"` + // The number of bytes that were cached (and served) by Cloudflare. + Cached int64 `json:"cached"` + // The number of bytes that were fetched and served from the origin server. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesBandwidthJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesBandwidthJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesBandwidth] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesBandwidthJSON struct { + All apijson.Field + Cached apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesBandwidth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for requests. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesRequests struct { + // Total number of requests served. + All int64 `json:"all"` + // Total number of cached requests served. + Cached int64 `json:"cached"` + // Key/value pairs where the key is a two-digit country code and the value is the + // number of requests served to that country. + Country interface{} `json:"country"` + // A variable list of key/value pairs where the key is a HTTP status code and the + // value is the number of requests with that code served. + HTTPStatus interface{} `json:"http_status"` + // Total number of requests served from the origin. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesRequestsJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesRequestsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesRequests] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesRequestsJSON struct { + All apijson.Field + Cached apijson.Field + Country apijson.Field + HTTPStatus apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesRequests) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesSince interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesSince() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesSince)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Breakdown of totals for threats. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesThreats struct { + // The total number of identifiable threats received over the time frame. + All int64 `json:"all"` + // A list of key/value pairs where the key is a two-digit country code and the + // value is the number of malicious requests received from that country. + Country interface{} `json:"country"` + // The list of key/value pairs where the key is a threat category and the value is + // the number of requests. + Type interface{} `json:"type"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesThreatsJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesThreatsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesThreats] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesThreatsJSON struct { + All apijson.Field + Country apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesThreats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesUntil interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesUntil() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTimeseriesUntil)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Breakdown of totals by data type. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotals struct { + // Breakdown of totals for bandwidth in the form of bytes. + Bandwidth ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsBandwidth `json:"bandwidth"` + // Breakdown of totals for requests. + Requests ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsRequests `json:"requests"` + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsSince `json:"since"` + // Breakdown of totals for threats. + Threats ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsThreats `json:"threats"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsUntil `json:"until"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotals] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsJSON struct { + Bandwidth apijson.Field + Requests apijson.Field + Since apijson.Field + Threats apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotals) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for bandwidth in the form of bytes. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsBandwidth struct { + // The total number of bytes served within the time frame. + All int64 `json:"all"` + // The number of bytes that were cached (and served) by Cloudflare. + Cached int64 `json:"cached"` + // The number of bytes that were fetched and served from the origin server. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsBandwidthJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsBandwidthJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsBandwidth] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsBandwidthJSON struct { + All apijson.Field + Cached apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsBandwidth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for requests. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsRequests struct { + // Total number of requests served. + All int64 `json:"all"` + // Total number of cached requests served. + Cached int64 `json:"cached"` + // Key/value pairs where the key is a two-digit country code and the value is the + // number of requests served to that country. + Country interface{} `json:"country"` + // A variable list of key/value pairs where the key is a HTTP status code and the + // value is the number of requests with that code served. + HTTPStatus interface{} `json:"http_status"` + // Total number of requests served from the origin. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsRequestsJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsRequestsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsRequests] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsRequestsJSON struct { + All apijson.Field + Cached apijson.Field + Country apijson.Field + HTTPStatus apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsRequests) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsSince interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsSince() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsSince)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Breakdown of totals for threats. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsThreats struct { + // The total number of identifiable threats received over the time frame. + All int64 `json:"all"` + // A list of key/value pairs where the key is a two-digit country code and the + // value is the number of malicious requests received from that country. + Country interface{} `json:"country"` + // The list of key/value pairs where the key is a threat category and the value is + // the number of requests. + Type interface{} `json:"type"` + JSON zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsThreatsJSON `json:"-"` +} + +// zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsThreatsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsThreats] +type zoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsThreatsJSON struct { + All apijson.Field + Country apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsThreats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsUntil interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsUntil() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseResultTotalsUntil)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Whether the API call was successful +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseSuccess bool + +const ( + ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseSuccessTrue ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseSuccess = true +) + +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams struct { + // When set to true, the API will move the requested time window backward, until it + // finds a region with completely aggregated data. + // + // The API response _may not represent the requested time window_. + Continuous param.Field[bool] `query:"continuous"` + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since param.Field[ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsSince] `query:"since"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until param.Field[ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsUntil] `query:"until"` +} + +// URLQuery serializes +// [ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams]'s +// query parameters as `url.Values`. +func (r ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Satisfied by [shared.UnionString], [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsSince interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsSince() +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Satisfied by [shared.UnionString], [shared.UnionInt]. +type ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsUntil interface { + ImplementsZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsUntil() +} diff --git a/zoneanalyticscolo_test.go b/zoneanalyticscolo_test.go new file mode 100644 index 00000000000..3fef267a7f0 --- /dev/null +++ b/zoneanalyticscolo_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Analytics.Colo.ZoneAnalyticsDeprecatedGetAnalyticsByCoLocations( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams{ + Continuous: cloudflare.F(true), + Since: cloudflare.F[cloudflare.ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsSince](shared.UnionString("2015-01-01T12:23:00Z")), + Until: cloudflare.F[cloudflare.ZoneAnalyticsColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParamsUntil](shared.UnionString("2015-01-02T12:23:00Z")), + }, + ) + 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/zoneanalyticsdashboard.go b/zoneanalyticsdashboard.go new file mode 100644 index 00000000000..84c0d549bd4 --- /dev/null +++ b/zoneanalyticsdashboard.go @@ -0,0 +1,1087 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneAnalyticsDashboardService 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 [NewZoneAnalyticsDashboardService] +// method instead. +type ZoneAnalyticsDashboardService struct { + Options []option.RequestOption +} + +// NewZoneAnalyticsDashboardService 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 NewZoneAnalyticsDashboardService(opts ...option.RequestOption) (r *ZoneAnalyticsDashboardService) { + r = &ZoneAnalyticsDashboardService{} + r.Options = opts + return +} + +// The dashboard view provides both totals and timeseries data for the given zone +// and time period across the entire Cloudflare network. +func (r *ZoneAnalyticsDashboardService) ZoneAnalyticsDeprecatedGetDashboard(ctx context.Context, zoneIdentifier string, query ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParams, opts ...option.RequestOption) (res *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/analytics/dashboard", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponse struct { + Errors []ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseError `json:"errors"` + Messages []ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseMessage `json:"messages"` + // The exact parameters/timestamps the analytics service used to return data. + Query ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuery `json:"query"` + // Totals and timeseries data. + Result ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseSuccess `json:"success"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseJSON contains +// the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponse] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Query apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseErrorJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseError] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseMessageJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseMessage] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The exact parameters/timestamps the analytics service used to return data. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuery struct { + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuerySince `json:"since"` + // The amount of time (in minutes) that each data point in the timeseries + // represents. The granularity of the time-series returned (e.g. each bucket in the + // time series representing 1-minute vs 1-day) is calculated by the API based on + // the time-range provided to the API. + TimeDelta int64 `json:"time_delta"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryUntil `json:"until"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuery] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryJSON struct { + Since apijson.Field + TimeDelta apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuerySince interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuerySince() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQuerySince)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryUntil interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryUntil() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseQueryUntil)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Totals and timeseries data. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResult struct { + // Time deltas containing metadata about each bucket of time. The number of buckets + // (resolution) is determined by the amount of time between the since and until + // parameters. + Timeseries []ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimesery `json:"timeseries"` + // Breakdown of totals by data type. + Totals ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotals `json:"totals"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResult] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultJSON struct { + Timeseries apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimesery struct { + // Breakdown of totals for bandwidth in the form of bytes. + Bandwidth ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidth `json:"bandwidth"` + // Breakdown of totals for pageviews. + Pageviews ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesPageviews `json:"pageviews"` + // Breakdown of totals for requests. + Requests ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequests `json:"requests"` + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesSince `json:"since"` + // Breakdown of totals for threats. + Threats ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesThreats `json:"threats"` + Uniques ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUniques `json:"uniques"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUntil `json:"until"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseryJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseryJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimesery] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseryJSON struct { + Bandwidth apijson.Field + Pageviews apijson.Field + Requests apijson.Field + Since apijson.Field + Threats apijson.Field + Uniques apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimesery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for bandwidth in the form of bytes. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidth struct { + // The total number of bytes served within the time frame. + All int64 `json:"all"` + // The number of bytes that were cached (and served) by Cloudflare. + Cached int64 `json:"cached"` + // A variable list of key/value pairs where the key represents the type of content + // served, and the value is the number in bytes served. + ContentType interface{} `json:"content_type"` + // A variable list of key/value pairs where the key is a two-digit country code and + // the value is the number of bytes served to that country. + Country interface{} `json:"country"` + // A break down of bytes served over HTTPS. + Ssl ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSsl `json:"ssl"` + // A breakdown of requests by their SSL protocol. + SslProtocols ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslProtocols `json:"ssl_protocols"` + // The number of bytes that were fetched and served from the origin server. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidth] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthJSON struct { + All apijson.Field + Cached apijson.Field + ContentType apijson.Field + Country apijson.Field + Ssl apijson.Field + SslProtocols apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A break down of bytes served over HTTPS. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSsl struct { + // The number of bytes served over HTTPS. + Encrypted int64 `json:"encrypted"` + // The number of bytes served over HTTP. + Unencrypted int64 `json:"unencrypted"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSsl] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslJSON struct { + Encrypted apijson.Field + Unencrypted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A breakdown of requests by their SSL protocol. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslProtocols struct { + // The number of requests served over HTTP. + None int64 `json:"none"` + // The number of requests served over TLS v1.0. + TlSv1 int64 `json:"TLSv1"` + // The number of requests served over TLS v1.1. + TlSv1_1 int64 `json:"TLSv1.1"` + // The number of requests served over TLS v1.2. + TlSv1_2 int64 `json:"TLSv1.2"` + // The number of requests served over TLS v1.3. + TlSv1_3 int64 `json:"TLSv1.3"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslProtocolsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslProtocolsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslProtocols] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslProtocolsJSON struct { + None apijson.Field + TlSv1 apijson.Field + TlSv1_1 apijson.Field + TlSv1_2 apijson.Field + TlSv1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesBandwidthSslProtocols) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for pageviews. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesPageviews struct { + // The total number of pageviews served within the time range. + All int64 `json:"all"` + // A variable list of key/value pairs representing the search engine and number of + // hits. + SearchEngine interface{} `json:"search_engine"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesPageviewsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesPageviewsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesPageviews] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesPageviewsJSON struct { + All apijson.Field + SearchEngine apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesPageviews) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for requests. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequests struct { + // Total number of requests served. + All int64 `json:"all"` + // Total number of cached requests served. + Cached int64 `json:"cached"` + // A variable list of key/value pairs where the key represents the type of content + // served, and the value is the number of requests. + ContentType interface{} `json:"content_type"` + // A variable list of key/value pairs where the key is a two-digit country code and + // the value is the number of requests served to that country. + Country interface{} `json:"country"` + // Key/value pairs where the key is a HTTP status code and the value is the number + // of requests served with that code. + HTTPStatus interface{} `json:"http_status"` + // A break down of requests served over HTTPS. + Ssl ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSsl `json:"ssl"` + // A breakdown of requests by their SSL protocol. + SslProtocols ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslProtocols `json:"ssl_protocols"` + // Total number of requests served from the origin. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequests] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsJSON struct { + All apijson.Field + Cached apijson.Field + ContentType apijson.Field + Country apijson.Field + HTTPStatus apijson.Field + Ssl apijson.Field + SslProtocols apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequests) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A break down of requests served over HTTPS. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSsl struct { + // The number of requests served over HTTPS. + Encrypted int64 `json:"encrypted"` + // The number of requests served over HTTP. + Unencrypted int64 `json:"unencrypted"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSsl] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslJSON struct { + Encrypted apijson.Field + Unencrypted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A breakdown of requests by their SSL protocol. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslProtocols struct { + // The number of requests served over HTTP. + None int64 `json:"none"` + // The number of requests served over TLS v1.0. + TlSv1 int64 `json:"TLSv1"` + // The number of requests served over TLS v1.1. + TlSv1_1 int64 `json:"TLSv1.1"` + // The number of requests served over TLS v1.2. + TlSv1_2 int64 `json:"TLSv1.2"` + // The number of requests served over TLS v1.3. + TlSv1_3 int64 `json:"TLSv1.3"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslProtocolsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslProtocolsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslProtocols] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslProtocolsJSON struct { + None apijson.Field + TlSv1 apijson.Field + TlSv1_1 apijson.Field + TlSv1_2 apijson.Field + TlSv1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesRequestsSslProtocols) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesSince interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesSince() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesSince)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Breakdown of totals for threats. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesThreats struct { + // The total number of identifiable threats received over the time frame. + All int64 `json:"all"` + // A list of key/value pairs where the key is a two-digit country code and the + // value is the number of malicious requests received from that country. + Country interface{} `json:"country"` + // The list of key/value pairs where the key is a threat category and the value is + // the number of requests. + Type interface{} `json:"type"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesThreatsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesThreatsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesThreats] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesThreatsJSON struct { + All apijson.Field + Country apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesThreats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUniques struct { + // Total number of unique IP addresses within the time range. + All int64 `json:"all"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUniquesJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUniquesJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUniques] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUniquesJSON struct { + All apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUniques) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUntil interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUntil() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTimeseriesUntil)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Breakdown of totals by data type. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotals struct { + // Breakdown of totals for bandwidth in the form of bytes. + Bandwidth ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidth `json:"bandwidth"` + // Breakdown of totals for pageviews. + Pageviews ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsPageviews `json:"pageviews"` + // Breakdown of totals for requests. + Requests ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequests `json:"requests"` + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsSince `json:"since"` + // Breakdown of totals for threats. + Threats ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsThreats `json:"threats"` + Uniques ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUniques `json:"uniques"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUntil `json:"until"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotals] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsJSON struct { + Bandwidth apijson.Field + Pageviews apijson.Field + Requests apijson.Field + Since apijson.Field + Threats apijson.Field + Uniques apijson.Field + Until apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotals) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for bandwidth in the form of bytes. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidth struct { + // The total number of bytes served within the time frame. + All int64 `json:"all"` + // The number of bytes that were cached (and served) by Cloudflare. + Cached int64 `json:"cached"` + // A variable list of key/value pairs where the key represents the type of content + // served, and the value is the number in bytes served. + ContentType interface{} `json:"content_type"` + // A variable list of key/value pairs where the key is a two-digit country code and + // the value is the number of bytes served to that country. + Country interface{} `json:"country"` + // A break down of bytes served over HTTPS. + Ssl ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSsl `json:"ssl"` + // A breakdown of requests by their SSL protocol. + SslProtocols ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslProtocols `json:"ssl_protocols"` + // The number of bytes that were fetched and served from the origin server. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidth] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthJSON struct { + All apijson.Field + Cached apijson.Field + ContentType apijson.Field + Country apijson.Field + Ssl apijson.Field + SslProtocols apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A break down of bytes served over HTTPS. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSsl struct { + // The number of bytes served over HTTPS. + Encrypted int64 `json:"encrypted"` + // The number of bytes served over HTTP. + Unencrypted int64 `json:"unencrypted"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSsl] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslJSON struct { + Encrypted apijson.Field + Unencrypted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A breakdown of requests by their SSL protocol. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslProtocols struct { + // The number of requests served over HTTP. + None int64 `json:"none"` + // The number of requests served over TLS v1.0. + TlSv1 int64 `json:"TLSv1"` + // The number of requests served over TLS v1.1. + TlSv1_1 int64 `json:"TLSv1.1"` + // The number of requests served over TLS v1.2. + TlSv1_2 int64 `json:"TLSv1.2"` + // The number of requests served over TLS v1.3. + TlSv1_3 int64 `json:"TLSv1.3"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslProtocolsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslProtocolsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslProtocols] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslProtocolsJSON struct { + None apijson.Field + TlSv1 apijson.Field + TlSv1_1 apijson.Field + TlSv1_2 apijson.Field + TlSv1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsBandwidthSslProtocols) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for pageviews. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsPageviews struct { + // The total number of pageviews served within the time range. + All int64 `json:"all"` + // A variable list of key/value pairs representing the search engine and number of + // hits. + SearchEngine interface{} `json:"search_engine"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsPageviewsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsPageviewsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsPageviews] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsPageviewsJSON struct { + All apijson.Field + SearchEngine apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsPageviews) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Breakdown of totals for requests. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequests struct { + // Total number of requests served. + All int64 `json:"all"` + // Total number of cached requests served. + Cached int64 `json:"cached"` + // A variable list of key/value pairs where the key represents the type of content + // served, and the value is the number of requests. + ContentType interface{} `json:"content_type"` + // A variable list of key/value pairs where the key is a two-digit country code and + // the value is the number of requests served to that country. + Country interface{} `json:"country"` + // Key/value pairs where the key is a HTTP status code and the value is the number + // of requests served with that code. + HTTPStatus interface{} `json:"http_status"` + // A break down of requests served over HTTPS. + Ssl ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSsl `json:"ssl"` + // A breakdown of requests by their SSL protocol. + SslProtocols ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslProtocols `json:"ssl_protocols"` + // Total number of requests served from the origin. + Uncached int64 `json:"uncached"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequests] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsJSON struct { + All apijson.Field + Cached apijson.Field + ContentType apijson.Field + Country apijson.Field + HTTPStatus apijson.Field + Ssl apijson.Field + SslProtocols apijson.Field + Uncached apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequests) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A break down of requests served over HTTPS. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSsl struct { + // The number of requests served over HTTPS. + Encrypted int64 `json:"encrypted"` + // The number of requests served over HTTP. + Unencrypted int64 `json:"unencrypted"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSsl] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslJSON struct { + Encrypted apijson.Field + Unencrypted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A breakdown of requests by their SSL protocol. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslProtocols struct { + // The number of requests served over HTTP. + None int64 `json:"none"` + // The number of requests served over TLS v1.0. + TlSv1 int64 `json:"TLSv1"` + // The number of requests served over TLS v1.1. + TlSv1_1 int64 `json:"TLSv1.1"` + // The number of requests served over TLS v1.2. + TlSv1_2 int64 `json:"TLSv1.2"` + // The number of requests served over TLS v1.3. + TlSv1_3 int64 `json:"TLSv1.3"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslProtocolsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslProtocolsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslProtocols] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslProtocolsJSON struct { + None apijson.Field + TlSv1 apijson.Field + TlSv1_1 apijson.Field + TlSv1_2 apijson.Field + TlSv1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsRequestsSslProtocols) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsSince interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsSince() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsSince)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Breakdown of totals for threats. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsThreats struct { + // The total number of identifiable threats received over the time frame. + All int64 `json:"all"` + // A list of key/value pairs where the key is a two-digit country code and the + // value is the number of malicious requests received from that country. + Country interface{} `json:"country"` + // The list of key/value pairs where the key is a threat category and the value is + // the number of requests. + Type interface{} `json:"type"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsThreatsJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsThreatsJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsThreats] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsThreatsJSON struct { + All apijson.Field + Country apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsThreats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUniques struct { + // Total number of unique IP addresses within the time range. + All int64 `json:"all"` + JSON zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUniquesJSON `json:"-"` +} + +// zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUniquesJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUniques] +type zoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUniquesJSON struct { + All apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUniques) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Union satisfied by [shared.UnionString] or [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUntil interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUntil() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseResultTotalsUntil)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionInt(0)), + }, + ) +} + +// Whether the API call was successful +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseSuccess bool + +const ( + ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseSuccessTrue ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardResponseSuccess = true +) + +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParams struct { + // When set to true, the API will move the requested time window backward, until it + // finds a region with completely aggregated data. + // + // The API response _may not represent the requested time window_. + Continuous param.Field[bool] `query:"continuous"` + // The (inclusive) beginning of the requested time frame. This value can be a + // negative integer representing the number of minutes in the past relative to time + // the request is made, or can be an absolute timestamp that conforms to RFC 3339. + // At this point in time, it cannot exceed a time in the past greater than one + // year. + // + // Ranges that the Cloudflare web application provides will provide the following + // period length for each point: + // + // - Last 60 minutes (from -59 to -1): 1 minute resolution + // - Last 7 hours (from -419 to -60): 15 minutes resolution + // - Last 15 hours (from -899 to -420): 30 minutes resolution + // - Last 72 hours (from -4320 to -900): 1 hour resolution + // - Older than 3 days (-525600 to -4320): 1 day resolution. + Since param.Field[ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsSince] `query:"since"` + // The (exclusive) end of the requested time frame. This value can be a negative + // integer representing the number of minutes in the past relative to time the + // request is made, or can be an absolute timestamp that conforms to RFC 3339. If + // omitted, the time of the request is used. + Until param.Field[ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsUntil] `query:"until"` +} + +// URLQuery serializes +// [ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParams]'s query +// parameters as `url.Values`. +func (r ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The (inclusive) beginning of the requested time frame. This value can be a +// negative integer representing the number of minutes in the past relative to time +// the request is made, or can be an absolute timestamp that conforms to RFC 3339. +// At this point in time, it cannot exceed a time in the past greater than one +// year. +// +// Ranges that the Cloudflare web application provides will provide the following +// period length for each point: +// +// - Last 60 minutes (from -59 to -1): 1 minute resolution +// - Last 7 hours (from -419 to -60): 15 minutes resolution +// - Last 15 hours (from -899 to -420): 30 minutes resolution +// - Last 72 hours (from -4320 to -900): 1 hour resolution +// - Older than 3 days (-525600 to -4320): 1 day resolution. +// +// Satisfied by [shared.UnionString], [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsSince interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsSince() +} + +// The (exclusive) end of the requested time frame. This value can be a negative +// integer representing the number of minutes in the past relative to time the +// request is made, or can be an absolute timestamp that conforms to RFC 3339. If +// omitted, the time of the request is used. +// +// Satisfied by [shared.UnionString], [shared.UnionInt]. +type ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsUntil interface { + ImplementsZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsUntil() +} diff --git a/zoneanalyticsdashboard_test.go b/zoneanalyticsdashboard_test.go new file mode 100644 index 00000000000..f4da5ce376e --- /dev/null +++ b/zoneanalyticsdashboard_test.go @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Analytics.Dashboards.ZoneAnalyticsDeprecatedGetDashboard( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParams{ + Continuous: cloudflare.F(true), + Since: cloudflare.F[cloudflare.ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsSince](shared.UnionString("2015-01-01T12:23:00Z")), + Until: cloudflare.F[cloudflare.ZoneAnalyticsDashboardZoneAnalyticsDeprecatedGetDashboardParamsUntil](shared.UnionString("2015-01-02T12:23:00Z")), + }, + ) + 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/zoneanalyticslatency.go b/zoneanalyticslatency.go new file mode 100644 index 00000000000..97d0878c137 --- /dev/null +++ b/zoneanalyticslatency.go @@ -0,0 +1,130 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAnalyticsLatencyService 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 [NewZoneAnalyticsLatencyService] +// method instead. +type ZoneAnalyticsLatencyService struct { + Options []option.RequestOption + Colos *ZoneAnalyticsLatencyColoService +} + +// NewZoneAnalyticsLatencyService 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 NewZoneAnalyticsLatencyService(opts ...option.RequestOption) (r *ZoneAnalyticsLatencyService) { + r = &ZoneAnalyticsLatencyService{} + r.Options = opts + r.Colos = NewZoneAnalyticsLatencyColoService(opts...) + return +} + +// Argo Analytics for a zone +func (r *ZoneAnalyticsLatencyService) ArgoAnalyticsForZoneArgoAnalyticsForAZone(ctx context.Context, zoneIdentifier string, query ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneParams, opts ...option.RequestOption) (res *ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/analytics/latency", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponse struct { + Errors []ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseError `json:"errors"` + Messages []ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseSuccess `json:"success"` + JSON zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseJSON `json:"-"` +} + +// zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponse] +type zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseErrorJSON `json:"-"` +} + +// zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseError] +type zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseMessageJSON `json:"-"` +} + +// zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseMessage] +type zoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseSuccess bool + +const ( + ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseSuccessTrue ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneResponseSuccess = true +) + +type ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneParams struct { + Bins param.Field[string] `query:"bins"` +} + +// URLQuery serializes +// [ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneParams]'s query +// parameters as `url.Values`. +func (r ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zoneanalyticslatency_test.go b/zoneanalyticslatency_test.go new file mode 100644 index 00000000000..066ac7111d4 --- /dev/null +++ b/zoneanalyticslatency_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Analytics.Latencies.ArgoAnalyticsForZoneArgoAnalyticsForAZone( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAnalyticsLatencyArgoAnalyticsForZoneArgoAnalyticsForAZoneParams{ + Bins: cloudflare.F("string"), + }, + ) + 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/zoneanalyticslatencycolo.go b/zoneanalyticslatencycolo.go new file mode 100644 index 00000000000..bc8a76b7d1a --- /dev/null +++ b/zoneanalyticslatencycolo.go @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAnalyticsLatencyColoService 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 +// [NewZoneAnalyticsLatencyColoService] method instead. +type ZoneAnalyticsLatencyColoService struct { + Options []option.RequestOption +} + +// NewZoneAnalyticsLatencyColoService 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 NewZoneAnalyticsLatencyColoService(opts ...option.RequestOption) (r *ZoneAnalyticsLatencyColoService) { + r = &ZoneAnalyticsLatencyColoService{} + r.Options = opts + return +} + +// Argo Analytics for a zone at different PoPs +func (r *ZoneAnalyticsLatencyColoService) ArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPs(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/analytics/latency/colos", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponse struct { + Errors []ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseError `json:"errors"` + Messages []ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseSuccess `json:"success"` + JSON zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseJSON `json:"-"` +} + +// zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponse] +type zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseErrorJSON `json:"-"` +} + +// zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseError] +type zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseMessageJSON `json:"-"` +} + +// zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseMessage] +type zoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseSuccess bool + +const ( + ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseSuccessTrue ZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPsResponseSuccess = true +) diff --git a/zoneanalyticslatencycolo_test.go b/zoneanalyticslatencycolo_test.go new file mode 100644 index 00000000000..79909f4adae --- /dev/null +++ b/zoneanalyticslatencycolo_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAnalyticsLatencyColoArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Analytics.Latencies.Colos.ArgoAnalyticsForGeolocationArgoAnalyticsForAZoneAtDifferentPoPs(context.TODO(), "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/zoneapigateway.go b/zoneapigateway.go new file mode 100644 index 00000000000..e8cf22cd324 --- /dev/null +++ b/zoneapigateway.go @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAPIGatewayService 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 [NewZoneAPIGatewayService] method +// instead. +type ZoneAPIGatewayService struct { + Options []option.RequestOption + Configurations *ZoneAPIGatewayConfigurationService + Discovery *ZoneAPIGatewayDiscoveryService + Schemas *ZoneAPIGatewaySchemaService + Settings *ZoneAPIGatewaySettingService + UserSchemas *ZoneAPIGatewayUserSchemaService +} + +// NewZoneAPIGatewayService 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 NewZoneAPIGatewayService(opts ...option.RequestOption) (r *ZoneAPIGatewayService) { + r = &ZoneAPIGatewayService{} + r.Options = opts + r.Configurations = NewZoneAPIGatewayConfigurationService(opts...) + r.Discovery = NewZoneAPIGatewayDiscoveryService(opts...) + r.Schemas = NewZoneAPIGatewaySchemaService(opts...) + r.Settings = NewZoneAPIGatewaySettingService(opts...) + r.UserSchemas = NewZoneAPIGatewayUserSchemaService(opts...) + return +} diff --git a/zoneapigatewayconfiguration.go b/zoneapigatewayconfiguration.go new file mode 100644 index 00000000000..0ec400c74a4 --- /dev/null +++ b/zoneapigatewayconfiguration.go @@ -0,0 +1,298 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneAPIGatewayConfigurationService 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 +// [NewZoneAPIGatewayConfigurationService] method instead. +type ZoneAPIGatewayConfigurationService struct { + Options []option.RequestOption +} + +// NewZoneAPIGatewayConfigurationService 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 NewZoneAPIGatewayConfigurationService(opts ...option.RequestOption) (r *ZoneAPIGatewayConfigurationService) { + r = &ZoneAPIGatewayConfigurationService{} + r.Options = opts + return +} + +// Retrieve information about specific configuration properties +func (r *ZoneAPIGatewayConfigurationService) APIShieldSettingsGetInformationAboutSpecificConfigurationProperties(ctx context.Context, zoneID string, query ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParams, opts ...option.RequestOption) (res *ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/configuration", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Set configuration properties +func (r *ZoneAPIGatewayConfigurationService) APIShieldSettingsSetConfigurationProperties(ctx context.Context, zoneID string, body ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParams, opts ...option.RequestOption) (res *ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/configuration", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponse struct { + Errors []ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseError `json:"errors"` + Messages []ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseMessage `json:"messages"` + Result ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponse] +type zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseError] +type zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseMessage] +type zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResult struct { + AuthIDCharacteristics []ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristic `json:"auth_id_characteristics"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResult] +type zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultJSON struct { + AuthIDCharacteristics apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristic struct { + // The name of the characteristic field, i.e., the header or cookie name. + Name string `json:"name,required"` + // The type of characteristic. + Type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicsType `json:"type,required"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristic] +type zoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicJSON struct { + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristic) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of characteristic. +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicsType string + +const ( + ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicsTypeHeader ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicsType = "header" + ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicsTypeCookie ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesResponseResultAuthIDCharacteristicsType = "cookie" +) + +type ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponse struct { + Errors []ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseError `json:"errors"` + Messages []ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseMessage `json:"messages"` + Result ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponse] +type zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseError] +type zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseMessage] +type zoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseResultUnknown] +// or [shared.UnionString]. +type ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseResult interface { + ImplementsZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParams struct { + // Requests information about certain properties. + Properties param.Field[[]ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParamsProperty] `query:"properties"` +} + +// URLQuery serializes +// [ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParams]'s +// query parameters as `url.Values`. +func (r ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParamsProperty string + +const ( + ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParamsPropertyAuthIDCharacteristics ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParamsProperty = "auth_id_characteristics" +) + +type ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParams struct { + AuthIDCharacteristics param.Field[[]ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristic] `json:"auth_id_characteristics"` +} + +func (r ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristic struct { + // The name of the characteristic field, i.e., the header or cookie name. + Name param.Field[string] `json:"name,required"` + // The type of characteristic. + Type param.Field[ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristicsType] `json:"type,required"` +} + +func (r ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristic) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of characteristic. +type ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristicsType string + +const ( + ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristicsTypeHeader ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristicsType = "header" + ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristicsTypeCookie ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristicsType = "cookie" +) diff --git a/zoneapigatewayconfiguration_test.go b/zoneapigatewayconfiguration_test.go new file mode 100644 index 00000000000..bd5b713f670 --- /dev/null +++ b/zoneapigatewayconfiguration_test.go @@ -0,0 +1,81 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Configurations.APIShieldSettingsGetInformationAboutSpecificConfigurationProperties( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParams{ + Properties: cloudflare.F([]cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParamsProperty{cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsGetInformationAboutSpecificConfigurationPropertiesParamsPropertyAuthIDCharacteristics}), + }, + ) + 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 TestZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Configurations.APIShieldSettingsSetConfigurationProperties( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParams{ + AuthIDCharacteristics: cloudflare.F([]cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristic{{ + Name: cloudflare.F("authorization"), + Type: cloudflare.F(cloudflare.ZoneAPIGatewayConfigurationAPIShieldSettingsSetConfigurationPropertiesParamsAuthIDCharacteristicsTypeHeader), + }}), + }, + ) + 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/zoneapigatewaydiscovery.go b/zoneapigatewaydiscovery.go new file mode 100644 index 00000000000..ddbea2b7bf8 --- /dev/null +++ b/zoneapigatewaydiscovery.go @@ -0,0 +1,128 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAPIGatewayDiscoveryService 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 +// [NewZoneAPIGatewayDiscoveryService] method instead. +type ZoneAPIGatewayDiscoveryService struct { + Options []option.RequestOption + Operations *ZoneAPIGatewayDiscoveryOperationService +} + +// NewZoneAPIGatewayDiscoveryService 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 NewZoneAPIGatewayDiscoveryService(opts ...option.RequestOption) (r *ZoneAPIGatewayDiscoveryService) { + r = &ZoneAPIGatewayDiscoveryService{} + r.Options = opts + r.Operations = NewZoneAPIGatewayDiscoveryOperationService(opts...) + return +} + +// Retrieve the most up to date view of discovered operations, rendered as OpenAPI +// schemas +func (r *ZoneAPIGatewayDiscoveryService) APIShieldEndpointManagementGetAPIDiscoveryResultsForAZone(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/discovery", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponse struct { + Errors []ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseError `json:"errors"` + Messages []ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseMessage `json:"messages"` + Result ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponse] +type zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseError] +type zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseMessage] +type zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseResult struct { + Schemas []interface{} `json:"schemas"` + Timestamp time.Time `json:"timestamp" format:"date-time"` + JSON zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseResult] +type zoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseResultJSON struct { + Schemas apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZoneResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zoneapigatewaydiscovery_test.go b/zoneapigatewaydiscovery_test.go new file mode 100644 index 00000000000..1e6e8a36a9f --- /dev/null +++ b/zoneapigatewaydiscovery_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAPIGatewayDiscoveryAPIShieldEndpointManagementGetAPIDiscoveryResultsForAZone(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Discovery.APIShieldEndpointManagementGetAPIDiscoveryResultsForAZone(context.TODO(), "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/zoneapigatewaydiscoveryoperation.go b/zoneapigatewaydiscoveryoperation.go new file mode 100644 index 00000000000..7ff4c684c09 --- /dev/null +++ b/zoneapigatewaydiscoveryoperation.go @@ -0,0 +1,560 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAPIGatewayDiscoveryOperationService 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 +// [NewZoneAPIGatewayDiscoveryOperationService] method instead. +type ZoneAPIGatewayDiscoveryOperationService struct { + Options []option.RequestOption +} + +// NewZoneAPIGatewayDiscoveryOperationService 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 NewZoneAPIGatewayDiscoveryOperationService(opts ...option.RequestOption) (r *ZoneAPIGatewayDiscoveryOperationService) { + r = &ZoneAPIGatewayDiscoveryOperationService{} + r.Options = opts + return +} + +// Update the `state` on one or more discovered operations +func (r *ZoneAPIGatewayDiscoveryOperationService) Update(ctx context.Context, zoneID string, body ZoneAPIGatewayDiscoveryOperationUpdateParams, opts ...option.RequestOption) (res *ZoneAPIGatewayDiscoveryOperationUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/discovery/operations", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Retrieve the most up to date view of discovered operations +func (r *ZoneAPIGatewayDiscoveryOperationService) List(ctx context.Context, zoneID string, query ZoneAPIGatewayDiscoveryOperationListParams, opts ...option.RequestOption) (res *ZoneAPIGatewayDiscoveryOperationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/discovery/operations", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Update the `state` on a discovered operation +func (r *ZoneAPIGatewayDiscoveryOperationService) UpdateState(ctx context.Context, zoneID string, operationID string, body ZoneAPIGatewayDiscoveryOperationUpdateStateParams, opts ...option.RequestOption) (res *ZoneAPIGatewayDiscoveryOperationUpdateStateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/discovery/operations/%s", zoneID, operationID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneAPIGatewayDiscoveryOperationUpdateResponse struct { + Errors []ZoneAPIGatewayDiscoveryOperationUpdateResponseError `json:"errors"` + Messages []ZoneAPIGatewayDiscoveryOperationUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayDiscoveryOperationUpdateResponseJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationUpdateResponseJSON contains the JSON metadata +// for the struct [ZoneAPIGatewayDiscoveryOperationUpdateResponse] +type zoneAPIGatewayDiscoveryOperationUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryOperationUpdateResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationUpdateResponseErrorJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayDiscoveryOperationUpdateResponseError] +type zoneAPIGatewayDiscoveryOperationUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryOperationUpdateResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationUpdateResponseMessageJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayDiscoveryOperationUpdateResponseMessage] +type zoneAPIGatewayDiscoveryOperationUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationListResponse struct { + Errors []ZoneAPIGatewayDiscoveryOperationListResponseError `json:"errors"` + Messages []ZoneAPIGatewayDiscoveryOperationListResponseMessage `json:"messages"` + Result []ZoneAPIGatewayDiscoveryOperationListResponseResult `json:"result"` + ResultInfo ZoneAPIGatewayDiscoveryOperationListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayDiscoveryOperationListResponseJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationListResponseJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayDiscoveryOperationListResponse] +type zoneAPIGatewayDiscoveryOperationListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryOperationListResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationListResponseErrorJSON contains the JSON metadata +// for the struct [ZoneAPIGatewayDiscoveryOperationListResponseError] +type zoneAPIGatewayDiscoveryOperationListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryOperationListResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationListResponseMessageJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayDiscoveryOperationListResponseMessage] +type zoneAPIGatewayDiscoveryOperationListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationListResponseResult struct { + // UUID identifier + ID string `json:"id" format:"uuid"` + // The endpoint which can contain path parameter templates in curly braces, each + // will be replaced from left to right with {varN}, starting with {var1}, during + // insertion. This will further be Cloudflare-normalized upon insertion. See: + // https://developers.cloudflare.com/rules/normalization/how-it-works/. + Endpoint string `json:"endpoint" format:"uri-template"` + Features ZoneAPIGatewayDiscoveryOperationListResponseResultFeatures `json:"features"` + // RFC3986-compliant host. + Host string `json:"host" format:"hostname"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The HTTP method used to access the endpoint. + Method ZoneAPIGatewayDiscoveryOperationListResponseResultMethod `json:"method"` + // API discovery engine(s) that discovered this operation + Origin []ZoneAPIGatewayDiscoveryOperationListResponseResultOrigin `json:"origin"` + // State of operation in API Discovery + // + // - `review` - Operation is not saved into API Shield Endpoint Management + // - `saved` - Operation is saved into API Shield Endpoint Management + // - `ignored` - Operation is marked as ignored + State ZoneAPIGatewayDiscoveryOperationListResponseResultState `json:"state"` + JSON zoneAPIGatewayDiscoveryOperationListResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationListResponseResultJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayDiscoveryOperationListResponseResult] +type zoneAPIGatewayDiscoveryOperationListResponseResultJSON struct { + ID apijson.Field + Endpoint apijson.Field + Features apijson.Field + Host apijson.Field + LastUpdated apijson.Field + Method apijson.Field + Origin apijson.Field + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationListResponseResultFeatures struct { + TrafficStats ZoneAPIGatewayDiscoveryOperationListResponseResultFeaturesTrafficStats `json:"traffic_stats"` + JSON zoneAPIGatewayDiscoveryOperationListResponseResultFeaturesJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationListResponseResultFeaturesJSON contains the JSON +// metadata for the struct +// [ZoneAPIGatewayDiscoveryOperationListResponseResultFeatures] +type zoneAPIGatewayDiscoveryOperationListResponseResultFeaturesJSON struct { + TrafficStats apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationListResponseResultFeatures) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationListResponseResultFeaturesTrafficStats struct { + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The period in seconds these statistics were computed over + PeriodSeconds int64 `json:"period_seconds,required"` + // The average number of requests seen during this period + Requests float64 `json:"requests,required"` + JSON zoneAPIGatewayDiscoveryOperationListResponseResultFeaturesTrafficStatsJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationListResponseResultFeaturesTrafficStatsJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayDiscoveryOperationListResponseResultFeaturesTrafficStats] +type zoneAPIGatewayDiscoveryOperationListResponseResultFeaturesTrafficStatsJSON struct { + LastUpdated apijson.Field + PeriodSeconds apijson.Field + Requests apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationListResponseResultFeaturesTrafficStats) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The HTTP method used to access the endpoint. +type ZoneAPIGatewayDiscoveryOperationListResponseResultMethod string + +const ( + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodGet ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "GET" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodPost ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "POST" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodHead ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "HEAD" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodOptions ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "OPTIONS" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodPut ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "PUT" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodDelete ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "DELETE" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodConnect ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "CONNECT" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodPatch ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "PATCH" + ZoneAPIGatewayDiscoveryOperationListResponseResultMethodTrace ZoneAPIGatewayDiscoveryOperationListResponseResultMethod = "TRACE" +) + +// - `ML` - Discovered operation was sourced using ML API Discovery \* +// `SessionIdentifier` - Discovered operation was sourced using Session +// Identifier API Discovery +type ZoneAPIGatewayDiscoveryOperationListResponseResultOrigin string + +const ( + ZoneAPIGatewayDiscoveryOperationListResponseResultOriginMl ZoneAPIGatewayDiscoveryOperationListResponseResultOrigin = "ML" + ZoneAPIGatewayDiscoveryOperationListResponseResultOriginSessionIdentifier ZoneAPIGatewayDiscoveryOperationListResponseResultOrigin = "SessionIdentifier" +) + +// State of operation in API Discovery +// +// - `review` - Operation is not saved into API Shield Endpoint Management +// - `saved` - Operation is saved into API Shield Endpoint Management +// - `ignored` - Operation is marked as ignored +type ZoneAPIGatewayDiscoveryOperationListResponseResultState string + +const ( + ZoneAPIGatewayDiscoveryOperationListResponseResultStateReview ZoneAPIGatewayDiscoveryOperationListResponseResultState = "review" + ZoneAPIGatewayDiscoveryOperationListResponseResultStateSaved ZoneAPIGatewayDiscoveryOperationListResponseResultState = "saved" + ZoneAPIGatewayDiscoveryOperationListResponseResultStateIgnored ZoneAPIGatewayDiscoveryOperationListResponseResultState = "ignored" +) + +type ZoneAPIGatewayDiscoveryOperationListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAPIGatewayDiscoveryOperationListResponseResultInfoJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationListResponseResultInfoJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayDiscoveryOperationListResponseResultInfo] +type zoneAPIGatewayDiscoveryOperationListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationUpdateStateResponse struct { + Errors []ZoneAPIGatewayDiscoveryOperationUpdateStateResponseError `json:"errors"` + Messages []ZoneAPIGatewayDiscoveryOperationUpdateStateResponseMessage `json:"messages"` + Result ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayDiscoveryOperationUpdateStateResponseJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationUpdateStateResponseJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayDiscoveryOperationUpdateStateResponse] +type zoneAPIGatewayDiscoveryOperationUpdateStateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationUpdateStateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationUpdateStateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryOperationUpdateStateResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationUpdateStateResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneAPIGatewayDiscoveryOperationUpdateStateResponseError] +type zoneAPIGatewayDiscoveryOperationUpdateStateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationUpdateStateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationUpdateStateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayDiscoveryOperationUpdateStateResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationUpdateStateResponseMessageJSON contains the JSON +// metadata for the struct +// [ZoneAPIGatewayDiscoveryOperationUpdateStateResponseMessage] +type zoneAPIGatewayDiscoveryOperationUpdateStateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationUpdateStateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResult struct { + // State of operation in API Discovery + // + // - `review` - Operation is not saved into API Shield Endpoint Management + // - `saved` - Operation is saved into API Shield Endpoint Management + // - `ignored` - Operation is marked as ignored + State ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultState `json:"state"` + JSON zoneAPIGatewayDiscoveryOperationUpdateStateResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayDiscoveryOperationUpdateStateResponseResultJSON contains the JSON +// metadata for the struct +// [ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResult] +type zoneAPIGatewayDiscoveryOperationUpdateStateResponseResultJSON struct { + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// State of operation in API Discovery +// +// - `review` - Operation is not saved into API Shield Endpoint Management +// - `saved` - Operation is saved into API Shield Endpoint Management +// - `ignored` - Operation is marked as ignored +type ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultState string + +const ( + ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultStateReview ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultState = "review" + ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultStateSaved ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultState = "saved" + ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultStateIgnored ZoneAPIGatewayDiscoveryOperationUpdateStateResponseResultState = "ignored" +) + +type ZoneAPIGatewayDiscoveryOperationUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneAPIGatewayDiscoveryOperationUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneAPIGatewayDiscoveryOperationListParams struct { + // When `true`, only return API Discovery results that are not saved into API + // Shield Endpoint Management + Diff param.Field[bool] `query:"diff"` + // Direction to order results. + Direction param.Field[ZoneAPIGatewayDiscoveryOperationListParamsDirection] `query:"direction"` + // Filter results to only include endpoints containing this pattern. + Endpoint param.Field[string] `query:"endpoint"` + // Filter results to only include the specified hosts. + Host param.Field[[]string] `query:"host"` + // Filter results to only include the specified HTTP methods. + Method param.Field[[]string] `query:"method"` + // Field to order by + Order param.Field[ZoneAPIGatewayDiscoveryOperationListParamsOrder] `query:"order"` + // Filter results to only include discovery results sourced from a particular + // discovery engine + // + // - `ML` - Discovered operations that were sourced using ML API Discovery + // - `SessionIdentifier` - Discovered operations that were sourced using Session + // Identifier API Discovery + Origin param.Field[ZoneAPIGatewayDiscoveryOperationListParamsOrigin] `query:"origin"` + // Page number of paginated results. + Page param.Field[interface{}] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[interface{}] `query:"per_page"` + // Filter results to only include discovery results in a particular state. States + // are as follows + // + // - `review` - Discovered operations that are not saved into API Shield Endpoint + // Management + // - `saved` - Discovered operations that are already saved into API Shield + // Endpoint Management + // - `ignored` - Discovered operations that have been marked as ignored + State param.Field[ZoneAPIGatewayDiscoveryOperationListParamsState] `query:"state"` +} + +// URLQuery serializes [ZoneAPIGatewayDiscoveryOperationListParams]'s query +// parameters as `url.Values`. +func (r ZoneAPIGatewayDiscoveryOperationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order results. +type ZoneAPIGatewayDiscoveryOperationListParamsDirection string + +const ( + ZoneAPIGatewayDiscoveryOperationListParamsDirectionAsc ZoneAPIGatewayDiscoveryOperationListParamsDirection = "asc" + ZoneAPIGatewayDiscoveryOperationListParamsDirectionDesc ZoneAPIGatewayDiscoveryOperationListParamsDirection = "desc" +) + +// Field to order by +type ZoneAPIGatewayDiscoveryOperationListParamsOrder string + +const ( + ZoneAPIGatewayDiscoveryOperationListParamsOrderHost ZoneAPIGatewayDiscoveryOperationListParamsOrder = "host" + ZoneAPIGatewayDiscoveryOperationListParamsOrderMethod ZoneAPIGatewayDiscoveryOperationListParamsOrder = "method" + ZoneAPIGatewayDiscoveryOperationListParamsOrderEndpoint ZoneAPIGatewayDiscoveryOperationListParamsOrder = "endpoint" + ZoneAPIGatewayDiscoveryOperationListParamsOrderTrafficStatsRequests ZoneAPIGatewayDiscoveryOperationListParamsOrder = "traffic_stats.requests" + ZoneAPIGatewayDiscoveryOperationListParamsOrderTrafficStatsLastUpdated ZoneAPIGatewayDiscoveryOperationListParamsOrder = "traffic_stats.last_updated" +) + +// Filter results to only include discovery results sourced from a particular +// discovery engine +// +// - `ML` - Discovered operations that were sourced using ML API Discovery +// - `SessionIdentifier` - Discovered operations that were sourced using Session +// Identifier API Discovery +type ZoneAPIGatewayDiscoveryOperationListParamsOrigin string + +const ( + ZoneAPIGatewayDiscoveryOperationListParamsOriginMl ZoneAPIGatewayDiscoveryOperationListParamsOrigin = "ML" + ZoneAPIGatewayDiscoveryOperationListParamsOriginSessionIdentifier ZoneAPIGatewayDiscoveryOperationListParamsOrigin = "SessionIdentifier" +) + +// Filter results to only include discovery results in a particular state. States +// are as follows +// +// - `review` - Discovered operations that are not saved into API Shield Endpoint +// Management +// - `saved` - Discovered operations that are already saved into API Shield +// Endpoint Management +// - `ignored` - Discovered operations that have been marked as ignored +type ZoneAPIGatewayDiscoveryOperationListParamsState string + +const ( + ZoneAPIGatewayDiscoveryOperationListParamsStateReview ZoneAPIGatewayDiscoveryOperationListParamsState = "review" + ZoneAPIGatewayDiscoveryOperationListParamsStateSaved ZoneAPIGatewayDiscoveryOperationListParamsState = "saved" + ZoneAPIGatewayDiscoveryOperationListParamsStateIgnored ZoneAPIGatewayDiscoveryOperationListParamsState = "ignored" +) + +type ZoneAPIGatewayDiscoveryOperationUpdateStateParams struct { + // Mark state of operation in API Discovery + // + // - `review` - Mark operation as for review + // - `ignored` - Mark operation as ignored + State param.Field[ZoneAPIGatewayDiscoveryOperationUpdateStateParamsState] `json:"state"` +} + +func (r ZoneAPIGatewayDiscoveryOperationUpdateStateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Mark state of operation in API Discovery +// +// - `review` - Mark operation as for review +// - `ignored` - Mark operation as ignored +type ZoneAPIGatewayDiscoveryOperationUpdateStateParamsState string + +const ( + ZoneAPIGatewayDiscoveryOperationUpdateStateParamsStateReview ZoneAPIGatewayDiscoveryOperationUpdateStateParamsState = "review" + ZoneAPIGatewayDiscoveryOperationUpdateStateParamsStateIgnored ZoneAPIGatewayDiscoveryOperationUpdateStateParamsState = "ignored" +) diff --git a/zoneapigatewaydiscoveryoperation_test.go b/zoneapigatewaydiscoveryoperation_test.go new file mode 100644 index 00000000000..d81fa7ddf81 --- /dev/null +++ b/zoneapigatewaydiscoveryoperation_test.go @@ -0,0 +1,127 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAPIGatewayDiscoveryOperationUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Discovery.Operations.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{ + "3818d821-5901-4147-a474-f5f5aec1d54e": map[string]interface{}{ + "state": "ignored", + }, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": map[string]interface{}{ + "state": "review", + }, + }), + }, + ) + 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 TestZoneAPIGatewayDiscoveryOperationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Discovery.Operations.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewayDiscoveryOperationListParams{ + Diff: cloudflare.F(true), + Direction: cloudflare.F(cloudflare.ZoneAPIGatewayDiscoveryOperationListParamsDirectionDesc), + Endpoint: cloudflare.F("/api/v1"), + Host: cloudflare.F([]string{"api.cloudflare.com"}), + Method: cloudflare.F([]string{"GET"}), + Order: cloudflare.F(cloudflare.ZoneAPIGatewayDiscoveryOperationListParamsOrderMethod), + Origin: cloudflare.F(cloudflare.ZoneAPIGatewayDiscoveryOperationListParamsOriginMl), + Page: cloudflare.F[any](map[string]interface{}{}), + PerPage: cloudflare.F[any](map[string]interface{}{}), + State: cloudflare.F(cloudflare.ZoneAPIGatewayDiscoveryOperationListParamsStateReview), + }, + ) + 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 TestZoneAPIGatewayDiscoveryOperationUpdateStateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Discovery.Operations.UpdateState( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateStateParams{ + State: cloudflare.F(cloudflare.ZoneAPIGatewayDiscoveryOperationUpdateStateParamsStateReview), + }, + ) + 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/zoneapigatewayschema.go b/zoneapigatewayschema.go new file mode 100644 index 00000000000..7ee185d8ed1 --- /dev/null +++ b/zoneapigatewayschema.go @@ -0,0 +1,154 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAPIGatewaySchemaService 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 [NewZoneAPIGatewaySchemaService] +// method instead. +type ZoneAPIGatewaySchemaService struct { + Options []option.RequestOption +} + +// NewZoneAPIGatewaySchemaService 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 NewZoneAPIGatewaySchemaService(opts ...option.RequestOption) (r *ZoneAPIGatewaySchemaService) { + r = &ZoneAPIGatewaySchemaService{} + r.Options = opts + return +} + +// Retrieve operations and features as OpenAPI schemas +func (r *ZoneAPIGatewaySchemaService) APIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemas(ctx context.Context, zoneID string, query ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParams, opts ...option.RequestOption) (res *ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/schemas", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponse struct { + Errors []ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseError `json:"errors"` + Messages []ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseMessage `json:"messages"` + Result ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseJSON `json:"-"` +} + +// zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponse] +type zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseError] +type zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseMessage] +type zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseResult struct { + Schemas []interface{} `json:"schemas"` + Timestamp string `json:"timestamp"` + JSON zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseResultJSON `json:"-"` +} + +// zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseResult] +type zoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseResultJSON struct { + Schemas apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParams struct { + // Add feature(s) to the results. The feature name that is given here corresponds + // to the resulting feature object. Have a look at the top-level object description + // for more details on the specific meaning. + Feature param.Field[[]ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeature] `query:"feature"` + // Receive schema only for the given host(s). + Host param.Field[[]string] `query:"host"` +} + +// URLQuery serializes +// [ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParams]'s +// query parameters as `url.Values`. +func (r ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeature string + +const ( + ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeatureThresholds ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeature = "thresholds" + ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeatureParameterSchemas ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeature = "parameter_schemas" + ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeatureSchemaInfo ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeature = "schema_info" +) diff --git a/zoneapigatewayschema_test.go b/zoneapigatewayschema_test.go new file mode 100644 index 00000000000..9477c2f9797 --- /dev/null +++ b/zoneapigatewayschema_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Schemas.APIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemas( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParams{ + Feature: cloudflare.F([]cloudflare.ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeature{cloudflare.ZoneAPIGatewaySchemaAPIShieldEndpointManagementGetOperationsAndFeaturesAsOpenAPISchemasParamsFeatureThresholds}), + Host: cloudflare.F([]string{"www.example.com"}), + }, + ) + 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/zoneapigatewaysetting.go b/zoneapigatewaysetting.go new file mode 100644 index 00000000000..72643b698fd --- /dev/null +++ b/zoneapigatewaysetting.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAPIGatewaySettingService 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 [NewZoneAPIGatewaySettingService] +// method instead. +type ZoneAPIGatewaySettingService struct { + Options []option.RequestOption + SchemaValidations *ZoneAPIGatewaySettingSchemaValidationService +} + +// NewZoneAPIGatewaySettingService 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 NewZoneAPIGatewaySettingService(opts ...option.RequestOption) (r *ZoneAPIGatewaySettingService) { + r = &ZoneAPIGatewaySettingService{} + r.Options = opts + r.SchemaValidations = NewZoneAPIGatewaySettingSchemaValidationService(opts...) + return +} diff --git a/zoneapigatewaysettingschemavalidation.go b/zoneapigatewaysettingschemavalidation.go new file mode 100644 index 00000000000..d43e64dbcab --- /dev/null +++ b/zoneapigatewaysettingschemavalidation.go @@ -0,0 +1,354 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAPIGatewaySettingSchemaValidationService 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 +// [NewZoneAPIGatewaySettingSchemaValidationService] method instead. +type ZoneAPIGatewaySettingSchemaValidationService struct { + Options []option.RequestOption +} + +// NewZoneAPIGatewaySettingSchemaValidationService 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 NewZoneAPIGatewaySettingSchemaValidationService(opts ...option.RequestOption) (r *ZoneAPIGatewaySettingSchemaValidationService) { + r = &ZoneAPIGatewaySettingSchemaValidationService{} + r.Options = opts + return +} + +// Retrieves zone level schema validation settings currently set on the zone +func (r *ZoneAPIGatewaySettingSchemaValidationService) Get(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneAPIGatewaySettingSchemaValidationGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/settings/schema_validation", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates zone level schema validation settings on the zone +func (r *ZoneAPIGatewaySettingSchemaValidationService) Update(ctx context.Context, zoneID string, body ZoneAPIGatewaySettingSchemaValidationUpdateParams, opts ...option.RequestOption) (res *ZoneAPIGatewaySettingSchemaValidationUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/settings/schema_validation", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Updates zone level schema validation settings on the zone +func (r *ZoneAPIGatewaySettingSchemaValidationService) Patch(ctx context.Context, zoneID string, body ZoneAPIGatewaySettingSchemaValidationPatchParams, opts ...option.RequestOption) (res *ZoneAPIGatewaySettingSchemaValidationPatchResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/settings/schema_validation", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneAPIGatewaySettingSchemaValidationGetResponse struct { + // The default mitigation action used when there is no mitigation action defined on + // the operation + // + // Mitigation actions are as follows: + // + // - `log` - log request when request does not conform to schema + // - `block` - deny access to the site when request does not conform to schema + // + // A special value of of `none` will skip running schema validation entirely for + // the request when there is no mitigation action defined on the operation + ValidationDefaultMitigationAction ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationAction `json:"validation_default_mitigation_action"` + // When set, this overrides both zone level and operation level mitigation actions. + // + // - `none` will skip running schema validation entirely for the request + // - `null` indicates that no override is in place + ValidationOverrideMitigationAction ZoneAPIGatewaySettingSchemaValidationGetResponseValidationOverrideMitigationAction `json:"validation_override_mitigation_action,nullable"` + JSON zoneAPIGatewaySettingSchemaValidationGetResponseJSON `json:"-"` +} + +// zoneAPIGatewaySettingSchemaValidationGetResponseJSON contains the JSON metadata +// for the struct [ZoneAPIGatewaySettingSchemaValidationGetResponse] +type zoneAPIGatewaySettingSchemaValidationGetResponseJSON struct { + ValidationDefaultMitigationAction apijson.Field + ValidationOverrideMitigationAction apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewaySettingSchemaValidationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default mitigation action used when there is no mitigation action defined on +// the operation +// +// Mitigation actions are as follows: +// +// - `log` - log request when request does not conform to schema +// - `block` - deny access to the site when request does not conform to schema +// +// A special value of of `none` will skip running schema validation entirely for +// the request when there is no mitigation action defined on the operation +type ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationActionNone ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationAction = "none" + ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationActionLog ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationAction = "log" + ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationActionBlock ZoneAPIGatewaySettingSchemaValidationGetResponseValidationDefaultMitigationAction = "block" +) + +// When set, this overrides both zone level and operation level mitigation actions. +// +// - `none` will skip running schema validation entirely for the request +// - `null` indicates that no override is in place +type ZoneAPIGatewaySettingSchemaValidationGetResponseValidationOverrideMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationGetResponseValidationOverrideMitigationActionNone ZoneAPIGatewaySettingSchemaValidationGetResponseValidationOverrideMitigationAction = "none" +) + +type ZoneAPIGatewaySettingSchemaValidationUpdateResponse struct { + // The default mitigation action used when there is no mitigation action defined on + // the operation + // + // Mitigation actions are as follows: + // + // - `log` - log request when request does not conform to schema + // - `block` - deny access to the site when request does not conform to schema + // + // A special value of of `none` will skip running schema validation entirely for + // the request when there is no mitigation action defined on the operation + ValidationDefaultMitigationAction ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationAction `json:"validation_default_mitigation_action"` + // When set, this overrides both zone level and operation level mitigation actions. + // + // - `none` will skip running schema validation entirely for the request + // - `null` indicates that no override is in place + ValidationOverrideMitigationAction ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationOverrideMitigationAction `json:"validation_override_mitigation_action,nullable"` + JSON zoneAPIGatewaySettingSchemaValidationUpdateResponseJSON `json:"-"` +} + +// zoneAPIGatewaySettingSchemaValidationUpdateResponseJSON contains the JSON +// metadata for the struct [ZoneAPIGatewaySettingSchemaValidationUpdateResponse] +type zoneAPIGatewaySettingSchemaValidationUpdateResponseJSON struct { + ValidationDefaultMitigationAction apijson.Field + ValidationOverrideMitigationAction apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewaySettingSchemaValidationUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default mitigation action used when there is no mitigation action defined on +// the operation +// +// Mitigation actions are as follows: +// +// - `log` - log request when request does not conform to schema +// - `block` - deny access to the site when request does not conform to schema +// +// A special value of of `none` will skip running schema validation entirely for +// the request when there is no mitigation action defined on the operation +type ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationActionNone ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationAction = "none" + ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationActionLog ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationAction = "log" + ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationActionBlock ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationDefaultMitigationAction = "block" +) + +// When set, this overrides both zone level and operation level mitigation actions. +// +// - `none` will skip running schema validation entirely for the request +// - `null` indicates that no override is in place +type ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationOverrideMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationOverrideMitigationActionNone ZoneAPIGatewaySettingSchemaValidationUpdateResponseValidationOverrideMitigationAction = "none" +) + +type ZoneAPIGatewaySettingSchemaValidationPatchResponse struct { + // The default mitigation action used when there is no mitigation action defined on + // the operation + // + // Mitigation actions are as follows: + // + // - `log` - log request when request does not conform to schema + // - `block` - deny access to the site when request does not conform to schema + // + // A special value of of `none` will skip running schema validation entirely for + // the request when there is no mitigation action defined on the operation + ValidationDefaultMitigationAction ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationAction `json:"validation_default_mitigation_action"` + // When set, this overrides both zone level and operation level mitigation actions. + // + // - `none` will skip running schema validation entirely for the request + // - `null` indicates that no override is in place + ValidationOverrideMitigationAction ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationOverrideMitigationAction `json:"validation_override_mitigation_action,nullable"` + JSON zoneAPIGatewaySettingSchemaValidationPatchResponseJSON `json:"-"` +} + +// zoneAPIGatewaySettingSchemaValidationPatchResponseJSON contains the JSON +// metadata for the struct [ZoneAPIGatewaySettingSchemaValidationPatchResponse] +type zoneAPIGatewaySettingSchemaValidationPatchResponseJSON struct { + ValidationDefaultMitigationAction apijson.Field + ValidationOverrideMitigationAction apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewaySettingSchemaValidationPatchResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default mitigation action used when there is no mitigation action defined on +// the operation +// +// Mitigation actions are as follows: +// +// - `log` - log request when request does not conform to schema +// - `block` - deny access to the site when request does not conform to schema +// +// A special value of of `none` will skip running schema validation entirely for +// the request when there is no mitigation action defined on the operation +type ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationActionNone ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationAction = "none" + ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationActionLog ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationAction = "log" + ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationActionBlock ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationDefaultMitigationAction = "block" +) + +// When set, this overrides both zone level and operation level mitigation actions. +// +// - `none` will skip running schema validation entirely for the request +// - `null` indicates that no override is in place +type ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationOverrideMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationOverrideMitigationActionNone ZoneAPIGatewaySettingSchemaValidationPatchResponseValidationOverrideMitigationAction = "none" +) + +type ZoneAPIGatewaySettingSchemaValidationUpdateParams struct { + // The default mitigation action used when there is no mitigation action defined on + // the operation + // + // Mitigation actions are as follows: + // + // - `log` - log request when request does not conform to schema + // - `block` - deny access to the site when request does not conform to schema + // + // A special value of of `none` will skip running schema validation entirely for + // the request when there is no mitigation action defined on the operation + ValidationDefaultMitigationAction param.Field[ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationAction] `json:"validation_default_mitigation_action,required"` + // When set, this overrides both zone level and operation level mitigation actions. + // + // - `none` will skip running schema validation entirely for the request + // - `null` indicates that no override is in place + // + // To clear any override, use the special value `disable_override` or `null` + ValidationOverrideMitigationAction param.Field[ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationOverrideMitigationAction] `json:"validation_override_mitigation_action"` +} + +func (r ZoneAPIGatewaySettingSchemaValidationUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default mitigation action used when there is no mitigation action defined on +// the operation +// +// Mitigation actions are as follows: +// +// - `log` - log request when request does not conform to schema +// - `block` - deny access to the site when request does not conform to schema +// +// A special value of of `none` will skip running schema validation entirely for +// the request when there is no mitigation action defined on the operation +type ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationActionNone ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationAction = "none" + ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationActionLog ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationAction = "log" + ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationActionBlock ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationAction = "block" +) + +// When set, this overrides both zone level and operation level mitigation actions. +// +// - `none` will skip running schema validation entirely for the request +// - `null` indicates that no override is in place +// +// To clear any override, use the special value `disable_override` or `null` +type ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationOverrideMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationOverrideMitigationActionNone ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationOverrideMitigationAction = "none" + ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationOverrideMitigationActionDisableOverride ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationOverrideMitigationAction = "disable_override" +) + +type ZoneAPIGatewaySettingSchemaValidationPatchParams struct { + // The default mitigation action used when there is no mitigation action defined on + // the operation Mitigation actions are as follows: + // + // - `log` - log request when request does not conform to schema + // - `block` - deny access to the site when request does not conform to schema + // + // A special value of of `none` will skip running schema validation entirely for + // the request when there is no mitigation action defined on the operation + // + // `null` will have no effect. + ValidationDefaultMitigationAction param.Field[ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationAction] `json:"validation_default_mitigation_action"` + // When set, this overrides both zone level and operation level mitigation actions. + // + // - `none` will skip running schema validation entirely for the request + // + // To clear any override, use the special value `disable_override` + // + // `null` will have no effect. + ValidationOverrideMitigationAction param.Field[ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationOverrideMitigationAction] `json:"validation_override_mitigation_action"` +} + +func (r ZoneAPIGatewaySettingSchemaValidationPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default mitigation action used when there is no mitigation action defined on +// the operation Mitigation actions are as follows: +// +// - `log` - log request when request does not conform to schema +// - `block` - deny access to the site when request does not conform to schema +// +// A special value of of `none` will skip running schema validation entirely for +// the request when there is no mitigation action defined on the operation +// +// `null` will have no effect. +type ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationActionNone ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationAction = "none" + ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationActionLog ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationAction = "log" + ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationActionBlock ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationAction = "block" +) + +// When set, this overrides both zone level and operation level mitigation actions. +// +// - `none` will skip running schema validation entirely for the request +// +// To clear any override, use the special value `disable_override` +// +// `null` will have no effect. +type ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationOverrideMitigationAction string + +const ( + ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationOverrideMitigationActionNone ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationOverrideMitigationAction = "none" + ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationOverrideMitigationActionDisableOverride ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationOverrideMitigationAction = "disable_override" +) diff --git a/zoneapigatewaysettingschemavalidation_test.go b/zoneapigatewaysettingschemavalidation_test.go new file mode 100644 index 00000000000..91dabfbb1ea --- /dev/null +++ b/zoneapigatewaysettingschemavalidation_test.go @@ -0,0 +1,106 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAPIGatewaySettingSchemaValidationGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Settings.SchemaValidations.Get(context.TODO(), "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()) + } +} + +func TestZoneAPIGatewaySettingSchemaValidationUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Settings.SchemaValidations.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewaySettingSchemaValidationUpdateParams{ + ValidationDefaultMitigationAction: cloudflare.F(cloudflare.ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationDefaultMitigationActionBlock), + ValidationOverrideMitigationAction: cloudflare.F(cloudflare.ZoneAPIGatewaySettingSchemaValidationUpdateParamsValidationOverrideMitigationActionNone), + }, + ) + 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 TestZoneAPIGatewaySettingSchemaValidationPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.Settings.SchemaValidations.Patch( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewaySettingSchemaValidationPatchParams{ + ValidationDefaultMitigationAction: cloudflare.F(cloudflare.ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationDefaultMitigationActionBlock), + ValidationOverrideMitigationAction: cloudflare.F(cloudflare.ZoneAPIGatewaySettingSchemaValidationPatchParamsValidationOverrideMitigationActionNone), + }, + ) + 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/zoneapigatewayuserschema.go b/zoneapigatewayuserschema.go new file mode 100644 index 00000000000..f4cbed62f0c --- /dev/null +++ b/zoneapigatewayuserschema.go @@ -0,0 +1,745 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "bytes" + "context" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apiform" + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneAPIGatewayUserSchemaService 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 +// [NewZoneAPIGatewayUserSchemaService] method instead. +type ZoneAPIGatewayUserSchemaService struct { + Options []option.RequestOption + Operations *ZoneAPIGatewayUserSchemaOperationService +} + +// NewZoneAPIGatewayUserSchemaService 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 NewZoneAPIGatewayUserSchemaService(opts ...option.RequestOption) (r *ZoneAPIGatewayUserSchemaService) { + r = &ZoneAPIGatewayUserSchemaService{} + r.Options = opts + r.Operations = NewZoneAPIGatewayUserSchemaOperationService(opts...) + return +} + +// Upload a schema to a zone +func (r *ZoneAPIGatewayUserSchemaService) New(ctx context.Context, zoneID string, body ZoneAPIGatewayUserSchemaNewParams, opts ...option.RequestOption) (res *ZoneAPIGatewayUserSchemaNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/user_schemas", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Retrieve information about a specific schema on a zone +func (r *ZoneAPIGatewayUserSchemaService) Get(ctx context.Context, zoneID string, schemaID string, query ZoneAPIGatewayUserSchemaGetParams, opts ...option.RequestOption) (res *ZoneAPIGatewayUserSchemaGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/user_schemas/%s", zoneID, schemaID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Enable validation for a schema +func (r *ZoneAPIGatewayUserSchemaService) Update(ctx context.Context, zoneID string, schemaID string, body ZoneAPIGatewayUserSchemaUpdateParams, opts ...option.RequestOption) (res *ZoneAPIGatewayUserSchemaUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/user_schemas/%s", zoneID, schemaID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Retrieve information about all schemas on a zone +func (r *ZoneAPIGatewayUserSchemaService) List(ctx context.Context, zoneID string, query ZoneAPIGatewayUserSchemaListParams, opts ...option.RequestOption) (res *ZoneAPIGatewayUserSchemaListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/user_schemas", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Delete a schema +func (r *ZoneAPIGatewayUserSchemaService) Delete(ctx context.Context, zoneID string, schemaID string, opts ...option.RequestOption) (res *ZoneAPIGatewayUserSchemaDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/user_schemas/%s", zoneID, schemaID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type ZoneAPIGatewayUserSchemaNewResponse struct { + Errors []ZoneAPIGatewayUserSchemaNewResponseError `json:"errors"` + Messages []ZoneAPIGatewayUserSchemaNewResponseMessage `json:"messages"` + Result ZoneAPIGatewayUserSchemaNewResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayUserSchemaNewResponseJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaNewResponseJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaNewResponse] +type zoneAPIGatewayUserSchemaNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaNewResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaNewResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaNewResponseError] +type zoneAPIGatewayUserSchemaNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaNewResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaNewResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaNewResponseMessage] +type zoneAPIGatewayUserSchemaNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaNewResponseResult struct { + Schema ZoneAPIGatewayUserSchemaNewResponseResultSchema `json:"schema,required"` + UploadDetails ZoneAPIGatewayUserSchemaNewResponseResultUploadDetails `json:"upload_details"` + JSON zoneAPIGatewayUserSchemaNewResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaNewResponseResultJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaNewResponseResult] +type zoneAPIGatewayUserSchemaNewResponseResultJSON struct { + Schema apijson.Field + UploadDetails apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaNewResponseResultSchema struct { + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // Kind of schema + Kind ZoneAPIGatewayUserSchemaNewResponseResultSchemaKind `json:"kind,required"` + // Name of the schema + Name string `json:"name,required"` + // UUID identifier + SchemaID string `json:"schema_id,required" format:"uuid"` + // Source of the schema + Source string `json:"source"` + // Flag whether schema is enabled for validation. + ValidationEnabled bool `json:"validation_enabled"` + JSON zoneAPIGatewayUserSchemaNewResponseResultSchemaJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaNewResponseResultSchemaJSON contains the JSON metadata +// for the struct [ZoneAPIGatewayUserSchemaNewResponseResultSchema] +type zoneAPIGatewayUserSchemaNewResponseResultSchemaJSON struct { + CreatedAt apijson.Field + Kind apijson.Field + Name apijson.Field + SchemaID apijson.Field + Source apijson.Field + ValidationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaNewResponseResultSchema) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Kind of schema +type ZoneAPIGatewayUserSchemaNewResponseResultSchemaKind string + +const ( + ZoneAPIGatewayUserSchemaNewResponseResultSchemaKindOpenapiV3 ZoneAPIGatewayUserSchemaNewResponseResultSchemaKind = "openapi_v3" +) + +type ZoneAPIGatewayUserSchemaNewResponseResultUploadDetails struct { + // Diagnostic warning events that occurred during processing. These events are + // non-critical errors found within the schema. + Warnings []ZoneAPIGatewayUserSchemaNewResponseResultUploadDetailsWarning `json:"warnings"` + JSON zoneAPIGatewayUserSchemaNewResponseResultUploadDetailsJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaNewResponseResultUploadDetailsJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayUserSchemaNewResponseResultUploadDetails] +type zoneAPIGatewayUserSchemaNewResponseResultUploadDetailsJSON struct { + Warnings apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaNewResponseResultUploadDetails) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaNewResponseResultUploadDetailsWarning struct { + // Code that identifies the event that occurred. + Code int64 `json:"code,required"` + // JSONPath location(s) in the schema where these events were encountered. See + // [https://goessner.net/articles/JsonPath/](https://goessner.net/articles/JsonPath/) + // for JSONPath specification. + Locations []string `json:"locations"` + // Diagnostic message that describes the event. + Message string `json:"message"` + JSON zoneAPIGatewayUserSchemaNewResponseResultUploadDetailsWarningJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaNewResponseResultUploadDetailsWarningJSON contains the +// JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaNewResponseResultUploadDetailsWarning] +type zoneAPIGatewayUserSchemaNewResponseResultUploadDetailsWarningJSON struct { + Code apijson.Field + Locations apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaNewResponseResultUploadDetailsWarning) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaGetResponse struct { + Errors []ZoneAPIGatewayUserSchemaGetResponseError `json:"errors"` + Messages []ZoneAPIGatewayUserSchemaGetResponseMessage `json:"messages"` + Result ZoneAPIGatewayUserSchemaGetResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayUserSchemaGetResponseJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaGetResponseJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaGetResponse] +type zoneAPIGatewayUserSchemaGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaGetResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaGetResponseError] +type zoneAPIGatewayUserSchemaGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaGetResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaGetResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaGetResponseMessage] +type zoneAPIGatewayUserSchemaGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaGetResponseResult struct { + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // Kind of schema + Kind ZoneAPIGatewayUserSchemaGetResponseResultKind `json:"kind,required"` + // Name of the schema + Name string `json:"name,required"` + // UUID identifier + SchemaID string `json:"schema_id,required" format:"uuid"` + // Source of the schema + Source string `json:"source"` + // Flag whether schema is enabled for validation. + ValidationEnabled bool `json:"validation_enabled"` + JSON zoneAPIGatewayUserSchemaGetResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaGetResponseResult] +type zoneAPIGatewayUserSchemaGetResponseResultJSON struct { + CreatedAt apijson.Field + Kind apijson.Field + Name apijson.Field + SchemaID apijson.Field + Source apijson.Field + ValidationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Kind of schema +type ZoneAPIGatewayUserSchemaGetResponseResultKind string + +const ( + ZoneAPIGatewayUserSchemaGetResponseResultKindOpenapiV3 ZoneAPIGatewayUserSchemaGetResponseResultKind = "openapi_v3" +) + +type ZoneAPIGatewayUserSchemaUpdateResponse struct { + Errors []ZoneAPIGatewayUserSchemaUpdateResponseError `json:"errors"` + Messages []ZoneAPIGatewayUserSchemaUpdateResponseMessage `json:"messages"` + Result ZoneAPIGatewayUserSchemaUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayUserSchemaUpdateResponseJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaUpdateResponse] +type zoneAPIGatewayUserSchemaUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaUpdateResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaUpdateResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaUpdateResponseError] +type zoneAPIGatewayUserSchemaUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaUpdateResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaUpdateResponseMessage] +type zoneAPIGatewayUserSchemaUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaUpdateResponseResult struct { + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // Kind of schema + Kind ZoneAPIGatewayUserSchemaUpdateResponseResultKind `json:"kind,required"` + // Name of the schema + Name string `json:"name,required"` + // UUID identifier + SchemaID string `json:"schema_id,required" format:"uuid"` + // Source of the schema + Source string `json:"source"` + // Flag whether schema is enabled for validation. + ValidationEnabled bool `json:"validation_enabled"` + JSON zoneAPIGatewayUserSchemaUpdateResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaUpdateResponseResultJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaUpdateResponseResult] +type zoneAPIGatewayUserSchemaUpdateResponseResultJSON struct { + CreatedAt apijson.Field + Kind apijson.Field + Name apijson.Field + SchemaID apijson.Field + Source apijson.Field + ValidationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Kind of schema +type ZoneAPIGatewayUserSchemaUpdateResponseResultKind string + +const ( + ZoneAPIGatewayUserSchemaUpdateResponseResultKindOpenapiV3 ZoneAPIGatewayUserSchemaUpdateResponseResultKind = "openapi_v3" +) + +type ZoneAPIGatewayUserSchemaListResponse struct { + Errors []ZoneAPIGatewayUserSchemaListResponseError `json:"errors"` + Messages []ZoneAPIGatewayUserSchemaListResponseMessage `json:"messages"` + Result []ZoneAPIGatewayUserSchemaListResponseResult `json:"result"` + ResultInfo ZoneAPIGatewayUserSchemaListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayUserSchemaListResponseJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaListResponseJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaListResponse] +type zoneAPIGatewayUserSchemaListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaListResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaListResponseError] +type zoneAPIGatewayUserSchemaListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaListResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaListResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaListResponseMessage] +type zoneAPIGatewayUserSchemaListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaListResponseResult struct { + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // Kind of schema + Kind ZoneAPIGatewayUserSchemaListResponseResultKind `json:"kind,required"` + // Name of the schema + Name string `json:"name,required"` + // UUID identifier + SchemaID string `json:"schema_id,required" format:"uuid"` + // Source of the schema + Source string `json:"source"` + // Flag whether schema is enabled for validation. + ValidationEnabled bool `json:"validation_enabled"` + JSON zoneAPIGatewayUserSchemaListResponseResultJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaListResponseResultJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaListResponseResult] +type zoneAPIGatewayUserSchemaListResponseResultJSON struct { + CreatedAt apijson.Field + Kind apijson.Field + Name apijson.Field + SchemaID apijson.Field + Source apijson.Field + ValidationEnabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Kind of schema +type ZoneAPIGatewayUserSchemaListResponseResultKind string + +const ( + ZoneAPIGatewayUserSchemaListResponseResultKindOpenapiV3 ZoneAPIGatewayUserSchemaListResponseResultKind = "openapi_v3" +) + +type ZoneAPIGatewayUserSchemaListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAPIGatewayUserSchemaListResponseResultInfoJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaListResponseResultInfoJSON contains the JSON metadata +// for the struct [ZoneAPIGatewayUserSchemaListResponseResultInfo] +type zoneAPIGatewayUserSchemaListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaDeleteResponse struct { + Errors []ZoneAPIGatewayUserSchemaDeleteResponseError `json:"errors"` + Messages []ZoneAPIGatewayUserSchemaDeleteResponseMessage `json:"messages"` + Result ZoneAPIGatewayUserSchemaDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayUserSchemaDeleteResponseJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneAPIGatewayUserSchemaDeleteResponse] +type zoneAPIGatewayUserSchemaDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaDeleteResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaDeleteResponseErrorJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaDeleteResponseError] +type zoneAPIGatewayUserSchemaDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaDeleteResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaDeleteResponseMessage] +type zoneAPIGatewayUserSchemaDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [ZoneAPIGatewayUserSchemaDeleteResponseResultUnknown] or +// [shared.UnionString]. +type ZoneAPIGatewayUserSchemaDeleteResponseResult interface { + ImplementsZoneAPIGatewayUserSchemaDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneAPIGatewayUserSchemaDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ZoneAPIGatewayUserSchemaNewParams struct { + // Schema file bytes + File param.Field[io.Reader] `json:"file,required" format:"binary"` + // Kind of schema + Kind param.Field[ZoneAPIGatewayUserSchemaNewParamsKind] `json:"kind,required"` + // Name of the schema + Name param.Field[string] `json:"name"` + // Flag whether schema is enabled for validation. + ValidationEnabled param.Field[ZoneAPIGatewayUserSchemaNewParamsValidationEnabled] `json:"validation_enabled"` +} + +func (r ZoneAPIGatewayUserSchemaNewParams) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} + +// Kind of schema +type ZoneAPIGatewayUserSchemaNewParamsKind string + +const ( + ZoneAPIGatewayUserSchemaNewParamsKindOpenapiV3 ZoneAPIGatewayUserSchemaNewParamsKind = "openapi_v3" +) + +// Flag whether schema is enabled for validation. +type ZoneAPIGatewayUserSchemaNewParamsValidationEnabled string + +const ( + ZoneAPIGatewayUserSchemaNewParamsValidationEnabledTrue ZoneAPIGatewayUserSchemaNewParamsValidationEnabled = "true" + ZoneAPIGatewayUserSchemaNewParamsValidationEnabledFalse ZoneAPIGatewayUserSchemaNewParamsValidationEnabled = "false" +) + +type ZoneAPIGatewayUserSchemaGetParams struct { + // Omit the source-files of schemas and only retrieve their meta-data. + OmitSource param.Field[bool] `query:"omit_source"` +} + +// URLQuery serializes [ZoneAPIGatewayUserSchemaGetParams]'s query parameters as +// `url.Values`. +func (r ZoneAPIGatewayUserSchemaGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneAPIGatewayUserSchemaUpdateParams struct { + ValidationEnabled param.Field[interface{}] `json:"validation_enabled"` +} + +func (r ZoneAPIGatewayUserSchemaUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneAPIGatewayUserSchemaListParams struct { + // Omit the source-files of schemas and only retrieve their meta-data. + OmitSource param.Field[bool] `query:"omit_source"` + // Page number of paginated results. + Page param.Field[interface{}] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[interface{}] `query:"per_page"` + // Flag whether schema is enabled for validation. + ValidationEnabled param.Field[bool] `query:"validation_enabled"` +} + +// URLQuery serializes [ZoneAPIGatewayUserSchemaListParams]'s query parameters as +// `url.Values`. +func (r ZoneAPIGatewayUserSchemaListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zoneapigatewayuserschema_test.go b/zoneapigatewayuserschema_test.go new file mode 100644 index 00000000000..06aa1e18f0f --- /dev/null +++ b/zoneapigatewayuserschema_test.go @@ -0,0 +1,182 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAPIGatewayUserSchemaNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.UserSchemas.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewayUserSchemaNewParams{ + File: cloudflare.F(io.Reader(bytes.NewBuffer([]byte("some file contents")))), + Kind: cloudflare.F(cloudflare.ZoneAPIGatewayUserSchemaNewParamsKindOpenapiV3), + Name: cloudflare.F("petstore schema"), + ValidationEnabled: cloudflare.F(cloudflare.ZoneAPIGatewayUserSchemaNewParamsValidationEnabledTrue), + }, + ) + 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 TestZoneAPIGatewayUserSchemaGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.UserSchemas.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.ZoneAPIGatewayUserSchemaGetParams{ + OmitSource: cloudflare.F(true), + }, + ) + 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 TestZoneAPIGatewayUserSchemaUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.UserSchemas.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.ZoneAPIGatewayUserSchemaUpdateParams{ + ValidationEnabled: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneAPIGatewayUserSchemaListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.UserSchemas.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneAPIGatewayUserSchemaListParams{ + OmitSource: cloudflare.F(true), + Page: cloudflare.F[any](map[string]interface{}{}), + PerPage: cloudflare.F[any](map[string]interface{}{}), + ValidationEnabled: cloudflare.F(true), + }, + ) + 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 TestZoneAPIGatewayUserSchemaDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.UserSchemas.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + ) + 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/zoneapigatewayuserschemaoperation.go b/zoneapigatewayuserschemaoperation.go new file mode 100644 index 00000000000..cb9cbfeccfa --- /dev/null +++ b/zoneapigatewayuserschemaoperation.go @@ -0,0 +1,438 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAPIGatewayUserSchemaOperationService 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 +// [NewZoneAPIGatewayUserSchemaOperationService] method instead. +type ZoneAPIGatewayUserSchemaOperationService struct { + Options []option.RequestOption +} + +// NewZoneAPIGatewayUserSchemaOperationService 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 NewZoneAPIGatewayUserSchemaOperationService(opts ...option.RequestOption) (r *ZoneAPIGatewayUserSchemaOperationService) { + r = &ZoneAPIGatewayUserSchemaOperationService{} + r.Options = opts + return +} + +// Retrieves all operations from the schema. Operations that already exist in API +// Shield Endpoint Management will be returned as full operations. +func (r *ZoneAPIGatewayUserSchemaOperationService) List(ctx context.Context, zoneID string, schemaID string, query ZoneAPIGatewayUserSchemaOperationListParams, opts ...option.RequestOption) (res *ZoneAPIGatewayUserSchemaOperationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/api_gateway/user_schemas/%s/operations", zoneID, schemaID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneAPIGatewayUserSchemaOperationListResponse struct { + Errors []ZoneAPIGatewayUserSchemaOperationListResponseError `json:"errors"` + Messages []ZoneAPIGatewayUserSchemaOperationListResponseMessage `json:"messages"` + Result []ZoneAPIGatewayUserSchemaOperationListResponseResult `json:"result"` + ResultInfo ZoneAPIGatewayUserSchemaOperationListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneAPIGatewayUserSchemaOperationListResponseJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseJSON contains the JSON metadata for +// the struct [ZoneAPIGatewayUserSchemaOperationListResponse] +type zoneAPIGatewayUserSchemaOperationListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaOperationListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaOperationListResponseErrorJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseErrorJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayUserSchemaOperationListResponseError] +type zoneAPIGatewayUserSchemaOperationListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaOperationListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAPIGatewayUserSchemaOperationListResponseMessageJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseMessageJSON contains the JSON +// metadata for the struct [ZoneAPIGatewayUserSchemaOperationListResponseMessage] +type zoneAPIGatewayUserSchemaOperationListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperation] or +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperation]. +type ZoneAPIGatewayUserSchemaOperationListResponseResult interface { + implementsZoneAPIGatewayUserSchemaOperationListResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAPIGatewayUserSchemaOperationListResponseResult)(nil)).Elem(), "") +} + +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperation struct { + // The endpoint which can contain path parameter templates in curly braces, each + // will be replaced from left to right with {varN}, starting with {var1}, during + // insertion. This will further be Cloudflare-normalized upon insertion. See: + // https://developers.cloudflare.com/rules/normalization/how-it-works/. + Endpoint string `json:"endpoint" format:"uri-template"` + Features ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeatures `json:"features"` + // RFC3986-compliant host. + Host string `json:"host" format:"hostname"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The HTTP method used to access the endpoint. + Method ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod `json:"method"` + // UUID identifier + OperationID string `json:"operation_id" format:"uuid"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperation] +type zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationJSON struct { + Endpoint apijson.Field + Features apijson.Field + Host apijson.Field + LastUpdated apijson.Field + Method apijson.Field + OperationID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperation) implementsZoneAPIGatewayUserSchemaOperationListResponseResult() { +} + +// Union satisfied by +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholds] +// or +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemas]. +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeatures interface { + implementsZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeatures() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeatures)(nil)).Elem(), "") +} + +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholds struct { + Thresholds ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsThresholds `json:"thresholds"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholds] +type zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsJSON struct { + Thresholds apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholds) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholds) implementsZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeatures() { +} + +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsThresholds struct { + // The total number of auth-ids seen across this calculation. + AuthIDTokens int64 `json:"auth_id_tokens"` + // The number of data points used for the threshold suggestion calculation. + DataPoints int64 `json:"data_points"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The p50 quantile of requests (in period_seconds). + P50 int64 `json:"p50"` + // The p90 quantile of requests (in period_seconds). + P90 int64 `json:"p90"` + // The p99 quantile of requests (in period_seconds). + P99 int64 `json:"p99"` + // The period over which this threshold is suggested. + PeriodSeconds int64 `json:"period_seconds"` + // The estimated number of requests covered by these calculations. + Requests int64 `json:"requests"` + // The suggested threshold in requests done by the same auth_id or period_seconds. + SuggestedThreshold int64 `json:"suggested_threshold"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsThresholdsJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsThresholdsJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsThresholds] +type zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsThresholdsJSON struct { + AuthIDTokens apijson.Field + DataPoints apijson.Field + LastUpdated apijson.Field + P50 apijson.Field + P90 apijson.Field + P99 apijson.Field + PeriodSeconds apijson.Field + Requests apijson.Field + SuggestedThreshold apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureThresholdsThresholds) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemas struct { + ParameterSchemas ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemas `json:"parameter_schemas,required"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemas] +type zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasJSON struct { + ParameterSchemas apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemas) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemas) implementsZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeatures() { +} + +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemas struct { + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // An operation schema object containing a response. + ParameterSchemas ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasParameterSchemas `json:"parameter_schemas"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemas] +type zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasJSON struct { + LastUpdated apijson.Field + ParameterSchemas apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemas) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// An operation schema object containing a response. +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasParameterSchemas struct { + // An array containing the learned parameter schemas. + Parameters []interface{} `json:"parameters"` + // An empty response object. This field is required to yield a valid operation + // schema. + Responses interface{} `json:"responses,nullable"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasParameterSchemasJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasParameterSchemasJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasParameterSchemas] +type zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasParameterSchemasJSON struct { + Parameters apijson.Field + Responses apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationFeaturesAvFlf4mpOperationFeatureParameterSchemasParameterSchemasParameterSchemas) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The HTTP method used to access the endpoint. +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod string + +const ( + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodGet ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "GET" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodPost ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "POST" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodHead ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "HEAD" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodOptions ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "OPTIONS" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodPut ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "PUT" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodDelete ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "DELETE" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodConnect ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "CONNECT" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodPatch ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "PATCH" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethodTrace ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpOperationMethod = "TRACE" +) + +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperation struct { + // The endpoint which can contain path parameter templates in curly braces, each + // will be replaced from left to right with {varN}, starting with {var1}, during + // insertion. This will further be Cloudflare-normalized upon insertion. See: + // https://developers.cloudflare.com/rules/normalization/how-it-works/. + Endpoint string `json:"endpoint,required" format:"uri-template"` + // RFC3986-compliant host. + Host string `json:"host,required" format:"hostname"` + // The HTTP method used to access the endpoint. + Method ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod `json:"method,required"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationJSON +// contains the JSON metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperation] +type zoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationJSON struct { + Endpoint apijson.Field + Host apijson.Field + Method apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperation) implementsZoneAPIGatewayUserSchemaOperationListResponseResult() { +} + +// The HTTP method used to access the endpoint. +type ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod string + +const ( + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodGet ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "GET" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodPost ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "POST" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodHead ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "HEAD" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodOptions ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "OPTIONS" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodPut ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "PUT" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodDelete ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "DELETE" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodConnect ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "CONNECT" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodPatch ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "PATCH" + ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethodTrace ZoneAPIGatewayUserSchemaOperationListResponseResultAvFlf4mpBasicOperationMethod = "TRACE" +) + +type ZoneAPIGatewayUserSchemaOperationListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAPIGatewayUserSchemaOperationListResponseResultInfoJSON `json:"-"` +} + +// zoneAPIGatewayUserSchemaOperationListResponseResultInfoJSON contains the JSON +// metadata for the struct +// [ZoneAPIGatewayUserSchemaOperationListResponseResultInfo] +type zoneAPIGatewayUserSchemaOperationListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAPIGatewayUserSchemaOperationListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAPIGatewayUserSchemaOperationListParams struct { + // Filter results to only include endpoints containing this pattern. + Endpoint param.Field[string] `query:"endpoint"` + // Add feature(s) to the results. The feature name that is given here corresponds + // to the resulting feature object. Have a look at the top-level object description + // for more details on the specific meaning. + Feature param.Field[[]ZoneAPIGatewayUserSchemaOperationListParamsFeature] `query:"feature"` + // Filter results to only include the specified hosts. + Host param.Field[[]string] `query:"host"` + // Filter results to only include the specified HTTP methods. + Method param.Field[[]string] `query:"method"` + // Filter results by whether operations exist in API Shield Endpoint Management or + // not. `new` will just return operations from the schema that do not exist in API + // Shield Endpoint Management. `existing` will just return operations from the + // schema that already exist in API Shield Endpoint Management. + OperationStatus param.Field[ZoneAPIGatewayUserSchemaOperationListParamsOperationStatus] `query:"operation_status"` + // Page number of paginated results. + Page param.Field[interface{}] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[interface{}] `query:"per_page"` +} + +// URLQuery serializes [ZoneAPIGatewayUserSchemaOperationListParams]'s query +// parameters as `url.Values`. +func (r ZoneAPIGatewayUserSchemaOperationListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneAPIGatewayUserSchemaOperationListParamsFeature string + +const ( + ZoneAPIGatewayUserSchemaOperationListParamsFeatureThresholds ZoneAPIGatewayUserSchemaOperationListParamsFeature = "thresholds" + ZoneAPIGatewayUserSchemaOperationListParamsFeatureParameterSchemas ZoneAPIGatewayUserSchemaOperationListParamsFeature = "parameter_schemas" + ZoneAPIGatewayUserSchemaOperationListParamsFeatureSchemaInfo ZoneAPIGatewayUserSchemaOperationListParamsFeature = "schema_info" +) + +// Filter results by whether operations exist in API Shield Endpoint Management or +// not. `new` will just return operations from the schema that do not exist in API +// Shield Endpoint Management. `existing` will just return operations from the +// schema that already exist in API Shield Endpoint Management. +type ZoneAPIGatewayUserSchemaOperationListParamsOperationStatus string + +const ( + ZoneAPIGatewayUserSchemaOperationListParamsOperationStatusNew ZoneAPIGatewayUserSchemaOperationListParamsOperationStatus = "new" + ZoneAPIGatewayUserSchemaOperationListParamsOperationStatusExisting ZoneAPIGatewayUserSchemaOperationListParamsOperationStatus = "existing" +) diff --git a/zoneapigatewayuserschemaoperation_test.go b/zoneapigatewayuserschemaoperation_test.go new file mode 100644 index 00000000000..f15c7582b8f --- /dev/null +++ b/zoneapigatewayuserschemaoperation_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAPIGatewayUserSchemaOperationListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.APIGateway.UserSchemas.Operations.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + cloudflare.ZoneAPIGatewayUserSchemaOperationListParams{ + Endpoint: cloudflare.F("/api/v1"), + Feature: cloudflare.F([]cloudflare.ZoneAPIGatewayUserSchemaOperationListParamsFeature{cloudflare.ZoneAPIGatewayUserSchemaOperationListParamsFeatureThresholds}), + Host: cloudflare.F([]string{"api.cloudflare.com"}), + Method: cloudflare.F([]string{"GET"}), + OperationStatus: cloudflare.F(cloudflare.ZoneAPIGatewayUserSchemaOperationListParamsOperationStatusNew), + Page: cloudflare.F[any](map[string]interface{}{}), + PerPage: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/zoneargo.go b/zoneargo.go new file mode 100644 index 00000000000..571505c27cd --- /dev/null +++ b/zoneargo.go @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneArgoService 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 [NewZoneArgoService] method instead. +type ZoneArgoService struct { + Options []option.RequestOption + SmartRoutings *ZoneArgoSmartRoutingService + TieredCaching *ZoneArgoTieredCachingService +} + +// NewZoneArgoService 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 NewZoneArgoService(opts ...option.RequestOption) (r *ZoneArgoService) { + r = &ZoneArgoService{} + r.Options = opts + r.SmartRoutings = NewZoneArgoSmartRoutingService(opts...) + r.TieredCaching = NewZoneArgoTieredCachingService(opts...) + return +} diff --git a/zoneargosmartrouting.go b/zoneargosmartrouting.go new file mode 100644 index 00000000000..7745399ab4d --- /dev/null +++ b/zoneargosmartrouting.go @@ -0,0 +1,209 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneArgoSmartRoutingService 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 [NewZoneArgoSmartRoutingService] +// method instead. +type ZoneArgoSmartRoutingService struct { + Options []option.RequestOption +} + +// NewZoneArgoSmartRoutingService 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 NewZoneArgoSmartRoutingService(opts ...option.RequestOption) (r *ZoneArgoSmartRoutingService) { + r = &ZoneArgoSmartRoutingService{} + r.Options = opts + return +} + +// Get Argo Smart Routing setting +func (r *ZoneArgoSmartRoutingService) ArgoSmartRoutingGetArgoSmartRoutingSetting(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/argo/smart_routing", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates enablement of Argo Smart Routing. +func (r *ZoneArgoSmartRoutingService) ArgoSmartRoutingPatchArgoSmartRoutingSetting(ctx context.Context, zoneIdentifier string, body ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParams, opts ...option.RequestOption) (res *ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/argo/smart_routing", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponse struct { + Errors []ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseError `json:"errors"` + Messages []ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseSuccess `json:"success"` + JSON zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseJSON `json:"-"` +} + +// zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseJSON +// contains the JSON metadata for the struct +// [ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponse] +type zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseErrorJSON `json:"-"` +} + +// zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseError] +type zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseMessageJSON `json:"-"` +} + +// zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseMessage] +type zoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseSuccess bool + +const ( + ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseSuccessTrue ZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSettingResponseSuccess = true +) + +type ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponse struct { + Errors []ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseError `json:"errors"` + Messages []ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseSuccess `json:"success"` + JSON zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseJSON `json:"-"` +} + +// zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseJSON +// contains the JSON metadata for the struct +// [ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponse] +type zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseErrorJSON `json:"-"` +} + +// zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseError] +type zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseMessageJSON `json:"-"` +} + +// zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseMessage] +type zoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseSuccess bool + +const ( + ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseSuccessTrue ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingResponseSuccess = true +) + +type ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParams struct { + // Enables Argo Smart Routing. + Value param.Field[ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParamsValue] `json:"value,required"` +} + +func (r ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables Argo Smart Routing. +type ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParamsValue string + +const ( + ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParamsValueOn ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParamsValue = "on" + ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParamsValueOff ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParamsValue = "off" +) diff --git a/zoneargosmartrouting_test.go b/zoneargosmartrouting_test.go new file mode 100644 index 00000000000..a0d2f6c9c6f --- /dev/null +++ b/zoneargosmartrouting_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneArgoSmartRoutingArgoSmartRoutingGetArgoSmartRoutingSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Argos.SmartRoutings.ArgoSmartRoutingGetArgoSmartRoutingSetting(context.TODO(), "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()) + } +} + +func TestZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Argos.SmartRoutings.ArgoSmartRoutingPatchArgoSmartRoutingSetting( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParams{ + Value: cloudflare.F(cloudflare.ZoneArgoSmartRoutingArgoSmartRoutingPatchArgoSmartRoutingSettingParamsValueOn), + }, + ) + 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/zoneargotieredcaching.go b/zoneargotieredcaching.go new file mode 100644 index 00000000000..6eceac006f1 --- /dev/null +++ b/zoneargotieredcaching.go @@ -0,0 +1,209 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneArgoTieredCachingService 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 [NewZoneArgoTieredCachingService] +// method instead. +type ZoneArgoTieredCachingService struct { + Options []option.RequestOption +} + +// NewZoneArgoTieredCachingService 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 NewZoneArgoTieredCachingService(opts ...option.RequestOption) (r *ZoneArgoTieredCachingService) { + r = &ZoneArgoTieredCachingService{} + r.Options = opts + return +} + +// Get Tiered Caching setting +func (r *ZoneArgoTieredCachingService) TieredCachingGetTieredCachingSetting(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/argo/tiered_caching", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates enablement of Tiered Caching +func (r *ZoneArgoTieredCachingService) TieredCachingPatchTieredCachingSetting(ctx context.Context, zoneIdentifier string, body ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParams, opts ...option.RequestOption) (res *ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/argo/tiered_caching", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponse struct { + Errors []ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseError `json:"errors"` + Messages []ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseSuccess `json:"success"` + JSON zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseJSON `json:"-"` +} + +// zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseJSON contains +// the JSON metadata for the struct +// [ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponse] +type zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseErrorJSON `json:"-"` +} + +// zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseError] +type zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseMessageJSON `json:"-"` +} + +// zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseMessage] +type zoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseSuccess bool + +const ( + ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseSuccessTrue ZoneArgoTieredCachingTieredCachingGetTieredCachingSettingResponseSuccess = true +) + +type ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponse struct { + Errors []ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseError `json:"errors"` + Messages []ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseSuccess `json:"success"` + JSON zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseJSON `json:"-"` +} + +// zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseJSON contains +// the JSON metadata for the struct +// [ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponse] +type zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseErrorJSON `json:"-"` +} + +// zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseError] +type zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseMessageJSON `json:"-"` +} + +// zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseMessage] +type zoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseSuccess bool + +const ( + ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseSuccessTrue ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingResponseSuccess = true +) + +type ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParams struct { + // Enables Tiered Caching. + Value param.Field[ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParamsValue] `json:"value,required"` +} + +func (r ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables Tiered Caching. +type ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParamsValue string + +const ( + ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParamsValueOn ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParamsValue = "on" + ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParamsValueOff ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParamsValue = "off" +) diff --git a/zoneargotieredcaching_test.go b/zoneargotieredcaching_test.go new file mode 100644 index 00000000000..3b4fdd3fdf6 --- /dev/null +++ b/zoneargotieredcaching_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneArgoTieredCachingTieredCachingGetTieredCachingSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Argos.TieredCaching.TieredCachingGetTieredCachingSetting(context.TODO(), "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()) + } +} + +func TestZoneArgoTieredCachingTieredCachingPatchTieredCachingSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Argos.TieredCaching.TieredCachingPatchTieredCachingSetting( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParams{ + Value: cloudflare.F(cloudflare.ZoneArgoTieredCachingTieredCachingPatchTieredCachingSettingParamsValueOn), + }, + ) + 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/zoneavailableplan.go b/zoneavailableplan.go new file mode 100644 index 00000000000..0794ec37bb7 --- /dev/null +++ b/zoneavailableplan.go @@ -0,0 +1,324 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAvailablePlanService 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 [NewZoneAvailablePlanService] method +// instead. +type ZoneAvailablePlanService struct { + Options []option.RequestOption +} + +// NewZoneAvailablePlanService 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 NewZoneAvailablePlanService(opts ...option.RequestOption) (r *ZoneAvailablePlanService) { + r = &ZoneAvailablePlanService{} + r.Options = opts + return +} + +// Details of the available plan that the zone can subscribe to. +func (r *ZoneAvailablePlanService) Get(ctx context.Context, zoneIdentifier string, planIdentifier string, opts ...option.RequestOption) (res *ZoneAvailablePlanGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/available_plans/%s", zoneIdentifier, planIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Lists available plans the zone can subscribe to. +func (r *ZoneAvailablePlanService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneAvailablePlanListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/available_plans", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneAvailablePlanGetResponse struct { + Errors []ZoneAvailablePlanGetResponseError `json:"errors"` + Messages []ZoneAvailablePlanGetResponseMessage `json:"messages"` + Result ZoneAvailablePlanGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneAvailablePlanGetResponseSuccess `json:"success"` + JSON zoneAvailablePlanGetResponseJSON `json:"-"` +} + +// zoneAvailablePlanGetResponseJSON contains the JSON metadata for the struct +// [ZoneAvailablePlanGetResponse] +type zoneAvailablePlanGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailablePlanGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAvailablePlanGetResponseErrorJSON `json:"-"` +} + +// zoneAvailablePlanGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneAvailablePlanGetResponseError] +type zoneAvailablePlanGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailablePlanGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAvailablePlanGetResponseMessageJSON `json:"-"` +} + +// zoneAvailablePlanGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneAvailablePlanGetResponseMessage] +type zoneAvailablePlanGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailablePlanGetResponseResult struct { + // Identifier + ID string `json:"id"` + // Indicates whether you can subscribe to this plan. + CanSubscribe bool `json:"can_subscribe"` + // The monetary unit in which pricing information is displayed. + Currency string `json:"currency"` + // Indicates whether this plan is managed externally. + ExternallyManaged bool `json:"externally_managed"` + // The frequency at which you will be billed for this plan. + Frequency ZoneAvailablePlanGetResponseResultFrequency `json:"frequency"` + // Indicates whether you are currently subscribed to this plan. + IsSubscribed bool `json:"is_subscribed"` + // Indicates whether this plan has a legacy discount applied. + LegacyDiscount bool `json:"legacy_discount"` + // The legacy identifier for this rate plan, if any. + LegacyID string `json:"legacy_id"` + // The plan name. + Name string `json:"name"` + // The amount you will be billed for this plan. + Price float64 `json:"price"` + JSON zoneAvailablePlanGetResponseResultJSON `json:"-"` +} + +// zoneAvailablePlanGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneAvailablePlanGetResponseResult] +type zoneAvailablePlanGetResponseResultJSON struct { + ID apijson.Field + CanSubscribe apijson.Field + Currency apijson.Field + ExternallyManaged apijson.Field + Frequency apijson.Field + IsSubscribed apijson.Field + LegacyDiscount apijson.Field + LegacyID apijson.Field + Name apijson.Field + Price apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which you will be billed for this plan. +type ZoneAvailablePlanGetResponseResultFrequency string + +const ( + ZoneAvailablePlanGetResponseResultFrequencyWeekly ZoneAvailablePlanGetResponseResultFrequency = "weekly" + ZoneAvailablePlanGetResponseResultFrequencyMonthly ZoneAvailablePlanGetResponseResultFrequency = "monthly" + ZoneAvailablePlanGetResponseResultFrequencyQuarterly ZoneAvailablePlanGetResponseResultFrequency = "quarterly" + ZoneAvailablePlanGetResponseResultFrequencyYearly ZoneAvailablePlanGetResponseResultFrequency = "yearly" +) + +// Whether the API call was successful +type ZoneAvailablePlanGetResponseSuccess bool + +const ( + ZoneAvailablePlanGetResponseSuccessTrue ZoneAvailablePlanGetResponseSuccess = true +) + +type ZoneAvailablePlanListResponse struct { + Errors []ZoneAvailablePlanListResponseError `json:"errors"` + Messages []ZoneAvailablePlanListResponseMessage `json:"messages"` + Result []ZoneAvailablePlanListResponseResult `json:"result"` + ResultInfo ZoneAvailablePlanListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneAvailablePlanListResponseSuccess `json:"success"` + JSON zoneAvailablePlanListResponseJSON `json:"-"` +} + +// zoneAvailablePlanListResponseJSON contains the JSON metadata for the struct +// [ZoneAvailablePlanListResponse] +type zoneAvailablePlanListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailablePlanListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAvailablePlanListResponseErrorJSON `json:"-"` +} + +// zoneAvailablePlanListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneAvailablePlanListResponseError] +type zoneAvailablePlanListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailablePlanListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAvailablePlanListResponseMessageJSON `json:"-"` +} + +// zoneAvailablePlanListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneAvailablePlanListResponseMessage] +type zoneAvailablePlanListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailablePlanListResponseResult struct { + // Identifier + ID string `json:"id"` + // Indicates whether you can subscribe to this plan. + CanSubscribe bool `json:"can_subscribe"` + // The monetary unit in which pricing information is displayed. + Currency string `json:"currency"` + // Indicates whether this plan is managed externally. + ExternallyManaged bool `json:"externally_managed"` + // The frequency at which you will be billed for this plan. + Frequency ZoneAvailablePlanListResponseResultFrequency `json:"frequency"` + // Indicates whether you are currently subscribed to this plan. + IsSubscribed bool `json:"is_subscribed"` + // Indicates whether this plan has a legacy discount applied. + LegacyDiscount bool `json:"legacy_discount"` + // The legacy identifier for this rate plan, if any. + LegacyID string `json:"legacy_id"` + // The plan name. + Name string `json:"name"` + // The amount you will be billed for this plan. + Price float64 `json:"price"` + JSON zoneAvailablePlanListResponseResultJSON `json:"-"` +} + +// zoneAvailablePlanListResponseResultJSON contains the JSON metadata for the +// struct [ZoneAvailablePlanListResponseResult] +type zoneAvailablePlanListResponseResultJSON struct { + ID apijson.Field + CanSubscribe apijson.Field + Currency apijson.Field + ExternallyManaged apijson.Field + Frequency apijson.Field + IsSubscribed apijson.Field + LegacyDiscount apijson.Field + LegacyID apijson.Field + Name apijson.Field + Price apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which you will be billed for this plan. +type ZoneAvailablePlanListResponseResultFrequency string + +const ( + ZoneAvailablePlanListResponseResultFrequencyWeekly ZoneAvailablePlanListResponseResultFrequency = "weekly" + ZoneAvailablePlanListResponseResultFrequencyMonthly ZoneAvailablePlanListResponseResultFrequency = "monthly" + ZoneAvailablePlanListResponseResultFrequencyQuarterly ZoneAvailablePlanListResponseResultFrequency = "quarterly" + ZoneAvailablePlanListResponseResultFrequencyYearly ZoneAvailablePlanListResponseResultFrequency = "yearly" +) + +type ZoneAvailablePlanListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAvailablePlanListResponseResultInfoJSON `json:"-"` +} + +// zoneAvailablePlanListResponseResultInfoJSON contains the JSON metadata for the +// struct [ZoneAvailablePlanListResponseResultInfo] +type zoneAvailablePlanListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailablePlanListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAvailablePlanListResponseSuccess bool + +const ( + ZoneAvailablePlanListResponseSuccessTrue ZoneAvailablePlanListResponseSuccess = true +) diff --git a/zonesettingprivacypass_test.go b/zoneavailableplan_test.go similarity index 64% rename from zonesettingprivacypass_test.go rename to zoneavailableplan_test.go index 6472facf74a..69c6d64770b 100644 --- a/zonesettingprivacypass_test.go +++ b/zoneavailableplan_test.go @@ -13,7 +13,8 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestZoneSettingPrivacyPassUpdate(t *testing.T) { +func TestZoneAvailablePlanGet(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 @@ -23,15 +24,15 @@ func TestZoneSettingPrivacyPassUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.Zones.Settings.PrivacyPasses.Update( + _, err := client.Zones.AvailablePlans.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.ZoneSettingPrivacyPassUpdateParams{ - Value: cloudflare.F(cloudflare.ZoneSettingPrivacyPassUpdateParamsValueOn), - }, + "023e105f4ecef8ad9ca31a8372d0c353", ) if err != nil { var apierr *cloudflare.Error @@ -42,7 +43,8 @@ func TestZoneSettingPrivacyPassUpdate(t *testing.T) { } } -func TestZoneSettingPrivacyPassList(t *testing.T) { +func TestZoneAvailablePlanList(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 @@ -52,10 +54,12 @@ func TestZoneSettingPrivacyPassList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.Zones.Settings.PrivacyPasses.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.Zones.AvailablePlans.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { diff --git a/zoneavailablerateplan.go b/zoneavailablerateplan.go new file mode 100644 index 00000000000..126bc1edf84 --- /dev/null +++ b/zoneavailablerateplan.go @@ -0,0 +1,220 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneAvailableRatePlanService 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 [NewZoneAvailableRatePlanService] +// method instead. +type ZoneAvailableRatePlanService struct { + Options []option.RequestOption +} + +// NewZoneAvailableRatePlanService 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 NewZoneAvailableRatePlanService(opts ...option.RequestOption) (r *ZoneAvailableRatePlanService) { + r = &ZoneAvailableRatePlanService{} + r.Options = opts + return +} + +// Lists all rate plans the zone can subscribe to. +func (r *ZoneAvailableRatePlanService) ZoneRatePlanListAvailableRatePlans(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/available_rate_plans", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponse struct { + Errors []ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseError `json:"errors"` + Messages []ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseMessage `json:"messages"` + Result []ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResult `json:"result"` + ResultInfo ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseSuccess `json:"success"` + JSON zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseJSON `json:"-"` +} + +// zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseJSON contains the +// JSON metadata for the struct +// [ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponse] +type zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseErrorJSON `json:"-"` +} + +// zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseError] +type zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseMessageJSON `json:"-"` +} + +// zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseMessage] +type zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResult struct { + // Plan identifier tag. + ID string `json:"id"` + // Array of available components values for the plan. + Components []ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponent `json:"components"` + // The monetary unit in which pricing information is displayed. + Currency string `json:"currency"` + // The duration of the plan subscription. + Duration float64 `json:"duration"` + // The frequency at which you will be billed for this plan. + Frequency ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequency `json:"frequency"` + // The plan name. + Name string `json:"name"` + JSON zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultJSON `json:"-"` +} + +// zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResult] +type zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultJSON struct { + ID apijson.Field + Components apijson.Field + Currency apijson.Field + Duration apijson.Field + Frequency apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponent struct { + // The default amount allocated. + Default float64 `json:"default"` + // The unique component. + Name ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsName `json:"name"` + // The unit price of the addon. + UnitPrice float64 `json:"unit_price"` + JSON zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentJSON `json:"-"` +} + +// zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentJSON +// contains the JSON metadata for the struct +// [ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponent] +type zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentJSON struct { + Default apijson.Field + Name apijson.Field + UnitPrice apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The unique component. +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsName string + +const ( + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsNameZones ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsName = "zones" + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsNamePageRules ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsName = "page_rules" + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsNameDedicatedCertificates ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsName = "dedicated_certificates" + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsNameDedicatedCertificatesCustom ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultComponentsName = "dedicated_certificates_custom" +) + +// The frequency at which you will be billed for this plan. +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequency string + +const ( + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequencyWeekly ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequency = "weekly" + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequencyMonthly ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequency = "monthly" + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequencyQuarterly ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequency = "quarterly" + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequencyYearly ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultFrequency = "yearly" +) + +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultInfoJSON `json:"-"` +} + +// zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultInfo] +type zoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseSuccess bool + +const ( + ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseSuccessTrue ZoneAvailableRatePlanZoneRatePlanListAvailableRatePlansResponseSuccess = true +) diff --git a/zoneavailablerateplan_test.go b/zoneavailablerateplan_test.go new file mode 100644 index 00000000000..b1abc274b18 --- /dev/null +++ b/zoneavailablerateplan_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneAvailableRatePlanZoneRatePlanListAvailableRatePlans(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.AvailableRatePlans.ZoneRatePlanListAvailableRatePlans(context.TODO(), "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/zonebotmanagement.go b/zonebotmanagement.go new file mode 100644 index 00000000000..81980f8749e --- /dev/null +++ b/zonebotmanagement.go @@ -0,0 +1,822 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneBotManagementService 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 [NewZoneBotManagementService] method +// instead. +type ZoneBotManagementService struct { + Options []option.RequestOption +} + +// NewZoneBotManagementService 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 NewZoneBotManagementService(opts ...option.RequestOption) (r *ZoneBotManagementService) { + r = &ZoneBotManagementService{} + r.Options = opts + return +} + +// Retrieve a zone's Bot Management Config +func (r *ZoneBotManagementService) Get(ctx context.Context, zoneIdentifier string, query ZoneBotManagementGetParams, opts ...option.RequestOption) (res *ZoneBotManagementGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/bot_management", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Updates the Bot Management configuration for a zone. +// +// This API is used to update: +// +// - **Bot Fight Mode** +// - **Super Bot Fight Mode** +// - **Bot Management for Enterprise** +// +// See [Bot Plans](https://developers.cloudflare.com/bots/plans/) for more +// information on the different plans +func (r *ZoneBotManagementService) Update(ctx context.Context, zoneIdentifier string, params ZoneBotManagementUpdateParams, opts ...option.RequestOption) (res *ZoneBotManagementUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/bot_management", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) + return +} + +type ZoneBotManagementGetResponse struct { + Errors []ZoneBotManagementGetResponseError `json:"errors"` + Messages []ZoneBotManagementGetResponseMessage `json:"messages"` + Result ZoneBotManagementGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneBotManagementGetResponseSuccess `json:"success"` + JSON zoneBotManagementGetResponseJSON `json:"-"` +} + +// zoneBotManagementGetResponseJSON contains the JSON metadata for the struct +// [ZoneBotManagementGetResponse] +type zoneBotManagementGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneBotManagementGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneBotManagementGetResponseErrorJSON `json:"-"` +} + +// zoneBotManagementGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneBotManagementGetResponseError] +type zoneBotManagementGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneBotManagementGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneBotManagementGetResponseMessageJSON `json:"-"` +} + +// zoneBotManagementGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneBotManagementGetResponseMessage] +type zoneBotManagementGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneBotManagementGetResponseResultEsic0axpBotFightModeConfig], +// [ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfig], +// [ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfig] or +// [ZoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfig]. +type ZoneBotManagementGetResponseResult interface { + implementsZoneBotManagementGetResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneBotManagementGetResponseResult)(nil)).Elem(), "") +} + +type ZoneBotManagementGetResponseResultEsic0axpBotFightModeConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to enable Bot Fight Mode. + FightMode bool `json:"fight_mode"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementGetResponseResultEsic0axpBotFightModeConfigJSON `json:"-"` +} + +// zoneBotManagementGetResponseResultEsic0axpBotFightModeConfigJSON contains the +// JSON metadata for the struct +// [ZoneBotManagementGetResponseResultEsic0axpBotFightModeConfig] +type zoneBotManagementGetResponseResultEsic0axpBotFightModeConfigJSON struct { + EnableJs apijson.Field + FightMode apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementGetResponseResultEsic0axpBotFightModeConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementGetResponseResultEsic0axpBotFightModeConfig) implementsZoneBotManagementGetResponseResult() { +} + +type ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to optimize Super Bot Fight Mode protections for Wordpress. + OptimizeWordpress bool `json:"optimize_wordpress"` + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + SbfmDefinitelyAutomated ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + // static resources on your application need bot protection. Note: Static resource + // protection can also result in legitimate traffic being blocked. + SbfmStaticResourceProtection bool `json:"sbfm_static_resource_protection"` + // Super Bot Fight Mode (SBFM) action to take on verified bots requests. + SbfmVerifiedBots ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots `json:"sbfm_verified_bots"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigJSON `json:"-"` +} + +// zoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigJSON contains the +// JSON metadata for the struct +// [ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfig] +type zoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigJSON struct { + EnableJs apijson.Field + OptimizeWordpress apijson.Field + SbfmDefinitelyAutomated apijson.Field + SbfmStaticResourceProtection apijson.Field + SbfmVerifiedBots apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfig) implementsZoneBotManagementGetResponseResult() { +} + +// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. +type ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated string + +const ( + ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedAllow ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "allow" + ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedBlock ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "block" + ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedManagedChallenge ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on verified bots requests. +type ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots string + +const ( + ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBotsAllow ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots = "allow" + ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBotsBlock ZoneBotManagementGetResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots = "block" +) + +type ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to optimize Super Bot Fight Mode protections for Wordpress. + OptimizeWordpress bool `json:"optimize_wordpress"` + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + SbfmDefinitelyAutomated ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) action to take on likely automated requests. + SbfmLikelyAutomated ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated `json:"sbfm_likely_automated"` + // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + // static resources on your application need bot protection. Note: Static resource + // protection can also result in legitimate traffic being blocked. + SbfmStaticResourceProtection bool `json:"sbfm_static_resource_protection"` + // Super Bot Fight Mode (SBFM) action to take on verified bots requests. + SbfmVerifiedBots ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots `json:"sbfm_verified_bots"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigJSON `json:"-"` +} + +// zoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigJSON contains the JSON +// metadata for the struct +// [ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfig] +type zoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigJSON struct { + EnableJs apijson.Field + OptimizeWordpress apijson.Field + SbfmDefinitelyAutomated apijson.Field + SbfmLikelyAutomated apijson.Field + SbfmStaticResourceProtection apijson.Field + SbfmVerifiedBots apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfig) implementsZoneBotManagementGetResponseResult() { +} + +// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. +type ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated string + +const ( + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedAllow ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "allow" + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedBlock ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "block" + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedManagedChallenge ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on likely automated requests. +type ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated string + +const ( + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedAllow ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "allow" + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedBlock ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "block" + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedManagedChallenge ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on verified bots requests. +type ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots string + +const ( + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBotsAllow ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots = "allow" + ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBotsBlock ZoneBotManagementGetResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots = "block" +) + +type ZoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfig struct { + // Automatically update to the newest bot detection models created by Cloudflare as + // they are released. + // [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + AutoUpdateModel bool `json:"auto_update_model"` + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to disable tracking the highest bot score for a session in the Bot + // Management cookie. + SuppressSessionScore bool `json:"suppress_session_score"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfigJSON `json:"-"` +} + +// zoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfigJSON contains the +// JSON metadata for the struct +// [ZoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfig] +type zoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfigJSON struct { + AutoUpdateModel apijson.Field + EnableJs apijson.Field + SuppressSessionScore apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementGetResponseResultEsic0axpBmSubscriptionConfig) implementsZoneBotManagementGetResponseResult() { +} + +// Whether the API call was successful +type ZoneBotManagementGetResponseSuccess bool + +const ( + ZoneBotManagementGetResponseSuccessTrue ZoneBotManagementGetResponseSuccess = true +) + +type ZoneBotManagementUpdateResponse struct { + Errors []ZoneBotManagementUpdateResponseError `json:"errors"` + Messages []ZoneBotManagementUpdateResponseMessage `json:"messages"` + Result ZoneBotManagementUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneBotManagementUpdateResponseSuccess `json:"success"` + JSON zoneBotManagementUpdateResponseJSON `json:"-"` +} + +// zoneBotManagementUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneBotManagementUpdateResponse] +type zoneBotManagementUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneBotManagementUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneBotManagementUpdateResponseErrorJSON `json:"-"` +} + +// zoneBotManagementUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneBotManagementUpdateResponseError] +type zoneBotManagementUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneBotManagementUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneBotManagementUpdateResponseMessageJSON `json:"-"` +} + +// zoneBotManagementUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneBotManagementUpdateResponseMessage] +type zoneBotManagementUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfig], +// [ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfig], +// [ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfig] or +// [ZoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfig]. +type ZoneBotManagementUpdateResponseResult interface { + implementsZoneBotManagementUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneBotManagementUpdateResponseResult)(nil)).Elem(), "") +} + +type ZoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to enable Bot Fight Mode. + FightMode bool `json:"fight_mode"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfigJSON `json:"-"` +} + +// zoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfigJSON contains the +// JSON metadata for the struct +// [ZoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfig] +type zoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfigJSON struct { + EnableJs apijson.Field + FightMode apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementUpdateResponseResultEsic0axpBotFightModeConfig) implementsZoneBotManagementUpdateResponseResult() { +} + +type ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to optimize Super Bot Fight Mode protections for Wordpress. + OptimizeWordpress bool `json:"optimize_wordpress"` + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + SbfmDefinitelyAutomated ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + // static resources on your application need bot protection. Note: Static resource + // protection can also result in legitimate traffic being blocked. + SbfmStaticResourceProtection bool `json:"sbfm_static_resource_protection"` + // Super Bot Fight Mode (SBFM) action to take on verified bots requests. + SbfmVerifiedBots ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots `json:"sbfm_verified_bots"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigJSON `json:"-"` +} + +// zoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigJSON contains +// the JSON metadata for the struct +// [ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfig] +type zoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigJSON struct { + EnableJs apijson.Field + OptimizeWordpress apijson.Field + SbfmDefinitelyAutomated apijson.Field + SbfmStaticResourceProtection apijson.Field + SbfmVerifiedBots apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfig) implementsZoneBotManagementUpdateResponseResult() { +} + +// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. +type ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated string + +const ( + ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedAllow ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "allow" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedBlock ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "block" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedManagedChallenge ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on verified bots requests. +type ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots string + +const ( + ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBotsAllow ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots = "allow" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBotsBlock ZoneBotManagementUpdateResponseResultEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots = "block" +) + +type ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to optimize Super Bot Fight Mode protections for Wordpress. + OptimizeWordpress bool `json:"optimize_wordpress"` + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + SbfmDefinitelyAutomated ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) action to take on likely automated requests. + SbfmLikelyAutomated ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated `json:"sbfm_likely_automated"` + // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + // static resources on your application need bot protection. Note: Static resource + // protection can also result in legitimate traffic being blocked. + SbfmStaticResourceProtection bool `json:"sbfm_static_resource_protection"` + // Super Bot Fight Mode (SBFM) action to take on verified bots requests. + SbfmVerifiedBots ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots `json:"sbfm_verified_bots"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigJSON `json:"-"` +} + +// zoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigJSON contains the +// JSON metadata for the struct +// [ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfig] +type zoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigJSON struct { + EnableJs apijson.Field + OptimizeWordpress apijson.Field + SbfmDefinitelyAutomated apijson.Field + SbfmLikelyAutomated apijson.Field + SbfmStaticResourceProtection apijson.Field + SbfmVerifiedBots apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfig) implementsZoneBotManagementUpdateResponseResult() { +} + +// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. +type ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated string + +const ( + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedAllow ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "allow" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedBlock ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "block" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedManagedChallenge ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on likely automated requests. +type ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated string + +const ( + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedAllow ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "allow" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedBlock ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "block" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedManagedChallenge ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on verified bots requests. +type ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots string + +const ( + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBotsAllow ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots = "allow" + ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBotsBlock ZoneBotManagementUpdateResponseResultEsic0axpSbfmLikelyConfigSbfmVerifiedBots = "block" +) + +type ZoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfig struct { + // Automatically update to the newest bot detection models created by Cloudflare as + // they are released. + // [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + AutoUpdateModel bool `json:"auto_update_model"` + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs bool `json:"enable_js"` + // Whether to disable tracking the highest bot score for a session in the Bot + // Management cookie. + SuppressSessionScore bool `json:"suppress_session_score"` + // A read-only field that indicates whether the zone currently is running the + // latest ML model. + UsingLatestModel bool `json:"using_latest_model"` + JSON zoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfigJSON `json:"-"` +} + +// zoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfigJSON contains +// the JSON metadata for the struct +// [ZoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfig] +type zoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfigJSON struct { + AutoUpdateModel apijson.Field + EnableJs apijson.Field + SuppressSessionScore apijson.Field + UsingLatestModel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneBotManagementUpdateResponseResultEsic0axpBmSubscriptionConfig) implementsZoneBotManagementUpdateResponseResult() { +} + +// Whether the API call was successful +type ZoneBotManagementUpdateResponseSuccess bool + +const ( + ZoneBotManagementUpdateResponseSuccessTrue ZoneBotManagementUpdateResponseSuccess = true +) + +type ZoneBotManagementGetParams struct { + // Header used to control which version of the API to use. Note: Only the 2.0.0 + // version is documented. The older 1.0.0 version is deprecated and will soon be + // removed. + CloudflareVersion param.Field[ZoneBotManagementGetParamsCloudflareVersion] `header:"Cloudflare-Version"` +} + +// Header used to control which version of the API to use. Note: Only the 2.0.0 +// version is documented. The older 1.0.0 version is deprecated and will soon be +// removed. +type ZoneBotManagementGetParamsCloudflareVersion string + +const ( + ZoneBotManagementGetParamsCloudflareVersion2_0_0 ZoneBotManagementGetParamsCloudflareVersion = "2.0.0" + ZoneBotManagementGetParamsCloudflareVersion1_0_0 ZoneBotManagementGetParamsCloudflareVersion = "1.0.0" +) + +// This interface is a union satisfied by one of the following: +// [ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfig], +// [ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfig], +// [ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfig], +// [ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfig]. +type ZoneBotManagementUpdateParams interface { + ImplementsZoneBotManagementUpdateParams() +} + +type ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs param.Field[bool] `json:"enable_js"` + // Whether to enable Bot Fight Mode. + FightMode param.Field[bool] `json:"fight_mode"` + // Header used to control which version of the API to use. Note: Only the 2.0.0 + // version is documented. The older 1.0.0 version is deprecated and will soon be + // removed. + CloudflareVersion param.Field[ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfigCloudflareVersion] `header:"Cloudflare-Version"` +} + +func (r ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfig) ImplementsZoneBotManagementUpdateParams() { + +} + +// Header used to control which version of the API to use. Note: Only the 2.0.0 +// version is documented. The older 1.0.0 version is deprecated and will soon be +// removed. +type ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfigCloudflareVersion string + +const ( + ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfigCloudflareVersion2_0_0 ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfigCloudflareVersion = "2.0.0" + ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfigCloudflareVersion1_0_0 ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfigCloudflareVersion = "1.0.0" +) + +type ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs param.Field[bool] `json:"enable_js"` + // Whether to optimize Super Bot Fight Mode protections for Wordpress. + OptimizeWordpress param.Field[bool] `json:"optimize_wordpress"` + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + SbfmDefinitelyAutomated param.Field[ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + // static resources on your application need bot protection. Note: Static resource + // protection can also result in legitimate traffic being blocked. + SbfmStaticResourceProtection param.Field[bool] `json:"sbfm_static_resource_protection"` + // Super Bot Fight Mode (SBFM) action to take on verified bots requests. + SbfmVerifiedBots param.Field[ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots] `json:"sbfm_verified_bots"` + // Header used to control which version of the API to use. Note: Only the 2.0.0 + // version is documented. The older 1.0.0 version is deprecated and will soon be + // removed. + CloudflareVersion param.Field[ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigCloudflareVersion] `header:"Cloudflare-Version"` +} + +func (r ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfig) ImplementsZoneBotManagementUpdateParams() { + +} + +// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. +type ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated string + +const ( + ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedAllow ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "allow" + ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedBlock ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "block" + ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomatedManagedChallenge ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmDefinitelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on verified bots requests. +type ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots string + +const ( + ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmVerifiedBotsAllow ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots = "allow" + ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmVerifiedBotsBlock ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigSbfmVerifiedBots = "block" +) + +// Header used to control which version of the API to use. Note: Only the 2.0.0 +// version is documented. The older 1.0.0 version is deprecated and will soon be +// removed. +type ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigCloudflareVersion string + +const ( + ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigCloudflareVersion2_0_0 ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigCloudflareVersion = "2.0.0" + ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigCloudflareVersion1_0_0 ZoneBotManagementUpdateParamsEsic0axpSbfmDefinitelyConfigCloudflareVersion = "1.0.0" +) + +type ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfig struct { + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs param.Field[bool] `json:"enable_js"` + // Whether to optimize Super Bot Fight Mode protections for Wordpress. + OptimizeWordpress param.Field[bool] `json:"optimize_wordpress"` + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + SbfmDefinitelyAutomated param.Field[ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) action to take on likely automated requests. + SbfmLikelyAutomated param.Field[ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomated] `json:"sbfm_likely_automated"` + // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + // static resources on your application need bot protection. Note: Static resource + // protection can also result in legitimate traffic being blocked. + SbfmStaticResourceProtection param.Field[bool] `json:"sbfm_static_resource_protection"` + // Super Bot Fight Mode (SBFM) action to take on verified bots requests. + SbfmVerifiedBots param.Field[ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmVerifiedBots] `json:"sbfm_verified_bots"` + // Header used to control which version of the API to use. Note: Only the 2.0.0 + // version is documented. The older 1.0.0 version is deprecated and will soon be + // removed. + CloudflareVersion param.Field[ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigCloudflareVersion] `header:"Cloudflare-Version"` +} + +func (r ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfig) ImplementsZoneBotManagementUpdateParams() { + +} + +// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. +type ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated string + +const ( + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedAllow ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "allow" + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedBlock ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "block" + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomatedManagedChallenge ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmDefinitelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on likely automated requests. +type ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomated string + +const ( + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedAllow ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "allow" + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedBlock ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "block" + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomatedManagedChallenge ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmLikelyAutomated = "managed_challenge" +) + +// Super Bot Fight Mode (SBFM) action to take on verified bots requests. +type ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmVerifiedBots string + +const ( + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmVerifiedBotsAllow ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmVerifiedBots = "allow" + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmVerifiedBotsBlock ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigSbfmVerifiedBots = "block" +) + +// Header used to control which version of the API to use. Note: Only the 2.0.0 +// version is documented. The older 1.0.0 version is deprecated and will soon be +// removed. +type ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigCloudflareVersion string + +const ( + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigCloudflareVersion2_0_0 ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigCloudflareVersion = "2.0.0" + ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigCloudflareVersion1_0_0 ZoneBotManagementUpdateParamsEsic0axpSbfmLikelyConfigCloudflareVersion = "1.0.0" +) + +type ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfig struct { + // Automatically update to the newest bot detection models created by Cloudflare as + // they are released. + // [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + AutoUpdateModel param.Field[bool] `json:"auto_update_model"` + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs param.Field[bool] `json:"enable_js"` + // Whether to disable tracking the highest bot score for a session in the Bot + // Management cookie. + SuppressSessionScore param.Field[bool] `json:"suppress_session_score"` + // Header used to control which version of the API to use. Note: Only the 2.0.0 + // version is documented. The older 1.0.0 version is deprecated and will soon be + // removed. + CloudflareVersion param.Field[ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfigCloudflareVersion] `header:"Cloudflare-Version"` +} + +func (r ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfig) ImplementsZoneBotManagementUpdateParams() { + +} + +// Header used to control which version of the API to use. Note: Only the 2.0.0 +// version is documented. The older 1.0.0 version is deprecated and will soon be +// removed. +type ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfigCloudflareVersion string + +const ( + ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfigCloudflareVersion2_0_0 ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfigCloudflareVersion = "2.0.0" + ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfigCloudflareVersion1_0_0 ZoneBotManagementUpdateParamsEsic0axpBmSubscriptionConfigCloudflareVersion = "1.0.0" +) diff --git a/zonebotmanagement_test.go b/zonebotmanagement_test.go new file mode 100644 index 00000000000..99147f08ec7 --- /dev/null +++ b/zonebotmanagement_test.go @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneBotManagementGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.BotManagement.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneBotManagementGetParams{ + CloudflareVersion: cloudflare.F(cloudflare.ZoneBotManagementGetParamsCloudflareVersion2_0_0), + }, + ) + 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 TestZoneBotManagementUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.BotManagement.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfig{ + EnableJs: cloudflare.F(true), + FightMode: cloudflare.F(true), + CloudflareVersion: cloudflare.F(cloudflare.ZoneBotManagementUpdateParamsEsic0axpBotFightModeConfigCloudflareVersion2_0_0), + }, + ) + 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/zonecach.go b/zonecach.go new file mode 100644 index 00000000000..119c5758e84 --- /dev/null +++ b/zonecach.go @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCachService 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 [NewZoneCachService] method instead. +type ZoneCachService struct { + Options []option.RequestOption + CacheReserves *ZoneCachCacheReserveService + TieredCacheSmartTopologyEnables *ZoneCachTieredCacheSmartTopologyEnableService + Variants *ZoneCachVariantService +} + +// NewZoneCachService 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 NewZoneCachService(opts ...option.RequestOption) (r *ZoneCachService) { + r = &ZoneCachService{} + r.Options = opts + r.CacheReserves = NewZoneCachCacheReserveService(opts...) + r.TieredCacheSmartTopologyEnables = NewZoneCachTieredCacheSmartTopologyEnableService(opts...) + r.Variants = NewZoneCachVariantService(opts...) + return +} diff --git a/zonecachcachereserve.go b/zonecachcachereserve.go new file mode 100644 index 00000000000..98a1b3028aa --- /dev/null +++ b/zonecachcachereserve.go @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCachCacheReserveService 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 [NewZoneCachCacheReserveService] +// method instead. +type ZoneCachCacheReserveService struct { + Options []option.RequestOption +} + +// NewZoneCachCacheReserveService 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 NewZoneCachCacheReserveService(opts ...option.RequestOption) (r *ZoneCachCacheReserveService) { + r = &ZoneCachCacheReserveService{} + r.Options = opts + return +} + +// Increase cache lifetimes by automatically storing all cacheable files into +// Cloudflare's persistent object storage buckets. Requires Cache Reserve +// subscription. Note: using Tiered Cache with Cache Reserve is highly recommended +// to reduce Reserve operations costs. See the +// [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) +// for more information. +func (r *ZoneCachCacheReserveService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCachCacheReserveListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/cache_reserve", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Increase cache lifetimes by automatically storing all cacheable files into +// Cloudflare's persistent object storage buckets. Requires Cache Reserve +// subscription. Note: using Tiered Cache with Cache Reserve is highly recommended +// to reduce Reserve operations costs. See the +// [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) +// for more information. +func (r *ZoneCachCacheReserveService) ZoneCacheSettingsChangeCacheReserveSetting(ctx context.Context, zoneIdentifier string, body ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParams, opts ...option.RequestOption) (res *ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/cache_reserve", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneCachCacheReserveListResponse struct { + Errors []ZoneCachCacheReserveListResponseError `json:"errors"` + Messages []ZoneCachCacheReserveListResponseMessage `json:"messages"` + Result ZoneCachCacheReserveListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCachCacheReserveListResponseSuccess `json:"success"` + JSON zoneCachCacheReserveListResponseJSON `json:"-"` +} + +// zoneCachCacheReserveListResponseJSON contains the JSON metadata for the struct +// [ZoneCachCacheReserveListResponse] +type zoneCachCacheReserveListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachCacheReserveListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachCacheReserveListResponseErrorJSON `json:"-"` +} + +// zoneCachCacheReserveListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneCachCacheReserveListResponseError] +type zoneCachCacheReserveListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachCacheReserveListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachCacheReserveListResponseMessageJSON `json:"-"` +} + +// zoneCachCacheReserveListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneCachCacheReserveListResponseMessage] +type zoneCachCacheReserveListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachCacheReserveListResponseResult struct { + // ID of the zone setting. + ID ZoneCachCacheReserveListResponseResultID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the Cache Reserve zone setting. + Value ZoneCachCacheReserveListResponseResultValue `json:"value"` + JSON zoneCachCacheReserveListResponseResultJSON `json:"-"` +} + +// zoneCachCacheReserveListResponseResultJSON contains the JSON metadata for the +// struct [ZoneCachCacheReserveListResponseResult] +type zoneCachCacheReserveListResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachCacheReserveListResponseResultID string + +const ( + ZoneCachCacheReserveListResponseResultIDCacheReserve ZoneCachCacheReserveListResponseResultID = "cache_reserve" +) + +// Value of the Cache Reserve zone setting. +type ZoneCachCacheReserveListResponseResultValue string + +const ( + ZoneCachCacheReserveListResponseResultValueOn ZoneCachCacheReserveListResponseResultValue = "on" + ZoneCachCacheReserveListResponseResultValueOff ZoneCachCacheReserveListResponseResultValue = "off" +) + +// Whether the API call was successful +type ZoneCachCacheReserveListResponseSuccess bool + +const ( + ZoneCachCacheReserveListResponseSuccessTrue ZoneCachCacheReserveListResponseSuccess = true +) + +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponse struct { + Errors []ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseError `json:"errors"` + Messages []ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseMessage `json:"messages"` + Result ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseSuccess `json:"success"` + JSON zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseJSON `json:"-"` +} + +// zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseJSON +// contains the JSON metadata for the struct +// [ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponse] +type zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseErrorJSON `json:"-"` +} + +// zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseError] +type zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseMessageJSON `json:"-"` +} + +// zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseMessage] +type zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResult struct { + // ID of the zone setting. + ID ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the Cache Reserve zone setting. + Value ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultValue `json:"value"` + JSON zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultJSON `json:"-"` +} + +// zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResult] +type zoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultID string + +const ( + ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultIDCacheReserve ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultID = "cache_reserve" +) + +// Value of the Cache Reserve zone setting. +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultValue string + +const ( + ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultValueOn ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultValue = "on" + ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultValueOff ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseResultValue = "off" +) + +// Whether the API call was successful +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseSuccess bool + +const ( + ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseSuccessTrue ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingResponseSuccess = true +) + +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParams struct { + // Value of the Cache Reserve zone setting. + Value param.Field[ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParamsValue] `json:"value,required"` +} + +func (r ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the Cache Reserve zone setting. +type ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParamsValue string + +const ( + ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParamsValueOn ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParamsValue = "on" + ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParamsValueOff ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParamsValue = "off" +) diff --git a/zonecachcachereserve_test.go b/zonecachcachereserve_test.go new file mode 100644 index 00000000000..5aed05254e2 --- /dev/null +++ b/zonecachcachereserve_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCachCacheReserveList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.CacheReserves.List(context.TODO(), "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()) + } +} + +func TestZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.CacheReserves.ZoneCacheSettingsChangeCacheReserveSetting( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParams{ + Value: cloudflare.F(cloudflare.ZoneCachCacheReserveZoneCacheSettingsChangeCacheReserveSettingParamsValueOn), + }, + ) + 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/zonecache.go b/zonecache.go new file mode 100644 index 00000000000..31451742337 --- /dev/null +++ b/zonecache.go @@ -0,0 +1,767 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCacheService 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 [NewZoneCacheService] method instead. +type ZoneCacheService struct { + Options []option.RequestOption +} + +// NewZoneCacheService 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 NewZoneCacheService(opts ...option.RequestOption) (r *ZoneCacheService) { + r = &ZoneCacheService{} + r.Options = opts + return +} + +// You can use Cache Reserve Clear to clear your Cache Reserve, but you must first +// disable Cache Reserve. In most cases, this will be accomplished within 24 hours. +// You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind +// that you cannot undo or cancel this operation. +func (r *ZoneCacheService) GetCacheReserveClear(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCacheGetCacheReserveClearResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/cache_reserve_clear", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + 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 *ZoneCacheService) GetOriginPostQuantumEncryption(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCacheGetOriginPostQuantumEncryptionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/origin_post_quantum_encryption", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Instructs Cloudflare to check a regional hub data center on the way to your +// upper tier. This can help improve performance for smart and custom tiered cache +// topologies. +func (r *ZoneCacheService) GetRegionalTieredCache(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCacheGetRegionalTieredCacheResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/regional_tiered_cache", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Instructs Cloudflare to check a regional hub data center on the way to your +// upper tier. This can help improve performance for smart and custom tiered cache +// topologies. +func (r *ZoneCacheService) PatchRegionalTieredCache(ctx context.Context, zoneIdentifier string, body ZoneCachePatchRegionalTieredCacheParams, opts ...option.RequestOption) (res *ZoneCachePatchRegionalTieredCacheResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/regional_tiered_cache", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// You can use Cache Reserve Clear to clear your Cache Reserve, but you must first +// disable Cache Reserve. In most cases, this will be accomplished within 24 hours. +// You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind +// that you cannot undo or cancel this operation. +func (r *ZoneCacheService) PostCacheReserveClear(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCachePostCacheReserveClearResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/cache_reserve_clear", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + 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 *ZoneCacheService) PutOriginPostQuantumEncryption(ctx context.Context, zoneIdentifier string, body ZoneCachePutOriginPostQuantumEncryptionParams, opts ...option.RequestOption) (res *ZoneCachePutOriginPostQuantumEncryptionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/origin_post_quantum_encryption", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneCacheGetCacheReserveClearResponse struct { + Errors []ZoneCacheGetCacheReserveClearResponseError `json:"errors"` + Messages []ZoneCacheGetCacheReserveClearResponseMessage `json:"messages"` + Result ZoneCacheGetCacheReserveClearResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCacheGetCacheReserveClearResponseSuccess `json:"success"` + JSON zoneCacheGetCacheReserveClearResponseJSON `json:"-"` +} + +// zoneCacheGetCacheReserveClearResponseJSON contains the JSON metadata for the +// struct [ZoneCacheGetCacheReserveClearResponse] +type zoneCacheGetCacheReserveClearResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetCacheReserveClearResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetCacheReserveClearResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCacheGetCacheReserveClearResponseErrorJSON `json:"-"` +} + +// zoneCacheGetCacheReserveClearResponseErrorJSON contains the JSON metadata for +// the struct [ZoneCacheGetCacheReserveClearResponseError] +type zoneCacheGetCacheReserveClearResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetCacheReserveClearResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetCacheReserveClearResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCacheGetCacheReserveClearResponseMessageJSON `json:"-"` +} + +// zoneCacheGetCacheReserveClearResponseMessageJSON contains the JSON metadata for +// the struct [ZoneCacheGetCacheReserveClearResponseMessage] +type zoneCacheGetCacheReserveClearResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetCacheReserveClearResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetCacheReserveClearResponseResult struct { + // ID of the zone setting. + ID ZoneCacheGetCacheReserveClearResponseResultID `json:"id"` + // The time that the latest Cache Reserve Clear operation completed. + EndTs time.Time `json:"end_ts" format:"date-time"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // The time that the latest Cache Reserve Clear operation started. + StartTs time.Time `json:"start_ts" format:"date-time"` + // The current state of the Cache Reserve Clear operation. + State ZoneCacheGetCacheReserveClearResponseResultState `json:"state"` + JSON zoneCacheGetCacheReserveClearResponseResultJSON `json:"-"` +} + +// zoneCacheGetCacheReserveClearResponseResultJSON contains the JSON metadata for +// the struct [ZoneCacheGetCacheReserveClearResponseResult] +type zoneCacheGetCacheReserveClearResponseResultJSON struct { + ID apijson.Field + EndTs apijson.Field + ModifiedOn apijson.Field + StartTs apijson.Field + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetCacheReserveClearResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCacheGetCacheReserveClearResponseResultID string + +const ( + ZoneCacheGetCacheReserveClearResponseResultIDCacheReserveClear ZoneCacheGetCacheReserveClearResponseResultID = "cache_reserve_clear" +) + +// The current state of the Cache Reserve Clear operation. +type ZoneCacheGetCacheReserveClearResponseResultState string + +const ( + ZoneCacheGetCacheReserveClearResponseResultStateInProgress ZoneCacheGetCacheReserveClearResponseResultState = "In-progress" + ZoneCacheGetCacheReserveClearResponseResultStateCompleted ZoneCacheGetCacheReserveClearResponseResultState = "Completed" +) + +// Whether the API call was successful +type ZoneCacheGetCacheReserveClearResponseSuccess bool + +const ( + ZoneCacheGetCacheReserveClearResponseSuccessTrue ZoneCacheGetCacheReserveClearResponseSuccess = true +) + +type ZoneCacheGetOriginPostQuantumEncryptionResponse struct { + Errors []ZoneCacheGetOriginPostQuantumEncryptionResponseError `json:"errors"` + Messages []ZoneCacheGetOriginPostQuantumEncryptionResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCacheGetOriginPostQuantumEncryptionResponseSuccess `json:"success"` + JSON zoneCacheGetOriginPostQuantumEncryptionResponseJSON `json:"-"` +} + +// zoneCacheGetOriginPostQuantumEncryptionResponseJSON contains the JSON metadata +// for the struct [ZoneCacheGetOriginPostQuantumEncryptionResponse] +type zoneCacheGetOriginPostQuantumEncryptionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetOriginPostQuantumEncryptionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetOriginPostQuantumEncryptionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCacheGetOriginPostQuantumEncryptionResponseErrorJSON `json:"-"` +} + +// zoneCacheGetOriginPostQuantumEncryptionResponseErrorJSON contains the JSON +// metadata for the struct [ZoneCacheGetOriginPostQuantumEncryptionResponseError] +type zoneCacheGetOriginPostQuantumEncryptionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetOriginPostQuantumEncryptionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetOriginPostQuantumEncryptionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCacheGetOriginPostQuantumEncryptionResponseMessageJSON `json:"-"` +} + +// zoneCacheGetOriginPostQuantumEncryptionResponseMessageJSON contains the JSON +// metadata for the struct [ZoneCacheGetOriginPostQuantumEncryptionResponseMessage] +type zoneCacheGetOriginPostQuantumEncryptionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetOriginPostQuantumEncryptionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCacheGetOriginPostQuantumEncryptionResponseSuccess bool + +const ( + ZoneCacheGetOriginPostQuantumEncryptionResponseSuccessTrue ZoneCacheGetOriginPostQuantumEncryptionResponseSuccess = true +) + +type ZoneCacheGetRegionalTieredCacheResponse struct { + Errors []ZoneCacheGetRegionalTieredCacheResponseError `json:"errors"` + Messages []ZoneCacheGetRegionalTieredCacheResponseMessage `json:"messages"` + Result ZoneCacheGetRegionalTieredCacheResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCacheGetRegionalTieredCacheResponseSuccess `json:"success"` + JSON zoneCacheGetRegionalTieredCacheResponseJSON `json:"-"` +} + +// zoneCacheGetRegionalTieredCacheResponseJSON contains the JSON metadata for the +// struct [ZoneCacheGetRegionalTieredCacheResponse] +type zoneCacheGetRegionalTieredCacheResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetRegionalTieredCacheResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetRegionalTieredCacheResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCacheGetRegionalTieredCacheResponseErrorJSON `json:"-"` +} + +// zoneCacheGetRegionalTieredCacheResponseErrorJSON contains the JSON metadata for +// the struct [ZoneCacheGetRegionalTieredCacheResponseError] +type zoneCacheGetRegionalTieredCacheResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetRegionalTieredCacheResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetRegionalTieredCacheResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCacheGetRegionalTieredCacheResponseMessageJSON `json:"-"` +} + +// zoneCacheGetRegionalTieredCacheResponseMessageJSON contains the JSON metadata +// for the struct [ZoneCacheGetRegionalTieredCacheResponseMessage] +type zoneCacheGetRegionalTieredCacheResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetRegionalTieredCacheResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCacheGetRegionalTieredCacheResponseResult struct { + // ID of the zone setting. + ID ZoneCacheGetRegionalTieredCacheResponseResultID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Instructs Cloudflare to check a regional hub data center on the way to your + // upper tier. This can help improve performance for smart and custom tiered cache + // topologies. + Value ZoneCacheGetRegionalTieredCacheResponseResultValue `json:"value"` + JSON zoneCacheGetRegionalTieredCacheResponseResultJSON `json:"-"` +} + +// zoneCacheGetRegionalTieredCacheResponseResultJSON contains the JSON metadata for +// the struct [ZoneCacheGetRegionalTieredCacheResponseResult] +type zoneCacheGetRegionalTieredCacheResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetRegionalTieredCacheResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCacheGetRegionalTieredCacheResponseResultID string + +const ( + ZoneCacheGetRegionalTieredCacheResponseResultIDTcRegional ZoneCacheGetRegionalTieredCacheResponseResultID = "tc_regional" +) + +// Instructs Cloudflare to check a regional hub data center on the way to your +// upper tier. This can help improve performance for smart and custom tiered cache +// topologies. +type ZoneCacheGetRegionalTieredCacheResponseResultValue struct { + // ID of the zone setting. + ID ZoneCacheGetRegionalTieredCacheResponseResultValueID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneCacheGetRegionalTieredCacheResponseResultValueJSON `json:"-"` +} + +// zoneCacheGetRegionalTieredCacheResponseResultValueJSON contains the JSON +// metadata for the struct [ZoneCacheGetRegionalTieredCacheResponseResultValue] +type zoneCacheGetRegionalTieredCacheResponseResultValueJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCacheGetRegionalTieredCacheResponseResultValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCacheGetRegionalTieredCacheResponseResultValueID string + +const ( + ZoneCacheGetRegionalTieredCacheResponseResultValueIDTcRegional ZoneCacheGetRegionalTieredCacheResponseResultValueID = "tc_regional" +) + +// Whether the API call was successful +type ZoneCacheGetRegionalTieredCacheResponseSuccess bool + +const ( + ZoneCacheGetRegionalTieredCacheResponseSuccessTrue ZoneCacheGetRegionalTieredCacheResponseSuccess = true +) + +type ZoneCachePatchRegionalTieredCacheResponse struct { + Errors []ZoneCachePatchRegionalTieredCacheResponseError `json:"errors"` + Messages []ZoneCachePatchRegionalTieredCacheResponseMessage `json:"messages"` + Result ZoneCachePatchRegionalTieredCacheResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCachePatchRegionalTieredCacheResponseSuccess `json:"success"` + JSON zoneCachePatchRegionalTieredCacheResponseJSON `json:"-"` +} + +// zoneCachePatchRegionalTieredCacheResponseJSON contains the JSON metadata for the +// struct [ZoneCachePatchRegionalTieredCacheResponse] +type zoneCachePatchRegionalTieredCacheResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePatchRegionalTieredCacheResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePatchRegionalTieredCacheResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachePatchRegionalTieredCacheResponseErrorJSON `json:"-"` +} + +// zoneCachePatchRegionalTieredCacheResponseErrorJSON contains the JSON metadata +// for the struct [ZoneCachePatchRegionalTieredCacheResponseError] +type zoneCachePatchRegionalTieredCacheResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePatchRegionalTieredCacheResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePatchRegionalTieredCacheResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachePatchRegionalTieredCacheResponseMessageJSON `json:"-"` +} + +// zoneCachePatchRegionalTieredCacheResponseMessageJSON contains the JSON metadata +// for the struct [ZoneCachePatchRegionalTieredCacheResponseMessage] +type zoneCachePatchRegionalTieredCacheResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePatchRegionalTieredCacheResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePatchRegionalTieredCacheResponseResult struct { + // ID of the zone setting. + ID ZoneCachePatchRegionalTieredCacheResponseResultID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Instructs Cloudflare to check a regional hub data center on the way to your + // upper tier. This can help improve performance for smart and custom tiered cache + // topologies. + Value ZoneCachePatchRegionalTieredCacheResponseResultValue `json:"value"` + JSON zoneCachePatchRegionalTieredCacheResponseResultJSON `json:"-"` +} + +// zoneCachePatchRegionalTieredCacheResponseResultJSON contains the JSON metadata +// for the struct [ZoneCachePatchRegionalTieredCacheResponseResult] +type zoneCachePatchRegionalTieredCacheResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePatchRegionalTieredCacheResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachePatchRegionalTieredCacheResponseResultID string + +const ( + ZoneCachePatchRegionalTieredCacheResponseResultIDTcRegional ZoneCachePatchRegionalTieredCacheResponseResultID = "tc_regional" +) + +// Instructs Cloudflare to check a regional hub data center on the way to your +// upper tier. This can help improve performance for smart and custom tiered cache +// topologies. +type ZoneCachePatchRegionalTieredCacheResponseResultValue struct { + // ID of the zone setting. + ID ZoneCachePatchRegionalTieredCacheResponseResultValueID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneCachePatchRegionalTieredCacheResponseResultValueJSON `json:"-"` +} + +// zoneCachePatchRegionalTieredCacheResponseResultValueJSON contains the JSON +// metadata for the struct [ZoneCachePatchRegionalTieredCacheResponseResultValue] +type zoneCachePatchRegionalTieredCacheResponseResultValueJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePatchRegionalTieredCacheResponseResultValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachePatchRegionalTieredCacheResponseResultValueID string + +const ( + ZoneCachePatchRegionalTieredCacheResponseResultValueIDTcRegional ZoneCachePatchRegionalTieredCacheResponseResultValueID = "tc_regional" +) + +// Whether the API call was successful +type ZoneCachePatchRegionalTieredCacheResponseSuccess bool + +const ( + ZoneCachePatchRegionalTieredCacheResponseSuccessTrue ZoneCachePatchRegionalTieredCacheResponseSuccess = true +) + +type ZoneCachePostCacheReserveClearResponse struct { + Errors []ZoneCachePostCacheReserveClearResponseError `json:"errors"` + Messages []ZoneCachePostCacheReserveClearResponseMessage `json:"messages"` + Result ZoneCachePostCacheReserveClearResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCachePostCacheReserveClearResponseSuccess `json:"success"` + JSON zoneCachePostCacheReserveClearResponseJSON `json:"-"` +} + +// zoneCachePostCacheReserveClearResponseJSON contains the JSON metadata for the +// struct [ZoneCachePostCacheReserveClearResponse] +type zoneCachePostCacheReserveClearResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePostCacheReserveClearResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePostCacheReserveClearResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachePostCacheReserveClearResponseErrorJSON `json:"-"` +} + +// zoneCachePostCacheReserveClearResponseErrorJSON contains the JSON metadata for +// the struct [ZoneCachePostCacheReserveClearResponseError] +type zoneCachePostCacheReserveClearResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePostCacheReserveClearResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePostCacheReserveClearResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachePostCacheReserveClearResponseMessageJSON `json:"-"` +} + +// zoneCachePostCacheReserveClearResponseMessageJSON contains the JSON metadata for +// the struct [ZoneCachePostCacheReserveClearResponseMessage] +type zoneCachePostCacheReserveClearResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePostCacheReserveClearResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePostCacheReserveClearResponseResult struct { + // ID of the zone setting. + ID ZoneCachePostCacheReserveClearResponseResultID `json:"id"` + // The time that the latest Cache Reserve Clear operation completed. + EndTs time.Time `json:"end_ts" format:"date-time"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // The time that the latest Cache Reserve Clear operation started. + StartTs time.Time `json:"start_ts" format:"date-time"` + // The current state of the Cache Reserve Clear operation. + State ZoneCachePostCacheReserveClearResponseResultState `json:"state"` + JSON zoneCachePostCacheReserveClearResponseResultJSON `json:"-"` +} + +// zoneCachePostCacheReserveClearResponseResultJSON contains the JSON metadata for +// the struct [ZoneCachePostCacheReserveClearResponseResult] +type zoneCachePostCacheReserveClearResponseResultJSON struct { + ID apijson.Field + EndTs apijson.Field + ModifiedOn apijson.Field + StartTs apijson.Field + State apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePostCacheReserveClearResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachePostCacheReserveClearResponseResultID string + +const ( + ZoneCachePostCacheReserveClearResponseResultIDCacheReserveClear ZoneCachePostCacheReserveClearResponseResultID = "cache_reserve_clear" +) + +// The current state of the Cache Reserve Clear operation. +type ZoneCachePostCacheReserveClearResponseResultState string + +const ( + ZoneCachePostCacheReserveClearResponseResultStateInProgress ZoneCachePostCacheReserveClearResponseResultState = "In-progress" + ZoneCachePostCacheReserveClearResponseResultStateCompleted ZoneCachePostCacheReserveClearResponseResultState = "Completed" +) + +// Whether the API call was successful +type ZoneCachePostCacheReserveClearResponseSuccess bool + +const ( + ZoneCachePostCacheReserveClearResponseSuccessTrue ZoneCachePostCacheReserveClearResponseSuccess = true +) + +type ZoneCachePutOriginPostQuantumEncryptionResponse struct { + Errors []ZoneCachePutOriginPostQuantumEncryptionResponseError `json:"errors"` + Messages []ZoneCachePutOriginPostQuantumEncryptionResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCachePutOriginPostQuantumEncryptionResponseSuccess `json:"success"` + JSON zoneCachePutOriginPostQuantumEncryptionResponseJSON `json:"-"` +} + +// zoneCachePutOriginPostQuantumEncryptionResponseJSON contains the JSON metadata +// for the struct [ZoneCachePutOriginPostQuantumEncryptionResponse] +type zoneCachePutOriginPostQuantumEncryptionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePutOriginPostQuantumEncryptionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePutOriginPostQuantumEncryptionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachePutOriginPostQuantumEncryptionResponseErrorJSON `json:"-"` +} + +// zoneCachePutOriginPostQuantumEncryptionResponseErrorJSON contains the JSON +// metadata for the struct [ZoneCachePutOriginPostQuantumEncryptionResponseError] +type zoneCachePutOriginPostQuantumEncryptionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePutOriginPostQuantumEncryptionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachePutOriginPostQuantumEncryptionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachePutOriginPostQuantumEncryptionResponseMessageJSON `json:"-"` +} + +// zoneCachePutOriginPostQuantumEncryptionResponseMessageJSON contains the JSON +// metadata for the struct [ZoneCachePutOriginPostQuantumEncryptionResponseMessage] +type zoneCachePutOriginPostQuantumEncryptionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachePutOriginPostQuantumEncryptionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCachePutOriginPostQuantumEncryptionResponseSuccess bool + +const ( + ZoneCachePutOriginPostQuantumEncryptionResponseSuccessTrue ZoneCachePutOriginPostQuantumEncryptionResponseSuccess = true +) + +type ZoneCachePatchRegionalTieredCacheParams struct { + // Value of the Regional Tiered Cache zone setting. + Value param.Field[ZoneCachePatchRegionalTieredCacheParamsValue] `json:"value,required"` +} + +func (r ZoneCachePatchRegionalTieredCacheParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the Regional Tiered Cache zone setting. +type ZoneCachePatchRegionalTieredCacheParamsValue string + +const ( + ZoneCachePatchRegionalTieredCacheParamsValueOn ZoneCachePatchRegionalTieredCacheParamsValue = "on" + ZoneCachePatchRegionalTieredCacheParamsValueOff ZoneCachePatchRegionalTieredCacheParamsValue = "off" +) + +type ZoneCachePutOriginPostQuantumEncryptionParams struct { + // Value of the Origin Post Quantum Encryption Setting. + Value param.Field[ZoneCachePutOriginPostQuantumEncryptionParamsValue] `json:"value,required"` +} + +func (r ZoneCachePutOriginPostQuantumEncryptionParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the Origin Post Quantum Encryption Setting. +type ZoneCachePutOriginPostQuantumEncryptionParamsValue string + +const ( + ZoneCachePutOriginPostQuantumEncryptionParamsValuePreferred ZoneCachePutOriginPostQuantumEncryptionParamsValue = "preferred" + ZoneCachePutOriginPostQuantumEncryptionParamsValueSupported ZoneCachePutOriginPostQuantumEncryptionParamsValue = "supported" + ZoneCachePutOriginPostQuantumEncryptionParamsValueOff ZoneCachePutOriginPostQuantumEncryptionParamsValue = "off" +) diff --git a/zonecache_test.go b/zonecache_test.go new file mode 100644 index 00000000000..27a4679b162 --- /dev/null +++ b/zonecache_test.go @@ -0,0 +1,182 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCacheGetCacheReserveClear(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Cache.GetCacheReserveClear(context.TODO(), "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()) + } +} + +func TestZoneCacheGetOriginPostQuantumEncryption(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Cache.GetOriginPostQuantumEncryption(context.TODO(), "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()) + } +} + +func TestZoneCacheGetRegionalTieredCache(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Cache.GetRegionalTieredCache(context.TODO(), "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()) + } +} + +func TestZoneCachePatchRegionalTieredCache(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Cache.PatchRegionalTieredCache( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCachePatchRegionalTieredCacheParams{ + Value: cloudflare.F(cloudflare.ZoneCachePatchRegionalTieredCacheParamsValueOn), + }, + ) + 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 TestZoneCachePostCacheReserveClear(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Cache.PostCacheReserveClear(context.TODO(), "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()) + } +} + +func TestZoneCachePutOriginPostQuantumEncryption(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Cache.PutOriginPostQuantumEncryption( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCachePutOriginPostQuantumEncryptionParams{ + Value: cloudflare.F(cloudflare.ZoneCachePutOriginPostQuantumEncryptionParamsValuePreferred), + }, + ) + 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/zonecachtieredcachesmarttopologyenable.go b/zonecachtieredcachesmarttopologyenable.go new file mode 100644 index 00000000000..3c567de9215 --- /dev/null +++ b/zonecachtieredcachesmarttopologyenable.go @@ -0,0 +1,289 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCachTieredCacheSmartTopologyEnableService 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 [NewZoneCachTieredCacheSmartTopologyEnableService] method instead. +type ZoneCachTieredCacheSmartTopologyEnableService struct { + Options []option.RequestOption +} + +// NewZoneCachTieredCacheSmartTopologyEnableService 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 NewZoneCachTieredCacheSmartTopologyEnableService(opts ...option.RequestOption) (r *ZoneCachTieredCacheSmartTopologyEnableService) { + r = &ZoneCachTieredCacheSmartTopologyEnableService{} + r.Options = opts + return +} + +// Remvoves enablement of Smart Tiered Cache +func (r *ZoneCachTieredCacheSmartTopologyEnableService) Delete(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCachTieredCacheSmartTopologyEnableDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Get Smart Tiered Cache setting +func (r *ZoneCachTieredCacheSmartTopologyEnableService) SmartTieredCacheGetSmartTieredCacheSetting(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates enablement of Tiered Cache +func (r *ZoneCachTieredCacheSmartTopologyEnableService) SmartTieredCachePatchSmartTieredCacheSetting(ctx context.Context, zoneIdentifier string, body ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParams, opts ...option.RequestOption) (res *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneCachTieredCacheSmartTopologyEnableDeleteResponse struct { + Errors []ZoneCachTieredCacheSmartTopologyEnableDeleteResponseError `json:"errors"` + Messages []ZoneCachTieredCacheSmartTopologyEnableDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCachTieredCacheSmartTopologyEnableDeleteResponseSuccess `json:"success"` + JSON zoneCachTieredCacheSmartTopologyEnableDeleteResponseJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableDeleteResponseJSON contains the JSON +// metadata for the struct [ZoneCachTieredCacheSmartTopologyEnableDeleteResponse] +type zoneCachTieredCacheSmartTopologyEnableDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachTieredCacheSmartTopologyEnableDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachTieredCacheSmartTopologyEnableDeleteResponseErrorJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableDeleteResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableDeleteResponseError] +type zoneCachTieredCacheSmartTopologyEnableDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachTieredCacheSmartTopologyEnableDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachTieredCacheSmartTopologyEnableDeleteResponseMessageJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableDeleteResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableDeleteResponseMessage] +type zoneCachTieredCacheSmartTopologyEnableDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCachTieredCacheSmartTopologyEnableDeleteResponseSuccess bool + +const ( + ZoneCachTieredCacheSmartTopologyEnableDeleteResponseSuccessTrue ZoneCachTieredCacheSmartTopologyEnableDeleteResponseSuccess = true +) + +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponse struct { + Errors []ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseError `json:"errors"` + Messages []ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseSuccess `json:"success"` + JSON zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseJSON +// contains the JSON metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponse] +type zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseErrorJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseError] +type zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseMessageJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseMessage] +type zoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseSuccess bool + +const ( + ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseSuccessTrue ZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSettingResponseSuccess = true +) + +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponse struct { + Errors []ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseError `json:"errors"` + Messages []ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseSuccess `json:"success"` + JSON zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseJSON +// contains the JSON metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponse] +type zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseErrorJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseError] +type zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseMessageJSON `json:"-"` +} + +// zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseMessage] +type zoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseSuccess bool + +const ( + ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseSuccessTrue ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingResponseSuccess = true +) + +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParams struct { + // Enables Tiered Cache. + Value param.Field[ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParamsValue] `json:"value,required"` +} + +func (r ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enables Tiered Cache. +type ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParamsValue string + +const ( + ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParamsValueOn ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParamsValue = "on" + ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParamsValueOff ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParamsValue = "off" +) diff --git a/zonecachtieredcachesmarttopologyenable_test.go b/zonecachtieredcachesmarttopologyenable_test.go new file mode 100644 index 00000000000..8d57621b117 --- /dev/null +++ b/zonecachtieredcachesmarttopologyenable_test.go @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCachTieredCacheSmartTopologyEnableDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.TieredCacheSmartTopologyEnables.Delete(context.TODO(), "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()) + } +} + +func TestZoneCachTieredCacheSmartTopologyEnableSmartTieredCacheGetSmartTieredCacheSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.TieredCacheSmartTopologyEnables.SmartTieredCacheGetSmartTieredCacheSetting(context.TODO(), "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()) + } +} + +func TestZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.TieredCacheSmartTopologyEnables.SmartTieredCachePatchSmartTieredCacheSetting( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParams{ + Value: cloudflare.F(cloudflare.ZoneCachTieredCacheSmartTopologyEnableSmartTieredCachePatchSmartTieredCacheSettingParamsValueOn), + }, + ) + 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/zonecachvariant.go b/zonecachvariant.go new file mode 100644 index 00000000000..308f8917349 --- /dev/null +++ b/zonecachvariant.go @@ -0,0 +1,551 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCachVariantService 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 [NewZoneCachVariantService] method +// instead. +type ZoneCachVariantService struct { + Options []option.RequestOption +} + +// NewZoneCachVariantService 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 NewZoneCachVariantService(opts ...option.RequestOption) (r *ZoneCachVariantService) { + r = &ZoneCachVariantService{} + r.Options = opts + return +} + +// Variant support enables caching variants of images with certain file extensions +// in addition to the original. This only applies when the origin server sends the +// 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but +// does not serve the variant requested, the response will not be cached. This will +// be indicated with BYPASS cache status in the response headers. +func (r *ZoneCachVariantService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCachVariantListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/variants", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Variant support enables caching variants of images with certain file extensions +// in addition to the original. This only applies when the origin server sends the +// 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but +// does not serve the variant requested, the response will not be cached. This will +// be indicated with BYPASS cache status in the response headers. +func (r *ZoneCachVariantService) Delete(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCachVariantDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/variants", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Variant support enables caching variants of images with certain file extensions +// in addition to the original. This only applies when the origin server sends the +// 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but +// does not serve the variant requested, the response will not be cached. This will +// be indicated with BYPASS cache status in the response headers. +func (r *ZoneCachVariantService) ZoneCacheSettingsChangeVariantsSetting(ctx context.Context, zoneIdentifier string, body ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParams, opts ...option.RequestOption) (res *ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/cache/variants", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneCachVariantListResponse struct { + Errors []ZoneCachVariantListResponseError `json:"errors"` + Messages []ZoneCachVariantListResponseMessage `json:"messages"` + Result ZoneCachVariantListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCachVariantListResponseSuccess `json:"success"` + JSON zoneCachVariantListResponseJSON `json:"-"` +} + +// zoneCachVariantListResponseJSON contains the JSON metadata for the struct +// [ZoneCachVariantListResponse] +type zoneCachVariantListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachVariantListResponseErrorJSON `json:"-"` +} + +// zoneCachVariantListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneCachVariantListResponseError] +type zoneCachVariantListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachVariantListResponseMessageJSON `json:"-"` +} + +// zoneCachVariantListResponseMessageJSON contains the JSON metadata for the struct +// [ZoneCachVariantListResponseMessage] +type zoneCachVariantListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantListResponseResult struct { + // ID of the zone setting. + ID ZoneCachVariantListResponseResultID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneCachVariantListResponseResultValue `json:"value"` + JSON zoneCachVariantListResponseResultJSON `json:"-"` +} + +// zoneCachVariantListResponseResultJSON contains the JSON metadata for the struct +// [ZoneCachVariantListResponseResult] +type zoneCachVariantListResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachVariantListResponseResultID string + +const ( + ZoneCachVariantListResponseResultIDVariants ZoneCachVariantListResponseResultID = "variants" +) + +// Value of the zone setting. +type ZoneCachVariantListResponseResultValue struct { + // List of strings with the MIME types of all the variants that should be served + // for avif. + Avif []interface{} `json:"avif"` + // List of strings with the MIME types of all the variants that should be served + // for bmp. + Bmp []interface{} `json:"bmp"` + // List of strings with the MIME types of all the variants that should be served + // for gif. + Gif []interface{} `json:"gif"` + // List of strings with the MIME types of all the variants that should be served + // for jp2. + Jp2 []interface{} `json:"jp2"` + // List of strings with the MIME types of all the variants that should be served + // for jpeg. + Jpeg []interface{} `json:"jpeg"` + // List of strings with the MIME types of all the variants that should be served + // for jpg. + Jpg []interface{} `json:"jpg"` + // List of strings with the MIME types of all the variants that should be served + // for jpg2. + Jpg2 []interface{} `json:"jpg2"` + // List of strings with the MIME types of all the variants that should be served + // for png. + Png []interface{} `json:"png"` + // List of strings with the MIME types of all the variants that should be served + // for tif. + Tif []interface{} `json:"tif"` + // List of strings with the MIME types of all the variants that should be served + // for tiff. + Tiff []interface{} `json:"tiff"` + // List of strings with the MIME types of all the variants that should be served + // for webp. + Webp []interface{} `json:"webp"` + JSON zoneCachVariantListResponseResultValueJSON `json:"-"` +} + +// zoneCachVariantListResponseResultValueJSON contains the JSON metadata for the +// struct [ZoneCachVariantListResponseResultValue] +type zoneCachVariantListResponseResultValueJSON struct { + Avif apijson.Field + Bmp apijson.Field + Gif apijson.Field + Jp2 apijson.Field + Jpeg apijson.Field + Jpg apijson.Field + Jpg2 apijson.Field + Png apijson.Field + Tif apijson.Field + Tiff apijson.Field + Webp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantListResponseResultValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCachVariantListResponseSuccess bool + +const ( + ZoneCachVariantListResponseSuccessTrue ZoneCachVariantListResponseSuccess = true +) + +type ZoneCachVariantDeleteResponse struct { + Errors []ZoneCachVariantDeleteResponseError `json:"errors"` + Messages []ZoneCachVariantDeleteResponseMessage `json:"messages"` + // Variant support enables caching variants of images with certain file extensions + // in addition to the original. This only applies when the origin server sends the + // 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but + // does not serve the variant requested, the response will not be cached. This will + // be indicated with BYPASS cache status in the response headers. + Result ZoneCachVariantDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCachVariantDeleteResponseSuccess `json:"success"` + JSON zoneCachVariantDeleteResponseJSON `json:"-"` +} + +// zoneCachVariantDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneCachVariantDeleteResponse] +type zoneCachVariantDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachVariantDeleteResponseErrorJSON `json:"-"` +} + +// zoneCachVariantDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneCachVariantDeleteResponseError] +type zoneCachVariantDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachVariantDeleteResponseMessageJSON `json:"-"` +} + +// zoneCachVariantDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneCachVariantDeleteResponseMessage] +type zoneCachVariantDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Variant support enables caching variants of images with certain file extensions +// in addition to the original. This only applies when the origin server sends the +// 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but +// does not serve the variant requested, the response will not be cached. This will +// be indicated with BYPASS cache status in the response headers. +type ZoneCachVariantDeleteResponseResult struct { + // ID of the zone setting. + ID ZoneCachVariantDeleteResponseResultID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneCachVariantDeleteResponseResultJSON `json:"-"` +} + +// zoneCachVariantDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneCachVariantDeleteResponseResult] +type zoneCachVariantDeleteResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachVariantDeleteResponseResultID string + +const ( + ZoneCachVariantDeleteResponseResultIDVariants ZoneCachVariantDeleteResponseResultID = "variants" +) + +// Whether the API call was successful +type ZoneCachVariantDeleteResponseSuccess bool + +const ( + ZoneCachVariantDeleteResponseSuccessTrue ZoneCachVariantDeleteResponseSuccess = true +) + +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponse struct { + Errors []ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseError `json:"errors"` + Messages []ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseMessage `json:"messages"` + Result ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseSuccess `json:"success"` + JSON zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseJSON `json:"-"` +} + +// zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseJSON contains the +// JSON metadata for the struct +// [ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponse] +type zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseErrorJSON `json:"-"` +} + +// zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseError] +type zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseMessageJSON `json:"-"` +} + +// zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseMessage] +type zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResult struct { + // ID of the zone setting. + ID ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultID `json:"id"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultValue `json:"value"` + JSON zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultJSON `json:"-"` +} + +// zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResult] +type zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultID string + +const ( + ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultIDVariants ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultID = "variants" +) + +// Value of the zone setting. +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultValue struct { + // List of strings with the MIME types of all the variants that should be served + // for avif. + Avif []interface{} `json:"avif"` + // List of strings with the MIME types of all the variants that should be served + // for bmp. + Bmp []interface{} `json:"bmp"` + // List of strings with the MIME types of all the variants that should be served + // for gif. + Gif []interface{} `json:"gif"` + // List of strings with the MIME types of all the variants that should be served + // for jp2. + Jp2 []interface{} `json:"jp2"` + // List of strings with the MIME types of all the variants that should be served + // for jpeg. + Jpeg []interface{} `json:"jpeg"` + // List of strings with the MIME types of all the variants that should be served + // for jpg. + Jpg []interface{} `json:"jpg"` + // List of strings with the MIME types of all the variants that should be served + // for jpg2. + Jpg2 []interface{} `json:"jpg2"` + // List of strings with the MIME types of all the variants that should be served + // for png. + Png []interface{} `json:"png"` + // List of strings with the MIME types of all the variants that should be served + // for tif. + Tif []interface{} `json:"tif"` + // List of strings with the MIME types of all the variants that should be served + // for tiff. + Tiff []interface{} `json:"tiff"` + // List of strings with the MIME types of all the variants that should be served + // for webp. + Webp []interface{} `json:"webp"` + JSON zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultValueJSON `json:"-"` +} + +// zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultValueJSON +// contains the JSON metadata for the struct +// [ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultValue] +type zoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultValueJSON struct { + Avif apijson.Field + Bmp apijson.Field + Gif apijson.Field + Jp2 apijson.Field + Jpeg apijson.Field + Jpg apijson.Field + Jpg2 apijson.Field + Png apijson.Field + Tif apijson.Field + Tiff apijson.Field + Webp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseResultValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseSuccess bool + +const ( + ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseSuccessTrue ZoneCachVariantZoneCacheSettingsChangeVariantsSettingResponseSuccess = true +) + +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParams struct { + // Value of the zone setting. + Value param.Field[ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParamsValue] `json:"value,required"` +} + +func (r ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParamsValue struct { + // List of strings with the MIME types of all the variants that should be served + // for avif. + Avif param.Field[[]interface{}] `json:"avif"` + // List of strings with the MIME types of all the variants that should be served + // for bmp. + Bmp param.Field[[]interface{}] `json:"bmp"` + // List of strings with the MIME types of all the variants that should be served + // for gif. + Gif param.Field[[]interface{}] `json:"gif"` + // List of strings with the MIME types of all the variants that should be served + // for jp2. + Jp2 param.Field[[]interface{}] `json:"jp2"` + // List of strings with the MIME types of all the variants that should be served + // for jpeg. + Jpeg param.Field[[]interface{}] `json:"jpeg"` + // List of strings with the MIME types of all the variants that should be served + // for jpg. + Jpg param.Field[[]interface{}] `json:"jpg"` + // List of strings with the MIME types of all the variants that should be served + // for jpg2. + Jpg2 param.Field[[]interface{}] `json:"jpg2"` + // List of strings with the MIME types of all the variants that should be served + // for png. + Png param.Field[[]interface{}] `json:"png"` + // List of strings with the MIME types of all the variants that should be served + // for tif. + Tif param.Field[[]interface{}] `json:"tif"` + // List of strings with the MIME types of all the variants that should be served + // for tiff. + Tiff param.Field[[]interface{}] `json:"tiff"` + // List of strings with the MIME types of all the variants that should be served + // for webp. + Webp param.Field[[]interface{}] `json:"webp"` +} + +func (r ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonecachvariant_test.go b/zonecachvariant_test.go new file mode 100644 index 00000000000..c1665e2e354 --- /dev/null +++ b/zonecachvariant_test.go @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCachVariantList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.Variants.List(context.TODO(), "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()) + } +} + +func TestZoneCachVariantDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.Variants.Delete(context.TODO(), "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()) + } +} + +func TestZoneCachVariantZoneCacheSettingsChangeVariantsSettingWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Caches.Variants.ZoneCacheSettingsChangeVariantsSetting( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParams{ + Value: cloudflare.F(cloudflare.ZoneCachVariantZoneCacheSettingsChangeVariantsSettingParamsValue{ + Avif: cloudflare.F([]interface{}{"image/webp", "image/jpeg"}), + Bmp: cloudflare.F([]interface{}{"image/webp", "image/jpeg"}), + Gif: cloudflare.F([]interface{}{"image/webp", "image/jpeg"}), + Jp2: cloudflare.F([]interface{}{"image/webp", "image/avif"}), + Jpeg: cloudflare.F([]interface{}{"image/webp", "image/avif"}), + Jpg: cloudflare.F([]interface{}{"image/webp", "image/avif"}), + Jpg2: cloudflare.F([]interface{}{"image/webp", "image/avif"}), + Png: cloudflare.F([]interface{}{"image/webp", "image/avif"}), + Tif: cloudflare.F([]interface{}{"image/webp", "image/avif"}), + Tiff: cloudflare.F([]interface{}{"image/webp", "image/avif"}), + Webp: cloudflare.F([]interface{}{"image/jpeg", "image/avif"}), + }), + }, + ) + 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/zonecertificateauthority.go b/zonecertificateauthority.go new file mode 100644 index 00000000000..a6b50ef48b9 --- /dev/null +++ b/zonecertificateauthority.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCertificateAuthorityService 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 +// [NewZoneCertificateAuthorityService] method instead. +type ZoneCertificateAuthorityService struct { + Options []option.RequestOption + HostnameAssociations *ZoneCertificateAuthorityHostnameAssociationService +} + +// NewZoneCertificateAuthorityService 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 NewZoneCertificateAuthorityService(opts ...option.RequestOption) (r *ZoneCertificateAuthorityService) { + r = &ZoneCertificateAuthorityService{} + r.Options = opts + r.HostnameAssociations = NewZoneCertificateAuthorityHostnameAssociationService(opts...) + return +} diff --git a/zonecertificateauthorityhostnameassociation.go b/zonecertificateauthorityhostnameassociation.go new file mode 100644 index 00000000000..a7ee9fd1338 --- /dev/null +++ b/zonecertificateauthorityhostnameassociation.go @@ -0,0 +1,270 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCertificateAuthorityHostnameAssociationService 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 [NewZoneCertificateAuthorityHostnameAssociationService] method instead. +type ZoneCertificateAuthorityHostnameAssociationService struct { + Options []option.RequestOption +} + +// NewZoneCertificateAuthorityHostnameAssociationService 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 NewZoneCertificateAuthorityHostnameAssociationService(opts ...option.RequestOption) (r *ZoneCertificateAuthorityHostnameAssociationService) { + r = &ZoneCertificateAuthorityHostnameAssociationService{} + r.Options = opts + return +} + +// List Hostname Associations +func (r *ZoneCertificateAuthorityHostnameAssociationService) ClientCertificateForAZoneListHostnameAssociations(ctx context.Context, zoneIdentifier string, query ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsParams, opts ...option.RequestOption) (res *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/certificate_authorities/hostname_associations", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Replace Hostname Associations +func (r *ZoneCertificateAuthorityHostnameAssociationService) ClientCertificateForAZonePutHostnameAssociations(ctx context.Context, zoneIdentifier string, body ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsParams, opts ...option.RequestOption) (res *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/certificate_authorities/hostname_associations", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponse struct { + Errors []ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseError `json:"errors"` + Messages []ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseMessage `json:"messages"` + Result ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseSuccess `json:"success"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponse] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseErrorJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseError] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseMessageJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseMessage] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseResult struct { + Hostnames []string `json:"hostnames"` + // The UUID for a certificate that was uploaded to the mTLS Certificate Management + // endpoint. If no mtls_certificate_id is given, the hostnames will be associated + // to your active Cloudflare Managed CA. + MtlsCertificateID string `json:"mtls_certificate_id"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseResultJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseResult] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseResultJSON struct { + Hostnames apijson.Field + MtlsCertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseSuccess bool + +const ( + ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseSuccessTrue ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsResponseSuccess = true +) + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponse struct { + Errors []ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseError `json:"errors"` + Messages []ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseMessage `json:"messages"` + Result ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseSuccess `json:"success"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponse] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseErrorJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseError] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseMessageJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseMessage] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseResult struct { + Hostnames []string `json:"hostnames"` + // The UUID for a certificate that was uploaded to the mTLS Certificate Management + // endpoint. If no mtls_certificate_id is given, the hostnames will be associated + // to your active Cloudflare Managed CA. + MtlsCertificateID string `json:"mtls_certificate_id"` + JSON zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseResultJSON `json:"-"` +} + +// zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseResult] +type zoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseResultJSON struct { + Hostnames apijson.Field + MtlsCertificateID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseSuccess bool + +const ( + ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseSuccessTrue ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsResponseSuccess = true +) + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsParams struct { + // The UUID to match against for a certificate that was uploaded to the mTLS + // Certificate Management endpoint. If no mtls_certificate_id is given, the results + // will be the hostnames associated to your active Cloudflare Managed CA. + MtlsCertificateID param.Field[string] `query:"mtls_certificate_id"` +} + +// URLQuery serializes +// [ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsParams]'s +// query parameters as `url.Values`. +func (r ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsParams struct { + Hostnames param.Field[[]string] `json:"hostnames"` + // The UUID for a certificate that was uploaded to the mTLS Certificate Management + // endpoint. If no mtls_certificate_id is given, the hostnames will be associated + // to your active Cloudflare Managed CA. + MtlsCertificateID param.Field[string] `json:"mtls_certificate_id"` +} + +func (r ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonecertificateauthorityhostnameassociation_test.go b/zonecertificateauthorityhostnameassociation_test.go new file mode 100644 index 00000000000..bbd9af6cd5a --- /dev/null +++ b/zonecertificateauthorityhostnameassociation_test.go @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CertificateAuthorities.HostnameAssociations.ClientCertificateForAZoneListHostnameAssociations( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZoneListHostnameAssociationsParams{ + MtlsCertificateID: cloudflare.F("b2134436-2555-4acf-be5b-26c48136575e"), + }, + ) + 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 TestZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CertificateAuthorities.HostnameAssociations.ClientCertificateForAZonePutHostnameAssociations( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCertificateAuthorityHostnameAssociationClientCertificateForAZonePutHostnameAssociationsParams{ + Hostnames: cloudflare.F([]string{"api.example.com", "api.example.com", "api.example.com"}), + MtlsCertificateID: cloudflare.F("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), + }, + ) + 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/zoneclientcertificate.go b/zoneclientcertificate.go new file mode 100644 index 00000000000..7e0a8174317 --- /dev/null +++ b/zoneclientcertificate.go @@ -0,0 +1,924 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneClientCertificateService 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 [NewZoneClientCertificateService] +// method instead. +type ZoneClientCertificateService struct { + Options []option.RequestOption +} + +// NewZoneClientCertificateService 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 NewZoneClientCertificateService(opts ...option.RequestOption) (r *ZoneClientCertificateService) { + r = &ZoneClientCertificateService{} + r.Options = opts + return +} + +// Get Details for a single mTLS API Shield Client Certificate +func (r *ZoneClientCertificateService) Get(ctx context.Context, zoneIdentifier string, clientCertificateIdentifier string, opts ...option.RequestOption) (res *ZoneClientCertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/client_certificates/%s", zoneIdentifier, clientCertificateIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// If a API Shield mTLS Client Certificate is in a pending_revocation state, you +// may reactivate it with this endpoint. +func (r *ZoneClientCertificateService) Update(ctx context.Context, zoneIdentifier string, clientCertificateIdentifier string, opts ...option.RequestOption) (res *ZoneClientCertificateUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/client_certificates/%s", zoneIdentifier, clientCertificateIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &res, opts...) + return +} + +// Set a API Shield mTLS Client Certificate to pending_revocation status for +// processing to revoked status. +func (r *ZoneClientCertificateService) Delete(ctx context.Context, zoneIdentifier string, clientCertificateIdentifier string, opts ...option.RequestOption) (res *ZoneClientCertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/client_certificates/%s", zoneIdentifier, clientCertificateIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new API Shield mTLS Client Certificate +func (r *ZoneClientCertificateService) ClientCertificateForAZoneNewClientCertificate(ctx context.Context, zoneIdentifier string, body ZoneClientCertificateClientCertificateForAZoneNewClientCertificateParams, opts ...option.RequestOption) (res *ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/client_certificates", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all of your Zone's API Shield mTLS Client Certificates by Status and/or +// using Pagination +func (r *ZoneClientCertificateService) ClientCertificateForAZoneListClientCertificates(ctx context.Context, zoneIdentifier string, query ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParams, opts ...option.RequestOption) (res *shared.Page[ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/client_certificates", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneClientCertificateGetResponse struct { + Errors []ZoneClientCertificateGetResponseError `json:"errors"` + Messages []ZoneClientCertificateGetResponseMessage `json:"messages"` + Result ZoneClientCertificateGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneClientCertificateGetResponseSuccess `json:"success"` + JSON zoneClientCertificateGetResponseJSON `json:"-"` +} + +// zoneClientCertificateGetResponseJSON contains the JSON metadata for the struct +// [ZoneClientCertificateGetResponse] +type zoneClientCertificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateGetResponseErrorJSON `json:"-"` +} + +// zoneClientCertificateGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneClientCertificateGetResponseError] +type zoneClientCertificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateGetResponseMessageJSON `json:"-"` +} + +// zoneClientCertificateGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneClientCertificateGetResponseMessage] +type zoneClientCertificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateGetResponseResult struct { + // Identifier + ID string `json:"id"` + // The Client Certificate PEM + Certificate string `json:"certificate"` + // Certificate Authority used to issue the Client Certificate + CertificateAuthority ZoneClientCertificateGetResponseResultCertificateAuthority `json:"certificate_authority"` + // Common Name of the Client Certificate + CommonName string `json:"common_name"` + // Country, provided by the CSR + Country string `json:"country"` + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr string `json:"csr"` + // Date that the Client Certificate expires + ExpiresOn string `json:"expires_on"` + // Unique identifier of the Client Certificate + FingerprintSha256 string `json:"fingerprint_sha256"` + // Date that the Client Certificate was issued by the Certificate Authority + IssuedOn string `json:"issued_on"` + // Location, provided by the CSR + Location string `json:"location"` + // Organization, provided by the CSR + Organization string `json:"organization"` + // Organizational Unit, provided by the CSR + OrganizationalUnit string `json:"organizational_unit"` + // The serial number on the created Client Certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the Client Certificate.. + Signature string `json:"signature"` + // Subject Key Identifier + Ski string `json:"ski"` + // State, provided by the CSR + State string `json:"state"` + // Client Certificates may be active or revoked, and the pending_reactivation or + // pending_revocation represent in-progress asynchronous transitions + Status ZoneClientCertificateGetResponseResultStatus `json:"status"` + // The number of days the Client Certificate will be valid after the issued_on date + ValidityDays int64 `json:"validity_days"` + JSON zoneClientCertificateGetResponseResultJSON `json:"-"` +} + +// zoneClientCertificateGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneClientCertificateGetResponseResult] +type zoneClientCertificateGetResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + CertificateAuthority apijson.Field + CommonName apijson.Field + Country apijson.Field + Csr apijson.Field + ExpiresOn apijson.Field + FingerprintSha256 apijson.Field + IssuedOn apijson.Field + Location apijson.Field + Organization apijson.Field + OrganizationalUnit apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Ski apijson.Field + State apijson.Field + Status apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate Authority used to issue the Client Certificate +type ZoneClientCertificateGetResponseResultCertificateAuthority struct { + ID string `json:"id"` + Name string `json:"name"` + JSON zoneClientCertificateGetResponseResultCertificateAuthorityJSON `json:"-"` +} + +// zoneClientCertificateGetResponseResultCertificateAuthorityJSON contains the JSON +// metadata for the struct +// [ZoneClientCertificateGetResponseResultCertificateAuthority] +type zoneClientCertificateGetResponseResultCertificateAuthorityJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateGetResponseResultCertificateAuthority) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Client Certificates may be active or revoked, and the pending_reactivation or +// pending_revocation represent in-progress asynchronous transitions +type ZoneClientCertificateGetResponseResultStatus string + +const ( + ZoneClientCertificateGetResponseResultStatusActive ZoneClientCertificateGetResponseResultStatus = "active" + ZoneClientCertificateGetResponseResultStatusPendingReactivation ZoneClientCertificateGetResponseResultStatus = "pending_reactivation" + ZoneClientCertificateGetResponseResultStatusPendingRevocation ZoneClientCertificateGetResponseResultStatus = "pending_revocation" + ZoneClientCertificateGetResponseResultStatusRevoked ZoneClientCertificateGetResponseResultStatus = "revoked" +) + +// Whether the API call was successful +type ZoneClientCertificateGetResponseSuccess bool + +const ( + ZoneClientCertificateGetResponseSuccessTrue ZoneClientCertificateGetResponseSuccess = true +) + +type ZoneClientCertificateUpdateResponse struct { + Errors []ZoneClientCertificateUpdateResponseError `json:"errors"` + Messages []ZoneClientCertificateUpdateResponseMessage `json:"messages"` + Result ZoneClientCertificateUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneClientCertificateUpdateResponseSuccess `json:"success"` + JSON zoneClientCertificateUpdateResponseJSON `json:"-"` +} + +// zoneClientCertificateUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneClientCertificateUpdateResponse] +type zoneClientCertificateUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateUpdateResponseErrorJSON `json:"-"` +} + +// zoneClientCertificateUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneClientCertificateUpdateResponseError] +type zoneClientCertificateUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateUpdateResponseMessageJSON `json:"-"` +} + +// zoneClientCertificateUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneClientCertificateUpdateResponseMessage] +type zoneClientCertificateUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateUpdateResponseResult struct { + // Identifier + ID string `json:"id"` + // The Client Certificate PEM + Certificate string `json:"certificate"` + // Certificate Authority used to issue the Client Certificate + CertificateAuthority ZoneClientCertificateUpdateResponseResultCertificateAuthority `json:"certificate_authority"` + // Common Name of the Client Certificate + CommonName string `json:"common_name"` + // Country, provided by the CSR + Country string `json:"country"` + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr string `json:"csr"` + // Date that the Client Certificate expires + ExpiresOn string `json:"expires_on"` + // Unique identifier of the Client Certificate + FingerprintSha256 string `json:"fingerprint_sha256"` + // Date that the Client Certificate was issued by the Certificate Authority + IssuedOn string `json:"issued_on"` + // Location, provided by the CSR + Location string `json:"location"` + // Organization, provided by the CSR + Organization string `json:"organization"` + // Organizational Unit, provided by the CSR + OrganizationalUnit string `json:"organizational_unit"` + // The serial number on the created Client Certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the Client Certificate.. + Signature string `json:"signature"` + // Subject Key Identifier + Ski string `json:"ski"` + // State, provided by the CSR + State string `json:"state"` + // Client Certificates may be active or revoked, and the pending_reactivation or + // pending_revocation represent in-progress asynchronous transitions + Status ZoneClientCertificateUpdateResponseResultStatus `json:"status"` + // The number of days the Client Certificate will be valid after the issued_on date + ValidityDays int64 `json:"validity_days"` + JSON zoneClientCertificateUpdateResponseResultJSON `json:"-"` +} + +// zoneClientCertificateUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneClientCertificateUpdateResponseResult] +type zoneClientCertificateUpdateResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + CertificateAuthority apijson.Field + CommonName apijson.Field + Country apijson.Field + Csr apijson.Field + ExpiresOn apijson.Field + FingerprintSha256 apijson.Field + IssuedOn apijson.Field + Location apijson.Field + Organization apijson.Field + OrganizationalUnit apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Ski apijson.Field + State apijson.Field + Status apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate Authority used to issue the Client Certificate +type ZoneClientCertificateUpdateResponseResultCertificateAuthority struct { + ID string `json:"id"` + Name string `json:"name"` + JSON zoneClientCertificateUpdateResponseResultCertificateAuthorityJSON `json:"-"` +} + +// zoneClientCertificateUpdateResponseResultCertificateAuthorityJSON contains the +// JSON metadata for the struct +// [ZoneClientCertificateUpdateResponseResultCertificateAuthority] +type zoneClientCertificateUpdateResponseResultCertificateAuthorityJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateUpdateResponseResultCertificateAuthority) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Client Certificates may be active or revoked, and the pending_reactivation or +// pending_revocation represent in-progress asynchronous transitions +type ZoneClientCertificateUpdateResponseResultStatus string + +const ( + ZoneClientCertificateUpdateResponseResultStatusActive ZoneClientCertificateUpdateResponseResultStatus = "active" + ZoneClientCertificateUpdateResponseResultStatusPendingReactivation ZoneClientCertificateUpdateResponseResultStatus = "pending_reactivation" + ZoneClientCertificateUpdateResponseResultStatusPendingRevocation ZoneClientCertificateUpdateResponseResultStatus = "pending_revocation" + ZoneClientCertificateUpdateResponseResultStatusRevoked ZoneClientCertificateUpdateResponseResultStatus = "revoked" +) + +// Whether the API call was successful +type ZoneClientCertificateUpdateResponseSuccess bool + +const ( + ZoneClientCertificateUpdateResponseSuccessTrue ZoneClientCertificateUpdateResponseSuccess = true +) + +type ZoneClientCertificateDeleteResponse struct { + Errors []ZoneClientCertificateDeleteResponseError `json:"errors"` + Messages []ZoneClientCertificateDeleteResponseMessage `json:"messages"` + Result ZoneClientCertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneClientCertificateDeleteResponseSuccess `json:"success"` + JSON zoneClientCertificateDeleteResponseJSON `json:"-"` +} + +// zoneClientCertificateDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneClientCertificateDeleteResponse] +type zoneClientCertificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateDeleteResponseErrorJSON `json:"-"` +} + +// zoneClientCertificateDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneClientCertificateDeleteResponseError] +type zoneClientCertificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateDeleteResponseMessageJSON `json:"-"` +} + +// zoneClientCertificateDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneClientCertificateDeleteResponseMessage] +type zoneClientCertificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + // The Client Certificate PEM + Certificate string `json:"certificate"` + // Certificate Authority used to issue the Client Certificate + CertificateAuthority ZoneClientCertificateDeleteResponseResultCertificateAuthority `json:"certificate_authority"` + // Common Name of the Client Certificate + CommonName string `json:"common_name"` + // Country, provided by the CSR + Country string `json:"country"` + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr string `json:"csr"` + // Date that the Client Certificate expires + ExpiresOn string `json:"expires_on"` + // Unique identifier of the Client Certificate + FingerprintSha256 string `json:"fingerprint_sha256"` + // Date that the Client Certificate was issued by the Certificate Authority + IssuedOn string `json:"issued_on"` + // Location, provided by the CSR + Location string `json:"location"` + // Organization, provided by the CSR + Organization string `json:"organization"` + // Organizational Unit, provided by the CSR + OrganizationalUnit string `json:"organizational_unit"` + // The serial number on the created Client Certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the Client Certificate.. + Signature string `json:"signature"` + // Subject Key Identifier + Ski string `json:"ski"` + // State, provided by the CSR + State string `json:"state"` + // Client Certificates may be active or revoked, and the pending_reactivation or + // pending_revocation represent in-progress asynchronous transitions + Status ZoneClientCertificateDeleteResponseResultStatus `json:"status"` + // The number of days the Client Certificate will be valid after the issued_on date + ValidityDays int64 `json:"validity_days"` + JSON zoneClientCertificateDeleteResponseResultJSON `json:"-"` +} + +// zoneClientCertificateDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneClientCertificateDeleteResponseResult] +type zoneClientCertificateDeleteResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + CertificateAuthority apijson.Field + CommonName apijson.Field + Country apijson.Field + Csr apijson.Field + ExpiresOn apijson.Field + FingerprintSha256 apijson.Field + IssuedOn apijson.Field + Location apijson.Field + Organization apijson.Field + OrganizationalUnit apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Ski apijson.Field + State apijson.Field + Status apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate Authority used to issue the Client Certificate +type ZoneClientCertificateDeleteResponseResultCertificateAuthority struct { + ID string `json:"id"` + Name string `json:"name"` + JSON zoneClientCertificateDeleteResponseResultCertificateAuthorityJSON `json:"-"` +} + +// zoneClientCertificateDeleteResponseResultCertificateAuthorityJSON contains the +// JSON metadata for the struct +// [ZoneClientCertificateDeleteResponseResultCertificateAuthority] +type zoneClientCertificateDeleteResponseResultCertificateAuthorityJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateDeleteResponseResultCertificateAuthority) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Client Certificates may be active or revoked, and the pending_reactivation or +// pending_revocation represent in-progress asynchronous transitions +type ZoneClientCertificateDeleteResponseResultStatus string + +const ( + ZoneClientCertificateDeleteResponseResultStatusActive ZoneClientCertificateDeleteResponseResultStatus = "active" + ZoneClientCertificateDeleteResponseResultStatusPendingReactivation ZoneClientCertificateDeleteResponseResultStatus = "pending_reactivation" + ZoneClientCertificateDeleteResponseResultStatusPendingRevocation ZoneClientCertificateDeleteResponseResultStatus = "pending_revocation" + ZoneClientCertificateDeleteResponseResultStatusRevoked ZoneClientCertificateDeleteResponseResultStatus = "revoked" +) + +// Whether the API call was successful +type ZoneClientCertificateDeleteResponseSuccess bool + +const ( + ZoneClientCertificateDeleteResponseSuccessTrue ZoneClientCertificateDeleteResponseSuccess = true +) + +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponse struct { + Errors []ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseError `json:"errors"` + Messages []ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseMessage `json:"messages"` + Result ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseSuccess `json:"success"` + JSON zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseJSON `json:"-"` +} + +// zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseJSON +// contains the JSON metadata for the struct +// [ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponse] +type zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseErrorJSON `json:"-"` +} + +// zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseError] +type zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseMessageJSON `json:"-"` +} + +// zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseMessage] +type zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResult struct { + // Identifier + ID string `json:"id"` + // The Client Certificate PEM + Certificate string `json:"certificate"` + // Certificate Authority used to issue the Client Certificate + CertificateAuthority ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultCertificateAuthority `json:"certificate_authority"` + // Common Name of the Client Certificate + CommonName string `json:"common_name"` + // Country, provided by the CSR + Country string `json:"country"` + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr string `json:"csr"` + // Date that the Client Certificate expires + ExpiresOn string `json:"expires_on"` + // Unique identifier of the Client Certificate + FingerprintSha256 string `json:"fingerprint_sha256"` + // Date that the Client Certificate was issued by the Certificate Authority + IssuedOn string `json:"issued_on"` + // Location, provided by the CSR + Location string `json:"location"` + // Organization, provided by the CSR + Organization string `json:"organization"` + // Organizational Unit, provided by the CSR + OrganizationalUnit string `json:"organizational_unit"` + // The serial number on the created Client Certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the Client Certificate.. + Signature string `json:"signature"` + // Subject Key Identifier + Ski string `json:"ski"` + // State, provided by the CSR + State string `json:"state"` + // Client Certificates may be active or revoked, and the pending_reactivation or + // pending_revocation represent in-progress asynchronous transitions + Status ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatus `json:"status"` + // The number of days the Client Certificate will be valid after the issued_on date + ValidityDays int64 `json:"validity_days"` + JSON zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultJSON `json:"-"` +} + +// zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResult] +type zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + CertificateAuthority apijson.Field + CommonName apijson.Field + Country apijson.Field + Csr apijson.Field + ExpiresOn apijson.Field + FingerprintSha256 apijson.Field + IssuedOn apijson.Field + Location apijson.Field + Organization apijson.Field + OrganizationalUnit apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Ski apijson.Field + State apijson.Field + Status apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate Authority used to issue the Client Certificate +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultCertificateAuthority struct { + ID string `json:"id"` + Name string `json:"name"` + JSON zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultCertificateAuthorityJSON `json:"-"` +} + +// zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultCertificateAuthorityJSON +// contains the JSON metadata for the struct +// [ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultCertificateAuthority] +type zoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultCertificateAuthorityJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultCertificateAuthority) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Client Certificates may be active or revoked, and the pending_reactivation or +// pending_revocation represent in-progress asynchronous transitions +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatus string + +const ( + ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatusActive ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatus = "active" + ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatusPendingReactivation ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatus = "pending_reactivation" + ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatusPendingRevocation ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatus = "pending_revocation" + ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatusRevoked ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseResultStatus = "revoked" +) + +// Whether the API call was successful +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseSuccess bool + +const ( + ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseSuccessTrue ZoneClientCertificateClientCertificateForAZoneNewClientCertificateResponseSuccess = true +) + +type ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponse struct { + // Identifier + ID string `json:"id"` + // The Client Certificate PEM + Certificate string `json:"certificate"` + // Certificate Authority used to issue the Client Certificate + CertificateAuthority ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseCertificateAuthority `json:"certificate_authority"` + // Common Name of the Client Certificate + CommonName string `json:"common_name"` + // Country, provided by the CSR + Country string `json:"country"` + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr string `json:"csr"` + // Date that the Client Certificate expires + ExpiresOn string `json:"expires_on"` + // Unique identifier of the Client Certificate + FingerprintSha256 string `json:"fingerprint_sha256"` + // Date that the Client Certificate was issued by the Certificate Authority + IssuedOn string `json:"issued_on"` + // Location, provided by the CSR + Location string `json:"location"` + // Organization, provided by the CSR + Organization string `json:"organization"` + // Organizational Unit, provided by the CSR + OrganizationalUnit string `json:"organizational_unit"` + // The serial number on the created Client Certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the Client Certificate.. + Signature string `json:"signature"` + // Subject Key Identifier + Ski string `json:"ski"` + // State, provided by the CSR + State string `json:"state"` + // Client Certificates may be active or revoked, and the pending_reactivation or + // pending_revocation represent in-progress asynchronous transitions + Status ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatus `json:"status"` + // The number of days the Client Certificate will be valid after the issued_on date + ValidityDays int64 `json:"validity_days"` + JSON zoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseJSON `json:"-"` +} + +// zoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseJSON +// contains the JSON metadata for the struct +// [ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponse] +type zoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseJSON struct { + ID apijson.Field + Certificate apijson.Field + CertificateAuthority apijson.Field + CommonName apijson.Field + Country apijson.Field + Csr apijson.Field + ExpiresOn apijson.Field + FingerprintSha256 apijson.Field + IssuedOn apijson.Field + Location apijson.Field + Organization apijson.Field + OrganizationalUnit apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Ski apijson.Field + State apijson.Field + Status apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate Authority used to issue the Client Certificate +type ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseCertificateAuthority struct { + ID string `json:"id"` + Name string `json:"name"` + JSON zoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseCertificateAuthorityJSON `json:"-"` +} + +// zoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseCertificateAuthorityJSON +// contains the JSON metadata for the struct +// [ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseCertificateAuthority] +type zoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseCertificateAuthorityJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseCertificateAuthority) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Client Certificates may be active or revoked, and the pending_reactivation or +// pending_revocation represent in-progress asynchronous transitions +type ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatus string + +const ( + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatusActive ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatus = "active" + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatusPendingReactivation ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatus = "pending_reactivation" + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatusPendingRevocation ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatus = "pending_revocation" + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatusRevoked ZoneClientCertificateClientCertificateForAZoneListClientCertificatesResponseStatus = "revoked" +) + +type ZoneClientCertificateClientCertificateForAZoneNewClientCertificateParams struct { + // The Certificate Signing Request (CSR). Must be newline-encoded. + Csr param.Field[string] `json:"csr,required"` + // The number of days the Client Certificate will be valid after the issued_on date + ValidityDays param.Field[int64] `json:"validity_days,required"` +} + +func (r ZoneClientCertificateClientCertificateForAZoneNewClientCertificateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParams struct { + // Limit to the number of records returned. + Limit param.Field[int64] `query:"limit"` + // Offset the results + Offset param.Field[int64] `query:"offset"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of records per page. + PerPage param.Field[float64] `query:"per_page"` + // Client Certitifcate Status to filter results by. + Status param.Field[ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatus] `query:"status"` +} + +// URLQuery serializes +// [ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParams]'s +// query parameters as `url.Values`. +func (r ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Client Certitifcate Status to filter results by. +type ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatus string + +const ( + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatusAll ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatus = "all" + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatusActive ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatus = "active" + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatusPendingReactivation ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatus = "pending_reactivation" + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatusPendingRevocation ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatus = "pending_revocation" + ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatusRevoked ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatus = "revoked" +) diff --git a/zoneclientcertificate_test.go b/zoneclientcertificate_test.go new file mode 100644 index 00000000000..1bb0f626fe9 --- /dev/null +++ b/zoneclientcertificate_test.go @@ -0,0 +1,173 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneClientCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ClientCertificates.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneClientCertificateUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ClientCertificates.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneClientCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ClientCertificates.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneClientCertificateClientCertificateForAZoneNewClientCertificate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ClientCertificates.ClientCertificateForAZoneNewClientCertificate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneClientCertificateClientCertificateForAZoneNewClientCertificateParams{ + Csr: cloudflare.F("-----BEGIN CERTIFICATE REQUEST-----\\nMIICY....\\n-----END CERTIFICATE REQUEST-----\\n"), + ValidityDays: cloudflare.F(int64(3650)), + }, + ) + 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 TestZoneClientCertificateClientCertificateForAZoneListClientCertificatesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ClientCertificates.ClientCertificateForAZoneListClientCertificates( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParams{ + Limit: cloudflare.F(int64(10)), + Offset: cloudflare.F(int64(10)), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Status: cloudflare.F(cloudflare.ZoneClientCertificateClientCertificateForAZoneListClientCertificatesParamsStatusAll), + }, + ) + 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/zonecustomcertificate.go b/zonecustomcertificate.go new file mode 100644 index 00000000000..fe591e12f9c --- /dev/null +++ b/zonecustomcertificate.go @@ -0,0 +1,777 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCustomCertificateService 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 [NewZoneCustomCertificateService] +// method instead. +type ZoneCustomCertificateService struct { + Options []option.RequestOption + Prioritizes *ZoneCustomCertificatePrioritizeService +} + +// NewZoneCustomCertificateService 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 NewZoneCustomCertificateService(opts ...option.RequestOption) (r *ZoneCustomCertificateService) { + r = &ZoneCustomCertificateService{} + r.Options = opts + r.Prioritizes = NewZoneCustomCertificatePrioritizeService(opts...) + return +} + +// SSL Configuration Details +func (r *ZoneCustomCertificateService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneCustomCertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Upload a new private key and/or PEM/CRT for the SSL certificate. Note: PATCHing +// a configuration for sni_custom certificates will result in a new resource id +// being returned, and the previous one being deleted. +func (r *ZoneCustomCertificateService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneCustomCertificateUpdateParams, opts ...option.RequestOption) (res *ZoneCustomCertificateUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Remove a SSL certificate from a zone. +func (r *ZoneCustomCertificateService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneCustomCertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Upload a new SSL certificate for a zone. +func (r *ZoneCustomCertificateService) CustomSslForAZoneNewSslConfiguration(ctx context.Context, zoneIdentifier string, body ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParams, opts ...option.RequestOption) (res *ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_certificates", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List, search, and filter all of your custom SSL certificates. The higher +// priority will break ties across overlapping 'legacy_custom' certificates, but +// 'legacy_custom' certificates will always supercede 'sni_custom' certificates. +func (r *ZoneCustomCertificateService) CustomSslForAZoneListSslConfigurations(ctx context.Context, zoneIdentifier string, query ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParams, opts ...option.RequestOption) (res *shared.Page[ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/custom_certificates", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneCustomCertificateGetResponse struct { + Errors []ZoneCustomCertificateGetResponseError `json:"errors"` + Messages []ZoneCustomCertificateGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomCertificateGetResponseSuccess `json:"success"` + JSON zoneCustomCertificateGetResponseJSON `json:"-"` +} + +// zoneCustomCertificateGetResponseJSON contains the JSON metadata for the struct +// [ZoneCustomCertificateGetResponse] +type zoneCustomCertificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateGetResponseErrorJSON `json:"-"` +} + +// zoneCustomCertificateGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneCustomCertificateGetResponseError] +type zoneCustomCertificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateGetResponseMessageJSON `json:"-"` +} + +// zoneCustomCertificateGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneCustomCertificateGetResponseMessage] +type zoneCustomCertificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomCertificateGetResponseSuccess bool + +const ( + ZoneCustomCertificateGetResponseSuccessTrue ZoneCustomCertificateGetResponseSuccess = true +) + +type ZoneCustomCertificateUpdateResponse struct { + Errors []ZoneCustomCertificateUpdateResponseError `json:"errors"` + Messages []ZoneCustomCertificateUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomCertificateUpdateResponseSuccess `json:"success"` + JSON zoneCustomCertificateUpdateResponseJSON `json:"-"` +} + +// zoneCustomCertificateUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneCustomCertificateUpdateResponse] +type zoneCustomCertificateUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateUpdateResponseErrorJSON `json:"-"` +} + +// zoneCustomCertificateUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneCustomCertificateUpdateResponseError] +type zoneCustomCertificateUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateUpdateResponseMessageJSON `json:"-"` +} + +// zoneCustomCertificateUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneCustomCertificateUpdateResponseMessage] +type zoneCustomCertificateUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomCertificateUpdateResponseSuccess bool + +const ( + ZoneCustomCertificateUpdateResponseSuccessTrue ZoneCustomCertificateUpdateResponseSuccess = true +) + +type ZoneCustomCertificateDeleteResponse struct { + Errors []ZoneCustomCertificateDeleteResponseError `json:"errors"` + Messages []ZoneCustomCertificateDeleteResponseMessage `json:"messages"` + Result ZoneCustomCertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCustomCertificateDeleteResponseSuccess `json:"success"` + JSON zoneCustomCertificateDeleteResponseJSON `json:"-"` +} + +// zoneCustomCertificateDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneCustomCertificateDeleteResponse] +type zoneCustomCertificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateDeleteResponseErrorJSON `json:"-"` +} + +// zoneCustomCertificateDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneCustomCertificateDeleteResponseError] +type zoneCustomCertificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateDeleteResponseMessageJSON `json:"-"` +} + +// zoneCustomCertificateDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneCustomCertificateDeleteResponseMessage] +type zoneCustomCertificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON zoneCustomCertificateDeleteResponseResultJSON `json:"-"` +} + +// zoneCustomCertificateDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneCustomCertificateDeleteResponseResult] +type zoneCustomCertificateDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomCertificateDeleteResponseSuccess bool + +const ( + ZoneCustomCertificateDeleteResponseSuccessTrue ZoneCustomCertificateDeleteResponseSuccess = true +) + +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponse struct { + Errors []ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseError `json:"errors"` + Messages []ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseSuccess `json:"success"` + JSON zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseJSON `json:"-"` +} + +// zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseJSON contains +// the JSON metadata for the struct +// [ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponse] +type zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseErrorJSON `json:"-"` +} + +// zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseError] +type zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseMessageJSON `json:"-"` +} + +// zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseMessage] +type zoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseSuccess bool + +const ( + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseSuccessTrue ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationResponseSuccess = true +) + +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponse struct { + // Identifier + ID string `json:"id,required"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethod `json:"bundle_method,required"` + // When the certificate from the authority expires. + ExpiresOn time.Time `json:"expires_on,required" format:"date-time"` + Hosts []string `json:"hosts,required"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer,required"` + // When the certificate was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The order/priority in which the certificate will be used in a request. The + // higher priority will break ties across overlapping 'legacy_custom' certificates, + // but 'legacy_custom' certificates will always supercede 'sni_custom' + // certificates. + Priority float64 `json:"priority,required"` + // The type of hash used for the certificate. + Signature string `json:"signature,required"` + // Status of the zone's custom SSL. + Status ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatus `json:"status,required"` + // When the certificate was uploaded to Cloudflare. + UploadedOn time.Time `json:"uploaded_on,required" format:"date-time"` + // Identifier + ZoneID string `json:"zone_id,required"` + // Specify the region where your private key can be held locally for optimal TLS + // performance. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Options allow distribution to + // only to U.S. data centers, only to E.U. data centers, or only to highest + // security data centers. Default distribution is to all Cloudflare datacenters, + // for optimal performance. + GeoRestrictions ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictions `json:"geo_restrictions"` + KeylessServer ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServer `json:"keyless_server"` + // Specify the policy that determines the region where your private key will be + // held locally. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Any combination of countries, + // specified by their two letter country code + // (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + // can be chosen, such as 'country: IN', as well as 'region: EU' which refers to + // the EU region. If there are too few data centers satisfying the policy, it will + // be rejected. + Policy string `json:"policy"` + JSON zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseJSON `json:"-"` +} + +// zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseJSON contains +// the JSON metadata for the struct +// [ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponse] +type zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseJSON struct { + ID apijson.Field + BundleMethod apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + ModifiedOn apijson.Field + Priority apijson.Field + Signature apijson.Field + Status apijson.Field + UploadedOn apijson.Field + ZoneID apijson.Field + GeoRestrictions apijson.Field + KeylessServer apijson.Field + Policy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethod string + +const ( + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethodUbiquitous ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethod = "ubiquitous" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethodOptimal ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethod = "optimal" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethodForce ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseBundleMethod = "force" +) + +// Status of the zone's custom SSL. +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatus string + +const ( + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatusActive ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatus = "active" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatusExpired ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatus = "expired" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatusDeleted ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatus = "deleted" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatusPending ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatus = "pending" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatusInitializing ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseStatus = "initializing" +) + +// Specify the region where your private key can be held locally for optimal TLS +// performance. HTTPS connections to any excluded data center will still be fully +// encrypted, but will incur some latency while Keyless SSL is used to complete the +// handshake with the nearest allowed data center. Options allow distribution to +// only to U.S. data centers, only to E.U. data centers, or only to highest +// security data centers. Default distribution is to all Cloudflare datacenters, +// for optimal performance. +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictions struct { + Label ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabel `json:"label"` + JSON zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsJSON `json:"-"` +} + +// zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictions] +type zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsJSON struct { + Label apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabel string + +const ( + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabelUs ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabel = "us" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabelEu ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabel = "eu" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabelHighestSecurity ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseGeoRestrictionsLabel = "highest_security" +) + +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServer struct { + // Keyless certificate identifier tag. + ID string `json:"id,required"` + // When the Keyless SSL was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Whether or not the Keyless SSL is on or off. + Enabled bool `json:"enabled,required"` + // The keyless SSL name. + Host string `json:"host,required" format:"hostname"` + // When the Keyless SSL was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The keyless SSL name. + Name string `json:"name,required"` + // Available permissions for the Keyless SSL for the current user requesting the + // item. + Permissions []interface{} `json:"permissions,required"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port float64 `json:"port,required"` + // Status of the Keyless SSL. + Status ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerStatus `json:"status,required"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerTunnel `json:"tunnel"` + JSON zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerJSON `json:"-"` +} + +// zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServer] +type zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + Host apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Permissions apijson.Field + Port apijson.Field + Status apijson.Field + Tunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Keyless SSL. +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerStatus string + +const ( + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerStatusActive ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerStatus = "active" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerStatusDeleted ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerStatus = "deleted" +) + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerTunnel struct { + // Private IP of the Key Server Host + PrivateIP string `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID string `json:"vnet_id,required"` + JSON zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerTunnelJSON `json:"-"` +} + +// zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerTunnelJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerTunnel] +type zoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerTunnelJSON struct { + PrivateIP apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsResponseKeylessServerTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificateUpdateParams struct { + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod param.Field[ZoneCustomCertificateUpdateParamsBundleMethod] `json:"bundle_method"` + // The zone's SSL certificate or certificate and the intermediate(s). + Certificate param.Field[string] `json:"certificate"` + // Specify the region where your private key can be held locally for optimal TLS + // performance. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Options allow distribution to + // only to U.S. data centers, only to E.U. data centers, or only to highest + // security data centers. Default distribution is to all Cloudflare datacenters, + // for optimal performance. + GeoRestrictions param.Field[ZoneCustomCertificateUpdateParamsGeoRestrictions] `json:"geo_restrictions"` + // Specify the policy that determines the region where your private key will be + // held locally. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Any combination of countries, + // specified by their two letter country code + // (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + // can be chosen, such as 'country: IN', as well as 'region: EU' which refers to + // the EU region. If there are too few data centers satisfying the policy, it will + // be rejected. + Policy param.Field[string] `json:"policy"` + // The zone's private key. + PrivateKey param.Field[string] `json:"private_key"` +} + +func (r ZoneCustomCertificateUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomCertificateUpdateParamsBundleMethod string + +const ( + ZoneCustomCertificateUpdateParamsBundleMethodUbiquitous ZoneCustomCertificateUpdateParamsBundleMethod = "ubiquitous" + ZoneCustomCertificateUpdateParamsBundleMethodOptimal ZoneCustomCertificateUpdateParamsBundleMethod = "optimal" + ZoneCustomCertificateUpdateParamsBundleMethodForce ZoneCustomCertificateUpdateParamsBundleMethod = "force" +) + +// Specify the region where your private key can be held locally for optimal TLS +// performance. HTTPS connections to any excluded data center will still be fully +// encrypted, but will incur some latency while Keyless SSL is used to complete the +// handshake with the nearest allowed data center. Options allow distribution to +// only to U.S. data centers, only to E.U. data centers, or only to highest +// security data centers. Default distribution is to all Cloudflare datacenters, +// for optimal performance. +type ZoneCustomCertificateUpdateParamsGeoRestrictions struct { + Label param.Field[ZoneCustomCertificateUpdateParamsGeoRestrictionsLabel] `json:"label"` +} + +func (r ZoneCustomCertificateUpdateParamsGeoRestrictions) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneCustomCertificateUpdateParamsGeoRestrictionsLabel string + +const ( + ZoneCustomCertificateUpdateParamsGeoRestrictionsLabelUs ZoneCustomCertificateUpdateParamsGeoRestrictionsLabel = "us" + ZoneCustomCertificateUpdateParamsGeoRestrictionsLabelEu ZoneCustomCertificateUpdateParamsGeoRestrictionsLabel = "eu" + ZoneCustomCertificateUpdateParamsGeoRestrictionsLabelHighestSecurity ZoneCustomCertificateUpdateParamsGeoRestrictionsLabel = "highest_security" +) + +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParams struct { + // The zone's SSL certificate or certificate and the intermediate(s). + Certificate param.Field[string] `json:"certificate,required"` + // The zone's private key. + PrivateKey param.Field[string] `json:"private_key,required"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod param.Field[ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethod] `json:"bundle_method"` + // Specify the region where your private key can be held locally for optimal TLS + // performance. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Options allow distribution to + // only to U.S. data centers, only to E.U. data centers, or only to highest + // security data centers. Default distribution is to all Cloudflare datacenters, + // for optimal performance. + GeoRestrictions param.Field[ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictions] `json:"geo_restrictions"` + // Specify the policy that determines the region where your private key will be + // held locally. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Any combination of countries, + // specified by their two letter country code + // (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + // can be chosen, such as 'country: IN', as well as 'region: EU' which refers to + // the EU region. If there are too few data centers satisfying the policy, it will + // be rejected. + Policy param.Field[string] `json:"policy"` + // The type 'legacy_custom' enables support for legacy clients which do not include + // SNI in the TLS handshake. + Type param.Field[ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsType] `json:"type"` +} + +func (r ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethod string + +const ( + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethodUbiquitous ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethod = "ubiquitous" + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethodOptimal ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethod = "optimal" + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethodForce ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethod = "force" +) + +// Specify the region where your private key can be held locally for optimal TLS +// performance. HTTPS connections to any excluded data center will still be fully +// encrypted, but will incur some latency while Keyless SSL is used to complete the +// handshake with the nearest allowed data center. Options allow distribution to +// only to U.S. data centers, only to E.U. data centers, or only to highest +// security data centers. Default distribution is to all Cloudflare datacenters, +// for optimal performance. +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictions struct { + Label param.Field[ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabel] `json:"label"` +} + +func (r ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictions) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabel string + +const ( + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabelUs ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabel = "us" + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabelEu ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabel = "eu" + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabelHighestSecurity ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabel = "highest_security" +) + +// The type 'legacy_custom' enables support for legacy clients which do not include +// SNI in the TLS handshake. +type ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsType string + +const ( + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsTypeLegacyCustom ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsType = "legacy_custom" + ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsTypeSniCustom ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsType = "sni_custom" +) + +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParams struct { + // Whether to match all search requirements or at least one (any). + Match param.Field[ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParamsMatch] `query:"match"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of zones per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParams]'s query +// parameters as `url.Values`. +func (r ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Whether to match all search requirements or at least one (any). +type ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParamsMatch string + +const ( + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParamsMatchAny ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParamsMatch = "any" + ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParamsMatchAll ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParamsMatch = "all" +) diff --git a/zonecustomcertificate_test.go b/zonecustomcertificate_test.go new file mode 100644 index 00000000000..f7c494cc2cd --- /dev/null +++ b/zonecustomcertificate_test.go @@ -0,0 +1,186 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCustomCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomCertificates.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneCustomCertificateUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomCertificates.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomCertificateUpdateParams{ + BundleMethod: cloudflare.F(cloudflare.ZoneCustomCertificateUpdateParamsBundleMethodUbiquitous), + Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), + GeoRestrictions: cloudflare.F(cloudflare.ZoneCustomCertificateUpdateParamsGeoRestrictions{ + Label: cloudflare.F(cloudflare.ZoneCustomCertificateUpdateParamsGeoRestrictionsLabelUs), + }), + Policy: cloudflare.F("(country: US) or (region: EU)"), + PrivateKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), + }, + ) + 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 TestZoneCustomCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomCertificates.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneCustomCertificateCustomSslForAZoneNewSslConfigurationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomCertificates.CustomSslForAZoneNewSslConfiguration( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParams{ + Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), + PrivateKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), + BundleMethod: cloudflare.F(cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsBundleMethodUbiquitous), + GeoRestrictions: cloudflare.F(cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictions{ + Label: cloudflare.F(cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsGeoRestrictionsLabelUs), + }), + Policy: cloudflare.F("(country: US) or (region: EU)"), + Type: cloudflare.F(cloudflare.ZoneCustomCertificateCustomSslForAZoneNewSslConfigurationParamsTypeSniCustom), + }, + ) + 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 TestZoneCustomCertificateCustomSslForAZoneListSslConfigurationsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomCertificates.CustomSslForAZoneListSslConfigurations( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParams{ + Match: cloudflare.F(cloudflare.ZoneCustomCertificateCustomSslForAZoneListSslConfigurationsParamsMatchAny), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/zonecustomcertificateprioritize.go b/zonecustomcertificateprioritize.go new file mode 100644 index 00000000000..68efa18035c --- /dev/null +++ b/zonecustomcertificateprioritize.go @@ -0,0 +1,377 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCustomCertificatePrioritizeService 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 +// [NewZoneCustomCertificatePrioritizeService] method instead. +type ZoneCustomCertificatePrioritizeService struct { + Options []option.RequestOption +} + +// NewZoneCustomCertificatePrioritizeService 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 NewZoneCustomCertificatePrioritizeService(opts ...option.RequestOption) (r *ZoneCustomCertificatePrioritizeService) { + r = &ZoneCustomCertificatePrioritizeService{} + r.Options = opts + return +} + +// If a zone has multiple SSL certificates, you can set the order in which they +// should be used during a request. The higher priority will break ties across +// overlapping 'legacy_custom' certificates. +func (r *ZoneCustomCertificatePrioritizeService) CustomSslForAZoneRePrioritizeSslCertificates(ctx context.Context, zoneIdentifier string, body ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParams, opts ...option.RequestOption) (res *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_certificates/prioritize", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponse struct { + Errors []ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseError `json:"errors"` + Messages []ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseMessage `json:"messages"` + Result []ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResult `json:"result"` + ResultInfo ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseSuccess `json:"success"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponse] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseErrorJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseError] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseMessageJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseMessage] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResult struct { + // Identifier + ID string `json:"id,required"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethod `json:"bundle_method,required"` + // When the certificate from the authority expires. + ExpiresOn time.Time `json:"expires_on,required" format:"date-time"` + Hosts []string `json:"hosts,required"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer,required"` + // When the certificate was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The order/priority in which the certificate will be used in a request. The + // higher priority will break ties across overlapping 'legacy_custom' certificates, + // but 'legacy_custom' certificates will always supercede 'sni_custom' + // certificates. + Priority float64 `json:"priority,required"` + // The type of hash used for the certificate. + Signature string `json:"signature,required"` + // Status of the zone's custom SSL. + Status ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatus `json:"status,required"` + // When the certificate was uploaded to Cloudflare. + UploadedOn time.Time `json:"uploaded_on,required" format:"date-time"` + // Identifier + ZoneID string `json:"zone_id,required"` + // Specify the region where your private key can be held locally for optimal TLS + // performance. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Options allow distribution to + // only to U.S. data centers, only to E.U. data centers, or only to highest + // security data centers. Default distribution is to all Cloudflare datacenters, + // for optimal performance. + GeoRestrictions ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictions `json:"geo_restrictions"` + KeylessServer ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServer `json:"keyless_server"` + // Specify the policy that determines the region where your private key will be + // held locally. HTTPS connections to any excluded data center will still be fully + // encrypted, but will incur some latency while Keyless SSL is used to complete the + // handshake with the nearest allowed data center. Any combination of countries, + // specified by their two letter country code + // (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + // can be chosen, such as 'country: IN', as well as 'region: EU' which refers to + // the EU region. If there are too few data centers satisfying the policy, it will + // be rejected. + Policy string `json:"policy"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResult] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultJSON struct { + ID apijson.Field + BundleMethod apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + ModifiedOn apijson.Field + Priority apijson.Field + Signature apijson.Field + Status apijson.Field + UploadedOn apijson.Field + ZoneID apijson.Field + GeoRestrictions apijson.Field + KeylessServer apijson.Field + Policy apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethod string + +const ( + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethodUbiquitous ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethod = "ubiquitous" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethodOptimal ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethod = "optimal" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethodForce ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultBundleMethod = "force" +) + +// Status of the zone's custom SSL. +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatus string + +const ( + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatusActive ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatus = "active" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatusExpired ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatus = "expired" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatusDeleted ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatus = "deleted" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatusPending ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatus = "pending" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatusInitializing ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultStatus = "initializing" +) + +// Specify the region where your private key can be held locally for optimal TLS +// performance. HTTPS connections to any excluded data center will still be fully +// encrypted, but will incur some latency while Keyless SSL is used to complete the +// handshake with the nearest allowed data center. Options allow distribution to +// only to U.S. data centers, only to E.U. data centers, or only to highest +// security data centers. Default distribution is to all Cloudflare datacenters, +// for optimal performance. +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictions struct { + Label ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabel `json:"label"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictions] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsJSON struct { + Label apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictions) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabel string + +const ( + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabelUs ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabel = "us" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabelEu ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabel = "eu" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabelHighestSecurity ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultGeoRestrictionsLabel = "highest_security" +) + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServer struct { + // Keyless certificate identifier tag. + ID string `json:"id,required"` + // When the Keyless SSL was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Whether or not the Keyless SSL is on or off. + Enabled bool `json:"enabled,required"` + // The keyless SSL name. + Host string `json:"host,required" format:"hostname"` + // When the Keyless SSL was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The keyless SSL name. + Name string `json:"name,required"` + // Available permissions for the Keyless SSL for the current user requesting the + // item. + Permissions []interface{} `json:"permissions,required"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port float64 `json:"port,required"` + // Status of the Keyless SSL. + Status ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerStatus `json:"status,required"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerTunnel `json:"tunnel"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServer] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + Host apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Permissions apijson.Field + Port apijson.Field + Status apijson.Field + Tunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServer) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Keyless SSL. +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerStatus string + +const ( + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerStatusActive ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerStatus = "active" + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerStatusDeleted ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerStatus = "deleted" +) + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerTunnel struct { + // Private IP of the Key Server Host + PrivateIP string `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID string `json:"vnet_id,required"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerTunnelJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerTunnelJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerTunnel] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerTunnelJSON struct { + PrivateIP apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultKeylessServerTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultInfoJSON `json:"-"` +} + +// zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultInfo] +type zoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseSuccess bool + +const ( + ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseSuccessTrue ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesResponseSuccess = true +) + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParams struct { + // Array of ordered certificates. + Certificates param.Field[[]ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParamsCertificate] `json:"certificates,required"` +} + +func (r ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParamsCertificate struct { + // The order/priority in which the certificate will be used in a request. The + // higher priority will break ties across overlapping 'legacy_custom' certificates, + // but 'legacy_custom' certificates will always supercede 'sni_custom' + // certificates. + Priority param.Field[float64] `json:"priority"` +} + +func (r ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParamsCertificate) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonecustomcertificateprioritize_test.go b/zonecustomcertificateprioritize_test.go new file mode 100644 index 00000000000..c0b5c26ea14 --- /dev/null +++ b/zonecustomcertificateprioritize_test.go @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificates(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomCertificates.Prioritizes.CustomSslForAZoneRePrioritizeSslCertificates( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParams{ + Certificates: cloudflare.F([]cloudflare.ZoneCustomCertificatePrioritizeCustomSslForAZoneRePrioritizeSslCertificatesParamsCertificate{{ + Priority: cloudflare.F(2.000000), + }, { + Priority: cloudflare.F(1.000000), + }}), + }, + ) + 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/zonecustomhostname.go b/zonecustomhostname.go new file mode 100644 index 00000000000..def9355f55c --- /dev/null +++ b/zonecustomhostname.go @@ -0,0 +1,2340 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCustomHostnameService 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 [NewZoneCustomHostnameService] method +// instead. +type ZoneCustomHostnameService struct { + Options []option.RequestOption + FallbackOrigins *ZoneCustomHostnameFallbackOriginService +} + +// NewZoneCustomHostnameService 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 NewZoneCustomHostnameService(opts ...option.RequestOption) (r *ZoneCustomHostnameService) { + r = &ZoneCustomHostnameService{} + r.Options = opts + r.FallbackOrigins = NewZoneCustomHostnameFallbackOriginService(opts...) + return +} + +// Custom Hostname Details +func (r *ZoneCustomHostnameService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneCustomHostnameGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Modify SSL configuration for a custom hostname. When sent with SSL config that +// matches existing config, used to indicate that hostname should pass domain +// control validation (DCV). Can also be used to change validation type, e.g., from +// 'http' to 'email'. +func (r *ZoneCustomHostnameService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneCustomHostnameUpdateParams, opts ...option.RequestOption) (res *ZoneCustomHostnameUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete Custom Hostname (and any issued SSL certificates) +func (r *ZoneCustomHostnameService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneCustomHostnameDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Add a new custom hostname and request that an SSL certificate be issued for it. +// One of three validation methods—http, txt, email—should be used, with 'http' +// recommended if the CNAME is already in place (or will be soon). Specifying +// 'email' will send an email to the WHOIS contacts on file for the base domain +// plus hostmaster, postmaster, webmaster, admin, administrator. If http is used +// and the domain is not already pointing to the Managed CNAME host, the PATCH +// method must be used once it is (to complete validation). +func (r *ZoneCustomHostnameService) CustomHostnameForAZoneNewCustomHostname(ctx context.Context, zoneIdentifier string, body ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParams, opts ...option.RequestOption) (res *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List, search, sort, and filter all of your custom hostnames. +func (r *ZoneCustomHostnameService) CustomHostnameForAZoneListCustomHostnames(ctx context.Context, zoneIdentifier string, query ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParams, opts ...option.RequestOption) (res *shared.Page[ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneCustomHostnameGetResponse struct { + Errors []ZoneCustomHostnameGetResponseError `json:"errors"` + Messages []ZoneCustomHostnameGetResponseMessage `json:"messages"` + Result ZoneCustomHostnameGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCustomHostnameGetResponseSuccess `json:"success"` + JSON zoneCustomHostnameGetResponseJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseJSON contains the JSON metadata for the struct +// [ZoneCustomHostnameGetResponse] +type zoneCustomHostnameGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameGetResponseErrorJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneCustomHostnameGetResponseError] +type zoneCustomHostnameGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameGetResponseMessageJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneCustomHostnameGetResponseMessage] +type zoneCustomHostnameGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameGetResponseResult struct { + // Identifier + ID string `json:"id"` + // This is the time the hostname was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // These are per-hostname (customer) settings. + CustomMetadata ZoneCustomHostnameGetResponseResultCustomMetadata `json:"custom_metadata"` + // a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + // record. + CustomOriginServer string `json:"custom_origin_server"` + // A hostname that will be sent to your custom origin server as SNI for TLS + // handshake. This can be a valid subdomain of the zone or custom origin server + // name or the string ':request_host_header:' which will cause the host header in + // the request to be used as SNI. Not configurable with default/fallback origin + // server. + CustomOriginSni string `json:"custom_origin_sni"` + // The custom hostname that will point to your hostname via CNAME. + Hostname string `json:"hostname"` + // This is a record which can be placed to activate a hostname. + OwnershipVerification ZoneCustomHostnameGetResponseResultOwnershipVerification `json:"ownership_verification"` + // This presents the token to be served by the given http url to activate a + // hostname. + OwnershipVerificationHTTP ZoneCustomHostnameGetResponseResultOwnershipVerificationHTTP `json:"ownership_verification_http"` + // SSL properties for the custom hostname. + Ssl ZoneCustomHostnameGetResponseResultSsl `json:"ssl"` + // Status of the hostname's activation. + Status ZoneCustomHostnameGetResponseResultStatus `json:"status"` + // These are errors that were encountered while trying to activate a hostname. + VerificationErrors []interface{} `json:"verification_errors"` + JSON zoneCustomHostnameGetResponseResultJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneCustomHostnameGetResponseResult] +type zoneCustomHostnameGetResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + CustomMetadata apijson.Field + CustomOriginServer apijson.Field + CustomOriginSni apijson.Field + Hostname apijson.Field + OwnershipVerification apijson.Field + OwnershipVerificationHTTP apijson.Field + Ssl apijson.Field + Status apijson.Field + VerificationErrors apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// These are per-hostname (customer) settings. +type ZoneCustomHostnameGetResponseResultCustomMetadata struct { + // Unique metadata for this hostname. + Key string `json:"key"` + JSON zoneCustomHostnameGetResponseResultCustomMetadataJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultCustomMetadataJSON contains the JSON metadata +// for the struct [ZoneCustomHostnameGetResponseResultCustomMetadata] +type zoneCustomHostnameGetResponseResultCustomMetadataJSON struct { + Key apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResultCustomMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// This is a record which can be placed to activate a hostname. +type ZoneCustomHostnameGetResponseResultOwnershipVerification struct { + // DNS Name for record. + Name string `json:"name"` + // DNS Record type. + Type ZoneCustomHostnameGetResponseResultOwnershipVerificationType `json:"type"` + // Content for the record. + Value string `json:"value"` + JSON zoneCustomHostnameGetResponseResultOwnershipVerificationJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultOwnershipVerificationJSON contains the JSON +// metadata for the struct +// [ZoneCustomHostnameGetResponseResultOwnershipVerification] +type zoneCustomHostnameGetResponseResultOwnershipVerificationJSON struct { + Name apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResultOwnershipVerification) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DNS Record type. +type ZoneCustomHostnameGetResponseResultOwnershipVerificationType string + +const ( + ZoneCustomHostnameGetResponseResultOwnershipVerificationTypeTxt ZoneCustomHostnameGetResponseResultOwnershipVerificationType = "txt" +) + +// This presents the token to be served by the given http url to activate a +// hostname. +type ZoneCustomHostnameGetResponseResultOwnershipVerificationHTTP struct { + // Token to be served. + HTTPBody string `json:"http_body"` + // The HTTP URL that will be checked during custom hostname verification and where + // the customer should host the token. + HTTPURL string `json:"http_url"` + JSON zoneCustomHostnameGetResponseResultOwnershipVerificationHTTPJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultOwnershipVerificationHTTPJSON contains the +// JSON metadata for the struct +// [ZoneCustomHostnameGetResponseResultOwnershipVerificationHTTP] +type zoneCustomHostnameGetResponseResultOwnershipVerificationHTTPJSON struct { + HTTPBody apijson.Field + HTTPURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResultOwnershipVerificationHTTP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// SSL properties for the custom hostname. +type ZoneCustomHostnameGetResponseResultSsl struct { + // Custom hostname SSL identifier tag. + ID string `json:"id"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod ZoneCustomHostnameGetResponseResultSslBundleMethod `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority ZoneCustomHostnameGetResponseResultSslCertificateAuthority `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate string `json:"custom_certificate"` + // The identifier for the Custom CSR that was used. + CustomCsrID string `json:"custom_csr_id"` + // The key for a custom uploaded certificate. + CustomKey string `json:"custom_key"` + // The time the custom certificate expires on. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // A list of Hostnames on a custom uploaded certificate. + Hosts []interface{} `json:"hosts"` + // The issuer on a custom uploaded certificate. + Issuer string `json:"issuer"` + // Domain control validation (DCV) method used for this hostname. + Method ZoneCustomHostnameGetResponseResultSslMethod `json:"method"` + // The serial number on a custom uploaded certificate. + SerialNumber string `json:"serial_number"` + // SSL specific settings. + Settings ZoneCustomHostnameGetResponseResultSslSettings `json:"settings"` + // The signature on a custom uploaded certificate. + Signature string `json:"signature"` + // Status of the hostname's SSL certificates. + Status ZoneCustomHostnameGetResponseResultSslStatus `json:"status"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type ZoneCustomHostnameGetResponseResultSslType `json:"type"` + // The time the custom certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + // Domain validation errors that have been received by the certificate authority + // (CA). + ValidationErrors []ZoneCustomHostnameGetResponseResultSslValidationError `json:"validation_errors"` + ValidationRecords []ZoneCustomHostnameGetResponseResultSslValidationRecord `json:"validation_records"` + // Indicates whether the certificate covers a wildcard. + Wildcard bool `json:"wildcard"` + JSON zoneCustomHostnameGetResponseResultSslJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultSslJSON contains the JSON metadata for the +// struct [ZoneCustomHostnameGetResponseResultSsl] +type zoneCustomHostnameGetResponseResultSslJSON struct { + ID apijson.Field + BundleMethod apijson.Field + CertificateAuthority apijson.Field + CustomCertificate apijson.Field + CustomCsrID apijson.Field + CustomKey apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + Method apijson.Field + SerialNumber apijson.Field + Settings apijson.Field + Signature apijson.Field + Status apijson.Field + Type apijson.Field + UploadedOn apijson.Field + ValidationErrors apijson.Field + ValidationRecords apijson.Field + Wildcard apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResultSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomHostnameGetResponseResultSslBundleMethod string + +const ( + ZoneCustomHostnameGetResponseResultSslBundleMethodUbiquitous ZoneCustomHostnameGetResponseResultSslBundleMethod = "ubiquitous" + ZoneCustomHostnameGetResponseResultSslBundleMethodOptimal ZoneCustomHostnameGetResponseResultSslBundleMethod = "optimal" + ZoneCustomHostnameGetResponseResultSslBundleMethodForce ZoneCustomHostnameGetResponseResultSslBundleMethod = "force" +) + +// The Certificate Authority that will issue the certificate +type ZoneCustomHostnameGetResponseResultSslCertificateAuthority string + +const ( + ZoneCustomHostnameGetResponseResultSslCertificateAuthorityDigicert ZoneCustomHostnameGetResponseResultSslCertificateAuthority = "digicert" + ZoneCustomHostnameGetResponseResultSslCertificateAuthorityGoogle ZoneCustomHostnameGetResponseResultSslCertificateAuthority = "google" + ZoneCustomHostnameGetResponseResultSslCertificateAuthorityLetsEncrypt ZoneCustomHostnameGetResponseResultSslCertificateAuthority = "lets_encrypt" +) + +// Domain control validation (DCV) method used for this hostname. +type ZoneCustomHostnameGetResponseResultSslMethod string + +const ( + ZoneCustomHostnameGetResponseResultSslMethodHTTP ZoneCustomHostnameGetResponseResultSslMethod = "http" + ZoneCustomHostnameGetResponseResultSslMethodTxt ZoneCustomHostnameGetResponseResultSslMethod = "txt" + ZoneCustomHostnameGetResponseResultSslMethodEmail ZoneCustomHostnameGetResponseResultSslMethod = "email" +) + +// SSL specific settings. +type ZoneCustomHostnameGetResponseResultSslSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers []string `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints ZoneCustomHostnameGetResponseResultSslSettingsEarlyHints `json:"early_hints"` + // Whether or not HTTP2 is enabled. + Http2 ZoneCustomHostnameGetResponseResultSslSettingsHttp2 `json:"http2"` + // The minimum TLS version supported. + MinTlsVersion ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + Tls1_3 ZoneCustomHostnameGetResponseResultSslSettingsTls1_3 `json:"tls_1_3"` + JSON zoneCustomHostnameGetResponseResultSslSettingsJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultSslSettingsJSON contains the JSON metadata +// for the struct [ZoneCustomHostnameGetResponseResultSslSettings] +type zoneCustomHostnameGetResponseResultSslSettingsJSON struct { + Ciphers apijson.Field + EarlyHints apijson.Field + Http2 apijson.Field + MinTlsVersion apijson.Field + Tls1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResultSslSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not Early Hints is enabled. +type ZoneCustomHostnameGetResponseResultSslSettingsEarlyHints string + +const ( + ZoneCustomHostnameGetResponseResultSslSettingsEarlyHintsOn ZoneCustomHostnameGetResponseResultSslSettingsEarlyHints = "on" + ZoneCustomHostnameGetResponseResultSslSettingsEarlyHintsOff ZoneCustomHostnameGetResponseResultSslSettingsEarlyHints = "off" +) + +// Whether or not HTTP2 is enabled. +type ZoneCustomHostnameGetResponseResultSslSettingsHttp2 string + +const ( + ZoneCustomHostnameGetResponseResultSslSettingsHttp2On ZoneCustomHostnameGetResponseResultSslSettingsHttp2 = "on" + ZoneCustomHostnameGetResponseResultSslSettingsHttp2Off ZoneCustomHostnameGetResponseResultSslSettingsHttp2 = "off" +) + +// The minimum TLS version supported. +type ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion string + +const ( + ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion1_0 ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion = "1.0" + ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion1_1 ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion = "1.1" + ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion1_2 ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion = "1.2" + ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion1_3 ZoneCustomHostnameGetResponseResultSslSettingsMinTlsVersion = "1.3" +) + +// Whether or not TLS 1.3 is enabled. +type ZoneCustomHostnameGetResponseResultSslSettingsTls1_3 string + +const ( + ZoneCustomHostnameGetResponseResultSslSettingsTls1_3On ZoneCustomHostnameGetResponseResultSslSettingsTls1_3 = "on" + ZoneCustomHostnameGetResponseResultSslSettingsTls1_3Off ZoneCustomHostnameGetResponseResultSslSettingsTls1_3 = "off" +) + +// Status of the hostname's SSL certificates. +type ZoneCustomHostnameGetResponseResultSslStatus string + +const ( + ZoneCustomHostnameGetResponseResultSslStatusInitializing ZoneCustomHostnameGetResponseResultSslStatus = "initializing" + ZoneCustomHostnameGetResponseResultSslStatusPendingValidation ZoneCustomHostnameGetResponseResultSslStatus = "pending_validation" + ZoneCustomHostnameGetResponseResultSslStatusDeleted ZoneCustomHostnameGetResponseResultSslStatus = "deleted" + ZoneCustomHostnameGetResponseResultSslStatusPendingIssuance ZoneCustomHostnameGetResponseResultSslStatus = "pending_issuance" + ZoneCustomHostnameGetResponseResultSslStatusPendingDeployment ZoneCustomHostnameGetResponseResultSslStatus = "pending_deployment" + ZoneCustomHostnameGetResponseResultSslStatusPendingDeletion ZoneCustomHostnameGetResponseResultSslStatus = "pending_deletion" + ZoneCustomHostnameGetResponseResultSslStatusPendingExpiration ZoneCustomHostnameGetResponseResultSslStatus = "pending_expiration" + ZoneCustomHostnameGetResponseResultSslStatusExpired ZoneCustomHostnameGetResponseResultSslStatus = "expired" + ZoneCustomHostnameGetResponseResultSslStatusActive ZoneCustomHostnameGetResponseResultSslStatus = "active" + ZoneCustomHostnameGetResponseResultSslStatusInitializingTimedOut ZoneCustomHostnameGetResponseResultSslStatus = "initializing_timed_out" + ZoneCustomHostnameGetResponseResultSslStatusValidationTimedOut ZoneCustomHostnameGetResponseResultSslStatus = "validation_timed_out" + ZoneCustomHostnameGetResponseResultSslStatusIssuanceTimedOut ZoneCustomHostnameGetResponseResultSslStatus = "issuance_timed_out" + ZoneCustomHostnameGetResponseResultSslStatusDeploymentTimedOut ZoneCustomHostnameGetResponseResultSslStatus = "deployment_timed_out" + ZoneCustomHostnameGetResponseResultSslStatusDeletionTimedOut ZoneCustomHostnameGetResponseResultSslStatus = "deletion_timed_out" + ZoneCustomHostnameGetResponseResultSslStatusPendingCleanup ZoneCustomHostnameGetResponseResultSslStatus = "pending_cleanup" + ZoneCustomHostnameGetResponseResultSslStatusStagingDeployment ZoneCustomHostnameGetResponseResultSslStatus = "staging_deployment" + ZoneCustomHostnameGetResponseResultSslStatusStagingActive ZoneCustomHostnameGetResponseResultSslStatus = "staging_active" + ZoneCustomHostnameGetResponseResultSslStatusDeactivating ZoneCustomHostnameGetResponseResultSslStatus = "deactivating" + ZoneCustomHostnameGetResponseResultSslStatusInactive ZoneCustomHostnameGetResponseResultSslStatus = "inactive" + ZoneCustomHostnameGetResponseResultSslStatusBackupIssued ZoneCustomHostnameGetResponseResultSslStatus = "backup_issued" + ZoneCustomHostnameGetResponseResultSslStatusHoldingDeployment ZoneCustomHostnameGetResponseResultSslStatus = "holding_deployment" +) + +// Level of validation to be used for this hostname. Domain validation (dv) must be +// used. +type ZoneCustomHostnameGetResponseResultSslType string + +const ( + ZoneCustomHostnameGetResponseResultSslTypeDv ZoneCustomHostnameGetResponseResultSslType = "dv" +) + +type ZoneCustomHostnameGetResponseResultSslValidationError struct { + // A domain validation error. + Message string `json:"message"` + JSON zoneCustomHostnameGetResponseResultSslValidationErrorJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultSslValidationErrorJSON contains the JSON +// metadata for the struct [ZoneCustomHostnameGetResponseResultSslValidationError] +type zoneCustomHostnameGetResponseResultSslValidationErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResultSslValidationError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate's required validation record. +type ZoneCustomHostnameGetResponseResultSslValidationRecord struct { + // The set of email addresses that the certificate authority (CA) will use to + // complete domain validation. + Emails []interface{} `json:"emails"` + // The content that the certificate authority (CA) will expect to find at the + // http_url during the domain validation. + HTTPBody string `json:"http_body"` + // The url that will be checked during domain validation. + HTTPURL string `json:"http_url"` + // The hostname that the certificate authority (CA) will check for a TXT record + // during domain validation . + TxtName string `json:"txt_name"` + // The TXT record that the certificate authority (CA) will check during domain + // validation. + TxtValue string `json:"txt_value"` + JSON zoneCustomHostnameGetResponseResultSslValidationRecordJSON `json:"-"` +} + +// zoneCustomHostnameGetResponseResultSslValidationRecordJSON contains the JSON +// metadata for the struct [ZoneCustomHostnameGetResponseResultSslValidationRecord] +type zoneCustomHostnameGetResponseResultSslValidationRecordJSON struct { + Emails apijson.Field + HTTPBody apijson.Field + HTTPURL apijson.Field + TxtName apijson.Field + TxtValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameGetResponseResultSslValidationRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneCustomHostnameGetResponseResultStatus string + +const ( + ZoneCustomHostnameGetResponseResultStatusActive ZoneCustomHostnameGetResponseResultStatus = "active" + ZoneCustomHostnameGetResponseResultStatusPending ZoneCustomHostnameGetResponseResultStatus = "pending" + ZoneCustomHostnameGetResponseResultStatusActiveRedeploying ZoneCustomHostnameGetResponseResultStatus = "active_redeploying" + ZoneCustomHostnameGetResponseResultStatusMoved ZoneCustomHostnameGetResponseResultStatus = "moved" + ZoneCustomHostnameGetResponseResultStatusPendingDeletion ZoneCustomHostnameGetResponseResultStatus = "pending_deletion" + ZoneCustomHostnameGetResponseResultStatusDeleted ZoneCustomHostnameGetResponseResultStatus = "deleted" + ZoneCustomHostnameGetResponseResultStatusPendingBlocked ZoneCustomHostnameGetResponseResultStatus = "pending_blocked" + ZoneCustomHostnameGetResponseResultStatusPendingMigration ZoneCustomHostnameGetResponseResultStatus = "pending_migration" + ZoneCustomHostnameGetResponseResultStatusPendingProvisioned ZoneCustomHostnameGetResponseResultStatus = "pending_provisioned" + ZoneCustomHostnameGetResponseResultStatusTestPending ZoneCustomHostnameGetResponseResultStatus = "test_pending" + ZoneCustomHostnameGetResponseResultStatusTestActive ZoneCustomHostnameGetResponseResultStatus = "test_active" + ZoneCustomHostnameGetResponseResultStatusTestActiveApex ZoneCustomHostnameGetResponseResultStatus = "test_active_apex" + ZoneCustomHostnameGetResponseResultStatusTestBlocked ZoneCustomHostnameGetResponseResultStatus = "test_blocked" + ZoneCustomHostnameGetResponseResultStatusTestFailed ZoneCustomHostnameGetResponseResultStatus = "test_failed" + ZoneCustomHostnameGetResponseResultStatusProvisioned ZoneCustomHostnameGetResponseResultStatus = "provisioned" + ZoneCustomHostnameGetResponseResultStatusBlocked ZoneCustomHostnameGetResponseResultStatus = "blocked" +) + +// Whether the API call was successful +type ZoneCustomHostnameGetResponseSuccess bool + +const ( + ZoneCustomHostnameGetResponseSuccessTrue ZoneCustomHostnameGetResponseSuccess = true +) + +type ZoneCustomHostnameUpdateResponse struct { + Errors []ZoneCustomHostnameUpdateResponseError `json:"errors"` + Messages []ZoneCustomHostnameUpdateResponseMessage `json:"messages"` + Result ZoneCustomHostnameUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCustomHostnameUpdateResponseSuccess `json:"success"` + JSON zoneCustomHostnameUpdateResponseJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneCustomHostnameUpdateResponse] +type zoneCustomHostnameUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameUpdateResponseErrorJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneCustomHostnameUpdateResponseError] +type zoneCustomHostnameUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameUpdateResponseMessageJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneCustomHostnameUpdateResponseMessage] +type zoneCustomHostnameUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameUpdateResponseResult struct { + // Identifier + ID string `json:"id"` + // This is the time the hostname was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // These are per-hostname (customer) settings. + CustomMetadata ZoneCustomHostnameUpdateResponseResultCustomMetadata `json:"custom_metadata"` + // a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + // record. + CustomOriginServer string `json:"custom_origin_server"` + // A hostname that will be sent to your custom origin server as SNI for TLS + // handshake. This can be a valid subdomain of the zone or custom origin server + // name or the string ':request_host_header:' which will cause the host header in + // the request to be used as SNI. Not configurable with default/fallback origin + // server. + CustomOriginSni string `json:"custom_origin_sni"` + // The custom hostname that will point to your hostname via CNAME. + Hostname string `json:"hostname"` + // This is a record which can be placed to activate a hostname. + OwnershipVerification ZoneCustomHostnameUpdateResponseResultOwnershipVerification `json:"ownership_verification"` + // This presents the token to be served by the given http url to activate a + // hostname. + OwnershipVerificationHTTP ZoneCustomHostnameUpdateResponseResultOwnershipVerificationHTTP `json:"ownership_verification_http"` + // SSL properties for the custom hostname. + Ssl ZoneCustomHostnameUpdateResponseResultSsl `json:"ssl"` + // Status of the hostname's activation. + Status ZoneCustomHostnameUpdateResponseResultStatus `json:"status"` + // These are errors that were encountered while trying to activate a hostname. + VerificationErrors []interface{} `json:"verification_errors"` + JSON zoneCustomHostnameUpdateResponseResultJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneCustomHostnameUpdateResponseResult] +type zoneCustomHostnameUpdateResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + CustomMetadata apijson.Field + CustomOriginServer apijson.Field + CustomOriginSni apijson.Field + Hostname apijson.Field + OwnershipVerification apijson.Field + OwnershipVerificationHTTP apijson.Field + Ssl apijson.Field + Status apijson.Field + VerificationErrors apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// These are per-hostname (customer) settings. +type ZoneCustomHostnameUpdateResponseResultCustomMetadata struct { + // Unique metadata for this hostname. + Key string `json:"key"` + JSON zoneCustomHostnameUpdateResponseResultCustomMetadataJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultCustomMetadataJSON contains the JSON +// metadata for the struct [ZoneCustomHostnameUpdateResponseResultCustomMetadata] +type zoneCustomHostnameUpdateResponseResultCustomMetadataJSON struct { + Key apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResultCustomMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// This is a record which can be placed to activate a hostname. +type ZoneCustomHostnameUpdateResponseResultOwnershipVerification struct { + // DNS Name for record. + Name string `json:"name"` + // DNS Record type. + Type ZoneCustomHostnameUpdateResponseResultOwnershipVerificationType `json:"type"` + // Content for the record. + Value string `json:"value"` + JSON zoneCustomHostnameUpdateResponseResultOwnershipVerificationJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultOwnershipVerificationJSON contains the +// JSON metadata for the struct +// [ZoneCustomHostnameUpdateResponseResultOwnershipVerification] +type zoneCustomHostnameUpdateResponseResultOwnershipVerificationJSON struct { + Name apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResultOwnershipVerification) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DNS Record type. +type ZoneCustomHostnameUpdateResponseResultOwnershipVerificationType string + +const ( + ZoneCustomHostnameUpdateResponseResultOwnershipVerificationTypeTxt ZoneCustomHostnameUpdateResponseResultOwnershipVerificationType = "txt" +) + +// This presents the token to be served by the given http url to activate a +// hostname. +type ZoneCustomHostnameUpdateResponseResultOwnershipVerificationHTTP struct { + // Token to be served. + HTTPBody string `json:"http_body"` + // The HTTP URL that will be checked during custom hostname verification and where + // the customer should host the token. + HTTPURL string `json:"http_url"` + JSON zoneCustomHostnameUpdateResponseResultOwnershipVerificationHTTPJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultOwnershipVerificationHTTPJSON contains the +// JSON metadata for the struct +// [ZoneCustomHostnameUpdateResponseResultOwnershipVerificationHTTP] +type zoneCustomHostnameUpdateResponseResultOwnershipVerificationHTTPJSON struct { + HTTPBody apijson.Field + HTTPURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResultOwnershipVerificationHTTP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// SSL properties for the custom hostname. +type ZoneCustomHostnameUpdateResponseResultSsl struct { + // Custom hostname SSL identifier tag. + ID string `json:"id"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod ZoneCustomHostnameUpdateResponseResultSslBundleMethod `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority ZoneCustomHostnameUpdateResponseResultSslCertificateAuthority `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate string `json:"custom_certificate"` + // The identifier for the Custom CSR that was used. + CustomCsrID string `json:"custom_csr_id"` + // The key for a custom uploaded certificate. + CustomKey string `json:"custom_key"` + // The time the custom certificate expires on. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // A list of Hostnames on a custom uploaded certificate. + Hosts []interface{} `json:"hosts"` + // The issuer on a custom uploaded certificate. + Issuer string `json:"issuer"` + // Domain control validation (DCV) method used for this hostname. + Method ZoneCustomHostnameUpdateResponseResultSslMethod `json:"method"` + // The serial number on a custom uploaded certificate. + SerialNumber string `json:"serial_number"` + // SSL specific settings. + Settings ZoneCustomHostnameUpdateResponseResultSslSettings `json:"settings"` + // The signature on a custom uploaded certificate. + Signature string `json:"signature"` + // Status of the hostname's SSL certificates. + Status ZoneCustomHostnameUpdateResponseResultSslStatus `json:"status"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type ZoneCustomHostnameUpdateResponseResultSslType `json:"type"` + // The time the custom certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + // Domain validation errors that have been received by the certificate authority + // (CA). + ValidationErrors []ZoneCustomHostnameUpdateResponseResultSslValidationError `json:"validation_errors"` + ValidationRecords []ZoneCustomHostnameUpdateResponseResultSslValidationRecord `json:"validation_records"` + // Indicates whether the certificate covers a wildcard. + Wildcard bool `json:"wildcard"` + JSON zoneCustomHostnameUpdateResponseResultSslJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultSslJSON contains the JSON metadata for the +// struct [ZoneCustomHostnameUpdateResponseResultSsl] +type zoneCustomHostnameUpdateResponseResultSslJSON struct { + ID apijson.Field + BundleMethod apijson.Field + CertificateAuthority apijson.Field + CustomCertificate apijson.Field + CustomCsrID apijson.Field + CustomKey apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + Method apijson.Field + SerialNumber apijson.Field + Settings apijson.Field + Signature apijson.Field + Status apijson.Field + Type apijson.Field + UploadedOn apijson.Field + ValidationErrors apijson.Field + ValidationRecords apijson.Field + Wildcard apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResultSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomHostnameUpdateResponseResultSslBundleMethod string + +const ( + ZoneCustomHostnameUpdateResponseResultSslBundleMethodUbiquitous ZoneCustomHostnameUpdateResponseResultSslBundleMethod = "ubiquitous" + ZoneCustomHostnameUpdateResponseResultSslBundleMethodOptimal ZoneCustomHostnameUpdateResponseResultSslBundleMethod = "optimal" + ZoneCustomHostnameUpdateResponseResultSslBundleMethodForce ZoneCustomHostnameUpdateResponseResultSslBundleMethod = "force" +) + +// The Certificate Authority that will issue the certificate +type ZoneCustomHostnameUpdateResponseResultSslCertificateAuthority string + +const ( + ZoneCustomHostnameUpdateResponseResultSslCertificateAuthorityDigicert ZoneCustomHostnameUpdateResponseResultSslCertificateAuthority = "digicert" + ZoneCustomHostnameUpdateResponseResultSslCertificateAuthorityGoogle ZoneCustomHostnameUpdateResponseResultSslCertificateAuthority = "google" + ZoneCustomHostnameUpdateResponseResultSslCertificateAuthorityLetsEncrypt ZoneCustomHostnameUpdateResponseResultSslCertificateAuthority = "lets_encrypt" +) + +// Domain control validation (DCV) method used for this hostname. +type ZoneCustomHostnameUpdateResponseResultSslMethod string + +const ( + ZoneCustomHostnameUpdateResponseResultSslMethodHTTP ZoneCustomHostnameUpdateResponseResultSslMethod = "http" + ZoneCustomHostnameUpdateResponseResultSslMethodTxt ZoneCustomHostnameUpdateResponseResultSslMethod = "txt" + ZoneCustomHostnameUpdateResponseResultSslMethodEmail ZoneCustomHostnameUpdateResponseResultSslMethod = "email" +) + +// SSL specific settings. +type ZoneCustomHostnameUpdateResponseResultSslSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers []string `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints ZoneCustomHostnameUpdateResponseResultSslSettingsEarlyHints `json:"early_hints"` + // Whether or not HTTP2 is enabled. + Http2 ZoneCustomHostnameUpdateResponseResultSslSettingsHttp2 `json:"http2"` + // The minimum TLS version supported. + MinTlsVersion ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + Tls1_3 ZoneCustomHostnameUpdateResponseResultSslSettingsTls1_3 `json:"tls_1_3"` + JSON zoneCustomHostnameUpdateResponseResultSslSettingsJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultSslSettingsJSON contains the JSON metadata +// for the struct [ZoneCustomHostnameUpdateResponseResultSslSettings] +type zoneCustomHostnameUpdateResponseResultSslSettingsJSON struct { + Ciphers apijson.Field + EarlyHints apijson.Field + Http2 apijson.Field + MinTlsVersion apijson.Field + Tls1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResultSslSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not Early Hints is enabled. +type ZoneCustomHostnameUpdateResponseResultSslSettingsEarlyHints string + +const ( + ZoneCustomHostnameUpdateResponseResultSslSettingsEarlyHintsOn ZoneCustomHostnameUpdateResponseResultSslSettingsEarlyHints = "on" + ZoneCustomHostnameUpdateResponseResultSslSettingsEarlyHintsOff ZoneCustomHostnameUpdateResponseResultSslSettingsEarlyHints = "off" +) + +// Whether or not HTTP2 is enabled. +type ZoneCustomHostnameUpdateResponseResultSslSettingsHttp2 string + +const ( + ZoneCustomHostnameUpdateResponseResultSslSettingsHttp2On ZoneCustomHostnameUpdateResponseResultSslSettingsHttp2 = "on" + ZoneCustomHostnameUpdateResponseResultSslSettingsHttp2Off ZoneCustomHostnameUpdateResponseResultSslSettingsHttp2 = "off" +) + +// The minimum TLS version supported. +type ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion string + +const ( + ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion1_0 ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion = "1.0" + ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion1_1 ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion = "1.1" + ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion1_2 ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion = "1.2" + ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion1_3 ZoneCustomHostnameUpdateResponseResultSslSettingsMinTlsVersion = "1.3" +) + +// Whether or not TLS 1.3 is enabled. +type ZoneCustomHostnameUpdateResponseResultSslSettingsTls1_3 string + +const ( + ZoneCustomHostnameUpdateResponseResultSslSettingsTls1_3On ZoneCustomHostnameUpdateResponseResultSslSettingsTls1_3 = "on" + ZoneCustomHostnameUpdateResponseResultSslSettingsTls1_3Off ZoneCustomHostnameUpdateResponseResultSslSettingsTls1_3 = "off" +) + +// Status of the hostname's SSL certificates. +type ZoneCustomHostnameUpdateResponseResultSslStatus string + +const ( + ZoneCustomHostnameUpdateResponseResultSslStatusInitializing ZoneCustomHostnameUpdateResponseResultSslStatus = "initializing" + ZoneCustomHostnameUpdateResponseResultSslStatusPendingValidation ZoneCustomHostnameUpdateResponseResultSslStatus = "pending_validation" + ZoneCustomHostnameUpdateResponseResultSslStatusDeleted ZoneCustomHostnameUpdateResponseResultSslStatus = "deleted" + ZoneCustomHostnameUpdateResponseResultSslStatusPendingIssuance ZoneCustomHostnameUpdateResponseResultSslStatus = "pending_issuance" + ZoneCustomHostnameUpdateResponseResultSslStatusPendingDeployment ZoneCustomHostnameUpdateResponseResultSslStatus = "pending_deployment" + ZoneCustomHostnameUpdateResponseResultSslStatusPendingDeletion ZoneCustomHostnameUpdateResponseResultSslStatus = "pending_deletion" + ZoneCustomHostnameUpdateResponseResultSslStatusPendingExpiration ZoneCustomHostnameUpdateResponseResultSslStatus = "pending_expiration" + ZoneCustomHostnameUpdateResponseResultSslStatusExpired ZoneCustomHostnameUpdateResponseResultSslStatus = "expired" + ZoneCustomHostnameUpdateResponseResultSslStatusActive ZoneCustomHostnameUpdateResponseResultSslStatus = "active" + ZoneCustomHostnameUpdateResponseResultSslStatusInitializingTimedOut ZoneCustomHostnameUpdateResponseResultSslStatus = "initializing_timed_out" + ZoneCustomHostnameUpdateResponseResultSslStatusValidationTimedOut ZoneCustomHostnameUpdateResponseResultSslStatus = "validation_timed_out" + ZoneCustomHostnameUpdateResponseResultSslStatusIssuanceTimedOut ZoneCustomHostnameUpdateResponseResultSslStatus = "issuance_timed_out" + ZoneCustomHostnameUpdateResponseResultSslStatusDeploymentTimedOut ZoneCustomHostnameUpdateResponseResultSslStatus = "deployment_timed_out" + ZoneCustomHostnameUpdateResponseResultSslStatusDeletionTimedOut ZoneCustomHostnameUpdateResponseResultSslStatus = "deletion_timed_out" + ZoneCustomHostnameUpdateResponseResultSslStatusPendingCleanup ZoneCustomHostnameUpdateResponseResultSslStatus = "pending_cleanup" + ZoneCustomHostnameUpdateResponseResultSslStatusStagingDeployment ZoneCustomHostnameUpdateResponseResultSslStatus = "staging_deployment" + ZoneCustomHostnameUpdateResponseResultSslStatusStagingActive ZoneCustomHostnameUpdateResponseResultSslStatus = "staging_active" + ZoneCustomHostnameUpdateResponseResultSslStatusDeactivating ZoneCustomHostnameUpdateResponseResultSslStatus = "deactivating" + ZoneCustomHostnameUpdateResponseResultSslStatusInactive ZoneCustomHostnameUpdateResponseResultSslStatus = "inactive" + ZoneCustomHostnameUpdateResponseResultSslStatusBackupIssued ZoneCustomHostnameUpdateResponseResultSslStatus = "backup_issued" + ZoneCustomHostnameUpdateResponseResultSslStatusHoldingDeployment ZoneCustomHostnameUpdateResponseResultSslStatus = "holding_deployment" +) + +// Level of validation to be used for this hostname. Domain validation (dv) must be +// used. +type ZoneCustomHostnameUpdateResponseResultSslType string + +const ( + ZoneCustomHostnameUpdateResponseResultSslTypeDv ZoneCustomHostnameUpdateResponseResultSslType = "dv" +) + +type ZoneCustomHostnameUpdateResponseResultSslValidationError struct { + // A domain validation error. + Message string `json:"message"` + JSON zoneCustomHostnameUpdateResponseResultSslValidationErrorJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultSslValidationErrorJSON contains the JSON +// metadata for the struct +// [ZoneCustomHostnameUpdateResponseResultSslValidationError] +type zoneCustomHostnameUpdateResponseResultSslValidationErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResultSslValidationError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate's required validation record. +type ZoneCustomHostnameUpdateResponseResultSslValidationRecord struct { + // The set of email addresses that the certificate authority (CA) will use to + // complete domain validation. + Emails []interface{} `json:"emails"` + // The content that the certificate authority (CA) will expect to find at the + // http_url during the domain validation. + HTTPBody string `json:"http_body"` + // The url that will be checked during domain validation. + HTTPURL string `json:"http_url"` + // The hostname that the certificate authority (CA) will check for a TXT record + // during domain validation . + TxtName string `json:"txt_name"` + // The TXT record that the certificate authority (CA) will check during domain + // validation. + TxtValue string `json:"txt_value"` + JSON zoneCustomHostnameUpdateResponseResultSslValidationRecordJSON `json:"-"` +} + +// zoneCustomHostnameUpdateResponseResultSslValidationRecordJSON contains the JSON +// metadata for the struct +// [ZoneCustomHostnameUpdateResponseResultSslValidationRecord] +type zoneCustomHostnameUpdateResponseResultSslValidationRecordJSON struct { + Emails apijson.Field + HTTPBody apijson.Field + HTTPURL apijson.Field + TxtName apijson.Field + TxtValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameUpdateResponseResultSslValidationRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneCustomHostnameUpdateResponseResultStatus string + +const ( + ZoneCustomHostnameUpdateResponseResultStatusActive ZoneCustomHostnameUpdateResponseResultStatus = "active" + ZoneCustomHostnameUpdateResponseResultStatusPending ZoneCustomHostnameUpdateResponseResultStatus = "pending" + ZoneCustomHostnameUpdateResponseResultStatusActiveRedeploying ZoneCustomHostnameUpdateResponseResultStatus = "active_redeploying" + ZoneCustomHostnameUpdateResponseResultStatusMoved ZoneCustomHostnameUpdateResponseResultStatus = "moved" + ZoneCustomHostnameUpdateResponseResultStatusPendingDeletion ZoneCustomHostnameUpdateResponseResultStatus = "pending_deletion" + ZoneCustomHostnameUpdateResponseResultStatusDeleted ZoneCustomHostnameUpdateResponseResultStatus = "deleted" + ZoneCustomHostnameUpdateResponseResultStatusPendingBlocked ZoneCustomHostnameUpdateResponseResultStatus = "pending_blocked" + ZoneCustomHostnameUpdateResponseResultStatusPendingMigration ZoneCustomHostnameUpdateResponseResultStatus = "pending_migration" + ZoneCustomHostnameUpdateResponseResultStatusPendingProvisioned ZoneCustomHostnameUpdateResponseResultStatus = "pending_provisioned" + ZoneCustomHostnameUpdateResponseResultStatusTestPending ZoneCustomHostnameUpdateResponseResultStatus = "test_pending" + ZoneCustomHostnameUpdateResponseResultStatusTestActive ZoneCustomHostnameUpdateResponseResultStatus = "test_active" + ZoneCustomHostnameUpdateResponseResultStatusTestActiveApex ZoneCustomHostnameUpdateResponseResultStatus = "test_active_apex" + ZoneCustomHostnameUpdateResponseResultStatusTestBlocked ZoneCustomHostnameUpdateResponseResultStatus = "test_blocked" + ZoneCustomHostnameUpdateResponseResultStatusTestFailed ZoneCustomHostnameUpdateResponseResultStatus = "test_failed" + ZoneCustomHostnameUpdateResponseResultStatusProvisioned ZoneCustomHostnameUpdateResponseResultStatus = "provisioned" + ZoneCustomHostnameUpdateResponseResultStatusBlocked ZoneCustomHostnameUpdateResponseResultStatus = "blocked" +) + +// Whether the API call was successful +type ZoneCustomHostnameUpdateResponseSuccess bool + +const ( + ZoneCustomHostnameUpdateResponseSuccessTrue ZoneCustomHostnameUpdateResponseSuccess = true +) + +type ZoneCustomHostnameDeleteResponse struct { + // Identifier + ID string `json:"id"` + JSON zoneCustomHostnameDeleteResponseJSON `json:"-"` +} + +// zoneCustomHostnameDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneCustomHostnameDeleteResponse] +type zoneCustomHostnameDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponse struct { + Errors []ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseError `json:"errors"` + Messages []ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseMessage `json:"messages"` + Result ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseSuccess `json:"success"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseJSON contains +// the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponse] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseErrorJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseError] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseMessageJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseMessage] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResult struct { + // Identifier + ID string `json:"id"` + // This is the time the hostname was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // These are per-hostname (customer) settings. + CustomMetadata ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultCustomMetadata `json:"custom_metadata"` + // a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + // record. + CustomOriginServer string `json:"custom_origin_server"` + // A hostname that will be sent to your custom origin server as SNI for TLS + // handshake. This can be a valid subdomain of the zone or custom origin server + // name or the string ':request_host_header:' which will cause the host header in + // the request to be used as SNI. Not configurable with default/fallback origin + // server. + CustomOriginSni string `json:"custom_origin_sni"` + // The custom hostname that will point to your hostname via CNAME. + Hostname string `json:"hostname"` + // This is a record which can be placed to activate a hostname. + OwnershipVerification ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerification `json:"ownership_verification"` + // This presents the token to be served by the given http url to activate a + // hostname. + OwnershipVerificationHTTP ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationHTTP `json:"ownership_verification_http"` + // SSL properties for the custom hostname. + Ssl ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSsl `json:"ssl"` + // Status of the hostname's activation. + Status ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus `json:"status"` + // These are errors that were encountered while trying to activate a hostname. + VerificationErrors []interface{} `json:"verification_errors"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResult] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + CustomMetadata apijson.Field + CustomOriginServer apijson.Field + CustomOriginSni apijson.Field + Hostname apijson.Field + OwnershipVerification apijson.Field + OwnershipVerificationHTTP apijson.Field + Ssl apijson.Field + Status apijson.Field + VerificationErrors apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// These are per-hostname (customer) settings. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultCustomMetadata struct { + // Unique metadata for this hostname. + Key string `json:"key"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultCustomMetadataJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultCustomMetadataJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultCustomMetadata] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultCustomMetadataJSON struct { + Key apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultCustomMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// This is a record which can be placed to activate a hostname. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerification struct { + // DNS Name for record. + Name string `json:"name"` + // DNS Record type. + Type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationType `json:"type"` + // Content for the record. + Value string `json:"value"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerification] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationJSON struct { + Name apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerification) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DNS Record type. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationType string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationTypeTxt ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationType = "txt" +) + +// This presents the token to be served by the given http url to activate a +// hostname. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationHTTP struct { + // Token to be served. + HTTPBody string `json:"http_body"` + // The HTTP URL that will be checked during custom hostname verification and where + // the customer should host the token. + HTTPURL string `json:"http_url"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationHTTPJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationHTTPJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationHTTP] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationHTTPJSON struct { + HTTPBody apijson.Field + HTTPURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultOwnershipVerificationHTTP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// SSL properties for the custom hostname. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSsl struct { + // Custom hostname SSL identifier tag. + ID string `json:"id"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethod `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthority `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate string `json:"custom_certificate"` + // The identifier for the Custom CSR that was used. + CustomCsrID string `json:"custom_csr_id"` + // The key for a custom uploaded certificate. + CustomKey string `json:"custom_key"` + // The time the custom certificate expires on. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // A list of Hostnames on a custom uploaded certificate. + Hosts []interface{} `json:"hosts"` + // The issuer on a custom uploaded certificate. + Issuer string `json:"issuer"` + // Domain control validation (DCV) method used for this hostname. + Method ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethod `json:"method"` + // The serial number on a custom uploaded certificate. + SerialNumber string `json:"serial_number"` + // SSL specific settings. + Settings ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettings `json:"settings"` + // The signature on a custom uploaded certificate. + Signature string `json:"signature"` + // Status of the hostname's SSL certificates. + Status ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus `json:"status"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslType `json:"type"` + // The time the custom certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + // Domain validation errors that have been received by the certificate authority + // (CA). + ValidationErrors []ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationError `json:"validation_errors"` + ValidationRecords []ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationRecord `json:"validation_records"` + // Indicates whether the certificate covers a wildcard. + Wildcard bool `json:"wildcard"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSsl] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslJSON struct { + ID apijson.Field + BundleMethod apijson.Field + CertificateAuthority apijson.Field + CustomCertificate apijson.Field + CustomCsrID apijson.Field + CustomKey apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + Method apijson.Field + SerialNumber apijson.Field + Settings apijson.Field + Signature apijson.Field + Status apijson.Field + Type apijson.Field + UploadedOn apijson.Field + ValidationErrors apijson.Field + ValidationRecords apijson.Field + Wildcard apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethod string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethodUbiquitous ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethod = "ubiquitous" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethodOptimal ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethod = "optimal" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethodForce ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslBundleMethod = "force" +) + +// The Certificate Authority that will issue the certificate +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthority string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthorityDigicert ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthority = "digicert" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthorityGoogle ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthority = "google" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthorityLetsEncrypt ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslCertificateAuthority = "lets_encrypt" +) + +// Domain control validation (DCV) method used for this hostname. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethod string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethodHTTP ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethod = "http" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethodTxt ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethod = "txt" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethodEmail ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslMethod = "email" +) + +// SSL specific settings. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers []string `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsEarlyHints `json:"early_hints"` + // Whether or not HTTP2 is enabled. + Http2 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsHttp2 `json:"http2"` + // The minimum TLS version supported. + MinTlsVersion ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + Tls1_3 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsTls1_3 `json:"tls_1_3"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettings] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsJSON struct { + Ciphers apijson.Field + EarlyHints apijson.Field + Http2 apijson.Field + MinTlsVersion apijson.Field + Tls1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not Early Hints is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsEarlyHints string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsEarlyHintsOn ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsEarlyHints = "on" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsEarlyHintsOff ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsEarlyHints = "off" +) + +// Whether or not HTTP2 is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsHttp2 string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsHttp2On ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsHttp2 = "on" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsHttp2Off ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsHttp2 = "off" +) + +// The minimum TLS version supported. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion1_0 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion = "1.0" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion1_1 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion = "1.1" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion1_2 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion = "1.2" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion1_3 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsMinTlsVersion = "1.3" +) + +// Whether or not TLS 1.3 is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsTls1_3 string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsTls1_3On ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsTls1_3 = "on" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsTls1_3Off ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslSettingsTls1_3 = "off" +) + +// Status of the hostname's SSL certificates. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusInitializing ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "initializing" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusPendingValidation ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "pending_validation" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusDeleted ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "deleted" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusPendingIssuance ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "pending_issuance" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusPendingDeployment ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "pending_deployment" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusPendingDeletion ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "pending_deletion" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusPendingExpiration ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "pending_expiration" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusExpired ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "expired" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusActive ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "active" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusInitializingTimedOut ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "initializing_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusValidationTimedOut ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "validation_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusIssuanceTimedOut ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "issuance_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusDeploymentTimedOut ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "deployment_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusDeletionTimedOut ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "deletion_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusPendingCleanup ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "pending_cleanup" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusStagingDeployment ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "staging_deployment" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusStagingActive ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "staging_active" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusDeactivating ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "deactivating" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusInactive ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "inactive" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusBackupIssued ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "backup_issued" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatusHoldingDeployment ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslStatus = "holding_deployment" +) + +// Level of validation to be used for this hostname. Domain validation (dv) must be +// used. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslType string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslTypeDv ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslType = "dv" +) + +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationError struct { + // A domain validation error. + Message string `json:"message"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationErrorJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationError] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate's required validation record. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationRecord struct { + // The set of email addresses that the certificate authority (CA) will use to + // complete domain validation. + Emails []interface{} `json:"emails"` + // The content that the certificate authority (CA) will expect to find at the + // http_url during the domain validation. + HTTPBody string `json:"http_body"` + // The url that will be checked during domain validation. + HTTPURL string `json:"http_url"` + // The hostname that the certificate authority (CA) will check for a TXT record + // during domain validation . + TxtName string `json:"txt_name"` + // The TXT record that the certificate authority (CA) will check during domain + // validation. + TxtValue string `json:"txt_value"` + JSON zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationRecordJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationRecordJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationRecord] +type zoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationRecordJSON struct { + Emails apijson.Field + HTTPBody apijson.Field + HTTPURL apijson.Field + TxtName apijson.Field + TxtValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultSslValidationRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusActive ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "active" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusPending ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "pending" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusActiveRedeploying ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "active_redeploying" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusMoved ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "moved" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusPendingDeletion ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "pending_deletion" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusDeleted ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "deleted" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusPendingBlocked ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "pending_blocked" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusPendingMigration ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "pending_migration" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusPendingProvisioned ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "pending_provisioned" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusTestPending ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "test_pending" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusTestActive ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "test_active" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusTestActiveApex ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "test_active_apex" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusTestBlocked ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "test_blocked" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusTestFailed ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "test_failed" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusProvisioned ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "provisioned" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatusBlocked ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseResultStatus = "blocked" +) + +// Whether the API call was successful +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseSuccess bool + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseSuccessTrue ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameResponseSuccess = true +) + +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponse struct { + // Identifier + ID string `json:"id"` + // This is the time the hostname was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // These are per-hostname (customer) settings. + CustomMetadata ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseCustomMetadata `json:"custom_metadata"` + // a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + // record. + CustomOriginServer string `json:"custom_origin_server"` + // A hostname that will be sent to your custom origin server as SNI for TLS + // handshake. This can be a valid subdomain of the zone or custom origin server + // name or the string ':request_host_header:' which will cause the host header in + // the request to be used as SNI. Not configurable with default/fallback origin + // server. + CustomOriginSni string `json:"custom_origin_sni"` + // The custom hostname that will point to your hostname via CNAME. + Hostname string `json:"hostname"` + // This is a record which can be placed to activate a hostname. + OwnershipVerification ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerification `json:"ownership_verification"` + // This presents the token to be served by the given http url to activate a + // hostname. + OwnershipVerificationHTTP ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationHTTP `json:"ownership_verification_http"` + // SSL properties for the custom hostname. + Ssl ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSsl `json:"ssl"` + // Status of the hostname's activation. + Status ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus `json:"status"` + // These are errors that were encountered while trying to activate a hostname. + VerificationErrors []interface{} `json:"verification_errors"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseJSON contains +// the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponse] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseJSON struct { + ID apijson.Field + CreatedAt apijson.Field + CustomMetadata apijson.Field + CustomOriginServer apijson.Field + CustomOriginSni apijson.Field + Hostname apijson.Field + OwnershipVerification apijson.Field + OwnershipVerificationHTTP apijson.Field + Ssl apijson.Field + Status apijson.Field + VerificationErrors apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// These are per-hostname (customer) settings. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseCustomMetadata struct { + // Unique metadata for this hostname. + Key string `json:"key"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseCustomMetadataJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseCustomMetadataJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseCustomMetadata] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseCustomMetadataJSON struct { + Key apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseCustomMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// This is a record which can be placed to activate a hostname. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerification struct { + // DNS Name for record. + Name string `json:"name"` + // DNS Record type. + Type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationType `json:"type"` + // Content for the record. + Value string `json:"value"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerification] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationJSON struct { + Name apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerification) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// DNS Record type. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationType string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationTypeTxt ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationType = "txt" +) + +// This presents the token to be served by the given http url to activate a +// hostname. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationHTTP struct { + // Token to be served. + HTTPBody string `json:"http_body"` + // The HTTP URL that will be checked during custom hostname verification and where + // the customer should host the token. + HTTPURL string `json:"http_url"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationHTTPJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationHTTPJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationHTTP] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationHTTPJSON struct { + HTTPBody apijson.Field + HTTPURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseOwnershipVerificationHTTP) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// SSL properties for the custom hostname. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSsl struct { + // Custom hostname SSL identifier tag. + ID string `json:"id"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethod `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthority `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate string `json:"custom_certificate"` + // The identifier for the Custom CSR that was used. + CustomCsrID string `json:"custom_csr_id"` + // The key for a custom uploaded certificate. + CustomKey string `json:"custom_key"` + // The time the custom certificate expires on. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // A list of Hostnames on a custom uploaded certificate. + Hosts []interface{} `json:"hosts"` + // The issuer on a custom uploaded certificate. + Issuer string `json:"issuer"` + // Domain control validation (DCV) method used for this hostname. + Method ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethod `json:"method"` + // The serial number on a custom uploaded certificate. + SerialNumber string `json:"serial_number"` + // SSL specific settings. + Settings ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettings `json:"settings"` + // The signature on a custom uploaded certificate. + Signature string `json:"signature"` + // Status of the hostname's SSL certificates. + Status ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus `json:"status"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslType `json:"type"` + // The time the custom certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + // Domain validation errors that have been received by the certificate authority + // (CA). + ValidationErrors []ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationError `json:"validation_errors"` + ValidationRecords []ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationRecord `json:"validation_records"` + // Indicates whether the certificate covers a wildcard. + Wildcard bool `json:"wildcard"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSsl] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslJSON struct { + ID apijson.Field + BundleMethod apijson.Field + CertificateAuthority apijson.Field + CustomCertificate apijson.Field + CustomCsrID apijson.Field + CustomKey apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + Method apijson.Field + SerialNumber apijson.Field + Settings apijson.Field + Signature apijson.Field + Status apijson.Field + Type apijson.Field + UploadedOn apijson.Field + ValidationErrors apijson.Field + ValidationRecords apijson.Field + Wildcard apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethod string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethodUbiquitous ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethod = "ubiquitous" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethodOptimal ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethod = "optimal" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethodForce ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslBundleMethod = "force" +) + +// The Certificate Authority that will issue the certificate +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthority string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthorityDigicert ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthority = "digicert" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthorityGoogle ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthority = "google" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthorityLetsEncrypt ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslCertificateAuthority = "lets_encrypt" +) + +// Domain control validation (DCV) method used for this hostname. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethod string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethodHTTP ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethod = "http" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethodTxt ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethod = "txt" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethodEmail ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslMethod = "email" +) + +// SSL specific settings. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers []string `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsEarlyHints `json:"early_hints"` + // Whether or not HTTP2 is enabled. + Http2 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsHttp2 `json:"http2"` + // The minimum TLS version supported. + MinTlsVersion ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + Tls1_3 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsTls1_3 `json:"tls_1_3"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettings] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsJSON struct { + Ciphers apijson.Field + EarlyHints apijson.Field + Http2 apijson.Field + MinTlsVersion apijson.Field + Tls1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not Early Hints is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsEarlyHints string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsEarlyHintsOn ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsEarlyHints = "on" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsEarlyHintsOff ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsEarlyHints = "off" +) + +// Whether or not HTTP2 is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsHttp2 string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsHttp2On ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsHttp2 = "on" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsHttp2Off ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsHttp2 = "off" +) + +// The minimum TLS version supported. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion1_0 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion = "1.0" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion1_1 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion = "1.1" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion1_2 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion = "1.2" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion1_3 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsMinTlsVersion = "1.3" +) + +// Whether or not TLS 1.3 is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsTls1_3 string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsTls1_3On ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsTls1_3 = "on" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsTls1_3Off ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslSettingsTls1_3 = "off" +) + +// Status of the hostname's SSL certificates. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusInitializing ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "initializing" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusPendingValidation ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "pending_validation" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusDeleted ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "deleted" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusPendingIssuance ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "pending_issuance" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusPendingDeployment ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "pending_deployment" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusPendingDeletion ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "pending_deletion" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusPendingExpiration ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "pending_expiration" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusExpired ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "expired" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusActive ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "active" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusInitializingTimedOut ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "initializing_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusValidationTimedOut ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "validation_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusIssuanceTimedOut ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "issuance_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusDeploymentTimedOut ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "deployment_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusDeletionTimedOut ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "deletion_timed_out" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusPendingCleanup ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "pending_cleanup" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusStagingDeployment ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "staging_deployment" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusStagingActive ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "staging_active" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusDeactivating ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "deactivating" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusInactive ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "inactive" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusBackupIssued ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "backup_issued" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatusHoldingDeployment ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslStatus = "holding_deployment" +) + +// Level of validation to be used for this hostname. Domain validation (dv) must be +// used. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslType string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslTypeDv ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslType = "dv" +) + +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationError struct { + // A domain validation error. + Message string `json:"message"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationErrorJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationError] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate's required validation record. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationRecord struct { + // The set of email addresses that the certificate authority (CA) will use to + // complete domain validation. + Emails []interface{} `json:"emails"` + // The content that the certificate authority (CA) will expect to find at the + // http_url during the domain validation. + HTTPBody string `json:"http_body"` + // The url that will be checked during domain validation. + HTTPURL string `json:"http_url"` + // The hostname that the certificate authority (CA) will check for a TXT record + // during domain validation . + TxtName string `json:"txt_name"` + // The TXT record that the certificate authority (CA) will check during domain + // validation. + TxtValue string `json:"txt_value"` + JSON zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationRecordJSON `json:"-"` +} + +// zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationRecordJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationRecord] +type zoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationRecordJSON struct { + Emails apijson.Field + HTTPBody apijson.Field + HTTPURL apijson.Field + TxtName apijson.Field + TxtValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseSslValidationRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusActive ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "active" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusPending ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "pending" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusActiveRedeploying ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "active_redeploying" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusMoved ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "moved" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusPendingDeletion ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "pending_deletion" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusDeleted ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "deleted" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusPendingBlocked ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "pending_blocked" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusPendingMigration ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "pending_migration" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusPendingProvisioned ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "pending_provisioned" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusTestPending ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "test_pending" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusTestActive ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "test_active" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusTestActiveApex ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "test_active_apex" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusTestBlocked ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "test_blocked" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusTestFailed ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "test_failed" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusProvisioned ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "provisioned" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatusBlocked ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesResponseStatus = "blocked" +) + +type ZoneCustomHostnameUpdateParams struct { + // These are per-hostname (customer) settings. + CustomMetadata param.Field[ZoneCustomHostnameUpdateParamsCustomMetadata] `json:"custom_metadata"` + // a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME + // record. + CustomOriginServer param.Field[string] `json:"custom_origin_server"` + // A hostname that will be sent to your custom origin server as SNI for TLS + // handshake. This can be a valid subdomain of the zone or custom origin server + // name or the string ':request_host_header:' which will cause the host header in + // the request to be used as SNI. Not configurable with default/fallback origin + // server. + CustomOriginSni param.Field[string] `json:"custom_origin_sni"` + // SSL properties used when creating the custom hostname. + Ssl param.Field[ZoneCustomHostnameUpdateParamsSsl] `json:"ssl"` +} + +func (r ZoneCustomHostnameUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// These are per-hostname (customer) settings. +type ZoneCustomHostnameUpdateParamsCustomMetadata struct { + // Unique metadata for this hostname. + Key param.Field[string] `json:"key"` +} + +func (r ZoneCustomHostnameUpdateParamsCustomMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// SSL properties used when creating the custom hostname. +type ZoneCustomHostnameUpdateParamsSsl struct { + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod param.Field[ZoneCustomHostnameUpdateParamsSslBundleMethod] `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority param.Field[ZoneCustomHostnameUpdateParamsSslCertificateAuthority] `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate param.Field[string] `json:"custom_certificate"` + // The key for a custom uploaded certificate. + CustomKey param.Field[string] `json:"custom_key"` + // Domain control validation (DCV) method used for this hostname. + Method param.Field[ZoneCustomHostnameUpdateParamsSslMethod] `json:"method"` + // SSL specific settings. + Settings param.Field[ZoneCustomHostnameUpdateParamsSslSettings] `json:"settings"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type param.Field[ZoneCustomHostnameUpdateParamsSslType] `json:"type"` + // Indicates whether the certificate covers a wildcard. + Wildcard param.Field[bool] `json:"wildcard"` +} + +func (r ZoneCustomHostnameUpdateParamsSsl) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomHostnameUpdateParamsSslBundleMethod string + +const ( + ZoneCustomHostnameUpdateParamsSslBundleMethodUbiquitous ZoneCustomHostnameUpdateParamsSslBundleMethod = "ubiquitous" + ZoneCustomHostnameUpdateParamsSslBundleMethodOptimal ZoneCustomHostnameUpdateParamsSslBundleMethod = "optimal" + ZoneCustomHostnameUpdateParamsSslBundleMethodForce ZoneCustomHostnameUpdateParamsSslBundleMethod = "force" +) + +// The Certificate Authority that will issue the certificate +type ZoneCustomHostnameUpdateParamsSslCertificateAuthority string + +const ( + ZoneCustomHostnameUpdateParamsSslCertificateAuthorityDigicert ZoneCustomHostnameUpdateParamsSslCertificateAuthority = "digicert" + ZoneCustomHostnameUpdateParamsSslCertificateAuthorityGoogle ZoneCustomHostnameUpdateParamsSslCertificateAuthority = "google" + ZoneCustomHostnameUpdateParamsSslCertificateAuthorityLetsEncrypt ZoneCustomHostnameUpdateParamsSslCertificateAuthority = "lets_encrypt" +) + +// Domain control validation (DCV) method used for this hostname. +type ZoneCustomHostnameUpdateParamsSslMethod string + +const ( + ZoneCustomHostnameUpdateParamsSslMethodHTTP ZoneCustomHostnameUpdateParamsSslMethod = "http" + ZoneCustomHostnameUpdateParamsSslMethodTxt ZoneCustomHostnameUpdateParamsSslMethod = "txt" + ZoneCustomHostnameUpdateParamsSslMethodEmail ZoneCustomHostnameUpdateParamsSslMethod = "email" +) + +// SSL specific settings. +type ZoneCustomHostnameUpdateParamsSslSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers param.Field[[]string] `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints param.Field[ZoneCustomHostnameUpdateParamsSslSettingsEarlyHints] `json:"early_hints"` + // Whether or not HTTP2 is enabled. + Http2 param.Field[ZoneCustomHostnameUpdateParamsSslSettingsHttp2] `json:"http2"` + // The minimum TLS version supported. + MinTlsVersion param.Field[ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion] `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + Tls1_3 param.Field[ZoneCustomHostnameUpdateParamsSslSettingsTls1_3] `json:"tls_1_3"` +} + +func (r ZoneCustomHostnameUpdateParamsSslSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not Early Hints is enabled. +type ZoneCustomHostnameUpdateParamsSslSettingsEarlyHints string + +const ( + ZoneCustomHostnameUpdateParamsSslSettingsEarlyHintsOn ZoneCustomHostnameUpdateParamsSslSettingsEarlyHints = "on" + ZoneCustomHostnameUpdateParamsSslSettingsEarlyHintsOff ZoneCustomHostnameUpdateParamsSslSettingsEarlyHints = "off" +) + +// Whether or not HTTP2 is enabled. +type ZoneCustomHostnameUpdateParamsSslSettingsHttp2 string + +const ( + ZoneCustomHostnameUpdateParamsSslSettingsHttp2On ZoneCustomHostnameUpdateParamsSslSettingsHttp2 = "on" + ZoneCustomHostnameUpdateParamsSslSettingsHttp2Off ZoneCustomHostnameUpdateParamsSslSettingsHttp2 = "off" +) + +// The minimum TLS version supported. +type ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion string + +const ( + ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion1_0 ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion = "1.0" + ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion1_1 ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion = "1.1" + ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion1_2 ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion = "1.2" + ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion1_3 ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion = "1.3" +) + +// Whether or not TLS 1.3 is enabled. +type ZoneCustomHostnameUpdateParamsSslSettingsTls1_3 string + +const ( + ZoneCustomHostnameUpdateParamsSslSettingsTls1_3On ZoneCustomHostnameUpdateParamsSslSettingsTls1_3 = "on" + ZoneCustomHostnameUpdateParamsSslSettingsTls1_3Off ZoneCustomHostnameUpdateParamsSslSettingsTls1_3 = "off" +) + +// Level of validation to be used for this hostname. Domain validation (dv) must be +// used. +type ZoneCustomHostnameUpdateParamsSslType string + +const ( + ZoneCustomHostnameUpdateParamsSslTypeDv ZoneCustomHostnameUpdateParamsSslType = "dv" +) + +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParams struct { + // The custom hostname that will point to your hostname via CNAME. + Hostname param.Field[string] `json:"hostname,required"` + // SSL properties used when creating the custom hostname. + Ssl param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSsl] `json:"ssl,required"` + // These are per-hostname (customer) settings. + CustomMetadata param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsCustomMetadata] `json:"custom_metadata"` +} + +func (r ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// SSL properties used when creating the custom hostname. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSsl struct { + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethod] `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthority] `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate param.Field[string] `json:"custom_certificate"` + // The key for a custom uploaded certificate. + CustomKey param.Field[string] `json:"custom_key"` + // Domain control validation (DCV) method used for this hostname. + Method param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethod] `json:"method"` + // SSL specific settings. + Settings param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettings] `json:"settings"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslType] `json:"type"` + // Indicates whether the certificate covers a wildcard. + Wildcard param.Field[bool] `json:"wildcard"` +} + +func (r ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSsl) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethod string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethodUbiquitous ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethod = "ubiquitous" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethodOptimal ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethod = "optimal" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethodForce ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethod = "force" +) + +// The Certificate Authority that will issue the certificate +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthority string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthorityDigicert ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthority = "digicert" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthorityGoogle ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthority = "google" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthorityLetsEncrypt ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthority = "lets_encrypt" +) + +// Domain control validation (DCV) method used for this hostname. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethod string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethodHTTP ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethod = "http" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethodTxt ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethod = "txt" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethodEmail ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethod = "email" +) + +// SSL specific settings. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers param.Field[[]string] `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsEarlyHints] `json:"early_hints"` + // Whether or not HTTP2 is enabled. + Http2 param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsHttp2] `json:"http2"` + // The minimum TLS version supported. + MinTlsVersion param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion] `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + Tls1_3 param.Field[ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsTls1_3] `json:"tls_1_3"` +} + +func (r ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not Early Hints is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsEarlyHints string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsEarlyHintsOn ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsEarlyHints = "on" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsEarlyHintsOff ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsEarlyHints = "off" +) + +// Whether or not HTTP2 is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsHttp2 string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsHttp2On ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsHttp2 = "on" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsHttp2Off ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsHttp2 = "off" +) + +// The minimum TLS version supported. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion1_0 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion = "1.0" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion1_1 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion = "1.1" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion1_2 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion = "1.2" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion1_3 ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion = "1.3" +) + +// Whether or not TLS 1.3 is enabled. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsTls1_3 string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsTls1_3On ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsTls1_3 = "on" + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsTls1_3Off ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsTls1_3 = "off" +) + +// Level of validation to be used for this hostname. Domain validation (dv) must be +// used. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslType string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslTypeDv ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslType = "dv" +) + +// These are per-hostname (customer) settings. +type ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsCustomMetadata struct { + // Unique metadata for this hostname. + Key param.Field[string] `json:"key"` +} + +func (r ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsCustomMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParams struct { + // Hostname ID to match against. This ID was generated and returned during the + // initial custom_hostname creation. This parameter cannot be used with the + // 'hostname' parameter. + ID param.Field[string] `query:"id"` + // Direction to order hostnames. + Direction param.Field[ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsDirection] `query:"direction"` + // Fully qualified domain name to match against. This parameter cannot be used with + // the 'id' parameter. + Hostname param.Field[string] `query:"hostname"` + // Field to order hostnames by. + Order param.Field[ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of hostnames per page. + PerPage param.Field[float64] `query:"per_page"` + // Whether to filter hostnames based on if they have SSL enabled. + Ssl param.Field[ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsSsl] `query:"ssl"` +} + +// URLQuery serializes +// [ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParams]'s query +// parameters as `url.Values`. +func (r ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order hostnames. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsDirection string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsDirectionAsc ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsDirection = "asc" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsDirectionDesc ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsDirection = "desc" +) + +// Field to order hostnames by. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsOrder string + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsOrderSsl ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsOrder = "ssl" + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsOrderSslStatus ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsOrder = "ssl_status" +) + +// Whether to filter hostnames based on if they have SSL enabled. +type ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsSsl float64 + +const ( + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsSsl0 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsSsl = 0 + ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsSsl1 ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsSsl = 1 +) diff --git a/zonecustomhostname_test.go b/zonecustomhostname_test.go new file mode 100644 index 00000000000..ad6faeb2463 --- /dev/null +++ b/zonecustomhostname_test.go @@ -0,0 +1,216 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCustomHostnameGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneCustomHostnameUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomHostnameUpdateParams{ + CustomMetadata: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsCustomMetadata{ + Key: cloudflare.F("value"), + }), + CustomOriginServer: cloudflare.F("origin2.example.com"), + CustomOriginSni: cloudflare.F("sni.example.com"), + Ssl: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSsl{ + BundleMethod: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslBundleMethodUbiquitous), + CertificateAuthority: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslCertificateAuthorityGoogle), + CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), + CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), + Method: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslMethodHTTP), + Settings: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslSettings{ + Ciphers: cloudflare.F([]string{"ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"}), + EarlyHints: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslSettingsEarlyHintsOn), + Http2: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslSettingsHttp2On), + MinTlsVersion: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslSettingsMinTlsVersion1_2), + Tls1_3: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslSettingsTls1_3On), + }), + Type: cloudflare.F(cloudflare.ZoneCustomHostnameUpdateParamsSslTypeDv), + Wildcard: cloudflare.F(false), + }), + }, + ) + 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 TestZoneCustomHostnameDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.CustomHostnameForAZoneNewCustomHostname( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParams{ + Hostname: cloudflare.F("app.example.com"), + Ssl: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSsl{ + BundleMethod: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslBundleMethodUbiquitous), + CertificateAuthority: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslCertificateAuthorityGoogle), + CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), + CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), + Method: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslMethodHTTP), + Settings: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettings{ + Ciphers: cloudflare.F([]string{"ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"}), + EarlyHints: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsEarlyHintsOn), + Http2: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsHttp2On), + MinTlsVersion: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsMinTlsVersion1_2), + Tls1_3: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslSettingsTls1_3On), + }), + Type: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsSslTypeDv), + Wildcard: cloudflare.F(false), + }), + CustomMetadata: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneNewCustomHostnameParamsCustomMetadata{ + Key: cloudflare.F("value"), + }), + }, + ) + 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 TestZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.CustomHostnameForAZoneListCustomHostnames( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParams{ + ID: cloudflare.F("0d89c70d-ad9f-4843-b99f-6cc0252067e9"), + Direction: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsDirectionDesc), + Hostname: cloudflare.F("app.example.com"), + Order: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsOrderSsl), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Ssl: cloudflare.F(cloudflare.ZoneCustomHostnameCustomHostnameForAZoneListCustomHostnamesParamsSsl0), + }, + ) + 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/zonecustomhostnamefallbackorigin.go b/zonecustomhostnamefallbackorigin.go new file mode 100644 index 00000000000..02f7e3bfef8 --- /dev/null +++ b/zonecustomhostnamefallbackorigin.go @@ -0,0 +1,278 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCustomHostnameFallbackOriginService 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 +// [NewZoneCustomHostnameFallbackOriginService] method instead. +type ZoneCustomHostnameFallbackOriginService struct { + Options []option.RequestOption +} + +// NewZoneCustomHostnameFallbackOriginService 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 NewZoneCustomHostnameFallbackOriginService(opts ...option.RequestOption) (r *ZoneCustomHostnameFallbackOriginService) { + r = &ZoneCustomHostnameFallbackOriginService{} + r.Options = opts + return +} + +// Delete Fallback Origin for Custom Hostnames +func (r *ZoneCustomHostnameFallbackOriginService) Delete(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCustomHostnameFallbackOriginDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Get Fallback Origin for Custom Hostnames +func (r *ZoneCustomHostnameFallbackOriginService) CustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnames(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update Fallback Origin for Custom Hostnames +func (r *ZoneCustomHostnameFallbackOriginService) CustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnames(ctx context.Context, zoneIdentifier string, body ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesParams, opts ...option.RequestOption) (res *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneCustomHostnameFallbackOriginDeleteResponse struct { + Errors []ZoneCustomHostnameFallbackOriginDeleteResponseError `json:"errors"` + Messages []ZoneCustomHostnameFallbackOriginDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomHostnameFallbackOriginDeleteResponseSuccess `json:"success"` + JSON zoneCustomHostnameFallbackOriginDeleteResponseJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginDeleteResponseJSON contains the JSON metadata +// for the struct [ZoneCustomHostnameFallbackOriginDeleteResponse] +type zoneCustomHostnameFallbackOriginDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameFallbackOriginDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameFallbackOriginDeleteResponseErrorJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginDeleteResponseErrorJSON contains the JSON +// metadata for the struct [ZoneCustomHostnameFallbackOriginDeleteResponseError] +type zoneCustomHostnameFallbackOriginDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameFallbackOriginDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameFallbackOriginDeleteResponseMessageJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginDeleteResponseMessageJSON contains the JSON +// metadata for the struct [ZoneCustomHostnameFallbackOriginDeleteResponseMessage] +type zoneCustomHostnameFallbackOriginDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomHostnameFallbackOriginDeleteResponseSuccess bool + +const ( + ZoneCustomHostnameFallbackOriginDeleteResponseSuccessTrue ZoneCustomHostnameFallbackOriginDeleteResponseSuccess = true +) + +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponse struct { + Errors []ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseError `json:"errors"` + Messages []ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseSuccess `json:"success"` + JSON zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponse] +type zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseErrorJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseError] +type zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseMessageJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseMessage] +type zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseSuccess bool + +const ( + ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseSuccessTrue ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnamesResponseSuccess = true +) + +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponse struct { + Errors []ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseError `json:"errors"` + Messages []ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseSuccess `json:"success"` + JSON zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponse] +type zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseErrorJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseError] +type zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseMessageJSON `json:"-"` +} + +// zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseMessage] +type zoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseSuccess bool + +const ( + ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseSuccessTrue ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesResponseSuccess = true +) + +type ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesParams struct { + // Your origin hostname that requests to your custom hostnames will be sent to. + Origin param.Field[string] `json:"origin,required"` +} + +func (r ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonecustomhostnamefallbackorigin_test.go b/zonecustomhostnamefallbackorigin_test.go new file mode 100644 index 00000000000..3cb714f2f17 --- /dev/null +++ b/zonecustomhostnamefallbackorigin_test.go @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCustomHostnameFallbackOriginDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.FallbackOrigins.Delete(context.TODO(), "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()) + } +} + +func TestZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnames(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.FallbackOrigins.CustomHostnameFallbackOriginForAZoneGetFallbackOriginForCustomHostnames(context.TODO(), "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()) + } +} + +func TestZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnames(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomHostnames.FallbackOrigins.CustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnames( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomHostnameFallbackOriginCustomHostnameFallbackOriginForAZoneUpdateFallbackOriginForCustomHostnamesParams{ + Origin: cloudflare.F("fallback.example.com"), + }, + ) + 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/zonecustomn.go b/zonecustomn.go new file mode 100644 index 00000000000..183f9b396f1 --- /dev/null +++ b/zonecustomn.go @@ -0,0 +1,273 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCustomNService 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 [NewZoneCustomNService] method +// instead. +type ZoneCustomNService struct { + Options []option.RequestOption +} + +// NewZoneCustomNService 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 NewZoneCustomNService(opts ...option.RequestOption) (r *ZoneCustomNService) { + r = &ZoneCustomNService{} + r.Options = opts + return +} + +// Get metadata for account-level custom nameservers on a zone. +func (r *ZoneCustomNService) AccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadata(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_ns", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Set metadata for account-level custom nameservers on a zone. +// +// If you would like new zones in the account to use account custom nameservers by +// default, use PUT /accounts/:identifier to set the account setting +// use_account_custom_ns_by_default to true. +func (r *ZoneCustomNService) AccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadata(ctx context.Context, zoneIdentifier string, body ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataParams, opts ...option.RequestOption) (res *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_ns", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponse struct { + // Whether zone uses account-level custom nameservers. + Enabled bool `json:"enabled"` + Errors []ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseError `json:"errors"` + Messages []ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseMessage `json:"messages"` + // The number of the name server set to assign to the zone. + NsSet float64 `json:"ns_set"` + Result []interface{} `json:"result,nullable"` + ResultInfo ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseSuccess `json:"success"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponse] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseJSON struct { + Enabled apijson.Field + Errors apijson.Field + Messages apijson.Field + NsSet apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseErrorJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseError] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseMessageJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseMessage] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseResultInfoJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseSuccess bool + +const ( + ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseSuccessTrue ZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadataResponseSuccess = true +) + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponse struct { + Errors []ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseError `json:"errors"` + Messages []ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseSuccess `json:"success"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponse] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseErrorJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseError] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseMessageJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseMessage] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseResultInfoJSON `json:"-"` +} + +// zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo] +type zoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseSuccess bool + +const ( + ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseSuccessTrue ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataResponseSuccess = true +) + +type ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataParams struct { + // Whether zone uses account-level custom nameservers. + Enabled param.Field[bool] `json:"enabled"` + // The number of the name server set to assign to the zone. + NsSet param.Field[float64] `json:"ns_set"` +} + +func (r ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonecustomn_test.go b/zonecustomn_test.go new file mode 100644 index 00000000000..ae9557c3ac4 --- /dev/null +++ b/zonecustomn_test.go @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCustomNAccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadata(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomNs.AccountLevelCustomNameserversUsageForAZoneGetAccountCustomNameserverRelatedZoneMetadata(context.TODO(), "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()) + } +} + +func TestZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomNs.AccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadata( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomNAccountLevelCustomNameserversUsageForAZoneSetAccountCustomNameserverRelatedZoneMetadataParams{ + Enabled: cloudflare.F(true), + NsSet: cloudflare.F(1.000000), + }, + ) + 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/zonecustompage.go b/zonecustompage.go new file mode 100644 index 00000000000..071c4e30e0a --- /dev/null +++ b/zonecustompage.go @@ -0,0 +1,315 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneCustomPageService 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 [NewZoneCustomPageService] method +// instead. +type ZoneCustomPageService struct { + Options []option.RequestOption +} + +// NewZoneCustomPageService 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 NewZoneCustomPageService(opts ...option.RequestOption) (r *ZoneCustomPageService) { + r = &ZoneCustomPageService{} + r.Options = opts + return +} + +// Fetches the details of a custom page. +func (r *ZoneCustomPageService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneCustomPageGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_pages/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the configuration of an existing custom page. +func (r *ZoneCustomPageService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneCustomPageUpdateParams, opts ...option.RequestOption) (res *ZoneCustomPageUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_pages/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Fetches all the custom pages at the zone level. +func (r *ZoneCustomPageService) CustomPagesForAZoneListCustomPages(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneCustomPageCustomPagesForAZoneListCustomPagesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/custom_pages", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneCustomPageGetResponse struct { + Errors []ZoneCustomPageGetResponseError `json:"errors"` + Messages []ZoneCustomPageGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomPageGetResponseSuccess `json:"success"` + JSON zoneCustomPageGetResponseJSON `json:"-"` +} + +// zoneCustomPageGetResponseJSON contains the JSON metadata for the struct +// [ZoneCustomPageGetResponse] +type zoneCustomPageGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomPageGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomPageGetResponseErrorJSON `json:"-"` +} + +// zoneCustomPageGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneCustomPageGetResponseError] +type zoneCustomPageGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomPageGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomPageGetResponseMessageJSON `json:"-"` +} + +// zoneCustomPageGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneCustomPageGetResponseMessage] +type zoneCustomPageGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomPageGetResponseSuccess bool + +const ( + ZoneCustomPageGetResponseSuccessTrue ZoneCustomPageGetResponseSuccess = true +) + +type ZoneCustomPageUpdateResponse struct { + Errors []ZoneCustomPageUpdateResponseError `json:"errors"` + Messages []ZoneCustomPageUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneCustomPageUpdateResponseSuccess `json:"success"` + JSON zoneCustomPageUpdateResponseJSON `json:"-"` +} + +// zoneCustomPageUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneCustomPageUpdateResponse] +type zoneCustomPageUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomPageUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomPageUpdateResponseErrorJSON `json:"-"` +} + +// zoneCustomPageUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneCustomPageUpdateResponseError] +type zoneCustomPageUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomPageUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomPageUpdateResponseMessageJSON `json:"-"` +} + +// zoneCustomPageUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneCustomPageUpdateResponseMessage] +type zoneCustomPageUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomPageUpdateResponseSuccess bool + +const ( + ZoneCustomPageUpdateResponseSuccessTrue ZoneCustomPageUpdateResponseSuccess = true +) + +type ZoneCustomPageCustomPagesForAZoneListCustomPagesResponse struct { + Errors []ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseError `json:"errors"` + Messages []ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseSuccess `json:"success"` + JSON zoneCustomPageCustomPagesForAZoneListCustomPagesResponseJSON `json:"-"` +} + +// zoneCustomPageCustomPagesForAZoneListCustomPagesResponseJSON contains the JSON +// metadata for the struct +// [ZoneCustomPageCustomPagesForAZoneListCustomPagesResponse] +type zoneCustomPageCustomPagesForAZoneListCustomPagesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageCustomPagesForAZoneListCustomPagesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomPageCustomPagesForAZoneListCustomPagesResponseErrorJSON `json:"-"` +} + +// zoneCustomPageCustomPagesForAZoneListCustomPagesResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseError] +type zoneCustomPageCustomPagesForAZoneListCustomPagesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneCustomPageCustomPagesForAZoneListCustomPagesResponseMessageJSON `json:"-"` +} + +// zoneCustomPageCustomPagesForAZoneListCustomPagesResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseMessage] +type zoneCustomPageCustomPagesForAZoneListCustomPagesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneCustomPageCustomPagesForAZoneListCustomPagesResponseResultInfoJSON `json:"-"` +} + +// zoneCustomPageCustomPagesForAZoneListCustomPagesResponseResultInfoJSON contains +// the JSON metadata for the struct +// [ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseResultInfo] +type zoneCustomPageCustomPagesForAZoneListCustomPagesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseSuccess bool + +const ( + ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseSuccessTrue ZoneCustomPageCustomPagesForAZoneListCustomPagesResponseSuccess = true +) + +type ZoneCustomPageUpdateParams struct { + // The custom page state. + State param.Field[ZoneCustomPageUpdateParamsState] `json:"state,required"` + // The URL associated with the custom page. + URL param.Field[string] `json:"url,required" format:"uri"` +} + +func (r ZoneCustomPageUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The custom page state. +type ZoneCustomPageUpdateParamsState string + +const ( + ZoneCustomPageUpdateParamsStateDefault ZoneCustomPageUpdateParamsState = "default" + ZoneCustomPageUpdateParamsStateCustomized ZoneCustomPageUpdateParamsState = "customized" +) diff --git a/zonecustompage_test.go b/zonecustompage_test.go new file mode 100644 index 00000000000..4ccb8678425 --- /dev/null +++ b/zonecustompage_test.go @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneCustomPageGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomPages.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneCustomPageUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomPages.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneCustomPageUpdateParams{ + State: cloudflare.F(cloudflare.ZoneCustomPageUpdateParamsStateDefault), + URL: cloudflare.F("http://www.example.com"), + }, + ) + 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 TestZoneCustomPageCustomPagesForAZoneListCustomPages(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.CustomPages.CustomPagesForAZoneListCustomPages(context.TODO(), "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/zonedcvdelegation.go b/zonedcvdelegation.go new file mode 100644 index 00000000000..c2d959690d7 --- /dev/null +++ b/zonedcvdelegation.go @@ -0,0 +1,127 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneDcvDelegationService 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 [NewZoneDcvDelegationService] method +// instead. +type ZoneDcvDelegationService struct { + Options []option.RequestOption +} + +// NewZoneDcvDelegationService 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 NewZoneDcvDelegationService(opts ...option.RequestOption) (r *ZoneDcvDelegationService) { + r = &ZoneDcvDelegationService{} + r.Options = opts + return +} + +// Retrieve the account and zone specific unique identifier used as part of the +// CNAME target for DCV Delegation. +func (r *ZoneDcvDelegationService) Uuid(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneDcvDelegationUuidResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dcv_delegation/uuid", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneDcvDelegationUuidResponse struct { + Errors []ZoneDcvDelegationUuidResponseError `json:"errors"` + Messages []ZoneDcvDelegationUuidResponseMessage `json:"messages"` + Result ZoneDcvDelegationUuidResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneDcvDelegationUuidResponseSuccess `json:"success"` + JSON zoneDcvDelegationUuidResponseJSON `json:"-"` +} + +// zoneDcvDelegationUuidResponseJSON contains the JSON metadata for the struct +// [ZoneDcvDelegationUuidResponse] +type zoneDcvDelegationUuidResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDcvDelegationUuidResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDcvDelegationUuidResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDcvDelegationUuidResponseErrorJSON `json:"-"` +} + +// zoneDcvDelegationUuidResponseErrorJSON contains the JSON metadata for the struct +// [ZoneDcvDelegationUuidResponseError] +type zoneDcvDelegationUuidResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDcvDelegationUuidResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDcvDelegationUuidResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDcvDelegationUuidResponseMessageJSON `json:"-"` +} + +// zoneDcvDelegationUuidResponseMessageJSON contains the JSON metadata for the +// struct [ZoneDcvDelegationUuidResponseMessage] +type zoneDcvDelegationUuidResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDcvDelegationUuidResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDcvDelegationUuidResponseResult struct { + // The DCV Delegation unique identifier. + Uuid string `json:"uuid"` + JSON zoneDcvDelegationUuidResponseResultJSON `json:"-"` +} + +// zoneDcvDelegationUuidResponseResultJSON contains the JSON metadata for the +// struct [ZoneDcvDelegationUuidResponseResult] +type zoneDcvDelegationUuidResponseResultJSON struct { + Uuid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDcvDelegationUuidResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneDcvDelegationUuidResponseSuccess bool + +const ( + ZoneDcvDelegationUuidResponseSuccessTrue ZoneDcvDelegationUuidResponseSuccess = true +) diff --git a/aimicrosoft_test.go b/zonedcvdelegation_test.go similarity index 67% rename from aimicrosoft_test.go rename to zonedcvdelegation_test.go index aa8434aaa6b..79565f868fc 100644 --- a/aimicrosoft_test.go +++ b/zonedcvdelegation_test.go @@ -13,7 +13,8 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAIMicrosoftResnet50(t *testing.T) { +func TestZoneDcvDelegationUuid(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 @@ -23,10 +24,12 @@ func TestAIMicrosoftResnet50(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Microsoft.Resnet50(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.Zones.DcvDelegations.Uuid(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { diff --git a/zonednsanalytic.go b/zonednsanalytic.go new file mode 100644 index 00000000000..7f3034d7461 --- /dev/null +++ b/zonednsanalytic.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneDNSAnalyticService 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 [NewZoneDNSAnalyticService] method +// instead. +type ZoneDNSAnalyticService struct { + Options []option.RequestOption + Reports *ZoneDNSAnalyticReportService +} + +// NewZoneDNSAnalyticService 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 NewZoneDNSAnalyticService(opts ...option.RequestOption) (r *ZoneDNSAnalyticService) { + r = &ZoneDNSAnalyticService{} + r.Options = opts + r.Reports = NewZoneDNSAnalyticReportService(opts...) + return +} diff --git a/zonednsanalyticreport.go b/zonednsanalyticreport.go new file mode 100644 index 00000000000..232882e48d7 --- /dev/null +++ b/zonednsanalyticreport.go @@ -0,0 +1,238 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneDNSAnalyticReportService 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 [NewZoneDNSAnalyticReportService] +// method instead. +type ZoneDNSAnalyticReportService struct { + Options []option.RequestOption + Bytimes *ZoneDNSAnalyticReportBytimeService +} + +// NewZoneDNSAnalyticReportService 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 NewZoneDNSAnalyticReportService(opts ...option.RequestOption) (r *ZoneDNSAnalyticReportService) { + r = &ZoneDNSAnalyticReportService{} + r.Options = opts + r.Bytimes = NewZoneDNSAnalyticReportBytimeService(opts...) + return +} + +// Retrieves a list of summarised aggregate metrics over a given time period. +// +// See +// [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) +// for detailed information about the available query parameters. +func (r *ZoneDNSAnalyticReportService) List(ctx context.Context, identifier string, query ZoneDNSAnalyticReportListParams, opts ...option.RequestOption) (res *ZoneDNSAnalyticReportListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_analytics/report", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneDNSAnalyticReportListResponse struct { + Errors []ZoneDNSAnalyticReportListResponseError `json:"errors"` + Messages []ZoneDNSAnalyticReportListResponseMessage `json:"messages"` + Result ZoneDNSAnalyticReportListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneDNSAnalyticReportListResponseSuccess `json:"success"` + JSON zoneDNSAnalyticReportListResponseJSON `json:"-"` +} + +// zoneDNSAnalyticReportListResponseJSON contains the JSON metadata for the struct +// [ZoneDNSAnalyticReportListResponse] +type zoneDNSAnalyticReportListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSAnalyticReportListResponseErrorJSON `json:"-"` +} + +// zoneDNSAnalyticReportListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneDNSAnalyticReportListResponseError] +type zoneDNSAnalyticReportListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSAnalyticReportListResponseMessageJSON `json:"-"` +} + +// zoneDNSAnalyticReportListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneDNSAnalyticReportListResponseMessage] +type zoneDNSAnalyticReportListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportListResponseResult struct { + Data []ZoneDNSAnalyticReportListResponseResultData `json:"data"` + // Number of seconds between current time and last processed event, in another + // words how many seconds of data could be missing. + DataLag float64 `json:"data_lag"` + // Maximum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Max interface{} `json:"max"` + // Minimum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Min interface{} `json:"min"` + Query ZoneDNSAnalyticReportListResponseResultQuery `json:"query"` + // Total number of rows in the result. + Rows float64 `json:"rows"` + // Total results for metrics across all data (object mapping metric names to + // values). + Totals interface{} `json:"totals"` + JSON zoneDNSAnalyticReportListResponseResultJSON `json:"-"` +} + +// zoneDNSAnalyticReportListResponseResultJSON contains the JSON metadata for the +// struct [ZoneDNSAnalyticReportListResponseResult] +type zoneDNSAnalyticReportListResponseResultJSON struct { + Data apijson.Field + DataLag apijson.Field + Max apijson.Field + Min apijson.Field + Query apijson.Field + Rows apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportListResponseResultData struct { + // Array with one item per requested metric. Each item is a single value. + Metrics []float64 `json:"metrics,required"` + JSON zoneDNSAnalyticReportListResponseResultDataJSON `json:"-"` +} + +// zoneDNSAnalyticReportListResponseResultDataJSON contains the JSON metadata for +// the struct [ZoneDNSAnalyticReportListResponseResultData] +type zoneDNSAnalyticReportListResponseResultDataJSON struct { + Metrics apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportListResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportListResponseResultQuery struct { + // Array of dimension names. + Dimensions []string `json:"dimensions,required"` + // Limit number of returned metrics. + Limit int64 `json:"limit,required"` + // Array of metric names. + Metrics []string `json:"metrics,required"` + // Start date and time of requesting data period in ISO 8601 format. + Since time.Time `json:"since,required" format:"date-time"` + // End date and time of requesting data period in ISO 8601 format. + Until time.Time `json:"until,required" format:"date-time"` + // Segmentation filter in 'attribute operator value' format. + Filters string `json:"filters"` + // Array of dimensions to sort by, where each dimension may be prefixed by - + // (descending) or + (ascending). + Sort []string `json:"sort"` + JSON zoneDNSAnalyticReportListResponseResultQueryJSON `json:"-"` +} + +// zoneDNSAnalyticReportListResponseResultQueryJSON contains the JSON metadata for +// the struct [ZoneDNSAnalyticReportListResponseResultQuery] +type zoneDNSAnalyticReportListResponseResultQueryJSON struct { + Dimensions apijson.Field + Limit apijson.Field + Metrics apijson.Field + Since apijson.Field + Until apijson.Field + Filters apijson.Field + Sort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportListResponseResultQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneDNSAnalyticReportListResponseSuccess bool + +const ( + ZoneDNSAnalyticReportListResponseSuccessTrue ZoneDNSAnalyticReportListResponseSuccess = true +) + +type ZoneDNSAnalyticReportListParams struct { + // A comma-separated list of dimensions to group results by. + Dimensions param.Field[string] `query:"dimensions"` + // Segmentation filter in 'attribute operator value' format. + Filters param.Field[string] `query:"filters"` + // Limit number of returned metrics. + Limit param.Field[int64] `query:"limit"` + // A comma-separated list of metrics to query. + Metrics param.Field[string] `query:"metrics"` + // Start date and time of requesting data period in ISO 8601 format. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // A comma-separated list of dimensions to sort by, where each dimension may be + // prefixed by - (descending) or + (ascending). + Sort param.Field[string] `query:"sort"` + // End date and time of requesting data period in ISO 8601 format. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes [ZoneDNSAnalyticReportListParams]'s query parameters as +// `url.Values`. +func (r ZoneDNSAnalyticReportListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zonednsanalyticreport_test.go b/zonednsanalyticreport_test.go new file mode 100644 index 00000000000..33eb824530e --- /dev/null +++ b/zonednsanalyticreport_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneDNSAnalyticReportListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSAnalytics.Reports.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneDNSAnalyticReportListParams{ + Dimensions: cloudflare.F("queryType"), + Filters: cloudflare.F("responseCode==NOERROR,queryType==A"), + Limit: cloudflare.F(int64(100)), + Metrics: cloudflare.F("queryCount,uncachedCount"), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F("+responseCode,-queryName"), + Until: cloudflare.F(time.Now()), + }, + ) + 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/zonednsanalyticreportbytime.go b/zonednsanalyticreportbytime.go new file mode 100644 index 00000000000..320cb457bd9 --- /dev/null +++ b/zonednsanalyticreportbytime.go @@ -0,0 +1,256 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneDNSAnalyticReportBytimeService 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 +// [NewZoneDNSAnalyticReportBytimeService] method instead. +type ZoneDNSAnalyticReportBytimeService struct { + Options []option.RequestOption +} + +// NewZoneDNSAnalyticReportBytimeService 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 NewZoneDNSAnalyticReportBytimeService(opts ...option.RequestOption) (r *ZoneDNSAnalyticReportBytimeService) { + r = &ZoneDNSAnalyticReportBytimeService{} + r.Options = opts + return +} + +// Retrieves a list of aggregate metrics grouped by time interval. +// +// See +// [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) +// for detailed information about the available query parameters. +func (r *ZoneDNSAnalyticReportBytimeService) List(ctx context.Context, identifier string, query ZoneDNSAnalyticReportBytimeListParams, opts ...option.RequestOption) (res *ZoneDNSAnalyticReportBytimeListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_analytics/report/bytime", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneDNSAnalyticReportBytimeListResponse struct { + Errors []ZoneDNSAnalyticReportBytimeListResponseError `json:"errors"` + Messages []ZoneDNSAnalyticReportBytimeListResponseMessage `json:"messages"` + Result ZoneDNSAnalyticReportBytimeListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneDNSAnalyticReportBytimeListResponseSuccess `json:"success"` + JSON zoneDNSAnalyticReportBytimeListResponseJSON `json:"-"` +} + +// zoneDNSAnalyticReportBytimeListResponseJSON contains the JSON metadata for the +// struct [ZoneDNSAnalyticReportBytimeListResponse] +type zoneDNSAnalyticReportBytimeListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportBytimeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportBytimeListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSAnalyticReportBytimeListResponseErrorJSON `json:"-"` +} + +// zoneDNSAnalyticReportBytimeListResponseErrorJSON contains the JSON metadata for +// the struct [ZoneDNSAnalyticReportBytimeListResponseError] +type zoneDNSAnalyticReportBytimeListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportBytimeListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportBytimeListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSAnalyticReportBytimeListResponseMessageJSON `json:"-"` +} + +// zoneDNSAnalyticReportBytimeListResponseMessageJSON contains the JSON metadata +// for the struct [ZoneDNSAnalyticReportBytimeListResponseMessage] +type zoneDNSAnalyticReportBytimeListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportBytimeListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportBytimeListResponseResult struct { + Data []ZoneDNSAnalyticReportBytimeListResponseResultData `json:"data"` + // Number of seconds between current time and last processed event, in another + // words how many seconds of data could be missing. + DataLag float64 `json:"data_lag"` + // Maximum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Max interface{} `json:"max"` + // Minimum results for each metric (object mapping metric names to values). + // Currently always an empty object. + Min interface{} `json:"min"` + Query ZoneDNSAnalyticReportBytimeListResponseResultQuery `json:"query"` + // Total number of rows in the result. + Rows float64 `json:"rows"` + // Array of time intervals in the response data. Each interval is represented as an + // array containing two values: the start time, and the end time. + TimeIntervals [][]time.Time `json:"time_intervals" format:"date-time"` + // Total results for metrics across all data (object mapping metric names to + // values). + Totals interface{} `json:"totals"` + JSON zoneDNSAnalyticReportBytimeListResponseResultJSON `json:"-"` +} + +// zoneDNSAnalyticReportBytimeListResponseResultJSON contains the JSON metadata for +// the struct [ZoneDNSAnalyticReportBytimeListResponseResult] +type zoneDNSAnalyticReportBytimeListResponseResultJSON struct { + Data apijson.Field + DataLag apijson.Field + Max apijson.Field + Min apijson.Field + Query apijson.Field + Rows apijson.Field + TimeIntervals apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportBytimeListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportBytimeListResponseResultData struct { + // Array with one item per requested metric. Each item is an array of values, + // broken down by time interval. + Metrics [][]interface{} `json:"metrics,required"` + JSON zoneDNSAnalyticReportBytimeListResponseResultDataJSON `json:"-"` +} + +// zoneDNSAnalyticReportBytimeListResponseResultDataJSON contains the JSON metadata +// for the struct [ZoneDNSAnalyticReportBytimeListResponseResultData] +type zoneDNSAnalyticReportBytimeListResponseResultDataJSON struct { + Metrics apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportBytimeListResponseResultData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSAnalyticReportBytimeListResponseResultQuery struct { + // Unit of time to group data by. + TimeDelta ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta `json:"time_delta,required"` + JSON zoneDNSAnalyticReportBytimeListResponseResultQueryJSON `json:"-"` +} + +// zoneDNSAnalyticReportBytimeListResponseResultQueryJSON contains the JSON +// metadata for the struct [ZoneDNSAnalyticReportBytimeListResponseResultQuery] +type zoneDNSAnalyticReportBytimeListResponseResultQueryJSON struct { + TimeDelta apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSAnalyticReportBytimeListResponseResultQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Unit of time to group data by. +type ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta string + +const ( + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaAll ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "all" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaAuto ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "auto" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaYear ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "year" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaQuarter ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "quarter" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaMonth ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "month" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaWeek ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "week" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaDay ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "day" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaHour ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "hour" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaDekaminute ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "dekaminute" + ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDeltaMinute ZoneDNSAnalyticReportBytimeListResponseResultQueryTimeDelta = "minute" +) + +// Whether the API call was successful +type ZoneDNSAnalyticReportBytimeListResponseSuccess bool + +const ( + ZoneDNSAnalyticReportBytimeListResponseSuccessTrue ZoneDNSAnalyticReportBytimeListResponseSuccess = true +) + +type ZoneDNSAnalyticReportBytimeListParams struct { + // A comma-separated list of dimensions to group results by. + Dimensions param.Field[string] `query:"dimensions"` + // Segmentation filter in 'attribute operator value' format. + Filters param.Field[string] `query:"filters"` + // Limit number of returned metrics. + Limit param.Field[int64] `query:"limit"` + // A comma-separated list of metrics to query. + Metrics param.Field[string] `query:"metrics"` + // Start date and time of requesting data period in ISO 8601 format. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // A comma-separated list of dimensions to sort by, where each dimension may be + // prefixed by - (descending) or + (ascending). + Sort param.Field[string] `query:"sort"` + // Unit of time to group data by. + TimeDelta param.Field[ZoneDNSAnalyticReportBytimeListParamsTimeDelta] `query:"time_delta"` + // End date and time of requesting data period in ISO 8601 format. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes [ZoneDNSAnalyticReportBytimeListParams]'s query parameters +// as `url.Values`. +func (r ZoneDNSAnalyticReportBytimeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Unit of time to group data by. +type ZoneDNSAnalyticReportBytimeListParamsTimeDelta string + +const ( + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaAll ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "all" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaAuto ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "auto" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaYear ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "year" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaQuarter ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "quarter" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaMonth ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "month" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaWeek ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "week" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaDay ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "day" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaHour ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "hour" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaDekaminute ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "dekaminute" + ZoneDNSAnalyticReportBytimeListParamsTimeDeltaMinute ZoneDNSAnalyticReportBytimeListParamsTimeDelta = "minute" +) diff --git a/zonednsanalyticreportbytime_test.go b/zonednsanalyticreportbytime_test.go new file mode 100644 index 00000000000..291aaac7817 --- /dev/null +++ b/zonednsanalyticreportbytime_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneDNSAnalyticReportBytimeListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSAnalytics.Reports.Bytimes.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneDNSAnalyticReportBytimeListParams{ + Dimensions: cloudflare.F("queryType"), + Filters: cloudflare.F("responseCode==NOERROR,queryType==A"), + Limit: cloudflare.F(int64(100)), + Metrics: cloudflare.F("queryCount,uncachedCount"), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F("+responseCode,-queryName"), + TimeDelta: cloudflare.F(cloudflare.ZoneDNSAnalyticReportBytimeListParamsTimeDeltaHour), + Until: cloudflare.F(time.Now()), + }, + ) + 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/zonednsrecord.go b/zonednsrecord.go new file mode 100644 index 00000000000..09af7828bd1 --- /dev/null +++ b/zonednsrecord.go @@ -0,0 +1,10093 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneDNSRecordService 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 [NewZoneDNSRecordService] method +// instead. +type ZoneDNSRecordService struct { + Options []option.RequestOption + Exports *ZoneDNSRecordExportService + Imports *ZoneDNSRecordImportService + Scans *ZoneDNSRecordScanService +} + +// NewZoneDNSRecordService 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 NewZoneDNSRecordService(opts ...option.RequestOption) (r *ZoneDNSRecordService) { + r = &ZoneDNSRecordService{} + r.Options = opts + r.Exports = NewZoneDNSRecordExportService(opts...) + r.Imports = NewZoneDNSRecordImportService(opts...) + r.Scans = NewZoneDNSRecordScanService(opts...) + return +} + +// DNS Record Details +func (r *ZoneDNSRecordService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *DNSRecord, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_records/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update an existing DNS record. +// +// Notes: +// +// - A/AAAA records cannot exist on the same name as CNAME records. +// - NS records cannot exist on the same name as any other record type. +// - Domain names are always represented in Punycode, even if Unicode characters +// were used when creating the record. +func (r *ZoneDNSRecordService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneDNSRecordUpdateParams, opts ...option.RequestOption) (res *DNSRecord, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_records/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete DNS Record +func (r *ZoneDNSRecordService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneDNSRecordDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_records/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new DNS record for a zone. +// +// Notes: +// +// - A/AAAA records cannot exist on the same name as CNAME records. +// - NS records cannot exist on the same name as any other record type. +// - Domain names are always represented in Punycode, even if Unicode characters +// were used when creating the record. +func (r *ZoneDNSRecordService) DNSRecordsForAZoneNewDNSRecord(ctx context.Context, zoneIdentifier string, body ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams, opts ...option.RequestOption) (res *DNSRecord, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_records", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List, search, sort, and filter a zones' DNS records. +func (r *ZoneDNSRecordService) DNSRecordsForAZoneListDNSRecords(ctx context.Context, zoneIdentifier string, query ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParams, opts ...option.RequestOption) (res *shared.Page[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/dns_records", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Patch DNS Record +func (r *ZoneDNSRecordService) Patch(ctx context.Context, zoneIdentifier string, identifier string, body ZoneDNSRecordPatchParams, opts ...option.RequestOption) (res *DNSRecord, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_records/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type DNSRecord struct { + Errors []DNSRecordError `json:"errors"` + Messages []DNSRecordMessage `json:"messages"` + Result DNSRecordResult `json:"result"` + // Whether the API call was successful + Success DNSRecordSuccess `json:"success"` + JSON dnsRecordJSON `json:"-"` +} + +// dnsRecordJSON contains the JSON metadata for the struct [DNSRecord] +type dnsRecordJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DNSRecordError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dnsRecordErrorJSON `json:"-"` +} + +// dnsRecordErrorJSON contains the JSON metadata for the struct [DNSRecordError] +type dnsRecordErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DNSRecordMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dnsRecordMessageJSON `json:"-"` +} + +// dnsRecordMessageJSON contains the JSON metadata for the struct +// [DNSRecordMessage] +type dnsRecordMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [DNSRecordResultMpBuiT95ARecord], +// [DNSRecordResultMpBuiT95AaaaRecord], [DNSRecordResultMpBuiT95CaaRecord], +// [DNSRecordResultMpBuiT95CertRecord], [DNSRecordResultMpBuiT95CnameRecord], +// [DNSRecordResultMpBuiT95DnskeyRecord], [DNSRecordResultMpBuiT95DsRecord], +// [DNSRecordResultMpBuiT95HTTPsRecord], [DNSRecordResultMpBuiT95LocRecord], +// [DNSRecordResultMpBuiT95MxRecord], [DNSRecordResultMpBuiT95NaptrRecord], +// [DNSRecordResultMpBuiT95NsRecord], [DNSRecordResultMpBuiT95PtrRecord], +// [DNSRecordResultMpBuiT95SmimeaRecord], [DNSRecordResultMpBuiT95SrvRecord], +// [DNSRecordResultMpBuiT95SshfpRecord], [DNSRecordResultMpBuiT95SvcbRecord], +// [DNSRecordResultMpBuiT95TlsaRecord], [DNSRecordResultMpBuiT95TxtRecord] or +// [DNSRecordResultMpBuiT95UriRecord]. +type DNSRecordResult interface { + implementsDNSRecordResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*DNSRecordResult)(nil)).Elem(), "") +} + +type DNSRecordResultMpBuiT95ARecord struct { + // A valid IPv4 address. + Content string `json:"content,required" format:"ipv4"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95ARecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95ARecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied bool `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95ARecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95ARecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95ARecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95ARecord] +type dnsRecordResultMpBuiT95ARecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Proxied apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95ARecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95ARecord) implementsDNSRecordResult() {} + +// Record type. +type DNSRecordResultMpBuiT95ARecordType string + +const ( + DNSRecordResultMpBuiT95ARecordTypeA DNSRecordResultMpBuiT95ARecordType = "A" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95ARecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95ARecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95ARecordMetaJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95ARecordMeta] +type dnsRecordResultMpBuiT95ARecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95ARecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95ARecordTtlNumber]. +type DNSRecordResultMpBuiT95ARecordTtl interface { + ImplementsDNSRecordResultMpBuiT95ARecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95ARecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95ARecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95ARecordTtlNumber1 DNSRecordResultMpBuiT95ARecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95AaaaRecord struct { + // A valid IPv6 address. + Content string `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95AaaaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95AaaaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied bool `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95AaaaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95AaaaRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95AaaaRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95AaaaRecord] +type dnsRecordResultMpBuiT95AaaaRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Proxied apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95AaaaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95AaaaRecord) implementsDNSRecordResult() {} + +// Record type. +type DNSRecordResultMpBuiT95AaaaRecordType string + +const ( + DNSRecordResultMpBuiT95AaaaRecordTypeAaaa DNSRecordResultMpBuiT95AaaaRecordType = "AAAA" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95AaaaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95AaaaRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95AaaaRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95AaaaRecordMeta] +type dnsRecordResultMpBuiT95AaaaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95AaaaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95AaaaRecordTtlNumber]. +type DNSRecordResultMpBuiT95AaaaRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95AaaaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95AaaaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95AaaaRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95AaaaRecordTtlNumber1 DNSRecordResultMpBuiT95AaaaRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95CaaRecord struct { + // Components of a CAA record. + Data DNSRecordResultMpBuiT95CaaRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95CaaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted CAA content. See 'data' to set CAA properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95CaaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95CaaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95CaaRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CaaRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95CaaRecord] +type dnsRecordResultMpBuiT95CaaRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CaaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95CaaRecord) implementsDNSRecordResult() {} + +// Components of a CAA record. +type DNSRecordResultMpBuiT95CaaRecordData struct { + // Flags for the CAA record. + Flags float64 `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag string `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value string `json:"value"` + JSON dnsRecordResultMpBuiT95CaaRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CaaRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95CaaRecordData] +type dnsRecordResultMpBuiT95CaaRecordDataJSON struct { + Flags apijson.Field + Tag apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CaaRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95CaaRecordType string + +const ( + DNSRecordResultMpBuiT95CaaRecordTypeCaa DNSRecordResultMpBuiT95CaaRecordType = "CAA" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95CaaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95CaaRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CaaRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95CaaRecordMeta] +type dnsRecordResultMpBuiT95CaaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CaaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95CaaRecordTtlNumber]. +type DNSRecordResultMpBuiT95CaaRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95CaaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95CaaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95CaaRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95CaaRecordTtlNumber1 DNSRecordResultMpBuiT95CaaRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95CertRecord struct { + // Components of a CERT record. + Data DNSRecordResultMpBuiT95CertRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95CertRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted CERT content. See 'data' to set CERT properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95CertRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95CertRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95CertRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CertRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95CertRecord] +type dnsRecordResultMpBuiT95CertRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CertRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95CertRecord) implementsDNSRecordResult() {} + +// Components of a CERT record. +type DNSRecordResultMpBuiT95CertRecordData struct { + // Algorithm. + Algorithm float64 `json:"algorithm"` + // Certificate. + Certificate string `json:"certificate"` + // Key Tag. + KeyTag float64 `json:"key_tag"` + // Type. + Type float64 `json:"type"` + JSON dnsRecordResultMpBuiT95CertRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CertRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95CertRecordData] +type dnsRecordResultMpBuiT95CertRecordDataJSON struct { + Algorithm apijson.Field + Certificate apijson.Field + KeyTag apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CertRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95CertRecordType string + +const ( + DNSRecordResultMpBuiT95CertRecordTypeCert DNSRecordResultMpBuiT95CertRecordType = "CERT" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95CertRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95CertRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CertRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95CertRecordMeta] +type dnsRecordResultMpBuiT95CertRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CertRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95CertRecordTtlNumber]. +type DNSRecordResultMpBuiT95CertRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95CertRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95CertRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95CertRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95CertRecordTtlNumber1 DNSRecordResultMpBuiT95CertRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95CnameRecord struct { + // A valid hostname. Must not match the record's name. + Content interface{} `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95CnameRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95CnameRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied bool `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95CnameRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95CnameRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CnameRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95CnameRecord] +type dnsRecordResultMpBuiT95CnameRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Proxied apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CnameRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95CnameRecord) implementsDNSRecordResult() {} + +// Record type. +type DNSRecordResultMpBuiT95CnameRecordType string + +const ( + DNSRecordResultMpBuiT95CnameRecordTypeCname DNSRecordResultMpBuiT95CnameRecordType = "CNAME" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95CnameRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95CnameRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95CnameRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95CnameRecordMeta] +type dnsRecordResultMpBuiT95CnameRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95CnameRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95CnameRecordTtlNumber]. +type DNSRecordResultMpBuiT95CnameRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95CnameRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95CnameRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95CnameRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95CnameRecordTtlNumber1 DNSRecordResultMpBuiT95CnameRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95DnskeyRecord struct { + // Components of a DNSKEY record. + Data DNSRecordResultMpBuiT95DnskeyRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95DnskeyRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted DNSKEY content. See 'data' to set DNSKEY properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95DnskeyRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95DnskeyRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95DnskeyRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95DnskeyRecordJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95DnskeyRecord] +type dnsRecordResultMpBuiT95DnskeyRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95DnskeyRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95DnskeyRecord) implementsDNSRecordResult() {} + +// Components of a DNSKEY record. +type DNSRecordResultMpBuiT95DnskeyRecordData struct { + // Algorithm. + Algorithm float64 `json:"algorithm"` + // Flags. + Flags float64 `json:"flags"` + // Protocol. + Protocol float64 `json:"protocol"` + // Public Key. + PublicKey string `json:"public_key"` + JSON dnsRecordResultMpBuiT95DnskeyRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95DnskeyRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95DnskeyRecordData] +type dnsRecordResultMpBuiT95DnskeyRecordDataJSON struct { + Algorithm apijson.Field + Flags apijson.Field + Protocol apijson.Field + PublicKey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95DnskeyRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95DnskeyRecordType string + +const ( + DNSRecordResultMpBuiT95DnskeyRecordTypeDnskey DNSRecordResultMpBuiT95DnskeyRecordType = "DNSKEY" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95DnskeyRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95DnskeyRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95DnskeyRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95DnskeyRecordMeta] +type dnsRecordResultMpBuiT95DnskeyRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95DnskeyRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95DnskeyRecordTtlNumber]. +type DNSRecordResultMpBuiT95DnskeyRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95DnskeyRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95DnskeyRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95DnskeyRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95DnskeyRecordTtlNumber1 DNSRecordResultMpBuiT95DnskeyRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95DsRecord struct { + // Components of a DS record. + Data DNSRecordResultMpBuiT95DsRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95DsRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted DS content. See 'data' to set DS properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95DsRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95DsRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95DsRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95DsRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95DsRecord] +type dnsRecordResultMpBuiT95DsRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95DsRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95DsRecord) implementsDNSRecordResult() {} + +// Components of a DS record. +type DNSRecordResultMpBuiT95DsRecordData struct { + // Algorithm. + Algorithm float64 `json:"algorithm"` + // Digest. + Digest string `json:"digest"` + // Digest Type. + DigestType float64 `json:"digest_type"` + // Key Tag. + KeyTag float64 `json:"key_tag"` + JSON dnsRecordResultMpBuiT95DsRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95DsRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95DsRecordData] +type dnsRecordResultMpBuiT95DsRecordDataJSON struct { + Algorithm apijson.Field + Digest apijson.Field + DigestType apijson.Field + KeyTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95DsRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95DsRecordType string + +const ( + DNSRecordResultMpBuiT95DsRecordTypeDs DNSRecordResultMpBuiT95DsRecordType = "DS" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95DsRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95DsRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95DsRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95DsRecordMeta] +type dnsRecordResultMpBuiT95DsRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95DsRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95DsRecordTtlNumber]. +type DNSRecordResultMpBuiT95DsRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95DsRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95DsRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95DsRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95DsRecordTtlNumber1 DNSRecordResultMpBuiT95DsRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95HTTPsRecord struct { + // Components of a HTTPS record. + Data DNSRecordResultMpBuiT95HTTPsRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95HTTPsRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted HTTPS content. See 'data' to set HTTPS properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95HTTPsRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95HTTPsRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95HTTPsRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95HTTPsRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95HTTPsRecord] +type dnsRecordResultMpBuiT95HTTPsRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95HTTPsRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95HTTPsRecord) implementsDNSRecordResult() {} + +// Components of a HTTPS record. +type DNSRecordResultMpBuiT95HTTPsRecordData struct { + // priority. + Priority float64 `json:"priority"` + // target. + Target string `json:"target"` + // value. + Value string `json:"value"` + JSON dnsRecordResultMpBuiT95HTTPsRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95HTTPsRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95HTTPsRecordData] +type dnsRecordResultMpBuiT95HTTPsRecordDataJSON struct { + Priority apijson.Field + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95HTTPsRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95HTTPsRecordType string + +const ( + DNSRecordResultMpBuiT95HTTPsRecordTypeHTTPs DNSRecordResultMpBuiT95HTTPsRecordType = "HTTPS" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95HTTPsRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95HTTPsRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95HTTPsRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95HTTPsRecordMeta] +type dnsRecordResultMpBuiT95HTTPsRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95HTTPsRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95HTTPsRecordTtlNumber]. +type DNSRecordResultMpBuiT95HTTPsRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95HTTPsRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95HTTPsRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95HTTPsRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95HTTPsRecordTtlNumber1 DNSRecordResultMpBuiT95HTTPsRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95LocRecord struct { + // Components of a LOC record. + Data DNSRecordResultMpBuiT95LocRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95LocRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted LOC content. See 'data' to set LOC properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95LocRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95LocRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95LocRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95LocRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95LocRecord] +type dnsRecordResultMpBuiT95LocRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95LocRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95LocRecord) implementsDNSRecordResult() {} + +// Components of a LOC record. +type DNSRecordResultMpBuiT95LocRecordData struct { + // Altitude of location in meters. + Altitude float64 `json:"altitude"` + // Degrees of latitude. + LatDegrees float64 `json:"lat_degrees"` + // Latitude direction. + LatDirection DNSRecordResultMpBuiT95LocRecordDataLatDirection `json:"lat_direction"` + // Minutes of latitude. + LatMinutes float64 `json:"lat_minutes"` + // Seconds of latitude. + LatSeconds float64 `json:"lat_seconds"` + // Degrees of longitude. + LongDegrees float64 `json:"long_degrees"` + // Longitude direction. + LongDirection DNSRecordResultMpBuiT95LocRecordDataLongDirection `json:"long_direction"` + // Minutes of longitude. + LongMinutes float64 `json:"long_minutes"` + // Seconds of longitude. + LongSeconds float64 `json:"long_seconds"` + // Horizontal precision of location. + PrecisionHorz float64 `json:"precision_horz"` + // Vertical precision of location. + PrecisionVert float64 `json:"precision_vert"` + // Size of location in meters. + Size float64 `json:"size"` + JSON dnsRecordResultMpBuiT95LocRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95LocRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95LocRecordData] +type dnsRecordResultMpBuiT95LocRecordDataJSON struct { + Altitude apijson.Field + LatDegrees apijson.Field + LatDirection apijson.Field + LatMinutes apijson.Field + LatSeconds apijson.Field + LongDegrees apijson.Field + LongDirection apijson.Field + LongMinutes apijson.Field + LongSeconds apijson.Field + PrecisionHorz apijson.Field + PrecisionVert apijson.Field + Size apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95LocRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Latitude direction. +type DNSRecordResultMpBuiT95LocRecordDataLatDirection string + +const ( + DNSRecordResultMpBuiT95LocRecordDataLatDirectionN DNSRecordResultMpBuiT95LocRecordDataLatDirection = "N" + DNSRecordResultMpBuiT95LocRecordDataLatDirectionS DNSRecordResultMpBuiT95LocRecordDataLatDirection = "S" +) + +// Longitude direction. +type DNSRecordResultMpBuiT95LocRecordDataLongDirection string + +const ( + DNSRecordResultMpBuiT95LocRecordDataLongDirectionE DNSRecordResultMpBuiT95LocRecordDataLongDirection = "E" + DNSRecordResultMpBuiT95LocRecordDataLongDirectionW DNSRecordResultMpBuiT95LocRecordDataLongDirection = "W" +) + +// Record type. +type DNSRecordResultMpBuiT95LocRecordType string + +const ( + DNSRecordResultMpBuiT95LocRecordTypeLoc DNSRecordResultMpBuiT95LocRecordType = "LOC" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95LocRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95LocRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95LocRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95LocRecordMeta] +type dnsRecordResultMpBuiT95LocRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95LocRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95LocRecordTtlNumber]. +type DNSRecordResultMpBuiT95LocRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95LocRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95LocRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95LocRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95LocRecordTtlNumber1 DNSRecordResultMpBuiT95LocRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95MxRecord struct { + // A valid mail server hostname. + Content string `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority,required"` + // Record type. + Type DNSRecordResultMpBuiT95MxRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95MxRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95MxRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95MxRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95MxRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95MxRecord] +type dnsRecordResultMpBuiT95MxRecordJSON struct { + Content apijson.Field + Name apijson.Field + Priority apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95MxRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95MxRecord) implementsDNSRecordResult() {} + +// Record type. +type DNSRecordResultMpBuiT95MxRecordType string + +const ( + DNSRecordResultMpBuiT95MxRecordTypeMx DNSRecordResultMpBuiT95MxRecordType = "MX" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95MxRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95MxRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95MxRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95MxRecordMeta] +type dnsRecordResultMpBuiT95MxRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95MxRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95MxRecordTtlNumber]. +type DNSRecordResultMpBuiT95MxRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95MxRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95MxRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95MxRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95MxRecordTtlNumber1 DNSRecordResultMpBuiT95MxRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95NaptrRecord struct { + // Components of a NAPTR record. + Data DNSRecordResultMpBuiT95NaptrRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95NaptrRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted NAPTR content. See 'data' to set NAPTR properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95NaptrRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95NaptrRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95NaptrRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95NaptrRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95NaptrRecord] +type dnsRecordResultMpBuiT95NaptrRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95NaptrRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95NaptrRecord) implementsDNSRecordResult() {} + +// Components of a NAPTR record. +type DNSRecordResultMpBuiT95NaptrRecordData struct { + // Flags. + Flags string `json:"flags"` + // Order. + Order float64 `json:"order"` + // Preference. + Preference float64 `json:"preference"` + // Regex. + Regex string `json:"regex"` + // Replacement. + Replacement string `json:"replacement"` + // Service. + Service string `json:"service"` + JSON dnsRecordResultMpBuiT95NaptrRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95NaptrRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95NaptrRecordData] +type dnsRecordResultMpBuiT95NaptrRecordDataJSON struct { + Flags apijson.Field + Order apijson.Field + Preference apijson.Field + Regex apijson.Field + Replacement apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95NaptrRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95NaptrRecordType string + +const ( + DNSRecordResultMpBuiT95NaptrRecordTypeNaptr DNSRecordResultMpBuiT95NaptrRecordType = "NAPTR" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95NaptrRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95NaptrRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95NaptrRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95NaptrRecordMeta] +type dnsRecordResultMpBuiT95NaptrRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95NaptrRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95NaptrRecordTtlNumber]. +type DNSRecordResultMpBuiT95NaptrRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95NaptrRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95NaptrRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95NaptrRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95NaptrRecordTtlNumber1 DNSRecordResultMpBuiT95NaptrRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95NsRecord struct { + // A valid name server host name. + Content interface{} `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95NsRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95NsRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95NsRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95NsRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95NsRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95NsRecord] +type dnsRecordResultMpBuiT95NsRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95NsRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95NsRecord) implementsDNSRecordResult() {} + +// Record type. +type DNSRecordResultMpBuiT95NsRecordType string + +const ( + DNSRecordResultMpBuiT95NsRecordTypeNs DNSRecordResultMpBuiT95NsRecordType = "NS" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95NsRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95NsRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95NsRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95NsRecordMeta] +type dnsRecordResultMpBuiT95NsRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95NsRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95NsRecordTtlNumber]. +type DNSRecordResultMpBuiT95NsRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95NsRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95NsRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95NsRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95NsRecordTtlNumber1 DNSRecordResultMpBuiT95NsRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95PtrRecord struct { + // Domain name pointing to the address. + Content string `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95PtrRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95PtrRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95PtrRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95PtrRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95PtrRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95PtrRecord] +type dnsRecordResultMpBuiT95PtrRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95PtrRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95PtrRecord) implementsDNSRecordResult() {} + +// Record type. +type DNSRecordResultMpBuiT95PtrRecordType string + +const ( + DNSRecordResultMpBuiT95PtrRecordTypePtr DNSRecordResultMpBuiT95PtrRecordType = "PTR" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95PtrRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95PtrRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95PtrRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95PtrRecordMeta] +type dnsRecordResultMpBuiT95PtrRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95PtrRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95PtrRecordTtlNumber]. +type DNSRecordResultMpBuiT95PtrRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95PtrRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95PtrRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95PtrRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95PtrRecordTtlNumber1 DNSRecordResultMpBuiT95PtrRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95SmimeaRecord struct { + // Components of a SMIMEA record. + Data DNSRecordResultMpBuiT95SmimeaRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95SmimeaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted SMIMEA content. See 'data' to set SMIMEA properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95SmimeaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95SmimeaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95SmimeaRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SmimeaRecordJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SmimeaRecord] +type dnsRecordResultMpBuiT95SmimeaRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SmimeaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95SmimeaRecord) implementsDNSRecordResult() {} + +// Components of a SMIMEA record. +type DNSRecordResultMpBuiT95SmimeaRecordData struct { + // Certificate. + Certificate string `json:"certificate"` + // Matching Type. + MatchingType float64 `json:"matching_type"` + // Selector. + Selector float64 `json:"selector"` + // Usage. + Usage float64 `json:"usage"` + JSON dnsRecordResultMpBuiT95SmimeaRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SmimeaRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SmimeaRecordData] +type dnsRecordResultMpBuiT95SmimeaRecordDataJSON struct { + Certificate apijson.Field + MatchingType apijson.Field + Selector apijson.Field + Usage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SmimeaRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95SmimeaRecordType string + +const ( + DNSRecordResultMpBuiT95SmimeaRecordTypeSmimea DNSRecordResultMpBuiT95SmimeaRecordType = "SMIMEA" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95SmimeaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95SmimeaRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SmimeaRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SmimeaRecordMeta] +type dnsRecordResultMpBuiT95SmimeaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SmimeaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95SmimeaRecordTtlNumber]. +type DNSRecordResultMpBuiT95SmimeaRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95SmimeaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95SmimeaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95SmimeaRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95SmimeaRecordTtlNumber1 DNSRecordResultMpBuiT95SmimeaRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95SrvRecord struct { + // Components of a SRV record. + Data DNSRecordResultMpBuiT95SrvRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95SrvRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Priority, weight, port, and SRV target. See 'data' for setting the individual + // component values. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95SrvRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95SrvRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95SrvRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SrvRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95SrvRecord] +type dnsRecordResultMpBuiT95SrvRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SrvRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95SrvRecord) implementsDNSRecordResult() {} + +// Components of a SRV record. +type DNSRecordResultMpBuiT95SrvRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name string `json:"name" format:"hostname"` + // The port of the service. + Port float64 `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto string `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service string `json:"service"` + // A valid hostname. + Target string `json:"target" format:"hostname"` + // The record weight. + Weight float64 `json:"weight"` + JSON dnsRecordResultMpBuiT95SrvRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SrvRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SrvRecordData] +type dnsRecordResultMpBuiT95SrvRecordDataJSON struct { + Name apijson.Field + Port apijson.Field + Priority apijson.Field + Proto apijson.Field + Service apijson.Field + Target apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SrvRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95SrvRecordType string + +const ( + DNSRecordResultMpBuiT95SrvRecordTypeSrv DNSRecordResultMpBuiT95SrvRecordType = "SRV" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95SrvRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95SrvRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SrvRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SrvRecordMeta] +type dnsRecordResultMpBuiT95SrvRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SrvRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95SrvRecordTtlNumber]. +type DNSRecordResultMpBuiT95SrvRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95SrvRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95SrvRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95SrvRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95SrvRecordTtlNumber1 DNSRecordResultMpBuiT95SrvRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95SshfpRecord struct { + // Components of a SSHFP record. + Data DNSRecordResultMpBuiT95SshfpRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95SshfpRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted SSHFP content. See 'data' to set SSHFP properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95SshfpRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95SshfpRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95SshfpRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SshfpRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95SshfpRecord] +type dnsRecordResultMpBuiT95SshfpRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SshfpRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95SshfpRecord) implementsDNSRecordResult() {} + +// Components of a SSHFP record. +type DNSRecordResultMpBuiT95SshfpRecordData struct { + // algorithm. + Algorithm float64 `json:"algorithm"` + // fingerprint. + Fingerprint string `json:"fingerprint"` + // type. + Type float64 `json:"type"` + JSON dnsRecordResultMpBuiT95SshfpRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SshfpRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SshfpRecordData] +type dnsRecordResultMpBuiT95SshfpRecordDataJSON struct { + Algorithm apijson.Field + Fingerprint apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SshfpRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95SshfpRecordType string + +const ( + DNSRecordResultMpBuiT95SshfpRecordTypeSshfp DNSRecordResultMpBuiT95SshfpRecordType = "SSHFP" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95SshfpRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95SshfpRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SshfpRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SshfpRecordMeta] +type dnsRecordResultMpBuiT95SshfpRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SshfpRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95SshfpRecordTtlNumber]. +type DNSRecordResultMpBuiT95SshfpRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95SshfpRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95SshfpRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95SshfpRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95SshfpRecordTtlNumber1 DNSRecordResultMpBuiT95SshfpRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95SvcbRecord struct { + // Components of a SVCB record. + Data DNSRecordResultMpBuiT95SvcbRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95SvcbRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted SVCB content. See 'data' to set SVCB properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95SvcbRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95SvcbRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95SvcbRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SvcbRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95SvcbRecord] +type dnsRecordResultMpBuiT95SvcbRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SvcbRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95SvcbRecord) implementsDNSRecordResult() {} + +// Components of a SVCB record. +type DNSRecordResultMpBuiT95SvcbRecordData struct { + // priority. + Priority float64 `json:"priority"` + // target. + Target string `json:"target"` + // value. + Value string `json:"value"` + JSON dnsRecordResultMpBuiT95SvcbRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SvcbRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SvcbRecordData] +type dnsRecordResultMpBuiT95SvcbRecordDataJSON struct { + Priority apijson.Field + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SvcbRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95SvcbRecordType string + +const ( + DNSRecordResultMpBuiT95SvcbRecordTypeSvcb DNSRecordResultMpBuiT95SvcbRecordType = "SVCB" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95SvcbRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95SvcbRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95SvcbRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95SvcbRecordMeta] +type dnsRecordResultMpBuiT95SvcbRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95SvcbRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95SvcbRecordTtlNumber]. +type DNSRecordResultMpBuiT95SvcbRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95SvcbRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95SvcbRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95SvcbRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95SvcbRecordTtlNumber1 DNSRecordResultMpBuiT95SvcbRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95TlsaRecord struct { + // Components of a TLSA record. + Data DNSRecordResultMpBuiT95TlsaRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95TlsaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted TLSA content. See 'data' to set TLSA properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95TlsaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95TlsaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95TlsaRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95TlsaRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95TlsaRecord] +type dnsRecordResultMpBuiT95TlsaRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95TlsaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95TlsaRecord) implementsDNSRecordResult() {} + +// Components of a TLSA record. +type DNSRecordResultMpBuiT95TlsaRecordData struct { + // certificate. + Certificate string `json:"certificate"` + // Matching Type. + MatchingType float64 `json:"matching_type"` + // Selector. + Selector float64 `json:"selector"` + // Usage. + Usage float64 `json:"usage"` + JSON dnsRecordResultMpBuiT95TlsaRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95TlsaRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95TlsaRecordData] +type dnsRecordResultMpBuiT95TlsaRecordDataJSON struct { + Certificate apijson.Field + MatchingType apijson.Field + Selector apijson.Field + Usage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95TlsaRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95TlsaRecordType string + +const ( + DNSRecordResultMpBuiT95TlsaRecordTypeTlsa DNSRecordResultMpBuiT95TlsaRecordType = "TLSA" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95TlsaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95TlsaRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95TlsaRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95TlsaRecordMeta] +type dnsRecordResultMpBuiT95TlsaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95TlsaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95TlsaRecordTtlNumber]. +type DNSRecordResultMpBuiT95TlsaRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95TlsaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95TlsaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95TlsaRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95TlsaRecordTtlNumber1 DNSRecordResultMpBuiT95TlsaRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95TxtRecord struct { + // Text content for the record. + Content string `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type DNSRecordResultMpBuiT95TxtRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95TxtRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95TxtRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95TxtRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95TxtRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95TxtRecord] +type dnsRecordResultMpBuiT95TxtRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95TxtRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95TxtRecord) implementsDNSRecordResult() {} + +// Record type. +type DNSRecordResultMpBuiT95TxtRecordType string + +const ( + DNSRecordResultMpBuiT95TxtRecordTypeTxt DNSRecordResultMpBuiT95TxtRecordType = "TXT" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95TxtRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95TxtRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95TxtRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95TxtRecordMeta] +type dnsRecordResultMpBuiT95TxtRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95TxtRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95TxtRecordTtlNumber]. +type DNSRecordResultMpBuiT95TxtRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95TxtRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95TxtRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95TxtRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95TxtRecordTtlNumber1 DNSRecordResultMpBuiT95TxtRecordTtlNumber = 1 +) + +type DNSRecordResultMpBuiT95UriRecord struct { + // Components of a URI record. + Data DNSRecordResultMpBuiT95UriRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority,required"` + // Record type. + Type DNSRecordResultMpBuiT95UriRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted URI content. See 'data' to set URI properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta DNSRecordResultMpBuiT95UriRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl DNSRecordResultMpBuiT95UriRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON dnsRecordResultMpBuiT95UriRecordJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95UriRecordJSON contains the JSON metadata for the struct +// [DNSRecordResultMpBuiT95UriRecord] +type dnsRecordResultMpBuiT95UriRecordJSON struct { + Data apijson.Field + Name apijson.Field + Priority apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95UriRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r DNSRecordResultMpBuiT95UriRecord) implementsDNSRecordResult() {} + +// Components of a URI record. +type DNSRecordResultMpBuiT95UriRecordData struct { + // The record content. + Content string `json:"content"` + // The record weight. + Weight float64 `json:"weight"` + JSON dnsRecordResultMpBuiT95UriRecordDataJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95UriRecordDataJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95UriRecordData] +type dnsRecordResultMpBuiT95UriRecordDataJSON struct { + Content apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95UriRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type DNSRecordResultMpBuiT95UriRecordType string + +const ( + DNSRecordResultMpBuiT95UriRecordTypeUri DNSRecordResultMpBuiT95UriRecordType = "URI" +) + +// Extra Cloudflare-specific information about the record. +type DNSRecordResultMpBuiT95UriRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON dnsRecordResultMpBuiT95UriRecordMetaJSON `json:"-"` +} + +// dnsRecordResultMpBuiT95UriRecordMetaJSON contains the JSON metadata for the +// struct [DNSRecordResultMpBuiT95UriRecordMeta] +type dnsRecordResultMpBuiT95UriRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSRecordResultMpBuiT95UriRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [DNSRecordResultMpBuiT95UriRecordTtlNumber]. +type DNSRecordResultMpBuiT95UriRecordTtl interface { + ImplementsDNSRecordResultMpBuiT95UriRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DNSRecordResultMpBuiT95UriRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type DNSRecordResultMpBuiT95UriRecordTtlNumber float64 + +const ( + DNSRecordResultMpBuiT95UriRecordTtlNumber1 DNSRecordResultMpBuiT95UriRecordTtlNumber = 1 +) + +// Whether the API call was successful +type DNSRecordSuccess bool + +const ( + DNSRecordSuccessTrue DNSRecordSuccess = true +) + +type ZoneDNSRecordDeleteResponse struct { + Result ZoneDNSRecordDeleteResponseResult `json:"result"` + JSON zoneDNSRecordDeleteResponseJSON `json:"-"` +} + +// zoneDNSRecordDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneDNSRecordDeleteResponse] +type zoneDNSRecordDeleteResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON zoneDNSRecordDeleteResponseResultJSON `json:"-"` +} + +// zoneDNSRecordDeleteResponseResultJSON contains the JSON metadata for the struct +// [ZoneDNSRecordDeleteResponseResult] +type zoneDNSRecordDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecord] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecord]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse interface { + implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse)(nil)).Elem(), "") +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecord struct { + // A valid IPv4 address. + Content string `json:"content,required" format:"ipv4"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied bool `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Proxied apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTypeA ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordType = "A" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95ARecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecord struct { + // A valid IPv6 address. + Content string `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied bool `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Proxied apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTypeAaaa ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordType = "AAAA" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95AaaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecord struct { + // Components of a CAA record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted CAA content. See 'data' to set CAA properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a CAA record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordData struct { + // Flags for the CAA record. + Flags float64 `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag string `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value string `json:"value"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordDataJSON struct { + Flags apijson.Field + Tag apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTypeCaa ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordType = "CAA" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecord struct { + // Components of a CERT record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted CERT content. See 'data' to set CERT properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a CERT record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordData struct { + // Algorithm. + Algorithm float64 `json:"algorithm"` + // Certificate. + Certificate string `json:"certificate"` + // Key Tag. + KeyTag float64 `json:"key_tag"` + // Type. + Type float64 `json:"type"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordDataJSON struct { + Algorithm apijson.Field + Certificate apijson.Field + KeyTag apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTypeCert ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordType = "CERT" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CertRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecord struct { + // A valid hostname. Must not match the record's name. + Content interface{} `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied bool `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Proxied apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTypeCname ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordType = "CNAME" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95CnameRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecord struct { + // Components of a DNSKEY record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted DNSKEY content. See 'data' to set DNSKEY properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a DNSKEY record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordData struct { + // Algorithm. + Algorithm float64 `json:"algorithm"` + // Flags. + Flags float64 `json:"flags"` + // Protocol. + Protocol float64 `json:"protocol"` + // Public Key. + PublicKey string `json:"public_key"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordDataJSON struct { + Algorithm apijson.Field + Flags apijson.Field + Protocol apijson.Field + PublicKey apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTypeDnskey ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordType = "DNSKEY" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DnskeyRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecord struct { + // Components of a DS record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted DS content. See 'data' to set DS properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a DS record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordData struct { + // Algorithm. + Algorithm float64 `json:"algorithm"` + // Digest. + Digest string `json:"digest"` + // Digest Type. + DigestType float64 `json:"digest_type"` + // Key Tag. + KeyTag float64 `json:"key_tag"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordDataJSON struct { + Algorithm apijson.Field + Digest apijson.Field + DigestType apijson.Field + KeyTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTypeDs ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordType = "DS" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95DsRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecord struct { + // Components of a HTTPS record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted HTTPS content. See 'data' to set HTTPS properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a HTTPS record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordData struct { + // priority. + Priority float64 `json:"priority"` + // target. + Target string `json:"target"` + // value. + Value string `json:"value"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordDataJSON struct { + Priority apijson.Field + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTypeHTTPs ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordType = "HTTPS" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95HTTPsRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecord struct { + // Components of a LOC record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted LOC content. See 'data' to set LOC properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a LOC record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordData struct { + // Altitude of location in meters. + Altitude float64 `json:"altitude"` + // Degrees of latitude. + LatDegrees float64 `json:"lat_degrees"` + // Latitude direction. + LatDirection ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLatDirection `json:"lat_direction"` + // Minutes of latitude. + LatMinutes float64 `json:"lat_minutes"` + // Seconds of latitude. + LatSeconds float64 `json:"lat_seconds"` + // Degrees of longitude. + LongDegrees float64 `json:"long_degrees"` + // Longitude direction. + LongDirection ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLongDirection `json:"long_direction"` + // Minutes of longitude. + LongMinutes float64 `json:"long_minutes"` + // Seconds of longitude. + LongSeconds float64 `json:"long_seconds"` + // Horizontal precision of location. + PrecisionHorz float64 `json:"precision_horz"` + // Vertical precision of location. + PrecisionVert float64 `json:"precision_vert"` + // Size of location in meters. + Size float64 `json:"size"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataJSON struct { + Altitude apijson.Field + LatDegrees apijson.Field + LatDirection apijson.Field + LatMinutes apijson.Field + LatSeconds apijson.Field + LongDegrees apijson.Field + LongDirection apijson.Field + LongMinutes apijson.Field + LongSeconds apijson.Field + PrecisionHorz apijson.Field + PrecisionVert apijson.Field + Size apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Latitude direction. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLatDirection string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLatDirectionN ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLatDirection = "N" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLatDirectionS ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLatDirection = "S" +) + +// Longitude direction. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLongDirection string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLongDirectionE ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLongDirection = "E" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLongDirectionW ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordDataLongDirection = "W" +) + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTypeLoc ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordType = "LOC" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95LocRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecord struct { + // A valid mail server hostname. + Content string `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordJSON struct { + Content apijson.Field + Name apijson.Field + Priority apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTypeMx ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordType = "MX" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95MxRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecord struct { + // Components of a NAPTR record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted NAPTR content. See 'data' to set NAPTR properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a NAPTR record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordData struct { + // Flags. + Flags string `json:"flags"` + // Order. + Order float64 `json:"order"` + // Preference. + Preference float64 `json:"preference"` + // Regex. + Regex string `json:"regex"` + // Replacement. + Replacement string `json:"replacement"` + // Service. + Service string `json:"service"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordDataJSON struct { + Flags apijson.Field + Order apijson.Field + Preference apijson.Field + Regex apijson.Field + Replacement apijson.Field + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTypeNaptr ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordType = "NAPTR" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NaptrRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecord struct { + // A valid name server host name. + Content interface{} `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTypeNs ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordType = "NS" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95NsRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecord struct { + // Domain name pointing to the address. + Content string `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTypePtr ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordType = "PTR" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95PtrRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecord struct { + // Components of a SMIMEA record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted SMIMEA content. See 'data' to set SMIMEA properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a SMIMEA record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordData struct { + // Certificate. + Certificate string `json:"certificate"` + // Matching Type. + MatchingType float64 `json:"matching_type"` + // Selector. + Selector float64 `json:"selector"` + // Usage. + Usage float64 `json:"usage"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordDataJSON struct { + Certificate apijson.Field + MatchingType apijson.Field + Selector apijson.Field + Usage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTypeSmimea ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordType = "SMIMEA" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SmimeaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecord struct { + // Components of a SRV record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Priority, weight, port, and SRV target. See 'data' for setting the individual + // component values. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a SRV record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name string `json:"name" format:"hostname"` + // The port of the service. + Port float64 `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto string `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service string `json:"service"` + // A valid hostname. + Target string `json:"target" format:"hostname"` + // The record weight. + Weight float64 `json:"weight"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordDataJSON struct { + Name apijson.Field + Port apijson.Field + Priority apijson.Field + Proto apijson.Field + Service apijson.Field + Target apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTypeSrv ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordType = "SRV" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SrvRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecord struct { + // Components of a SSHFP record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted SSHFP content. See 'data' to set SSHFP properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a SSHFP record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordData struct { + // algorithm. + Algorithm float64 `json:"algorithm"` + // fingerprint. + Fingerprint string `json:"fingerprint"` + // type. + Type float64 `json:"type"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordDataJSON struct { + Algorithm apijson.Field + Fingerprint apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTypeSshfp ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordType = "SSHFP" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SshfpRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecord struct { + // Components of a SVCB record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted SVCB content. See 'data' to set SVCB properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a SVCB record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordData struct { + // priority. + Priority float64 `json:"priority"` + // target. + Target string `json:"target"` + // value. + Value string `json:"value"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordDataJSON struct { + Priority apijson.Field + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTypeSvcb ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordType = "SVCB" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95SvcbRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecord struct { + // Components of a TLSA record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted TLSA content. See 'data' to set TLSA properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordJSON struct { + Data apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a TLSA record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordData struct { + // certificate. + Certificate string `json:"certificate"` + // Matching Type. + MatchingType float64 `json:"matching_type"` + // Selector. + Selector float64 `json:"selector"` + // Usage. + Usage float64 `json:"usage"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordDataJSON struct { + Certificate apijson.Field + MatchingType apijson.Field + Selector apijson.Field + Usage apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTypeTlsa ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordType = "TLSA" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TlsaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecord struct { + // Text content for the record. + Content string `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordJSON struct { + Content apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTypeTxt ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordType = "TXT" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95TxtRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecord struct { + // Components of a URI record. + Data ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordData `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority,required"` + // Record type. + Type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Formatted URI content. See 'data' to set URI properties. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordMeta `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags []string `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtl `json:"ttl"` + // Identifier + ZoneID string `json:"zone_id"` + // The domain of the record. + ZoneName string `json:"zone_name" format:"hostname"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecord] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordJSON struct { + Data apijson.Field + Name apijson.Field + Priority apijson.Field + Type apijson.Field + ID apijson.Field + Comment apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Locked apijson.Field + Meta apijson.Field + ModifiedOn apijson.Field + Proxiable apijson.Field + Tags apijson.Field + Ttl apijson.Field + ZoneID apijson.Field + ZoneName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecord) implementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponse() { +} + +// Components of a URI record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordData struct { + // The record content. + Content string `json:"content"` + // The record weight. + Weight float64 `json:"weight"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordDataJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordDataJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordData] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordDataJSON struct { + Content apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTypeUri ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordType = "URI" +) + +// Extra Cloudflare-specific information about the record. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordMeta struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordMetaJSON `json:"-"` +} + +// zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordMetaJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordMeta] +type zoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordMetaJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsResponseMpBuiT95UriRecordTtlNumber = 1 +) + +// This interface is a union satisfied by one of the following: +// [ZoneDNSRecordUpdateParamsMpBuiT95ARecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95CaaRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95CertRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95CnameRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95DsRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95LocRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95MxRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95NsRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95PtrRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95SrvRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95TxtRecord], +// [ZoneDNSRecordUpdateParamsMpBuiT95UriRecord]. +type ZoneDNSRecordUpdateParams interface { + ImplementsZoneDNSRecordUpdateParams() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95ARecord struct { + // A valid IPv4 address. + Content param.Field[string] `json:"content,required" format:"ipv4"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95ARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95ARecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95ARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95ARecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95ARecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95ARecordTypeA ZoneDNSRecordUpdateParamsMpBuiT95ARecordType = "A" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95ARecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95ARecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95ARecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95ARecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95ARecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95ARecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecord struct { + // A valid IPv6 address. + Content param.Field[string] `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTypeAaaa ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordType = "AAAA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95AaaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95CaaRecord struct { + // Components of a CAA record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95CaaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95CaaRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a CAA record. +type ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordData struct { + // Flags for the CAA record. + Flags param.Field[float64] `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag param.Field[string] `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTypeCaa ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordType = "CAA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95CaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95CertRecord struct { + // Components of a CERT record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CertRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CertRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95CertRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95CertRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a CERT record. +type ZoneDNSRecordUpdateParamsMpBuiT95CertRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` + // Type. + Type param.Field[float64] `json:"type"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95CertRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95CertRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95CertRecordTypeCert ZoneDNSRecordUpdateParamsMpBuiT95CertRecordType = "CERT" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95CertRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95CnameRecord struct { + // A valid hostname. Must not match the record's name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95CnameRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95CnameRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTypeCname ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordType = "CNAME" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95CnameRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecord struct { + // Components of a DNSKEY record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a DNSKEY record. +type ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Flags. + Flags param.Field[float64] `json:"flags"` + // Protocol. + Protocol param.Field[float64] `json:"protocol"` + // Public Key. + PublicKey param.Field[string] `json:"public_key"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTypeDnskey ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordType = "DNSKEY" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95DnskeyRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95DsRecord struct { + // Components of a DS record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95DsRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95DsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95DsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95DsRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a DS record. +type ZoneDNSRecordUpdateParamsMpBuiT95DsRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Digest. + Digest param.Field[string] `json:"digest"` + // Digest Type. + DigestType param.Field[float64] `json:"digest_type"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95DsRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95DsRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95DsRecordTypeDs ZoneDNSRecordUpdateParamsMpBuiT95DsRecordType = "DS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95DsRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecord struct { + // Components of a HTTPS record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a HTTPS record. +type ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTypeHTTPs ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordType = "HTTPS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95HTTPsRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95LocRecord struct { + // Components of a LOC record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95LocRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95LocRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95LocRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95LocRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a LOC record. +type ZoneDNSRecordUpdateParamsMpBuiT95LocRecordData struct { + // Altitude of location in meters. + Altitude param.Field[float64] `json:"altitude"` + // Degrees of latitude. + LatDegrees param.Field[float64] `json:"lat_degrees"` + // Latitude direction. + LatDirection param.Field[ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLatDirection] `json:"lat_direction"` + // Minutes of latitude. + LatMinutes param.Field[float64] `json:"lat_minutes"` + // Seconds of latitude. + LatSeconds param.Field[float64] `json:"lat_seconds"` + // Degrees of longitude. + LongDegrees param.Field[float64] `json:"long_degrees"` + // Longitude direction. + LongDirection param.Field[ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLongDirection] `json:"long_direction"` + // Minutes of longitude. + LongMinutes param.Field[float64] `json:"long_minutes"` + // Seconds of longitude. + LongSeconds param.Field[float64] `json:"long_seconds"` + // Horizontal precision of location. + PrecisionHorz param.Field[float64] `json:"precision_horz"` + // Vertical precision of location. + PrecisionVert param.Field[float64] `json:"precision_vert"` + // Size of location in meters. + Size param.Field[float64] `json:"size"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95LocRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Latitude direction. +type ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLatDirection string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLatDirectionN ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLatDirection = "N" + ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLatDirectionS ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLatDirection = "S" +) + +// Longitude direction. +type ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLongDirection string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLongDirectionE ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLongDirection = "E" + ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLongDirectionW ZoneDNSRecordUpdateParamsMpBuiT95LocRecordDataLongDirection = "W" +) + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95LocRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95LocRecordTypeLoc ZoneDNSRecordUpdateParamsMpBuiT95LocRecordType = "LOC" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95LocRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95MxRecord struct { + // A valid mail server hostname. + Content param.Field[string] `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95MxRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95MxRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95MxRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95MxRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95MxRecordTypeMx ZoneDNSRecordUpdateParamsMpBuiT95MxRecordType = "MX" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95MxRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecord struct { + // Components of a NAPTR record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a NAPTR record. +type ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordData struct { + // Flags. + Flags param.Field[string] `json:"flags"` + // Order. + Order param.Field[float64] `json:"order"` + // Preference. + Preference param.Field[float64] `json:"preference"` + // Regex. + Regex param.Field[string] `json:"regex"` + // Replacement. + Replacement param.Field[string] `json:"replacement"` + // Service. + Service param.Field[string] `json:"service"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTypeNaptr ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordType = "NAPTR" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95NaptrRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95NsRecord struct { + // A valid name server host name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95NsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95NsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95NsRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95NsRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95NsRecordTypeNs ZoneDNSRecordUpdateParamsMpBuiT95NsRecordType = "NS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95NsRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95PtrRecord struct { + // Domain name pointing to the address. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95PtrRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95PtrRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTypePtr ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordType = "PTR" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95PtrRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecord struct { + // Components of a SMIMEA record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a SMIMEA record. +type ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordData struct { + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTypeSmimea ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordType = "SMIMEA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95SmimeaRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95SrvRecord struct { + // Components of a SRV record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SrvRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95SrvRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a SRV record. +type ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name param.Field[string] `json:"name" format:"hostname"` + // The port of the service. + Port param.Field[float64] `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto param.Field[string] `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service param.Field[string] `json:"service"` + // A valid hostname. + Target param.Field[string] `json:"target" format:"hostname"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTypeSrv ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordType = "SRV" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95SrvRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecord struct { + // Components of a SSHFP record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a SSHFP record. +type ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordData struct { + // algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // fingerprint. + Fingerprint param.Field[string] `json:"fingerprint"` + // type. + Type param.Field[float64] `json:"type"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTypeSshfp ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordType = "SSHFP" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95SshfpRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecord struct { + // Components of a SVCB record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a SVCB record. +type ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTypeSvcb ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordType = "SVCB" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95SvcbRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecord struct { + // Components of a TLSA record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a TLSA record. +type ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordData struct { + // certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTypeTlsa ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordType = "TLSA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95TlsaRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95TxtRecord struct { + // Text content for the record. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95TxtRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95TxtRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTypeTxt ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordType = "TXT" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95TxtRecordTtlNumber = 1 +) + +type ZoneDNSRecordUpdateParamsMpBuiT95UriRecord struct { + // Components of a URI record. + Data param.Field[ZoneDNSRecordUpdateParamsMpBuiT95UriRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[ZoneDNSRecordUpdateParamsMpBuiT95UriRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95UriRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordUpdateParamsMpBuiT95UriRecord) ImplementsZoneDNSRecordUpdateParams() { + +} + +// Components of a URI record. +type ZoneDNSRecordUpdateParamsMpBuiT95UriRecordData struct { + // The record content. + Content param.Field[string] `json:"content"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r ZoneDNSRecordUpdateParamsMpBuiT95UriRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordUpdateParamsMpBuiT95UriRecordType string + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95UriRecordTypeUri ZoneDNSRecordUpdateParamsMpBuiT95UriRecordType = "URI" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtlNumber]. +type ZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtl interface { + ImplementsZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtl() +} + +type ZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtlNumber float64 + +const ( + ZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtlNumber1 ZoneDNSRecordUpdateParamsMpBuiT95UriRecordTtlNumber = 1 +) + +// This interface is a union satisfied by one of the following: +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecord], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecord]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecord struct { + // A valid IPv4 address. + Content param.Field[string] `json:"content,required" format:"ipv4"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTypeA ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordType = "A" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecord struct { + // A valid IPv6 address. + Content param.Field[string] `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTypeAaaa ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordType = "AAAA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95AaaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecord struct { + // Components of a CAA record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a CAA record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordData struct { + // Flags for the CAA record. + Flags param.Field[float64] `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag param.Field[string] `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTypeCaa ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordType = "CAA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecord struct { + // Components of a CERT record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a CERT record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` + // Type. + Type param.Field[float64] `json:"type"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTypeCert ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordType = "CERT" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CertRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecord struct { + // A valid hostname. Must not match the record's name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTypeCname ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordType = "CNAME" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95CnameRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecord struct { + // Components of a DNSKEY record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a DNSKEY record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Flags. + Flags param.Field[float64] `json:"flags"` + // Protocol. + Protocol param.Field[float64] `json:"protocol"` + // Public Key. + PublicKey param.Field[string] `json:"public_key"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTypeDnskey ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordType = "DNSKEY" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DnskeyRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecord struct { + // Components of a DS record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a DS record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Digest. + Digest param.Field[string] `json:"digest"` + // Digest Type. + DigestType param.Field[float64] `json:"digest_type"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTypeDs ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordType = "DS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95DsRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecord struct { + // Components of a HTTPS record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a HTTPS record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTypeHTTPs ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordType = "HTTPS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95HTTPsRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecord struct { + // Components of a LOC record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a LOC record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordData struct { + // Altitude of location in meters. + Altitude param.Field[float64] `json:"altitude"` + // Degrees of latitude. + LatDegrees param.Field[float64] `json:"lat_degrees"` + // Latitude direction. + LatDirection param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLatDirection] `json:"lat_direction"` + // Minutes of latitude. + LatMinutes param.Field[float64] `json:"lat_minutes"` + // Seconds of latitude. + LatSeconds param.Field[float64] `json:"lat_seconds"` + // Degrees of longitude. + LongDegrees param.Field[float64] `json:"long_degrees"` + // Longitude direction. + LongDirection param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLongDirection] `json:"long_direction"` + // Minutes of longitude. + LongMinutes param.Field[float64] `json:"long_minutes"` + // Seconds of longitude. + LongSeconds param.Field[float64] `json:"long_seconds"` + // Horizontal precision of location. + PrecisionHorz param.Field[float64] `json:"precision_horz"` + // Vertical precision of location. + PrecisionVert param.Field[float64] `json:"precision_vert"` + // Size of location in meters. + Size param.Field[float64] `json:"size"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Latitude direction. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLatDirection string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLatDirectionN ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLatDirection = "N" + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLatDirectionS ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLatDirection = "S" +) + +// Longitude direction. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLongDirection string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLongDirectionE ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLongDirection = "E" + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLongDirectionW ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordDataLongDirection = "W" +) + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTypeLoc ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordType = "LOC" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95LocRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecord struct { + // A valid mail server hostname. + Content param.Field[string] `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTypeMx ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordType = "MX" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95MxRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecord struct { + // Components of a NAPTR record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a NAPTR record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordData struct { + // Flags. + Flags param.Field[string] `json:"flags"` + // Order. + Order param.Field[float64] `json:"order"` + // Preference. + Preference param.Field[float64] `json:"preference"` + // Regex. + Regex param.Field[string] `json:"regex"` + // Replacement. + Replacement param.Field[string] `json:"replacement"` + // Service. + Service param.Field[string] `json:"service"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTypeNaptr ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordType = "NAPTR" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NaptrRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecord struct { + // A valid name server host name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTypeNs ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordType = "NS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95NsRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecord struct { + // Domain name pointing to the address. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTypePtr ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordType = "PTR" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95PtrRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecord struct { + // Components of a SMIMEA record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a SMIMEA record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordData struct { + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTypeSmimea ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordType = "SMIMEA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SmimeaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecord struct { + // Components of a SRV record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a SRV record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name param.Field[string] `json:"name" format:"hostname"` + // The port of the service. + Port param.Field[float64] `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto param.Field[string] `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service param.Field[string] `json:"service"` + // A valid hostname. + Target param.Field[string] `json:"target" format:"hostname"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTypeSrv ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordType = "SRV" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SrvRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecord struct { + // Components of a SSHFP record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a SSHFP record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordData struct { + // algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // fingerprint. + Fingerprint param.Field[string] `json:"fingerprint"` + // type. + Type param.Field[float64] `json:"type"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTypeSshfp ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordType = "SSHFP" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SshfpRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecord struct { + // Components of a SVCB record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a SVCB record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTypeSvcb ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordType = "SVCB" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95SvcbRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecord struct { + // Components of a TLSA record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a TLSA record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordData struct { + // certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTypeTlsa ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordType = "TLSA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TlsaRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecord struct { + // Text content for the record. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTypeTxt ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordType = "TXT" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95TxtRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecord struct { + // Components of a URI record. + Data param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecord) ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParams() { + +} + +// Components of a URI record. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordData struct { + // The record content. + Content param.Field[string] `json:"content"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTypeUri ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordType = "URI" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtlNumber]. +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtl interface { + ImplementsZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtl() +} + +type ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtlNumber float64 + +const ( + ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtlNumber1 ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95UriRecordTtlNumber = 1 +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParams struct { + Comment param.Field[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsComment] `query:"comment"` + // DNS record content. + Content param.Field[string] `query:"content"` + // Direction to order DNS records in. + Direction param.Field[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsDirection] `query:"direction"` + // Whether to match all search requirements or at least one (any). If set to `all`, + // acts like a logical AND between filters. If set to `any`, acts like a logical OR + // instead. Note that the interaction between tag filters is controlled by the + // `tag-match` parameter instead. + Match param.Field[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsMatch] `query:"match"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `query:"name"` + // Field to order DNS records by. + Order param.Field[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of DNS records per page. + PerPage param.Field[float64] `query:"per_page"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `query:"proxied"` + // Allows searching in multiple properties of a DNS record simultaneously. This + // parameter is intended for human users, not automation. Its exact behavior is + // intentionally left unspecified and is subject to change in the future. This + // parameter works independently of the `match` setting. For automated searches, + // please use the other available parameters. + Search param.Field[string] `query:"search"` + Tag param.Field[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTag] `query:"tag"` + // Whether to match all tag search requirements or at least one (any). If set to + // `all`, acts like a logical AND between tag filters. If set to `any`, acts like a + // logical OR instead. Note that the regular `match` parameter is still used to + // combine the resulting condition with other filters that aren't related to tags. + TagMatch param.Field[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTagMatch] `query:"tag_match"` + // Record type. + Type param.Field[ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType] `query:"type"` +} + +// URLQuery serializes [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParams]'s +// query parameters as `url.Values`. +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsComment struct { + // If this parameter is present, only records _without_ a comment are returned. + Absent param.Field[string] `query:"absent"` + // Substring of the DNS record comment. Comment filters are case-insensitive. + Contains param.Field[string] `query:"contains"` + // Suffix of the DNS record comment. Comment filters are case-insensitive. + Endswith param.Field[string] `query:"endswith"` + // Exact value of the DNS record comment. Comment filters are case-insensitive. + Exact param.Field[string] `query:"exact"` + // If this parameter is present, only records _with_ a comment are returned. + Present param.Field[string] `query:"present"` + // Prefix of the DNS record comment. Comment filters are case-insensitive. + Startswith param.Field[string] `query:"startswith"` +} + +// URLQuery serializes +// [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsComment]'s query parameters +// as `url.Values`. +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsComment) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order DNS records in. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsDirection string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsDirectionAsc ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsDirection = "asc" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsDirectionDesc ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsDirection = "desc" +) + +// Whether to match all search requirements or at least one (any). If set to `all`, +// acts like a logical AND between filters. If set to `any`, acts like a logical OR +// instead. Note that the interaction between tag filters is controlled by the +// `tag-match` parameter instead. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsMatch string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsMatchAny ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsMatch = "any" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsMatchAll ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsMatch = "all" +) + +// Field to order DNS records by. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrder string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrderType ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrder = "type" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrderName ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrder = "name" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrderContent ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrder = "content" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrderTtl ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrder = "ttl" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrderProxied ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrder = "proxied" +) + +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTag struct { + // Name of a tag which must _not_ be present on the DNS record. Tag filters are + // case-insensitive. + Absent param.Field[string] `query:"absent"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value contains + // ``. Tag filters are case-insensitive. + Contains param.Field[string] `query:"contains"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value ends with + // ``. Tag filters are case-insensitive. + Endswith param.Field[string] `query:"endswith"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value is ``. Tag + // filters are case-insensitive. + Exact param.Field[string] `query:"exact"` + // Name of a tag which must be present on the DNS record. Tag filters are + // case-insensitive. + Present param.Field[string] `query:"present"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value starts with + // ``. Tag filters are case-insensitive. + Startswith param.Field[string] `query:"startswith"` +} + +// URLQuery serializes [ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTag]'s +// query parameters as `url.Values`. +func (r ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTag) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Whether to match all tag search requirements or at least one (any). If set to +// `all`, acts like a logical AND between tag filters. If set to `any`, acts like a +// logical OR instead. Note that the regular `match` parameter is still used to +// combine the resulting condition with other filters that aren't related to tags. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTagMatch string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTagMatchAny ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTagMatch = "any" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTagMatchAll ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTagMatch = "all" +) + +// Record type. +type ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType string + +const ( + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeA ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "A" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeAaaa ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "AAAA" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeCaa ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "CAA" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeCert ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "CERT" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeCname ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "CNAME" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeDnskey ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "DNSKEY" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeDs ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "DS" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeHTTPs ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "HTTPS" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeLoc ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "LOC" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeMx ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "MX" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeNaptr ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "NAPTR" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeNs ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "NS" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypePtr ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "PTR" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeSmimea ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "SMIMEA" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeSrv ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "SRV" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeSshfp ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "SSHFP" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeSvcb ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "SVCB" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeTlsa ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "TLSA" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeTxt ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "TXT" + ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeUri ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsType = "URI" +) + +// This interface is a union satisfied by one of the following: +// [ZoneDNSRecordPatchParamsMpBuiT95ARecord], +// [ZoneDNSRecordPatchParamsMpBuiT95AaaaRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95CaaRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95CertRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95CnameRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95DsRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95LocRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95MxRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95NaptrRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95NsRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95PtrRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95SrvRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95SshfpRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95SvcbRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95TlsaRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95TxtRecord], +// [ZoneDNSRecordPatchParamsMpBuiT95UriRecord]. +type ZoneDNSRecordPatchParams interface { + ImplementsZoneDNSRecordPatchParams() +} + +type ZoneDNSRecordPatchParamsMpBuiT95ARecord struct { + // A valid IPv4 address. + Content param.Field[string] `json:"content,required" format:"ipv4"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95ARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95ARecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95ARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95ARecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95ARecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95ARecordTypeA ZoneDNSRecordPatchParamsMpBuiT95ARecordType = "A" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95ARecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95ARecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95ARecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95ARecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95ARecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95ARecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95AaaaRecord struct { + // A valid IPv6 address. + Content param.Field[string] `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95AaaaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95AaaaRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTypeAaaa ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordType = "AAAA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95AaaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95CaaRecord struct { + // Components of a CAA record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95CaaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95CaaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95CaaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95CaaRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a CAA record. +type ZoneDNSRecordPatchParamsMpBuiT95CaaRecordData struct { + // Flags for the CAA record. + Flags param.Field[float64] `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag param.Field[string] `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95CaaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95CaaRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95CaaRecordTypeCaa ZoneDNSRecordPatchParamsMpBuiT95CaaRecordType = "CAA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95CaaRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95CertRecord struct { + // Components of a CERT record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95CertRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95CertRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95CertRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95CertRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95CertRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a CERT record. +type ZoneDNSRecordPatchParamsMpBuiT95CertRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` + // Type. + Type param.Field[float64] `json:"type"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95CertRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95CertRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95CertRecordTypeCert ZoneDNSRecordPatchParamsMpBuiT95CertRecordType = "CERT" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95CertRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95CertRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95CertRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95CertRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95CertRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95CertRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95CnameRecord struct { + // A valid hostname. Must not match the record's name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95CnameRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95CnameRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95CnameRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95CnameRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95CnameRecordTypeCname ZoneDNSRecordPatchParamsMpBuiT95CnameRecordType = "CNAME" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95CnameRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecord struct { + // Components of a DNSKEY record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a DNSKEY record. +type ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Flags. + Flags param.Field[float64] `json:"flags"` + // Protocol. + Protocol param.Field[float64] `json:"protocol"` + // Public Key. + PublicKey param.Field[string] `json:"public_key"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTypeDnskey ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordType = "DNSKEY" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95DnskeyRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95DsRecord struct { + // Components of a DS record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95DsRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95DsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95DsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95DsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95DsRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a DS record. +type ZoneDNSRecordPatchParamsMpBuiT95DsRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Digest. + Digest param.Field[string] `json:"digest"` + // Digest Type. + DigestType param.Field[float64] `json:"digest_type"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95DsRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95DsRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95DsRecordTypeDs ZoneDNSRecordPatchParamsMpBuiT95DsRecordType = "DS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95DsRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95DsRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95DsRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95DsRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95DsRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95DsRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecord struct { + // Components of a HTTPS record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a HTTPS record. +type ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTypeHTTPs ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordType = "HTTPS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95HTTPsRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95LocRecord struct { + // Components of a LOC record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95LocRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95LocRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95LocRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95LocRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95LocRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a LOC record. +type ZoneDNSRecordPatchParamsMpBuiT95LocRecordData struct { + // Altitude of location in meters. + Altitude param.Field[float64] `json:"altitude"` + // Degrees of latitude. + LatDegrees param.Field[float64] `json:"lat_degrees"` + // Latitude direction. + LatDirection param.Field[ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLatDirection] `json:"lat_direction"` + // Minutes of latitude. + LatMinutes param.Field[float64] `json:"lat_minutes"` + // Seconds of latitude. + LatSeconds param.Field[float64] `json:"lat_seconds"` + // Degrees of longitude. + LongDegrees param.Field[float64] `json:"long_degrees"` + // Longitude direction. + LongDirection param.Field[ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLongDirection] `json:"long_direction"` + // Minutes of longitude. + LongMinutes param.Field[float64] `json:"long_minutes"` + // Seconds of longitude. + LongSeconds param.Field[float64] `json:"long_seconds"` + // Horizontal precision of location. + PrecisionHorz param.Field[float64] `json:"precision_horz"` + // Vertical precision of location. + PrecisionVert param.Field[float64] `json:"precision_vert"` + // Size of location in meters. + Size param.Field[float64] `json:"size"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95LocRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Latitude direction. +type ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLatDirection string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLatDirectionN ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLatDirection = "N" + ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLatDirectionS ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLatDirection = "S" +) + +// Longitude direction. +type ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLongDirection string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLongDirectionE ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLongDirection = "E" + ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLongDirectionW ZoneDNSRecordPatchParamsMpBuiT95LocRecordDataLongDirection = "W" +) + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95LocRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95LocRecordTypeLoc ZoneDNSRecordPatchParamsMpBuiT95LocRecordType = "LOC" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95LocRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95LocRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95LocRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95LocRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95LocRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95LocRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95MxRecord struct { + // A valid mail server hostname. + Content param.Field[string] `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95MxRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95MxRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95MxRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95MxRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95MxRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95MxRecordTypeMx ZoneDNSRecordPatchParamsMpBuiT95MxRecordType = "MX" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95MxRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95MxRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95MxRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95MxRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95MxRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95MxRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95NaptrRecord struct { + // Components of a NAPTR record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95NaptrRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95NaptrRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a NAPTR record. +type ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordData struct { + // Flags. + Flags param.Field[string] `json:"flags"` + // Order. + Order param.Field[float64] `json:"order"` + // Preference. + Preference param.Field[float64] `json:"preference"` + // Regex. + Regex param.Field[string] `json:"regex"` + // Replacement. + Replacement param.Field[string] `json:"replacement"` + // Service. + Service param.Field[string] `json:"service"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTypeNaptr ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordType = "NAPTR" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95NaptrRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95NsRecord struct { + // A valid name server host name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95NsRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95NsRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95NsRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95NsRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95NsRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95NsRecordTypeNs ZoneDNSRecordPatchParamsMpBuiT95NsRecordType = "NS" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95NsRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95NsRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95NsRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95NsRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95NsRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95NsRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95PtrRecord struct { + // Domain name pointing to the address. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95PtrRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95PtrRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95PtrRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95PtrRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95PtrRecordTypePtr ZoneDNSRecordPatchParamsMpBuiT95PtrRecordType = "PTR" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95PtrRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecord struct { + // Components of a SMIMEA record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a SMIMEA record. +type ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordData struct { + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTypeSmimea ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordType = "SMIMEA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95SmimeaRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95SrvRecord struct { + // Components of a SRV record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95SrvRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95SrvRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SrvRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95SrvRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a SRV record. +type ZoneDNSRecordPatchParamsMpBuiT95SrvRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name param.Field[string] `json:"name" format:"hostname"` + // The port of the service. + Port param.Field[float64] `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto param.Field[string] `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service param.Field[string] `json:"service"` + // A valid hostname. + Target param.Field[string] `json:"target" format:"hostname"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SrvRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95SrvRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SrvRecordTypeSrv ZoneDNSRecordPatchParamsMpBuiT95SrvRecordType = "SRV" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95SrvRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95SshfpRecord struct { + // Components of a SSHFP record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SshfpRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95SshfpRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a SSHFP record. +type ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordData struct { + // algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // fingerprint. + Fingerprint param.Field[string] `json:"fingerprint"` + // type. + Type param.Field[float64] `json:"type"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTypeSshfp ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordType = "SSHFP" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95SshfpRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95SvcbRecord struct { + // Components of a SVCB record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SvcbRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95SvcbRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a SVCB record. +type ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTypeSvcb ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordType = "SVCB" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95SvcbRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95TlsaRecord struct { + // Components of a TLSA record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95TlsaRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95TlsaRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a TLSA record. +type ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordData struct { + // certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTypeTlsa ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordType = "TLSA" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95TlsaRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95TxtRecord struct { + // Text content for the record. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95TxtRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95TxtRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95TxtRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95TxtRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95TxtRecordTypeTxt ZoneDNSRecordPatchParamsMpBuiT95TxtRecordType = "TXT" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95TxtRecordTtlNumber = 1 +) + +type ZoneDNSRecordPatchParamsMpBuiT95UriRecord struct { + // Components of a URI record. + Data param.Field[ZoneDNSRecordPatchParamsMpBuiT95UriRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[ZoneDNSRecordPatchParamsMpBuiT95UriRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + Ttl param.Field[ZoneDNSRecordPatchParamsMpBuiT95UriRecordTtl] `json:"ttl"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95UriRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZoneDNSRecordPatchParamsMpBuiT95UriRecord) ImplementsZoneDNSRecordPatchParams() { + +} + +// Components of a URI record. +type ZoneDNSRecordPatchParamsMpBuiT95UriRecordData struct { + // The record content. + Content param.Field[string] `json:"content"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r ZoneDNSRecordPatchParamsMpBuiT95UriRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type ZoneDNSRecordPatchParamsMpBuiT95UriRecordType string + +const ( + ZoneDNSRecordPatchParamsMpBuiT95UriRecordTypeUri ZoneDNSRecordPatchParamsMpBuiT95UriRecordType = "URI" +) + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [ZoneDNSRecordPatchParamsMpBuiT95UriRecordTtlNumber]. +type ZoneDNSRecordPatchParamsMpBuiT95UriRecordTtl interface { + ImplementsZoneDNSRecordPatchParamsMpBuiT95UriRecordTtl() +} + +type ZoneDNSRecordPatchParamsMpBuiT95UriRecordTtlNumber float64 + +const ( + ZoneDNSRecordPatchParamsMpBuiT95UriRecordTtlNumber1 ZoneDNSRecordPatchParamsMpBuiT95UriRecordTtlNumber = 1 +) diff --git a/zonednsrecord_test.go b/zonednsrecord_test.go new file mode 100644 index 00000000000..6d4f275bad5 --- /dev/null +++ b/zonednsrecord_test.go @@ -0,0 +1,249 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneDNSRecordGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneDNSRecordUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneDNSRecordUpdateParamsMpBuiT95ARecord{ + Content: cloudflare.F("198.51.100.4"), + Name: cloudflare.F("example.com"), + Type: cloudflare.F(cloudflare.ZoneDNSRecordUpdateParamsMpBuiT95ARecordTypeA), + Comment: cloudflare.F("Domain verification record"), + Proxied: cloudflare.F(false), + Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + Ttl: cloudflare.F[cloudflare.ZoneDNSRecordUpdateParamsMpBuiT95ARecordTtl](shared.UnionFloat(3600.000000)), + }, + ) + 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 TestZoneDNSRecordDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneDNSRecordDNSRecordsForAZoneNewDNSRecordWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.DNSRecordsForAZoneNewDNSRecord( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecord{ + Content: cloudflare.F("198.51.100.4"), + Name: cloudflare.F("example.com"), + Type: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTypeA), + Comment: cloudflare.F("Domain verification record"), + Proxied: cloudflare.F(false), + Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + Ttl: cloudflare.F[cloudflare.ZoneDNSRecordDNSRecordsForAZoneNewDNSRecordParamsMpBuiT95ARecordTtl](shared.UnionFloat(3600.000000)), + }, + ) + 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 TestZoneDNSRecordDNSRecordsForAZoneListDNSRecordsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.DNSRecordsForAZoneListDNSRecords( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParams{ + Comment: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsComment{ + Present: cloudflare.F("string"), + Absent: cloudflare.F("string"), + Exact: cloudflare.F("Hello, world"), + Contains: cloudflare.F("ello, worl"), + Startswith: cloudflare.F("Hello, w"), + Endswith: cloudflare.F("o, world"), + }), + Content: cloudflare.F("127.0.0.1"), + Direction: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsDirectionAsc), + Match: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsMatchAny), + Name: cloudflare.F("example.com"), + Order: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsOrderType), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + Proxied: cloudflare.F(false), + Search: cloudflare.F("www.cloudflare.com"), + Tag: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTag{ + Present: cloudflare.F("important"), + Absent: cloudflare.F("important"), + Exact: cloudflare.F("greeting:Hello, world"), + Contains: cloudflare.F("greeting:ello, worl"), + Startswith: cloudflare.F("greeting:Hello, w"), + Endswith: cloudflare.F("greeting:o, world"), + }), + TagMatch: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTagMatchAny), + Type: cloudflare.F(cloudflare.ZoneDNSRecordDNSRecordsForAZoneListDNSRecordsParamsTypeA), + }, + ) + 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 TestZoneDNSRecordPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.Patch( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneDNSRecordPatchParamsMpBuiT95ARecord{ + Content: cloudflare.F("198.51.100.4"), + Name: cloudflare.F("example.com"), + Type: cloudflare.F(cloudflare.ZoneDNSRecordPatchParamsMpBuiT95ARecordTypeA), + Comment: cloudflare.F("Domain verification record"), + Proxied: cloudflare.F(false), + Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + Ttl: cloudflare.F[cloudflare.ZoneDNSRecordPatchParamsMpBuiT95ARecordTtl](shared.UnionFloat(3600.000000)), + }, + ) + 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/zonednsrecordexport.go b/zonednsrecordexport.go new file mode 100644 index 00000000000..aef34d2c83d --- /dev/null +++ b/zonednsrecordexport.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneDNSRecordExportService 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 [NewZoneDNSRecordExportService] +// method instead. +type ZoneDNSRecordExportService struct { + Options []option.RequestOption +} + +// NewZoneDNSRecordExportService 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 NewZoneDNSRecordExportService(opts ...option.RequestOption) (r *ZoneDNSRecordExportService) { + r = &ZoneDNSRecordExportService{} + r.Options = opts + return +} + +// You can export your +// [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this +// endpoint. +// +// See +// [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/import-and-export/ "Import and export records") +// for more information. +func (r *ZoneDNSRecordExportService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *string, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "text/plain")}, opts...) + path := fmt.Sprintf("zones/%s/dns_records/export", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} diff --git a/zonednsrecordexport_test.go b/zonednsrecordexport_test.go new file mode 100644 index 00000000000..6e7e2f32dcf --- /dev/null +++ b/zonednsrecordexport_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneDNSRecordExportList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.Exports.List(context.TODO(), "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/zonednsrecordimport.go b/zonednsrecordimport.go new file mode 100644 index 00000000000..5a8932bf530 --- /dev/null +++ b/zonednsrecordimport.go @@ -0,0 +1,186 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneDNSRecordImportService 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 [NewZoneDNSRecordImportService] +// method instead. +type ZoneDNSRecordImportService struct { + Options []option.RequestOption +} + +// NewZoneDNSRecordImportService 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 NewZoneDNSRecordImportService(opts ...option.RequestOption) (r *ZoneDNSRecordImportService) { + r = &ZoneDNSRecordImportService{} + r.Options = opts + return +} + +// You can upload your +// [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this +// endpoint. It assumes that cURL is called from a location with bind_config.txt +// (valid BIND config) present. +// +// See +// [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/import-and-export/ "Import and export records") +// for more information. +func (r *ZoneDNSRecordImportService) DNSRecordsForAZoneImportDNSRecords(ctx context.Context, zoneIdentifier string, body ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsParams, opts ...option.RequestOption) (res *ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_records/import", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponse struct { + Errors []ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseError `json:"errors"` + Messages []ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseMessage `json:"messages"` + Result ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseSuccess `json:"success"` + Timing ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseTiming `json:"timing"` + JSON zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseJSON `json:"-"` +} + +// zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseJSON contains the +// JSON metadata for the struct +// [ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponse] +type zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + Timing apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseErrorJSON `json:"-"` +} + +// zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseError] +type zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseMessageJSON `json:"-"` +} + +// zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseMessage] +type zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseResult struct { + // Number of DNS records added. + RecsAdded float64 `json:"recs_added"` + // Total number of DNS records parsed. + TotalRecordsParsed float64 `json:"total_records_parsed"` + JSON zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseResultJSON `json:"-"` +} + +// zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseResult] +type zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseResultJSON struct { + RecsAdded apijson.Field + TotalRecordsParsed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseSuccess bool + +const ( + ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseSuccessTrue ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseSuccess = true +) + +type ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseTiming struct { + // When the file parsing ended. + EndTime time.Time `json:"end_time" format:"date-time"` + // Processing time of the file in seconds. + ProcessTime float64 `json:"process_time"` + // When the file parsing started. + StartTime time.Time `json:"start_time" format:"date-time"` + JSON zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseTimingJSON `json:"-"` +} + +// zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseTimingJSON contains +// the JSON metadata for the struct +// [ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseTiming] +type zoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseTimingJSON struct { + EndTime apijson.Field + ProcessTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsResponseTiming) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsParams struct { + // BIND config to import. + // + // **Tip:** When using cURL, a file can be uploaded using + // `--form 'file=@bind_config.txt'`. + File param.Field[string] `json:"file,required"` + // Whether or not proxiable records should receive the performance and security + // benefits of Cloudflare. + // + // The value should be either `true` or `false`. + Proxied param.Field[string] `json:"proxied"` +} + +func (r ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonednsrecordimport_test.go b/zonednsrecordimport_test.go new file mode 100644 index 00000000000..0b172aeb188 --- /dev/null +++ b/zonednsrecordimport_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.Imports.DNSRecordsForAZoneImportDNSRecords( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneDNSRecordImportDNSRecordsForAZoneImportDNSRecordsParams{ + File: cloudflare.F("www.example.com. 300 IN A 127.0.0.1"), + Proxied: cloudflare.F("true"), + }, + ) + 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/zonednsrecordscan.go b/zonednsrecordscan.go new file mode 100644 index 00000000000..bd2869fdd2a --- /dev/null +++ b/zonednsrecordscan.go @@ -0,0 +1,162 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneDNSRecordScanService 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 [NewZoneDNSRecordScanService] method +// instead. +type ZoneDNSRecordScanService struct { + Options []option.RequestOption +} + +// NewZoneDNSRecordScanService 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 NewZoneDNSRecordScanService(opts ...option.RequestOption) (r *ZoneDNSRecordScanService) { + r = &ZoneDNSRecordScanService{} + r.Options = opts + return +} + +// Scan for common DNS records on your domain and automatically add them to your +// zone. Useful if you haven't updated your nameservers yet. +func (r *ZoneDNSRecordScanService) DNSRecordsForAZoneScanDNSRecords(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dns_records/scan", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponse struct { + Errors []ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseError `json:"errors"` + Messages []ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseMessage `json:"messages"` + Result ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseSuccess `json:"success"` + Timing ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseTiming `json:"timing"` + JSON zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseJSON `json:"-"` +} + +// zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseJSON contains the JSON +// metadata for the struct +// [ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponse] +type zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + Timing apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseErrorJSON `json:"-"` +} + +// zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseError] +type zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseMessageJSON `json:"-"` +} + +// zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseMessage] +type zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseResult struct { + // Number of DNS records added. + RecsAdded float64 `json:"recs_added"` + // Total number of DNS records parsed. + TotalRecordsParsed float64 `json:"total_records_parsed"` + JSON zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseResultJSON `json:"-"` +} + +// zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseResult] +type zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseResultJSON struct { + RecsAdded apijson.Field + TotalRecordsParsed apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseSuccess bool + +const ( + ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseSuccessTrue ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseSuccess = true +) + +type ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseTiming struct { + // When the file parsing ended. + EndTime time.Time `json:"end_time" format:"date-time"` + // Processing time of the file in seconds. + ProcessTime float64 `json:"process_time"` + // When the file parsing started. + StartTime time.Time `json:"start_time" format:"date-time"` + JSON zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseTimingJSON `json:"-"` +} + +// zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseTimingJSON contains the +// JSON metadata for the struct +// [ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseTiming] +type zoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseTimingJSON struct { + EndTime apijson.Field + ProcessTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecordsResponseTiming) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonednsrecordscan_test.go b/zonednsrecordscan_test.go new file mode 100644 index 00000000000..2921ecc82c8 --- /dev/null +++ b/zonednsrecordscan_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneDNSRecordScanDNSRecordsForAZoneScanDNSRecords(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.DNSRecords.Scans.DNSRecordsForAZoneScanDNSRecords(context.TODO(), "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/zonednssec.go b/zonednssec.go index 15eb26a6d1b..66452a4dc08 100644 --- a/zonednssec.go +++ b/zonednssec.go @@ -32,7 +32,7 @@ func NewZoneDnssecService(opts ...option.RequestOption) (r *ZoneDnssecService) { } // Details about DNSSEC status and configuration. -func (r *ZoneDnssecService) Get(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *DnssecSingle, err error) { +func (r *ZoneDnssecService) Get(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneDnssecGetResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("zones/%s/dnssec", zoneIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) @@ -40,24 +40,180 @@ func (r *ZoneDnssecService) Get(ctx context.Context, zoneIdentifier string, opts } // Enable or disable DNSSEC. -func (r *ZoneDnssecService) Update(ctx context.Context, zoneIdentifier string, body ZoneDnssecUpdateParams, opts ...option.RequestOption) (res *DnssecSingle, err error) { +func (r *ZoneDnssecService) Update(ctx context.Context, zoneIdentifier string, body ZoneDnssecUpdateParams, opts ...option.RequestOption) (res *ZoneDnssecUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("zones/%s/dnssec", zoneIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) return } -type DnssecSingle struct { - Errors []DnssecSingleError `json:"errors"` - Messages []DnssecSingleMessage `json:"messages"` - Result DnssecSingleResult `json:"result"` +// Delete DNSSEC. +func (r *ZoneDnssecService) Delete(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneDnssecDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/dnssec", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +type ZoneDnssecGetResponse struct { + Errors []ZoneDnssecGetResponseError `json:"errors"` + Messages []ZoneDnssecGetResponseMessage `json:"messages"` + Result ZoneDnssecGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneDnssecGetResponseSuccess `json:"success"` + JSON zoneDnssecGetResponseJSON `json:"-"` +} + +// zoneDnssecGetResponseJSON contains the JSON metadata for the struct +// [ZoneDnssecGetResponse] +type zoneDnssecGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDnssecGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDnssecGetResponseErrorJSON `json:"-"` +} + +// zoneDnssecGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneDnssecGetResponseError] +type zoneDnssecGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDnssecGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDnssecGetResponseMessageJSON `json:"-"` +} + +// zoneDnssecGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneDnssecGetResponseMessage] +type zoneDnssecGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDnssecGetResponseResult struct { + // Algorithm key code. + Algorithm string `json:"algorithm,nullable"` + // Digest hash. + Digest string `json:"digest,nullable"` + // Type of digest algorithm. + DigestAlgorithm string `json:"digest_algorithm,nullable"` + // Coded type for digest algorithm. + DigestType string `json:"digest_type,nullable"` + // If true, multi-signer DNSSEC is enabled on the zone, allowing multiple providers + // to serve a DNSSEC-signed zone at the same time. This is required for DNSKEY + // records (except those automatically generated by Cloudflare) to be added to the + // zone. + // + // See + // [Multi-signer DNSSEC](https://developers.cloudflare.com/dns/dnssec/multi-signer-dnssec/) + // for details. + DnssecMultiSigner bool `json:"dnssec_multi_signer"` + // If true, allows Cloudflare to transfer in a DNSSEC-signed zone including + // signatures from an external provider, without requiring Cloudflare to sign any + // records on the fly. + // + // Note that this feature has some limitations. See + // [Cloudflare as Secondary](https://developers.cloudflare.com/dns/zone-setups/zone-transfers/cloudflare-as-secondary/setup/#dnssec) + // for details. + DnssecPresigned bool `json:"dnssec_presigned"` + // Full DS record. + Ds string `json:"ds,nullable"` + // Flag for DNSSEC record. + Flags float64 `json:"flags,nullable"` + // Code for key tag. + KeyTag float64 `json:"key_tag,nullable"` + // Algorithm key type. + KeyType string `json:"key_type,nullable"` + // When DNSSEC was last modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Public key for DS record. + PublicKey string `json:"public_key,nullable"` + // Status of DNSSEC, based on user-desired state and presence of necessary records. + Status ZoneDnssecGetResponseResultStatus `json:"status"` + JSON zoneDnssecGetResponseResultJSON `json:"-"` +} + +// zoneDnssecGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneDnssecGetResponseResult] +type zoneDnssecGetResponseResultJSON struct { + Algorithm apijson.Field + Digest apijson.Field + DigestAlgorithm apijson.Field + DigestType apijson.Field + DnssecMultiSigner apijson.Field + DnssecPresigned apijson.Field + Ds apijson.Field + Flags apijson.Field + KeyTag apijson.Field + KeyType apijson.Field + ModifiedOn apijson.Field + PublicKey apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of DNSSEC, based on user-desired state and presence of necessary records. +type ZoneDnssecGetResponseResultStatus string + +const ( + ZoneDnssecGetResponseResultStatusActive ZoneDnssecGetResponseResultStatus = "active" + ZoneDnssecGetResponseResultStatusPending ZoneDnssecGetResponseResultStatus = "pending" + ZoneDnssecGetResponseResultStatusDisabled ZoneDnssecGetResponseResultStatus = "disabled" + ZoneDnssecGetResponseResultStatusPendingDisabled ZoneDnssecGetResponseResultStatus = "pending-disabled" + ZoneDnssecGetResponseResultStatusError ZoneDnssecGetResponseResultStatus = "error" +) + +// Whether the API call was successful +type ZoneDnssecGetResponseSuccess bool + +const ( + ZoneDnssecGetResponseSuccessTrue ZoneDnssecGetResponseSuccess = true +) + +type ZoneDnssecUpdateResponse struct { + Errors []ZoneDnssecUpdateResponseError `json:"errors"` + Messages []ZoneDnssecUpdateResponseMessage `json:"messages"` + Result ZoneDnssecUpdateResponseResult `json:"result"` // Whether the API call was successful - Success DnssecSingleSuccess `json:"success"` - JSON dnssecSingleJSON `json:"-"` + Success ZoneDnssecUpdateResponseSuccess `json:"success"` + JSON zoneDnssecUpdateResponseJSON `json:"-"` } -// dnssecSingleJSON contains the JSON metadata for the struct [DnssecSingle] -type dnssecSingleJSON struct { +// zoneDnssecUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneDnssecUpdateResponse] +type zoneDnssecUpdateResponseJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -66,49 +222,49 @@ type dnssecSingleJSON struct { ExtraFields map[string]apijson.Field } -func (r *DnssecSingle) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneDnssecUpdateResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DnssecSingleError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON dnssecSingleErrorJSON `json:"-"` +type ZoneDnssecUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDnssecUpdateResponseErrorJSON `json:"-"` } -// dnssecSingleErrorJSON contains the JSON metadata for the struct -// [DnssecSingleError] -type dnssecSingleErrorJSON struct { +// zoneDnssecUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneDnssecUpdateResponseError] +type zoneDnssecUpdateResponseErrorJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *DnssecSingleError) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneDnssecUpdateResponseError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DnssecSingleMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON dnssecSingleMessageJSON `json:"-"` +type ZoneDnssecUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDnssecUpdateResponseMessageJSON `json:"-"` } -// dnssecSingleMessageJSON contains the JSON metadata for the struct -// [DnssecSingleMessage] -type dnssecSingleMessageJSON struct { +// zoneDnssecUpdateResponseMessageJSON contains the JSON metadata for the struct +// [ZoneDnssecUpdateResponseMessage] +type zoneDnssecUpdateResponseMessageJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *DnssecSingleMessage) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneDnssecUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DnssecSingleResult struct { +type ZoneDnssecUpdateResponseResult struct { // Algorithm key code. Algorithm string `json:"algorithm,nullable"` // Digest hash. @@ -117,6 +273,23 @@ type DnssecSingleResult struct { DigestAlgorithm string `json:"digest_algorithm,nullable"` // Coded type for digest algorithm. DigestType string `json:"digest_type,nullable"` + // If true, multi-signer DNSSEC is enabled on the zone, allowing multiple providers + // to serve a DNSSEC-signed zone at the same time. This is required for DNSKEY + // records (except those automatically generated by Cloudflare) to be added to the + // zone. + // + // See + // [Multi-signer DNSSEC](https://developers.cloudflare.com/dns/dnssec/multi-signer-dnssec/) + // for details. + DnssecMultiSigner bool `json:"dnssec_multi_signer"` + // If true, allows Cloudflare to transfer in a DNSSEC-signed zone including + // signatures from an external provider, without requiring Cloudflare to sign any + // records on the fly. + // + // Note that this feature has some limitations. See + // [Cloudflare as Secondary](https://developers.cloudflare.com/dns/zone-setups/zone-transfers/cloudflare-as-secondary/setup/#dnssec) + // for details. + DnssecPresigned bool `json:"dnssec_presigned"` // Full DS record. Ds string `json:"ds,nullable"` // Flag for DNSSEC record. @@ -130,53 +303,141 @@ type DnssecSingleResult struct { // Public key for DS record. PublicKey string `json:"public_key,nullable"` // Status of DNSSEC, based on user-desired state and presence of necessary records. - Status DnssecSingleResultStatus `json:"status"` - JSON dnssecSingleResultJSON `json:"-"` -} - -// dnssecSingleResultJSON contains the JSON metadata for the struct -// [DnssecSingleResult] -type dnssecSingleResultJSON struct { - Algorithm apijson.Field - Digest apijson.Field - DigestAlgorithm apijson.Field - DigestType apijson.Field - Ds apijson.Field - Flags apijson.Field - KeyTag apijson.Field - KeyType apijson.Field - ModifiedOn apijson.Field - PublicKey apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DnssecSingleResult) UnmarshalJSON(data []byte) (err error) { + Status ZoneDnssecUpdateResponseResultStatus `json:"status"` + JSON zoneDnssecUpdateResponseResultJSON `json:"-"` +} + +// zoneDnssecUpdateResponseResultJSON contains the JSON metadata for the struct +// [ZoneDnssecUpdateResponseResult] +type zoneDnssecUpdateResponseResultJSON struct { + Algorithm apijson.Field + Digest apijson.Field + DigestAlgorithm apijson.Field + DigestType apijson.Field + DnssecMultiSigner apijson.Field + DnssecPresigned apijson.Field + Ds apijson.Field + Flags apijson.Field + KeyTag apijson.Field + KeyType apijson.Field + ModifiedOn apijson.Field + PublicKey apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Status of DNSSEC, based on user-desired state and presence of necessary records. -type DnssecSingleResultStatus string +type ZoneDnssecUpdateResponseResultStatus string const ( - DnssecSingleResultStatusActive DnssecSingleResultStatus = "active" - DnssecSingleResultStatusPending DnssecSingleResultStatus = "pending" - DnssecSingleResultStatusDisabled DnssecSingleResultStatus = "disabled" - DnssecSingleResultStatusPendingDisabled DnssecSingleResultStatus = "pending-disabled" - DnssecSingleResultStatusError DnssecSingleResultStatus = "error" + ZoneDnssecUpdateResponseResultStatusActive ZoneDnssecUpdateResponseResultStatus = "active" + ZoneDnssecUpdateResponseResultStatusPending ZoneDnssecUpdateResponseResultStatus = "pending" + ZoneDnssecUpdateResponseResultStatusDisabled ZoneDnssecUpdateResponseResultStatus = "disabled" + ZoneDnssecUpdateResponseResultStatusPendingDisabled ZoneDnssecUpdateResponseResultStatus = "pending-disabled" + ZoneDnssecUpdateResponseResultStatusError ZoneDnssecUpdateResponseResultStatus = "error" ) // Whether the API call was successful -type DnssecSingleSuccess bool +type ZoneDnssecUpdateResponseSuccess bool + +const ( + ZoneDnssecUpdateResponseSuccessTrue ZoneDnssecUpdateResponseSuccess = true +) + +type ZoneDnssecDeleteResponse struct { + Errors []ZoneDnssecDeleteResponseError `json:"errors"` + Messages []ZoneDnssecDeleteResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success ZoneDnssecDeleteResponseSuccess `json:"success"` + JSON zoneDnssecDeleteResponseJSON `json:"-"` +} + +// zoneDnssecDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneDnssecDeleteResponse] +type zoneDnssecDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDnssecDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDnssecDeleteResponseErrorJSON `json:"-"` +} + +// zoneDnssecDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneDnssecDeleteResponseError] +type zoneDnssecDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneDnssecDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneDnssecDeleteResponseMessageJSON `json:"-"` +} + +// zoneDnssecDeleteResponseMessageJSON contains the JSON metadata for the struct +// [ZoneDnssecDeleteResponseMessage] +type zoneDnssecDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneDnssecDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneDnssecDeleteResponseSuccess bool const ( - DnssecSingleSuccessTrue DnssecSingleSuccess = true + ZoneDnssecDeleteResponseSuccessTrue ZoneDnssecDeleteResponseSuccess = true ) type ZoneDnssecUpdateParams struct { + // If true, multi-signer DNSSEC is enabled on the zone, allowing multiple providers + // to serve a DNSSEC-signed zone at the same time. This is required for DNSKEY + // records (except those automatically generated by Cloudflare) to be added to the + // zone. + // + // See + // [Multi-signer DNSSEC](https://developers.cloudflare.com/dns/dnssec/multi-signer-dnssec/) + // for details. + DnssecMultiSigner param.Field[bool] `json:"dnssec_multi_signer"` + // If true, allows Cloudflare to transfer in a DNSSEC-signed zone including + // signatures from an external provider, without requiring Cloudflare to sign any + // records on the fly. + // + // Note that this feature has some limitations. See + // [Cloudflare as Secondary](https://developers.cloudflare.com/dns/zone-setups/zone-transfers/cloudflare-as-secondary/setup/#dnssec) + // for details. + DnssecPresigned param.Field[bool] `json:"dnssec_presigned"` // Status of DNSSEC, based on user-desired state and presence of necessary records. - Status param.Field[ZoneDnssecUpdateParamsStatus] `json:"status,required"` + Status param.Field[ZoneDnssecUpdateParamsStatus] `json:"status"` } func (r ZoneDnssecUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/zonednssec_test.go b/zonednssec_test.go index c9ccebbc7d6..b42aab33b75 100644 --- a/zonednssec_test.go +++ b/zonednssec_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneDnssecGet(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 @@ -23,8 +24,10 @@ func TestZoneDnssecGet(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Dnssecs.Get(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { @@ -36,7 +39,8 @@ func TestZoneDnssecGet(t *testing.T) { } } -func TestZoneDnssecUpdate(t *testing.T) { +func TestZoneDnssecUpdateWithOptionalParams(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 @@ -46,14 +50,18 @@ func TestZoneDnssecUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Dnssecs.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.ZoneDnssecUpdateParams{ - Status: cloudflare.F(cloudflare.ZoneDnssecUpdateParamsStatusActive), + DnssecMultiSigner: cloudflare.F(false), + DnssecPresigned: cloudflare.F(true), + Status: cloudflare.F(cloudflare.ZoneDnssecUpdateParamsStatusActive), }, ) if err != nil { @@ -64,3 +72,29 @@ func TestZoneDnssecUpdate(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestZoneDnssecDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Dnssecs.Delete(context.TODO(), "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/zoneemail.go b/zoneemail.go new file mode 100644 index 00000000000..182f915abc2 --- /dev/null +++ b/zoneemail.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneEmailService 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 [NewZoneEmailService] method instead. +type ZoneEmailService struct { + Options []option.RequestOption + Routings *ZoneEmailRoutingService +} + +// NewZoneEmailService 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 NewZoneEmailService(opts ...option.RequestOption) (r *ZoneEmailService) { + r = &ZoneEmailService{} + r.Options = opts + r.Routings = NewZoneEmailRoutingService(opts...) + return +} diff --git a/zoneemailrouting.go b/zoneemailrouting.go new file mode 100644 index 00000000000..ffd926aaeec --- /dev/null +++ b/zoneemailrouting.go @@ -0,0 +1,184 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneEmailRoutingService 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 [NewZoneEmailRoutingService] method +// instead. +type ZoneEmailRoutingService struct { + Options []option.RequestOption + Disables *ZoneEmailRoutingDisableService + DNS *ZoneEmailRoutingDNSService + Enables *ZoneEmailRoutingEnableService + Rules *ZoneEmailRoutingRuleService +} + +// NewZoneEmailRoutingService 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 NewZoneEmailRoutingService(opts ...option.RequestOption) (r *ZoneEmailRoutingService) { + r = &ZoneEmailRoutingService{} + r.Options = opts + r.Disables = NewZoneEmailRoutingDisableService(opts...) + r.DNS = NewZoneEmailRoutingDNSService(opts...) + r.Enables = NewZoneEmailRoutingEnableService(opts...) + r.Rules = NewZoneEmailRoutingRuleService(opts...) + return +} + +// Get information about the settings for your Email Routing zone. +func (r *ZoneEmailRoutingService) EmailRoutingSettingsGetEmailRoutingSettings(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponse struct { + Errors []ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseError `json:"errors"` + Messages []ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseMessage `json:"messages"` + Result ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseSuccess `json:"success"` + JSON zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseJSON `json:"-"` +} + +// zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseJSON contains +// the JSON metadata for the struct +// [ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponse] +type zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseError] +type zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseMessage] +type zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResult struct { + // The date and time the settings have been created. + Created time.Time `json:"created" format:"date-time"` + // State of the zone settings for Email Routing. + Enabled ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultEnabled `json:"enabled"` + // The date and time the settings have been modified. + Modified time.Time `json:"modified" format:"date-time"` + // Domain of your zone. + Name string `json:"name"` + // Flag to check if the user skipped the configuration wizard. + SkipWizard ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultSkipWizard `json:"skip_wizard"` + // Show the state of your account, and the type or configuration error. + Status ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatus `json:"status"` + // Email Routing settings identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResult] +type zoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultJSON struct { + Created apijson.Field + Enabled apijson.Field + Modified apijson.Field + Name apijson.Field + SkipWizard apijson.Field + Status apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// State of the zone settings for Email Routing. +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultEnabled bool + +const ( + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultEnabledTrue ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultEnabled = true + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultEnabledFalse ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultEnabled = false +) + +// Flag to check if the user skipped the configuration wizard. +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultSkipWizard bool + +const ( + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultSkipWizardTrue ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultSkipWizard = true + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultSkipWizardFalse ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultSkipWizard = false +) + +// Show the state of your account, and the type or configuration error. +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatus string + +const ( + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatusReady ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatus = "ready" + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatusUnconfigured ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatus = "unconfigured" + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatusMisconfigured ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatus = "misconfigured" + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatusMisconfiguredLocked ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatus = "misconfigured/locked" + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatusUnlocked ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseResultStatus = "unlocked" +) + +// Whether the API call was successful +type ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseSuccess bool + +const ( + ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseSuccessTrue ZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettingsResponseSuccess = true +) diff --git a/zoneemailrouting_test.go b/zoneemailrouting_test.go new file mode 100644 index 00000000000..c38ed73134e --- /dev/null +++ b/zoneemailrouting_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneEmailRoutingEmailRoutingSettingsGetEmailRoutingSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.EmailRoutingSettingsGetEmailRoutingSettings(context.TODO(), "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/zoneemailroutingdisable.go b/zoneemailroutingdisable.go new file mode 100644 index 00000000000..6cecfac61fb --- /dev/null +++ b/zoneemailroutingdisable.go @@ -0,0 +1,177 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneEmailRoutingDisableService 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 +// [NewZoneEmailRoutingDisableService] method instead. +type ZoneEmailRoutingDisableService struct { + Options []option.RequestOption +} + +// NewZoneEmailRoutingDisableService 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 NewZoneEmailRoutingDisableService(opts ...option.RequestOption) (r *ZoneEmailRoutingDisableService) { + r = &ZoneEmailRoutingDisableService{} + r.Options = opts + return +} + +// Disable your Email Routing zone. Also removes additional MX records previously +// required for Email Routing to work. +func (r *ZoneEmailRoutingDisableService) EmailRoutingSettingsDisableEmailRouting(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/disable", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponse struct { + Errors []ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseError `json:"errors"` + Messages []ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseMessage `json:"messages"` + Result ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseSuccess `json:"success"` + JSON zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseJSON `json:"-"` +} + +// zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponse] +type zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseError] +type zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseMessage] +type zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResult struct { + // The date and time the settings have been created. + Created time.Time `json:"created" format:"date-time"` + // State of the zone settings for Email Routing. + Enabled ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultEnabled `json:"enabled"` + // The date and time the settings have been modified. + Modified time.Time `json:"modified" format:"date-time"` + // Domain of your zone. + Name string `json:"name"` + // Flag to check if the user skipped the configuration wizard. + SkipWizard ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultSkipWizard `json:"skip_wizard"` + // Show the state of your account, and the type or configuration error. + Status ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatus `json:"status"` + // Email Routing settings identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResult] +type zoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultJSON struct { + Created apijson.Field + Enabled apijson.Field + Modified apijson.Field + Name apijson.Field + SkipWizard apijson.Field + Status apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// State of the zone settings for Email Routing. +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultEnabled bool + +const ( + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultEnabledTrue ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultEnabled = true + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultEnabledFalse ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultEnabled = false +) + +// Flag to check if the user skipped the configuration wizard. +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultSkipWizard bool + +const ( + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultSkipWizardTrue ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultSkipWizard = true + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultSkipWizardFalse ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultSkipWizard = false +) + +// Show the state of your account, and the type or configuration error. +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatus string + +const ( + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatusReady ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatus = "ready" + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatusUnconfigured ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatus = "unconfigured" + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatusMisconfigured ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatus = "misconfigured" + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatusMisconfiguredLocked ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatus = "misconfigured/locked" + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatusUnlocked ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseResultStatus = "unlocked" +) + +// Whether the API call was successful +type ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseSuccess bool + +const ( + ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseSuccessTrue ZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRoutingResponseSuccess = true +) diff --git a/zoneemailroutingdisable_test.go b/zoneemailroutingdisable_test.go new file mode 100644 index 00000000000..31e407b35be --- /dev/null +++ b/zoneemailroutingdisable_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneEmailRoutingDisableEmailRoutingSettingsDisableEmailRouting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Disables.EmailRoutingSettingsDisableEmailRouting(context.TODO(), "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/zoneemailroutingdns.go b/zoneemailroutingdns.go new file mode 100644 index 00000000000..eb6368e01ef --- /dev/null +++ b/zoneemailroutingdns.go @@ -0,0 +1,229 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneEmailRoutingDNSService 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 [NewZoneEmailRoutingDNSService] +// method instead. +type ZoneEmailRoutingDNSService struct { + Options []option.RequestOption +} + +// NewZoneEmailRoutingDNSService 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 NewZoneEmailRoutingDNSService(opts ...option.RequestOption) (r *ZoneEmailRoutingDNSService) { + r = &ZoneEmailRoutingDNSService{} + r.Options = opts + return +} + +// Show the DNS records needed to configure your Email Routing zone. +func (r *ZoneEmailRoutingDNSService) EmailRoutingSettingsEmailRoutingDNSSettings(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/dns", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponse struct { + Errors []ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseError `json:"errors"` + Messages []ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseMessage `json:"messages"` + Result []ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResult `json:"result"` + ResultInfo ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseSuccess `json:"success"` + JSON zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseJSON `json:"-"` +} + +// zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponse] +type zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseError] +type zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseMessage] +type zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// List of records needed to enable an Email Routing zone. +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResult struct { + // DNS record content. + Content string `json:"content"` + // DNS record name (or @ for the zone apex). + Name string `json:"name"` + // Required for MX, SRV and URI records. Unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority"` + // Time to live, in seconds, of the DNS record. Must be between 60 and 86400, or 1 + // for 'automatic'. + Ttl ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtl `json:"ttl"` + // DNS record type. + Type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType `json:"type"` + JSON zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResult] +type zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultJSON struct { + Content apijson.Field + Name apijson.Field + Priority apijson.Field + Ttl apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Time to live, in seconds, of the DNS record. Must be between 60 and 86400, or 1 +// for 'automatic'. +// +// Union satisfied by [shared.UnionFloat] or +// [ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtlNumber]. +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtl interface { + ImplementsZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtl() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtl)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + ) +} + +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtlNumber float64 + +const ( + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtlNumber1 ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTtlNumber = 1 +) + +// DNS record type. +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType string + +const ( + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeA ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "A" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeAaaa ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "AAAA" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeCname ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "CNAME" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeHTTPs ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "HTTPS" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeTxt ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "TXT" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeSrv ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "SRV" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeLoc ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "LOC" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeMx ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "MX" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeNs ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "NS" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeCert ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "CERT" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeDnskey ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "DNSKEY" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeDs ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "DS" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeNaptr ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "NAPTR" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeSmimea ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "SMIMEA" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeSshfp ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "SSHFP" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeSvcb ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "SVCB" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeTlsa ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "TLSA" + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultTypeUri ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultType = "URI" +) + +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultInfoJSON `json:"-"` +} + +// zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultInfo] +type zoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseSuccess bool + +const ( + ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseSuccessTrue ZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettingsResponseSuccess = true +) diff --git a/zoneemailroutingdns_test.go b/zoneemailroutingdns_test.go new file mode 100644 index 00000000000..728ebba2ce0 --- /dev/null +++ b/zoneemailroutingdns_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneEmailRoutingDNSEmailRoutingSettingsEmailRoutingDNSSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.DNS.EmailRoutingSettingsEmailRoutingDNSSettings(context.TODO(), "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/zoneemailroutingenable.go b/zoneemailroutingenable.go new file mode 100644 index 00000000000..96acf33f2df --- /dev/null +++ b/zoneemailroutingenable.go @@ -0,0 +1,176 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneEmailRoutingEnableService 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 [NewZoneEmailRoutingEnableService] +// method instead. +type ZoneEmailRoutingEnableService struct { + Options []option.RequestOption +} + +// NewZoneEmailRoutingEnableService 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 NewZoneEmailRoutingEnableService(opts ...option.RequestOption) (r *ZoneEmailRoutingEnableService) { + r = &ZoneEmailRoutingEnableService{} + r.Options = opts + return +} + +// Enable you Email Routing zone. Add and lock the necessary MX and SPF records. +func (r *ZoneEmailRoutingEnableService) EmailRoutingSettingsEnableEmailRouting(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/enable", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponse struct { + Errors []ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseError `json:"errors"` + Messages []ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseMessage `json:"messages"` + Result ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseSuccess `json:"success"` + JSON zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseJSON `json:"-"` +} + +// zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponse] +type zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseError] +type zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseMessage] +type zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResult struct { + // The date and time the settings have been created. + Created time.Time `json:"created" format:"date-time"` + // State of the zone settings for Email Routing. + Enabled ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultEnabled `json:"enabled"` + // The date and time the settings have been modified. + Modified time.Time `json:"modified" format:"date-time"` + // Domain of your zone. + Name string `json:"name"` + // Flag to check if the user skipped the configuration wizard. + SkipWizard ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultSkipWizard `json:"skip_wizard"` + // Show the state of your account, and the type or configuration error. + Status ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatus `json:"status"` + // Email Routing settings identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResult] +type zoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultJSON struct { + Created apijson.Field + Enabled apijson.Field + Modified apijson.Field + Name apijson.Field + SkipWizard apijson.Field + Status apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// State of the zone settings for Email Routing. +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultEnabled bool + +const ( + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultEnabledTrue ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultEnabled = true + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultEnabledFalse ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultEnabled = false +) + +// Flag to check if the user skipped the configuration wizard. +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultSkipWizard bool + +const ( + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultSkipWizardTrue ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultSkipWizard = true + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultSkipWizardFalse ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultSkipWizard = false +) + +// Show the state of your account, and the type or configuration error. +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatus string + +const ( + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatusReady ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatus = "ready" + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatusUnconfigured ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatus = "unconfigured" + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatusMisconfigured ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatus = "misconfigured" + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatusMisconfiguredLocked ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatus = "misconfigured/locked" + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatusUnlocked ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseResultStatus = "unlocked" +) + +// Whether the API call was successful +type ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseSuccess bool + +const ( + ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseSuccessTrue ZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRoutingResponseSuccess = true +) diff --git a/zoneemailroutingenable_test.go b/zoneemailroutingenable_test.go new file mode 100644 index 00000000000..b4cd2489044 --- /dev/null +++ b/zoneemailroutingenable_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneEmailRoutingEnableEmailRoutingSettingsEnableEmailRouting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Enables.EmailRoutingSettingsEnableEmailRouting(context.TODO(), "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/zoneemailroutingrule.go b/zoneemailroutingrule.go new file mode 100644 index 00000000000..3062a4c8d80 --- /dev/null +++ b/zoneemailroutingrule.go @@ -0,0 +1,1097 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneEmailRoutingRuleService 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 [NewZoneEmailRoutingRuleService] +// method instead. +type ZoneEmailRoutingRuleService struct { + Options []option.RequestOption + CatchAlls *ZoneEmailRoutingRuleCatchAllService +} + +// NewZoneEmailRoutingRuleService 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 NewZoneEmailRoutingRuleService(opts ...option.RequestOption) (r *ZoneEmailRoutingRuleService) { + r = &ZoneEmailRoutingRuleService{} + r.Options = opts + r.CatchAlls = NewZoneEmailRoutingRuleCatchAllService(opts...) + return +} + +// Get information for a specific routing rule already created. +func (r *ZoneEmailRoutingRuleService) Get(ctx context.Context, zoneIdentifier string, ruleIdentifier string, opts ...option.RequestOption) (res *ZoneEmailRoutingRuleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/rules/%s", zoneIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update actions and matches, or enable/disable specific routing rules. +func (r *ZoneEmailRoutingRuleService) Update(ctx context.Context, zoneIdentifier string, ruleIdentifier string, body ZoneEmailRoutingRuleUpdateParams, opts ...option.RequestOption) (res *ZoneEmailRoutingRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/rules/%s", zoneIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete a specific routing rule. +func (r *ZoneEmailRoutingRuleService) Delete(ctx context.Context, zoneIdentifier string, ruleIdentifier string, opts ...option.RequestOption) (res *ZoneEmailRoutingRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/rules/%s", zoneIdentifier, ruleIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Rules consist of a set of criteria for matching emails (such as an email being +// sent to a specific custom email address) plus a set of actions to take on the +// email (like forwarding it to a specific destination address). +func (r *ZoneEmailRoutingRuleService) EmailRoutingRoutingRulesNewRoutingRule(ctx context.Context, zoneIdentifier string, body ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParams, opts ...option.RequestOption) (res *ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists existing routing rules. +func (r *ZoneEmailRoutingRuleService) EmailRoutingRoutingRulesListRoutingRules(ctx context.Context, zoneIdentifier string, query ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParams, opts ...option.RequestOption) (res *shared.Page[ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/email/routing/rules", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneEmailRoutingRuleGetResponse struct { + Errors []ZoneEmailRoutingRuleGetResponseError `json:"errors"` + Messages []ZoneEmailRoutingRuleGetResponseMessage `json:"messages"` + Result ZoneEmailRoutingRuleGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingRuleGetResponseSuccess `json:"success"` + JSON zoneEmailRoutingRuleGetResponseJSON `json:"-"` +} + +// zoneEmailRoutingRuleGetResponseJSON contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleGetResponse] +type zoneEmailRoutingRuleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleGetResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingRuleGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleGetResponseError] +type zoneEmailRoutingRuleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleGetResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingRuleGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleGetResponseMessage] +type zoneEmailRoutingRuleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleGetResponseResult struct { + // List actions patterns. + Actions []ZoneEmailRoutingRuleGetResponseResultAction `json:"actions"` + // Routing rule status. + Enabled ZoneEmailRoutingRuleGetResponseResultEnabled `json:"enabled"` + // Matching patterns to forward to your actions. + Matchers []ZoneEmailRoutingRuleGetResponseResultMatcher `json:"matchers"` + // Routing rule name. + Name string `json:"name"` + // Priority of the routing rule. + Priority float64 `json:"priority"` + // Routing rule identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingRuleGetResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingRuleGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleGetResponseResult] +type zoneEmailRoutingRuleGetResponseResultJSON struct { + Actions apijson.Field + Enabled apijson.Field + Matchers apijson.Field + Name apijson.Field + Priority apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Actions pattern. +type ZoneEmailRoutingRuleGetResponseResultAction struct { + // Type of supported action. + Type ZoneEmailRoutingRuleGetResponseResultActionsType `json:"type,required"` + Value []string `json:"value,required"` + JSON zoneEmailRoutingRuleGetResponseResultActionJSON `json:"-"` +} + +// zoneEmailRoutingRuleGetResponseResultActionJSON contains the JSON metadata for +// the struct [ZoneEmailRoutingRuleGetResponseResultAction] +type zoneEmailRoutingRuleGetResponseResultActionJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleGetResponseResultAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of supported action. +type ZoneEmailRoutingRuleGetResponseResultActionsType string + +const ( + ZoneEmailRoutingRuleGetResponseResultActionsTypeDrop ZoneEmailRoutingRuleGetResponseResultActionsType = "drop" + ZoneEmailRoutingRuleGetResponseResultActionsTypeForward ZoneEmailRoutingRuleGetResponseResultActionsType = "forward" + ZoneEmailRoutingRuleGetResponseResultActionsTypeWorker ZoneEmailRoutingRuleGetResponseResultActionsType = "worker" +) + +// Routing rule status. +type ZoneEmailRoutingRuleGetResponseResultEnabled bool + +const ( + ZoneEmailRoutingRuleGetResponseResultEnabledTrue ZoneEmailRoutingRuleGetResponseResultEnabled = true + ZoneEmailRoutingRuleGetResponseResultEnabledFalse ZoneEmailRoutingRuleGetResponseResultEnabled = false +) + +// Matching pattern to forward your actions. +type ZoneEmailRoutingRuleGetResponseResultMatcher struct { + // Field for type matcher. + Field ZoneEmailRoutingRuleGetResponseResultMatchersField `json:"field,required"` + // Type of matcher. + Type ZoneEmailRoutingRuleGetResponseResultMatchersType `json:"type,required"` + // Value for matcher. + Value string `json:"value,required"` + JSON zoneEmailRoutingRuleGetResponseResultMatcherJSON `json:"-"` +} + +// zoneEmailRoutingRuleGetResponseResultMatcherJSON contains the JSON metadata for +// the struct [ZoneEmailRoutingRuleGetResponseResultMatcher] +type zoneEmailRoutingRuleGetResponseResultMatcherJSON struct { + Field apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleGetResponseResultMatcher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Field for type matcher. +type ZoneEmailRoutingRuleGetResponseResultMatchersField string + +const ( + ZoneEmailRoutingRuleGetResponseResultMatchersFieldTo ZoneEmailRoutingRuleGetResponseResultMatchersField = "to" +) + +// Type of matcher. +type ZoneEmailRoutingRuleGetResponseResultMatchersType string + +const ( + ZoneEmailRoutingRuleGetResponseResultMatchersTypeLiteral ZoneEmailRoutingRuleGetResponseResultMatchersType = "literal" +) + +// Whether the API call was successful +type ZoneEmailRoutingRuleGetResponseSuccess bool + +const ( + ZoneEmailRoutingRuleGetResponseSuccessTrue ZoneEmailRoutingRuleGetResponseSuccess = true +) + +type ZoneEmailRoutingRuleUpdateResponse struct { + Errors []ZoneEmailRoutingRuleUpdateResponseError `json:"errors"` + Messages []ZoneEmailRoutingRuleUpdateResponseMessage `json:"messages"` + Result ZoneEmailRoutingRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingRuleUpdateResponseSuccess `json:"success"` + JSON zoneEmailRoutingRuleUpdateResponseJSON `json:"-"` +} + +// zoneEmailRoutingRuleUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleUpdateResponse] +type zoneEmailRoutingRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleUpdateResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingRuleUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleUpdateResponseError] +type zoneEmailRoutingRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleUpdateResponseMessage] +type zoneEmailRoutingRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleUpdateResponseResult struct { + // List actions patterns. + Actions []ZoneEmailRoutingRuleUpdateResponseResultAction `json:"actions"` + // Routing rule status. + Enabled ZoneEmailRoutingRuleUpdateResponseResultEnabled `json:"enabled"` + // Matching patterns to forward to your actions. + Matchers []ZoneEmailRoutingRuleUpdateResponseResultMatcher `json:"matchers"` + // Routing rule name. + Name string `json:"name"` + // Priority of the routing rule. + Priority float64 `json:"priority"` + // Routing rule identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingRuleUpdateResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleUpdateResponseResult] +type zoneEmailRoutingRuleUpdateResponseResultJSON struct { + Actions apijson.Field + Enabled apijson.Field + Matchers apijson.Field + Name apijson.Field + Priority apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Actions pattern. +type ZoneEmailRoutingRuleUpdateResponseResultAction struct { + // Type of supported action. + Type ZoneEmailRoutingRuleUpdateResponseResultActionsType `json:"type,required"` + Value []string `json:"value,required"` + JSON zoneEmailRoutingRuleUpdateResponseResultActionJSON `json:"-"` +} + +// zoneEmailRoutingRuleUpdateResponseResultActionJSON contains the JSON metadata +// for the struct [ZoneEmailRoutingRuleUpdateResponseResultAction] +type zoneEmailRoutingRuleUpdateResponseResultActionJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleUpdateResponseResultAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of supported action. +type ZoneEmailRoutingRuleUpdateResponseResultActionsType string + +const ( + ZoneEmailRoutingRuleUpdateResponseResultActionsTypeDrop ZoneEmailRoutingRuleUpdateResponseResultActionsType = "drop" + ZoneEmailRoutingRuleUpdateResponseResultActionsTypeForward ZoneEmailRoutingRuleUpdateResponseResultActionsType = "forward" + ZoneEmailRoutingRuleUpdateResponseResultActionsTypeWorker ZoneEmailRoutingRuleUpdateResponseResultActionsType = "worker" +) + +// Routing rule status. +type ZoneEmailRoutingRuleUpdateResponseResultEnabled bool + +const ( + ZoneEmailRoutingRuleUpdateResponseResultEnabledTrue ZoneEmailRoutingRuleUpdateResponseResultEnabled = true + ZoneEmailRoutingRuleUpdateResponseResultEnabledFalse ZoneEmailRoutingRuleUpdateResponseResultEnabled = false +) + +// Matching pattern to forward your actions. +type ZoneEmailRoutingRuleUpdateResponseResultMatcher struct { + // Field for type matcher. + Field ZoneEmailRoutingRuleUpdateResponseResultMatchersField `json:"field,required"` + // Type of matcher. + Type ZoneEmailRoutingRuleUpdateResponseResultMatchersType `json:"type,required"` + // Value for matcher. + Value string `json:"value,required"` + JSON zoneEmailRoutingRuleUpdateResponseResultMatcherJSON `json:"-"` +} + +// zoneEmailRoutingRuleUpdateResponseResultMatcherJSON contains the JSON metadata +// for the struct [ZoneEmailRoutingRuleUpdateResponseResultMatcher] +type zoneEmailRoutingRuleUpdateResponseResultMatcherJSON struct { + Field apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleUpdateResponseResultMatcher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Field for type matcher. +type ZoneEmailRoutingRuleUpdateResponseResultMatchersField string + +const ( + ZoneEmailRoutingRuleUpdateResponseResultMatchersFieldTo ZoneEmailRoutingRuleUpdateResponseResultMatchersField = "to" +) + +// Type of matcher. +type ZoneEmailRoutingRuleUpdateResponseResultMatchersType string + +const ( + ZoneEmailRoutingRuleUpdateResponseResultMatchersTypeLiteral ZoneEmailRoutingRuleUpdateResponseResultMatchersType = "literal" +) + +// Whether the API call was successful +type ZoneEmailRoutingRuleUpdateResponseSuccess bool + +const ( + ZoneEmailRoutingRuleUpdateResponseSuccessTrue ZoneEmailRoutingRuleUpdateResponseSuccess = true +) + +type ZoneEmailRoutingRuleDeleteResponse struct { + Errors []ZoneEmailRoutingRuleDeleteResponseError `json:"errors"` + Messages []ZoneEmailRoutingRuleDeleteResponseMessage `json:"messages"` + Result ZoneEmailRoutingRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingRuleDeleteResponseSuccess `json:"success"` + JSON zoneEmailRoutingRuleDeleteResponseJSON `json:"-"` +} + +// zoneEmailRoutingRuleDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleDeleteResponse] +type zoneEmailRoutingRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleDeleteResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingRuleDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleDeleteResponseError] +type zoneEmailRoutingRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleDeleteResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleDeleteResponseMessage] +type zoneEmailRoutingRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleDeleteResponseResult struct { + // List actions patterns. + Actions []ZoneEmailRoutingRuleDeleteResponseResultAction `json:"actions"` + // Routing rule status. + Enabled ZoneEmailRoutingRuleDeleteResponseResultEnabled `json:"enabled"` + // Matching patterns to forward to your actions. + Matchers []ZoneEmailRoutingRuleDeleteResponseResultMatcher `json:"matchers"` + // Routing rule name. + Name string `json:"name"` + // Priority of the routing rule. + Priority float64 `json:"priority"` + // Routing rule identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingRuleDeleteResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingRuleDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneEmailRoutingRuleDeleteResponseResult] +type zoneEmailRoutingRuleDeleteResponseResultJSON struct { + Actions apijson.Field + Enabled apijson.Field + Matchers apijson.Field + Name apijson.Field + Priority apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Actions pattern. +type ZoneEmailRoutingRuleDeleteResponseResultAction struct { + // Type of supported action. + Type ZoneEmailRoutingRuleDeleteResponseResultActionsType `json:"type,required"` + Value []string `json:"value,required"` + JSON zoneEmailRoutingRuleDeleteResponseResultActionJSON `json:"-"` +} + +// zoneEmailRoutingRuleDeleteResponseResultActionJSON contains the JSON metadata +// for the struct [ZoneEmailRoutingRuleDeleteResponseResultAction] +type zoneEmailRoutingRuleDeleteResponseResultActionJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleDeleteResponseResultAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of supported action. +type ZoneEmailRoutingRuleDeleteResponseResultActionsType string + +const ( + ZoneEmailRoutingRuleDeleteResponseResultActionsTypeDrop ZoneEmailRoutingRuleDeleteResponseResultActionsType = "drop" + ZoneEmailRoutingRuleDeleteResponseResultActionsTypeForward ZoneEmailRoutingRuleDeleteResponseResultActionsType = "forward" + ZoneEmailRoutingRuleDeleteResponseResultActionsTypeWorker ZoneEmailRoutingRuleDeleteResponseResultActionsType = "worker" +) + +// Routing rule status. +type ZoneEmailRoutingRuleDeleteResponseResultEnabled bool + +const ( + ZoneEmailRoutingRuleDeleteResponseResultEnabledTrue ZoneEmailRoutingRuleDeleteResponseResultEnabled = true + ZoneEmailRoutingRuleDeleteResponseResultEnabledFalse ZoneEmailRoutingRuleDeleteResponseResultEnabled = false +) + +// Matching pattern to forward your actions. +type ZoneEmailRoutingRuleDeleteResponseResultMatcher struct { + // Field for type matcher. + Field ZoneEmailRoutingRuleDeleteResponseResultMatchersField `json:"field,required"` + // Type of matcher. + Type ZoneEmailRoutingRuleDeleteResponseResultMatchersType `json:"type,required"` + // Value for matcher. + Value string `json:"value,required"` + JSON zoneEmailRoutingRuleDeleteResponseResultMatcherJSON `json:"-"` +} + +// zoneEmailRoutingRuleDeleteResponseResultMatcherJSON contains the JSON metadata +// for the struct [ZoneEmailRoutingRuleDeleteResponseResultMatcher] +type zoneEmailRoutingRuleDeleteResponseResultMatcherJSON struct { + Field apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleDeleteResponseResultMatcher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Field for type matcher. +type ZoneEmailRoutingRuleDeleteResponseResultMatchersField string + +const ( + ZoneEmailRoutingRuleDeleteResponseResultMatchersFieldTo ZoneEmailRoutingRuleDeleteResponseResultMatchersField = "to" +) + +// Type of matcher. +type ZoneEmailRoutingRuleDeleteResponseResultMatchersType string + +const ( + ZoneEmailRoutingRuleDeleteResponseResultMatchersTypeLiteral ZoneEmailRoutingRuleDeleteResponseResultMatchersType = "literal" +) + +// Whether the API call was successful +type ZoneEmailRoutingRuleDeleteResponseSuccess bool + +const ( + ZoneEmailRoutingRuleDeleteResponseSuccessTrue ZoneEmailRoutingRuleDeleteResponseSuccess = true +) + +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponse struct { + Errors []ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseError `json:"errors"` + Messages []ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseMessage `json:"messages"` + Result ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseSuccess `json:"success"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseJSON contains +// the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponse] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseError] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseMessage] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResult struct { + // List actions patterns. + Actions []ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultAction `json:"actions"` + // Routing rule status. + Enabled ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultEnabled `json:"enabled"` + // Matching patterns to forward to your actions. + Matchers []ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatcher `json:"matchers"` + // Routing rule name. + Name string `json:"name"` + // Priority of the routing rule. + Priority float64 `json:"priority"` + // Routing rule identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResult] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultJSON struct { + Actions apijson.Field + Enabled apijson.Field + Matchers apijson.Field + Name apijson.Field + Priority apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Actions pattern. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultAction struct { + // Type of supported action. + Type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsType `json:"type,required"` + Value []string `json:"value,required"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultAction] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of supported action. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsType string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsTypeDrop ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsType = "drop" + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsTypeForward ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsType = "forward" + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsTypeWorker ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultActionsType = "worker" +) + +// Routing rule status. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultEnabled bool + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultEnabledTrue ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultEnabled = true + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultEnabledFalse ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultEnabled = false +) + +// Matching pattern to forward your actions. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatcher struct { + // Field for type matcher. + Field ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersField `json:"field,required"` + // Type of matcher. + Type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersType `json:"type,required"` + // Value for matcher. + Value string `json:"value,required"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatcherJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatcherJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatcher] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatcherJSON struct { + Field apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatcher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Field for type matcher. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersField string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersFieldTo ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersField = "to" +) + +// Type of matcher. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersType string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersTypeLiteral ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseResultMatchersType = "literal" +) + +// Whether the API call was successful +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseSuccess bool + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseSuccessTrue ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleResponseSuccess = true +) + +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponse struct { + // List actions patterns. + Actions []ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseAction `json:"actions"` + // Routing rule status. + Enabled ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseEnabled `json:"enabled"` + // Matching patterns to forward to your actions. + Matchers []ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatcher `json:"matchers"` + // Routing rule name. + Name string `json:"name"` + // Priority of the routing rule. + Priority float64 `json:"priority"` + // Routing rule identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponse] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseJSON struct { + Actions apijson.Field + Enabled apijson.Field + Matchers apijson.Field + Name apijson.Field + Priority apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Actions pattern. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseAction struct { + // Type of supported action. + Type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsType `json:"type,required"` + Value []string `json:"value,required"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseAction] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of supported action. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsType string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsTypeDrop ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsType = "drop" + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsTypeForward ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsType = "forward" + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsTypeWorker ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseActionsType = "worker" +) + +// Routing rule status. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseEnabled bool + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseEnabledTrue ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseEnabled = true + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseEnabledFalse ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseEnabled = false +) + +// Matching pattern to forward your actions. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatcher struct { + // Field for type matcher. + Field ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersField `json:"field,required"` + // Type of matcher. + Type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersType `json:"type,required"` + // Value for matcher. + Value string `json:"value,required"` + JSON zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatcherJSON `json:"-"` +} + +// zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatcherJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatcher] +type zoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatcherJSON struct { + Field apijson.Field + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatcher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Field for type matcher. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersField string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersFieldTo ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersField = "to" +) + +// Type of matcher. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersType string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersTypeLiteral ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesResponseMatchersType = "literal" +) + +type ZoneEmailRoutingRuleUpdateParams struct { + // List actions patterns. + Actions param.Field[[]ZoneEmailRoutingRuleUpdateParamsAction] `json:"actions,required"` + // Matching patterns to forward to your actions. + Matchers param.Field[[]ZoneEmailRoutingRuleUpdateParamsMatcher] `json:"matchers,required"` + // Routing rule status. + Enabled param.Field[ZoneEmailRoutingRuleUpdateParamsEnabled] `json:"enabled"` + // Routing rule name. + Name param.Field[string] `json:"name"` + // Priority of the routing rule. + Priority param.Field[float64] `json:"priority"` +} + +func (r ZoneEmailRoutingRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Actions pattern. +type ZoneEmailRoutingRuleUpdateParamsAction struct { + // Type of supported action. + Type param.Field[ZoneEmailRoutingRuleUpdateParamsActionsType] `json:"type,required"` + Value param.Field[[]string] `json:"value,required"` +} + +func (r ZoneEmailRoutingRuleUpdateParamsAction) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of supported action. +type ZoneEmailRoutingRuleUpdateParamsActionsType string + +const ( + ZoneEmailRoutingRuleUpdateParamsActionsTypeDrop ZoneEmailRoutingRuleUpdateParamsActionsType = "drop" + ZoneEmailRoutingRuleUpdateParamsActionsTypeForward ZoneEmailRoutingRuleUpdateParamsActionsType = "forward" + ZoneEmailRoutingRuleUpdateParamsActionsTypeWorker ZoneEmailRoutingRuleUpdateParamsActionsType = "worker" +) + +// Matching pattern to forward your actions. +type ZoneEmailRoutingRuleUpdateParamsMatcher struct { + // Field for type matcher. + Field param.Field[ZoneEmailRoutingRuleUpdateParamsMatchersField] `json:"field,required"` + // Type of matcher. + Type param.Field[ZoneEmailRoutingRuleUpdateParamsMatchersType] `json:"type,required"` + // Value for matcher. + Value param.Field[string] `json:"value,required"` +} + +func (r ZoneEmailRoutingRuleUpdateParamsMatcher) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Field for type matcher. +type ZoneEmailRoutingRuleUpdateParamsMatchersField string + +const ( + ZoneEmailRoutingRuleUpdateParamsMatchersFieldTo ZoneEmailRoutingRuleUpdateParamsMatchersField = "to" +) + +// Type of matcher. +type ZoneEmailRoutingRuleUpdateParamsMatchersType string + +const ( + ZoneEmailRoutingRuleUpdateParamsMatchersTypeLiteral ZoneEmailRoutingRuleUpdateParamsMatchersType = "literal" +) + +// Routing rule status. +type ZoneEmailRoutingRuleUpdateParamsEnabled bool + +const ( + ZoneEmailRoutingRuleUpdateParamsEnabledTrue ZoneEmailRoutingRuleUpdateParamsEnabled = true + ZoneEmailRoutingRuleUpdateParamsEnabledFalse ZoneEmailRoutingRuleUpdateParamsEnabled = false +) + +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParams struct { + // List actions patterns. + Actions param.Field[[]ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsAction] `json:"actions,required"` + // Matching patterns to forward to your actions. + Matchers param.Field[[]ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatcher] `json:"matchers,required"` + // Routing rule status. + Enabled param.Field[ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsEnabled] `json:"enabled"` + // Routing rule name. + Name param.Field[string] `json:"name"` + // Priority of the routing rule. + Priority param.Field[float64] `json:"priority"` +} + +func (r ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Actions pattern. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsAction struct { + // Type of supported action. + Type param.Field[ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsType] `json:"type,required"` + Value param.Field[[]string] `json:"value,required"` +} + +func (r ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsAction) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of supported action. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsType string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsTypeDrop ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsType = "drop" + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsTypeForward ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsType = "forward" + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsTypeWorker ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsType = "worker" +) + +// Matching pattern to forward your actions. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatcher struct { + // Field for type matcher. + Field param.Field[ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersField] `json:"field,required"` + // Type of matcher. + Type param.Field[ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersType] `json:"type,required"` + // Value for matcher. + Value param.Field[string] `json:"value,required"` +} + +func (r ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatcher) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Field for type matcher. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersField string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersFieldTo ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersField = "to" +) + +// Type of matcher. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersType string + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersTypeLiteral ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersType = "literal" +) + +// Routing rule status. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsEnabled bool + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsEnabledTrue ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsEnabled = true + ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsEnabledFalse ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsEnabled = false +) + +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParams struct { + // Filter by enabled routing rules. + Enabled param.Field[ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParamsEnabled] `query:"enabled"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParams]'s query +// parameters as `url.Values`. +func (r ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Filter by enabled routing rules. +type ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParamsEnabled bool + +const ( + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParamsEnabledTrue ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParamsEnabled = true + ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParamsEnabledFalse ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParamsEnabled = false +) diff --git a/zoneemailroutingrule_test.go b/zoneemailroutingrule_test.go new file mode 100644 index 00000000000..4c5b9825a2c --- /dev/null +++ b/zoneemailroutingrule_test.go @@ -0,0 +1,223 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneEmailRoutingRuleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Rules.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a7e6fb77503c41d8a7f3113c6918f10c", + ) + 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 TestZoneEmailRoutingRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Rules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a7e6fb77503c41d8a7f3113c6918f10c", + cloudflare.ZoneEmailRoutingRuleUpdateParams{ + Actions: cloudflare.F([]cloudflare.ZoneEmailRoutingRuleUpdateParamsAction{{ + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }}), + Matchers: cloudflare.F([]cloudflare.ZoneEmailRoutingRuleUpdateParamsMatcher{{ + Field: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsMatchersFieldTo), + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsMatchersTypeLiteral), + Value: cloudflare.F("test@example.com"), + }, { + Field: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsMatchersFieldTo), + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsMatchersTypeLiteral), + Value: cloudflare.F("test@example.com"), + }, { + Field: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsMatchersFieldTo), + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsMatchersTypeLiteral), + Value: cloudflare.F("test@example.com"), + }}), + Enabled: cloudflare.F(cloudflare.ZoneEmailRoutingRuleUpdateParamsEnabledTrue), + Name: cloudflare.F("Send to user@example.net rule."), + Priority: cloudflare.F(0.000000), + }, + ) + 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 TestZoneEmailRoutingRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Rules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a7e6fb77503c41d8a7f3113c6918f10c", + ) + 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 TestZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Rules.EmailRoutingRoutingRulesNewRoutingRule( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParams{ + Actions: cloudflare.F([]cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsAction{{ + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }}), + Matchers: cloudflare.F([]cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatcher{{ + Field: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersFieldTo), + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersTypeLiteral), + Value: cloudflare.F("test@example.com"), + }, { + Field: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersFieldTo), + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersTypeLiteral), + Value: cloudflare.F("test@example.com"), + }, { + Field: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersFieldTo), + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsMatchersTypeLiteral), + Value: cloudflare.F("test@example.com"), + }}), + Enabled: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesNewRoutingRuleParamsEnabledTrue), + Name: cloudflare.F("Send to user@example.net rule."), + Priority: cloudflare.F(0.000000), + }, + ) + 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 TestZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Rules.EmailRoutingRoutingRulesListRoutingRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParams{ + Enabled: cloudflare.F(cloudflare.ZoneEmailRoutingRuleEmailRoutingRoutingRulesListRoutingRulesParamsEnabledTrue), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/zoneemailroutingrulecatchall.go b/zoneemailroutingrulecatchall.go new file mode 100644 index 00000000000..829ee73a44e --- /dev/null +++ b/zoneemailroutingrulecatchall.go @@ -0,0 +1,447 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneEmailRoutingRuleCatchAllService 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 +// [NewZoneEmailRoutingRuleCatchAllService] method instead. +type ZoneEmailRoutingRuleCatchAllService struct { + Options []option.RequestOption +} + +// NewZoneEmailRoutingRuleCatchAllService 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 NewZoneEmailRoutingRuleCatchAllService(opts ...option.RequestOption) (r *ZoneEmailRoutingRuleCatchAllService) { + r = &ZoneEmailRoutingRuleCatchAllService{} + r.Options = opts + return +} + +// Get information on the default catch-all routing rule. +func (r *ZoneEmailRoutingRuleCatchAllService) EmailRoutingRoutingRulesGetCatchAllRule(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/rules/catch_all", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Enable or disable catch-all routing rule, or change action to forward to +// specific destination address. +func (r *ZoneEmailRoutingRuleCatchAllService) EmailRoutingRoutingRulesUpdateCatchAllRule(ctx context.Context, zoneIdentifier string, body ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParams, opts ...option.RequestOption) (res *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/email/routing/rules/catch_all", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponse struct { + Errors []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseError `json:"errors"` + Messages []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseMessage `json:"messages"` + Result ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseSuccess `json:"success"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponse] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseError] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseMessage] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResult struct { + // List actions for the catch-all routing rule. + Actions []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultAction `json:"actions"` + // Routing rule status. + Enabled ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultEnabled `json:"enabled"` + // List of matchers for the catch-all routing rule. + Matchers []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatcher `json:"matchers"` + // Routing rule name. + Name string `json:"name"` + // Routing rule identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResult] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultJSON struct { + Actions apijson.Field + Enabled apijson.Field + Matchers apijson.Field + Name apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Action for the catch-all routing rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultAction struct { + // Type of action for catch-all rule. + Type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsType `json:"type,required"` + Value []string `json:"value"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultAction] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of action for catch-all rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsType string + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsTypeDrop ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsType = "drop" + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsTypeForward ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsType = "forward" + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsTypeWorker ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultActionsType = "worker" +) + +// Routing rule status. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultEnabled bool + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultEnabledTrue ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultEnabled = true + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultEnabledFalse ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultEnabled = false +) + +// Matcher for catch-all routing rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatcher struct { + // Type of matcher. Default is 'all'. + Type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatchersType `json:"type,required"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatcherJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatcherJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatcher] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatcherJSON struct { + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatcher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of matcher. Default is 'all'. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatchersType string + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatchersTypeAll ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseResultMatchersType = "all" +) + +// Whether the API call was successful +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseSuccess bool + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseSuccessTrue ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRuleResponseSuccess = true +) + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponse struct { + Errors []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseError `json:"errors"` + Messages []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseMessage `json:"messages"` + Result ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseSuccess `json:"success"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponse] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseErrorJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseError] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseMessageJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseMessage] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResult struct { + // List actions for the catch-all routing rule. + Actions []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultAction `json:"actions"` + // Routing rule status. + Enabled ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultEnabled `json:"enabled"` + // List of matchers for the catch-all routing rule. + Matchers []ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatcher `json:"matchers"` + // Routing rule name. + Name string `json:"name"` + // Routing rule identifier. + Tag string `json:"tag"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResult] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultJSON struct { + Actions apijson.Field + Enabled apijson.Field + Matchers apijson.Field + Name apijson.Field + Tag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Action for the catch-all routing rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultAction struct { + // Type of action for catch-all rule. + Type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsType `json:"type,required"` + Value []string `json:"value"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultAction] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionJSON struct { + Type apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of action for catch-all rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsType string + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsTypeDrop ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsType = "drop" + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsTypeForward ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsType = "forward" + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsTypeWorker ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultActionsType = "worker" +) + +// Routing rule status. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultEnabled bool + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultEnabledTrue ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultEnabled = true + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultEnabledFalse ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultEnabled = false +) + +// Matcher for catch-all routing rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatcher struct { + // Type of matcher. Default is 'all'. + Type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatchersType `json:"type,required"` + JSON zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatcherJSON `json:"-"` +} + +// zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatcherJSON +// contains the JSON metadata for the struct +// [ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatcher] +type zoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatcherJSON struct { + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatcher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of matcher. Default is 'all'. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatchersType string + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatchersTypeAll ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseResultMatchersType = "all" +) + +// Whether the API call was successful +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseSuccess bool + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseSuccessTrue ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleResponseSuccess = true +) + +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParams struct { + // List actions for the catch-all routing rule. + Actions param.Field[[]ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsAction] `json:"actions,required"` + // List of matchers for the catch-all routing rule. + Matchers param.Field[[]ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatcher] `json:"matchers,required"` + // Routing rule status. + Enabled param.Field[ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsEnabled] `json:"enabled"` + // Routing rule name. + Name param.Field[string] `json:"name"` +} + +func (r ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Action for the catch-all routing rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsAction struct { + // Type of action for catch-all rule. + Type param.Field[ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsType] `json:"type,required"` + Value param.Field[[]string] `json:"value"` +} + +func (r ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsAction) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of action for catch-all rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsType string + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsTypeDrop ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsType = "drop" + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsTypeForward ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsType = "forward" + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsTypeWorker ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsType = "worker" +) + +// Matcher for catch-all routing rule. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatcher struct { + // Type of matcher. Default is 'all'. + Type param.Field[ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatchersType] `json:"type,required"` +} + +func (r ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatcher) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of matcher. Default is 'all'. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatchersType string + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatchersTypeAll ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatchersType = "all" +) + +// Routing rule status. +type ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsEnabled bool + +const ( + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsEnabledTrue ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsEnabled = true + ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsEnabledFalse ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsEnabled = false +) diff --git a/zoneemailroutingrulecatchall_test.go b/zoneemailroutingrulecatchall_test.go new file mode 100644 index 00000000000..654cacc110b --- /dev/null +++ b/zoneemailroutingrulecatchall_test.go @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesGetCatchAllRule(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Rules.CatchAlls.EmailRoutingRoutingRulesGetCatchAllRule(context.TODO(), "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()) + } +} + +func TestZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Emails.Routings.Rules.CatchAlls.EmailRoutingRoutingRulesUpdateCatchAllRule( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParams{ + Actions: cloudflare.F([]cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsAction{{ + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsActionsTypeForward), + Value: cloudflare.F([]string{"destinationaddress@example.net", "destinationaddress@example.net", "destinationaddress@example.net"}), + }}), + Matchers: cloudflare.F([]cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatcher{{ + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatchersTypeAll), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatchersTypeAll), + }, { + Type: cloudflare.F(cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsMatchersTypeAll), + }}), + Enabled: cloudflare.F(cloudflare.ZoneEmailRoutingRuleCatchAllEmailRoutingRoutingRulesUpdateCatchAllRuleParamsEnabledTrue), + Name: cloudflare.F("Send to user@example.net rule."), + }, + ) + 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/zonefilter.go b/zonefilter.go new file mode 100644 index 00000000000..c18d9b3b1cc --- /dev/null +++ b/zonefilter.go @@ -0,0 +1,730 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFilterService 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 [NewZoneFilterService] method instead. +type ZoneFilterService struct { + Options []option.RequestOption +} + +// NewZoneFilterService 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 NewZoneFilterService(opts ...option.RequestOption) (r *ZoneFilterService) { + r = &ZoneFilterService{} + r.Options = opts + return +} + +// Fetches the details of a filter. +func (r *ZoneFilterService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFilterGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/filters/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an existing filter. +func (r *ZoneFilterService) Update(ctx context.Context, zoneIdentifier string, id string, body ZoneFilterUpdateParams, opts ...option.RequestOption) (res *ZoneFilterUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/filters/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an existing filter. +func (r *ZoneFilterService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFilterDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/filters/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates one or more filters. +func (r *ZoneFilterService) FiltersNewFilters(ctx context.Context, zoneIdentifier string, body ZoneFilterFiltersNewFiltersParams, opts ...option.RequestOption) (res *ZoneFilterFiltersNewFiltersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/filters", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches filters in a zone. You can filter the results using several optional +// parameters. +func (r *ZoneFilterService) FiltersListFilters(ctx context.Context, zoneIdentifier string, query ZoneFilterFiltersListFiltersParams, opts ...option.RequestOption) (res *shared.Page[ZoneFilterFiltersListFiltersResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/filters", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Updates one or more existing filters. +func (r *ZoneFilterService) FiltersUpdateFilters(ctx context.Context, zoneIdentifier string, body ZoneFilterFiltersUpdateFiltersParams, opts ...option.RequestOption) (res *ZoneFilterFiltersUpdateFiltersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/filters", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneFilterGetResponse struct { + Errors []ZoneFilterGetResponseError `json:"errors"` + Messages []ZoneFilterGetResponseMessage `json:"messages"` + Result ZoneFilterGetResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneFilterGetResponseSuccess `json:"success"` + JSON zoneFilterGetResponseJSON `json:"-"` +} + +// zoneFilterGetResponseJSON contains the JSON metadata for the struct +// [ZoneFilterGetResponse] +type zoneFilterGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterGetResponseErrorJSON `json:"-"` +} + +// zoneFilterGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneFilterGetResponseError] +type zoneFilterGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterGetResponseMessageJSON `json:"-"` +} + +// zoneFilterGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneFilterGetResponseMessage] +type zoneFilterGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterGetResponseResult struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFilterGetResponseResultJSON `json:"-"` +} + +// zoneFilterGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneFilterGetResponseResult] +type zoneFilterGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFilterGetResponseSuccess bool + +const ( + ZoneFilterGetResponseSuccessTrue ZoneFilterGetResponseSuccess = true +) + +type ZoneFilterUpdateResponse struct { + Errors []ZoneFilterUpdateResponseError `json:"errors"` + Messages []ZoneFilterUpdateResponseMessage `json:"messages"` + Result ZoneFilterUpdateResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneFilterUpdateResponseSuccess `json:"success"` + JSON zoneFilterUpdateResponseJSON `json:"-"` +} + +// zoneFilterUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneFilterUpdateResponse] +type zoneFilterUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterUpdateResponseErrorJSON `json:"-"` +} + +// zoneFilterUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneFilterUpdateResponseError] +type zoneFilterUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterUpdateResponseMessageJSON `json:"-"` +} + +// zoneFilterUpdateResponseMessageJSON contains the JSON metadata for the struct +// [ZoneFilterUpdateResponseMessage] +type zoneFilterUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterUpdateResponseResult struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFilterUpdateResponseResultJSON `json:"-"` +} + +// zoneFilterUpdateResponseResultJSON contains the JSON metadata for the struct +// [ZoneFilterUpdateResponseResult] +type zoneFilterUpdateResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFilterUpdateResponseSuccess bool + +const ( + ZoneFilterUpdateResponseSuccessTrue ZoneFilterUpdateResponseSuccess = true +) + +type ZoneFilterDeleteResponse struct { + Errors []ZoneFilterDeleteResponseError `json:"errors"` + Messages []ZoneFilterDeleteResponseMessage `json:"messages"` + Result ZoneFilterDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFilterDeleteResponseSuccess `json:"success"` + JSON zoneFilterDeleteResponseJSON `json:"-"` +} + +// zoneFilterDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneFilterDeleteResponse] +type zoneFilterDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterDeleteResponseErrorJSON `json:"-"` +} + +// zoneFilterDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneFilterDeleteResponseError] +type zoneFilterDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterDeleteResponseMessageJSON `json:"-"` +} + +// zoneFilterDeleteResponseMessageJSON contains the JSON metadata for the struct +// [ZoneFilterDeleteResponseMessage] +type zoneFilterDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterDeleteResponseResult struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFilterDeleteResponseResultJSON `json:"-"` +} + +// zoneFilterDeleteResponseResultJSON contains the JSON metadata for the struct +// [ZoneFilterDeleteResponseResult] +type zoneFilterDeleteResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFilterDeleteResponseSuccess bool + +const ( + ZoneFilterDeleteResponseSuccessTrue ZoneFilterDeleteResponseSuccess = true +) + +type ZoneFilterFiltersNewFiltersResponse struct { + Errors []ZoneFilterFiltersNewFiltersResponseError `json:"errors"` + Messages []ZoneFilterFiltersNewFiltersResponseMessage `json:"messages"` + Result []ZoneFilterFiltersNewFiltersResponseResult `json:"result"` + ResultInfo ZoneFilterFiltersNewFiltersResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneFilterFiltersNewFiltersResponseSuccess `json:"success"` + JSON zoneFilterFiltersNewFiltersResponseJSON `json:"-"` +} + +// zoneFilterFiltersNewFiltersResponseJSON contains the JSON metadata for the +// struct [ZoneFilterFiltersNewFiltersResponse] +type zoneFilterFiltersNewFiltersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersNewFiltersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersNewFiltersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterFiltersNewFiltersResponseErrorJSON `json:"-"` +} + +// zoneFilterFiltersNewFiltersResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFilterFiltersNewFiltersResponseError] +type zoneFilterFiltersNewFiltersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersNewFiltersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersNewFiltersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterFiltersNewFiltersResponseMessageJSON `json:"-"` +} + +// zoneFilterFiltersNewFiltersResponseMessageJSON contains the JSON metadata for +// the struct [ZoneFilterFiltersNewFiltersResponseMessage] +type zoneFilterFiltersNewFiltersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersNewFiltersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersNewFiltersResponseResult struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFilterFiltersNewFiltersResponseResultJSON `json:"-"` +} + +// zoneFilterFiltersNewFiltersResponseResultJSON contains the JSON metadata for the +// struct [ZoneFilterFiltersNewFiltersResponseResult] +type zoneFilterFiltersNewFiltersResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersNewFiltersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersNewFiltersResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneFilterFiltersNewFiltersResponseResultInfoJSON `json:"-"` +} + +// zoneFilterFiltersNewFiltersResponseResultInfoJSON contains the JSON metadata for +// the struct [ZoneFilterFiltersNewFiltersResponseResultInfo] +type zoneFilterFiltersNewFiltersResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersNewFiltersResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFilterFiltersNewFiltersResponseSuccess bool + +const ( + ZoneFilterFiltersNewFiltersResponseSuccessTrue ZoneFilterFiltersNewFiltersResponseSuccess = true +) + +type ZoneFilterFiltersListFiltersResponse struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFilterFiltersListFiltersResponseJSON `json:"-"` +} + +// zoneFilterFiltersListFiltersResponseJSON contains the JSON metadata for the +// struct [ZoneFilterFiltersListFiltersResponse] +type zoneFilterFiltersListFiltersResponseJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersListFiltersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersUpdateFiltersResponse struct { + Errors []ZoneFilterFiltersUpdateFiltersResponseError `json:"errors"` + Messages []ZoneFilterFiltersUpdateFiltersResponseMessage `json:"messages"` + Result []ZoneFilterFiltersUpdateFiltersResponseResult `json:"result"` + ResultInfo ZoneFilterFiltersUpdateFiltersResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneFilterFiltersUpdateFiltersResponseSuccess `json:"success"` + JSON zoneFilterFiltersUpdateFiltersResponseJSON `json:"-"` +} + +// zoneFilterFiltersUpdateFiltersResponseJSON contains the JSON metadata for the +// struct [ZoneFilterFiltersUpdateFiltersResponse] +type zoneFilterFiltersUpdateFiltersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersUpdateFiltersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersUpdateFiltersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterFiltersUpdateFiltersResponseErrorJSON `json:"-"` +} + +// zoneFilterFiltersUpdateFiltersResponseErrorJSON contains the JSON metadata for +// the struct [ZoneFilterFiltersUpdateFiltersResponseError] +type zoneFilterFiltersUpdateFiltersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersUpdateFiltersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersUpdateFiltersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFilterFiltersUpdateFiltersResponseMessageJSON `json:"-"` +} + +// zoneFilterFiltersUpdateFiltersResponseMessageJSON contains the JSON metadata for +// the struct [ZoneFilterFiltersUpdateFiltersResponseMessage] +type zoneFilterFiltersUpdateFiltersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersUpdateFiltersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersUpdateFiltersResponseResult struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFilterFiltersUpdateFiltersResponseResultJSON `json:"-"` +} + +// zoneFilterFiltersUpdateFiltersResponseResultJSON contains the JSON metadata for +// the struct [ZoneFilterFiltersUpdateFiltersResponseResult] +type zoneFilterFiltersUpdateFiltersResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersUpdateFiltersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFilterFiltersUpdateFiltersResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneFilterFiltersUpdateFiltersResponseResultInfoJSON `json:"-"` +} + +// zoneFilterFiltersUpdateFiltersResponseResultInfoJSON contains the JSON metadata +// for the struct [ZoneFilterFiltersUpdateFiltersResponseResultInfo] +type zoneFilterFiltersUpdateFiltersResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFilterFiltersUpdateFiltersResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFilterFiltersUpdateFiltersResponseSuccess bool + +const ( + ZoneFilterFiltersUpdateFiltersResponseSuccessTrue ZoneFilterFiltersUpdateFiltersResponseSuccess = true +) + +type ZoneFilterUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFilterUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFilterFiltersNewFiltersParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFilterFiltersNewFiltersParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFilterFiltersListFiltersParams struct { + // A case-insensitive string to find in the description. + Description param.Field[string] `query:"description"` + // A case-insensitive string to find in the expression. + Expression param.Field[string] `query:"expression"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // When true, indicates that the filter is currently paused. + Paused param.Field[bool] `query:"paused"` + // Number of filters per page. + PerPage param.Field[float64] `query:"per_page"` + // The filter ref (a short reference tag) to search for. Must be an exact match. + Ref param.Field[string] `query:"ref"` +} + +// URLQuery serializes [ZoneFilterFiltersListFiltersParams]'s query parameters as +// `url.Values`. +func (r ZoneFilterFiltersListFiltersParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneFilterFiltersUpdateFiltersParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFilterFiltersUpdateFiltersParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/zonefilter_test.go b/zonefilter_test.go new file mode 100644 index 00000000000..b2dd44fa376 --- /dev/null +++ b/zonefilter_test.go @@ -0,0 +1,208 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFilterGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Filters.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b61", + ) + 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 TestZoneFilterUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Filters.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b61", + cloudflare.ZoneFilterUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFilterDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Filters.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b61", + ) + 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 TestZoneFilterFiltersNewFilters(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Filters.FiltersNewFilters( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFilterFiltersNewFiltersParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFilterFiltersListFiltersWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Filters.FiltersListFilters( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFilterFiltersListFiltersParams{ + Description: cloudflare.F("browsers"), + Expression: cloudflare.F("php"), + Page: cloudflare.F(1.000000), + Paused: cloudflare.F(false), + PerPage: cloudflare.F(5.000000), + Ref: cloudflare.F("FIL-100"), + }, + ) + 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 TestZoneFilterFiltersUpdateFilters(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Filters.FiltersUpdateFilters( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFilterFiltersUpdateFiltersParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/zonefirewall.go b/zonefirewall.go new file mode 100644 index 00000000000..57d650cac01 --- /dev/null +++ b/zonefirewall.go @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallService 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 [NewZoneFirewallService] method +// instead. +type ZoneFirewallService struct { + Options []option.RequestOption + Lockdowns *ZoneFirewallLockdownService + Rules *ZoneFirewallRuleService + UaRules *ZoneFirewallUaRuleService + Wafs *ZoneFirewallWafService + AccessRules *ZoneFirewallAccessRuleService +} + +// NewZoneFirewallService 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 NewZoneFirewallService(opts ...option.RequestOption) (r *ZoneFirewallService) { + r = &ZoneFirewallService{} + r.Options = opts + r.Lockdowns = NewZoneFirewallLockdownService(opts...) + r.Rules = NewZoneFirewallRuleService(opts...) + r.UaRules = NewZoneFirewallUaRuleService(opts...) + r.Wafs = NewZoneFirewallWafService(opts...) + r.AccessRules = NewZoneFirewallAccessRuleService(opts...) + return +} diff --git a/zonefirewallaccessrule.go b/zonefirewallaccessrule.go new file mode 100644 index 00000000000..5c2280cb3c8 --- /dev/null +++ b/zonefirewallaccessrule.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallAccessRuleService 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 [NewZoneFirewallAccessRuleService] +// method instead. +type ZoneFirewallAccessRuleService struct { + Options []option.RequestOption + Rules *ZoneFirewallAccessRuleRuleService +} + +// NewZoneFirewallAccessRuleService 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 NewZoneFirewallAccessRuleService(opts ...option.RequestOption) (r *ZoneFirewallAccessRuleService) { + r = &ZoneFirewallAccessRuleService{} + r.Options = opts + r.Rules = NewZoneFirewallAccessRuleRuleService(opts...) + return +} diff --git a/zonefirewallaccessrulerule.go b/zonefirewallaccessrulerule.go new file mode 100644 index 00000000000..ba83fb1a1e5 --- /dev/null +++ b/zonefirewallaccessrulerule.go @@ -0,0 +1,1396 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallAccessRuleRuleService 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 +// [NewZoneFirewallAccessRuleRuleService] method instead. +type ZoneFirewallAccessRuleRuleService struct { + Options []option.RequestOption +} + +// NewZoneFirewallAccessRuleRuleService 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 NewZoneFirewallAccessRuleRuleService(opts ...option.RequestOption) (r *ZoneFirewallAccessRuleRuleService) { + r = &ZoneFirewallAccessRuleRuleService{} + r.Options = opts + return +} + +// Updates an IP Access rule defined at the zone level. You can only update the +// rule action (`mode` parameter) and notes. +func (r *ZoneFirewallAccessRuleRuleService) Update(ctx context.Context, zoneID string, identifier string, body ZoneFirewallAccessRuleRuleUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallAccessRuleRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/access_rules/rules/%s", zoneID, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes an IP Access rule defined at the zone level. +// +// Optionally, you can use the `cascade` property to specify that you wish to +// delete similar rules in other zones managed by the same zone owner. +func (r *ZoneFirewallAccessRuleRuleService) Delete(ctx context.Context, zoneID string, identifier string, body ZoneFirewallAccessRuleRuleDeleteParams, opts ...option.RequestOption) (res *ZoneFirewallAccessRuleRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/access_rules/rules/%s", zoneID, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Creates a new IP Access rule for a zone. +// +// Note: To create an IP Access rule that applies to multiple zones, refer to +// [IP Access rules for a user](#ip-access-rules-for-a-user) or +// [IP Access rules for an account](#ip-access-rules-for-an-account) as +// appropriate. +func (r *ZoneFirewallAccessRuleRuleService) IPAccessRulesForAZoneNewAnIPAccessRule(ctx context.Context, zoneID string, body ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParams, opts ...option.RequestOption) (res *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/access_rules/rules", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches IP Access rules of a zone. You can filter the results using several +// optional parameters. +func (r *ZoneFirewallAccessRuleRuleService) IPAccessRulesForAZoneListIPAccessRules(ctx context.Context, zoneID string, query ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParams, opts ...option.RequestOption) (res *shared.Page[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/access_rules/rules", zoneID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneFirewallAccessRuleRuleUpdateResponse struct { + Errors []ZoneFirewallAccessRuleRuleUpdateResponseError `json:"errors"` + Messages []ZoneFirewallAccessRuleRuleUpdateResponseMessage `json:"messages"` + Result ZoneFirewallAccessRuleRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallAccessRuleRuleUpdateResponseSuccess `json:"success"` + JSON zoneFirewallAccessRuleRuleUpdateResponseJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallAccessRuleRuleUpdateResponse] +type zoneFirewallAccessRuleRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallAccessRuleRuleUpdateResponseErrorJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseErrorJSON contains the JSON metadata for +// the struct [ZoneFirewallAccessRuleRuleUpdateResponseError] +type zoneFirewallAccessRuleRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallAccessRuleRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseMessageJSON contains the JSON metadata +// for the struct [ZoneFirewallAccessRuleRuleUpdateResponseMessage] +type zoneFirewallAccessRuleRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleUpdateResponseResult struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration ZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode ZoneFirewallAccessRuleRuleUpdateResponseResultMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON zoneFirewallAccessRuleRuleUpdateResponseResultJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseResultJSON contains the JSON metadata +// for the struct [ZoneFirewallAccessRuleRuleUpdateResponseResult] +type zoneFirewallAccessRuleRuleUpdateResponseResultJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedMode string + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedModeBlock ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "block" + ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedModeChallenge ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "challenge" + ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedModeWhitelist ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "whitelist" + ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedModeJsChallenge ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "js_challenge" + ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedModeManagedChallenge ZoneFirewallAccessRuleRuleUpdateResponseResultAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration], +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration], +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration], +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration] +// or +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration]. +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration interface { + implementsZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration)(nil)).Elem(), "") +} + +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTipConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTipConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration] +type zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTipConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfiguration) implementsZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTargetIP ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration] +type zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6Configuration) implementsZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTargetIp6 ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration] +type zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfiguration) implementsZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTargetIPRange ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTasnConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTasnConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration] +type zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTasnConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfiguration) implementsZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTargetASN ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration] +type zoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfiguration) implementsZoneFirewallAccessRuleRuleUpdateResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTargetCountry ZoneFirewallAccessRuleRuleUpdateResponseResultConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleUpdateResponseResultMode string + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseResultModeBlock ZoneFirewallAccessRuleRuleUpdateResponseResultMode = "block" + ZoneFirewallAccessRuleRuleUpdateResponseResultModeChallenge ZoneFirewallAccessRuleRuleUpdateResponseResultMode = "challenge" + ZoneFirewallAccessRuleRuleUpdateResponseResultModeWhitelist ZoneFirewallAccessRuleRuleUpdateResponseResultMode = "whitelist" + ZoneFirewallAccessRuleRuleUpdateResponseResultModeJsChallenge ZoneFirewallAccessRuleRuleUpdateResponseResultMode = "js_challenge" + ZoneFirewallAccessRuleRuleUpdateResponseResultModeManagedChallenge ZoneFirewallAccessRuleRuleUpdateResponseResultMode = "managed_challenge" +) + +// Whether the API call was successful +type ZoneFirewallAccessRuleRuleUpdateResponseSuccess bool + +const ( + ZoneFirewallAccessRuleRuleUpdateResponseSuccessTrue ZoneFirewallAccessRuleRuleUpdateResponseSuccess = true +) + +type ZoneFirewallAccessRuleRuleDeleteResponse struct { + Errors []ZoneFirewallAccessRuleRuleDeleteResponseError `json:"errors"` + Messages []ZoneFirewallAccessRuleRuleDeleteResponseMessage `json:"messages"` + Result ZoneFirewallAccessRuleRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallAccessRuleRuleDeleteResponseSuccess `json:"success"` + JSON zoneFirewallAccessRuleRuleDeleteResponseJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallAccessRuleRuleDeleteResponse] +type zoneFirewallAccessRuleRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallAccessRuleRuleDeleteResponseErrorJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleDeleteResponseErrorJSON contains the JSON metadata for +// the struct [ZoneFirewallAccessRuleRuleDeleteResponseError] +type zoneFirewallAccessRuleRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallAccessRuleRuleDeleteResponseMessageJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleDeleteResponseMessageJSON contains the JSON metadata +// for the struct [ZoneFirewallAccessRuleRuleDeleteResponseMessage] +type zoneFirewallAccessRuleRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleDeleteResponseResult struct { + // The unique identifier of the IP Access rule. + ID string `json:"id"` + JSON zoneFirewallAccessRuleRuleDeleteResponseResultJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleDeleteResponseResultJSON contains the JSON metadata +// for the struct [ZoneFirewallAccessRuleRuleDeleteResponseResult] +type zoneFirewallAccessRuleRuleDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallAccessRuleRuleDeleteResponseSuccess bool + +const ( + ZoneFirewallAccessRuleRuleDeleteResponseSuccessTrue ZoneFirewallAccessRuleRuleDeleteResponseSuccess = true +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponse struct { + Errors []ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseError `json:"errors"` + Messages []ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseMessage `json:"messages"` + Result ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseSuccess `json:"success"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponse] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseErrorJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseError] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseMessageJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseMessage] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResult struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResult] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedMode string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedModeBlock ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedMode = "block" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedModeChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedMode = "challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedModeWhitelist ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedMode = "whitelist" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedModeJsChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedMode = "js_challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedModeManagedChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration] +// or +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration]. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration interface { + implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration)(nil)).Elem(), "") +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTipConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTipConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTipConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTargetIP ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6Configuration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTargetIp6 ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTargetIPRange ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTasnConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTasnConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTasnConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTargetASN ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTargetCountry ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultMode string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultModeBlock ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultMode = "block" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultModeChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultMode = "challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultModeWhitelist ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultMode = "whitelist" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultModeJsChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultMode = "js_challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultModeManagedChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseResultMode = "managed_challenge" +) + +// Whether the API call was successful +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseSuccess bool + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseSuccessTrue ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleResponseSuccess = true +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponse struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponse] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedMode string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedModeBlock ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedMode = "block" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedModeChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedMode = "challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedModeWhitelist ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedMode = "whitelist" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedModeJsChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedMode = "js_challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedModeManagedChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration] +// or +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration]. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration interface { + implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration)(nil)).Elem(), "") +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTipConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTipConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTipConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTargetIP ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6Configuration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTargetIp6 ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTargetIPRange ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTasnConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTasnConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTasnConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTargetASN ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationJSON `json:"-"` +} + +// zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration] +type zoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTargetCountry ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseMode string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseModeBlock ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseMode = "block" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseModeChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseMode = "challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseModeWhitelist ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseMode = "whitelist" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseModeJsChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseMode = "js_challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseModeManagedChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesResponseMode = "managed_challenge" +) + +type ZoneFirewallAccessRuleRuleUpdateParams struct { + // The action to apply to a matched request. + Mode param.Field[ZoneFirewallAccessRuleRuleUpdateParamsMode] `json:"mode"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes"` +} + +func (r ZoneFirewallAccessRuleRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleUpdateParamsMode string + +const ( + ZoneFirewallAccessRuleRuleUpdateParamsModeBlock ZoneFirewallAccessRuleRuleUpdateParamsMode = "block" + ZoneFirewallAccessRuleRuleUpdateParamsModeChallenge ZoneFirewallAccessRuleRuleUpdateParamsMode = "challenge" + ZoneFirewallAccessRuleRuleUpdateParamsModeWhitelist ZoneFirewallAccessRuleRuleUpdateParamsMode = "whitelist" + ZoneFirewallAccessRuleRuleUpdateParamsModeJsChallenge ZoneFirewallAccessRuleRuleUpdateParamsMode = "js_challenge" + ZoneFirewallAccessRuleRuleUpdateParamsModeManagedChallenge ZoneFirewallAccessRuleRuleUpdateParamsMode = "managed_challenge" +) + +type ZoneFirewallAccessRuleRuleDeleteParams struct { + // The level to attempt to delete similar rules defined for other zones with the + // same owner. The default value is `none`, which will only delete the current + // rule. Using `basic` will delete rules that match the same action (mode) and + // configuration, while using `aggressive` will delete rules that match the same + // configuration. + Cascade param.Field[ZoneFirewallAccessRuleRuleDeleteParamsCascade] `json:"cascade"` +} + +func (r ZoneFirewallAccessRuleRuleDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The level to attempt to delete similar rules defined for other zones with the +// same owner. The default value is `none`, which will only delete the current +// rule. Using `basic` will delete rules that match the same action (mode) and +// configuration, while using `aggressive` will delete rules that match the same +// configuration. +type ZoneFirewallAccessRuleRuleDeleteParamsCascade string + +const ( + ZoneFirewallAccessRuleRuleDeleteParamsCascadeNone ZoneFirewallAccessRuleRuleDeleteParamsCascade = "none" + ZoneFirewallAccessRuleRuleDeleteParamsCascadeBasic ZoneFirewallAccessRuleRuleDeleteParamsCascade = "basic" + ZoneFirewallAccessRuleRuleDeleteParamsCascadeAggressive ZoneFirewallAccessRuleRuleDeleteParamsCascade = "aggressive" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParams struct { + // The rule configuration. + Configuration param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration] `json:"configuration,required"` + // The action to apply to a matched request. + Mode param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsMode] `json:"mode,required"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes,required"` +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The rule configuration. +// +// Satisfied by +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration], +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration]. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration interface { + implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration() +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget] `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value param.Field[string] `json:"value"` +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTargetIP ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTarget = "ip" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget] `json:"target"` + // The IPv6 address to match. + Value param.Field[string] `json:"value"` +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6Configuration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTargetIp6 ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIpv6ConfigurationTarget = "ip6" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget] `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value param.Field[string] `json:"value"` +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTargetIPRange ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCidrConfigurationTarget = "ip_range" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget] `json:"target"` + // The AS number to match. + Value param.Field[string] `json:"value"` +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTargetASN ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTASNConfigurationTarget = "asn" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget] `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value param.Field[string] `json:"value"` +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfiguration) implementsZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTargetCountry ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsMode string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsModeBlock ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsMode = "block" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsModeChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsMode = "challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsModeWhitelist ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsMode = "whitelist" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsModeJsChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsMode = "js_challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsModeManagedChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsMode = "managed_challenge" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParams struct { + // The direction used to sort returned rules. + Direction param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsDirection] `query:"direction"` + EgsPagination param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPagination] `query:"egs-pagination"` + Filters param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFilters] `query:"filters"` + // The field used to sort returned rules. + Order param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrder] `query:"order"` + // Requested page within paginated list of results. + Page param.Field[float64] `query:"page"` + // Maximum number of results requested. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParams]'s query +// parameters as `url.Values`. +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned rules. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsDirection string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsDirectionAsc ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsDirection = "asc" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsDirectionDesc ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsDirection = "desc" +) + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPagination struct { + Json param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPaginationJson] `query:"json"` +} + +// URLQuery serializes +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPagination]'s +// query parameters as `url.Values`. +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPagination) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPaginationJson struct { + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The maximum number of results per page. You can only set the value to `1` or to + // a multiple of 5 such as `5`, `10`, `15`, or `20`. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPaginationJson]'s +// query parameters as `url.Values`. +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPaginationJson) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFilters struct { + // The target to search in existing rules. + ConfigurationTarget param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTarget] `query:"configuration.target"` + // The target value to search for in existing rules: an IP address, an IP address + // range, or a country code, depending on the provided `configuration.target`. + // Notes: You can search for a single IPv4 address, an IP address range with a + // subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code. + ConfigurationValue param.Field[string] `query:"configuration.value"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMatch] `query:"match"` + // The action to apply to a matched request. + Mode param.Field[ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMode] `query:"mode"` + // The string to search for in the notes of existing IP Access rules. Notes: For + // example, the string 'attack' would match IP Access rules with notes 'Attack + // 26/02' and 'Attack 27/02'. The search is case insensitive. + Notes param.Field[string] `query:"notes"` +} + +// URLQuery serializes +// [ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFilters]'s +// query parameters as `url.Values`. +func (r ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFilters) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The target to search in existing rules. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTarget string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTargetIP ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTarget = "ip" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTargetIPRange ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTarget = "ip_range" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTargetASN ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTarget = "asn" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTargetCountry ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTarget = "country" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMatch string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMatchAny ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMatch = "any" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMatchAll ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMatch = "all" +) + +// The action to apply to a matched request. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMode string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersModeBlock ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMode = "block" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersModeChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMode = "challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersModeWhitelist ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMode = "whitelist" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersModeJsChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMode = "js_challenge" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersModeManagedChallenge ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMode = "managed_challenge" +) + +// The field used to sort returned rules. +type ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrder string + +const ( + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrderConfigurationTarget ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrder = "configuration.target" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrderConfigurationValue ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrder = "configuration.value" + ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrderMode ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrder = "mode" +) diff --git a/zonefirewallaccessrulerule_test.go b/zonefirewallaccessrulerule_test.go new file mode 100644 index 00000000000..487897fbd30 --- /dev/null +++ b/zonefirewallaccessrulerule_test.go @@ -0,0 +1,166 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallAccessRuleRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.AccessRules.Rules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "92f17202ed8bd63d69a66b86a49a8f6b", + cloudflare.ZoneFirewallAccessRuleRuleUpdateParams{ + Mode: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleUpdateParamsModeChallenge), + Notes: cloudflare.F("This rule is enabled because of an event that occurred on date 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()) + } +} + +func TestZoneFirewallAccessRuleRuleDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.AccessRules.Rules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "92f17202ed8bd63d69a66b86a49a8f6b", + cloudflare.ZoneFirewallAccessRuleRuleDeleteParams{ + Cascade: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleDeleteParamsCascadeNone), + }, + ) + 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 TestZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.AccessRules.Rules.IPAccessRulesForAZoneNewAnIPAccessRule( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParams{ + Configuration: cloudflare.F[cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfiguration](cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfiguration{ + Target: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsConfigurationDZw70ubTIPConfigurationTargetIP), + Value: cloudflare.F("198.51.100.4"), + })), + Mode: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneNewAnIPAccessRuleParamsModeChallenge), + Notes: cloudflare.F("This rule is enabled because of an event that occurred on date 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()) + } +} + +func TestZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.AccessRules.Rules.IPAccessRulesForAZoneListIPAccessRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParams{ + Direction: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsDirectionDesc), + EgsPagination: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPagination{ + Json: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsEgsPaginationJson{ + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + }), + }), + Filters: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFilters{ + ConfigurationTarget: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersConfigurationTargetIP), + ConfigurationValue: cloudflare.F("198.51.100.4"), + Match: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersMatchAny), + Mode: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsFiltersModeChallenge), + Notes: cloudflare.F("my note"), + }), + Order: cloudflare.F(cloudflare.ZoneFirewallAccessRuleRuleIPAccessRulesForAZoneListIPAccessRulesParamsOrderMode), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(20.000000), + }, + ) + 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/zonefirewalllockdown.go b/zonefirewalllockdown.go new file mode 100644 index 00000000000..b1ef41bc89e --- /dev/null +++ b/zonefirewalllockdown.go @@ -0,0 +1,885 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallLockdownService 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 [NewZoneFirewallLockdownService] +// method instead. +type ZoneFirewallLockdownService struct { + Options []option.RequestOption +} + +// NewZoneFirewallLockdownService 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 NewZoneFirewallLockdownService(opts ...option.RequestOption) (r *ZoneFirewallLockdownService) { + r = &ZoneFirewallLockdownService{} + r.Options = opts + return +} + +// Fetches the details of a Zone Lockdown rule. +func (r *ZoneFirewallLockdownService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFirewallLockdownGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/lockdowns/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an existing Zone Lockdown rule. +func (r *ZoneFirewallLockdownService) Update(ctx context.Context, zoneIdentifier string, id string, body ZoneFirewallLockdownUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallLockdownUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/lockdowns/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an existing Zone Lockdown rule. +func (r *ZoneFirewallLockdownService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFirewallLockdownDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/lockdowns/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new Zone Lockdown rule. +func (r *ZoneFirewallLockdownService) ZoneLockdownNewAZoneLockdownRule(ctx context.Context, zoneIdentifier string, body ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleParams, opts ...option.RequestOption) (res *ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/lockdowns", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches Zone Lockdown rules. You can filter the results using several optional +// parameters. +func (r *ZoneFirewallLockdownService) ZoneLockdownListZoneLockdownRules(ctx context.Context, zoneIdentifier string, query ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesParams, opts ...option.RequestOption) (res *shared.Page[ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/lockdowns", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneFirewallLockdownGetResponse struct { + Errors []ZoneFirewallLockdownGetResponseError `json:"errors"` + Messages []ZoneFirewallLockdownGetResponseMessage `json:"messages"` + Result ZoneFirewallLockdownGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallLockdownGetResponseSuccess `json:"success"` + JSON zoneFirewallLockdownGetResponseJSON `json:"-"` +} + +// zoneFirewallLockdownGetResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallLockdownGetResponse] +type zoneFirewallLockdownGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallLockdownGetResponseErrorJSON `json:"-"` +} + +// zoneFirewallLockdownGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFirewallLockdownGetResponseError] +type zoneFirewallLockdownGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallLockdownGetResponseMessageJSON `json:"-"` +} + +// zoneFirewallLockdownGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallLockdownGetResponseMessage] +type zoneFirewallLockdownGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownGetResponseResult struct { + // The unique identifier of the Zone Lockdown rule. + ID string `json:"id,required"` + // A list of IP addresses or CIDR ranges that will be allowed to access the URLs + // specified in the Zone Lockdown rule. You can include any number of `ip` or + // `ip_range` configurations. + Configurations ZoneFirewallLockdownGetResponseResultConfigurations `json:"configurations,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // An informative summary of the rule. + Description string `json:"description,required"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // When true, indicates that the rule is currently paused. + Paused bool `json:"paused,required"` + // The URLs to include in the rule definition. You can use wildcards. Each entered + // URL will be escaped before use, which means you can only use simple wildcard + // patterns. + URLs []string `json:"urls,required"` + JSON zoneFirewallLockdownGetResponseResultJSON `json:"-"` +} + +// zoneFirewallLockdownGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneFirewallLockdownGetResponseResult] +type zoneFirewallLockdownGetResponseResultJSON struct { + ID apijson.Field + Configurations apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Paused apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A list of IP addresses or CIDR ranges that will be allowed to access the URLs +// specified in the Zone Lockdown rule. You can include any number of `ip` or +// `ip_range` configurations. +// +// Union satisfied by +// [ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfiguration] +// or +// [ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration]. +type ZoneFirewallLockdownGetResponseResultConfigurations interface { + implementsZoneFirewallLockdownGetResponseResultConfigurations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallLockdownGetResponseResultConfigurations)(nil)).Elem(), "") +} + +type ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the Zone Lockdown rule. + Target ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON zoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfiguration] +type zoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfiguration) implementsZoneFirewallLockdownGetResponseResultConfigurations() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the Zone Lockdown rule. +type ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget string + +const ( + ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTargetIP ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget = "ip" +) + +type ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the Zone Lockdown rule. + Target ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24`. + Value string `json:"value"` + JSON zoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration] +type zoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration) implementsZoneFirewallLockdownGetResponseResultConfigurations() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the Zone Lockdown rule. +type ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget string + +const ( + ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTargetIPRange ZoneFirewallLockdownGetResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget = "ip_range" +) + +// Whether the API call was successful +type ZoneFirewallLockdownGetResponseSuccess bool + +const ( + ZoneFirewallLockdownGetResponseSuccessTrue ZoneFirewallLockdownGetResponseSuccess = true +) + +type ZoneFirewallLockdownUpdateResponse struct { + Errors []ZoneFirewallLockdownUpdateResponseError `json:"errors"` + Messages []ZoneFirewallLockdownUpdateResponseMessage `json:"messages"` + Result ZoneFirewallLockdownUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallLockdownUpdateResponseSuccess `json:"success"` + JSON zoneFirewallLockdownUpdateResponseJSON `json:"-"` +} + +// zoneFirewallLockdownUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallLockdownUpdateResponse] +type zoneFirewallLockdownUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallLockdownUpdateResponseErrorJSON `json:"-"` +} + +// zoneFirewallLockdownUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFirewallLockdownUpdateResponseError] +type zoneFirewallLockdownUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallLockdownUpdateResponseMessageJSON `json:"-"` +} + +// zoneFirewallLockdownUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallLockdownUpdateResponseMessage] +type zoneFirewallLockdownUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownUpdateResponseResult struct { + // The unique identifier of the Zone Lockdown rule. + ID string `json:"id,required"` + // A list of IP addresses or CIDR ranges that will be allowed to access the URLs + // specified in the Zone Lockdown rule. You can include any number of `ip` or + // `ip_range` configurations. + Configurations ZoneFirewallLockdownUpdateResponseResultConfigurations `json:"configurations,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // An informative summary of the rule. + Description string `json:"description,required"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // When true, indicates that the rule is currently paused. + Paused bool `json:"paused,required"` + // The URLs to include in the rule definition. You can use wildcards. Each entered + // URL will be escaped before use, which means you can only use simple wildcard + // patterns. + URLs []string `json:"urls,required"` + JSON zoneFirewallLockdownUpdateResponseResultJSON `json:"-"` +} + +// zoneFirewallLockdownUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneFirewallLockdownUpdateResponseResult] +type zoneFirewallLockdownUpdateResponseResultJSON struct { + ID apijson.Field + Configurations apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Paused apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A list of IP addresses or CIDR ranges that will be allowed to access the URLs +// specified in the Zone Lockdown rule. You can include any number of `ip` or +// `ip_range` configurations. +// +// Union satisfied by +// [ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfiguration] +// or +// [ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration]. +type ZoneFirewallLockdownUpdateResponseResultConfigurations interface { + implementsZoneFirewallLockdownUpdateResponseResultConfigurations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallLockdownUpdateResponseResultConfigurations)(nil)).Elem(), "") +} + +type ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the Zone Lockdown rule. + Target ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON zoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfiguration] +type zoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfiguration) implementsZoneFirewallLockdownUpdateResponseResultConfigurations() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the Zone Lockdown rule. +type ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget string + +const ( + ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTargetIP ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget = "ip" +) + +type ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the Zone Lockdown rule. + Target ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24`. + Value string `json:"value"` + JSON zoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration] +type zoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration) implementsZoneFirewallLockdownUpdateResponseResultConfigurations() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the Zone Lockdown rule. +type ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget string + +const ( + ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTargetIPRange ZoneFirewallLockdownUpdateResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget = "ip_range" +) + +// Whether the API call was successful +type ZoneFirewallLockdownUpdateResponseSuccess bool + +const ( + ZoneFirewallLockdownUpdateResponseSuccessTrue ZoneFirewallLockdownUpdateResponseSuccess = true +) + +type ZoneFirewallLockdownDeleteResponse struct { + Result ZoneFirewallLockdownDeleteResponseResult `json:"result"` + JSON zoneFirewallLockdownDeleteResponseJSON `json:"-"` +} + +// zoneFirewallLockdownDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallLockdownDeleteResponse] +type zoneFirewallLockdownDeleteResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownDeleteResponseResult struct { + // The unique identifier of the Zone Lockdown rule. + ID string `json:"id"` + JSON zoneFirewallLockdownDeleteResponseResultJSON `json:"-"` +} + +// zoneFirewallLockdownDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneFirewallLockdownDeleteResponseResult] +type zoneFirewallLockdownDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponse struct { + Errors []ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseError `json:"errors"` + Messages []ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseMessage `json:"messages"` + Result ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseSuccess `json:"success"` + JSON zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseJSON contains the +// JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponse] +type zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseErrorJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseError] +type zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseMessageJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseMessage] +type zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResult struct { + // The unique identifier of the Zone Lockdown rule. + ID string `json:"id,required"` + // A list of IP addresses or CIDR ranges that will be allowed to access the URLs + // specified in the Zone Lockdown rule. You can include any number of `ip` or + // `ip_range` configurations. + Configurations ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurations `json:"configurations,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // An informative summary of the rule. + Description string `json:"description,required"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // When true, indicates that the rule is currently paused. + Paused bool `json:"paused,required"` + // The URLs to include in the rule definition. You can use wildcards. Each entered + // URL will be escaped before use, which means you can only use simple wildcard + // patterns. + URLs []string `json:"urls,required"` + JSON zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResult] +type zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultJSON struct { + ID apijson.Field + Configurations apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Paused apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A list of IP addresses or CIDR ranges that will be allowed to access the URLs +// specified in the Zone Lockdown rule. You can include any number of `ip` or +// `ip_range` configurations. +// +// Union satisfied by +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfiguration] +// or +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration]. +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurations interface { + implementsZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurations)(nil)).Elem(), "") +} + +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the Zone Lockdown rule. + Target ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfiguration] +type zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfiguration) implementsZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurations() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the Zone Lockdown rule. +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget string + +const ( + ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTargetIP ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasIPConfigurationTarget = "ip" +) + +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the Zone Lockdown rule. + Target ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24`. + Value string `json:"value"` + JSON zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration] +type zoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfiguration) implementsZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurations() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the Zone Lockdown rule. +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget string + +const ( + ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTargetIPRange ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseResultConfigurationsDZw70ubTSchemasCidrConfigurationTarget = "ip_range" +) + +// Whether the API call was successful +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseSuccess bool + +const ( + ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseSuccessTrue ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleResponseSuccess = true +) + +type ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponse struct { + // The unique identifier of the Zone Lockdown rule. + ID string `json:"id,required"` + // A list of IP addresses or CIDR ranges that will be allowed to access the URLs + // specified in the Zone Lockdown rule. You can include any number of `ip` or + // `ip_range` configurations. + Configurations ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurations `json:"configurations,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // An informative summary of the rule. + Description string `json:"description,required"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // When true, indicates that the rule is currently paused. + Paused bool `json:"paused,required"` + // The URLs to include in the rule definition. You can use wildcards. Each entered + // URL will be escaped before use, which means you can only use simple wildcard + // patterns. + URLs []string `json:"urls,required"` + JSON zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseJSON contains the +// JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponse] +type zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseJSON struct { + ID apijson.Field + Configurations apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Paused apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A list of IP addresses or CIDR ranges that will be allowed to access the URLs +// specified in the Zone Lockdown rule. You can include any number of `ip` or +// `ip_range` configurations. +// +// Union satisfied by +// [ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfiguration] +// or +// [ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfiguration]. +type ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurations interface { + implementsZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurations() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurations)(nil)).Elem(), "") +} + +type ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the Zone Lockdown rule. + Target ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfiguration] +type zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfiguration) implementsZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurations() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the Zone Lockdown rule. +type ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfigurationTarget string + +const ( + ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfigurationTargetIP ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasIPConfigurationTarget = "ip" +) + +type ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the Zone Lockdown rule. + Target ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24`. + Value string `json:"value"` + JSON zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfigurationJSON `json:"-"` +} + +// zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfiguration] +type zoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfiguration) implementsZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurations() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the Zone Lockdown rule. +type ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfigurationTarget string + +const ( + ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfigurationTargetIPRange ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesResponseConfigurationsDZw70ubTSchemasCidrConfigurationTarget = "ip_range" +) + +type ZoneFirewallLockdownUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallLockdownUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesParams struct { + // A string to search for in the description of existing rules. + Description param.Field[string] `query:"description"` + // A string to search for in the description of existing rules. + DescriptionSearch param.Field[string] `query:"description_search"` + // A single IP address to search for in existing rules. + IP param.Field[string] `query:"ip"` + // A single IP address range to search for in existing rules. + IPRangeSearch param.Field[string] `query:"ip_range_search"` + // A single IP address to search for in existing rules. + IPSearch param.Field[string] `query:"ip_search"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // The maximum number of results per page. You can only set the value to `1` or to + // a multiple of 5 such as `5`, `10`, `15`, or `20`. + PerPage param.Field[float64] `query:"per_page"` + // The priority of the rule to control the processing order. A lower number + // indicates higher priority. If not provided, any rules with a configured priority + // will be processed before rules without a priority. + Priority param.Field[float64] `query:"priority"` + // A single URI to search for in the list of URLs of existing rules. + UriSearch param.Field[string] `query:"uri_search"` +} + +// URLQuery serializes +// [ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesParams]'s query parameters +// as `url.Values`. +func (r ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zonefirewalllockdown_test.go b/zonefirewalllockdown_test.go new file mode 100644 index 00000000000..6efc37381f9 --- /dev/null +++ b/zonefirewalllockdown_test.go @@ -0,0 +1,179 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallLockdownGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Lockdowns.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + ) + 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 TestZoneFirewallLockdownUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Lockdowns.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + cloudflare.ZoneFirewallLockdownUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallLockdownDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Lockdowns.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + ) + 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 TestZoneFirewallLockdownZoneLockdownNewAZoneLockdownRule(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Lockdowns.ZoneLockdownNewAZoneLockdownRule( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallLockdownZoneLockdownNewAZoneLockdownRuleParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallLockdownZoneLockdownListZoneLockdownRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Lockdowns.ZoneLockdownListZoneLockdownRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallLockdownZoneLockdownListZoneLockdownRulesParams{ + Description: cloudflare.F("endpoints"), + DescriptionSearch: cloudflare.F("endpoints"), + IP: cloudflare.F("1.2.3.4"), + IPRangeSearch: cloudflare.F("1.2.3.0/16"), + IPSearch: cloudflare.F("1.2.3.4"), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + Priority: cloudflare.F(5.000000), + UriSearch: cloudflare.F("/some/path"), + }, + ) + 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/zonefirewallrule.go b/zonefirewallrule.go new file mode 100644 index 00000000000..5340a3e137e --- /dev/null +++ b/zonefirewallrule.go @@ -0,0 +1,1650 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallRuleService 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 [NewZoneFirewallRuleService] method +// instead. +type ZoneFirewallRuleService struct { + Options []option.RequestOption +} + +// NewZoneFirewallRuleService 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 NewZoneFirewallRuleService(opts ...option.RequestOption) (r *ZoneFirewallRuleService) { + r = &ZoneFirewallRuleService{} + r.Options = opts + return +} + +// Fetches the details of a firewall rule. +func (r *ZoneFirewallRuleService) Get(ctx context.Context, zoneIdentifier string, id string, query ZoneFirewallRuleGetParams, opts ...option.RequestOption) (res *ZoneFirewallRuleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Updates an existing firewall rule. +func (r *ZoneFirewallRuleService) Update(ctx context.Context, zoneIdentifier string, id string, body ZoneFirewallRuleUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an existing firewall rule. +func (r *ZoneFirewallRuleService) Delete(ctx context.Context, zoneIdentifier string, id string, body ZoneFirewallRuleDeleteParams, opts ...option.RequestOption) (res *ZoneFirewallRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +// Create one or more firewall rules. +func (r *ZoneFirewallRuleService) FirewallRulesNewFirewallRules(ctx context.Context, zoneIdentifier string, body ZoneFirewallRuleFirewallRulesNewFirewallRulesParams, opts ...option.RequestOption) (res *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches firewall rules in a zone. You can filter the results using several +// optional parameters. +func (r *ZoneFirewallRuleService) FirewallRulesListFirewallRules(ctx context.Context, zoneIdentifier string, query ZoneFirewallRuleFirewallRulesListFirewallRulesParams, opts ...option.RequestOption) (res *shared.Page[ZoneFirewallRuleFirewallRulesListFirewallRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/rules", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Updates one or more existing firewall rules. +func (r *ZoneFirewallRuleService) FirewallRulesUpdateFirewallRules(ctx context.Context, zoneIdentifier string, body ZoneFirewallRuleFirewallRulesUpdateFirewallRulesParams, opts ...option.RequestOption) (res *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Updates the priority of existing firewall rules. +func (r *ZoneFirewallRuleService) FirewallRulesUpdatePriorityOfFirewallRules(ctx context.Context, zoneIdentifier string, body ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesParams, opts ...option.RequestOption) (res *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneFirewallRuleGetResponse struct { + Errors []ZoneFirewallRuleGetResponseError `json:"errors"` + Messages []ZoneFirewallRuleGetResponseMessage `json:"messages"` + Result ZoneFirewallRuleGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallRuleGetResponseSuccess `json:"success"` + JSON zoneFirewallRuleGetResponseJSON `json:"-"` +} + +// zoneFirewallRuleGetResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallRuleGetResponse] +type zoneFirewallRuleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleGetResponseErrorJSON `json:"-"` +} + +// zoneFirewallRuleGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneFirewallRuleGetResponseError] +type zoneFirewallRuleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleGetResponseMessageJSON `json:"-"` +} + +// zoneFirewallRuleGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneFirewallRuleGetResponseMessage] +type zoneFirewallRuleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleGetResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action ZoneFirewallRuleGetResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter ZoneFirewallRuleGetResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []ZoneFirewallRuleGetResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON zoneFirewallRuleGetResponseResultJSON `json:"-"` +} + +// zoneFirewallRuleGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneFirewallRuleGetResponseResult] +type zoneFirewallRuleGetResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type ZoneFirewallRuleGetResponseResultAction string + +const ( + ZoneFirewallRuleGetResponseResultActionBlock ZoneFirewallRuleGetResponseResultAction = "block" + ZoneFirewallRuleGetResponseResultActionChallenge ZoneFirewallRuleGetResponseResultAction = "challenge" + ZoneFirewallRuleGetResponseResultActionJsChallenge ZoneFirewallRuleGetResponseResultAction = "js_challenge" + ZoneFirewallRuleGetResponseResultActionManagedChallenge ZoneFirewallRuleGetResponseResultAction = "managed_challenge" + ZoneFirewallRuleGetResponseResultActionAllow ZoneFirewallRuleGetResponseResultAction = "allow" + ZoneFirewallRuleGetResponseResultActionLog ZoneFirewallRuleGetResponseResultAction = "log" + ZoneFirewallRuleGetResponseResultActionBypass ZoneFirewallRuleGetResponseResultAction = "bypass" +) + +// Union satisfied by [ZoneFirewallRuleGetResponseResultFilterDZw70ubTFilter] or +// [ZoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilter]. +type ZoneFirewallRuleGetResponseResultFilter interface { + implementsZoneFirewallRuleGetResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallRuleGetResponseResultFilter)(nil)).Elem(), "") +} + +type ZoneFirewallRuleGetResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFirewallRuleGetResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// zoneFirewallRuleGetResponseResultFilterDZw70ubTFilterJSON contains the JSON +// metadata for the struct [ZoneFirewallRuleGetResponseResultFilterDZw70ubTFilter] +type zoneFirewallRuleGetResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleGetResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleGetResponseResultFilterDZw70ubTFilter) implementsZoneFirewallRuleGetResponseResultFilter() { +} + +type ZoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON zoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// zoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilterJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilter] +type zoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleGetResponseResultFilterDZw70ubTDeletedFilter) implementsZoneFirewallRuleGetResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type ZoneFirewallRuleGetResponseResultProduct string + +const ( + ZoneFirewallRuleGetResponseResultProductZoneLockdown ZoneFirewallRuleGetResponseResultProduct = "zoneLockdown" + ZoneFirewallRuleGetResponseResultProductUaBlock ZoneFirewallRuleGetResponseResultProduct = "uaBlock" + ZoneFirewallRuleGetResponseResultProductBic ZoneFirewallRuleGetResponseResultProduct = "bic" + ZoneFirewallRuleGetResponseResultProductHot ZoneFirewallRuleGetResponseResultProduct = "hot" + ZoneFirewallRuleGetResponseResultProductSecurityLevel ZoneFirewallRuleGetResponseResultProduct = "securityLevel" + ZoneFirewallRuleGetResponseResultProductRateLimit ZoneFirewallRuleGetResponseResultProduct = "rateLimit" + ZoneFirewallRuleGetResponseResultProductWaf ZoneFirewallRuleGetResponseResultProduct = "waf" +) + +// Whether the API call was successful +type ZoneFirewallRuleGetResponseSuccess bool + +const ( + ZoneFirewallRuleGetResponseSuccessTrue ZoneFirewallRuleGetResponseSuccess = true +) + +type ZoneFirewallRuleUpdateResponse struct { + Errors []ZoneFirewallRuleUpdateResponseError `json:"errors"` + Messages []ZoneFirewallRuleUpdateResponseMessage `json:"messages"` + Result ZoneFirewallRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallRuleUpdateResponseSuccess `json:"success"` + JSON zoneFirewallRuleUpdateResponseJSON `json:"-"` +} + +// zoneFirewallRuleUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallRuleUpdateResponse] +type zoneFirewallRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleUpdateResponseErrorJSON `json:"-"` +} + +// zoneFirewallRuleUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFirewallRuleUpdateResponseError] +type zoneFirewallRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneFirewallRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallRuleUpdateResponseMessage] +type zoneFirewallRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleUpdateResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action ZoneFirewallRuleUpdateResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter ZoneFirewallRuleUpdateResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []ZoneFirewallRuleUpdateResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON zoneFirewallRuleUpdateResponseResultJSON `json:"-"` +} + +// zoneFirewallRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneFirewallRuleUpdateResponseResult] +type zoneFirewallRuleUpdateResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type ZoneFirewallRuleUpdateResponseResultAction string + +const ( + ZoneFirewallRuleUpdateResponseResultActionBlock ZoneFirewallRuleUpdateResponseResultAction = "block" + ZoneFirewallRuleUpdateResponseResultActionChallenge ZoneFirewallRuleUpdateResponseResultAction = "challenge" + ZoneFirewallRuleUpdateResponseResultActionJsChallenge ZoneFirewallRuleUpdateResponseResultAction = "js_challenge" + ZoneFirewallRuleUpdateResponseResultActionManagedChallenge ZoneFirewallRuleUpdateResponseResultAction = "managed_challenge" + ZoneFirewallRuleUpdateResponseResultActionAllow ZoneFirewallRuleUpdateResponseResultAction = "allow" + ZoneFirewallRuleUpdateResponseResultActionLog ZoneFirewallRuleUpdateResponseResultAction = "log" + ZoneFirewallRuleUpdateResponseResultActionBypass ZoneFirewallRuleUpdateResponseResultAction = "bypass" +) + +// Union satisfied by [ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilter] or +// [ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter]. +type ZoneFirewallRuleUpdateResponseResultFilter interface { + implementsZoneFirewallRuleUpdateResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallRuleUpdateResponseResultFilter)(nil)).Elem(), "") +} + +type ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// zoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilterJSON contains the JSON +// metadata for the struct +// [ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilter] +type zoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTFilter) implementsZoneFirewallRuleUpdateResponseResultFilter() { +} + +type ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON zoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// zoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilterJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter] +type zoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleUpdateResponseResultFilterDZw70ubTDeletedFilter) implementsZoneFirewallRuleUpdateResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type ZoneFirewallRuleUpdateResponseResultProduct string + +const ( + ZoneFirewallRuleUpdateResponseResultProductZoneLockdown ZoneFirewallRuleUpdateResponseResultProduct = "zoneLockdown" + ZoneFirewallRuleUpdateResponseResultProductUaBlock ZoneFirewallRuleUpdateResponseResultProduct = "uaBlock" + ZoneFirewallRuleUpdateResponseResultProductBic ZoneFirewallRuleUpdateResponseResultProduct = "bic" + ZoneFirewallRuleUpdateResponseResultProductHot ZoneFirewallRuleUpdateResponseResultProduct = "hot" + ZoneFirewallRuleUpdateResponseResultProductSecurityLevel ZoneFirewallRuleUpdateResponseResultProduct = "securityLevel" + ZoneFirewallRuleUpdateResponseResultProductRateLimit ZoneFirewallRuleUpdateResponseResultProduct = "rateLimit" + ZoneFirewallRuleUpdateResponseResultProductWaf ZoneFirewallRuleUpdateResponseResultProduct = "waf" +) + +// Whether the API call was successful +type ZoneFirewallRuleUpdateResponseSuccess bool + +const ( + ZoneFirewallRuleUpdateResponseSuccessTrue ZoneFirewallRuleUpdateResponseSuccess = true +) + +type ZoneFirewallRuleDeleteResponse struct { + Errors []ZoneFirewallRuleDeleteResponseError `json:"errors"` + Messages []ZoneFirewallRuleDeleteResponseMessage `json:"messages"` + Result ZoneFirewallRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallRuleDeleteResponseSuccess `json:"success"` + JSON zoneFirewallRuleDeleteResponseJSON `json:"-"` +} + +// zoneFirewallRuleDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallRuleDeleteResponse] +type zoneFirewallRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleDeleteResponseErrorJSON `json:"-"` +} + +// zoneFirewallRuleDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFirewallRuleDeleteResponseError] +type zoneFirewallRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleDeleteResponseMessageJSON `json:"-"` +} + +// zoneFirewallRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallRuleDeleteResponseMessage] +type zoneFirewallRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleDeleteResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action ZoneFirewallRuleDeleteResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter ZoneFirewallRuleDeleteResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []ZoneFirewallRuleDeleteResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON zoneFirewallRuleDeleteResponseResultJSON `json:"-"` +} + +// zoneFirewallRuleDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneFirewallRuleDeleteResponseResult] +type zoneFirewallRuleDeleteResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type ZoneFirewallRuleDeleteResponseResultAction string + +const ( + ZoneFirewallRuleDeleteResponseResultActionBlock ZoneFirewallRuleDeleteResponseResultAction = "block" + ZoneFirewallRuleDeleteResponseResultActionChallenge ZoneFirewallRuleDeleteResponseResultAction = "challenge" + ZoneFirewallRuleDeleteResponseResultActionJsChallenge ZoneFirewallRuleDeleteResponseResultAction = "js_challenge" + ZoneFirewallRuleDeleteResponseResultActionManagedChallenge ZoneFirewallRuleDeleteResponseResultAction = "managed_challenge" + ZoneFirewallRuleDeleteResponseResultActionAllow ZoneFirewallRuleDeleteResponseResultAction = "allow" + ZoneFirewallRuleDeleteResponseResultActionLog ZoneFirewallRuleDeleteResponseResultAction = "log" + ZoneFirewallRuleDeleteResponseResultActionBypass ZoneFirewallRuleDeleteResponseResultAction = "bypass" +) + +// Union satisfied by [ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilter] or +// [ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter]. +type ZoneFirewallRuleDeleteResponseResultFilter interface { + implementsZoneFirewallRuleDeleteResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallRuleDeleteResponseResultFilter)(nil)).Elem(), "") +} + +type ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// zoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilterJSON contains the JSON +// metadata for the struct +// [ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilter] +type zoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTFilter) implementsZoneFirewallRuleDeleteResponseResultFilter() { +} + +type ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON zoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// zoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilterJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter] +type zoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleDeleteResponseResultFilterDZw70ubTDeletedFilter) implementsZoneFirewallRuleDeleteResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type ZoneFirewallRuleDeleteResponseResultProduct string + +const ( + ZoneFirewallRuleDeleteResponseResultProductZoneLockdown ZoneFirewallRuleDeleteResponseResultProduct = "zoneLockdown" + ZoneFirewallRuleDeleteResponseResultProductUaBlock ZoneFirewallRuleDeleteResponseResultProduct = "uaBlock" + ZoneFirewallRuleDeleteResponseResultProductBic ZoneFirewallRuleDeleteResponseResultProduct = "bic" + ZoneFirewallRuleDeleteResponseResultProductHot ZoneFirewallRuleDeleteResponseResultProduct = "hot" + ZoneFirewallRuleDeleteResponseResultProductSecurityLevel ZoneFirewallRuleDeleteResponseResultProduct = "securityLevel" + ZoneFirewallRuleDeleteResponseResultProductRateLimit ZoneFirewallRuleDeleteResponseResultProduct = "rateLimit" + ZoneFirewallRuleDeleteResponseResultProductWaf ZoneFirewallRuleDeleteResponseResultProduct = "waf" +) + +// Whether the API call was successful +type ZoneFirewallRuleDeleteResponseSuccess bool + +const ( + ZoneFirewallRuleDeleteResponseSuccessTrue ZoneFirewallRuleDeleteResponseSuccess = true +) + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponse struct { + Errors []ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseError `json:"errors"` + Messages []ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseMessage `json:"messages"` + Result []ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResult `json:"result"` + ResultInfo ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseSuccess `json:"success"` + JSON zoneFirewallRuleFirewallRulesNewFirewallRulesResponseJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesNewFirewallRulesResponseJSON contains the JSON +// metadata for the struct [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponse] +type zoneFirewallRuleFirewallRulesNewFirewallRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleFirewallRulesNewFirewallRulesResponseErrorJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesNewFirewallRulesResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseError] +type zoneFirewallRuleFirewallRulesNewFirewallRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleFirewallRulesNewFirewallRulesResponseMessageJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesNewFirewallRulesResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseMessage] +type zoneFirewallRuleFirewallRulesNewFirewallRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResult] +type zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction string + +const ( + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultActionBlock ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction = "block" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultActionChallenge ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction = "challenge" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultActionJsChallenge ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction = "js_challenge" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultActionManagedChallenge ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction = "managed_challenge" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultActionAllow ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction = "allow" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultActionLog ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction = "log" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultActionBypass ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultAction = "bypass" +) + +// Union satisfied by +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilter] +// or +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilter]. +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilter interface { + implementsZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilter)(nil)).Elem(), "") +} + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilter] +type zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTFilter) implementsZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilter() { +} + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilter] +type zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilterDZw70ubTDeletedFilter) implementsZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct string + +const ( + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProductZoneLockdown ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct = "zoneLockdown" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProductUaBlock ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct = "uaBlock" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProductBic ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct = "bic" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProductHot ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct = "hot" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProductSecurityLevel ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct = "securityLevel" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProductRateLimit ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct = "rateLimit" + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProductWaf ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultProduct = "waf" +) + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultInfoJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultInfoJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultInfo] +type zoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseSuccess bool + +const ( + ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseSuccessTrue ZoneFirewallRuleFirewallRulesNewFirewallRulesResponseSuccess = true +) + +type ZoneFirewallRuleFirewallRulesListFirewallRulesResponse struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesListFirewallRulesResponseJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesListFirewallRulesResponseJSON contains the JSON +// metadata for the struct [ZoneFirewallRuleFirewallRulesListFirewallRulesResponse] +type zoneFirewallRuleFirewallRulesListFirewallRulesResponseJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesListFirewallRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction string + +const ( + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseActionBlock ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction = "block" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseActionChallenge ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction = "challenge" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseActionJsChallenge ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction = "js_challenge" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseActionManagedChallenge ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction = "managed_challenge" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseActionAllow ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction = "allow" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseActionLog ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction = "log" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseActionBypass ZoneFirewallRuleFirewallRulesListFirewallRulesResponseAction = "bypass" +) + +// Union satisfied by +// [ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilter] or +// [ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilter]. +type ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilter interface { + implementsZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilter)(nil)).Elem(), "") +} + +type ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilter] +type zoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTFilter) implementsZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilter() { +} + +type ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON zoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilter] +type zoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilterDZw70ubTDeletedFilter) implementsZoneFirewallRuleFirewallRulesListFirewallRulesResponseFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct string + +const ( + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProductZoneLockdown ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct = "zoneLockdown" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProductUaBlock ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct = "uaBlock" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProductBic ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct = "bic" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProductHot ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct = "hot" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProductSecurityLevel ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct = "securityLevel" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProductRateLimit ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct = "rateLimit" + ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProductWaf ZoneFirewallRuleFirewallRulesListFirewallRulesResponseProduct = "waf" +) + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponse struct { + Errors []ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseError `json:"errors"` + Messages []ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseMessage `json:"messages"` + Result []ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResult `json:"result"` + ResultInfo ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseSuccess `json:"success"` + JSON zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseJSON contains the JSON +// metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponse] +type zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseErrorJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseError] +type zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseMessageJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseMessage] +type zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResult] +type zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction string + +const ( + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultActionBlock ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction = "block" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultActionChallenge ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction = "challenge" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultActionJsChallenge ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction = "js_challenge" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultActionManagedChallenge ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction = "managed_challenge" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultActionAllow ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction = "allow" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultActionLog ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction = "log" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultActionBypass ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultAction = "bypass" +) + +// Union satisfied by +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilter] +// or +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilter]. +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilter interface { + implementsZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilter)(nil)).Elem(), "") +} + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilter] +type zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTFilter) implementsZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilter() { +} + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilter] +type zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilterDZw70ubTDeletedFilter) implementsZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct string + +const ( + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProductZoneLockdown ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct = "zoneLockdown" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProductUaBlock ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct = "uaBlock" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProductBic ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct = "bic" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProductHot ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct = "hot" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProductSecurityLevel ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct = "securityLevel" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProductRateLimit ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct = "rateLimit" + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProductWaf ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultProduct = "waf" +) + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultInfoJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultInfoJSON contains +// the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultInfo] +type zoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseSuccess bool + +const ( + ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseSuccessTrue ZoneFirewallRuleFirewallRulesUpdateFirewallRulesResponseSuccess = true +) + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponse struct { + Errors []ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseError `json:"errors"` + Messages []ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseMessage `json:"messages"` + Result []ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResult `json:"result"` + ResultInfo ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseSuccess `json:"success"` + JSON zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseJSON contains +// the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponse] +type zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseErrorJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseError] +type zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseMessageJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseMessage] +type zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResult struct { + // The unique identifier of the firewall rule. + ID string `json:"id"` + // The action to apply to a matched request. The `log` action is only available on + // an Enterprise plan. + Action ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction `json:"action"` + // An informative summary of the firewall rule. + Description string `json:"description"` + Filter ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilter `json:"filter"` + // When true, indicates that the firewall rule is currently paused. + Paused bool `json:"paused"` + // The priority of the rule. Optional value used to define the processing order. A + // lower number indicates a higher priority. If not provided, rules with a defined + // priority will be processed before rules without a priority. + Priority float64 `json:"priority"` + Products []ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct `json:"products"` + // A short reference tag. Allows you to select related firewall rules. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResult] +type zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Filter apijson.Field + Paused apijson.Field + Priority apijson.Field + Products apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. The `log` action is only available on +// an Enterprise plan. +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction string + +const ( + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultActionBlock ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction = "block" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultActionChallenge ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction = "challenge" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultActionJsChallenge ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction = "js_challenge" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultActionManagedChallenge ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction = "managed_challenge" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultActionAllow ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction = "allow" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultActionLog ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction = "log" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultActionBypass ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultAction = "bypass" +) + +// Union satisfied by +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilter] +// or +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilter]. +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilter interface { + implementsZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilter() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilter)(nil)).Elem(), "") +} + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilter struct { + // The unique identifier of the filter. + ID string `json:"id"` + // An informative summary of the filter. + Description string `json:"description"` + // The filter expression. For more information, refer to + // [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + Expression string `json:"expression"` + // When true, indicates that the filter is currently paused. + Paused bool `json:"paused"` + // A short reference tag. Allows you to select related filters. + Ref string `json:"ref"` + JSON zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilter] +type zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilterJSON struct { + ID apijson.Field + Description apijson.Field + Expression apijson.Field + Paused apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTFilter) implementsZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilter() { +} + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilter struct { + // The unique identifier of the filter. + ID string `json:"id,required"` + // When true, indicates that the firewall rule was deleted. + Deleted bool `json:"deleted,required"` + JSON zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilter] +type zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilterJSON struct { + ID apijson.Field + Deleted apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilterDZw70ubTDeletedFilter) implementsZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultFilter() { +} + +// A list of products to bypass for a request when using the `bypass` action. +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct string + +const ( + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProductZoneLockdown ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct = "zoneLockdown" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProductUaBlock ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct = "uaBlock" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProductBic ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct = "bic" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProductHot ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct = "hot" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProductSecurityLevel ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct = "securityLevel" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProductRateLimit ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct = "rateLimit" + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProductWaf ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultProduct = "waf" +) + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultInfoJSON `json:"-"` +} + +// zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultInfo] +type zoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseSuccess bool + +const ( + ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseSuccessTrue ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesResponseSuccess = true +) + +type ZoneFirewallRuleGetParams struct { +} + +type ZoneFirewallRuleUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallRuleDeleteParams struct { + // When true, indicates that Cloudflare should also delete the associated filter if + // there are no other firewall rules referencing the filter. + DeleteFilterIfUnused param.Field[bool] `json:"delete_filter_if_unused"` +} + +func (r ZoneFirewallRuleDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneFirewallRuleFirewallRulesNewFirewallRulesParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallRuleFirewallRulesNewFirewallRulesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallRuleFirewallRulesListFirewallRulesParams struct { + // The action to search for. Must be an exact match. + Action param.Field[string] `query:"action"` + // A case-insensitive string to find in the description. + Description param.Field[string] `query:"description"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // When true, indicates that the firewall rule is currently paused. + Paused param.Field[bool] `query:"paused"` + // Number of firewall rules per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [ZoneFirewallRuleFirewallRulesListFirewallRulesParams]'s +// query parameters as `url.Values`. +func (r ZoneFirewallRuleFirewallRulesListFirewallRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneFirewallRuleFirewallRulesUpdateFirewallRulesParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallRuleFirewallRulesUpdateFirewallRulesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/zonefirewallrule_test.go b/zonefirewallrule_test.go new file mode 100644 index 00000000000..d94a6510f3c --- /dev/null +++ b/zonefirewallrule_test.go @@ -0,0 +1,243 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallRuleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Rules.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b60", + cloudflare.ZoneFirewallRuleGetParams{}, + ) + 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 TestZoneFirewallRuleUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Rules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b60", + cloudflare.ZoneFirewallRuleUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallRuleDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Rules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b60", + cloudflare.ZoneFirewallRuleDeleteParams{ + DeleteFilterIfUnused: cloudflare.F(true), + }, + ) + 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 TestZoneFirewallRuleFirewallRulesNewFirewallRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Rules.FirewallRulesNewFirewallRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallRuleFirewallRulesNewFirewallRulesParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallRuleFirewallRulesListFirewallRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Rules.FirewallRulesListFirewallRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallRuleFirewallRulesListFirewallRulesParams{ + Action: cloudflare.F("block"), + Description: cloudflare.F("mir"), + Page: cloudflare.F(1.000000), + Paused: cloudflare.F(false), + PerPage: cloudflare.F(5.000000), + }, + ) + 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 TestZoneFirewallRuleFirewallRulesUpdateFirewallRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Rules.FirewallRulesUpdateFirewallRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallRuleFirewallRulesUpdateFirewallRulesParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Rules.FirewallRulesUpdatePriorityOfFirewallRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallRuleFirewallRulesUpdatePriorityOfFirewallRulesParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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/zonefirewalluarule.go b/zonefirewalluarule.go new file mode 100644 index 00000000000..424c6265b0f --- /dev/null +++ b/zonefirewalluarule.go @@ -0,0 +1,489 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallUaRuleService 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 [NewZoneFirewallUaRuleService] method +// instead. +type ZoneFirewallUaRuleService struct { + Options []option.RequestOption +} + +// NewZoneFirewallUaRuleService 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 NewZoneFirewallUaRuleService(opts ...option.RequestOption) (r *ZoneFirewallUaRuleService) { + r = &ZoneFirewallUaRuleService{} + r.Options = opts + return +} + +// Fetches the details of a User Agent Blocking rule. +func (r *ZoneFirewallUaRuleService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFirewallUaRuleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/ua_rules/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an existing User Agent Blocking rule. +func (r *ZoneFirewallUaRuleService) Update(ctx context.Context, zoneIdentifier string, id string, body ZoneFirewallUaRuleUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallUaRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/ua_rules/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an existing User Agent Blocking rule. +func (r *ZoneFirewallUaRuleService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFirewallUaRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/ua_rules/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new User Agent Blocking rule in a zone. +func (r *ZoneFirewallUaRuleService) UserAgentBlockingRulesNewAUserAgentBlockingRule(ctx context.Context, zoneIdentifier string, body ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleParams, opts ...option.RequestOption) (res *ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/ua_rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches User Agent Blocking rules in a zone. You can filter the results using +// several optional parameters. +func (r *ZoneFirewallUaRuleService) UserAgentBlockingRulesListUserAgentBlockingRules(ctx context.Context, zoneIdentifier string, query ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesParams, opts ...option.RequestOption) (res *shared.Page[ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/ua_rules", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneFirewallUaRuleGetResponse struct { + Errors []ZoneFirewallUaRuleGetResponseError `json:"errors"` + Messages []ZoneFirewallUaRuleGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneFirewallUaRuleGetResponseSuccess `json:"success"` + JSON zoneFirewallUaRuleGetResponseJSON `json:"-"` +} + +// zoneFirewallUaRuleGetResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallUaRuleGetResponse] +type zoneFirewallUaRuleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleGetResponseErrorJSON `json:"-"` +} + +// zoneFirewallUaRuleGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneFirewallUaRuleGetResponseError] +type zoneFirewallUaRuleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleGetResponseMessageJSON `json:"-"` +} + +// zoneFirewallUaRuleGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallUaRuleGetResponseMessage] +type zoneFirewallUaRuleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallUaRuleGetResponseSuccess bool + +const ( + ZoneFirewallUaRuleGetResponseSuccessTrue ZoneFirewallUaRuleGetResponseSuccess = true +) + +type ZoneFirewallUaRuleUpdateResponse struct { + Errors []ZoneFirewallUaRuleUpdateResponseError `json:"errors"` + Messages []ZoneFirewallUaRuleUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneFirewallUaRuleUpdateResponseSuccess `json:"success"` + JSON zoneFirewallUaRuleUpdateResponseJSON `json:"-"` +} + +// zoneFirewallUaRuleUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallUaRuleUpdateResponse] +type zoneFirewallUaRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleUpdateResponseErrorJSON `json:"-"` +} + +// zoneFirewallUaRuleUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFirewallUaRuleUpdateResponseError] +type zoneFirewallUaRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneFirewallUaRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallUaRuleUpdateResponseMessage] +type zoneFirewallUaRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallUaRuleUpdateResponseSuccess bool + +const ( + ZoneFirewallUaRuleUpdateResponseSuccessTrue ZoneFirewallUaRuleUpdateResponseSuccess = true +) + +type ZoneFirewallUaRuleDeleteResponse struct { + Errors []ZoneFirewallUaRuleDeleteResponseError `json:"errors"` + Messages []ZoneFirewallUaRuleDeleteResponseMessage `json:"messages"` + Result ZoneFirewallUaRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallUaRuleDeleteResponseSuccess `json:"success"` + JSON zoneFirewallUaRuleDeleteResponseJSON `json:"-"` +} + +// zoneFirewallUaRuleDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallUaRuleDeleteResponse] +type zoneFirewallUaRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleDeleteResponseErrorJSON `json:"-"` +} + +// zoneFirewallUaRuleDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFirewallUaRuleDeleteResponseError] +type zoneFirewallUaRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleDeleteResponseMessageJSON `json:"-"` +} + +// zoneFirewallUaRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallUaRuleDeleteResponseMessage] +type zoneFirewallUaRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleDeleteResponseResult struct { + // The unique identifier of the User Agent Blocking rule. + ID string `json:"id"` + JSON zoneFirewallUaRuleDeleteResponseResultJSON `json:"-"` +} + +// zoneFirewallUaRuleDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneFirewallUaRuleDeleteResponseResult] +type zoneFirewallUaRuleDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallUaRuleDeleteResponseSuccess bool + +const ( + ZoneFirewallUaRuleDeleteResponseSuccessTrue ZoneFirewallUaRuleDeleteResponseSuccess = true +) + +type ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponse struct { + Errors []ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseError `json:"errors"` + Messages []ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseSuccess `json:"success"` + JSON zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseJSON `json:"-"` +} + +// zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseJSON +// contains the JSON metadata for the struct +// [ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponse] +type zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseErrorJSON `json:"-"` +} + +// zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseError] +type zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseMessageJSON `json:"-"` +} + +// zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseMessage] +type zoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseSuccess bool + +const ( + ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseSuccessTrue ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleResponseSuccess = true +) + +type ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponse struct { + // The unique identifier of the User Agent Blocking rule. + ID string `json:"id"` + // The configuration object for the current rule. + Configuration ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseConfiguration `json:"configuration"` + // An informative summary of the rule. + Description string `json:"description"` + // The action to apply to a matched request. + Mode ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseMode `json:"mode"` + // When true, indicates that the rule is currently paused. + Paused bool `json:"paused"` + JSON zoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseJSON `json:"-"` +} + +// zoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseJSON +// contains the JSON metadata for the struct +// [ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponse] +type zoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseJSON struct { + ID apijson.Field + Configuration apijson.Field + Description apijson.Field + Mode apijson.Field + Paused apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration object for the current rule. +type ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseConfiguration struct { + // The configuration target for this rule. You must set the target to `ua` for User + // Agent Blocking rules. + Target string `json:"target"` + // The exact user agent string to match. This value will be compared to the + // received `User-Agent` HTTP header value. + Value string `json:"value"` + JSON zoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseConfigurationJSON `json:"-"` +} + +// zoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseConfigurationJSON +// contains the JSON metadata for the struct +// [ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseConfiguration] +type zoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseMode string + +const ( + ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseModeBlock ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseMode = "block" + ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseModeChallenge ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseMode = "challenge" + ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseModeJsChallenge ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseMode = "js_challenge" + ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseModeManagedChallenge ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesResponseMode = "managed_challenge" +) + +type ZoneFirewallUaRuleUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallUaRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesParams struct { + // A string to search for in the description of existing rules. + Description param.Field[string] `query:"description"` + // A string to search for in the description of existing rules. + DescriptionSearch param.Field[string] `query:"description_search"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // The maximum number of results per page. You can only set the value to `1` or to + // a multiple of 5 such as `5`, `10`, `15`, or `20`. + PerPage param.Field[float64] `query:"per_page"` + // A string to search for in the user agent values of existing rules. + UaSearch param.Field[string] `query:"ua_search"` +} + +// URLQuery serializes +// [ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesParams]'s +// query parameters as `url.Values`. +func (r ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zonefirewalluarule_test.go b/zonefirewalluarule_test.go new file mode 100644 index 00000000000..515ae5be37a --- /dev/null +++ b/zonefirewalluarule_test.go @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallUaRuleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.UaRules.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + ) + 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 TestZoneFirewallUaRuleUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.UaRules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + cloudflare.ZoneFirewallUaRuleUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallUaRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.UaRules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + ) + 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 TestZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRule(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.UaRules.UserAgentBlockingRulesNewAUserAgentBlockingRule( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesNewAUserAgentBlockingRuleParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.UaRules.UserAgentBlockingRulesListUserAgentBlockingRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallUaRuleUserAgentBlockingRulesListUserAgentBlockingRulesParams{ + Description: cloudflare.F("abusive"), + DescriptionSearch: cloudflare.F("abusive"), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(1.000000), + UaSearch: cloudflare.F("Safari"), + }, + ) + 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/zonefirewallwaf.go b/zonefirewallwaf.go new file mode 100644 index 00000000000..83903997fcc --- /dev/null +++ b/zonefirewallwaf.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallWafService 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 [NewZoneFirewallWafService] method +// instead. +type ZoneFirewallWafService struct { + Options []option.RequestOption + Overrides *ZoneFirewallWafOverrideService + Packages *ZoneFirewallWafPackageService +} + +// NewZoneFirewallWafService 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 NewZoneFirewallWafService(opts ...option.RequestOption) (r *ZoneFirewallWafService) { + r = &ZoneFirewallWafService{} + r.Options = opts + r.Overrides = NewZoneFirewallWafOverrideService(opts...) + r.Packages = NewZoneFirewallWafPackageService(opts...) + return +} diff --git a/zonefirewallwafoverride.go b/zonefirewallwafoverride.go new file mode 100644 index 00000000000..97fea11578b --- /dev/null +++ b/zonefirewallwafoverride.go @@ -0,0 +1,795 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallWafOverrideService 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 +// [NewZoneFirewallWafOverrideService] method instead. +type ZoneFirewallWafOverrideService struct { + Options []option.RequestOption +} + +// NewZoneFirewallWafOverrideService 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 NewZoneFirewallWafOverrideService(opts ...option.RequestOption) (r *ZoneFirewallWafOverrideService) { + r = &ZoneFirewallWafOverrideService{} + r.Options = opts + return +} + +// Fetches the details of a URI-based WAF override. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafOverrideService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFirewallWafOverrideGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/overrides/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates an existing URI-based WAF override. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafOverrideService) Update(ctx context.Context, zoneIdentifier string, id string, body ZoneFirewallWafOverrideUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallWafOverrideUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/overrides/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an existing URI-based WAF override. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafOverrideService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneFirewallWafOverrideDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/overrides/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a URI-based WAF override for a zone. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafOverrideService) WafOverridesNewAWafOverride(ctx context.Context, zoneIdentifier string, body ZoneFirewallWafOverrideWafOverridesNewAWafOverrideParams, opts ...option.RequestOption) (res *ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/overrides", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches the URI-based WAF overrides in a zone. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafOverrideService) WafOverridesListWafOverrides(ctx context.Context, zoneIdentifier string, query ZoneFirewallWafOverrideWafOverridesListWafOverridesParams, opts ...option.RequestOption) (res *shared.Page[ZoneFirewallWafOverrideWafOverridesListWafOverridesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/overrides", zoneIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneFirewallWafOverrideGetResponse struct { + Errors []ZoneFirewallWafOverrideGetResponseError `json:"errors"` + Messages []ZoneFirewallWafOverrideGetResponseMessage `json:"messages"` + Result ZoneFirewallWafOverrideGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallWafOverrideGetResponseSuccess `json:"success"` + JSON zoneFirewallWafOverrideGetResponseJSON `json:"-"` +} + +// zoneFirewallWafOverrideGetResponseJSON contains the JSON metadata for the struct +// [ZoneFirewallWafOverrideGetResponse] +type zoneFirewallWafOverrideGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafOverrideGetResponseErrorJSON `json:"-"` +} + +// zoneFirewallWafOverrideGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneFirewallWafOverrideGetResponseError] +type zoneFirewallWafOverrideGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafOverrideGetResponseMessageJSON `json:"-"` +} + +// zoneFirewallWafOverrideGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneFirewallWafOverrideGetResponseMessage] +type zoneFirewallWafOverrideGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideGetResponseResult struct { + // The unique identifier of the WAF override. + ID string `json:"id"` + // An informative summary of the current URI-based WAF override. + Description string `json:"description,nullable"` + // An object that allows you to enable or disable WAF rule groups for the current + // WAF override. Each key of this object must be the ID of a WAF rule group, and + // each value must be a valid WAF action (usually `default` or `disable`). When + // creating a new URI-based WAF override, you must provide a `groups` object or a + // `rules` object. + Groups interface{} `json:"groups"` + // When true, indicates that the WAF package is currently paused. + Paused bool `json:"paused"` + // The relative priority of the current URI-based WAF override when multiple + // overrides match a single URL. A lower number indicates higher priority. Higher + // priority overrides may overwrite values set by lower priority overrides. + Priority float64 `json:"priority"` + // Specifies that, when a WAF rule matches, its configured action will be replaced + // by the action configured in this object. + RewriteAction ZoneFirewallWafOverrideGetResponseResultRewriteAction `json:"rewrite_action"` + // An object that allows you to override the action of specific WAF rules. Each key + // of this object must be the ID of a WAF rule, and each value must be a valid WAF + // action. Unless you are disabling a rule, ensure that you also enable the rule + // group that this WAF rule belongs to. When creating a new URI-based WAF override, + // you must provide a `groups` object or a `rules` object. + Rules interface{} `json:"rules"` + // The URLs to include in the current WAF override. You can use wildcards. Each + // entered URL will be escaped before use, which means you can only use simple + // wildcard patterns. + URLs []string `json:"urls"` + JSON zoneFirewallWafOverrideGetResponseResultJSON `json:"-"` +} + +// zoneFirewallWafOverrideGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneFirewallWafOverrideGetResponseResult] +type zoneFirewallWafOverrideGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Groups apijson.Field + Paused apijson.Field + Priority apijson.Field + RewriteAction apijson.Field + Rules apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies that, when a WAF rule matches, its configured action will be replaced +// by the action configured in this object. +type ZoneFirewallWafOverrideGetResponseResultRewriteAction struct { + // The WAF rule action to apply. + Block ZoneFirewallWafOverrideGetResponseResultRewriteActionBlock `json:"block"` + Challenge interface{} `json:"challenge"` + Default interface{} `json:"default"` + // The WAF rule action to apply. + Disable ZoneFirewallWafOverrideGetResponseResultRewriteActionDisable `json:"disable"` + Simulate interface{} `json:"simulate"` + JSON zoneFirewallWafOverrideGetResponseResultRewriteActionJSON `json:"-"` +} + +// zoneFirewallWafOverrideGetResponseResultRewriteActionJSON contains the JSON +// metadata for the struct [ZoneFirewallWafOverrideGetResponseResultRewriteAction] +type zoneFirewallWafOverrideGetResponseResultRewriteActionJSON struct { + Block apijson.Field + Challenge apijson.Field + Default apijson.Field + Disable apijson.Field + Simulate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideGetResponseResultRewriteAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideGetResponseResultRewriteActionBlock string + +const ( + ZoneFirewallWafOverrideGetResponseResultRewriteActionBlockChallenge ZoneFirewallWafOverrideGetResponseResultRewriteActionBlock = "challenge" + ZoneFirewallWafOverrideGetResponseResultRewriteActionBlockBlock ZoneFirewallWafOverrideGetResponseResultRewriteActionBlock = "block" + ZoneFirewallWafOverrideGetResponseResultRewriteActionBlockSimulate ZoneFirewallWafOverrideGetResponseResultRewriteActionBlock = "simulate" + ZoneFirewallWafOverrideGetResponseResultRewriteActionBlockDisable ZoneFirewallWafOverrideGetResponseResultRewriteActionBlock = "disable" + ZoneFirewallWafOverrideGetResponseResultRewriteActionBlockDefault ZoneFirewallWafOverrideGetResponseResultRewriteActionBlock = "default" +) + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideGetResponseResultRewriteActionDisable string + +const ( + ZoneFirewallWafOverrideGetResponseResultRewriteActionDisableChallenge ZoneFirewallWafOverrideGetResponseResultRewriteActionDisable = "challenge" + ZoneFirewallWafOverrideGetResponseResultRewriteActionDisableBlock ZoneFirewallWafOverrideGetResponseResultRewriteActionDisable = "block" + ZoneFirewallWafOverrideGetResponseResultRewriteActionDisableSimulate ZoneFirewallWafOverrideGetResponseResultRewriteActionDisable = "simulate" + ZoneFirewallWafOverrideGetResponseResultRewriteActionDisableDisable ZoneFirewallWafOverrideGetResponseResultRewriteActionDisable = "disable" + ZoneFirewallWafOverrideGetResponseResultRewriteActionDisableDefault ZoneFirewallWafOverrideGetResponseResultRewriteActionDisable = "default" +) + +// Whether the API call was successful +type ZoneFirewallWafOverrideGetResponseSuccess bool + +const ( + ZoneFirewallWafOverrideGetResponseSuccessTrue ZoneFirewallWafOverrideGetResponseSuccess = true +) + +type ZoneFirewallWafOverrideUpdateResponse struct { + Errors []ZoneFirewallWafOverrideUpdateResponseError `json:"errors"` + Messages []ZoneFirewallWafOverrideUpdateResponseMessage `json:"messages"` + Result ZoneFirewallWafOverrideUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallWafOverrideUpdateResponseSuccess `json:"success"` + JSON zoneFirewallWafOverrideUpdateResponseJSON `json:"-"` +} + +// zoneFirewallWafOverrideUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallWafOverrideUpdateResponse] +type zoneFirewallWafOverrideUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafOverrideUpdateResponseErrorJSON `json:"-"` +} + +// zoneFirewallWafOverrideUpdateResponseErrorJSON contains the JSON metadata for +// the struct [ZoneFirewallWafOverrideUpdateResponseError] +type zoneFirewallWafOverrideUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafOverrideUpdateResponseMessageJSON `json:"-"` +} + +// zoneFirewallWafOverrideUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneFirewallWafOverrideUpdateResponseMessage] +type zoneFirewallWafOverrideUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideUpdateResponseResult struct { + // The unique identifier of the WAF override. + ID string `json:"id"` + // An informative summary of the current URI-based WAF override. + Description string `json:"description,nullable"` + // An object that allows you to enable or disable WAF rule groups for the current + // WAF override. Each key of this object must be the ID of a WAF rule group, and + // each value must be a valid WAF action (usually `default` or `disable`). When + // creating a new URI-based WAF override, you must provide a `groups` object or a + // `rules` object. + Groups interface{} `json:"groups"` + // When true, indicates that the WAF package is currently paused. + Paused bool `json:"paused"` + // The relative priority of the current URI-based WAF override when multiple + // overrides match a single URL. A lower number indicates higher priority. Higher + // priority overrides may overwrite values set by lower priority overrides. + Priority float64 `json:"priority"` + // Specifies that, when a WAF rule matches, its configured action will be replaced + // by the action configured in this object. + RewriteAction ZoneFirewallWafOverrideUpdateResponseResultRewriteAction `json:"rewrite_action"` + // An object that allows you to override the action of specific WAF rules. Each key + // of this object must be the ID of a WAF rule, and each value must be a valid WAF + // action. Unless you are disabling a rule, ensure that you also enable the rule + // group that this WAF rule belongs to. When creating a new URI-based WAF override, + // you must provide a `groups` object or a `rules` object. + Rules interface{} `json:"rules"` + // The URLs to include in the current WAF override. You can use wildcards. Each + // entered URL will be escaped before use, which means you can only use simple + // wildcard patterns. + URLs []string `json:"urls"` + JSON zoneFirewallWafOverrideUpdateResponseResultJSON `json:"-"` +} + +// zoneFirewallWafOverrideUpdateResponseResultJSON contains the JSON metadata for +// the struct [ZoneFirewallWafOverrideUpdateResponseResult] +type zoneFirewallWafOverrideUpdateResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Groups apijson.Field + Paused apijson.Field + Priority apijson.Field + RewriteAction apijson.Field + Rules apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies that, when a WAF rule matches, its configured action will be replaced +// by the action configured in this object. +type ZoneFirewallWafOverrideUpdateResponseResultRewriteAction struct { + // The WAF rule action to apply. + Block ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlock `json:"block"` + Challenge interface{} `json:"challenge"` + Default interface{} `json:"default"` + // The WAF rule action to apply. + Disable ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisable `json:"disable"` + Simulate interface{} `json:"simulate"` + JSON zoneFirewallWafOverrideUpdateResponseResultRewriteActionJSON `json:"-"` +} + +// zoneFirewallWafOverrideUpdateResponseResultRewriteActionJSON contains the JSON +// metadata for the struct +// [ZoneFirewallWafOverrideUpdateResponseResultRewriteAction] +type zoneFirewallWafOverrideUpdateResponseResultRewriteActionJSON struct { + Block apijson.Field + Challenge apijson.Field + Default apijson.Field + Disable apijson.Field + Simulate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideUpdateResponseResultRewriteAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlock string + +const ( + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlockChallenge ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlock = "challenge" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlockBlock ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlock = "block" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlockSimulate ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlock = "simulate" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlockDisable ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlock = "disable" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlockDefault ZoneFirewallWafOverrideUpdateResponseResultRewriteActionBlock = "default" +) + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisable string + +const ( + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisableChallenge ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisable = "challenge" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisableBlock ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisable = "block" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisableSimulate ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisable = "simulate" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisableDisable ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisable = "disable" + ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisableDefault ZoneFirewallWafOverrideUpdateResponseResultRewriteActionDisable = "default" +) + +// Whether the API call was successful +type ZoneFirewallWafOverrideUpdateResponseSuccess bool + +const ( + ZoneFirewallWafOverrideUpdateResponseSuccessTrue ZoneFirewallWafOverrideUpdateResponseSuccess = true +) + +type ZoneFirewallWafOverrideDeleteResponse struct { + Result ZoneFirewallWafOverrideDeleteResponseResult `json:"result"` + JSON zoneFirewallWafOverrideDeleteResponseJSON `json:"-"` +} + +// zoneFirewallWafOverrideDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallWafOverrideDeleteResponse] +type zoneFirewallWafOverrideDeleteResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideDeleteResponseResult struct { + // The unique identifier of the WAF override. + ID string `json:"id"` + JSON zoneFirewallWafOverrideDeleteResponseResultJSON `json:"-"` +} + +// zoneFirewallWafOverrideDeleteResponseResultJSON contains the JSON metadata for +// the struct [ZoneFirewallWafOverrideDeleteResponseResult] +type zoneFirewallWafOverrideDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponse struct { + Errors []ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseError `json:"errors"` + Messages []ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseMessage `json:"messages"` + Result ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseSuccess `json:"success"` + JSON zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseJSON `json:"-"` +} + +// zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseJSON contains the JSON +// metadata for the struct +// [ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponse] +type zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseErrorJSON `json:"-"` +} + +// zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseError] +type zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseMessageJSON `json:"-"` +} + +// zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseMessage] +type zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResult struct { + // The unique identifier of the WAF override. + ID string `json:"id"` + // An informative summary of the current URI-based WAF override. + Description string `json:"description,nullable"` + // An object that allows you to enable or disable WAF rule groups for the current + // WAF override. Each key of this object must be the ID of a WAF rule group, and + // each value must be a valid WAF action (usually `default` or `disable`). When + // creating a new URI-based WAF override, you must provide a `groups` object or a + // `rules` object. + Groups interface{} `json:"groups"` + // When true, indicates that the WAF package is currently paused. + Paused bool `json:"paused"` + // The relative priority of the current URI-based WAF override when multiple + // overrides match a single URL. A lower number indicates higher priority. Higher + // priority overrides may overwrite values set by lower priority overrides. + Priority float64 `json:"priority"` + // Specifies that, when a WAF rule matches, its configured action will be replaced + // by the action configured in this object. + RewriteAction ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteAction `json:"rewrite_action"` + // An object that allows you to override the action of specific WAF rules. Each key + // of this object must be the ID of a WAF rule, and each value must be a valid WAF + // action. Unless you are disabling a rule, ensure that you also enable the rule + // group that this WAF rule belongs to. When creating a new URI-based WAF override, + // you must provide a `groups` object or a `rules` object. + Rules interface{} `json:"rules"` + // The URLs to include in the current WAF override. You can use wildcards. Each + // entered URL will be escaped before use, which means you can only use simple + // wildcard patterns. + URLs []string `json:"urls"` + JSON zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultJSON `json:"-"` +} + +// zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResult] +type zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Groups apijson.Field + Paused apijson.Field + Priority apijson.Field + RewriteAction apijson.Field + Rules apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies that, when a WAF rule matches, its configured action will be replaced +// by the action configured in this object. +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteAction struct { + // The WAF rule action to apply. + Block ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlock `json:"block"` + Challenge interface{} `json:"challenge"` + Default interface{} `json:"default"` + // The WAF rule action to apply. + Disable ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisable `json:"disable"` + Simulate interface{} `json:"simulate"` + JSON zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionJSON `json:"-"` +} + +// zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteAction] +type zoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionJSON struct { + Block apijson.Field + Challenge apijson.Field + Default apijson.Field + Disable apijson.Field + Simulate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlock string + +const ( + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlockChallenge ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlock = "challenge" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlockBlock ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlock = "block" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlockSimulate ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlock = "simulate" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlockDisable ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlock = "disable" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlockDefault ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionBlock = "default" +) + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisable string + +const ( + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisableChallenge ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisable = "challenge" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisableBlock ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisable = "block" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisableSimulate ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisable = "simulate" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisableDisable ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisable = "disable" + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisableDefault ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseResultRewriteActionDisable = "default" +) + +// Whether the API call was successful +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseSuccess bool + +const ( + ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseSuccessTrue ZoneFirewallWafOverrideWafOverridesNewAWafOverrideResponseSuccess = true +) + +type ZoneFirewallWafOverrideWafOverridesListWafOverridesResponse struct { + // The unique identifier of the WAF override. + ID string `json:"id"` + // An informative summary of the current URI-based WAF override. + Description string `json:"description,nullable"` + // An object that allows you to enable or disable WAF rule groups for the current + // WAF override. Each key of this object must be the ID of a WAF rule group, and + // each value must be a valid WAF action (usually `default` or `disable`). When + // creating a new URI-based WAF override, you must provide a `groups` object or a + // `rules` object. + Groups interface{} `json:"groups"` + // When true, indicates that the WAF package is currently paused. + Paused bool `json:"paused"` + // The relative priority of the current URI-based WAF override when multiple + // overrides match a single URL. A lower number indicates higher priority. Higher + // priority overrides may overwrite values set by lower priority overrides. + Priority float64 `json:"priority"` + // Specifies that, when a WAF rule matches, its configured action will be replaced + // by the action configured in this object. + RewriteAction ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteAction `json:"rewrite_action"` + // An object that allows you to override the action of specific WAF rules. Each key + // of this object must be the ID of a WAF rule, and each value must be a valid WAF + // action. Unless you are disabling a rule, ensure that you also enable the rule + // group that this WAF rule belongs to. When creating a new URI-based WAF override, + // you must provide a `groups` object or a `rules` object. + Rules interface{} `json:"rules"` + // The URLs to include in the current WAF override. You can use wildcards. Each + // entered URL will be escaped before use, which means you can only use simple + // wildcard patterns. + URLs []string `json:"urls"` + JSON zoneFirewallWafOverrideWafOverridesListWafOverridesResponseJSON `json:"-"` +} + +// zoneFirewallWafOverrideWafOverridesListWafOverridesResponseJSON contains the +// JSON metadata for the struct +// [ZoneFirewallWafOverrideWafOverridesListWafOverridesResponse] +type zoneFirewallWafOverrideWafOverridesListWafOverridesResponseJSON struct { + ID apijson.Field + Description apijson.Field + Groups apijson.Field + Paused apijson.Field + Priority apijson.Field + RewriteAction apijson.Field + Rules apijson.Field + URLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideWafOverridesListWafOverridesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Specifies that, when a WAF rule matches, its configured action will be replaced +// by the action configured in this object. +type ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteAction struct { + // The WAF rule action to apply. + Block ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlock `json:"block"` + Challenge interface{} `json:"challenge"` + Default interface{} `json:"default"` + // The WAF rule action to apply. + Disable ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisable `json:"disable"` + Simulate interface{} `json:"simulate"` + JSON zoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionJSON `json:"-"` +} + +// zoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteAction] +type zoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionJSON struct { + Block apijson.Field + Challenge apijson.Field + Default apijson.Field + Disable apijson.Field + Simulate apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlock string + +const ( + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlockChallenge ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlock = "challenge" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlockBlock ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlock = "block" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlockSimulate ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlock = "simulate" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlockDisable ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlock = "disable" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlockDefault ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionBlock = "default" +) + +// The WAF rule action to apply. +type ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisable string + +const ( + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisableChallenge ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisable = "challenge" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisableBlock ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisable = "block" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisableSimulate ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisable = "simulate" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisableDisable ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisable = "disable" + ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisableDefault ZoneFirewallWafOverrideWafOverridesListWafOverridesResponseRewriteActionDisable = "default" +) + +type ZoneFirewallWafOverrideUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallWafOverrideUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallWafOverrideWafOverridesNewAWafOverrideParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneFirewallWafOverrideWafOverridesNewAWafOverrideParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneFirewallWafOverrideWafOverridesListWafOverridesParams struct { + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The number of WAF overrides per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [ZoneFirewallWafOverrideWafOverridesListWafOverridesParams]'s query parameters +// as `url.Values`. +func (r ZoneFirewallWafOverrideWafOverridesListWafOverridesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zonefirewallwafoverride_test.go b/zonefirewallwafoverride_test.go new file mode 100644 index 00000000000..6efcee7e910 --- /dev/null +++ b/zonefirewallwafoverride_test.go @@ -0,0 +1,172 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallWafOverrideGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Overrides.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "de677e5818985db1285d0e80225f06e5", + ) + 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 TestZoneFirewallWafOverrideUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Overrides.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "de677e5818985db1285d0e80225f06e5", + cloudflare.ZoneFirewallWafOverrideUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallWafOverrideDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Overrides.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "de677e5818985db1285d0e80225f06e5", + ) + 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 TestZoneFirewallWafOverrideWafOverridesNewAWafOverride(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Overrides.WafOverridesNewAWafOverride( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallWafOverrideWafOverridesNewAWafOverrideParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneFirewallWafOverrideWafOverridesListWafOverridesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Overrides.WafOverridesListWafOverrides( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallWafOverrideWafOverridesListWafOverridesParams{ + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/zonefirewallwafpackage.go b/zonefirewallwafpackage.go new file mode 100644 index 00000000000..44fd4ec4c23 --- /dev/null +++ b/zonefirewallwafpackage.go @@ -0,0 +1,653 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneFirewallWafPackageService 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 [NewZoneFirewallWafPackageService] +// method instead. +type ZoneFirewallWafPackageService struct { + Options []option.RequestOption + Groups *ZoneFirewallWafPackageGroupService + Rules *ZoneFirewallWafPackageRuleService +} + +// NewZoneFirewallWafPackageService 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 NewZoneFirewallWafPackageService(opts ...option.RequestOption) (r *ZoneFirewallWafPackageService) { + r = &ZoneFirewallWafPackageService{} + r.Options = opts + r.Groups = NewZoneFirewallWafPackageGroupService(opts...) + r.Rules = NewZoneFirewallWafPackageRuleService(opts...) + return +} + +// Fetches the details of a WAF package. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneFirewallWafPackageGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a WAF package. You can update the sensitivity and the action of an +// anomaly detection WAF package. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneFirewallWafPackageUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallWafPackageUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Fetches WAF packages for a zone. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageService) WafPackagesListWafPackages(ctx context.Context, zoneIdentifier string, query ZoneFirewallWafPackageWafPackagesListWafPackagesParams, opts ...option.RequestOption) (res *ZoneFirewallWafPackageWafPackagesListWafPackagesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Union satisfied by [ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingle] +// or [ZoneFirewallWafPackageGetResponseObject]. +type ZoneFirewallWafPackageGetResponse interface { + implementsZoneFirewallWafPackageGetResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallWafPackageGetResponse)(nil)).Elem(), "") +} + +type ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingle struct { + Errors []ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleError `json:"errors"` + Messages []ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleMessage `json:"messages"` + Result ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleSuccess `json:"success"` + JSON zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleJSON `json:"-"` +} + +// zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleJSON contains the JSON +// metadata for the struct +// [ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingle] +type zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingle) implementsZoneFirewallWafPackageGetResponse() { +} + +type ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleErrorJSON `json:"-"` +} + +// zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleErrorJSON contains the +// JSON metadata for the struct +// [ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleError] +type zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleMessageJSON `json:"-"` +} + +// zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleMessageJSON contains +// the JSON metadata for the struct +// [ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleMessage] +type zoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleResultUnknown] or +// [shared.UnionString]. +type ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleResult interface { + ImplementsZoneFirewallWafPackageGetResponseDZw70ubTapiResponseSingleResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleSuccess bool + +const ( + ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleSuccessTrue ZoneFirewallWafPackageGetResponseDZw70ubTAPIResponseSingleSuccess = true +) + +type ZoneFirewallWafPackageGetResponseObject struct { + Result interface{} `json:"result"` + JSON zoneFirewallWafPackageGetResponseObjectJSON `json:"-"` +} + +// zoneFirewallWafPackageGetResponseObjectJSON contains the JSON metadata for the +// struct [ZoneFirewallWafPackageGetResponseObject] +type zoneFirewallWafPackageGetResponseObjectJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGetResponseObject) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageGetResponseObject) implementsZoneFirewallWafPackageGetResponse() {} + +type ZoneFirewallWafPackageUpdateResponse struct { + Result ZoneFirewallWafPackageUpdateResponseResult `json:"result"` + JSON zoneFirewallWafPackageUpdateResponseJSON `json:"-"` +} + +// zoneFirewallWafPackageUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallWafPackageUpdateResponse] +type zoneFirewallWafPackageUpdateResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageUpdateResponseResult struct { + // The unique identifier of a WAF package. + ID string `json:"id,required"` + // The default action performed by the rules in the WAF package. + ActionMode ZoneFirewallWafPackageUpdateResponseResultActionMode `json:"action_mode,required"` + // A summary of the purpose/function of the WAF package. + Description string `json:"description,required"` + // When a WAF package uses anomaly detection, each rule is given a score when + // triggered. If the total score of all triggered rules exceeds the sensitivity + // defined on the WAF package, the action defined on the package will be taken. + DetectionMode string `json:"detection_mode,required"` + // The name of the WAF package. + Name string `json:"name,required"` + // The sensitivity of the WAF package. + Sensitivity ZoneFirewallWafPackageUpdateResponseResultSensitivity `json:"sensitivity,required"` + // Identifier + ZoneID string `json:"zone_id,required"` + // When set to `active`, indicates that the WAF package will be applied to the + // zone. + Status ZoneFirewallWafPackageUpdateResponseResultStatus `json:"status"` + JSON zoneFirewallWafPackageUpdateResponseResultJSON `json:"-"` +} + +// zoneFirewallWafPackageUpdateResponseResultJSON contains the JSON metadata for +// the struct [ZoneFirewallWafPackageUpdateResponseResult] +type zoneFirewallWafPackageUpdateResponseResultJSON struct { + ID apijson.Field + ActionMode apijson.Field + Description apijson.Field + DetectionMode apijson.Field + Name apijson.Field + Sensitivity apijson.Field + ZoneID apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The default action performed by the rules in the WAF package. +type ZoneFirewallWafPackageUpdateResponseResultActionMode string + +const ( + ZoneFirewallWafPackageUpdateResponseResultActionModeSimulate ZoneFirewallWafPackageUpdateResponseResultActionMode = "simulate" + ZoneFirewallWafPackageUpdateResponseResultActionModeBlock ZoneFirewallWafPackageUpdateResponseResultActionMode = "block" + ZoneFirewallWafPackageUpdateResponseResultActionModeChallenge ZoneFirewallWafPackageUpdateResponseResultActionMode = "challenge" +) + +// The sensitivity of the WAF package. +type ZoneFirewallWafPackageUpdateResponseResultSensitivity string + +const ( + ZoneFirewallWafPackageUpdateResponseResultSensitivityHigh ZoneFirewallWafPackageUpdateResponseResultSensitivity = "high" + ZoneFirewallWafPackageUpdateResponseResultSensitivityMedium ZoneFirewallWafPackageUpdateResponseResultSensitivity = "medium" + ZoneFirewallWafPackageUpdateResponseResultSensitivityLow ZoneFirewallWafPackageUpdateResponseResultSensitivity = "low" + ZoneFirewallWafPackageUpdateResponseResultSensitivityOff ZoneFirewallWafPackageUpdateResponseResultSensitivity = "off" +) + +// When set to `active`, indicates that the WAF package will be applied to the +// zone. +type ZoneFirewallWafPackageUpdateResponseResultStatus string + +const ( + ZoneFirewallWafPackageUpdateResponseResultStatusActive ZoneFirewallWafPackageUpdateResponseResultStatus = "active" +) + +// Union satisfied by +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollection] +// or [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObject]. +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponse interface { + implementsZoneFirewallWafPackageWafPackagesListWafPackagesResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallWafPackageWafPackagesListWafPackagesResponse)(nil)).Elem(), "") +} + +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollection struct { + Errors []ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionError `json:"errors"` + Messages []ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionMessage `json:"messages"` + Result []interface{} `json:"result,nullable"` + ResultInfo ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionSuccess `json:"success"` + JSON zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionJSON `json:"-"` +} + +// zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollection] +type zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollection) implementsZoneFirewallWafPackageWafPackagesListWafPackagesResponse() { +} + +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionErrorJSON `json:"-"` +} + +// zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionErrorJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionError] +type zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionMessageJSON `json:"-"` +} + +// zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionMessageJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionMessage] +type zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionResultInfoJSON `json:"-"` +} + +// zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionResultInfo] +type zoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTapiResponseCollectionResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionSuccess bool + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionSuccessTrue ZoneFirewallWafPackageWafPackagesListWafPackagesResponseDZw70ubTAPIResponseCollectionSuccess = true +) + +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObject struct { + Result []ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResult `json:"result"` + JSON zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectJSON `json:"-"` +} + +// zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectJSON contains the +// JSON metadata for the struct +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObject] +type zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObject) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObject) implementsZoneFirewallWafPackageWafPackagesListWafPackagesResponse() { +} + +// Union satisfied by +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinition] +// or +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackage]. +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResult interface { + implementsZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResult)(nil)).Elem(), "") +} + +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinition struct { + // The unique identifier of a WAF package. + ID string `json:"id,required"` + // A summary of the purpose/function of the WAF package. + Description string `json:"description,required"` + // The mode that defines how rules within the package are evaluated during the + // course of a request. When a package uses anomaly detection mode (`anomaly` + // value), each rule is given a score when triggered. If the total score of all + // triggered rules exceeds the sensitivity defined in the WAF package, the action + // configured in the package will be performed. Traditional detection mode + // (`traditional` value) will decide the action to take when it is triggered by the + // request. If multiple rules are triggered, the action providing the highest + // protection will be applied (for example, a 'block' action will win over a + // 'challenge' action). + DetectionMode ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionDetectionMode `json:"detection_mode,required"` + // The name of the WAF package. + Name string `json:"name,required"` + // Identifier + ZoneID string `json:"zone_id,required"` + // When set to `active`, indicates that the WAF package will be applied to the + // zone. + Status ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionStatus `json:"status"` + JSON zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionJSON `json:"-"` +} + +// zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinition] +type zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionJSON struct { + ID apijson.Field + Description apijson.Field + DetectionMode apijson.Field + Name apijson.Field + ZoneID apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinition) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinition) implementsZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResult() { +} + +// The mode that defines how rules within the package are evaluated during the +// course of a request. When a package uses anomaly detection mode (`anomaly` +// value), each rule is given a score when triggered. If the total score of all +// triggered rules exceeds the sensitivity defined in the WAF package, the action +// configured in the package will be performed. Traditional detection mode +// (`traditional` value) will decide the action to take when it is triggered by the +// request. If multiple rules are triggered, the action providing the highest +// protection will be applied (for example, a 'block' action will win over a +// 'challenge' action). +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionDetectionMode string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionDetectionModeAnomaly ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionDetectionMode = "anomaly" + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionDetectionModeTraditional ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionDetectionMode = "traditional" +) + +// When set to `active`, indicates that the WAF package will be applied to the +// zone. +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionStatus string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionStatusActive ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTPackageDefinitionStatus = "active" +) + +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackage struct { + // The unique identifier of a WAF package. + ID string `json:"id,required"` + // The default action performed by the rules in the WAF package. + ActionMode ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionMode `json:"action_mode,required"` + // A summary of the purpose/function of the WAF package. + Description string `json:"description,required"` + // When a WAF package uses anomaly detection, each rule is given a score when + // triggered. If the total score of all triggered rules exceeds the sensitivity + // defined on the WAF package, the action defined on the package will be taken. + DetectionMode string `json:"detection_mode,required"` + // The name of the WAF package. + Name string `json:"name,required"` + // The sensitivity of the WAF package. + Sensitivity ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivity `json:"sensitivity,required"` + // Identifier + ZoneID string `json:"zone_id,required"` + // When set to `active`, indicates that the WAF package will be applied to the + // zone. + Status ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageStatus `json:"status"` + JSON zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageJSON `json:"-"` +} + +// zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackage] +type zoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageJSON struct { + ID apijson.Field + ActionMode apijson.Field + Description apijson.Field + DetectionMode apijson.Field + Name apijson.Field + Sensitivity apijson.Field + ZoneID apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackage) implementsZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResult() { +} + +// The default action performed by the rules in the WAF package. +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionMode string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionModeSimulate ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionMode = "simulate" + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionModeBlock ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionMode = "block" + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionModeChallenge ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageActionMode = "challenge" +) + +// The sensitivity of the WAF package. +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivity string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivityHigh ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivity = "high" + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivityMedium ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivity = "medium" + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivityLow ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivity = "low" + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivityOff ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageSensitivity = "off" +) + +// When set to `active`, indicates that the WAF package will be applied to the +// zone. +type ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageStatus string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageStatusActive ZoneFirewallWafPackageWafPackagesListWafPackagesResponseObjectResultDZw70ubTAnomalyPackageStatus = "active" +) + +type ZoneFirewallWafPackageUpdateParams struct { + // The default action performed by the rules in the WAF package. + ActionMode param.Field[ZoneFirewallWafPackageUpdateParamsActionMode] `json:"action_mode"` + // The sensitivity of the WAF package. + Sensitivity param.Field[ZoneFirewallWafPackageUpdateParamsSensitivity] `json:"sensitivity"` +} + +func (r ZoneFirewallWafPackageUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The default action performed by the rules in the WAF package. +type ZoneFirewallWafPackageUpdateParamsActionMode string + +const ( + ZoneFirewallWafPackageUpdateParamsActionModeSimulate ZoneFirewallWafPackageUpdateParamsActionMode = "simulate" + ZoneFirewallWafPackageUpdateParamsActionModeBlock ZoneFirewallWafPackageUpdateParamsActionMode = "block" + ZoneFirewallWafPackageUpdateParamsActionModeChallenge ZoneFirewallWafPackageUpdateParamsActionMode = "challenge" +) + +// The sensitivity of the WAF package. +type ZoneFirewallWafPackageUpdateParamsSensitivity string + +const ( + ZoneFirewallWafPackageUpdateParamsSensitivityHigh ZoneFirewallWafPackageUpdateParamsSensitivity = "high" + ZoneFirewallWafPackageUpdateParamsSensitivityMedium ZoneFirewallWafPackageUpdateParamsSensitivity = "medium" + ZoneFirewallWafPackageUpdateParamsSensitivityLow ZoneFirewallWafPackageUpdateParamsSensitivity = "low" + ZoneFirewallWafPackageUpdateParamsSensitivityOff ZoneFirewallWafPackageUpdateParamsSensitivity = "off" +) + +type ZoneFirewallWafPackageWafPackagesListWafPackagesParams struct { + // The direction used to sort returned packages. + Direction param.Field[ZoneFirewallWafPackageWafPackagesListWafPackagesParamsDirection] `query:"direction"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[ZoneFirewallWafPackageWafPackagesListWafPackagesParamsMatch] `query:"match"` + // The field used to sort returned packages. + Order param.Field[ZoneFirewallWafPackageWafPackagesListWafPackagesParamsOrder] `query:"order"` + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The number of packages per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [ZoneFirewallWafPackageWafPackagesListWafPackagesParams]'s +// query parameters as `url.Values`. +func (r ZoneFirewallWafPackageWafPackagesListWafPackagesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned packages. +type ZoneFirewallWafPackageWafPackagesListWafPackagesParamsDirection string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesParamsDirectionAsc ZoneFirewallWafPackageWafPackagesListWafPackagesParamsDirection = "asc" + ZoneFirewallWafPackageWafPackagesListWafPackagesParamsDirectionDesc ZoneFirewallWafPackageWafPackagesListWafPackagesParamsDirection = "desc" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type ZoneFirewallWafPackageWafPackagesListWafPackagesParamsMatch string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesParamsMatchAny ZoneFirewallWafPackageWafPackagesListWafPackagesParamsMatch = "any" + ZoneFirewallWafPackageWafPackagesListWafPackagesParamsMatchAll ZoneFirewallWafPackageWafPackagesListWafPackagesParamsMatch = "all" +) + +// The field used to sort returned packages. +type ZoneFirewallWafPackageWafPackagesListWafPackagesParamsOrder string + +const ( + ZoneFirewallWafPackageWafPackagesListWafPackagesParamsOrderName ZoneFirewallWafPackageWafPackagesListWafPackagesParamsOrder = "name" +) diff --git a/zonefirewallwafpackage_test.go b/zonefirewallwafpackage_test.go new file mode 100644 index 00000000000..2bc726280f4 --- /dev/null +++ b/zonefirewallwafpackage_test.go @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallWafPackageGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + ) + 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 TestZoneFirewallWafPackageUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + cloudflare.ZoneFirewallWafPackageUpdateParams{ + ActionMode: cloudflare.F(cloudflare.ZoneFirewallWafPackageUpdateParamsActionModeSimulate), + Sensitivity: cloudflare.F(cloudflare.ZoneFirewallWafPackageUpdateParamsSensitivityHigh), + }, + ) + 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 TestZoneFirewallWafPackageWafPackagesListWafPackagesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.WafPackagesListWafPackages( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneFirewallWafPackageWafPackagesListWafPackagesParams{ + Direction: cloudflare.F(cloudflare.ZoneFirewallWafPackageWafPackagesListWafPackagesParamsDirectionDesc), + Match: cloudflare.F(cloudflare.ZoneFirewallWafPackageWafPackagesListWafPackagesParamsMatchAny), + Order: cloudflare.F(cloudflare.ZoneFirewallWafPackageWafPackagesListWafPackagesParamsOrderName), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/zonefirewallwafpackagegroup.go b/zonefirewallwafpackagegroup.go new file mode 100644 index 00000000000..a51230bba66 --- /dev/null +++ b/zonefirewallwafpackagegroup.go @@ -0,0 +1,357 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallWafPackageGroupService 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 +// [NewZoneFirewallWafPackageGroupService] method instead. +type ZoneFirewallWafPackageGroupService struct { + Options []option.RequestOption +} + +// NewZoneFirewallWafPackageGroupService 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 NewZoneFirewallWafPackageGroupService(opts ...option.RequestOption) (r *ZoneFirewallWafPackageGroupService) { + r = &ZoneFirewallWafPackageGroupService{} + r.Options = opts + return +} + +// Fetches the details of a WAF rule group. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageGroupService) Get(ctx context.Context, zoneIdentifier string, packageIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneFirewallWafPackageGroupGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/groups/%s", zoneIdentifier, packageIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a WAF rule group. You can update the state (`mode` parameter) of a rule +// group. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageGroupService) Update(ctx context.Context, zoneIdentifier string, packageIdentifier string, identifier string, body ZoneFirewallWafPackageGroupUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallWafPackageGroupUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/groups/%s", zoneIdentifier, packageIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Fetches the WAF rule groups in a WAF package. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageGroupService) WafRuleGroupsListWafRuleGroups(ctx context.Context, zoneIdentifier string, packageIdentifier string, query ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParams, opts ...option.RequestOption) (res *shared.Page[ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/groups", zoneIdentifier, packageIdentifier) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneFirewallWafPackageGroupGetResponse struct { + Errors []ZoneFirewallWafPackageGroupGetResponseError `json:"errors"` + Messages []ZoneFirewallWafPackageGroupGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneFirewallWafPackageGroupGetResponseSuccess `json:"success"` + JSON zoneFirewallWafPackageGroupGetResponseJSON `json:"-"` +} + +// zoneFirewallWafPackageGroupGetResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallWafPackageGroupGetResponse] +type zoneFirewallWafPackageGroupGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGroupGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageGroupGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageGroupGetResponseErrorJSON `json:"-"` +} + +// zoneFirewallWafPackageGroupGetResponseErrorJSON contains the JSON metadata for +// the struct [ZoneFirewallWafPackageGroupGetResponseError] +type zoneFirewallWafPackageGroupGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGroupGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageGroupGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageGroupGetResponseMessageJSON `json:"-"` +} + +// zoneFirewallWafPackageGroupGetResponseMessageJSON contains the JSON metadata for +// the struct [ZoneFirewallWafPackageGroupGetResponseMessage] +type zoneFirewallWafPackageGroupGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGroupGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallWafPackageGroupGetResponseSuccess bool + +const ( + ZoneFirewallWafPackageGroupGetResponseSuccessTrue ZoneFirewallWafPackageGroupGetResponseSuccess = true +) + +type ZoneFirewallWafPackageGroupUpdateResponse struct { + Errors []ZoneFirewallWafPackageGroupUpdateResponseError `json:"errors"` + Messages []ZoneFirewallWafPackageGroupUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneFirewallWafPackageGroupUpdateResponseSuccess `json:"success"` + JSON zoneFirewallWafPackageGroupUpdateResponseJSON `json:"-"` +} + +// zoneFirewallWafPackageGroupUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallWafPackageGroupUpdateResponse] +type zoneFirewallWafPackageGroupUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGroupUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageGroupUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageGroupUpdateResponseErrorJSON `json:"-"` +} + +// zoneFirewallWafPackageGroupUpdateResponseErrorJSON contains the JSON metadata +// for the struct [ZoneFirewallWafPackageGroupUpdateResponseError] +type zoneFirewallWafPackageGroupUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGroupUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageGroupUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageGroupUpdateResponseMessageJSON `json:"-"` +} + +// zoneFirewallWafPackageGroupUpdateResponseMessageJSON contains the JSON metadata +// for the struct [ZoneFirewallWafPackageGroupUpdateResponseMessage] +type zoneFirewallWafPackageGroupUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGroupUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallWafPackageGroupUpdateResponseSuccess bool + +const ( + ZoneFirewallWafPackageGroupUpdateResponseSuccessTrue ZoneFirewallWafPackageGroupUpdateResponseSuccess = true +) + +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponse struct { + // The unique identifier of the rule group. + ID string `json:"id,required"` + // An informative summary of what the rule group does. + Description string `json:"description,required,nullable"` + // The state of the rules contained in the rule group. When `on`, the rules in the + // group are configurable/usable. + Mode ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseMode `json:"mode,required"` + // The name of the rule group. + Name string `json:"name,required"` + // The number of rules in the current rule group. + RulesCount float64 `json:"rules_count,required"` + // The available states for the rule group. + AllowedModes []ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseAllowedMode `json:"allowed_modes"` + // The number of rules within the group that have been modified from their default + // configuration. + ModifiedRulesCount float64 `json:"modified_rules_count"` + // The unique identifier of a WAF package. + PackageID string `json:"package_id"` + JSON zoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseJSON `json:"-"` +} + +// zoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseJSON contains +// the JSON metadata for the struct +// [ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponse] +type zoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseJSON struct { + ID apijson.Field + Description apijson.Field + Mode apijson.Field + Name apijson.Field + RulesCount apijson.Field + AllowedModes apijson.Field + ModifiedRulesCount apijson.Field + PackageID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The state of the rules contained in the rule group. When `on`, the rules in the +// group are configurable/usable. +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseMode string + +const ( + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseModeOn ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseMode = "on" + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseModeOff ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseMode = "off" +) + +// The state of the rules contained in the rule group. When `on`, the rules in the +// group are configurable/usable. +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseAllowedMode string + +const ( + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseAllowedModeOn ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseAllowedMode = "on" + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseAllowedModeOff ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsResponseAllowedMode = "off" +) + +type ZoneFirewallWafPackageGroupUpdateParams struct { + // The state of the rules contained in the rule group. When `on`, the rules in the + // group are configurable/usable. + Mode param.Field[ZoneFirewallWafPackageGroupUpdateParamsMode] `json:"mode"` +} + +func (r ZoneFirewallWafPackageGroupUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The state of the rules contained in the rule group. When `on`, the rules in the +// group are configurable/usable. +type ZoneFirewallWafPackageGroupUpdateParamsMode string + +const ( + ZoneFirewallWafPackageGroupUpdateParamsModeOn ZoneFirewallWafPackageGroupUpdateParamsMode = "on" + ZoneFirewallWafPackageGroupUpdateParamsModeOff ZoneFirewallWafPackageGroupUpdateParamsMode = "off" +) + +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParams struct { + // The direction used to sort returned rule groups. + Direction param.Field[ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsDirection] `query:"direction"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMatch] `query:"match"` + // The state of the rules contained in the rule group. When `on`, the rules in the + // group are configurable/usable. + Mode param.Field[ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMode] `query:"mode"` + // The field used to sort returned rule groups. + Order param.Field[ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsOrder] `query:"order"` + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The number of rule groups per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes +// [ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParams]'s query +// parameters as `url.Values`. +func (r ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned rule groups. +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsDirection string + +const ( + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsDirectionAsc ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsDirection = "asc" + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsDirectionDesc ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsDirection = "desc" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMatch string + +const ( + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMatchAny ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMatch = "any" + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMatchAll ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMatch = "all" +) + +// The state of the rules contained in the rule group. When `on`, the rules in the +// group are configurable/usable. +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMode string + +const ( + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsModeOn ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMode = "on" + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsModeOff ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMode = "off" +) + +// The field used to sort returned rule groups. +type ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsOrder string + +const ( + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsOrderMode ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsOrder = "mode" + ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsOrderRulesCount ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsOrder = "rules_count" +) diff --git a/zonefirewallwafpackagegroup_test.go b/zonefirewallwafpackagegroup_test.go new file mode 100644 index 00000000000..0d4dc61e926 --- /dev/null +++ b/zonefirewallwafpackagegroup_test.go @@ -0,0 +1,117 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallWafPackageGroupGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Groups.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + "a25a9a7e9c00afc1fb2e0245519d725b", + ) + 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 TestZoneFirewallWafPackageGroupUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Groups.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + "a25a9a7e9c00afc1fb2e0245519d725b", + cloudflare.ZoneFirewallWafPackageGroupUpdateParams{ + Mode: cloudflare.F(cloudflare.ZoneFirewallWafPackageGroupUpdateParamsModeOn), + }, + ) + 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 TestZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Groups.WafRuleGroupsListWafRuleGroups( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParams{ + Direction: cloudflare.F(cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsDirectionDesc), + Match: cloudflare.F(cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsMatchAny), + Mode: cloudflare.F(cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsModeOn), + Order: cloudflare.F(cloudflare.ZoneFirewallWafPackageGroupWafRuleGroupsListWafRuleGroupsParamsOrderMode), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/zonefirewallwafpackagerule.go b/zonefirewallwafpackagerule.go new file mode 100644 index 00000000000..4229a6af217 --- /dev/null +++ b/zonefirewallwafpackagerule.go @@ -0,0 +1,895 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneFirewallWafPackageRuleService 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 +// [NewZoneFirewallWafPackageRuleService] method instead. +type ZoneFirewallWafPackageRuleService struct { + Options []option.RequestOption +} + +// NewZoneFirewallWafPackageRuleService 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 NewZoneFirewallWafPackageRuleService(opts ...option.RequestOption) (r *ZoneFirewallWafPackageRuleService) { + r = &ZoneFirewallWafPackageRuleService{} + r.Options = opts + return +} + +// Fetches the details of a WAF rule in a WAF package. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageRuleService) Get(ctx context.Context, zoneID string, packageID string, identifier string, opts ...option.RequestOption) (res *ZoneFirewallWafPackageRuleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/rules/%s", zoneID, packageID, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a WAF rule. You can only update the mode/action of the rule. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageRuleService) Update(ctx context.Context, zoneID string, packageID string, identifier string, body ZoneFirewallWafPackageRuleUpdateParams, opts ...option.RequestOption) (res *ZoneFirewallWafPackageRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/rules/%s", zoneID, packageID, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Fetches WAF rules in a WAF package. +// +// **Note:** Applies only to the +// [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). +func (r *ZoneFirewallWafPackageRuleService) WafRulesListWafRules(ctx context.Context, zoneID string, packageID string, query ZoneFirewallWafPackageRuleWafRulesListWafRulesParams, opts ...option.RequestOption) (res *shared.Page[ZoneFirewallWafPackageRuleWafRulesListWafRulesResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/rules", zoneID, packageID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +type ZoneFirewallWafPackageRuleGetResponse struct { + Errors []ZoneFirewallWafPackageRuleGetResponseError `json:"errors"` + Messages []ZoneFirewallWafPackageRuleGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneFirewallWafPackageRuleGetResponseSuccess `json:"success"` + JSON zoneFirewallWafPackageRuleGetResponseJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleGetResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallWafPackageRuleGetResponse] +type zoneFirewallWafPackageRuleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageRuleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageRuleGetResponseErrorJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleGetResponseErrorJSON contains the JSON metadata for +// the struct [ZoneFirewallWafPackageRuleGetResponseError] +type zoneFirewallWafPackageRuleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageRuleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageRuleGetResponseMessageJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleGetResponseMessageJSON contains the JSON metadata for +// the struct [ZoneFirewallWafPackageRuleGetResponseMessage] +type zoneFirewallWafPackageRuleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneFirewallWafPackageRuleGetResponseSuccess bool + +const ( + ZoneFirewallWafPackageRuleGetResponseSuccessTrue ZoneFirewallWafPackageRuleGetResponseSuccess = true +) + +type ZoneFirewallWafPackageRuleUpdateResponse struct { + Errors []ZoneFirewallWafPackageRuleUpdateResponseError `json:"errors"` + Messages []ZoneFirewallWafPackageRuleUpdateResponseMessage `json:"messages"` + // When triggered, anomaly detection WAF rules contribute to an overall threat + // score that will determine if a request is considered malicious. You can + // configure the total scoring threshold through the 'sensitivity' property of the + // WAF package. + Result ZoneFirewallWafPackageRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneFirewallWafPackageRuleUpdateResponseSuccess `json:"success"` + JSON zoneFirewallWafPackageRuleUpdateResponseJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneFirewallWafPackageRuleUpdateResponse] +type zoneFirewallWafPackageRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageRuleUpdateResponseErrorJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseErrorJSON contains the JSON metadata for +// the struct [ZoneFirewallWafPackageRuleUpdateResponseError] +type zoneFirewallWafPackageRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneFirewallWafPackageRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneFirewallWafPackageRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseMessageJSON contains the JSON metadata +// for the struct [ZoneFirewallWafPackageRuleUpdateResponseMessage] +type zoneFirewallWafPackageRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// When triggered, anomaly detection WAF rules contribute to an overall threat +// score that will determine if a request is considered malicious. You can +// configure the total scoring threshold through the 'sensitivity' property of the +// WAF package. +// +// Union satisfied by +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRule], +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRule] or +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRule]. +type ZoneFirewallWafPackageRuleUpdateResponseResult interface { + implementsZoneFirewallWafPackageRuleUpdateResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallWafPackageRuleUpdateResponseResult)(nil)).Elem(), "") +} + +// When triggered, anomaly detection WAF rules contribute to an overall threat +// score that will determine if a request is considered malicious. You can +// configure the total scoring threshold through the 'sensitivity' property of the +// WAF package. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRule struct { + // The unique identifier of the WAF rule. + ID string `json:"id,required"` + // Defines the available modes for the current WAF rule. Applies to anomaly + // detection WAF rules. + AllowedModes []ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleAllowedMode `json:"allowed_modes,required"` + // The public description of the WAF rule. + Description string `json:"description,required"` + // The rule group to which the current WAF rule belongs. + Group ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleGroup `json:"group,required"` + // When set to `on`, the current WAF rule will be used when evaluating the request. + // Applies to anomaly detection WAF rules. + Mode ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleMode `json:"mode,required"` + // The unique identifier of a WAF package. + PackageID string `json:"package_id,required"` + // The order in which the individual WAF rule is executed within its rule group. + Priority string `json:"priority,required"` + JSON zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsAnomalyRuleJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsAnomalyRuleJSON contains +// the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRule] +type zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsAnomalyRuleJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Description apijson.Field + Group apijson.Field + Mode apijson.Field + PackageID apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRule) implementsZoneFirewallWafPackageRuleUpdateResponseResult() { +} + +// When set to `on`, the current WAF rule will be used when evaluating the request. +// Applies to anomaly detection WAF rules. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleAllowedMode string + +const ( + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleAllowedModeOn ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleAllowedMode = "on" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleAllowedModeOff ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleAllowedMode = "off" +) + +// The rule group to which the current WAF rule belongs. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleGroup struct { + // The unique identifier of the rule group. + ID string `json:"id"` + // The name of the rule group. + Name string `json:"name"` + JSON zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsAnomalyRuleGroupJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsAnomalyRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleGroup] +type zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsAnomalyRuleGroupJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// When set to `on`, the current WAF rule will be used when evaluating the request. +// Applies to anomaly detection WAF rules. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleMode string + +const ( + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleModeOn ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleMode = "on" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleModeOff ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsAnomalyRuleMode = "off" +) + +// When triggered, traditional WAF rules cause the firewall to immediately act upon +// the request based on the configuration of the rule. A 'deny' rule will +// immediately respond to the request based on the configured rule action/mode (for +// example, 'block') and no other rules will be processed. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRule struct { + // The unique identifier of the WAF rule. + ID string `json:"id,required"` + // The list of possible actions of the WAF rule when it is triggered. + AllowedModes []ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedMode `json:"allowed_modes,required"` + // The default action/mode of a rule. + DefaultMode ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultMode `json:"default_mode,required"` + // The public description of the WAF rule. + Description string `json:"description,required"` + // The rule group to which the current WAF rule belongs. + Group ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleGroup `json:"group,required"` + // The action that the current WAF rule will perform when triggered. Applies to + // traditional (deny) WAF rules. + Mode ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleMode `json:"mode,required"` + // The unique identifier of a WAF package. + PackageID string `json:"package_id,required"` + // The order in which the individual WAF rule is executed within its rule group. + Priority string `json:"priority,required"` + JSON zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalDenyRuleJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalDenyRuleJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRule] +type zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalDenyRuleJSON struct { + ID apijson.Field + AllowedModes apijson.Field + DefaultMode apijson.Field + Description apijson.Field + Group apijson.Field + Mode apijson.Field + PackageID apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRule) implementsZoneFirewallWafPackageRuleUpdateResponseResult() { +} + +// The action that the current WAF rule will perform when triggered. Applies to +// traditional (deny) WAF rules. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedMode string + +const ( + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedModeDefault ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedMode = "default" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedModeDisable ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedMode = "disable" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedModeSimulate ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedMode = "simulate" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedModeBlock ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedMode = "block" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedModeChallenge ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleAllowedMode = "challenge" +) + +// The default action/mode of a rule. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultMode string + +const ( + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultModeDisable ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultMode = "disable" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultModeSimulate ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultMode = "simulate" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultModeBlock ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultMode = "block" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultModeChallenge ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleDefaultMode = "challenge" +) + +// The rule group to which the current WAF rule belongs. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleGroup struct { + // The unique identifier of the rule group. + ID string `json:"id"` + // The name of the rule group. + Name string `json:"name"` + JSON zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalDenyRuleGroupJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalDenyRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleGroup] +type zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalDenyRuleGroupJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action that the current WAF rule will perform when triggered. Applies to +// traditional (deny) WAF rules. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleMode string + +const ( + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleModeDefault ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleMode = "default" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleModeDisable ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleMode = "disable" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleModeSimulate ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleMode = "simulate" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleModeBlock ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleMode = "block" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleModeChallenge ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalDenyRuleMode = "challenge" +) + +// When triggered, traditional WAF rules cause the firewall to immediately act on +// the request based on the rule configuration. An 'allow' rule will immediately +// allow the request and no other rules will be processed. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRule struct { + // The unique identifier of the WAF rule. + ID string `json:"id,required"` + // Defines the available modes for the current WAF rule. + AllowedModes []ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` + // The public description of the WAF rule. + Description string `json:"description,required"` + // The rule group to which the current WAF rule belongs. + Group ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleGroup `json:"group,required"` + // When set to `on`, the current rule will be used when evaluating the request. + // Applies to traditional (allow) WAF rules. + Mode ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleMode `json:"mode,required"` + // The unique identifier of a WAF package. + PackageID string `json:"package_id,required"` + // The order in which the individual WAF rule is executed within its rule group. + Priority string `json:"priority,required"` + JSON zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalAllowRuleJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalAllowRuleJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRule] +type zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalAllowRuleJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Description apijson.Field + Group apijson.Field + Mode apijson.Field + PackageID apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRule) implementsZoneFirewallWafPackageRuleUpdateResponseResult() { +} + +// When set to `on`, the current rule will be used when evaluating the request. +// Applies to traditional (allow) WAF rules. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleAllowedMode string + +const ( + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleAllowedModeOn ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleAllowedMode = "on" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleAllowedModeOff ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleAllowedMode = "off" +) + +// The rule group to which the current WAF rule belongs. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleGroup struct { + // The unique identifier of the rule group. + ID string `json:"id"` + // The name of the rule group. + Name string `json:"name"` + JSON zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalAllowRuleGroupJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalAllowRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleGroup] +type zoneFirewallWafPackageRuleUpdateResponseResultEg9LSmLsTraditionalAllowRuleGroupJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// When set to `on`, the current rule will be used when evaluating the request. +// Applies to traditional (allow) WAF rules. +type ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleMode string + +const ( + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleModeOn ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleMode = "on" + ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleModeOff ZoneFirewallWafPackageRuleUpdateResponseResultEG9LSmLsTraditionalAllowRuleMode = "off" +) + +// Whether the API call was successful +type ZoneFirewallWafPackageRuleUpdateResponseSuccess bool + +const ( + ZoneFirewallWafPackageRuleUpdateResponseSuccessTrue ZoneFirewallWafPackageRuleUpdateResponseSuccess = true +) + +// When triggered, anomaly detection WAF rules contribute to an overall threat +// score that will determine if a request is considered malicious. You can +// configure the total scoring threshold through the 'sensitivity' property of the +// WAF package. +// +// Union satisfied by +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRule], +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRule] +// or +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRule]. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponse interface { + implementsZoneFirewallWafPackageRuleWafRulesListWafRulesResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneFirewallWafPackageRuleWafRulesListWafRulesResponse)(nil)).Elem(), "") +} + +// When triggered, anomaly detection WAF rules contribute to an overall threat +// score that will determine if a request is considered malicious. You can +// configure the total scoring threshold through the 'sensitivity' property of the +// WAF package. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRule struct { + // The unique identifier of the WAF rule. + ID string `json:"id,required"` + // Defines the available modes for the current WAF rule. Applies to anomaly + // detection WAF rules. + AllowedModes []ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleAllowedMode `json:"allowed_modes,required"` + // The public description of the WAF rule. + Description string `json:"description,required"` + // The rule group to which the current WAF rule belongs. + Group ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleGroup `json:"group,required"` + // When set to `on`, the current WAF rule will be used when evaluating the request. + // Applies to anomaly detection WAF rules. + Mode ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleMode `json:"mode,required"` + // The unique identifier of a WAF package. + PackageID string `json:"package_id,required"` + // The order in which the individual WAF rule is executed within its rule group. + Priority string `json:"priority,required"` + JSON zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsAnomalyRuleJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsAnomalyRuleJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRule] +type zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsAnomalyRuleJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Description apijson.Field + Group apijson.Field + Mode apijson.Field + PackageID apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRule) implementsZoneFirewallWafPackageRuleWafRulesListWafRulesResponse() { +} + +// When set to `on`, the current WAF rule will be used when evaluating the request. +// Applies to anomaly detection WAF rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleAllowedMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleAllowedModeOn ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleAllowedMode = "on" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleAllowedModeOff ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleAllowedMode = "off" +) + +// The rule group to which the current WAF rule belongs. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleGroup struct { + // The unique identifier of the rule group. + ID string `json:"id"` + // The name of the rule group. + Name string `json:"name"` + JSON zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsAnomalyRuleGroupJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsAnomalyRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleGroup] +type zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsAnomalyRuleGroupJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// When set to `on`, the current WAF rule will be used when evaluating the request. +// Applies to anomaly detection WAF rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleModeOn ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleMode = "on" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleModeOff ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsAnomalyRuleMode = "off" +) + +// When triggered, traditional WAF rules cause the firewall to immediately act upon +// the request based on the configuration of the rule. A 'deny' rule will +// immediately respond to the request based on the configured rule action/mode (for +// example, 'block') and no other rules will be processed. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRule struct { + // The unique identifier of the WAF rule. + ID string `json:"id,required"` + // The list of possible actions of the WAF rule when it is triggered. + AllowedModes []ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedMode `json:"allowed_modes,required"` + // The default action/mode of a rule. + DefaultMode ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultMode `json:"default_mode,required"` + // The public description of the WAF rule. + Description string `json:"description,required"` + // The rule group to which the current WAF rule belongs. + Group ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleGroup `json:"group,required"` + // The action that the current WAF rule will perform when triggered. Applies to + // traditional (deny) WAF rules. + Mode ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleMode `json:"mode,required"` + // The unique identifier of a WAF package. + PackageID string `json:"package_id,required"` + // The order in which the individual WAF rule is executed within its rule group. + Priority string `json:"priority,required"` + JSON zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalDenyRuleJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalDenyRuleJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRule] +type zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalDenyRuleJSON struct { + ID apijson.Field + AllowedModes apijson.Field + DefaultMode apijson.Field + Description apijson.Field + Group apijson.Field + Mode apijson.Field + PackageID apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRule) implementsZoneFirewallWafPackageRuleWafRulesListWafRulesResponse() { +} + +// The action that the current WAF rule will perform when triggered. Applies to +// traditional (deny) WAF rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedModeDefault ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedMode = "default" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedModeDisable ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedMode = "disable" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedModeSimulate ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedMode = "simulate" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedModeBlock ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedMode = "block" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedModeChallenge ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleAllowedMode = "challenge" +) + +// The default action/mode of a rule. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultModeDisable ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultMode = "disable" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultModeSimulate ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultMode = "simulate" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultModeBlock ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultMode = "block" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultModeChallenge ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleDefaultMode = "challenge" +) + +// The rule group to which the current WAF rule belongs. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleGroup struct { + // The unique identifier of the rule group. + ID string `json:"id"` + // The name of the rule group. + Name string `json:"name"` + JSON zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalDenyRuleGroupJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalDenyRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleGroup] +type zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalDenyRuleGroupJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action that the current WAF rule will perform when triggered. Applies to +// traditional (deny) WAF rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleModeDefault ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleMode = "default" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleModeDisable ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleMode = "disable" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleModeSimulate ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleMode = "simulate" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleModeBlock ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleMode = "block" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleModeChallenge ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalDenyRuleMode = "challenge" +) + +// When triggered, traditional WAF rules cause the firewall to immediately act on +// the request based on the rule configuration. An 'allow' rule will immediately +// allow the request and no other rules will be processed. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRule struct { + // The unique identifier of the WAF rule. + ID string `json:"id,required"` + // Defines the available modes for the current WAF rule. + AllowedModes []ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` + // The public description of the WAF rule. + Description string `json:"description,required"` + // The rule group to which the current WAF rule belongs. + Group ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleGroup `json:"group,required"` + // When set to `on`, the current rule will be used when evaluating the request. + // Applies to traditional (allow) WAF rules. + Mode ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleMode `json:"mode,required"` + // The unique identifier of a WAF package. + PackageID string `json:"package_id,required"` + // The order in which the individual WAF rule is executed within its rule group. + Priority string `json:"priority,required"` + JSON zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalAllowRuleJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalAllowRuleJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRule] +type zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalAllowRuleJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Description apijson.Field + Group apijson.Field + Mode apijson.Field + PackageID apijson.Field + Priority apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRule) implementsZoneFirewallWafPackageRuleWafRulesListWafRulesResponse() { +} + +// When set to `on`, the current rule will be used when evaluating the request. +// Applies to traditional (allow) WAF rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleAllowedMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleAllowedModeOn ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleAllowedMode = "on" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleAllowedModeOff ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleAllowedMode = "off" +) + +// The rule group to which the current WAF rule belongs. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleGroup struct { + // The unique identifier of the rule group. + ID string `json:"id"` + // The name of the rule group. + Name string `json:"name"` + JSON zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalAllowRuleGroupJSON `json:"-"` +} + +// zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalAllowRuleGroupJSON +// contains the JSON metadata for the struct +// [ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleGroup] +type zoneFirewallWafPackageRuleWafRulesListWafRulesResponseEg9LSmLsTraditionalAllowRuleGroupJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleGroup) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// When set to `on`, the current rule will be used when evaluating the request. +// Applies to traditional (allow) WAF rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleModeOn ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleMode = "on" + ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleModeOff ZoneFirewallWafPackageRuleWafRulesListWafRulesResponseEG9LSmLsTraditionalAllowRuleMode = "off" +) + +type ZoneFirewallWafPackageRuleUpdateParams struct { + // The mode/action of the rule when triggered. You must use a value from the + // `allowed_modes` array of the current rule. + Mode param.Field[ZoneFirewallWafPackageRuleUpdateParamsMode] `json:"mode"` +} + +func (r ZoneFirewallWafPackageRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The mode/action of the rule when triggered. You must use a value from the +// `allowed_modes` array of the current rule. +type ZoneFirewallWafPackageRuleUpdateParamsMode string + +const ( + ZoneFirewallWafPackageRuleUpdateParamsModeDefault ZoneFirewallWafPackageRuleUpdateParamsMode = "default" + ZoneFirewallWafPackageRuleUpdateParamsModeDisable ZoneFirewallWafPackageRuleUpdateParamsMode = "disable" + ZoneFirewallWafPackageRuleUpdateParamsModeSimulate ZoneFirewallWafPackageRuleUpdateParamsMode = "simulate" + ZoneFirewallWafPackageRuleUpdateParamsModeBlock ZoneFirewallWafPackageRuleUpdateParamsMode = "block" + ZoneFirewallWafPackageRuleUpdateParamsModeChallenge ZoneFirewallWafPackageRuleUpdateParamsMode = "challenge" + ZoneFirewallWafPackageRuleUpdateParamsModeOn ZoneFirewallWafPackageRuleUpdateParamsMode = "on" + ZoneFirewallWafPackageRuleUpdateParamsModeOff ZoneFirewallWafPackageRuleUpdateParamsMode = "off" +) + +type ZoneFirewallWafPackageRuleWafRulesListWafRulesParams struct { + // The direction used to sort returned rules. + Direction param.Field[ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsDirection] `query:"direction"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMatch] `query:"match"` + // The action/mode a rule has been overridden to perform. + Mode param.Field[ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMode] `query:"mode"` + // The field used to sort returned rules. + Order param.Field[ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrder] `query:"order"` + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The number of rules per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [ZoneFirewallWafPackageRuleWafRulesListWafRulesParams]'s +// query parameters as `url.Values`. +func (r ZoneFirewallWafPackageRuleWafRulesListWafRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsDirection string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsDirectionAsc ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsDirection = "asc" + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsDirectionDesc ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsDirection = "desc" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMatch string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMatchAny ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMatch = "any" + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMatchAll ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMatch = "all" +) + +// The action/mode a rule has been overridden to perform. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMode string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsModeDis ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMode = "DIS" + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsModeChl ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMode = "CHL" + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsModeBlk ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMode = "BLK" + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsModeSim ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMode = "SIM" +) + +// The field used to sort returned rules. +type ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrder string + +const ( + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrderPriority ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrder = "priority" + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrderGroupID ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrder = "group_id" + ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrderDescription ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrder = "description" +) diff --git a/zonefirewallwafpackagerule_test.go b/zonefirewallwafpackagerule_test.go new file mode 100644 index 00000000000..c0b5c3666e5 --- /dev/null +++ b/zonefirewallwafpackagerule_test.go @@ -0,0 +1,117 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneFirewallWafPackageRuleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Rules.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + "a25a9a7e9c00afc1fb2e0245519d725b", + ) + 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 TestZoneFirewallWafPackageRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Rules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + "a25a9a7e9c00afc1fb2e0245519d725b", + cloudflare.ZoneFirewallWafPackageRuleUpdateParams{ + Mode: cloudflare.F(cloudflare.ZoneFirewallWafPackageRuleUpdateParamsModeOn), + }, + ) + 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 TestZoneFirewallWafPackageRuleWafRulesListWafRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Firewalls.Wafs.Packages.Rules.WafRulesListWafRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a25a9a7e9c00afc1fb2e0245519d725b", + cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesParams{ + Direction: cloudflare.F(cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsDirectionDesc), + Match: cloudflare.F(cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsMatchAny), + Mode: cloudflare.F(cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsModeChl), + Order: cloudflare.F(cloudflare.ZoneFirewallWafPackageRuleWafRulesListWafRulesParamsOrderPriority), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), + }, + ) + 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/zonehealthcheck.go b/zonehealthcheck.go new file mode 100644 index 00000000000..67652cfe386 --- /dev/null +++ b/zonehealthcheck.go @@ -0,0 +1,955 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneHealthcheckService 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 [NewZoneHealthcheckService] method +// instead. +type ZoneHealthcheckService struct { + Options []option.RequestOption + Previews *ZoneHealthcheckPreviewService +} + +// NewZoneHealthcheckService 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 NewZoneHealthcheckService(opts ...option.RequestOption) (r *ZoneHealthcheckService) { + r = &ZoneHealthcheckService{} + r.Options = opts + r.Previews = NewZoneHealthcheckPreviewService(opts...) + return +} + +// Fetch a single configured health check. +func (r *ZoneHealthcheckService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *HealthchecksSingleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a configured health check. +func (r *ZoneHealthcheckService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneHealthcheckUpdateParams, opts ...option.RequestOption) (res *HealthchecksSingleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete a health check. +func (r *ZoneHealthcheckService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneHealthcheckDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new health check. +func (r *ZoneHealthcheckService) HealthChecksNewHealthCheck(ctx context.Context, zoneIdentifier string, body ZoneHealthcheckHealthChecksNewHealthCheckParams, opts ...option.RequestOption) (res *HealthchecksSingleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List configured health checks. +func (r *ZoneHealthcheckService) HealthChecksListHealthChecks(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneHealthcheckHealthChecksListHealthChecksResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type HealthchecksSingleResponse struct { + Errors []HealthchecksSingleResponseError `json:"errors"` + Messages []HealthchecksSingleResponseMessage `json:"messages"` + Result HealthchecksSingleResponseResult `json:"result"` + // Whether the API call was successful + Success HealthchecksSingleResponseSuccess `json:"success"` + JSON healthchecksSingleResponseJSON `json:"-"` +} + +// healthchecksSingleResponseJSON contains the JSON metadata for the struct +// [HealthchecksSingleResponse] +type healthchecksSingleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HealthchecksSingleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HealthchecksSingleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON healthchecksSingleResponseErrorJSON `json:"-"` +} + +// healthchecksSingleResponseErrorJSON contains the JSON metadata for the struct +// [HealthchecksSingleResponseError] +type healthchecksSingleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HealthchecksSingleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HealthchecksSingleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON healthchecksSingleResponseMessageJSON `json:"-"` +} + +// healthchecksSingleResponseMessageJSON contains the JSON metadata for the struct +// [HealthchecksSingleResponseMessage] +type healthchecksSingleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HealthchecksSingleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type HealthchecksSingleResponseResult struct { + // Identifier + ID string `json:"id"` + // The hostname or IP address of the origin server to run health checks on. + Address string `json:"address"` + // A list of regions from which to run health checks. Null means Cloudflare will + // pick a default region. + CheckRegions []HealthchecksSingleResponseResultCheckRegion `json:"check_regions,nullable"` + // The number of consecutive fails required from a health check before changing the + // health to unhealthy. + ConsecutiveFails int64 `json:"consecutive_fails"` + // The number of consecutive successes required from a health check before changing + // the health to healthy. + ConsecutiveSuccesses int64 `json:"consecutive_successes"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // A human-readable description of the health check. + Description string `json:"description"` + // The current failure reason if status is unhealthy. + FailureReason string `json:"failure_reason"` + // Parameters specific to an HTTP or HTTPS health check. + HTTPConfig HealthchecksSingleResponseResultHTTPConfig `json:"http_config,nullable"` + // The interval between each health check. Shorter intervals may give quicker + // notifications if the origin status changes, but will increase load on the origin + // as we check from multiple locations. + Interval int64 `json:"interval"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A short name to identify the health check. Only alphanumeric characters, hyphens + // and underscores are allowed. + Name string `json:"name"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries int64 `json:"retries"` + // The current status of the origin server according to the health check. + Status HealthchecksSingleResponseResultStatus `json:"status"` + // If suspended, no health checks are sent to the origin. + Suspended bool `json:"suspended"` + // Parameters specific to TCP health check. + TcpConfig HealthchecksSingleResponseResultTcpConfig `json:"tcp_config,nullable"` + // The timeout (in seconds) before marking the health check as failed. + Timeout int64 `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP', 'HTTPS' and 'TCP'. + Type string `json:"type"` + JSON healthchecksSingleResponseResultJSON `json:"-"` +} + +// healthchecksSingleResponseResultJSON contains the JSON metadata for the struct +// [HealthchecksSingleResponseResult] +type healthchecksSingleResponseResultJSON struct { + ID apijson.Field + Address apijson.Field + CheckRegions apijson.Field + ConsecutiveFails apijson.Field + ConsecutiveSuccesses apijson.Field + CreatedOn apijson.Field + Description apijson.Field + FailureReason apijson.Field + HTTPConfig apijson.Field + Interval apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Retries apijson.Field + Status apijson.Field + Suspended apijson.Field + TcpConfig apijson.Field + Timeout apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HealthchecksSingleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, IN: India, +// SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (BUSINESS +// and ENTERPRISE customers only). +type HealthchecksSingleResponseResultCheckRegion string + +const ( + HealthchecksSingleResponseResultCheckRegionWnam HealthchecksSingleResponseResultCheckRegion = "WNAM" + HealthchecksSingleResponseResultCheckRegionEnam HealthchecksSingleResponseResultCheckRegion = "ENAM" + HealthchecksSingleResponseResultCheckRegionWeu HealthchecksSingleResponseResultCheckRegion = "WEU" + HealthchecksSingleResponseResultCheckRegionEeu HealthchecksSingleResponseResultCheckRegion = "EEU" + HealthchecksSingleResponseResultCheckRegionNsam HealthchecksSingleResponseResultCheckRegion = "NSAM" + HealthchecksSingleResponseResultCheckRegionSsam HealthchecksSingleResponseResultCheckRegion = "SSAM" + HealthchecksSingleResponseResultCheckRegionOc HealthchecksSingleResponseResultCheckRegion = "OC" + HealthchecksSingleResponseResultCheckRegionMe HealthchecksSingleResponseResultCheckRegion = "ME" + HealthchecksSingleResponseResultCheckRegionNaf HealthchecksSingleResponseResultCheckRegion = "NAF" + HealthchecksSingleResponseResultCheckRegionSaf HealthchecksSingleResponseResultCheckRegion = "SAF" + HealthchecksSingleResponseResultCheckRegionIn HealthchecksSingleResponseResultCheckRegion = "IN" + HealthchecksSingleResponseResultCheckRegionSeas HealthchecksSingleResponseResultCheckRegion = "SEAS" + HealthchecksSingleResponseResultCheckRegionNeas HealthchecksSingleResponseResultCheckRegion = "NEAS" + HealthchecksSingleResponseResultCheckRegionAllRegions HealthchecksSingleResponseResultCheckRegion = "ALL_REGIONS" +) + +// Parameters specific to an HTTP or HTTPS health check. +type HealthchecksSingleResponseResultHTTPConfig struct { + // Do not validate the certificate when the health check uses HTTPS. + AllowInsecure bool `json:"allow_insecure"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. + ExpectedBody string `json:"expected_body"` + // The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all + // codes starting with 2) of the health check. + ExpectedCodes []string `json:"expected_codes,nullable"` + // Follow redirects if the origin returns a 3xx status code. + FollowRedirects bool `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. + Header interface{} `json:"header,nullable"` + // The HTTP method to use for the health check. + Method HealthchecksSingleResponseResultHTTPConfigMethod `json:"method"` + // The endpoint path to health check against. + Path string `json:"path"` + // Port number to connect to for the health check. Defaults to 80 if type is HTTP + // or 443 if type is HTTPS. + Port int64 `json:"port"` + JSON healthchecksSingleResponseResultHTTPConfigJSON `json:"-"` +} + +// healthchecksSingleResponseResultHTTPConfigJSON contains the JSON metadata for +// the struct [HealthchecksSingleResponseResultHTTPConfig] +type healthchecksSingleResponseResultHTTPConfigJSON struct { + AllowInsecure apijson.Field + ExpectedBody apijson.Field + ExpectedCodes apijson.Field + FollowRedirects apijson.Field + Header apijson.Field + Method apijson.Field + Path apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HealthchecksSingleResponseResultHTTPConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The HTTP method to use for the health check. +type HealthchecksSingleResponseResultHTTPConfigMethod string + +const ( + HealthchecksSingleResponseResultHTTPConfigMethodGet HealthchecksSingleResponseResultHTTPConfigMethod = "GET" + HealthchecksSingleResponseResultHTTPConfigMethodHead HealthchecksSingleResponseResultHTTPConfigMethod = "HEAD" +) + +// The current status of the origin server according to the health check. +type HealthchecksSingleResponseResultStatus string + +const ( + HealthchecksSingleResponseResultStatusUnknown HealthchecksSingleResponseResultStatus = "unknown" + HealthchecksSingleResponseResultStatusHealthy HealthchecksSingleResponseResultStatus = "healthy" + HealthchecksSingleResponseResultStatusUnhealthy HealthchecksSingleResponseResultStatus = "unhealthy" + HealthchecksSingleResponseResultStatusSuspended HealthchecksSingleResponseResultStatus = "suspended" +) + +// Parameters specific to TCP health check. +type HealthchecksSingleResponseResultTcpConfig struct { + // The TCP connection method to use for the health check. + Method HealthchecksSingleResponseResultTcpConfigMethod `json:"method"` + // Port number to connect to for the health check. Defaults to 80. + Port int64 `json:"port"` + JSON healthchecksSingleResponseResultTcpConfigJSON `json:"-"` +} + +// healthchecksSingleResponseResultTcpConfigJSON contains the JSON metadata for the +// struct [HealthchecksSingleResponseResultTcpConfig] +type healthchecksSingleResponseResultTcpConfigJSON struct { + Method apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HealthchecksSingleResponseResultTcpConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The TCP connection method to use for the health check. +type HealthchecksSingleResponseResultTcpConfigMethod string + +const ( + HealthchecksSingleResponseResultTcpConfigMethodConnectionEstablished HealthchecksSingleResponseResultTcpConfigMethod = "connection_established" +) + +// Whether the API call was successful +type HealthchecksSingleResponseSuccess bool + +const ( + HealthchecksSingleResponseSuccessTrue HealthchecksSingleResponseSuccess = true +) + +type ZoneHealthcheckDeleteResponse struct { + Errors []ZoneHealthcheckDeleteResponseError `json:"errors"` + Messages []ZoneHealthcheckDeleteResponseMessage `json:"messages"` + Result ZoneHealthcheckDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneHealthcheckDeleteResponseSuccess `json:"success"` + JSON zoneHealthcheckDeleteResponseJSON `json:"-"` +} + +// zoneHealthcheckDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneHealthcheckDeleteResponse] +type zoneHealthcheckDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHealthcheckDeleteResponseErrorJSON `json:"-"` +} + +// zoneHealthcheckDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneHealthcheckDeleteResponseError] +type zoneHealthcheckDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHealthcheckDeleteResponseMessageJSON `json:"-"` +} + +// zoneHealthcheckDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneHealthcheckDeleteResponseMessage] +type zoneHealthcheckDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON zoneHealthcheckDeleteResponseResultJSON `json:"-"` +} + +// zoneHealthcheckDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneHealthcheckDeleteResponseResult] +type zoneHealthcheckDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneHealthcheckDeleteResponseSuccess bool + +const ( + ZoneHealthcheckDeleteResponseSuccessTrue ZoneHealthcheckDeleteResponseSuccess = true +) + +type ZoneHealthcheckHealthChecksListHealthChecksResponse struct { + Errors []ZoneHealthcheckHealthChecksListHealthChecksResponseError `json:"errors"` + Messages []ZoneHealthcheckHealthChecksListHealthChecksResponseMessage `json:"messages"` + Result []ZoneHealthcheckHealthChecksListHealthChecksResponseResult `json:"result"` + ResultInfo ZoneHealthcheckHealthChecksListHealthChecksResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneHealthcheckHealthChecksListHealthChecksResponseSuccess `json:"success"` + JSON zoneHealthcheckHealthChecksListHealthChecksResponseJSON `json:"-"` +} + +// zoneHealthcheckHealthChecksListHealthChecksResponseJSON contains the JSON +// metadata for the struct [ZoneHealthcheckHealthChecksListHealthChecksResponse] +type zoneHealthcheckHealthChecksListHealthChecksResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckHealthChecksListHealthChecksResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckHealthChecksListHealthChecksResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHealthcheckHealthChecksListHealthChecksResponseErrorJSON `json:"-"` +} + +// zoneHealthcheckHealthChecksListHealthChecksResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneHealthcheckHealthChecksListHealthChecksResponseError] +type zoneHealthcheckHealthChecksListHealthChecksResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckHealthChecksListHealthChecksResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckHealthChecksListHealthChecksResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHealthcheckHealthChecksListHealthChecksResponseMessageJSON `json:"-"` +} + +// zoneHealthcheckHealthChecksListHealthChecksResponseMessageJSON contains the JSON +// metadata for the struct +// [ZoneHealthcheckHealthChecksListHealthChecksResponseMessage] +type zoneHealthcheckHealthChecksListHealthChecksResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckHealthChecksListHealthChecksResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckHealthChecksListHealthChecksResponseResult struct { + // Identifier + ID string `json:"id"` + // The hostname or IP address of the origin server to run health checks on. + Address string `json:"address"` + // A list of regions from which to run health checks. Null means Cloudflare will + // pick a default region. + CheckRegions []ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion `json:"check_regions,nullable"` + // The number of consecutive fails required from a health check before changing the + // health to unhealthy. + ConsecutiveFails int64 `json:"consecutive_fails"` + // The number of consecutive successes required from a health check before changing + // the health to healthy. + ConsecutiveSuccesses int64 `json:"consecutive_successes"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // A human-readable description of the health check. + Description string `json:"description"` + // The current failure reason if status is unhealthy. + FailureReason string `json:"failure_reason"` + // Parameters specific to an HTTP or HTTPS health check. + HTTPConfig ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfig `json:"http_config,nullable"` + // The interval between each health check. Shorter intervals may give quicker + // notifications if the origin status changes, but will increase load on the origin + // as we check from multiple locations. + Interval int64 `json:"interval"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A short name to identify the health check. Only alphanumeric characters, hyphens + // and underscores are allowed. + Name string `json:"name"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries int64 `json:"retries"` + // The current status of the origin server according to the health check. + Status ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatus `json:"status"` + // If suspended, no health checks are sent to the origin. + Suspended bool `json:"suspended"` + // Parameters specific to TCP health check. + TcpConfig ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfig `json:"tcp_config,nullable"` + // The timeout (in seconds) before marking the health check as failed. + Timeout int64 `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP', 'HTTPS' and 'TCP'. + Type string `json:"type"` + JSON zoneHealthcheckHealthChecksListHealthChecksResponseResultJSON `json:"-"` +} + +// zoneHealthcheckHealthChecksListHealthChecksResponseResultJSON contains the JSON +// metadata for the struct +// [ZoneHealthcheckHealthChecksListHealthChecksResponseResult] +type zoneHealthcheckHealthChecksListHealthChecksResponseResultJSON struct { + ID apijson.Field + Address apijson.Field + CheckRegions apijson.Field + ConsecutiveFails apijson.Field + ConsecutiveSuccesses apijson.Field + CreatedOn apijson.Field + Description apijson.Field + FailureReason apijson.Field + HTTPConfig apijson.Field + Interval apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Retries apijson.Field + Status apijson.Field + Suspended apijson.Field + TcpConfig apijson.Field + Timeout apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckHealthChecksListHealthChecksResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, IN: India, +// SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (BUSINESS +// and ENTERPRISE customers only). +type ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion string + +const ( + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionWnam ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "WNAM" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionEnam ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "ENAM" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionWeu ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "WEU" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionEeu ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "EEU" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionNsam ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "NSAM" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionSsam ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "SSAM" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionOc ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "OC" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionMe ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "ME" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionNaf ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "NAF" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionSaf ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "SAF" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionIn ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "IN" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionSeas ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "SEAS" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionNeas ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "NEAS" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegionAllRegions ZoneHealthcheckHealthChecksListHealthChecksResponseResultCheckRegion = "ALL_REGIONS" +) + +// Parameters specific to an HTTP or HTTPS health check. +type ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfig struct { + // Do not validate the certificate when the health check uses HTTPS. + AllowInsecure bool `json:"allow_insecure"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. + ExpectedBody string `json:"expected_body"` + // The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all + // codes starting with 2) of the health check. + ExpectedCodes []string `json:"expected_codes,nullable"` + // Follow redirects if the origin returns a 3xx status code. + FollowRedirects bool `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. + Header interface{} `json:"header,nullable"` + // The HTTP method to use for the health check. + Method ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigMethod `json:"method"` + // The endpoint path to health check against. + Path string `json:"path"` + // Port number to connect to for the health check. Defaults to 80 if type is HTTP + // or 443 if type is HTTPS. + Port int64 `json:"port"` + JSON zoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigJSON `json:"-"` +} + +// zoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigJSON contains +// the JSON metadata for the struct +// [ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfig] +type zoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigJSON struct { + AllowInsecure apijson.Field + ExpectedBody apijson.Field + ExpectedCodes apijson.Field + FollowRedirects apijson.Field + Header apijson.Field + Method apijson.Field + Path apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The HTTP method to use for the health check. +type ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigMethod string + +const ( + ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigMethodGet ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigMethod = "GET" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigMethodHead ZoneHealthcheckHealthChecksListHealthChecksResponseResultHTTPConfigMethod = "HEAD" +) + +// The current status of the origin server according to the health check. +type ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatus string + +const ( + ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatusUnknown ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatus = "unknown" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatusHealthy ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatus = "healthy" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatusUnhealthy ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatus = "unhealthy" + ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatusSuspended ZoneHealthcheckHealthChecksListHealthChecksResponseResultStatus = "suspended" +) + +// Parameters specific to TCP health check. +type ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfig struct { + // The TCP connection method to use for the health check. + Method ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfigMethod `json:"method"` + // Port number to connect to for the health check. Defaults to 80. + Port int64 `json:"port"` + JSON zoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfigJSON `json:"-"` +} + +// zoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfigJSON contains +// the JSON metadata for the struct +// [ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfig] +type zoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfigJSON struct { + Method apijson.Field + Port apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The TCP connection method to use for the health check. +type ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfigMethod string + +const ( + ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfigMethodConnectionEstablished ZoneHealthcheckHealthChecksListHealthChecksResponseResultTcpConfigMethod = "connection_established" +) + +type ZoneHealthcheckHealthChecksListHealthChecksResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneHealthcheckHealthChecksListHealthChecksResponseResultInfoJSON `json:"-"` +} + +// zoneHealthcheckHealthChecksListHealthChecksResponseResultInfoJSON contains the +// JSON metadata for the struct +// [ZoneHealthcheckHealthChecksListHealthChecksResponseResultInfo] +type zoneHealthcheckHealthChecksListHealthChecksResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckHealthChecksListHealthChecksResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneHealthcheckHealthChecksListHealthChecksResponseSuccess bool + +const ( + ZoneHealthcheckHealthChecksListHealthChecksResponseSuccessTrue ZoneHealthcheckHealthChecksListHealthChecksResponseSuccess = true +) + +type ZoneHealthcheckUpdateParams struct { + // The hostname or IP address of the origin server to run health checks on. + Address param.Field[string] `json:"address,required"` + // A short name to identify the health check. Only alphanumeric characters, hyphens + // and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // A list of regions from which to run health checks. Null means Cloudflare will + // pick a default region. + CheckRegions param.Field[[]ZoneHealthcheckUpdateParamsCheckRegion] `json:"check_regions"` + // The number of consecutive fails required from a health check before changing the + // health to unhealthy. + ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` + // The number of consecutive successes required from a health check before changing + // the health to healthy. + ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` + // A human-readable description of the health check. + Description param.Field[string] `json:"description"` + // Parameters specific to an HTTP or HTTPS health check. + HTTPConfig param.Field[ZoneHealthcheckUpdateParamsHTTPConfig] `json:"http_config"` + // The interval between each health check. Shorter intervals may give quicker + // notifications if the origin status changes, but will increase load on the origin + // as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // If suspended, no health checks are sent to the origin. + Suspended param.Field[bool] `json:"suspended"` + // Parameters specific to TCP health check. + TcpConfig param.Field[ZoneHealthcheckUpdateParamsTcpConfig] `json:"tcp_config"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP', 'HTTPS' and 'TCP'. + Type param.Field[string] `json:"type"` +} + +func (r ZoneHealthcheckUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, IN: India, +// SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (BUSINESS +// and ENTERPRISE customers only). +type ZoneHealthcheckUpdateParamsCheckRegion string + +const ( + ZoneHealthcheckUpdateParamsCheckRegionWnam ZoneHealthcheckUpdateParamsCheckRegion = "WNAM" + ZoneHealthcheckUpdateParamsCheckRegionEnam ZoneHealthcheckUpdateParamsCheckRegion = "ENAM" + ZoneHealthcheckUpdateParamsCheckRegionWeu ZoneHealthcheckUpdateParamsCheckRegion = "WEU" + ZoneHealthcheckUpdateParamsCheckRegionEeu ZoneHealthcheckUpdateParamsCheckRegion = "EEU" + ZoneHealthcheckUpdateParamsCheckRegionNsam ZoneHealthcheckUpdateParamsCheckRegion = "NSAM" + ZoneHealthcheckUpdateParamsCheckRegionSsam ZoneHealthcheckUpdateParamsCheckRegion = "SSAM" + ZoneHealthcheckUpdateParamsCheckRegionOc ZoneHealthcheckUpdateParamsCheckRegion = "OC" + ZoneHealthcheckUpdateParamsCheckRegionMe ZoneHealthcheckUpdateParamsCheckRegion = "ME" + ZoneHealthcheckUpdateParamsCheckRegionNaf ZoneHealthcheckUpdateParamsCheckRegion = "NAF" + ZoneHealthcheckUpdateParamsCheckRegionSaf ZoneHealthcheckUpdateParamsCheckRegion = "SAF" + ZoneHealthcheckUpdateParamsCheckRegionIn ZoneHealthcheckUpdateParamsCheckRegion = "IN" + ZoneHealthcheckUpdateParamsCheckRegionSeas ZoneHealthcheckUpdateParamsCheckRegion = "SEAS" + ZoneHealthcheckUpdateParamsCheckRegionNeas ZoneHealthcheckUpdateParamsCheckRegion = "NEAS" + ZoneHealthcheckUpdateParamsCheckRegionAllRegions ZoneHealthcheckUpdateParamsCheckRegion = "ALL_REGIONS" +) + +// Parameters specific to an HTTP or HTTPS health check. +type ZoneHealthcheckUpdateParamsHTTPConfig struct { + // Do not validate the certificate when the health check uses HTTPS. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all + // codes starting with 2) of the health check. + ExpectedCodes param.Field[[]string] `json:"expected_codes"` + // Follow redirects if the origin returns a 3xx status code. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. + Header param.Field[interface{}] `json:"header"` + // The HTTP method to use for the health check. + Method param.Field[ZoneHealthcheckUpdateParamsHTTPConfigMethod] `json:"method"` + // The endpoint path to health check against. + Path param.Field[string] `json:"path"` + // Port number to connect to for the health check. Defaults to 80 if type is HTTP + // or 443 if type is HTTPS. + Port param.Field[int64] `json:"port"` +} + +func (r ZoneHealthcheckUpdateParamsHTTPConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The HTTP method to use for the health check. +type ZoneHealthcheckUpdateParamsHTTPConfigMethod string + +const ( + ZoneHealthcheckUpdateParamsHTTPConfigMethodGet ZoneHealthcheckUpdateParamsHTTPConfigMethod = "GET" + ZoneHealthcheckUpdateParamsHTTPConfigMethodHead ZoneHealthcheckUpdateParamsHTTPConfigMethod = "HEAD" +) + +// Parameters specific to TCP health check. +type ZoneHealthcheckUpdateParamsTcpConfig struct { + // The TCP connection method to use for the health check. + Method param.Field[ZoneHealthcheckUpdateParamsTcpConfigMethod] `json:"method"` + // Port number to connect to for the health check. Defaults to 80. + Port param.Field[int64] `json:"port"` +} + +func (r ZoneHealthcheckUpdateParamsTcpConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The TCP connection method to use for the health check. +type ZoneHealthcheckUpdateParamsTcpConfigMethod string + +const ( + ZoneHealthcheckUpdateParamsTcpConfigMethodConnectionEstablished ZoneHealthcheckUpdateParamsTcpConfigMethod = "connection_established" +) + +type ZoneHealthcheckHealthChecksNewHealthCheckParams struct { + // The hostname or IP address of the origin server to run health checks on. + Address param.Field[string] `json:"address,required"` + // A short name to identify the health check. Only alphanumeric characters, hyphens + // and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // A list of regions from which to run health checks. Null means Cloudflare will + // pick a default region. + CheckRegions param.Field[[]ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion] `json:"check_regions"` + // The number of consecutive fails required from a health check before changing the + // health to unhealthy. + ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` + // The number of consecutive successes required from a health check before changing + // the health to healthy. + ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` + // A human-readable description of the health check. + Description param.Field[string] `json:"description"` + // Parameters specific to an HTTP or HTTPS health check. + HTTPConfig param.Field[ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfig] `json:"http_config"` + // The interval between each health check. Shorter intervals may give quicker + // notifications if the origin status changes, but will increase load on the origin + // as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // If suspended, no health checks are sent to the origin. + Suspended param.Field[bool] `json:"suspended"` + // Parameters specific to TCP health check. + TcpConfig param.Field[ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfig] `json:"tcp_config"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP', 'HTTPS' and 'TCP'. + Type param.Field[string] `json:"type"` +} + +func (r ZoneHealthcheckHealthChecksNewHealthCheckParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, IN: India, +// SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (BUSINESS +// and ENTERPRISE customers only). +type ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion string + +const ( + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionWnam ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "WNAM" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionEnam ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "ENAM" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionWeu ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "WEU" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionEeu ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "EEU" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionNsam ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "NSAM" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionSsam ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "SSAM" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionOc ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "OC" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionMe ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "ME" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionNaf ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "NAF" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionSaf ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "SAF" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionIn ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "IN" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionSeas ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "SEAS" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionNeas ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "NEAS" + ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionAllRegions ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion = "ALL_REGIONS" +) + +// Parameters specific to an HTTP or HTTPS health check. +type ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfig struct { + // Do not validate the certificate when the health check uses HTTPS. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all + // codes starting with 2) of the health check. + ExpectedCodes param.Field[[]string] `json:"expected_codes"` + // Follow redirects if the origin returns a 3xx status code. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. + Header param.Field[interface{}] `json:"header"` + // The HTTP method to use for the health check. + Method param.Field[ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfigMethod] `json:"method"` + // The endpoint path to health check against. + Path param.Field[string] `json:"path"` + // Port number to connect to for the health check. Defaults to 80 if type is HTTP + // or 443 if type is HTTPS. + Port param.Field[int64] `json:"port"` +} + +func (r ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The HTTP method to use for the health check. +type ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfigMethod string + +const ( + ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfigMethodGet ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfigMethod = "GET" + ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfigMethodHead ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfigMethod = "HEAD" +) + +// Parameters specific to TCP health check. +type ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfig struct { + // The TCP connection method to use for the health check. + Method param.Field[ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfigMethod] `json:"method"` + // Port number to connect to for the health check. Defaults to 80. + Port param.Field[int64] `json:"port"` +} + +func (r ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The TCP connection method to use for the health check. +type ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfigMethod string + +const ( + ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfigMethodConnectionEstablished ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfigMethod = "connection_established" +) diff --git a/zonehealthcheck_test.go b/zonehealthcheck_test.go new file mode 100644 index 00000000000..f5749190ad7 --- /dev/null +++ b/zonehealthcheck_test.go @@ -0,0 +1,227 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneHealthcheckGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneHealthcheckUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneHealthcheckUpdateParams{ + Address: cloudflare.F("www.example.com"), + Name: cloudflare.F("server-1"), + CheckRegions: cloudflare.F([]cloudflare.ZoneHealthcheckUpdateParamsCheckRegion{cloudflare.ZoneHealthcheckUpdateParamsCheckRegionWeu, cloudflare.ZoneHealthcheckUpdateParamsCheckRegionEnam}), + ConsecutiveFails: cloudflare.F(int64(0)), + ConsecutiveSuccesses: cloudflare.F(int64(0)), + Description: cloudflare.F("Health check for www.example.com"), + HTTPConfig: cloudflare.F(cloudflare.ZoneHealthcheckUpdateParamsHTTPConfig{ + AllowInsecure: cloudflare.F(true), + ExpectedBody: cloudflare.F("success"), + ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Method: cloudflare.F(cloudflare.ZoneHealthcheckUpdateParamsHTTPConfigMethodGet), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + }), + Interval: cloudflare.F(int64(0)), + Retries: cloudflare.F(int64(0)), + Suspended: cloudflare.F(true), + TcpConfig: cloudflare.F(cloudflare.ZoneHealthcheckUpdateParamsTcpConfig{ + Method: cloudflare.F(cloudflare.ZoneHealthcheckUpdateParamsTcpConfigMethodConnectionEstablished), + Port: cloudflare.F(int64(0)), + }), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F("HTTPS"), + }, + ) + 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 TestZoneHealthcheckDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneHealthcheckHealthChecksNewHealthCheckWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.HealthChecksNewHealthCheck( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParams{ + Address: cloudflare.F("www.example.com"), + Name: cloudflare.F("server-1"), + CheckRegions: cloudflare.F([]cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegion{cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionWeu, cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParamsCheckRegionEnam}), + ConsecutiveFails: cloudflare.F(int64(0)), + ConsecutiveSuccesses: cloudflare.F(int64(0)), + Description: cloudflare.F("Health check for www.example.com"), + HTTPConfig: cloudflare.F(cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfig{ + AllowInsecure: cloudflare.F(true), + ExpectedBody: cloudflare.F("success"), + ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Method: cloudflare.F(cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParamsHTTPConfigMethodGet), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + }), + Interval: cloudflare.F(int64(0)), + Retries: cloudflare.F(int64(0)), + Suspended: cloudflare.F(true), + TcpConfig: cloudflare.F(cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfig{ + Method: cloudflare.F(cloudflare.ZoneHealthcheckHealthChecksNewHealthCheckParamsTcpConfigMethodConnectionEstablished), + Port: cloudflare.F(int64(0)), + }), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F("HTTPS"), + }, + ) + 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 TestZoneHealthcheckHealthChecksListHealthChecks(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.HealthChecksListHealthChecks(context.TODO(), "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/zonehealthcheckpreview.go b/zonehealthcheckpreview.go new file mode 100644 index 00000000000..3e02c2cdc31 --- /dev/null +++ b/zonehealthcheckpreview.go @@ -0,0 +1,263 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneHealthcheckPreviewService 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 [NewZoneHealthcheckPreviewService] +// method instead. +type ZoneHealthcheckPreviewService struct { + Options []option.RequestOption +} + +// NewZoneHealthcheckPreviewService 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 NewZoneHealthcheckPreviewService(opts ...option.RequestOption) (r *ZoneHealthcheckPreviewService) { + r = &ZoneHealthcheckPreviewService{} + r.Options = opts + return +} + +// Fetch a single configured health check preview. +func (r *ZoneHealthcheckPreviewService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *HealthchecksSingleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks/preview/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a health check. +func (r *ZoneHealthcheckPreviewService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneHealthcheckPreviewDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks/preview/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create a new preview health check. +func (r *ZoneHealthcheckPreviewService) HealthChecksNewPreviewHealthCheck(ctx context.Context, zoneIdentifier string, body ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParams, opts ...option.RequestOption) (res *HealthchecksSingleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/healthchecks/preview", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneHealthcheckPreviewDeleteResponse struct { + Errors []ZoneHealthcheckPreviewDeleteResponseError `json:"errors"` + Messages []ZoneHealthcheckPreviewDeleteResponseMessage `json:"messages"` + Result ZoneHealthcheckPreviewDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneHealthcheckPreviewDeleteResponseSuccess `json:"success"` + JSON zoneHealthcheckPreviewDeleteResponseJSON `json:"-"` +} + +// zoneHealthcheckPreviewDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneHealthcheckPreviewDeleteResponse] +type zoneHealthcheckPreviewDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckPreviewDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckPreviewDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHealthcheckPreviewDeleteResponseErrorJSON `json:"-"` +} + +// zoneHealthcheckPreviewDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneHealthcheckPreviewDeleteResponseError] +type zoneHealthcheckPreviewDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckPreviewDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckPreviewDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHealthcheckPreviewDeleteResponseMessageJSON `json:"-"` +} + +// zoneHealthcheckPreviewDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneHealthcheckPreviewDeleteResponseMessage] +type zoneHealthcheckPreviewDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckPreviewDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHealthcheckPreviewDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON zoneHealthcheckPreviewDeleteResponseResultJSON `json:"-"` +} + +// zoneHealthcheckPreviewDeleteResponseResultJSON contains the JSON metadata for +// the struct [ZoneHealthcheckPreviewDeleteResponseResult] +type zoneHealthcheckPreviewDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHealthcheckPreviewDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneHealthcheckPreviewDeleteResponseSuccess bool + +const ( + ZoneHealthcheckPreviewDeleteResponseSuccessTrue ZoneHealthcheckPreviewDeleteResponseSuccess = true +) + +type ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParams struct { + // The hostname or IP address of the origin server to run health checks on. + Address param.Field[string] `json:"address,required"` + // A short name to identify the health check. Only alphanumeric characters, hyphens + // and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // A list of regions from which to run health checks. Null means Cloudflare will + // pick a default region. + CheckRegions param.Field[[]ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion] `json:"check_regions"` + // The number of consecutive fails required from a health check before changing the + // health to unhealthy. + ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` + // The number of consecutive successes required from a health check before changing + // the health to healthy. + ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` + // A human-readable description of the health check. + Description param.Field[string] `json:"description"` + // Parameters specific to an HTTP or HTTPS health check. + HTTPConfig param.Field[ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfig] `json:"http_config"` + // The interval between each health check. Shorter intervals may give quicker + // notifications if the origin status changes, but will increase load on the origin + // as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // If suspended, no health checks are sent to the origin. + Suspended param.Field[bool] `json:"suspended"` + // Parameters specific to TCP health check. + TcpConfig param.Field[ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfig] `json:"tcp_config"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP', 'HTTPS' and 'TCP'. + Type param.Field[string] `json:"type"` +} + +func (r ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, +// EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, +// OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, IN: India, +// SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (BUSINESS +// and ENTERPRISE customers only). +type ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion string + +const ( + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionWnam ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "WNAM" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionEnam ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "ENAM" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionWeu ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "WEU" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionEeu ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "EEU" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionNsam ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "NSAM" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionSsam ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "SSAM" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionOc ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "OC" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionMe ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "ME" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionNaf ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "NAF" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionSaf ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "SAF" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionIn ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "IN" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionSeas ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "SEAS" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionNeas ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "NEAS" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionAllRegions ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion = "ALL_REGIONS" +) + +// Parameters specific to an HTTP or HTTPS health check. +type ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfig struct { + // Do not validate the certificate when the health check uses HTTPS. + AllowInsecure param.Field[bool] `json:"allow_insecure"` + // A case-insensitive sub-string to look for in the response body. If this string + // is not found, the origin will be marked as unhealthy. + ExpectedBody param.Field[string] `json:"expected_body"` + // The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all + // codes starting with 2) of the health check. + ExpectedCodes param.Field[[]string] `json:"expected_codes"` + // Follow redirects if the origin returns a 3xx status code. + FollowRedirects param.Field[bool] `json:"follow_redirects"` + // The HTTP request headers to send in the health check. It is recommended you set + // a Host header by default. The User-Agent header cannot be overridden. + Header param.Field[interface{}] `json:"header"` + // The HTTP method to use for the health check. + Method param.Field[ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfigMethod] `json:"method"` + // The endpoint path to health check against. + Path param.Field[string] `json:"path"` + // Port number to connect to for the health check. Defaults to 80 if type is HTTP + // or 443 if type is HTTPS. + Port param.Field[int64] `json:"port"` +} + +func (r ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The HTTP method to use for the health check. +type ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfigMethod string + +const ( + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfigMethodGet ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfigMethod = "GET" + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfigMethodHead ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfigMethod = "HEAD" +) + +// Parameters specific to TCP health check. +type ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfig struct { + // The TCP connection method to use for the health check. + Method param.Field[ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfigMethod] `json:"method"` + // Port number to connect to for the health check. Defaults to 80. + Port param.Field[int64] `json:"port"` +} + +func (r ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The TCP connection method to use for the health check. +type ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfigMethod string + +const ( + ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfigMethodConnectionEstablished ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfigMethod = "connection_established" +) diff --git a/zonehealthcheckpreview_test.go b/zonehealthcheckpreview_test.go new file mode 100644 index 00000000000..44137e71a62 --- /dev/null +++ b/zonehealthcheckpreview_test.go @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneHealthcheckPreviewGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.Previews.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneHealthcheckPreviewDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.Previews.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Healthchecks.Previews.HealthChecksNewPreviewHealthCheck( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParams{ + Address: cloudflare.F("www.example.com"), + Name: cloudflare.F("server-1"), + CheckRegions: cloudflare.F([]cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegion{cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionWeu, cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsCheckRegionEnam}), + ConsecutiveFails: cloudflare.F(int64(0)), + ConsecutiveSuccesses: cloudflare.F(int64(0)), + Description: cloudflare.F("Health check for www.example.com"), + HTTPConfig: cloudflare.F(cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfig{ + AllowInsecure: cloudflare.F(true), + ExpectedBody: cloudflare.F("success"), + ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Method: cloudflare.F(cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsHTTPConfigMethodGet), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + }), + Interval: cloudflare.F(int64(0)), + Retries: cloudflare.F(int64(0)), + Suspended: cloudflare.F(true), + TcpConfig: cloudflare.F(cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfig{ + Method: cloudflare.F(cloudflare.ZoneHealthcheckPreviewHealthChecksNewPreviewHealthCheckParamsTcpConfigMethodConnectionEstablished), + Port: cloudflare.F(int64(0)), + }), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F("HTTPS"), + }, + ) + 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/zonehold.go b/zonehold.go new file mode 100644 index 00000000000..9efee1dacc0 --- /dev/null +++ b/zonehold.go @@ -0,0 +1,309 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneHoldService 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 [NewZoneHoldService] method instead. +type ZoneHoldService struct { + Options []option.RequestOption +} + +// NewZoneHoldService 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 NewZoneHoldService(opts ...option.RequestOption) (r *ZoneHoldService) { + r = &ZoneHoldService{} + r.Options = opts + return +} + +// Enforce a zone hold on the zone, blocking the creation and activation of zones +// with this zone's hostname. +func (r *ZoneHoldService) New(ctx context.Context, zoneID string, body ZoneHoldNewParams, opts ...option.RequestOption) (res *ZoneHoldNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/hold", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Retrieve whether the zone is subject to a zone hold, and metadata about the +// hold. +func (r *ZoneHoldService) Get(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneHoldGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/hold", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Stop enforcement of a zone hold on the zone, permanently or temporarily, +// allowing the creation and activation of zones with this zone's hostname. +func (r *ZoneHoldService) Delete(ctx context.Context, zoneID string, body ZoneHoldDeleteParams, opts ...option.RequestOption) (res *ZoneHoldDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/hold", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +type ZoneHoldNewResponse struct { + Errors []ZoneHoldNewResponseError `json:"errors"` + Messages []ZoneHoldNewResponseMessage `json:"messages"` + Result ZoneHoldNewResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneHoldNewResponseSuccess `json:"success"` + JSON zoneHoldNewResponseJSON `json:"-"` +} + +// zoneHoldNewResponseJSON contains the JSON metadata for the struct +// [ZoneHoldNewResponse] +type zoneHoldNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHoldNewResponseErrorJSON `json:"-"` +} + +// zoneHoldNewResponseErrorJSON contains the JSON metadata for the struct +// [ZoneHoldNewResponseError] +type zoneHoldNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHoldNewResponseMessageJSON `json:"-"` +} + +// zoneHoldNewResponseMessageJSON contains the JSON metadata for the struct +// [ZoneHoldNewResponseMessage] +type zoneHoldNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldNewResponseResult struct { + Hold bool `json:"hold"` + HoldAfter string `json:"hold_after"` + IncludeSubdomains string `json:"include_subdomains"` + JSON zoneHoldNewResponseResultJSON `json:"-"` +} + +// zoneHoldNewResponseResultJSON contains the JSON metadata for the struct +// [ZoneHoldNewResponseResult] +type zoneHoldNewResponseResultJSON struct { + Hold apijson.Field + HoldAfter apijson.Field + IncludeSubdomains apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneHoldNewResponseSuccess bool + +const ( + ZoneHoldNewResponseSuccessTrue ZoneHoldNewResponseSuccess = true +) + +type ZoneHoldGetResponse struct { + Errors []ZoneHoldGetResponseError `json:"errors"` + Messages []ZoneHoldGetResponseMessage `json:"messages"` + Result ZoneHoldGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneHoldGetResponseSuccess `json:"success"` + JSON zoneHoldGetResponseJSON `json:"-"` +} + +// zoneHoldGetResponseJSON contains the JSON metadata for the struct +// [ZoneHoldGetResponse] +type zoneHoldGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHoldGetResponseErrorJSON `json:"-"` +} + +// zoneHoldGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneHoldGetResponseError] +type zoneHoldGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneHoldGetResponseMessageJSON `json:"-"` +} + +// zoneHoldGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneHoldGetResponseMessage] +type zoneHoldGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldGetResponseResult struct { + Hold bool `json:"hold"` + HoldAfter string `json:"hold_after"` + IncludeSubdomains string `json:"include_subdomains"` + JSON zoneHoldGetResponseResultJSON `json:"-"` +} + +// zoneHoldGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneHoldGetResponseResult] +type zoneHoldGetResponseResultJSON struct { + Hold apijson.Field + HoldAfter apijson.Field + IncludeSubdomains apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneHoldGetResponseSuccess bool + +const ( + ZoneHoldGetResponseSuccessTrue ZoneHoldGetResponseSuccess = true +) + +type ZoneHoldDeleteResponse struct { + Result ZoneHoldDeleteResponseResult `json:"result"` + JSON zoneHoldDeleteResponseJSON `json:"-"` +} + +// zoneHoldDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneHoldDeleteResponse] +type zoneHoldDeleteResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldDeleteResponseResult struct { + Hold bool `json:"hold"` + HoldAfter string `json:"hold_after"` + IncludeSubdomains string `json:"include_subdomains"` + JSON zoneHoldDeleteResponseResultJSON `json:"-"` +} + +// zoneHoldDeleteResponseResultJSON contains the JSON metadata for the struct +// [ZoneHoldDeleteResponseResult] +type zoneHoldDeleteResponseResultJSON struct { + Hold apijson.Field + HoldAfter apijson.Field + IncludeSubdomains apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneHoldDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneHoldNewParams struct { + // If provided, the zone hold will extend to block any subdomain of the given zone, + // as well as SSL4SaaS Custom Hostnames. For example, a zone hold on a zone with + // the hostname 'example.com' and include_subdomains=true will block 'example.com', + // 'staging.example.com', 'api.staging.example.com', etc. + IncludeSubdomains param.Field[bool] `query:"include_subdomains"` +} + +// URLQuery serializes [ZoneHoldNewParams]'s query parameters as `url.Values`. +func (r ZoneHoldNewParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneHoldDeleteParams struct { + // If `hold_after` is provided, the hold will be temporarily disabled, then + // automatically re-enabled by the system at the time specified in this + // RFC3339-formatted timestamp. Otherwise, the hold will be disabled indefinitely. + HoldAfter param.Field[string] `query:"hold_after"` +} + +// URLQuery serializes [ZoneHoldDeleteParams]'s query parameters as `url.Values`. +func (r ZoneHoldDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/aimeta_test.go b/zonehold_test.go similarity index 62% rename from aimeta_test.go rename to zonehold_test.go index 147f616febd..42ef5e10a8e 100644 --- a/aimeta_test.go +++ b/zonehold_test.go @@ -13,7 +13,8 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAIMetaLlama2_7bChatFp16WithOptionalParams(t *testing.T) { +func TestZoneHoldNewWithOptionalParams(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 @@ -23,15 +24,16 @@ func TestAIMetaLlama2_7bChatFp16WithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Meta.Llama2_7bChatFp16( + _, err := client.Zones.Holds.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIMetaLlama2_7bChatFp16ParamsVariant0{ - Prompt: cloudflare.F("string"), - Stream: cloudflare.F(true), + cloudflare.ZoneHoldNewParams{ + IncludeSubdomains: cloudflare.F(true), }, ) if err != nil { @@ -43,7 +45,8 @@ func TestAIMetaLlama2_7bChatFp16WithOptionalParams(t *testing.T) { } } -func TestAIMetaLlama2_7bChatInt8WithOptionalParams(t *testing.T) { +func TestZoneHoldGet(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 @@ -53,17 +56,12 @@ func TestAIMetaLlama2_7bChatInt8WithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), - ) - _, err := client.AI.Meta.Llama2_7bChatInt8( - context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIMetaLlama2_7bChatInt8ParamsVariant0{ - Prompt: cloudflare.F("string"), - Stream: cloudflare.F(true), - }, + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) + _, err := client.Zones.Holds.Get(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -73,7 +71,8 @@ func TestAIMetaLlama2_7bChatInt8WithOptionalParams(t *testing.T) { } } -func TestAIMetaM2m100_1_2bWithOptionalParams(t *testing.T) { +func TestZoneHoldDeleteWithOptionalParams(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 @@ -83,16 +82,16 @@ func TestAIMetaM2m100_1_2bWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) - _, err := client.AI.Meta.M2m100_1_2b( + _, err := client.Zones.Holds.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AIMetaM2m100_1_2bParams{ - TargetLang: cloudflare.F("string"), - Text: cloudflare.F("string"), - SourceLang: cloudflare.F("string"), + cloudflare.ZoneHoldDeleteParams{ + HoldAfter: cloudflare.F("string"), }, ) if err != nil { diff --git a/zonekeylesscertificate.go b/zonekeylesscertificate.go new file mode 100644 index 00000000000..b1ef620e2d3 --- /dev/null +++ b/zonekeylesscertificate.go @@ -0,0 +1,862 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneKeylessCertificateService 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 [NewZoneKeylessCertificateService] +// method instead. +type ZoneKeylessCertificateService struct { + Options []option.RequestOption +} + +// NewZoneKeylessCertificateService 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 NewZoneKeylessCertificateService(opts ...option.RequestOption) (r *ZoneKeylessCertificateService) { + r = &ZoneKeylessCertificateService{} + r.Options = opts + return +} + +// Get details for one Keyless SSL configuration. +func (r *ZoneKeylessCertificateService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneKeylessCertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/keyless_certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// This will update attributes of a Keyless SSL. Consists of one or more of the +// following: host,name,port. +func (r *ZoneKeylessCertificateService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneKeylessCertificateUpdateParams, opts ...option.RequestOption) (res *ZoneKeylessCertificateUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/keyless_certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete Keyless SSL Configuration +func (r *ZoneKeylessCertificateService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneKeylessCertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/keyless_certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create Keyless SSL Configuration +func (r *ZoneKeylessCertificateService) KeylessSslForAZoneNewKeylessSslConfiguration(ctx context.Context, zoneIdentifier string, body ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParams, opts ...option.RequestOption) (res *ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/keyless_certificates", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List all Keyless SSL configurations for a given zone. +func (r *ZoneKeylessCertificateService) KeylessSslForAZoneListKeylessSslConfigurations(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/keyless_certificates", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneKeylessCertificateGetResponse struct { + Errors []ZoneKeylessCertificateGetResponseError `json:"errors"` + Messages []ZoneKeylessCertificateGetResponseMessage `json:"messages"` + Result ZoneKeylessCertificateGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneKeylessCertificateGetResponseSuccess `json:"success"` + JSON zoneKeylessCertificateGetResponseJSON `json:"-"` +} + +// zoneKeylessCertificateGetResponseJSON contains the JSON metadata for the struct +// [ZoneKeylessCertificateGetResponse] +type zoneKeylessCertificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateGetResponseErrorJSON `json:"-"` +} + +// zoneKeylessCertificateGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneKeylessCertificateGetResponseError] +type zoneKeylessCertificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateGetResponseMessageJSON `json:"-"` +} + +// zoneKeylessCertificateGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneKeylessCertificateGetResponseMessage] +type zoneKeylessCertificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateGetResponseResult struct { + // Keyless certificate identifier tag. + ID string `json:"id,required"` + // When the Keyless SSL was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Whether or not the Keyless SSL is on or off. + Enabled bool `json:"enabled,required"` + // The keyless SSL name. + Host string `json:"host,required" format:"hostname"` + // When the Keyless SSL was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The keyless SSL name. + Name string `json:"name,required"` + // Available permissions for the Keyless SSL for the current user requesting the + // item. + Permissions []interface{} `json:"permissions,required"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port float64 `json:"port,required"` + // Status of the Keyless SSL. + Status ZoneKeylessCertificateGetResponseResultStatus `json:"status,required"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel ZoneKeylessCertificateGetResponseResultTunnel `json:"tunnel"` + JSON zoneKeylessCertificateGetResponseResultJSON `json:"-"` +} + +// zoneKeylessCertificateGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneKeylessCertificateGetResponseResult] +type zoneKeylessCertificateGetResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + Host apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Permissions apijson.Field + Port apijson.Field + Status apijson.Field + Tunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Keyless SSL. +type ZoneKeylessCertificateGetResponseResultStatus string + +const ( + ZoneKeylessCertificateGetResponseResultStatusActive ZoneKeylessCertificateGetResponseResultStatus = "active" + ZoneKeylessCertificateGetResponseResultStatusDeleted ZoneKeylessCertificateGetResponseResultStatus = "deleted" +) + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneKeylessCertificateGetResponseResultTunnel struct { + // Private IP of the Key Server Host + PrivateIP string `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID string `json:"vnet_id,required"` + JSON zoneKeylessCertificateGetResponseResultTunnelJSON `json:"-"` +} + +// zoneKeylessCertificateGetResponseResultTunnelJSON contains the JSON metadata for +// the struct [ZoneKeylessCertificateGetResponseResultTunnel] +type zoneKeylessCertificateGetResponseResultTunnelJSON struct { + PrivateIP apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateGetResponseResultTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneKeylessCertificateGetResponseSuccess bool + +const ( + ZoneKeylessCertificateGetResponseSuccessTrue ZoneKeylessCertificateGetResponseSuccess = true +) + +type ZoneKeylessCertificateUpdateResponse struct { + Errors []ZoneKeylessCertificateUpdateResponseError `json:"errors"` + Messages []ZoneKeylessCertificateUpdateResponseMessage `json:"messages"` + Result ZoneKeylessCertificateUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneKeylessCertificateUpdateResponseSuccess `json:"success"` + JSON zoneKeylessCertificateUpdateResponseJSON `json:"-"` +} + +// zoneKeylessCertificateUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneKeylessCertificateUpdateResponse] +type zoneKeylessCertificateUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateUpdateResponseErrorJSON `json:"-"` +} + +// zoneKeylessCertificateUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneKeylessCertificateUpdateResponseError] +type zoneKeylessCertificateUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateUpdateResponseMessageJSON `json:"-"` +} + +// zoneKeylessCertificateUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneKeylessCertificateUpdateResponseMessage] +type zoneKeylessCertificateUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateUpdateResponseResult struct { + // Keyless certificate identifier tag. + ID string `json:"id,required"` + // When the Keyless SSL was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Whether or not the Keyless SSL is on or off. + Enabled bool `json:"enabled,required"` + // The keyless SSL name. + Host string `json:"host,required" format:"hostname"` + // When the Keyless SSL was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The keyless SSL name. + Name string `json:"name,required"` + // Available permissions for the Keyless SSL for the current user requesting the + // item. + Permissions []interface{} `json:"permissions,required"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port float64 `json:"port,required"` + // Status of the Keyless SSL. + Status ZoneKeylessCertificateUpdateResponseResultStatus `json:"status,required"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel ZoneKeylessCertificateUpdateResponseResultTunnel `json:"tunnel"` + JSON zoneKeylessCertificateUpdateResponseResultJSON `json:"-"` +} + +// zoneKeylessCertificateUpdateResponseResultJSON contains the JSON metadata for +// the struct [ZoneKeylessCertificateUpdateResponseResult] +type zoneKeylessCertificateUpdateResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + Host apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Permissions apijson.Field + Port apijson.Field + Status apijson.Field + Tunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Keyless SSL. +type ZoneKeylessCertificateUpdateResponseResultStatus string + +const ( + ZoneKeylessCertificateUpdateResponseResultStatusActive ZoneKeylessCertificateUpdateResponseResultStatus = "active" + ZoneKeylessCertificateUpdateResponseResultStatusDeleted ZoneKeylessCertificateUpdateResponseResultStatus = "deleted" +) + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneKeylessCertificateUpdateResponseResultTunnel struct { + // Private IP of the Key Server Host + PrivateIP string `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID string `json:"vnet_id,required"` + JSON zoneKeylessCertificateUpdateResponseResultTunnelJSON `json:"-"` +} + +// zoneKeylessCertificateUpdateResponseResultTunnelJSON contains the JSON metadata +// for the struct [ZoneKeylessCertificateUpdateResponseResultTunnel] +type zoneKeylessCertificateUpdateResponseResultTunnelJSON struct { + PrivateIP apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateUpdateResponseResultTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneKeylessCertificateUpdateResponseSuccess bool + +const ( + ZoneKeylessCertificateUpdateResponseSuccessTrue ZoneKeylessCertificateUpdateResponseSuccess = true +) + +type ZoneKeylessCertificateDeleteResponse struct { + Errors []ZoneKeylessCertificateDeleteResponseError `json:"errors"` + Messages []ZoneKeylessCertificateDeleteResponseMessage `json:"messages"` + Result ZoneKeylessCertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneKeylessCertificateDeleteResponseSuccess `json:"success"` + JSON zoneKeylessCertificateDeleteResponseJSON `json:"-"` +} + +// zoneKeylessCertificateDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneKeylessCertificateDeleteResponse] +type zoneKeylessCertificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateDeleteResponseErrorJSON `json:"-"` +} + +// zoneKeylessCertificateDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneKeylessCertificateDeleteResponseError] +type zoneKeylessCertificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateDeleteResponseMessageJSON `json:"-"` +} + +// zoneKeylessCertificateDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneKeylessCertificateDeleteResponseMessage] +type zoneKeylessCertificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON zoneKeylessCertificateDeleteResponseResultJSON `json:"-"` +} + +// zoneKeylessCertificateDeleteResponseResultJSON contains the JSON metadata for +// the struct [ZoneKeylessCertificateDeleteResponseResult] +type zoneKeylessCertificateDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneKeylessCertificateDeleteResponseSuccess bool + +const ( + ZoneKeylessCertificateDeleteResponseSuccessTrue ZoneKeylessCertificateDeleteResponseSuccess = true +) + +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponse struct { + Errors []ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseError `json:"errors"` + Messages []ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseMessage `json:"messages"` + Result ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseSuccess `json:"success"` + JSON zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponse] +type zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseErrorJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseError] +type zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseMessageJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseMessage] +type zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResult struct { + // Keyless certificate identifier tag. + ID string `json:"id,required"` + // When the Keyless SSL was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Whether or not the Keyless SSL is on or off. + Enabled bool `json:"enabled,required"` + // The keyless SSL name. + Host string `json:"host,required" format:"hostname"` + // When the Keyless SSL was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The keyless SSL name. + Name string `json:"name,required"` + // Available permissions for the Keyless SSL for the current user requesting the + // item. + Permissions []interface{} `json:"permissions,required"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port float64 `json:"port,required"` + // Status of the Keyless SSL. + Status ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultStatus `json:"status,required"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultTunnel `json:"tunnel"` + JSON zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResult] +type zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + Host apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Permissions apijson.Field + Port apijson.Field + Status apijson.Field + Tunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Keyless SSL. +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultStatus string + +const ( + ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultStatusActive ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultStatus = "active" + ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultStatusDeleted ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultStatus = "deleted" +) + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultTunnel struct { + // Private IP of the Key Server Host + PrivateIP string `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID string `json:"vnet_id,required"` + JSON zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultTunnelJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultTunnelJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultTunnel] +type zoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultTunnelJSON struct { + PrivateIP apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseResultTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseSuccess bool + +const ( + ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseSuccessTrue ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationResponseSuccess = true +) + +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponse struct { + Errors []ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseError `json:"errors"` + Messages []ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseMessage `json:"messages"` + Result []ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResult `json:"result"` + ResultInfo ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseSuccess `json:"success"` + JSON zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponse] +type zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseErrorJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseError] +type zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseMessageJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseMessage] +type zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResult struct { + // Keyless certificate identifier tag. + ID string `json:"id,required"` + // When the Keyless SSL was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // Whether or not the Keyless SSL is on or off. + Enabled bool `json:"enabled,required"` + // The keyless SSL name. + Host string `json:"host,required" format:"hostname"` + // When the Keyless SSL was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The keyless SSL name. + Name string `json:"name,required"` + // Available permissions for the Keyless SSL for the current user requesting the + // item. + Permissions []interface{} `json:"permissions,required"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port float64 `json:"port,required"` + // Status of the Keyless SSL. + Status ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultStatus `json:"status,required"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultTunnel `json:"tunnel"` + JSON zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResult] +type zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Enabled apijson.Field + Host apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Permissions apijson.Field + Port apijson.Field + Status apijson.Field + Tunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the Keyless SSL. +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultStatus string + +const ( + ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultStatusActive ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultStatus = "active" + ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultStatusDeleted ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultStatus = "deleted" +) + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultTunnel struct { + // Private IP of the Key Server Host + PrivateIP string `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID string `json:"vnet_id,required"` + JSON zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultTunnelJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultTunnelJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultTunnel] +type zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultTunnelJSON struct { + PrivateIP apijson.Field + VnetID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultInfoJSON `json:"-"` +} + +// zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultInfo] +type zoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseSuccess bool + +const ( + ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseSuccessTrue ZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurationsResponseSuccess = true +) + +type ZoneKeylessCertificateUpdateParams struct { + // Whether or not the Keyless SSL is on or off. + Enabled param.Field[bool] `json:"enabled"` + // The keyless SSL name. + Host param.Field[string] `json:"host" format:"hostname"` + // The keyless SSL name. + Name param.Field[string] `json:"name"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port param.Field[float64] `json:"port"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel param.Field[ZoneKeylessCertificateUpdateParamsTunnel] `json:"tunnel"` +} + +func (r ZoneKeylessCertificateUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneKeylessCertificateUpdateParamsTunnel struct { + // Private IP of the Key Server Host + PrivateIP param.Field[string] `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID param.Field[string] `json:"vnet_id,required"` +} + +func (r ZoneKeylessCertificateUpdateParamsTunnel) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParams struct { + // The zone's SSL certificate or SSL certificate and intermediate(s). + Certificate param.Field[string] `json:"certificate,required"` + // The keyless SSL name. + Host param.Field[string] `json:"host,required" format:"hostname"` + // The keyless SSL port used to communicate between Cloudflare and the client's + // Keyless SSL server. + Port param.Field[float64] `json:"port,required"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod param.Field[ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethod] `json:"bundle_method"` + // The keyless SSL name. + Name param.Field[string] `json:"name"` + // Configuration for using Keyless SSL through a Cloudflare Tunnel + Tunnel param.Field[ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsTunnel] `json:"tunnel"` +} + +func (r ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethod string + +const ( + ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethodUbiquitous ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethod = "ubiquitous" + ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethodOptimal ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethod = "optimal" + ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethodForce ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethod = "force" +) + +// Configuration for using Keyless SSL through a Cloudflare Tunnel +type ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsTunnel struct { + // Private IP of the Key Server Host + PrivateIP param.Field[string] `json:"private_ip,required"` + // Cloudflare Tunnel Virtual Network ID + VnetID param.Field[string] `json:"vnet_id,required"` +} + +func (r ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsTunnel) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonekeylesscertificate_test.go b/zonekeylesscertificate_test.go new file mode 100644 index 00000000000..d3ef4891dc6 --- /dev/null +++ b/zonekeylesscertificate_test.go @@ -0,0 +1,180 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneKeylessCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.KeylessCertificates.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneKeylessCertificateUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.KeylessCertificates.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneKeylessCertificateUpdateParams{ + Enabled: cloudflare.F(false), + Host: cloudflare.F("example.com"), + Name: cloudflare.F("example.com Keyless SSL"), + Port: cloudflare.F(24008.000000), + Tunnel: cloudflare.F(cloudflare.ZoneKeylessCertificateUpdateParamsTunnel{ + PrivateIP: cloudflare.F("10.0.0.1"), + VnetID: cloudflare.F("7365377a-85a4-4390-9480-531ef7dc7a3c"), + }), + }, + ) + 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 TestZoneKeylessCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.KeylessCertificates.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.KeylessCertificates.KeylessSslForAZoneNewKeylessSslConfiguration( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParams{ + Certificate: cloudflare.F("-----BEGIN CERTIFICATE----- MIIDtTCCAp2gAwIBAgIJAM15n7fdxhRtMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV BAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX aWRnaXRzIFB0eSBMdGQwHhcNMTQwMzExMTkyMTU5WhcNMTQwNDEwMTkyMTU5WjBF MQswCQYDVQQGEwJVUzETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB CgKCAQEAvq3sKsHpeduJHimOK+fvQdKsI8z8A05MZyyLp2/R/GE8FjNv+hkVY1WQ LIyTNNQH7CJecE1nbTfo8Y56S7x/rhxC6/DJ8MIulapFPnorq46KU6yRxiM0MQ3N nTJHlHA2ozZta6YBBfVfhHWl1F0IfNbXCLKvGwWWMbCx43OfW6KTkbRnE6gFWKuO fSO5h2u5TaWVuSIzBvYs7Vza6m+gtYAvKAJV2nSZ+eSEFPDo29corOy8+huEOUL8 5FAw4BFPsr1TlrlGPFitduQUHGrSL7skk1ESGza0to3bOtrodKei2s9bk5MXm7lZ qI+WZJX4Zu9+mzZhc9pCVi8r/qlXuQIDAQABo4GnMIGkMB0GA1UdDgQWBBRvavf+ sWM4IwKiH9X9w1vl6nUVRDB1BgNVHSMEbjBsgBRvavf+sWM4IwKiH9X9w1vl6nUV RKFJpEcwRTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAM15n7fdxhRtMAwGA1UdEwQF MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBABY2ZzBaW0dMsAAT7tPJzrVWVzQx6KU4 UEBLudIlWPlkAwTnINCWR/8eNjCCmGA4heUdHmazdpPa8RzwOmc0NT1NQqzSyktt vTqb4iHD7+8f9MqJ9/FssCfTtqr/Qst/hGH4Wmdf1EJ/6FqYAAb5iRlPgshFZxU8 uXtA8hWn6fK6eISD9HBdcAFToUvKNZ1BIDPvh9f95Ine8ar6yGd56TUNrHR8eHBs ESxz5ddVR/oWRysNJ+aGAyYqHS8S/ttmC7r4XCAHqXptkHPCGRqkAhsterYhd4I8 /cBzejUobNCjjHFbtkAL/SjxZOLW+pNkZwfeYdM8iPkD54Uua1v2tdw= -----END CERTIFICATE-----"), + Host: cloudflare.F("example.com"), + Port: cloudflare.F(24008.000000), + BundleMethod: cloudflare.F(cloudflare.ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsBundleMethodUbiquitous), + Name: cloudflare.F("example.com Keyless SSL"), + Tunnel: cloudflare.F(cloudflare.ZoneKeylessCertificateKeylessSslForAZoneNewKeylessSslConfigurationParamsTunnel{ + PrivateIP: cloudflare.F("10.0.0.1"), + VnetID: cloudflare.F("7365377a-85a4-4390-9480-531ef7dc7a3c"), + }), + }, + ) + 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 TestZoneKeylessCertificateKeylessSslForAZoneListKeylessSslConfigurations(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.KeylessCertificates.KeylessSslForAZoneListKeylessSslConfigurations(context.TODO(), "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/zoneloadbalancer.go b/zoneloadbalancer.go index 55c2fe005cd..ce7dfb919a0 100644 --- a/zoneloadbalancer.go +++ b/zoneloadbalancer.go @@ -33,131 +33,53 @@ func NewZoneLoadBalancerService(opts ...option.RequestOption) (r *ZoneLoadBalanc } // Create a new load balancer. -func (r *ZoneLoadBalancerService) New(ctx context.Context, identifier interface{}, body ZoneLoadBalancerNewParams, opts ...option.RequestOption) (res *LoadBalancer, err error) { +func (r *ZoneLoadBalancerService) New(ctx context.Context, identifier string, body ZoneLoadBalancerNewParams, opts ...option.RequestOption) (res *LoadBalancer, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%v/load_balancers", identifier) + path := fmt.Sprintf("zones/%s/load_balancers", identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return } // Fetch a single configured load balancer. -func (r *ZoneLoadBalancerService) Get(ctx context.Context, identifier1 interface{}, identifier interface{}, opts ...option.RequestOption) (res *LoadBalancer, err error) { +func (r *ZoneLoadBalancerService) Get(ctx context.Context, identifier1 string, identifier string, opts ...option.RequestOption) (res *LoadBalancer, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%v/load_balancers/%v", identifier1, identifier) + path := fmt.Sprintf("zones/%s/load_balancers/%s", identifier1, identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) return } // Update a configured load balancer. -func (r *ZoneLoadBalancerService) Update(ctx context.Context, identifier1 interface{}, identifier interface{}, body ZoneLoadBalancerUpdateParams, opts ...option.RequestOption) (res *LoadBalancer, err error) { +func (r *ZoneLoadBalancerService) Update(ctx context.Context, identifier1 string, identifier string, body ZoneLoadBalancerUpdateParams, opts ...option.RequestOption) (res *LoadBalancer, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%v/load_balancers/%v", identifier1, identifier) + path := fmt.Sprintf("zones/%s/load_balancers/%s", identifier1, identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) return } // List configured load balancers. -func (r *ZoneLoadBalancerService) List(ctx context.Context, identifier interface{}, opts ...option.RequestOption) (res *LoadBalancerCollection, err error) { +func (r *ZoneLoadBalancerService) List(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneLoadBalancerListResponse, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%v/load_balancers", identifier) + path := fmt.Sprintf("zones/%s/load_balancers", identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) return } // Delete a configured load balancer. -func (r *ZoneLoadBalancerService) Delete(ctx context.Context, identifier1 interface{}, identifier interface{}, opts ...option.RequestOption) (res *IDResponseZtdTboH6, err error) { +func (r *ZoneLoadBalancerService) Delete(ctx context.Context, identifier1 string, identifier string, opts ...option.RequestOption) (res *ZoneLoadBalancerDeleteResponse, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%v/load_balancers/%v", identifier1, identifier) + path := fmt.Sprintf("zones/%s/load_balancers/%s", identifier1, identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } -type IDResponseZtdTboH6 struct { - Errors []IDResponseZtdTboH6Error `json:"errors"` - Messages []IDResponseZtdTboH6Message `json:"messages"` - Result IDResponseZtdTboH6Result `json:"result"` - // Whether the API call was successful - Success IDResponseZtdTboH6Success `json:"success"` - JSON idResponseZtdTboH6JSON `json:"-"` -} - -// idResponseZtdTboH6JSON contains the JSON metadata for the struct -// [IDResponseZtdTboH6] -type idResponseZtdTboH6JSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IDResponseZtdTboH6) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type IDResponseZtdTboH6Error struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON idResponseZtdTboH6ErrorJSON `json:"-"` -} - -// idResponseZtdTboH6ErrorJSON contains the JSON metadata for the struct -// [IDResponseZtdTboH6Error] -type idResponseZtdTboH6ErrorJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IDResponseZtdTboH6Error) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type IDResponseZtdTboH6Message struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON idResponseZtdTboH6MessageJSON `json:"-"` -} - -// idResponseZtdTboH6MessageJSON contains the JSON metadata for the struct -// [IDResponseZtdTboH6Message] -type idResponseZtdTboH6MessageJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IDResponseZtdTboH6Message) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type IDResponseZtdTboH6Result struct { - ID interface{} `json:"id"` - JSON idResponseZtdTboH6ResultJSON `json:"-"` -} - -// idResponseZtdTboH6ResultJSON contains the JSON metadata for the struct -// [IDResponseZtdTboH6Result] -type idResponseZtdTboH6ResultJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IDResponseZtdTboH6Result) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// Apply changes to an existing load balancer, overwriting the supplied properties. +func (r *ZoneLoadBalancerService) Patch(ctx context.Context, identifier1 string, identifier string, body ZoneLoadBalancerPatchParams, opts ...option.RequestOption) (res *LoadBalancer, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/load_balancers/%s", identifier1, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return } -// Whether the API call was successful -type IDResponseZtdTboH6Success bool - -const ( - IDResponseZtdTboH6SuccessTrue IDResponseZtdTboH6Success = true -) - type LoadBalancer struct { Errors []LoadBalancerError `json:"errors"` Messages []LoadBalancerMessage `json:"messages"` @@ -220,7 +142,7 @@ func (r *LoadBalancerMessage) UnmarshalJSON(data []byte) (err error) { } type LoadBalancerResult struct { - ID interface{} `json:"id"` + ID string `json:"id"` // Controls features that modify the routing of requests to pools and origins in // response to dynamic conditions, such as during the interval between active // health monitoring requests. For example, zero-downtime failover occurs @@ -258,8 +180,14 @@ type LoadBalancerResult struct { PopPools interface{} `json:"pop_pools"` // Whether the hostname should be gray clouded (false) or orange clouded (true). Proxied bool `json:"proxied"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. RandomSteering LoadBalancerResultRandomSteering `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall @@ -268,14 +196,18 @@ type LoadBalancerResult struct { // BETA Field Not General Access: A list of rules for this load balancer to // execute. Rules []LoadBalancerResultRule `json:"rules"` - // Configures cookie attributes for session affinity cookie. + // Configures attributes for session affinity. SessionAffinityAttributes LoadBalancerResultSessionAffinityAttributes `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl float64 `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -289,6 +221,14 @@ type LoadBalancerResult struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. SteeringPolicy LoadBalancerResultSteeringPolicy `json:"steering_policy"` @@ -421,8 +361,14 @@ const ( LoadBalancerResultLocationStrategyPreferEcsGeo LoadBalancerResultLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. type LoadBalancerResultRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. @@ -553,21 +499,31 @@ type LoadBalancerResultRulesOverrides struct { // explicitly defined will fall back to using the corresponding country_pool, then // region_pool mapping if it exists else to default_pools. PopPools interface{} `json:"pop_pools"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. RandomSteering LoadBalancerResultRulesOverridesRandomSteering `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall // back to using default_pools. RegionPools interface{} `json:"region_pools"` - // Configures cookie attributes for session affinity cookie. + // Configures attributes for session affinity. SessionAffinityAttributes LoadBalancerResultRulesOverridesSessionAffinityAttributes `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl float64 `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -581,6 +537,14 @@ type LoadBalancerResultRulesOverrides struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. SteeringPolicy LoadBalancerResultRulesOverridesSteeringPolicy `json:"steering_policy"` @@ -705,8 +669,14 @@ const ( LoadBalancerResultRulesOverridesLocationStrategyPreferEcsGeo LoadBalancerResultRulesOverridesLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. type LoadBalancerResultRulesOverridesRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. @@ -730,11 +700,64 @@ func (r *LoadBalancerResultRulesOverridesRandomSteering) UnmarshalJSON(data []by return apijson.UnmarshalRoot(data, r) } -// Configures cookie attributes for session affinity cookie. +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type LoadBalancerResultRulesOverridesSessionAffinity string + +const ( + LoadBalancerResultRulesOverridesSessionAffinityNone LoadBalancerResultRulesOverridesSessionAffinity = "none" + LoadBalancerResultRulesOverridesSessionAffinityCookie LoadBalancerResultRulesOverridesSessionAffinity = "cookie" + LoadBalancerResultRulesOverridesSessionAffinityIPCookie LoadBalancerResultRulesOverridesSessionAffinity = "ip_cookie" + LoadBalancerResultRulesOverridesSessionAffinityHeader LoadBalancerResultRulesOverridesSessionAffinity = "header" + LoadBalancerResultRulesOverridesSessionAffinityEmpty LoadBalancerResultRulesOverridesSessionAffinity = "\"\"" +) + +// Configures attributes for session affinity. type LoadBalancerResultRulesOverridesSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration float64 `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers []string `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders bool `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". @@ -745,13 +768,16 @@ type LoadBalancerResultRulesOverridesSessionAffinityAttributes struct { // attribute depending if Always Use HTTPS is enabled. Secure LoadBalancerResultRulesOverridesSessionAffinityAttributesSecure `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. ZeroDowntimeFailover LoadBalancerResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover `json:"zero_downtime_failover"` JSON loadBalancerResultRulesOverridesSessionAffinityAttributesJSON `json:"-"` } @@ -761,6 +787,8 @@ type LoadBalancerResultRulesOverridesSessionAffinityAttributes struct { // [LoadBalancerResultRulesOverridesSessionAffinityAttributes] type loadBalancerResultRulesOverridesSessionAffinityAttributesJSON struct { DrainDuration apijson.Field + Headers apijson.Field + RequireAllHeaders apijson.Field Samesite apijson.Field Secure apijson.Field ZeroDowntimeFailover apijson.Field @@ -797,13 +825,16 @@ const ( ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. type LoadBalancerResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover string const ( @@ -824,24 +855,87 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. type LoadBalancerResultRulesOverridesSteeringPolicy string const ( - LoadBalancerResultRulesOverridesSteeringPolicyOff LoadBalancerResultRulesOverridesSteeringPolicy = "off" - LoadBalancerResultRulesOverridesSteeringPolicyGeo LoadBalancerResultRulesOverridesSteeringPolicy = "geo" - LoadBalancerResultRulesOverridesSteeringPolicyRandom LoadBalancerResultRulesOverridesSteeringPolicy = "random" - LoadBalancerResultRulesOverridesSteeringPolicyDynamicLatency LoadBalancerResultRulesOverridesSteeringPolicy = "dynamic_latency" - LoadBalancerResultRulesOverridesSteeringPolicyProximity LoadBalancerResultRulesOverridesSteeringPolicy = "proximity" - LoadBalancerResultRulesOverridesSteeringPolicyEmpty LoadBalancerResultRulesOverridesSteeringPolicy = "\"\"" + LoadBalancerResultRulesOverridesSteeringPolicyOff LoadBalancerResultRulesOverridesSteeringPolicy = "off" + LoadBalancerResultRulesOverridesSteeringPolicyGeo LoadBalancerResultRulesOverridesSteeringPolicy = "geo" + LoadBalancerResultRulesOverridesSteeringPolicyRandom LoadBalancerResultRulesOverridesSteeringPolicy = "random" + LoadBalancerResultRulesOverridesSteeringPolicyDynamicLatency LoadBalancerResultRulesOverridesSteeringPolicy = "dynamic_latency" + LoadBalancerResultRulesOverridesSteeringPolicyProximity LoadBalancerResultRulesOverridesSteeringPolicy = "proximity" + LoadBalancerResultRulesOverridesSteeringPolicyLeastOutstandingRequests LoadBalancerResultRulesOverridesSteeringPolicy = "least_outstanding_requests" + LoadBalancerResultRulesOverridesSteeringPolicyLeastConnections LoadBalancerResultRulesOverridesSteeringPolicy = "least_connections" + LoadBalancerResultRulesOverridesSteeringPolicyEmpty LoadBalancerResultRulesOverridesSteeringPolicy = "\"\"" +) + +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type LoadBalancerResultSessionAffinity string + +const ( + LoadBalancerResultSessionAffinityNone LoadBalancerResultSessionAffinity = "none" + LoadBalancerResultSessionAffinityCookie LoadBalancerResultSessionAffinity = "cookie" + LoadBalancerResultSessionAffinityIPCookie LoadBalancerResultSessionAffinity = "ip_cookie" + LoadBalancerResultSessionAffinityHeader LoadBalancerResultSessionAffinity = "header" + LoadBalancerResultSessionAffinityEmpty LoadBalancerResultSessionAffinity = "\"\"" ) -// Configures cookie attributes for session affinity cookie. +// Configures attributes for session affinity. type LoadBalancerResultSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration float64 `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers []string `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders bool `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". @@ -852,13 +946,16 @@ type LoadBalancerResultSessionAffinityAttributes struct { // attribute depending if Always Use HTTPS is enabled. Secure LoadBalancerResultSessionAffinityAttributesSecure `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. ZeroDowntimeFailover LoadBalancerResultSessionAffinityAttributesZeroDowntimeFailover `json:"zero_downtime_failover"` JSON loadBalancerResultSessionAffinityAttributesJSON `json:"-"` } @@ -867,6 +964,8 @@ type LoadBalancerResultSessionAffinityAttributes struct { // the struct [LoadBalancerResultSessionAffinityAttributes] type loadBalancerResultSessionAffinityAttributesJSON struct { DrainDuration apijson.Field + Headers apijson.Field + RequireAllHeaders apijson.Field Samesite apijson.Field Secure apijson.Field ZeroDowntimeFailover apijson.Field @@ -903,13 +1002,16 @@ const ( ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. type LoadBalancerResultSessionAffinityAttributesZeroDowntimeFailover string const ( @@ -930,17 +1032,27 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. type LoadBalancerResultSteeringPolicy string const ( - LoadBalancerResultSteeringPolicyOff LoadBalancerResultSteeringPolicy = "off" - LoadBalancerResultSteeringPolicyGeo LoadBalancerResultSteeringPolicy = "geo" - LoadBalancerResultSteeringPolicyRandom LoadBalancerResultSteeringPolicy = "random" - LoadBalancerResultSteeringPolicyDynamicLatency LoadBalancerResultSteeringPolicy = "dynamic_latency" - LoadBalancerResultSteeringPolicyProximity LoadBalancerResultSteeringPolicy = "proximity" - LoadBalancerResultSteeringPolicyEmpty LoadBalancerResultSteeringPolicy = "\"\"" + LoadBalancerResultSteeringPolicyOff LoadBalancerResultSteeringPolicy = "off" + LoadBalancerResultSteeringPolicyGeo LoadBalancerResultSteeringPolicy = "geo" + LoadBalancerResultSteeringPolicyRandom LoadBalancerResultSteeringPolicy = "random" + LoadBalancerResultSteeringPolicyDynamicLatency LoadBalancerResultSteeringPolicy = "dynamic_latency" + LoadBalancerResultSteeringPolicyProximity LoadBalancerResultSteeringPolicy = "proximity" + LoadBalancerResultSteeringPolicyLeastOutstandingRequests LoadBalancerResultSteeringPolicy = "least_outstanding_requests" + LoadBalancerResultSteeringPolicyLeastConnections LoadBalancerResultSteeringPolicy = "least_connections" + LoadBalancerResultSteeringPolicyEmpty LoadBalancerResultSteeringPolicy = "\"\"" ) // Whether the API call was successful @@ -950,19 +1062,19 @@ const ( LoadBalancerSuccessTrue LoadBalancerSuccess = true ) -type LoadBalancerCollection struct { - Errors []LoadBalancerCollectionError `json:"errors"` - Messages []LoadBalancerCollectionMessage `json:"messages"` - Result []LoadBalancerCollectionResult `json:"result"` - ResultInfo LoadBalancerCollectionResultInfo `json:"result_info"` +type ZoneLoadBalancerListResponse struct { + Errors []ZoneLoadBalancerListResponseError `json:"errors"` + Messages []ZoneLoadBalancerListResponseMessage `json:"messages"` + Result []ZoneLoadBalancerListResponseResult `json:"result"` + ResultInfo ZoneLoadBalancerListResponseResultInfo `json:"result_info"` // Whether the API call was successful - Success LoadBalancerCollectionSuccess `json:"success"` - JSON loadBalancerCollectionJSON `json:"-"` + Success ZoneLoadBalancerListResponseSuccess `json:"success"` + JSON zoneLoadBalancerListResponseJSON `json:"-"` } -// loadBalancerCollectionJSON contains the JSON metadata for the struct -// [LoadBalancerCollection] -type loadBalancerCollectionJSON struct { +// zoneLoadBalancerListResponseJSON contains the JSON metadata for the struct +// [ZoneLoadBalancerListResponse] +type zoneLoadBalancerListResponseJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -972,57 +1084,57 @@ type loadBalancerCollectionJSON struct { ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollection) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type LoadBalancerCollectionError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON loadBalancerCollectionErrorJSON `json:"-"` +type ZoneLoadBalancerListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLoadBalancerListResponseErrorJSON `json:"-"` } -// loadBalancerCollectionErrorJSON contains the JSON metadata for the struct -// [LoadBalancerCollectionError] -type loadBalancerCollectionErrorJSON struct { +// zoneLoadBalancerListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneLoadBalancerListResponseError] +type zoneLoadBalancerListResponseErrorJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionError) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type LoadBalancerCollectionMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON loadBalancerCollectionMessageJSON `json:"-"` +type ZoneLoadBalancerListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLoadBalancerListResponseMessageJSON `json:"-"` } -// loadBalancerCollectionMessageJSON contains the JSON metadata for the struct -// [LoadBalancerCollectionMessage] -type loadBalancerCollectionMessageJSON struct { +// zoneLoadBalancerListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneLoadBalancerListResponseMessage] +type zoneLoadBalancerListResponseMessageJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionMessage) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseMessage) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type LoadBalancerCollectionResult struct { - ID interface{} `json:"id"` +type ZoneLoadBalancerListResponseResult struct { + ID string `json:"id"` // Controls features that modify the routing of requests to pools and origins in // response to dynamic conditions, such as during the interval between active // health monitoring requests. For example, zero-downtime failover occurs // immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 // response codes. If there is another healthy origin in the same pool, the request // is retried once against this alternate origin. - AdaptiveRouting LoadBalancerCollectionResultAdaptiveRouting `json:"adaptive_routing"` + AdaptiveRouting ZoneLoadBalancerListResponseResultAdaptiveRouting `json:"adaptive_routing"` // A mapping of country codes to a list of pool IDs (ordered by their failover // priority) for the given country. Any country not explicitly defined will fall // back to using the corresponding region_pool mapping if it exists else to @@ -1040,8 +1152,8 @@ type LoadBalancerCollectionResult struct { FallbackPool interface{} `json:"fallback_pool"` // Controls location-based steering for non-proxied requests. See `steering_policy` // to learn how steering is affected. - LocationStrategy LoadBalancerCollectionResultLocationStrategy `json:"location_strategy"` - ModifiedOn time.Time `json:"modified_on" format:"date-time"` + LocationStrategy ZoneLoadBalancerListResponseResultLocationStrategy `json:"location_strategy"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` // The DNS hostname to associate with your Load Balancer. If this hostname already // exists as a DNS record in Cloudflare's DNS, the Load Balancer will take // precedence and the DNS record will not be used. @@ -1053,24 +1165,34 @@ type LoadBalancerCollectionResult struct { PopPools interface{} `json:"pop_pools"` // Whether the hostname should be gray clouded (false) or orange clouded (true). Proxied bool `json:"proxied"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. - RandomSteering LoadBalancerCollectionResultRandomSteering `json:"random_steering"` + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. + RandomSteering ZoneLoadBalancerListResponseResultRandomSteering `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall // back to using default_pools. RegionPools interface{} `json:"region_pools"` // BETA Field Not General Access: A list of rules for this load balancer to // execute. - Rules []LoadBalancerCollectionResultRule `json:"rules"` - // Configures cookie attributes for session affinity cookie. - SessionAffinityAttributes LoadBalancerCollectionResultSessionAffinityAttributes `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + Rules []ZoneLoadBalancerListResponseResultRule `json:"rules"` + // Configures attributes for session affinity. + SessionAffinityAttributes ZoneLoadBalancerListResponseResultSessionAffinityAttributes `json:"session_affinity_attributes"` + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl float64 `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -1084,18 +1206,26 @@ type LoadBalancerCollectionResult struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy LoadBalancerCollectionResultSteeringPolicy `json:"steering_policy"` + SteeringPolicy ZoneLoadBalancerListResponseResultSteeringPolicy `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. - Ttl float64 `json:"ttl"` - JSON loadBalancerCollectionResultJSON `json:"-"` + Ttl float64 `json:"ttl"` + JSON zoneLoadBalancerListResponseResultJSON `json:"-"` } -// loadBalancerCollectionResultJSON contains the JSON metadata for the struct -// [LoadBalancerCollectionResult] -type loadBalancerCollectionResultJSON struct { +// zoneLoadBalancerListResponseResultJSON contains the JSON metadata for the struct +// [ZoneLoadBalancerListResponseResult] +type zoneLoadBalancerListResponseResultJSON struct { ID apijson.Field AdaptiveRouting apijson.Field CountryPools apijson.Field @@ -1120,7 +1250,7 @@ type loadBalancerCollectionResultJSON struct { ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResult) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } @@ -1130,39 +1260,39 @@ func (r *LoadBalancerCollectionResult) UnmarshalJSON(data []byte) (err error) { // immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 // response codes. If there is another healthy origin in the same pool, the request // is retried once against this alternate origin. -type LoadBalancerCollectionResultAdaptiveRouting struct { +type ZoneLoadBalancerListResponseResultAdaptiveRouting struct { // Extends zero-downtime failover of requests to healthy origins from alternate // pools, when no healthy alternate exists in the same pool, according to the // failover order defined by traffic and origin steering. When set false (the // default) zero-downtime failover will only occur between origins within the same // pool. See `session_affinity_attributes` for control over when sessions are // broken or reassigned. - FailoverAcrossPools bool `json:"failover_across_pools"` - JSON loadBalancerCollectionResultAdaptiveRoutingJSON `json:"-"` + FailoverAcrossPools bool `json:"failover_across_pools"` + JSON zoneLoadBalancerListResponseResultAdaptiveRoutingJSON `json:"-"` } -// loadBalancerCollectionResultAdaptiveRoutingJSON contains the JSON metadata for -// the struct [LoadBalancerCollectionResultAdaptiveRouting] -type loadBalancerCollectionResultAdaptiveRoutingJSON struct { +// zoneLoadBalancerListResponseResultAdaptiveRoutingJSON contains the JSON metadata +// for the struct [ZoneLoadBalancerListResponseResultAdaptiveRouting] +type zoneLoadBalancerListResponseResultAdaptiveRoutingJSON struct { FailoverAcrossPools apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultAdaptiveRouting) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultAdaptiveRouting) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Controls location-based steering for non-proxied requests. See `steering_policy` // to learn how steering is affected. -type LoadBalancerCollectionResultLocationStrategy struct { +type ZoneLoadBalancerListResponseResultLocationStrategy struct { // Determines the authoritative location when ECS is not preferred, does not exist // in the request, or its GeoIP lookup is unsuccessful. // // - `"pop"`: Use the Cloudflare PoP location. // - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is // unsuccessful, use the Cloudflare PoP location. - Mode LoadBalancerCollectionResultLocationStrategyMode `json:"mode"` + Mode ZoneLoadBalancerListResponseResultLocationStrategyMode `json:"mode"` // Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the // authoritative location. // @@ -1170,20 +1300,20 @@ type LoadBalancerCollectionResultLocationStrategy struct { // - `"never"`: Never prefer ECS. // - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. // - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - PreferEcs LoadBalancerCollectionResultLocationStrategyPreferEcs `json:"prefer_ecs"` - JSON loadBalancerCollectionResultLocationStrategyJSON `json:"-"` + PreferEcs ZoneLoadBalancerListResponseResultLocationStrategyPreferEcs `json:"prefer_ecs"` + JSON zoneLoadBalancerListResponseResultLocationStrategyJSON `json:"-"` } -// loadBalancerCollectionResultLocationStrategyJSON contains the JSON metadata for -// the struct [LoadBalancerCollectionResultLocationStrategy] -type loadBalancerCollectionResultLocationStrategyJSON struct { +// zoneLoadBalancerListResponseResultLocationStrategyJSON contains the JSON +// metadata for the struct [ZoneLoadBalancerListResponseResultLocationStrategy] +type zoneLoadBalancerListResponseResultLocationStrategyJSON struct { Mode apijson.Field PreferEcs apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultLocationStrategy) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultLocationStrategy) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } @@ -1193,11 +1323,11 @@ func (r *LoadBalancerCollectionResultLocationStrategy) UnmarshalJSON(data []byte // - `"pop"`: Use the Cloudflare PoP location. // - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is // unsuccessful, use the Cloudflare PoP location. -type LoadBalancerCollectionResultLocationStrategyMode string +type ZoneLoadBalancerListResponseResultLocationStrategyMode string const ( - LoadBalancerCollectionResultLocationStrategyModePop LoadBalancerCollectionResultLocationStrategyMode = "pop" - LoadBalancerCollectionResultLocationStrategyModeResolverIP LoadBalancerCollectionResultLocationStrategyMode = "resolver_ip" + ZoneLoadBalancerListResponseResultLocationStrategyModePop ZoneLoadBalancerListResponseResultLocationStrategyMode = "pop" + ZoneLoadBalancerListResponseResultLocationStrategyModeResolverIP ZoneLoadBalancerListResponseResultLocationStrategyMode = "resolver_ip" ) // Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the @@ -1207,43 +1337,49 @@ const ( // - `"never"`: Never prefer ECS. // - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. // - `"geo"`: Prefer ECS only when `steering_policy="geo"`. -type LoadBalancerCollectionResultLocationStrategyPreferEcs string +type ZoneLoadBalancerListResponseResultLocationStrategyPreferEcs string const ( - LoadBalancerCollectionResultLocationStrategyPreferEcsAlways LoadBalancerCollectionResultLocationStrategyPreferEcs = "always" - LoadBalancerCollectionResultLocationStrategyPreferEcsNever LoadBalancerCollectionResultLocationStrategyPreferEcs = "never" - LoadBalancerCollectionResultLocationStrategyPreferEcsProximity LoadBalancerCollectionResultLocationStrategyPreferEcs = "proximity" - LoadBalancerCollectionResultLocationStrategyPreferEcsGeo LoadBalancerCollectionResultLocationStrategyPreferEcs = "geo" + ZoneLoadBalancerListResponseResultLocationStrategyPreferEcsAlways ZoneLoadBalancerListResponseResultLocationStrategyPreferEcs = "always" + ZoneLoadBalancerListResponseResultLocationStrategyPreferEcsNever ZoneLoadBalancerListResponseResultLocationStrategyPreferEcs = "never" + ZoneLoadBalancerListResponseResultLocationStrategyPreferEcsProximity ZoneLoadBalancerListResponseResultLocationStrategyPreferEcs = "proximity" + ZoneLoadBalancerListResponseResultLocationStrategyPreferEcsGeo ZoneLoadBalancerListResponseResultLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. -type LoadBalancerCollectionResultRandomSteering struct { +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. +type ZoneLoadBalancerListResponseResultRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. DefaultWeight float64 `json:"default_weight"` // A mapping of pool IDs to custom weights. The weight is relative to other pools // in the load balancer. - PoolWeights interface{} `json:"pool_weights"` - JSON loadBalancerCollectionResultRandomSteeringJSON `json:"-"` + PoolWeights interface{} `json:"pool_weights"` + JSON zoneLoadBalancerListResponseResultRandomSteeringJSON `json:"-"` } -// loadBalancerCollectionResultRandomSteeringJSON contains the JSON metadata for -// the struct [LoadBalancerCollectionResultRandomSteering] -type loadBalancerCollectionResultRandomSteeringJSON struct { +// zoneLoadBalancerListResponseResultRandomSteeringJSON contains the JSON metadata +// for the struct [ZoneLoadBalancerListResponseResultRandomSteering] +type zoneLoadBalancerListResponseResultRandomSteeringJSON struct { DefaultWeight apijson.Field PoolWeights apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRandomSteering) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRandomSteering) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // A rule object containing conditions and overrides for this load balancer to // evaluate. -type LoadBalancerCollectionResultRule struct { +type ZoneLoadBalancerListResponseResultRule struct { // The condition expressions to evaluate. If the condition evaluates to true, the // overrides or fixed_response in this rule will be applied. An empty condition is // always true. For more details on condition expressions, please see @@ -1255,12 +1391,12 @@ type LoadBalancerCollectionResultRule struct { // A collection of fields used to directly respond to the eyeball instead of // routing to a pool. If a fixed_response is supplied the rule will be marked as // terminates. - FixedResponse LoadBalancerCollectionResultRulesFixedResponse `json:"fixed_response"` + FixedResponse ZoneLoadBalancerListResponseResultRulesFixedResponse `json:"fixed_response"` // Name of this rule. Only used for human readability. Name string `json:"name"` // A collection of overrides to apply to the load balancer when this rule's // condition is true. All fields are optional. - Overrides LoadBalancerCollectionResultRulesOverrides `json:"overrides"` + Overrides ZoneLoadBalancerListResponseResultRulesOverrides `json:"overrides"` // The order in which rules should be executed in relation to each other. Lower // values are executed first. Values do not need to be sequential. If no value is // provided for any rule the array order of the rules field will be used to assign @@ -1268,13 +1404,13 @@ type LoadBalancerCollectionResultRule struct { Priority int64 `json:"priority"` // If this rule's condition is true, this causes rule evaluation to stop after // processing this rule. - Terminates bool `json:"terminates"` - JSON loadBalancerCollectionResultRuleJSON `json:"-"` + Terminates bool `json:"terminates"` + JSON zoneLoadBalancerListResponseResultRuleJSON `json:"-"` } -// loadBalancerCollectionResultRuleJSON contains the JSON metadata for the struct -// [LoadBalancerCollectionResultRule] -type loadBalancerCollectionResultRuleJSON struct { +// zoneLoadBalancerListResponseResultRuleJSON contains the JSON metadata for the +// struct [ZoneLoadBalancerListResponseResultRule] +type zoneLoadBalancerListResponseResultRuleJSON struct { Condition apijson.Field Disabled apijson.Field FixedResponse apijson.Field @@ -1286,14 +1422,14 @@ type loadBalancerCollectionResultRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRule) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // A collection of fields used to directly respond to the eyeball instead of // routing to a pool. If a fixed_response is supplied the rule will be marked as // terminates. -type LoadBalancerCollectionResultRulesFixedResponse struct { +type ZoneLoadBalancerListResponseResultRulesFixedResponse struct { // The http 'Content-Type' header to include in the response. ContentType string `json:"content_type"` // The http 'Location' header to include in the response. @@ -1301,13 +1437,13 @@ type LoadBalancerCollectionResultRulesFixedResponse struct { // Text to include as the http body. MessageBody string `json:"message_body"` // The http status code to respond with. - StatusCode int64 `json:"status_code"` - JSON loadBalancerCollectionResultRulesFixedResponseJSON `json:"-"` + StatusCode int64 `json:"status_code"` + JSON zoneLoadBalancerListResponseResultRulesFixedResponseJSON `json:"-"` } -// loadBalancerCollectionResultRulesFixedResponseJSON contains the JSON metadata -// for the struct [LoadBalancerCollectionResultRulesFixedResponse] -type loadBalancerCollectionResultRulesFixedResponseJSON struct { +// zoneLoadBalancerListResponseResultRulesFixedResponseJSON contains the JSON +// metadata for the struct [ZoneLoadBalancerListResponseResultRulesFixedResponse] +type zoneLoadBalancerListResponseResultRulesFixedResponseJSON struct { ContentType apijson.Field Location apijson.Field MessageBody apijson.Field @@ -1316,20 +1452,20 @@ type loadBalancerCollectionResultRulesFixedResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRulesFixedResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRulesFixedResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // A collection of overrides to apply to the load balancer when this rule's // condition is true. All fields are optional. -type LoadBalancerCollectionResultRulesOverrides struct { +type ZoneLoadBalancerListResponseResultRulesOverrides struct { // Controls features that modify the routing of requests to pools and origins in // response to dynamic conditions, such as during the interval between active // health monitoring requests. For example, zero-downtime failover occurs // immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 // response codes. If there is another healthy origin in the same pool, the request // is retried once against this alternate origin. - AdaptiveRouting LoadBalancerCollectionResultRulesOverridesAdaptiveRouting `json:"adaptive_routing"` + AdaptiveRouting ZoneLoadBalancerListResponseResultRulesOverridesAdaptiveRouting `json:"adaptive_routing"` // A mapping of country codes to a list of pool IDs (ordered by their failover // priority) for the given country. Any country not explicitly defined will fall // back to using the corresponding region_pool mapping if it exists else to @@ -1342,27 +1478,37 @@ type LoadBalancerCollectionResultRulesOverrides struct { FallbackPool interface{} `json:"fallback_pool"` // Controls location-based steering for non-proxied requests. See `steering_policy` // to learn how steering is affected. - LocationStrategy LoadBalancerCollectionResultRulesOverridesLocationStrategy `json:"location_strategy"` + LocationStrategy ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategy `json:"location_strategy"` // (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs // (ordered by their failover priority) for the PoP (datacenter). Any PoPs not // explicitly defined will fall back to using the corresponding country_pool, then // region_pool mapping if it exists else to default_pools. PopPools interface{} `json:"pop_pools"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. - RandomSteering LoadBalancerCollectionResultRulesOverridesRandomSteering `json:"random_steering"` + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. + RandomSteering ZoneLoadBalancerListResponseResultRulesOverridesRandomSteering `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall // back to using default_pools. RegionPools interface{} `json:"region_pools"` - // Configures cookie attributes for session affinity cookie. - SessionAffinityAttributes LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributes `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + // Configures attributes for session affinity. + SessionAffinityAttributes ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributes `json:"session_affinity_attributes"` + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl float64 `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -1376,18 +1522,26 @@ type LoadBalancerCollectionResultRulesOverrides struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy LoadBalancerCollectionResultRulesOverridesSteeringPolicy `json:"steering_policy"` + SteeringPolicy ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. - Ttl float64 `json:"ttl"` - JSON loadBalancerCollectionResultRulesOverridesJSON `json:"-"` + Ttl float64 `json:"ttl"` + JSON zoneLoadBalancerListResponseResultRulesOverridesJSON `json:"-"` } -// loadBalancerCollectionResultRulesOverridesJSON contains the JSON metadata for -// the struct [LoadBalancerCollectionResultRulesOverrides] -type loadBalancerCollectionResultRulesOverridesJSON struct { +// zoneLoadBalancerListResponseResultRulesOverridesJSON contains the JSON metadata +// for the struct [ZoneLoadBalancerListResponseResultRulesOverrides] +type zoneLoadBalancerListResponseResultRulesOverridesJSON struct { AdaptiveRouting apijson.Field CountryPools apijson.Field DefaultPools apijson.Field @@ -1404,7 +1558,7 @@ type loadBalancerCollectionResultRulesOverridesJSON struct { ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRulesOverrides) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRulesOverrides) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } @@ -1414,40 +1568,40 @@ func (r *LoadBalancerCollectionResultRulesOverrides) UnmarshalJSON(data []byte) // immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 // response codes. If there is another healthy origin in the same pool, the request // is retried once against this alternate origin. -type LoadBalancerCollectionResultRulesOverridesAdaptiveRouting struct { +type ZoneLoadBalancerListResponseResultRulesOverridesAdaptiveRouting struct { // Extends zero-downtime failover of requests to healthy origins from alternate // pools, when no healthy alternate exists in the same pool, according to the // failover order defined by traffic and origin steering. When set false (the // default) zero-downtime failover will only occur between origins within the same // pool. See `session_affinity_attributes` for control over when sessions are // broken or reassigned. - FailoverAcrossPools bool `json:"failover_across_pools"` - JSON loadBalancerCollectionResultRulesOverridesAdaptiveRoutingJSON `json:"-"` + FailoverAcrossPools bool `json:"failover_across_pools"` + JSON zoneLoadBalancerListResponseResultRulesOverridesAdaptiveRoutingJSON `json:"-"` } -// loadBalancerCollectionResultRulesOverridesAdaptiveRoutingJSON contains the JSON -// metadata for the struct -// [LoadBalancerCollectionResultRulesOverridesAdaptiveRouting] -type loadBalancerCollectionResultRulesOverridesAdaptiveRoutingJSON struct { +// zoneLoadBalancerListResponseResultRulesOverridesAdaptiveRoutingJSON contains the +// JSON metadata for the struct +// [ZoneLoadBalancerListResponseResultRulesOverridesAdaptiveRouting] +type zoneLoadBalancerListResponseResultRulesOverridesAdaptiveRoutingJSON struct { FailoverAcrossPools apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRulesOverridesAdaptiveRouting) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRulesOverridesAdaptiveRouting) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Controls location-based steering for non-proxied requests. See `steering_policy` // to learn how steering is affected. -type LoadBalancerCollectionResultRulesOverridesLocationStrategy struct { +type ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategy struct { // Determines the authoritative location when ECS is not preferred, does not exist // in the request, or its GeoIP lookup is unsuccessful. // // - `"pop"`: Use the Cloudflare PoP location. // - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is // unsuccessful, use the Cloudflare PoP location. - Mode LoadBalancerCollectionResultRulesOverridesLocationStrategyMode `json:"mode"` + Mode ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyMode `json:"mode"` // Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the // authoritative location. // @@ -1455,21 +1609,21 @@ type LoadBalancerCollectionResultRulesOverridesLocationStrategy struct { // - `"never"`: Never prefer ECS. // - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. // - `"geo"`: Prefer ECS only when `steering_policy="geo"`. - PreferEcs LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcs `json:"prefer_ecs"` - JSON loadBalancerCollectionResultRulesOverridesLocationStrategyJSON `json:"-"` + PreferEcs ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcs `json:"prefer_ecs"` + JSON zoneLoadBalancerListResponseResultRulesOverridesLocationStrategyJSON `json:"-"` } -// loadBalancerCollectionResultRulesOverridesLocationStrategyJSON contains the JSON -// metadata for the struct -// [LoadBalancerCollectionResultRulesOverridesLocationStrategy] -type loadBalancerCollectionResultRulesOverridesLocationStrategyJSON struct { +// zoneLoadBalancerListResponseResultRulesOverridesLocationStrategyJSON contains +// the JSON metadata for the struct +// [ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategy] +type zoneLoadBalancerListResponseResultRulesOverridesLocationStrategyJSON struct { Mode apijson.Field PreferEcs apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRulesOverridesLocationStrategy) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategy) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } @@ -1479,11 +1633,11 @@ func (r *LoadBalancerCollectionResultRulesOverridesLocationStrategy) UnmarshalJS // - `"pop"`: Use the Cloudflare PoP location. // - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is // unsuccessful, use the Cloudflare PoP location. -type LoadBalancerCollectionResultRulesOverridesLocationStrategyMode string +type ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyMode string const ( - LoadBalancerCollectionResultRulesOverridesLocationStrategyModePop LoadBalancerCollectionResultRulesOverridesLocationStrategyMode = "pop" - LoadBalancerCollectionResultRulesOverridesLocationStrategyModeResolverIP LoadBalancerCollectionResultRulesOverridesLocationStrategyMode = "resolver_ip" + ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyModePop ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyMode = "pop" + ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyModeResolverIP ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyMode = "resolver_ip" ) // Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the @@ -1493,72 +1647,136 @@ const ( // - `"never"`: Never prefer ECS. // - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. // - `"geo"`: Prefer ECS only when `steering_policy="geo"`. -type LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcs string +type ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcs string const ( - LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcsAlways LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcs = "always" - LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcsNever LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcs = "never" - LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcsProximity LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcs = "proximity" - LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcsGeo LoadBalancerCollectionResultRulesOverridesLocationStrategyPreferEcs = "geo" + ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcsAlways ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcs = "always" + ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcsNever ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcs = "never" + ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcsProximity ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcs = "proximity" + ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcsGeo ZoneLoadBalancerListResponseResultRulesOverridesLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. -type LoadBalancerCollectionResultRulesOverridesRandomSteering struct { +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. +type ZoneLoadBalancerListResponseResultRulesOverridesRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. DefaultWeight float64 `json:"default_weight"` // A mapping of pool IDs to custom weights. The weight is relative to other pools // in the load balancer. - PoolWeights interface{} `json:"pool_weights"` - JSON loadBalancerCollectionResultRulesOverridesRandomSteeringJSON `json:"-"` + PoolWeights interface{} `json:"pool_weights"` + JSON zoneLoadBalancerListResponseResultRulesOverridesRandomSteeringJSON `json:"-"` } -// loadBalancerCollectionResultRulesOverridesRandomSteeringJSON contains the JSON -// metadata for the struct -// [LoadBalancerCollectionResultRulesOverridesRandomSteering] -type loadBalancerCollectionResultRulesOverridesRandomSteeringJSON struct { +// zoneLoadBalancerListResponseResultRulesOverridesRandomSteeringJSON contains the +// JSON metadata for the struct +// [ZoneLoadBalancerListResponseResultRulesOverridesRandomSteering] +type zoneLoadBalancerListResponseResultRulesOverridesRandomSteeringJSON struct { DefaultWeight apijson.Field PoolWeights apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRulesOverridesRandomSteering) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRulesOverridesRandomSteering) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -// Configures cookie attributes for session affinity cookie. -type LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributes struct { +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinity string + +const ( + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityNone ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinity = "none" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityCookie ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinity = "cookie" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityIPCookie ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinity = "ip_cookie" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityHeader ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinity = "header" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityEmpty ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinity = "\"\"" +) + +// Configures attributes for session affinity. +type ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration float64 `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers []string `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders bool `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". - Samesite LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesite `json:"samesite"` + Samesite ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesite `json:"samesite"` // Configures the Secure attribute on session affinity cookie. Value "Always" // indicates the Secure attribute will be set in the Set-Cookie header, "Never" // indicates the Secure attribute will not be set, and "Auto" will set the Secure // attribute depending if Always Use HTTPS is enabled. - Secure LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecure `json:"secure"` + Secure ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecure `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. - ZeroDowntimeFailover LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover `json:"zero_downtime_failover"` - JSON loadBalancerCollectionResultRulesOverridesSessionAffinityAttributesJSON `json:"-"` -} - -// loadBalancerCollectionResultRulesOverridesSessionAffinityAttributesJSON contains -// the JSON metadata for the struct -// [LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributes] -type loadBalancerCollectionResultRulesOverridesSessionAffinityAttributesJSON struct { + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. + ZeroDowntimeFailover ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover `json:"zero_downtime_failover"` + JSON zoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesJSON `json:"-"` +} + +// zoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesJSON +// contains the JSON metadata for the struct +// [ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributes] +type zoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesJSON struct { DrainDuration apijson.Field + Headers apijson.Field + RequireAllHeaders apijson.Field Samesite apijson.Field Secure apijson.Field ZeroDowntimeFailover apijson.Field @@ -1566,48 +1784,51 @@ type loadBalancerCollectionResultRulesOverridesSessionAffinityAttributesJSON str ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributes) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributes) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". -type LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesite string +type ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesite string const ( - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesiteAuto LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesite = "Auto" - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesiteLax LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesite = "Lax" - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesiteNone LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesite = "None" - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesiteStrict LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSamesite = "Strict" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesiteAuto ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesite = "Auto" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesiteLax ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesite = "Lax" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesiteNone ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesite = "None" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesiteStrict ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSamesite = "Strict" ) // Configures the Secure attribute on session affinity cookie. Value "Always" // indicates the Secure attribute will be set in the Set-Cookie header, "Never" // indicates the Secure attribute will not be set, and "Auto" will set the Secure // attribute depending if Always Use HTTPS is enabled. -type LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecure string +type ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecure string const ( - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecureAuto LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecure = "Auto" - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecureAlways LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecure = "Always" - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecureNever LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesSecure = "Never" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecureAuto ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecure = "Auto" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecureAlways ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecure = "Always" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecureNever ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesSecure = "Never" ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. -type LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover string +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. +type ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover string const ( - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverNone LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "none" - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverTemporary LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "temporary" - LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky LoadBalancerCollectionResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "sticky" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverNone ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "none" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverTemporary ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "temporary" + ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky ZoneLoadBalancerListResponseResultRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "sticky" ) // Steering Policy for this load balancer. @@ -1622,49 +1843,118 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. -type LoadBalancerCollectionResultRulesOverridesSteeringPolicy string +type ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy string + +const ( + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyOff ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "off" + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyGeo ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "geo" + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyRandom ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "random" + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyDynamicLatency ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyProximity ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "proximity" + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyLeastConnections ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "least_connections" + ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicyEmpty ZoneLoadBalancerListResponseResultRulesOverridesSteeringPolicy = "\"\"" +) + +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerListResponseResultSessionAffinity string const ( - LoadBalancerCollectionResultRulesOverridesSteeringPolicyOff LoadBalancerCollectionResultRulesOverridesSteeringPolicy = "off" - LoadBalancerCollectionResultRulesOverridesSteeringPolicyGeo LoadBalancerCollectionResultRulesOverridesSteeringPolicy = "geo" - LoadBalancerCollectionResultRulesOverridesSteeringPolicyRandom LoadBalancerCollectionResultRulesOverridesSteeringPolicy = "random" - LoadBalancerCollectionResultRulesOverridesSteeringPolicyDynamicLatency LoadBalancerCollectionResultRulesOverridesSteeringPolicy = "dynamic_latency" - LoadBalancerCollectionResultRulesOverridesSteeringPolicyProximity LoadBalancerCollectionResultRulesOverridesSteeringPolicy = "proximity" - LoadBalancerCollectionResultRulesOverridesSteeringPolicyEmpty LoadBalancerCollectionResultRulesOverridesSteeringPolicy = "\"\"" + ZoneLoadBalancerListResponseResultSessionAffinityNone ZoneLoadBalancerListResponseResultSessionAffinity = "none" + ZoneLoadBalancerListResponseResultSessionAffinityCookie ZoneLoadBalancerListResponseResultSessionAffinity = "cookie" + ZoneLoadBalancerListResponseResultSessionAffinityIPCookie ZoneLoadBalancerListResponseResultSessionAffinity = "ip_cookie" + ZoneLoadBalancerListResponseResultSessionAffinityHeader ZoneLoadBalancerListResponseResultSessionAffinity = "header" + ZoneLoadBalancerListResponseResultSessionAffinityEmpty ZoneLoadBalancerListResponseResultSessionAffinity = "\"\"" ) -// Configures cookie attributes for session affinity cookie. -type LoadBalancerCollectionResultSessionAffinityAttributes struct { +// Configures attributes for session affinity. +type ZoneLoadBalancerListResponseResultSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration float64 `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers []string `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders bool `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". - Samesite LoadBalancerCollectionResultSessionAffinityAttributesSamesite `json:"samesite"` + Samesite ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesite `json:"samesite"` // Configures the Secure attribute on session affinity cookie. Value "Always" // indicates the Secure attribute will be set in the Set-Cookie header, "Never" // indicates the Secure attribute will not be set, and "Auto" will set the Secure // attribute depending if Always Use HTTPS is enabled. - Secure LoadBalancerCollectionResultSessionAffinityAttributesSecure `json:"secure"` + Secure ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecure `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. - ZeroDowntimeFailover LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailover `json:"zero_downtime_failover"` - JSON loadBalancerCollectionResultSessionAffinityAttributesJSON `json:"-"` -} - -// loadBalancerCollectionResultSessionAffinityAttributesJSON contains the JSON -// metadata for the struct [LoadBalancerCollectionResultSessionAffinityAttributes] -type loadBalancerCollectionResultSessionAffinityAttributesJSON struct { + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. + ZeroDowntimeFailover ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailover `json:"zero_downtime_failover"` + JSON zoneLoadBalancerListResponseResultSessionAffinityAttributesJSON `json:"-"` +} + +// zoneLoadBalancerListResponseResultSessionAffinityAttributesJSON contains the +// JSON metadata for the struct +// [ZoneLoadBalancerListResponseResultSessionAffinityAttributes] +type zoneLoadBalancerListResponseResultSessionAffinityAttributesJSON struct { DrainDuration apijson.Field + Headers apijson.Field + RequireAllHeaders apijson.Field Samesite apijson.Field Secure apijson.Field ZeroDowntimeFailover apijson.Field @@ -1672,48 +1962,51 @@ type loadBalancerCollectionResultSessionAffinityAttributesJSON struct { ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultSessionAffinityAttributes) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultSessionAffinityAttributes) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". -type LoadBalancerCollectionResultSessionAffinityAttributesSamesite string +type ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesite string const ( - LoadBalancerCollectionResultSessionAffinityAttributesSamesiteAuto LoadBalancerCollectionResultSessionAffinityAttributesSamesite = "Auto" - LoadBalancerCollectionResultSessionAffinityAttributesSamesiteLax LoadBalancerCollectionResultSessionAffinityAttributesSamesite = "Lax" - LoadBalancerCollectionResultSessionAffinityAttributesSamesiteNone LoadBalancerCollectionResultSessionAffinityAttributesSamesite = "None" - LoadBalancerCollectionResultSessionAffinityAttributesSamesiteStrict LoadBalancerCollectionResultSessionAffinityAttributesSamesite = "Strict" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesiteAuto ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesite = "Auto" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesiteLax ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesite = "Lax" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesiteNone ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesite = "None" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesiteStrict ZoneLoadBalancerListResponseResultSessionAffinityAttributesSamesite = "Strict" ) // Configures the Secure attribute on session affinity cookie. Value "Always" // indicates the Secure attribute will be set in the Set-Cookie header, "Never" // indicates the Secure attribute will not be set, and "Auto" will set the Secure // attribute depending if Always Use HTTPS is enabled. -type LoadBalancerCollectionResultSessionAffinityAttributesSecure string +type ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecure string const ( - LoadBalancerCollectionResultSessionAffinityAttributesSecureAuto LoadBalancerCollectionResultSessionAffinityAttributesSecure = "Auto" - LoadBalancerCollectionResultSessionAffinityAttributesSecureAlways LoadBalancerCollectionResultSessionAffinityAttributesSecure = "Always" - LoadBalancerCollectionResultSessionAffinityAttributesSecureNever LoadBalancerCollectionResultSessionAffinityAttributesSecure = "Never" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecureAuto ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecure = "Auto" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecureAlways ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecure = "Always" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecureNever ZoneLoadBalancerListResponseResultSessionAffinityAttributesSecure = "Never" ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. -type LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailover string +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. +type ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailover string const ( - LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailoverNone LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailover = "none" - LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailoverTemporary LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailover = "temporary" - LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailoverSticky LoadBalancerCollectionResultSessionAffinityAttributesZeroDowntimeFailover = "sticky" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailoverNone ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailover = "none" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailoverTemporary ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailover = "temporary" + ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailoverSticky ZoneLoadBalancerListResponseResultSessionAffinityAttributesZeroDowntimeFailover = "sticky" ) // Steering Policy for this load balancer. @@ -1728,20 +2021,30 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. -type LoadBalancerCollectionResultSteeringPolicy string +type ZoneLoadBalancerListResponseResultSteeringPolicy string const ( - LoadBalancerCollectionResultSteeringPolicyOff LoadBalancerCollectionResultSteeringPolicy = "off" - LoadBalancerCollectionResultSteeringPolicyGeo LoadBalancerCollectionResultSteeringPolicy = "geo" - LoadBalancerCollectionResultSteeringPolicyRandom LoadBalancerCollectionResultSteeringPolicy = "random" - LoadBalancerCollectionResultSteeringPolicyDynamicLatency LoadBalancerCollectionResultSteeringPolicy = "dynamic_latency" - LoadBalancerCollectionResultSteeringPolicyProximity LoadBalancerCollectionResultSteeringPolicy = "proximity" - LoadBalancerCollectionResultSteeringPolicyEmpty LoadBalancerCollectionResultSteeringPolicy = "\"\"" + ZoneLoadBalancerListResponseResultSteeringPolicyOff ZoneLoadBalancerListResponseResultSteeringPolicy = "off" + ZoneLoadBalancerListResponseResultSteeringPolicyGeo ZoneLoadBalancerListResponseResultSteeringPolicy = "geo" + ZoneLoadBalancerListResponseResultSteeringPolicyRandom ZoneLoadBalancerListResponseResultSteeringPolicy = "random" + ZoneLoadBalancerListResponseResultSteeringPolicyDynamicLatency ZoneLoadBalancerListResponseResultSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerListResponseResultSteeringPolicyProximity ZoneLoadBalancerListResponseResultSteeringPolicy = "proximity" + ZoneLoadBalancerListResponseResultSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerListResponseResultSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerListResponseResultSteeringPolicyLeastConnections ZoneLoadBalancerListResponseResultSteeringPolicy = "least_connections" + ZoneLoadBalancerListResponseResultSteeringPolicyEmpty ZoneLoadBalancerListResponseResultSteeringPolicy = "\"\"" ) -type LoadBalancerCollectionResultInfo struct { +type ZoneLoadBalancerListResponseResultInfo struct { // Total number of results for the requested service Count float64 `json:"count"` // Current page within paginated list of results @@ -1749,13 +2052,13 @@ type LoadBalancerCollectionResultInfo struct { // Number of results per page of results PerPage float64 `json:"per_page"` // Total results available without any search parameters - TotalCount float64 `json:"total_count"` - JSON loadBalancerCollectionResultInfoJSON `json:"-"` + TotalCount float64 `json:"total_count"` + JSON zoneLoadBalancerListResponseResultInfoJSON `json:"-"` } -// loadBalancerCollectionResultInfoJSON contains the JSON metadata for the struct -// [LoadBalancerCollectionResultInfo] -type loadBalancerCollectionResultInfoJSON struct { +// zoneLoadBalancerListResponseResultInfoJSON contains the JSON metadata for the +// struct [ZoneLoadBalancerListResponseResultInfo] +type zoneLoadBalancerListResponseResultInfoJSON struct { Count apijson.Field Page apijson.Field PerPage apijson.Field @@ -1764,15 +2067,101 @@ type loadBalancerCollectionResultInfoJSON struct { ExtraFields map[string]apijson.Field } -func (r *LoadBalancerCollectionResultInfo) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneLoadBalancerListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLoadBalancerListResponseSuccess bool + +const ( + ZoneLoadBalancerListResponseSuccessTrue ZoneLoadBalancerListResponseSuccess = true +) + +type ZoneLoadBalancerDeleteResponse struct { + Errors []ZoneLoadBalancerDeleteResponseError `json:"errors"` + Messages []ZoneLoadBalancerDeleteResponseMessage `json:"messages"` + Result ZoneLoadBalancerDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneLoadBalancerDeleteResponseSuccess `json:"success"` + JSON zoneLoadBalancerDeleteResponseJSON `json:"-"` +} + +// zoneLoadBalancerDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneLoadBalancerDeleteResponse] +type zoneLoadBalancerDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLoadBalancerDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLoadBalancerDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLoadBalancerDeleteResponseErrorJSON `json:"-"` +} + +// zoneLoadBalancerDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneLoadBalancerDeleteResponseError] +type zoneLoadBalancerDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLoadBalancerDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLoadBalancerDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLoadBalancerDeleteResponseMessageJSON `json:"-"` +} + +// zoneLoadBalancerDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneLoadBalancerDeleteResponseMessage] +type zoneLoadBalancerDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLoadBalancerDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLoadBalancerDeleteResponseResult struct { + ID string `json:"id"` + JSON zoneLoadBalancerDeleteResponseResultJSON `json:"-"` +} + +// zoneLoadBalancerDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneLoadBalancerDeleteResponseResult] +type zoneLoadBalancerDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLoadBalancerDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type LoadBalancerCollectionSuccess bool +type ZoneLoadBalancerDeleteResponseSuccess bool const ( - LoadBalancerCollectionSuccessTrue LoadBalancerCollectionSuccess = true + ZoneLoadBalancerDeleteResponseSuccessTrue ZoneLoadBalancerDeleteResponseSuccess = true ) type ZoneLoadBalancerNewParams struct { @@ -1809,8 +2198,14 @@ type ZoneLoadBalancerNewParams struct { PopPools param.Field[interface{}] `json:"pop_pools"` // Whether the hostname should be gray clouded (false) or orange clouded (true). Proxied param.Field[bool] `json:"proxied"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. RandomSteering param.Field[ZoneLoadBalancerNewParamsRandomSteering] `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall @@ -1819,14 +2214,18 @@ type ZoneLoadBalancerNewParams struct { // BETA Field Not General Access: A list of rules for this load balancer to // execute. Rules param.Field[[]ZoneLoadBalancerNewParamsRule] `json:"rules"` - // Configures cookie attributes for session affinity cookie. + // Configures attributes for session affinity. SessionAffinityAttributes param.Field[ZoneLoadBalancerNewParamsSessionAffinityAttributes] `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl param.Field[float64] `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -1840,6 +2239,14 @@ type ZoneLoadBalancerNewParams struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. SteeringPolicy param.Field[ZoneLoadBalancerNewParamsSteeringPolicy] `json:"steering_policy"` @@ -1925,8 +2332,14 @@ const ( ZoneLoadBalancerNewParamsLocationStrategyPreferEcsGeo ZoneLoadBalancerNewParamsLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. type ZoneLoadBalancerNewParamsRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. @@ -2020,21 +2433,31 @@ type ZoneLoadBalancerNewParamsRulesOverrides struct { // explicitly defined will fall back to using the corresponding country_pool, then // region_pool mapping if it exists else to default_pools. PopPools param.Field[interface{}] `json:"pop_pools"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. RandomSteering param.Field[ZoneLoadBalancerNewParamsRulesOverridesRandomSteering] `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall // back to using default_pools. RegionPools param.Field[interface{}] `json:"region_pools"` - // Configures cookie attributes for session affinity cookie. + // Configures attributes for session affinity. SessionAffinityAttributes param.Field[ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributes] `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl param.Field[float64] `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -2048,6 +2471,14 @@ type ZoneLoadBalancerNewParamsRulesOverrides struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. SteeringPolicy param.Field[ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy] `json:"steering_policy"` @@ -2133,8 +2564,14 @@ const ( ZoneLoadBalancerNewParamsRulesOverridesLocationStrategyPreferEcsGeo ZoneLoadBalancerNewParamsRulesOverridesLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. type ZoneLoadBalancerNewParamsRulesOverridesRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. @@ -2148,11 +2585,64 @@ func (r ZoneLoadBalancerNewParamsRulesOverridesRandomSteering) MarshalJSON() (da return apijson.MarshalRoot(r) } -// Configures cookie attributes for session affinity cookie. +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerNewParamsRulesOverridesSessionAffinity string + +const ( + ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityNone ZoneLoadBalancerNewParamsRulesOverridesSessionAffinity = "none" + ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityCookie ZoneLoadBalancerNewParamsRulesOverridesSessionAffinity = "cookie" + ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityIPCookie ZoneLoadBalancerNewParamsRulesOverridesSessionAffinity = "ip_cookie" + ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityHeader ZoneLoadBalancerNewParamsRulesOverridesSessionAffinity = "header" + ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityEmpty ZoneLoadBalancerNewParamsRulesOverridesSessionAffinity = "\"\"" +) + +// Configures attributes for session affinity. type ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration param.Field[float64] `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers param.Field[[]string] `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders param.Field[bool] `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". @@ -2163,13 +2653,16 @@ type ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributes struct { // attribute depending if Always Use HTTPS is enabled. Secure param.Field[ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesSecure] `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. ZeroDowntimeFailover param.Field[ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover] `json:"zero_downtime_failover"` } @@ -2202,13 +2695,16 @@ const ( ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. type ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover string const ( @@ -2229,24 +2725,87 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. type ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy string const ( - ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyOff ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "off" - ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyGeo ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "geo" - ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyRandom ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "random" - ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyDynamicLatency ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "dynamic_latency" - ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyProximity ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "proximity" - ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyEmpty ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "\"\"" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyOff ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "off" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyGeo ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "geo" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyRandom ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "random" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyDynamicLatency ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyProximity ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "proximity" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyLeastConnections ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "least_connections" + ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyEmpty ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicy = "\"\"" +) + +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerNewParamsSessionAffinity string + +const ( + ZoneLoadBalancerNewParamsSessionAffinityNone ZoneLoadBalancerNewParamsSessionAffinity = "none" + ZoneLoadBalancerNewParamsSessionAffinityCookie ZoneLoadBalancerNewParamsSessionAffinity = "cookie" + ZoneLoadBalancerNewParamsSessionAffinityIPCookie ZoneLoadBalancerNewParamsSessionAffinity = "ip_cookie" + ZoneLoadBalancerNewParamsSessionAffinityHeader ZoneLoadBalancerNewParamsSessionAffinity = "header" + ZoneLoadBalancerNewParamsSessionAffinityEmpty ZoneLoadBalancerNewParamsSessionAffinity = "\"\"" ) -// Configures cookie attributes for session affinity cookie. +// Configures attributes for session affinity. type ZoneLoadBalancerNewParamsSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration param.Field[float64] `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers param.Field[[]string] `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders param.Field[bool] `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". @@ -2257,13 +2816,16 @@ type ZoneLoadBalancerNewParamsSessionAffinityAttributes struct { // attribute depending if Always Use HTTPS is enabled. Secure param.Field[ZoneLoadBalancerNewParamsSessionAffinityAttributesSecure] `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. ZeroDowntimeFailover param.Field[ZoneLoadBalancerNewParamsSessionAffinityAttributesZeroDowntimeFailover] `json:"zero_downtime_failover"` } @@ -2296,13 +2858,16 @@ const ( ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. type ZoneLoadBalancerNewParamsSessionAffinityAttributesZeroDowntimeFailover string const ( @@ -2323,17 +2888,27 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. type ZoneLoadBalancerNewParamsSteeringPolicy string const ( - ZoneLoadBalancerNewParamsSteeringPolicyOff ZoneLoadBalancerNewParamsSteeringPolicy = "off" - ZoneLoadBalancerNewParamsSteeringPolicyGeo ZoneLoadBalancerNewParamsSteeringPolicy = "geo" - ZoneLoadBalancerNewParamsSteeringPolicyRandom ZoneLoadBalancerNewParamsSteeringPolicy = "random" - ZoneLoadBalancerNewParamsSteeringPolicyDynamicLatency ZoneLoadBalancerNewParamsSteeringPolicy = "dynamic_latency" - ZoneLoadBalancerNewParamsSteeringPolicyProximity ZoneLoadBalancerNewParamsSteeringPolicy = "proximity" - ZoneLoadBalancerNewParamsSteeringPolicyEmpty ZoneLoadBalancerNewParamsSteeringPolicy = "\"\"" + ZoneLoadBalancerNewParamsSteeringPolicyOff ZoneLoadBalancerNewParamsSteeringPolicy = "off" + ZoneLoadBalancerNewParamsSteeringPolicyGeo ZoneLoadBalancerNewParamsSteeringPolicy = "geo" + ZoneLoadBalancerNewParamsSteeringPolicyRandom ZoneLoadBalancerNewParamsSteeringPolicy = "random" + ZoneLoadBalancerNewParamsSteeringPolicyDynamicLatency ZoneLoadBalancerNewParamsSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerNewParamsSteeringPolicyProximity ZoneLoadBalancerNewParamsSteeringPolicy = "proximity" + ZoneLoadBalancerNewParamsSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerNewParamsSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerNewParamsSteeringPolicyLeastConnections ZoneLoadBalancerNewParamsSteeringPolicy = "least_connections" + ZoneLoadBalancerNewParamsSteeringPolicyEmpty ZoneLoadBalancerNewParamsSteeringPolicy = "\"\"" ) type ZoneLoadBalancerUpdateParams struct { @@ -2372,8 +2947,14 @@ type ZoneLoadBalancerUpdateParams struct { PopPools param.Field[interface{}] `json:"pop_pools"` // Whether the hostname should be gray clouded (false) or orange clouded (true). Proxied param.Field[bool] `json:"proxied"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. RandomSteering param.Field[ZoneLoadBalancerUpdateParamsRandomSteering] `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall @@ -2382,14 +2963,18 @@ type ZoneLoadBalancerUpdateParams struct { // BETA Field Not General Access: A list of rules for this load balancer to // execute. Rules param.Field[[]ZoneLoadBalancerUpdateParamsRule] `json:"rules"` - // Configures cookie attributes for session affinity cookie. + // Configures attributes for session affinity. SessionAffinityAttributes param.Field[ZoneLoadBalancerUpdateParamsSessionAffinityAttributes] `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl param.Field[float64] `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -2403,6 +2988,14 @@ type ZoneLoadBalancerUpdateParams struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. SteeringPolicy param.Field[ZoneLoadBalancerUpdateParamsSteeringPolicy] `json:"steering_policy"` @@ -2488,8 +3081,14 @@ const ( ZoneLoadBalancerUpdateParamsLocationStrategyPreferEcsGeo ZoneLoadBalancerUpdateParamsLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. type ZoneLoadBalancerUpdateParamsRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. @@ -2583,21 +3182,31 @@ type ZoneLoadBalancerUpdateParamsRulesOverrides struct { // explicitly defined will fall back to using the corresponding country_pool, then // region_pool mapping if it exists else to default_pools. PopPools param.Field[interface{}] `json:"pop_pools"` - // Configures pool weights for random steering. When steering_policy is 'random', a - // random pool is selected with probability proportional to these pool weights. + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. RandomSteering param.Field[ZoneLoadBalancerUpdateParamsRulesOverridesRandomSteering] `json:"random_steering"` // A mapping of region codes to a list of pool IDs (ordered by their failover // priority) for the given region. Any regions not explicitly defined will fall // back to using default_pools. RegionPools param.Field[interface{}] `json:"region_pools"` - // Configures cookie attributes for session affinity cookie. + // Configures attributes for session affinity. SessionAffinityAttributes param.Field[ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributes] `json:"session_affinity_attributes"` - // Time, in seconds, until this load balancer's session affinity cookie expires - // after being created. This parameter is ignored unless a supported session - // affinity policy is set. The current default of 23 hours will be used unless - // session_affinity_ttl is explicitly set. The accepted range of values is between - // [1800, 604800]. Once the expiry time has been reached, subsequent requests may - // get sent to a different origin server. + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. SessionAffinityTtl param.Field[float64] `json:"session_affinity_ttl"` // Steering Policy for this load balancer. // @@ -2611,6 +3220,14 @@ type ZoneLoadBalancerUpdateParamsRulesOverrides struct { // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. SteeringPolicy param.Field[ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy] `json:"steering_policy"` @@ -2696,8 +3313,14 @@ const ( ZoneLoadBalancerUpdateParamsRulesOverridesLocationStrategyPreferEcsGeo ZoneLoadBalancerUpdateParamsRulesOverridesLocationStrategyPreferEcs = "geo" ) -// Configures pool weights for random steering. When steering_policy is 'random', a -// random pool is selected with probability proportional to these pool weights. +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. type ZoneLoadBalancerUpdateParamsRulesOverridesRandomSteering struct { // The default weight for pools in the load balancer that are not specified in the // pool_weights map. @@ -2711,11 +3334,64 @@ func (r ZoneLoadBalancerUpdateParamsRulesOverridesRandomSteering) MarshalJSON() return apijson.MarshalRoot(r) } -// Configures cookie attributes for session affinity cookie. +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinity string + +const ( + ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityNone ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinity = "none" + ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityCookie ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinity = "cookie" + ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityIPCookie ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinity = "ip_cookie" + ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityHeader ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinity = "header" + ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityEmpty ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinity = "\"\"" +) + +// Configures attributes for session affinity. type ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration param.Field[float64] `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers param.Field[[]string] `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders param.Field[bool] `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". @@ -2726,13 +3402,16 @@ type ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributes struct // attribute depending if Always Use HTTPS is enabled. Secure param.Field[ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesSecure] `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. ZeroDowntimeFailover param.Field[ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover] `json:"zero_downtime_failover"` } @@ -2765,13 +3444,16 @@ const ( ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. type ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover string const ( @@ -2792,24 +3474,87 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. type ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy string const ( - ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyOff ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "off" - ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyGeo ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "geo" - ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyRandom ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "random" - ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyDynamicLatency ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "dynamic_latency" - ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyProximity ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "proximity" - ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyEmpty ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "\"\"" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyOff ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "off" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyGeo ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "geo" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyRandom ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "random" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyDynamicLatency ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyProximity ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "proximity" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyLeastConnections ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "least_connections" + ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyEmpty ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicy = "\"\"" +) + +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerUpdateParamsSessionAffinity string + +const ( + ZoneLoadBalancerUpdateParamsSessionAffinityNone ZoneLoadBalancerUpdateParamsSessionAffinity = "none" + ZoneLoadBalancerUpdateParamsSessionAffinityCookie ZoneLoadBalancerUpdateParamsSessionAffinity = "cookie" + ZoneLoadBalancerUpdateParamsSessionAffinityIPCookie ZoneLoadBalancerUpdateParamsSessionAffinity = "ip_cookie" + ZoneLoadBalancerUpdateParamsSessionAffinityHeader ZoneLoadBalancerUpdateParamsSessionAffinity = "header" + ZoneLoadBalancerUpdateParamsSessionAffinityEmpty ZoneLoadBalancerUpdateParamsSessionAffinity = "\"\"" ) -// Configures cookie attributes for session affinity cookie. +// Configures attributes for session affinity. type ZoneLoadBalancerUpdateParamsSessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session // affinity is enabled on the load balancer. DrainDuration param.Field[float64] `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers param.Field[[]string] `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders param.Field[bool] `json:"require_all_headers"` // Configures the SameSite attribute on session affinity cookie. Value "Auto" will // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: // when using value "None", the secure attribute can not be set to "Never". @@ -2820,13 +3565,16 @@ type ZoneLoadBalancerUpdateParamsSessionAffinityAttributes struct { // attribute depending if Always Use HTTPS is enabled. Secure param.Field[ZoneLoadBalancerUpdateParamsSessionAffinityAttributesSecure] `json:"secure"` // Configures the zero-downtime failover between origins within a pool when session - // affinity is enabled. Value "none" means no failover takes place for sessions - // pinned to the origin (default). Value "temporary" means traffic will be sent to - // another other healthy origin until the originally pinned origin is available; - // note that this can potentially result in heavy origin flapping. Value "sticky" - // means the session affinity cookie is updated and subsequent requests are sent to - // the new origin. This feature is currently incompatible with Argo, Tiered Cache, - // and Bandwidth Alliance. + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. ZeroDowntimeFailover param.Field[ZoneLoadBalancerUpdateParamsSessionAffinityAttributesZeroDowntimeFailover] `json:"zero_downtime_failover"` } @@ -2859,13 +3607,16 @@ const ( ) // Configures the zero-downtime failover between origins within a pool when session -// affinity is enabled. Value "none" means no failover takes place for sessions -// pinned to the origin (default). Value "temporary" means traffic will be sent to -// another other healthy origin until the originally pinned origin is available; -// note that this can potentially result in heavy origin flapping. Value "sticky" -// means the session affinity cookie is updated and subsequent requests are sent to -// the new origin. This feature is currently incompatible with Argo, Tiered Cache, -// and Bandwidth Alliance. +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. type ZoneLoadBalancerUpdateParamsSessionAffinityAttributesZeroDowntimeFailover string const ( @@ -2886,15 +3637,774 @@ const ( // - `"proximity"`: Use the pools' latitude and longitude to select the closest // pool using the Cloudflare PoP location for proxied requests or the location // determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. type ZoneLoadBalancerUpdateParamsSteeringPolicy string const ( - ZoneLoadBalancerUpdateParamsSteeringPolicyOff ZoneLoadBalancerUpdateParamsSteeringPolicy = "off" - ZoneLoadBalancerUpdateParamsSteeringPolicyGeo ZoneLoadBalancerUpdateParamsSteeringPolicy = "geo" - ZoneLoadBalancerUpdateParamsSteeringPolicyRandom ZoneLoadBalancerUpdateParamsSteeringPolicy = "random" - ZoneLoadBalancerUpdateParamsSteeringPolicyDynamicLatency ZoneLoadBalancerUpdateParamsSteeringPolicy = "dynamic_latency" - ZoneLoadBalancerUpdateParamsSteeringPolicyProximity ZoneLoadBalancerUpdateParamsSteeringPolicy = "proximity" - ZoneLoadBalancerUpdateParamsSteeringPolicyEmpty ZoneLoadBalancerUpdateParamsSteeringPolicy = "\"\"" + ZoneLoadBalancerUpdateParamsSteeringPolicyOff ZoneLoadBalancerUpdateParamsSteeringPolicy = "off" + ZoneLoadBalancerUpdateParamsSteeringPolicyGeo ZoneLoadBalancerUpdateParamsSteeringPolicy = "geo" + ZoneLoadBalancerUpdateParamsSteeringPolicyRandom ZoneLoadBalancerUpdateParamsSteeringPolicy = "random" + ZoneLoadBalancerUpdateParamsSteeringPolicyDynamicLatency ZoneLoadBalancerUpdateParamsSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerUpdateParamsSteeringPolicyProximity ZoneLoadBalancerUpdateParamsSteeringPolicy = "proximity" + ZoneLoadBalancerUpdateParamsSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerUpdateParamsSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerUpdateParamsSteeringPolicyLeastConnections ZoneLoadBalancerUpdateParamsSteeringPolicy = "least_connections" + ZoneLoadBalancerUpdateParamsSteeringPolicyEmpty ZoneLoadBalancerUpdateParamsSteeringPolicy = "\"\"" +) + +type ZoneLoadBalancerPatchParams struct { + // Controls features that modify the routing of requests to pools and origins in + // response to dynamic conditions, such as during the interval between active + // health monitoring requests. For example, zero-downtime failover occurs + // immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + // response codes. If there is another healthy origin in the same pool, the request + // is retried once against this alternate origin. + AdaptiveRouting param.Field[ZoneLoadBalancerPatchParamsAdaptiveRouting] `json:"adaptive_routing"` + // A mapping of country codes to a list of pool IDs (ordered by their failover + // priority) for the given country. Any country not explicitly defined will fall + // back to using the corresponding region_pool mapping if it exists else to + // default_pools. + CountryPools param.Field[interface{}] `json:"country_pools"` + // A list of pool IDs ordered by their failover priority. Pools defined here are + // used by default, or when region_pools are not configured for a given region. + DefaultPools param.Field[[]string] `json:"default_pools"` + // Object description. + Description param.Field[string] `json:"description"` + // Whether to enable (the default) this load balancer. + Enabled param.Field[bool] `json:"enabled"` + // The pool ID to use when all other pools are detected as unhealthy. + FallbackPool param.Field[interface{}] `json:"fallback_pool"` + // Controls location-based steering for non-proxied requests. See `steering_policy` + // to learn how steering is affected. + LocationStrategy param.Field[ZoneLoadBalancerPatchParamsLocationStrategy] `json:"location_strategy"` + // The DNS hostname to associate with your Load Balancer. If this hostname already + // exists as a DNS record in Cloudflare's DNS, the Load Balancer will take + // precedence and the DNS record will not be used. + Name param.Field[string] `json:"name"` + // (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + // (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + // explicitly defined will fall back to using the corresponding country_pool, then + // region_pool mapping if it exists else to default_pools. + PopPools param.Field[interface{}] `json:"pop_pools"` + // Whether the hostname should be gray clouded (false) or orange clouded (true). + Proxied param.Field[bool] `json:"proxied"` + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. + RandomSteering param.Field[ZoneLoadBalancerPatchParamsRandomSteering] `json:"random_steering"` + // A mapping of region codes to a list of pool IDs (ordered by their failover + // priority) for the given region. Any regions not explicitly defined will fall + // back to using default_pools. + RegionPools param.Field[interface{}] `json:"region_pools"` + // BETA Field Not General Access: A list of rules for this load balancer to + // execute. + Rules param.Field[[]ZoneLoadBalancerPatchParamsRule] `json:"rules"` + // Configures attributes for session affinity. + SessionAffinityAttributes param.Field[ZoneLoadBalancerPatchParamsSessionAffinityAttributes] `json:"session_affinity_attributes"` + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. + SessionAffinityTtl param.Field[float64] `json:"session_affinity_ttl"` + // Steering Policy for this load balancer. + // + // - `"off"`: Use `default_pools`. + // - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + // requests, the country for `country_pools` is determined by + // `location_strategy`. + // - `"random"`: Select a pool randomly. + // - `"dynamic_latency"`: Use round trip time to select the closest pool in + // default_pools (requires pool health checks). + // - `"proximity"`: Use the pools' latitude and longitude to select the closest + // pool using the Cloudflare PoP location for proxied requests or the location + // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. + // - `""`: Will map to `"geo"` if you use + // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + SteeringPolicy param.Field[ZoneLoadBalancerPatchParamsSteeringPolicy] `json:"steering_policy"` + // Time to live (TTL) of the DNS entry for the IP address returned by this load + // balancer. This only applies to gray-clouded (unproxied) load balancers. + Ttl param.Field[float64] `json:"ttl"` +} + +func (r ZoneLoadBalancerPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Controls features that modify the routing of requests to pools and origins in +// response to dynamic conditions, such as during the interval between active +// health monitoring requests. For example, zero-downtime failover occurs +// immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 +// response codes. If there is another healthy origin in the same pool, the request +// is retried once against this alternate origin. +type ZoneLoadBalancerPatchParamsAdaptiveRouting struct { + // Extends zero-downtime failover of requests to healthy origins from alternate + // pools, when no healthy alternate exists in the same pool, according to the + // failover order defined by traffic and origin steering. When set false (the + // default) zero-downtime failover will only occur between origins within the same + // pool. See `session_affinity_attributes` for control over when sessions are + // broken or reassigned. + FailoverAcrossPools param.Field[bool] `json:"failover_across_pools"` +} + +func (r ZoneLoadBalancerPatchParamsAdaptiveRouting) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Controls location-based steering for non-proxied requests. See `steering_policy` +// to learn how steering is affected. +type ZoneLoadBalancerPatchParamsLocationStrategy struct { + // Determines the authoritative location when ECS is not preferred, does not exist + // in the request, or its GeoIP lookup is unsuccessful. + // + // - `"pop"`: Use the Cloudflare PoP location. + // - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is + // unsuccessful, use the Cloudflare PoP location. + Mode param.Field[ZoneLoadBalancerPatchParamsLocationStrategyMode] `json:"mode"` + // Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the + // authoritative location. + // + // - `"always"`: Always prefer ECS. + // - `"never"`: Never prefer ECS. + // - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. + // - `"geo"`: Prefer ECS only when `steering_policy="geo"`. + PreferEcs param.Field[ZoneLoadBalancerPatchParamsLocationStrategyPreferEcs] `json:"prefer_ecs"` +} + +func (r ZoneLoadBalancerPatchParamsLocationStrategy) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Determines the authoritative location when ECS is not preferred, does not exist +// in the request, or its GeoIP lookup is unsuccessful. +// +// - `"pop"`: Use the Cloudflare PoP location. +// - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is +// unsuccessful, use the Cloudflare PoP location. +type ZoneLoadBalancerPatchParamsLocationStrategyMode string + +const ( + ZoneLoadBalancerPatchParamsLocationStrategyModePop ZoneLoadBalancerPatchParamsLocationStrategyMode = "pop" + ZoneLoadBalancerPatchParamsLocationStrategyModeResolverIP ZoneLoadBalancerPatchParamsLocationStrategyMode = "resolver_ip" +) + +// Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the +// authoritative location. +// +// - `"always"`: Always prefer ECS. +// - `"never"`: Never prefer ECS. +// - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. +// - `"geo"`: Prefer ECS only when `steering_policy="geo"`. +type ZoneLoadBalancerPatchParamsLocationStrategyPreferEcs string + +const ( + ZoneLoadBalancerPatchParamsLocationStrategyPreferEcsAlways ZoneLoadBalancerPatchParamsLocationStrategyPreferEcs = "always" + ZoneLoadBalancerPatchParamsLocationStrategyPreferEcsNever ZoneLoadBalancerPatchParamsLocationStrategyPreferEcs = "never" + ZoneLoadBalancerPatchParamsLocationStrategyPreferEcsProximity ZoneLoadBalancerPatchParamsLocationStrategyPreferEcs = "proximity" + ZoneLoadBalancerPatchParamsLocationStrategyPreferEcsGeo ZoneLoadBalancerPatchParamsLocationStrategyPreferEcs = "geo" +) + +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. +type ZoneLoadBalancerPatchParamsRandomSteering struct { + // The default weight for pools in the load balancer that are not specified in the + // pool_weights map. + DefaultWeight param.Field[float64] `json:"default_weight"` + // A mapping of pool IDs to custom weights. The weight is relative to other pools + // in the load balancer. + PoolWeights param.Field[interface{}] `json:"pool_weights"` +} + +func (r ZoneLoadBalancerPatchParamsRandomSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A rule object containing conditions and overrides for this load balancer to +// evaluate. +type ZoneLoadBalancerPatchParamsRule struct { + // The condition expressions to evaluate. If the condition evaluates to true, the + // overrides or fixed_response in this rule will be applied. An empty condition is + // always true. For more details on condition expressions, please see + // https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. + Condition param.Field[string] `json:"condition"` + // Disable this specific rule. It will no longer be evaluated by this load + // balancer. + Disabled param.Field[bool] `json:"disabled"` + // A collection of fields used to directly respond to the eyeball instead of + // routing to a pool. If a fixed_response is supplied the rule will be marked as + // terminates. + FixedResponse param.Field[ZoneLoadBalancerPatchParamsRulesFixedResponse] `json:"fixed_response"` + // Name of this rule. Only used for human readability. + Name param.Field[string] `json:"name"` + // A collection of overrides to apply to the load balancer when this rule's + // condition is true. All fields are optional. + Overrides param.Field[ZoneLoadBalancerPatchParamsRulesOverrides] `json:"overrides"` + // The order in which rules should be executed in relation to each other. Lower + // values are executed first. Values do not need to be sequential. If no value is + // provided for any rule the array order of the rules field will be used to assign + // a priority. + Priority param.Field[int64] `json:"priority"` + // If this rule's condition is true, this causes rule evaluation to stop after + // processing this rule. + Terminates param.Field[bool] `json:"terminates"` +} + +func (r ZoneLoadBalancerPatchParamsRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A collection of fields used to directly respond to the eyeball instead of +// routing to a pool. If a fixed_response is supplied the rule will be marked as +// terminates. +type ZoneLoadBalancerPatchParamsRulesFixedResponse struct { + // The http 'Content-Type' header to include in the response. + ContentType param.Field[string] `json:"content_type"` + // The http 'Location' header to include in the response. + Location param.Field[string] `json:"location"` + // Text to include as the http body. + MessageBody param.Field[string] `json:"message_body"` + // The http status code to respond with. + StatusCode param.Field[int64] `json:"status_code"` +} + +func (r ZoneLoadBalancerPatchParamsRulesFixedResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A collection of overrides to apply to the load balancer when this rule's +// condition is true. All fields are optional. +type ZoneLoadBalancerPatchParamsRulesOverrides struct { + // Controls features that modify the routing of requests to pools and origins in + // response to dynamic conditions, such as during the interval between active + // health monitoring requests. For example, zero-downtime failover occurs + // immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 + // response codes. If there is another healthy origin in the same pool, the request + // is retried once against this alternate origin. + AdaptiveRouting param.Field[ZoneLoadBalancerPatchParamsRulesOverridesAdaptiveRouting] `json:"adaptive_routing"` + // A mapping of country codes to a list of pool IDs (ordered by their failover + // priority) for the given country. Any country not explicitly defined will fall + // back to using the corresponding region_pool mapping if it exists else to + // default_pools. + CountryPools param.Field[interface{}] `json:"country_pools"` + // A list of pool IDs ordered by their failover priority. Pools defined here are + // used by default, or when region_pools are not configured for a given region. + DefaultPools param.Field[[]string] `json:"default_pools"` + // The pool ID to use when all other pools are detected as unhealthy. + FallbackPool param.Field[interface{}] `json:"fallback_pool"` + // Controls location-based steering for non-proxied requests. See `steering_policy` + // to learn how steering is affected. + LocationStrategy param.Field[ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategy] `json:"location_strategy"` + // (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs + // (ordered by their failover priority) for the PoP (datacenter). Any PoPs not + // explicitly defined will fall back to using the corresponding country_pool, then + // region_pool mapping if it exists else to default_pools. + PopPools param.Field[interface{}] `json:"pop_pools"` + // Configures pool weights. + // + // - `steering_policy="random"`: A random pool is selected with probability + // proportional to pool weights. + // - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each + // pool's outstanding requests. + // - `steering_policy="least_connections"`: Use pool weights to scale each pool's + // open connections. + RandomSteering param.Field[ZoneLoadBalancerPatchParamsRulesOverridesRandomSteering] `json:"random_steering"` + // A mapping of region codes to a list of pool IDs (ordered by their failover + // priority) for the given region. Any regions not explicitly defined will fall + // back to using default_pools. + RegionPools param.Field[interface{}] `json:"region_pools"` + // Configures attributes for session affinity. + SessionAffinityAttributes param.Field[ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributes] `json:"session_affinity_attributes"` + // Time, in seconds, until a client's session expires after being created. Once the + // expiry time has been reached, subsequent requests may get sent to a different + // origin server. The accepted ranges per `session_affinity` policy are: + // + // - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used + // unless explicitly set. The accepted range of values is between [1800, 604800]. + // - `"header"`: The current default of 1800 seconds will be used unless explicitly + // set. The accepted range of values is between [30, 3600]. Note: With session + // affinity by header, sessions only expire after they haven't been used for the + // number of seconds specified. + SessionAffinityTtl param.Field[float64] `json:"session_affinity_ttl"` + // Steering Policy for this load balancer. + // + // - `"off"`: Use `default_pools`. + // - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied + // requests, the country for `country_pools` is determined by + // `location_strategy`. + // - `"random"`: Select a pool randomly. + // - `"dynamic_latency"`: Use round trip time to select the closest pool in + // default_pools (requires pool health checks). + // - `"proximity"`: Use the pools' latitude and longitude to select the closest + // pool using the Cloudflare PoP location for proxied requests or the location + // determined by `location_strategy` for non-proxied requests. + // - `"least_outstanding_requests"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of outstanding + // requests. Pools with more pending requests are weighted proportionately less + // relative to others. + // - `"least_connections"`: Select a pool by taking into consideration + // `random_steering` weights, as well as each pool's number of open connections. + // Pools with more open connections are weighted proportionately less relative to + // others. Supported for HTTP/1 and HTTP/2 connections. + // - `""`: Will map to `"geo"` if you use + // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. + SteeringPolicy param.Field[ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy] `json:"steering_policy"` + // Time to live (TTL) of the DNS entry for the IP address returned by this load + // balancer. This only applies to gray-clouded (unproxied) load balancers. + Ttl param.Field[float64] `json:"ttl"` +} + +func (r ZoneLoadBalancerPatchParamsRulesOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Controls features that modify the routing of requests to pools and origins in +// response to dynamic conditions, such as during the interval between active +// health monitoring requests. For example, zero-downtime failover occurs +// immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 +// response codes. If there is another healthy origin in the same pool, the request +// is retried once against this alternate origin. +type ZoneLoadBalancerPatchParamsRulesOverridesAdaptiveRouting struct { + // Extends zero-downtime failover of requests to healthy origins from alternate + // pools, when no healthy alternate exists in the same pool, according to the + // failover order defined by traffic and origin steering. When set false (the + // default) zero-downtime failover will only occur between origins within the same + // pool. See `session_affinity_attributes` for control over when sessions are + // broken or reassigned. + FailoverAcrossPools param.Field[bool] `json:"failover_across_pools"` +} + +func (r ZoneLoadBalancerPatchParamsRulesOverridesAdaptiveRouting) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Controls location-based steering for non-proxied requests. See `steering_policy` +// to learn how steering is affected. +type ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategy struct { + // Determines the authoritative location when ECS is not preferred, does not exist + // in the request, or its GeoIP lookup is unsuccessful. + // + // - `"pop"`: Use the Cloudflare PoP location. + // - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is + // unsuccessful, use the Cloudflare PoP location. + Mode param.Field[ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyMode] `json:"mode"` + // Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the + // authoritative location. + // + // - `"always"`: Always prefer ECS. + // - `"never"`: Never prefer ECS. + // - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. + // - `"geo"`: Prefer ECS only when `steering_policy="geo"`. + PreferEcs param.Field[ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcs] `json:"prefer_ecs"` +} + +func (r ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategy) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Determines the authoritative location when ECS is not preferred, does not exist +// in the request, or its GeoIP lookup is unsuccessful. +// +// - `"pop"`: Use the Cloudflare PoP location. +// - `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is +// unsuccessful, use the Cloudflare PoP location. +type ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyMode string + +const ( + ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyModePop ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyMode = "pop" + ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyModeResolverIP ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyMode = "resolver_ip" +) + +// Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the +// authoritative location. +// +// - `"always"`: Always prefer ECS. +// - `"never"`: Never prefer ECS. +// - `"proximity"`: Prefer ECS only when `steering_policy="proximity"`. +// - `"geo"`: Prefer ECS only when `steering_policy="geo"`. +type ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcs string + +const ( + ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcsAlways ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcs = "always" + ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcsNever ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcs = "never" + ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcsProximity ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcs = "proximity" + ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcsGeo ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcs = "geo" +) + +// Configures pool weights. +// +// - `steering_policy="random"`: A random pool is selected with probability +// proportional to pool weights. +// - `steering_policy="least_outstanding_requests"`: Use pool weights to scale each +// pool's outstanding requests. +// - `steering_policy="least_connections"`: Use pool weights to scale each pool's +// open connections. +type ZoneLoadBalancerPatchParamsRulesOverridesRandomSteering struct { + // The default weight for pools in the load balancer that are not specified in the + // pool_weights map. + DefaultWeight param.Field[float64] `json:"default_weight"` + // A mapping of pool IDs to custom weights. The weight is relative to other pools + // in the load balancer. + PoolWeights param.Field[interface{}] `json:"pool_weights"` +} + +func (r ZoneLoadBalancerPatchParamsRulesOverridesRandomSteering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinity string + +const ( + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityNone ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinity = "none" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityCookie ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinity = "cookie" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityIPCookie ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinity = "ip_cookie" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityHeader ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinity = "header" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityEmpty ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinity = "\"\"" +) + +// Configures attributes for session affinity. +type ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributes struct { + // Configures the drain duration in seconds. This field is only used when session + // affinity is enabled on the load balancer. + DrainDuration param.Field[float64] `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers param.Field[[]string] `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders param.Field[bool] `json:"require_all_headers"` + // Configures the SameSite attribute on session affinity cookie. Value "Auto" will + // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: + // when using value "None", the secure attribute can not be set to "Never". + Samesite param.Field[ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesite] `json:"samesite"` + // Configures the Secure attribute on session affinity cookie. Value "Always" + // indicates the Secure attribute will be set in the Set-Cookie header, "Never" + // indicates the Secure attribute will not be set, and "Auto" will set the Secure + // attribute depending if Always Use HTTPS is enabled. + Secure param.Field[ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecure] `json:"secure"` + // Configures the zero-downtime failover between origins within a pool when session + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. + ZeroDowntimeFailover param.Field[ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover] `json:"zero_downtime_failover"` +} + +func (r ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures the SameSite attribute on session affinity cookie. Value "Auto" will +// be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: +// when using value "None", the secure attribute can not be set to "Never". +type ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesite string + +const ( + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesiteAuto ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesite = "Auto" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesiteLax ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesite = "Lax" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesiteNone ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesite = "None" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesiteStrict ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesite = "Strict" +) + +// Configures the Secure attribute on session affinity cookie. Value "Always" +// indicates the Secure attribute will be set in the Set-Cookie header, "Never" +// indicates the Secure attribute will not be set, and "Auto" will set the Secure +// attribute depending if Always Use HTTPS is enabled. +type ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecure string + +const ( + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecureAuto ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecure = "Auto" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecureAlways ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecure = "Always" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecureNever ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecure = "Never" +) + +// Configures the zero-downtime failover between origins within a pool when session +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. +type ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover string + +const ( + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverNone ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "none" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverTemporary ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "temporary" + ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailover = "sticky" +) + +// Steering Policy for this load balancer. +// +// - `"off"`: Use `default_pools`. +// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied +// requests, the country for `country_pools` is determined by +// `location_strategy`. +// - `"random"`: Select a pool randomly. +// - `"dynamic_latency"`: Use round trip time to select the closest pool in +// default_pools (requires pool health checks). +// - `"proximity"`: Use the pools' latitude and longitude to select the closest +// pool using the Cloudflare PoP location for proxied requests or the location +// determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. +// - `""`: Will map to `"geo"` if you use +// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. +type ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy string + +const ( + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyOff ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "off" + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyGeo ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "geo" + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyRandom ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "random" + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyDynamicLatency ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyProximity ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "proximity" + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyLeastConnections ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "least_connections" + ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyEmpty ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicy = "\"\"" +) + +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type ZoneLoadBalancerPatchParamsSessionAffinity string + +const ( + ZoneLoadBalancerPatchParamsSessionAffinityNone ZoneLoadBalancerPatchParamsSessionAffinity = "none" + ZoneLoadBalancerPatchParamsSessionAffinityCookie ZoneLoadBalancerPatchParamsSessionAffinity = "cookie" + ZoneLoadBalancerPatchParamsSessionAffinityIPCookie ZoneLoadBalancerPatchParamsSessionAffinity = "ip_cookie" + ZoneLoadBalancerPatchParamsSessionAffinityHeader ZoneLoadBalancerPatchParamsSessionAffinity = "header" + ZoneLoadBalancerPatchParamsSessionAffinityEmpty ZoneLoadBalancerPatchParamsSessionAffinity = "\"\"" +) + +// Configures attributes for session affinity. +type ZoneLoadBalancerPatchParamsSessionAffinityAttributes struct { + // Configures the drain duration in seconds. This field is only used when session + // affinity is enabled on the load balancer. + DrainDuration param.Field[float64] `json:"drain_duration"` + // Configures the names of HTTP headers to base session affinity on when header + // `session_affinity` is enabled. At least one HTTP header name must be provided. + // To specify the exact cookies to be used, include an item in the following + // format: `"cookie:,"` (example) where everything + // after the colon is a comma-separated list of cookie names. Providing only + // `"cookie"` will result in all cookies being used. The default max number of HTTP + // header names that can be provided depends on your plan: 5 for Enterprise, 1 for + // all other plans. + Headers param.Field[[]string] `json:"headers"` + // When header `session_affinity` is enabled, this option can be used to specify + // how HTTP headers on load balancing requests will be used. The supported values + // are: + // + // - `"true"`: Load balancing requests must contain _all_ of the HTTP headers + // specified by the `headers` session affinity attribute, otherwise sessions + // aren't created. + // - `"false"`: Load balancing requests must contain _at least one_ of the HTTP + // headers specified by the `headers` session affinity attribute, otherwise + // sessions aren't created. + RequireAllHeaders param.Field[bool] `json:"require_all_headers"` + // Configures the SameSite attribute on session affinity cookie. Value "Auto" will + // be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: + // when using value "None", the secure attribute can not be set to "Never". + Samesite param.Field[ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesite] `json:"samesite"` + // Configures the Secure attribute on session affinity cookie. Value "Always" + // indicates the Secure attribute will be set in the Set-Cookie header, "Never" + // indicates the Secure attribute will not be set, and "Auto" will set the Secure + // attribute depending if Always Use HTTPS is enabled. + Secure param.Field[ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecure] `json:"secure"` + // Configures the zero-downtime failover between origins within a pool when session + // affinity is enabled. This feature is currently incompatible with Argo, Tiered + // Cache, and Bandwidth Alliance. The supported values are: + // + // - `"none"`: No failover takes place for sessions pinned to the origin (default). + // - `"temporary"`: Traffic will be sent to another other healthy origin until the + // originally pinned origin is available; note that this can potentially result + // in heavy origin flapping. + // - `"sticky"`: The session affinity cookie is updated and subsequent requests are + // sent to the new origin. Note: Zero-downtime failover with sticky sessions is + // currently not supported for session affinity by header. + ZeroDowntimeFailover param.Field[ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailover] `json:"zero_downtime_failover"` +} + +func (r ZoneLoadBalancerPatchParamsSessionAffinityAttributes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures the SameSite attribute on session affinity cookie. Value "Auto" will +// be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: +// when using value "None", the secure attribute can not be set to "Never". +type ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesite string + +const ( + ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesiteAuto ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesite = "Auto" + ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesiteLax ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesite = "Lax" + ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesiteNone ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesite = "None" + ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesiteStrict ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesite = "Strict" +) + +// Configures the Secure attribute on session affinity cookie. Value "Always" +// indicates the Secure attribute will be set in the Set-Cookie header, "Never" +// indicates the Secure attribute will not be set, and "Auto" will set the Secure +// attribute depending if Always Use HTTPS is enabled. +type ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecure string + +const ( + ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecureAuto ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecure = "Auto" + ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecureAlways ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecure = "Always" + ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecureNever ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecure = "Never" +) + +// Configures the zero-downtime failover between origins within a pool when session +// affinity is enabled. This feature is currently incompatible with Argo, Tiered +// Cache, and Bandwidth Alliance. The supported values are: +// +// - `"none"`: No failover takes place for sessions pinned to the origin (default). +// - `"temporary"`: Traffic will be sent to another other healthy origin until the +// originally pinned origin is available; note that this can potentially result +// in heavy origin flapping. +// - `"sticky"`: The session affinity cookie is updated and subsequent requests are +// sent to the new origin. Note: Zero-downtime failover with sticky sessions is +// currently not supported for session affinity by header. +type ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailover string + +const ( + ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailoverNone ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailover = "none" + ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailoverTemporary ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailover = "temporary" + ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailoverSticky ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailover = "sticky" +) + +// Steering Policy for this load balancer. +// +// - `"off"`: Use `default_pools`. +// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied +// requests, the country for `country_pools` is determined by +// `location_strategy`. +// - `"random"`: Select a pool randomly. +// - `"dynamic_latency"`: Use round trip time to select the closest pool in +// default_pools (requires pool health checks). +// - `"proximity"`: Use the pools' latitude and longitude to select the closest +// pool using the Cloudflare PoP location for proxied requests or the location +// determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. +// - `""`: Will map to `"geo"` if you use +// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. +type ZoneLoadBalancerPatchParamsSteeringPolicy string + +const ( + ZoneLoadBalancerPatchParamsSteeringPolicyOff ZoneLoadBalancerPatchParamsSteeringPolicy = "off" + ZoneLoadBalancerPatchParamsSteeringPolicyGeo ZoneLoadBalancerPatchParamsSteeringPolicy = "geo" + ZoneLoadBalancerPatchParamsSteeringPolicyRandom ZoneLoadBalancerPatchParamsSteeringPolicy = "random" + ZoneLoadBalancerPatchParamsSteeringPolicyDynamicLatency ZoneLoadBalancerPatchParamsSteeringPolicy = "dynamic_latency" + ZoneLoadBalancerPatchParamsSteeringPolicyProximity ZoneLoadBalancerPatchParamsSteeringPolicy = "proximity" + ZoneLoadBalancerPatchParamsSteeringPolicyLeastOutstandingRequests ZoneLoadBalancerPatchParamsSteeringPolicy = "least_outstanding_requests" + ZoneLoadBalancerPatchParamsSteeringPolicyLeastConnections ZoneLoadBalancerPatchParamsSteeringPolicy = "least_connections" + ZoneLoadBalancerPatchParamsSteeringPolicyEmpty ZoneLoadBalancerPatchParamsSteeringPolicy = "\"\"" ) diff --git a/zoneloadbalancer_test.go b/zoneloadbalancer_test.go index 2ee7c8823ec..a58063c874b 100644 --- a/zoneloadbalancer_test.go +++ b/zoneloadbalancer_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneLoadBalancerNewWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneLoadBalancerNewWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.LoadBalancers.New( context.TODO(), @@ -140,11 +143,13 @@ func TestZoneLoadBalancerNewWithOptionalParams(t *testing.T) { }), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }), @@ -210,11 +215,13 @@ func TestZoneLoadBalancerNewWithOptionalParams(t *testing.T) { }), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }), @@ -280,11 +287,13 @@ func TestZoneLoadBalancerNewWithOptionalParams(t *testing.T) { }), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsRulesOverridesSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }), @@ -293,11 +302,13 @@ func TestZoneLoadBalancerNewWithOptionalParams(t *testing.T) { }}), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerNewParamsSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }, @@ -312,6 +323,7 @@ func TestZoneLoadBalancerNewWithOptionalParams(t *testing.T) { } func TestZoneLoadBalancerGet(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 @@ -321,8 +333,10 @@ func TestZoneLoadBalancerGet(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.LoadBalancers.Get( context.TODO(), @@ -339,6 +353,7 @@ func TestZoneLoadBalancerGet(t *testing.T) { } func TestZoneLoadBalancerUpdateWithOptionalParams(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 @@ -348,8 +363,10 @@ func TestZoneLoadBalancerUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.LoadBalancers.Update( context.TODO(), @@ -467,11 +484,13 @@ func TestZoneLoadBalancerUpdateWithOptionalParams(t *testing.T) { }), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }), @@ -537,11 +556,13 @@ func TestZoneLoadBalancerUpdateWithOptionalParams(t *testing.T) { }), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }), @@ -607,11 +628,13 @@ func TestZoneLoadBalancerUpdateWithOptionalParams(t *testing.T) { }), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsRulesOverridesSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }), @@ -620,11 +643,13 @@ func TestZoneLoadBalancerUpdateWithOptionalParams(t *testing.T) { }}), SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsSessionAffinityAttributes{ DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsSessionAffinityAttributesSamesiteAuto), Secure: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsSessionAffinityAttributesSecureAuto), ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsSessionAffinityAttributesZeroDowntimeFailoverSticky), }), - SessionAffinityTtl: cloudflare.F(5000.000000), + SessionAffinityTtl: cloudflare.F(1800.000000), SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerUpdateParamsSteeringPolicyDynamicLatency), Ttl: cloudflare.F(30.000000), }, @@ -639,6 +664,7 @@ func TestZoneLoadBalancerUpdateWithOptionalParams(t *testing.T) { } func TestZoneLoadBalancerList(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 @@ -648,8 +674,10 @@ func TestZoneLoadBalancerList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.LoadBalancers.List(context.TODO(), "699d98642c564d2e855e9661899b7252") if err != nil { @@ -662,6 +690,7 @@ func TestZoneLoadBalancerList(t *testing.T) { } func TestZoneLoadBalancerDelete(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 @@ -671,8 +700,10 @@ func TestZoneLoadBalancerDelete(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.LoadBalancers.Delete( context.TODO(), @@ -687,3 +718,314 @@ func TestZoneLoadBalancerDelete(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestZoneLoadBalancerPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.LoadBalancers.Patch( + context.TODO(), + "699d98642c564d2e855e9661899b7252", + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneLoadBalancerPatchParams{ + AdaptiveRouting: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsAdaptiveRouting{ + FailoverAcrossPools: cloudflare.F(true), + }), + CountryPools: cloudflare.F[any](map[string]interface{}{ + "GB": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + }, + "US": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + DefaultPools: cloudflare.F([]string{"17b5962d775c646f3f9725cbc7a53df4", "9290f38c5d07c2e2f4df57b1f61d4196", "00920f38ce07c2e2f4df50b1f61d4194"}), + Description: cloudflare.F("Load Balancer for www.example.com"), + Enabled: cloudflare.F(true), + FallbackPool: cloudflare.F[any](map[string]interface{}{}), + LocationStrategy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsLocationStrategy{ + Mode: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsLocationStrategyModeResolverIP), + PreferEcs: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsLocationStrategyPreferEcsAlways), + }), + Name: cloudflare.F("www.example.com"), + PopPools: cloudflare.F[any](map[string]interface{}{ + "LAX": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + "LHR": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + "1": "f9138c5d07c2e2f4df57b1f61d4196", + }, + "SJC": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + Proxied: cloudflare.F(true), + RandomSteering: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRandomSteering{ + DefaultWeight: cloudflare.F(0.200000), + PoolWeights: cloudflare.F[any](map[string]interface{}{ + "9290f38c5d07c2e2f4df57b1f61d4196": 0.500000, + "de90f38ced07c2e2f4df50b1f61d4194": 0.300000, + }), + }), + RegionPools: cloudflare.F[any](map[string]interface{}{ + "ENAM": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + "WNAM": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + }), + Rules: cloudflare.F([]cloudflare.ZoneLoadBalancerPatchParamsRule{{ + Condition: cloudflare.F("http.request.uri.path contains \"/testing\""), + Disabled: cloudflare.F(true), + FixedResponse: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesFixedResponse{ + ContentType: cloudflare.F("application/json"), + Location: cloudflare.F("www.example.com"), + MessageBody: cloudflare.F("Testing Hello"), + StatusCode: cloudflare.F(int64(0)), + }), + Name: cloudflare.F("route the path /testing to testing datacenter."), + Overrides: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverrides{ + AdaptiveRouting: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesAdaptiveRouting{ + FailoverAcrossPools: cloudflare.F(true), + }), + CountryPools: cloudflare.F[any](map[string]interface{}{ + "GB": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + }, + "US": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + DefaultPools: cloudflare.F([]string{"17b5962d775c646f3f9725cbc7a53df4", "9290f38c5d07c2e2f4df57b1f61d4196", "00920f38ce07c2e2f4df50b1f61d4194"}), + FallbackPool: cloudflare.F[any](map[string]interface{}{}), + LocationStrategy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategy{ + Mode: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyModeResolverIP), + PreferEcs: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcsAlways), + }), + PopPools: cloudflare.F[any](map[string]interface{}{ + "LAX": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + "LHR": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + "1": "f9138c5d07c2e2f4df57b1f61d4196", + }, + "SJC": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + RandomSteering: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesRandomSteering{ + DefaultWeight: cloudflare.F(0.200000), + PoolWeights: cloudflare.F[any](map[string]interface{}{ + "9290f38c5d07c2e2f4df57b1f61d4196": 0.500000, + "de90f38ced07c2e2f4df50b1f61d4194": 0.300000, + }), + }), + RegionPools: cloudflare.F[any](map[string]interface{}{ + "ENAM": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + "WNAM": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + }), + SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributes{ + DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), + Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), + Secure: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecureAuto), + ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), + }), + SessionAffinityTtl: cloudflare.F(1800.000000), + SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyDynamicLatency), + Ttl: cloudflare.F(30.000000), + }), + Priority: cloudflare.F(int64(0)), + Terminates: cloudflare.F(true), + }, { + Condition: cloudflare.F("http.request.uri.path contains \"/testing\""), + Disabled: cloudflare.F(true), + FixedResponse: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesFixedResponse{ + ContentType: cloudflare.F("application/json"), + Location: cloudflare.F("www.example.com"), + MessageBody: cloudflare.F("Testing Hello"), + StatusCode: cloudflare.F(int64(0)), + }), + Name: cloudflare.F("route the path /testing to testing datacenter."), + Overrides: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverrides{ + AdaptiveRouting: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesAdaptiveRouting{ + FailoverAcrossPools: cloudflare.F(true), + }), + CountryPools: cloudflare.F[any](map[string]interface{}{ + "GB": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + }, + "US": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + DefaultPools: cloudflare.F([]string{"17b5962d775c646f3f9725cbc7a53df4", "9290f38c5d07c2e2f4df57b1f61d4196", "00920f38ce07c2e2f4df50b1f61d4194"}), + FallbackPool: cloudflare.F[any](map[string]interface{}{}), + LocationStrategy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategy{ + Mode: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyModeResolverIP), + PreferEcs: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcsAlways), + }), + PopPools: cloudflare.F[any](map[string]interface{}{ + "LAX": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + "LHR": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + "1": "f9138c5d07c2e2f4df57b1f61d4196", + }, + "SJC": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + RandomSteering: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesRandomSteering{ + DefaultWeight: cloudflare.F(0.200000), + PoolWeights: cloudflare.F[any](map[string]interface{}{ + "9290f38c5d07c2e2f4df57b1f61d4196": 0.500000, + "de90f38ced07c2e2f4df50b1f61d4194": 0.300000, + }), + }), + RegionPools: cloudflare.F[any](map[string]interface{}{ + "ENAM": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + "WNAM": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + }), + SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributes{ + DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), + Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), + Secure: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecureAuto), + ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), + }), + SessionAffinityTtl: cloudflare.F(1800.000000), + SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyDynamicLatency), + Ttl: cloudflare.F(30.000000), + }), + Priority: cloudflare.F(int64(0)), + Terminates: cloudflare.F(true), + }, { + Condition: cloudflare.F("http.request.uri.path contains \"/testing\""), + Disabled: cloudflare.F(true), + FixedResponse: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesFixedResponse{ + ContentType: cloudflare.F("application/json"), + Location: cloudflare.F("www.example.com"), + MessageBody: cloudflare.F("Testing Hello"), + StatusCode: cloudflare.F(int64(0)), + }), + Name: cloudflare.F("route the path /testing to testing datacenter."), + Overrides: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverrides{ + AdaptiveRouting: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesAdaptiveRouting{ + FailoverAcrossPools: cloudflare.F(true), + }), + CountryPools: cloudflare.F[any](map[string]interface{}{ + "GB": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + }, + "US": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + DefaultPools: cloudflare.F([]string{"17b5962d775c646f3f9725cbc7a53df4", "9290f38c5d07c2e2f4df57b1f61d4196", "00920f38ce07c2e2f4df50b1f61d4194"}), + FallbackPool: cloudflare.F[any](map[string]interface{}{}), + LocationStrategy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategy{ + Mode: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyModeResolverIP), + PreferEcs: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesLocationStrategyPreferEcsAlways), + }), + PopPools: cloudflare.F[any](map[string]interface{}{ + "LAX": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + "LHR": map[string]interface{}{ + "0": "abd90f38ced07c2e2f4df50b1f61d4194", + "1": "f9138c5d07c2e2f4df57b1f61d4196", + }, + "SJC": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + }), + RandomSteering: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesRandomSteering{ + DefaultWeight: cloudflare.F(0.200000), + PoolWeights: cloudflare.F[any](map[string]interface{}{ + "9290f38c5d07c2e2f4df57b1f61d4196": 0.500000, + "de90f38ced07c2e2f4df50b1f61d4194": 0.300000, + }), + }), + RegionPools: cloudflare.F[any](map[string]interface{}{ + "ENAM": map[string]interface{}{ + "0": "00920f38ce07c2e2f4df50b1f61d4194", + }, + "WNAM": map[string]interface{}{ + "0": "de90f38ced07c2e2f4df50b1f61d4194", + "1": "9290f38c5d07c2e2f4df57b1f61d4196", + }, + }), + SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributes{ + DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), + Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSamesiteAuto), + Secure: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesSecureAuto), + ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSessionAffinityAttributesZeroDowntimeFailoverSticky), + }), + SessionAffinityTtl: cloudflare.F(1800.000000), + SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsRulesOverridesSteeringPolicyDynamicLatency), + Ttl: cloudflare.F(30.000000), + }), + Priority: cloudflare.F(int64(0)), + Terminates: cloudflare.F(true), + }}), + SessionAffinityAttributes: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsSessionAffinityAttributes{ + DrainDuration: cloudflare.F(100.000000), + Headers: cloudflare.F([]string{"x"}), + RequireAllHeaders: cloudflare.F(true), + Samesite: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsSessionAffinityAttributesSamesiteAuto), + Secure: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsSessionAffinityAttributesSecureAuto), + ZeroDowntimeFailover: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsSessionAffinityAttributesZeroDowntimeFailoverSticky), + }), + SessionAffinityTtl: cloudflare.F(1800.000000), + SteeringPolicy: cloudflare.F(cloudflare.ZoneLoadBalancerPatchParamsSteeringPolicyDynamicLatency), + Ttl: cloudflare.F(30.000000), + }, + ) + 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/zonelog.go b/zonelog.go new file mode 100644 index 00000000000..e0460babb50 --- /dev/null +++ b/zonelog.go @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogService 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 [NewZoneLogService] method instead. +type ZoneLogService struct { + Options []option.RequestOption + Controls *ZoneLogControlService + Rayids *ZoneLogRayidService + Receiveds *ZoneLogReceivedService +} + +// NewZoneLogService 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 NewZoneLogService(opts ...option.RequestOption) (r *ZoneLogService) { + r = &ZoneLogService{} + r.Options = opts + r.Controls = NewZoneLogControlService(opts...) + r.Rayids = NewZoneLogRayidService(opts...) + r.Receiveds = NewZoneLogReceivedService(opts...) + return +} diff --git a/zonelogcontrol.go b/zonelogcontrol.go new file mode 100644 index 00000000000..22a51437bd0 --- /dev/null +++ b/zonelogcontrol.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogControlService 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 [NewZoneLogControlService] method +// instead. +type ZoneLogControlService struct { + Options []option.RequestOption + Retentions *ZoneLogControlRetentionService +} + +// NewZoneLogControlService 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 NewZoneLogControlService(opts ...option.RequestOption) (r *ZoneLogControlService) { + r = &ZoneLogControlService{} + r.Options = opts + r.Retentions = NewZoneLogControlRetentionService(opts...) + return +} diff --git a/zonelogcontrolretention.go b/zonelogcontrolretention.go new file mode 100644 index 00000000000..b44f180c0b9 --- /dev/null +++ b/zonelogcontrolretention.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogControlRetentionService 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 +// [NewZoneLogControlRetentionService] method instead. +type ZoneLogControlRetentionService struct { + Options []option.RequestOption + Flags *ZoneLogControlRetentionFlagService +} + +// NewZoneLogControlRetentionService 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 NewZoneLogControlRetentionService(opts ...option.RequestOption) (r *ZoneLogControlRetentionService) { + r = &ZoneLogControlRetentionService{} + r.Options = opts + r.Flags = NewZoneLogControlRetentionFlagService(opts...) + return +} diff --git a/zonelogcontrolretentionflag.go b/zonelogcontrolretentionflag.go new file mode 100644 index 00000000000..dc8e8d4de60 --- /dev/null +++ b/zonelogcontrolretentionflag.go @@ -0,0 +1,237 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogControlRetentionFlagService 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 +// [NewZoneLogControlRetentionFlagService] method instead. +type ZoneLogControlRetentionFlagService struct { + Options []option.RequestOption +} + +// NewZoneLogControlRetentionFlagService 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 NewZoneLogControlRetentionFlagService(opts ...option.RequestOption) (r *ZoneLogControlRetentionFlagService) { + r = &ZoneLogControlRetentionFlagService{} + r.Options = opts + return +} + +// Gets log retention flag for Logpull API. +func (r *ZoneLogControlRetentionFlagService) LogsReceivedGetLogRetentionFlag(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logs/control/retention/flag", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates log retention flag for Logpull API. +func (r *ZoneLogControlRetentionFlagService) LogsReceivedUpdateLogRetentionFlag(ctx context.Context, zoneIdentifier string, body ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagParams, opts ...option.RequestOption) (res *ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logs/control/retention/flag", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse struct { + Errors []ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseError `json:"errors"` + Messages []ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseMessage `json:"messages"` + Result ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseSuccess `json:"success"` + JSON zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseJSON contains +// the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse] +type zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseErrorJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseError] +type zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseMessageJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseMessage] +type zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseResult struct { + Flag bool `json:"flag"` + JSON zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseResultJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseResult] +type zoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseResultJSON struct { + Flag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseSuccess bool + +const ( + ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseSuccessTrue ZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponseSuccess = true +) + +type ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponse struct { + Errors []ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseError `json:"errors"` + Messages []ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseMessage `json:"messages"` + Result ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseSuccess `json:"success"` + JSON zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseJSON +// contains the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponse] +type zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseErrorJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseError] +type zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseMessageJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseMessage] +type zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseResult struct { + Flag bool `json:"flag"` + JSON zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseResultJSON `json:"-"` +} + +// zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseResult] +type zoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseResultJSON struct { + Flag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseSuccess bool + +const ( + ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseSuccessTrue ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagResponseSuccess = true +) + +type ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagParams struct { + // The log retention flag for Logpull API. + Flag param.Field[bool] `json:"flag,required"` +} + +func (r ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonelogcontrolretentionflag_test.go b/zonelogcontrolretentionflag_test.go new file mode 100644 index 00000000000..d7a38188b31 --- /dev/null +++ b/zonelogcontrolretentionflag_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogControlRetentionFlagLogsReceivedGetLogRetentionFlag(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logs.Controls.Retentions.Flags.LogsReceivedGetLogRetentionFlag(context.TODO(), "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()) + } +} + +func TestZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlag(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logs.Controls.Retentions.Flags.LogsReceivedUpdateLogRetentionFlag( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogControlRetentionFlagLogsReceivedUpdateLogRetentionFlagParams{ + Flag: cloudflare.F(true), + }, + ) + 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/zonelogpush.go b/zonelogpush.go new file mode 100644 index 00000000000..397b874fb49 --- /dev/null +++ b/zonelogpush.go @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushService 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 [NewZoneLogpushService] method +// instead. +type ZoneLogpushService struct { + Options []option.RequestOption + Datasets *ZoneLogpushDatasetService + Edges *ZoneLogpushEdgeService + Jobs *ZoneLogpushJobService + Ownerships *ZoneLogpushOwnershipService + Validates *ZoneLogpushValidateService +} + +// NewZoneLogpushService 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 NewZoneLogpushService(opts ...option.RequestOption) (r *ZoneLogpushService) { + r = &ZoneLogpushService{} + r.Options = opts + r.Datasets = NewZoneLogpushDatasetService(opts...) + r.Edges = NewZoneLogpushEdgeService(opts...) + r.Jobs = NewZoneLogpushJobService(opts...) + r.Ownerships = NewZoneLogpushOwnershipService(opts...) + r.Validates = NewZoneLogpushValidateService(opts...) + return +} diff --git a/zonelogpushdataset.go b/zonelogpushdataset.go new file mode 100644 index 00000000000..26b3d97e9d8 --- /dev/null +++ b/zonelogpushdataset.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushDatasetService 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 [NewZoneLogpushDatasetService] method +// instead. +type ZoneLogpushDatasetService struct { + Options []option.RequestOption + Fields *ZoneLogpushDatasetFieldService + Jobs *ZoneLogpushDatasetJobService +} + +// NewZoneLogpushDatasetService 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 NewZoneLogpushDatasetService(opts ...option.RequestOption) (r *ZoneLogpushDatasetService) { + r = &ZoneLogpushDatasetService{} + r.Options = opts + r.Fields = NewZoneLogpushDatasetFieldService(opts...) + r.Jobs = NewZoneLogpushDatasetJobService(opts...) + return +} diff --git a/zonelogpushdatasetfield.go b/zonelogpushdatasetfield.go new file mode 100644 index 00000000000..09a8c0fc518 --- /dev/null +++ b/zonelogpushdatasetfield.go @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushDatasetFieldService 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 +// [NewZoneLogpushDatasetFieldService] method instead. +type ZoneLogpushDatasetFieldService struct { + Options []option.RequestOption +} + +// NewZoneLogpushDatasetFieldService 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 NewZoneLogpushDatasetFieldService(opts ...option.RequestOption) (r *ZoneLogpushDatasetFieldService) { + r = &ZoneLogpushDatasetFieldService{} + r.Options = opts + return +} + +// Lists all fields available for a dataset. The response result is an object with +// key-value pairs, where keys are field names, and values are descriptions. +func (r *ZoneLogpushDatasetFieldService) GetZonesZoneIdentifierLogpushDatasetsDatasetFields(ctx context.Context, zoneIdentifier string, dataset string, opts ...option.RequestOption) (res *ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/datasets/%s/fields", zoneIdentifier, dataset) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponse struct { + Errors []ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseError `json:"errors"` + Messages []ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseSuccess `json:"success"` + JSON zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseJSON `json:"-"` +} + +// zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseJSON +// contains the JSON metadata for the struct +// [ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponse] +type zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseErrorJSON `json:"-"` +} + +// zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseError] +type zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseMessageJSON `json:"-"` +} + +// zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseMessage] +type zoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseSuccess bool + +const ( + ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseSuccessTrue ZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFieldsResponseSuccess = true +) diff --git a/zonelogpushdatasetfield_test.go b/zonelogpushdatasetfield_test.go new file mode 100644 index 00000000000..611901232d0 --- /dev/null +++ b/zonelogpushdatasetfield_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushDatasetFieldGetZonesZoneIdentifierLogpushDatasetsDatasetFields(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Datasets.Fields.GetZonesZoneIdentifierLogpushDatasetsDatasetFields( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "http_requests", + ) + 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/zonelogpushdatasetjob.go b/zonelogpushdatasetjob.go new file mode 100644 index 00000000000..13d257e5656 --- /dev/null +++ b/zonelogpushdatasetjob.go @@ -0,0 +1,185 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushDatasetJobService 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 [NewZoneLogpushDatasetJobService] +// method instead. +type ZoneLogpushDatasetJobService struct { + Options []option.RequestOption +} + +// NewZoneLogpushDatasetJobService 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 NewZoneLogpushDatasetJobService(opts ...option.RequestOption) (r *ZoneLogpushDatasetJobService) { + r = &ZoneLogpushDatasetJobService{} + r.Options = opts + return +} + +// Lists Logpush jobs for a zone for a dataset. +func (r *ZoneLogpushDatasetJobService) GetZonesZoneIdentifierLogpushDatasetsDatasetJobs(ctx context.Context, zoneIdentifier string, dataset string, opts ...option.RequestOption) (res *ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/datasets/%s/jobs", zoneIdentifier, dataset) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponse struct { + Errors []ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseError `json:"errors"` + Messages []ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseMessage `json:"messages"` + Result []ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseSuccess `json:"success"` + JSON zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseJSON `json:"-"` +} + +// zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseJSON +// contains the JSON metadata for the struct +// [ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponse] +type zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseErrorJSON `json:"-"` +} + +// zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseError] +type zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseMessageJSON `json:"-"` +} + +// zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseMessage] +type zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultJSON `json:"-"` +} + +// zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResult] +type zoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency string + +const ( + ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultFrequencyHigh ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency = "high" + ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultFrequencyLow ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseResultFrequency = "low" +) + +// Whether the API call was successful +type ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseSuccess bool + +const ( + ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseSuccessTrue ZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobsResponseSuccess = true +) diff --git a/zonelogpushdatasetjob_test.go b/zonelogpushdatasetjob_test.go new file mode 100644 index 00000000000..dd9ad82628d --- /dev/null +++ b/zonelogpushdatasetjob_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushDatasetJobGetZonesZoneIdentifierLogpushDatasetsDatasetJobs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Datasets.Jobs.GetZonesZoneIdentifierLogpushDatasetsDatasetJobs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "http_requests", + ) + 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/zonelogpushedge.go b/zonelogpushedge.go new file mode 100644 index 00000000000..dff00378747 --- /dev/null +++ b/zonelogpushedge.go @@ -0,0 +1,270 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushEdgeService 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 [NewZoneLogpushEdgeService] method +// instead. +type ZoneLogpushEdgeService struct { + Options []option.RequestOption +} + +// NewZoneLogpushEdgeService 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 NewZoneLogpushEdgeService(opts ...option.RequestOption) (r *ZoneLogpushEdgeService) { + r = &ZoneLogpushEdgeService{} + r.Options = opts + return +} + +// Lists Instant Logs jobs for a zone. +func (r *ZoneLogpushEdgeService) GetZonesZoneIdentifierLogpushEdgeJobs(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/edge", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Creates a new Instant Logs job for a zone. +func (r *ZoneLogpushEdgeService) PostZonesZoneIdentifierLogpushEdgeJobs(ctx context.Context, zoneIdentifier string, body ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsParams, opts ...option.RequestOption) (res *ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/edge", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponse struct { + Errors []ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseError `json:"errors"` + Messages []ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseMessage `json:"messages"` + Result []ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseSuccess `json:"success"` + JSON zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseJSON `json:"-"` +} + +// zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseJSON contains the +// JSON metadata for the struct +// [ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponse] +type zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseErrorJSON `json:"-"` +} + +// zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseError] +type zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseMessageJSON `json:"-"` +} + +// zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseMessage] +type zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseResult struct { + // Unique WebSocket address that will receive messages from Cloudflare’s edge. + DestinationConf string `json:"destination_conf" format:"uri"` + // Comma-separated list of fields. + Fields string `json:"fields"` + // Filters to drill down into specific events. + Filter string `json:"filter"` + // The sample parameter is the sample rate of the records set by the client: + // "sample": 1 is 100% of records "sample": 10 is 10% and so on. + Sample int64 `json:"sample"` + // Unique session id of the job. + SessionID string `json:"session_id"` + JSON zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseResultJSON `json:"-"` +} + +// zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseResult] +type zoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseResultJSON struct { + DestinationConf apijson.Field + Fields apijson.Field + Filter apijson.Field + Sample apijson.Field + SessionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseSuccess bool + +const ( + ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseSuccessTrue ZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobsResponseSuccess = true +) + +type ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponse struct { + Errors []ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseError `json:"errors"` + Messages []ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseMessage `json:"messages"` + Result ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseSuccess `json:"success"` + JSON zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseJSON `json:"-"` +} + +// zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseJSON contains the +// JSON metadata for the struct +// [ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponse] +type zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseErrorJSON `json:"-"` +} + +// zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseError] +type zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseMessageJSON `json:"-"` +} + +// zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseMessage] +type zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseResult struct { + // Unique WebSocket address that will receive messages from Cloudflare’s edge. + DestinationConf string `json:"destination_conf" format:"uri"` + // Comma-separated list of fields. + Fields string `json:"fields"` + // Filters to drill down into specific events. + Filter string `json:"filter"` + // The sample parameter is the sample rate of the records set by the client: + // "sample": 1 is 100% of records "sample": 10 is 10% and so on. + Sample int64 `json:"sample"` + // Unique session id of the job. + SessionID string `json:"session_id"` + JSON zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseResultJSON `json:"-"` +} + +// zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseResult] +type zoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseResultJSON struct { + DestinationConf apijson.Field + Fields apijson.Field + Filter apijson.Field + Sample apijson.Field + SessionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseSuccess bool + +const ( + ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseSuccessTrue ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsResponseSuccess = true +) + +type ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsParams struct { + // Comma-separated list of fields. + Fields param.Field[string] `json:"fields"` + // Filters to drill down into specific events. + Filter param.Field[string] `json:"filter"` + // The sample parameter is the sample rate of the records set by the client: + // "sample": 1 is 100% of records "sample": 10 is 10% and so on. + Sample param.Field[int64] `json:"sample"` +} + +func (r ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonelogpushedge_test.go b/zonelogpushedge_test.go new file mode 100644 index 00000000000..600f5256a4b --- /dev/null +++ b/zonelogpushedge_test.go @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushEdgeGetZonesZoneIdentifierLogpushEdgeJobs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Edges.GetZonesZoneIdentifierLogpushEdgeJobs(context.TODO(), "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()) + } +} + +func TestZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Edges.PostZonesZoneIdentifierLogpushEdgeJobs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogpushEdgePostZonesZoneIdentifierLogpushEdgeJobsParams{ + Fields: cloudflare.F("ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID"), + Filter: cloudflare.F("{\"where\":{\"and\":[{\"key\":\"ClientCountry\",\"operator\":\"neq\",\"value\":\"ca\"}]}}"), + Sample: cloudflare.F(int64(1)), + }, + ) + 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/zonelogpushjob.go b/zonelogpushjob.go new file mode 100644 index 00000000000..80a28b247fc --- /dev/null +++ b/zonelogpushjob.go @@ -0,0 +1,788 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushJobService 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 [NewZoneLogpushJobService] method +// instead. +type ZoneLogpushJobService struct { + Options []option.RequestOption +} + +// NewZoneLogpushJobService 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 NewZoneLogpushJobService(opts ...option.RequestOption) (r *ZoneLogpushJobService) { + r = &ZoneLogpushJobService{} + r.Options = opts + return +} + +// Gets the details of a Logpush job. +func (r *ZoneLogpushJobService) Get(ctx context.Context, zoneIdentifier string, jobIdentifier int64, opts ...option.RequestOption) (res *ZoneLogpushJobGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/jobs/%v", zoneIdentifier, jobIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a Logpush job. +func (r *ZoneLogpushJobService) Update(ctx context.Context, zoneIdentifier string, jobIdentifier int64, body ZoneLogpushJobUpdateParams, opts ...option.RequestOption) (res *ZoneLogpushJobUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/jobs/%v", zoneIdentifier, jobIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a Logpush job. +func (r *ZoneLogpushJobService) Delete(ctx context.Context, zoneIdentifier string, jobIdentifier int64, opts ...option.RequestOption) (res *ZoneLogpushJobDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/jobs/%v", zoneIdentifier, jobIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Lists Logpush jobs for a zone. +func (r *ZoneLogpushJobService) GetZonesZoneIdentifierLogpushJobs(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/jobs", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Creates a new Logpush job for a zone. +func (r *ZoneLogpushJobService) PostZonesZoneIdentifierLogpushJobs(ctx context.Context, zoneIdentifier string, body ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParams, opts ...option.RequestOption) (res *ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/jobs", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneLogpushJobGetResponse struct { + Errors []ZoneLogpushJobGetResponseError `json:"errors"` + Messages []ZoneLogpushJobGetResponseMessage `json:"messages"` + Result ZoneLogpushJobGetResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushJobGetResponseSuccess `json:"success"` + JSON zoneLogpushJobGetResponseJSON `json:"-"` +} + +// zoneLogpushJobGetResponseJSON contains the JSON metadata for the struct +// [ZoneLogpushJobGetResponse] +type zoneLogpushJobGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobGetResponseErrorJSON `json:"-"` +} + +// zoneLogpushJobGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneLogpushJobGetResponseError] +type zoneLogpushJobGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobGetResponseMessageJSON `json:"-"` +} + +// zoneLogpushJobGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneLogpushJobGetResponseMessage] +type zoneLogpushJobGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobGetResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency ZoneLogpushJobGetResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON zoneLogpushJobGetResponseResultJSON `json:"-"` +} + +// zoneLogpushJobGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneLogpushJobGetResponseResult] +type zoneLogpushJobGetResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type ZoneLogpushJobGetResponseResultFrequency string + +const ( + ZoneLogpushJobGetResponseResultFrequencyHigh ZoneLogpushJobGetResponseResultFrequency = "high" + ZoneLogpushJobGetResponseResultFrequencyLow ZoneLogpushJobGetResponseResultFrequency = "low" +) + +// Whether the API call was successful +type ZoneLogpushJobGetResponseSuccess bool + +const ( + ZoneLogpushJobGetResponseSuccessTrue ZoneLogpushJobGetResponseSuccess = true +) + +type ZoneLogpushJobUpdateResponse struct { + Errors []ZoneLogpushJobUpdateResponseError `json:"errors"` + Messages []ZoneLogpushJobUpdateResponseMessage `json:"messages"` + Result ZoneLogpushJobUpdateResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushJobUpdateResponseSuccess `json:"success"` + JSON zoneLogpushJobUpdateResponseJSON `json:"-"` +} + +// zoneLogpushJobUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneLogpushJobUpdateResponse] +type zoneLogpushJobUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobUpdateResponseErrorJSON `json:"-"` +} + +// zoneLogpushJobUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneLogpushJobUpdateResponseError] +type zoneLogpushJobUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobUpdateResponseMessageJSON `json:"-"` +} + +// zoneLogpushJobUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneLogpushJobUpdateResponseMessage] +type zoneLogpushJobUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobUpdateResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency ZoneLogpushJobUpdateResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON zoneLogpushJobUpdateResponseResultJSON `json:"-"` +} + +// zoneLogpushJobUpdateResponseResultJSON contains the JSON metadata for the struct +// [ZoneLogpushJobUpdateResponseResult] +type zoneLogpushJobUpdateResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type ZoneLogpushJobUpdateResponseResultFrequency string + +const ( + ZoneLogpushJobUpdateResponseResultFrequencyHigh ZoneLogpushJobUpdateResponseResultFrequency = "high" + ZoneLogpushJobUpdateResponseResultFrequencyLow ZoneLogpushJobUpdateResponseResultFrequency = "low" +) + +// Whether the API call was successful +type ZoneLogpushJobUpdateResponseSuccess bool + +const ( + ZoneLogpushJobUpdateResponseSuccessTrue ZoneLogpushJobUpdateResponseSuccess = true +) + +type ZoneLogpushJobDeleteResponse struct { + Errors []ZoneLogpushJobDeleteResponseError `json:"errors"` + Messages []ZoneLogpushJobDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushJobDeleteResponseSuccess `json:"success"` + JSON zoneLogpushJobDeleteResponseJSON `json:"-"` +} + +// zoneLogpushJobDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneLogpushJobDeleteResponse] +type zoneLogpushJobDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobDeleteResponseErrorJSON `json:"-"` +} + +// zoneLogpushJobDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneLogpushJobDeleteResponseError] +type zoneLogpushJobDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobDeleteResponseMessageJSON `json:"-"` +} + +// zoneLogpushJobDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneLogpushJobDeleteResponseMessage] +type zoneLogpushJobDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushJobDeleteResponseSuccess bool + +const ( + ZoneLogpushJobDeleteResponseSuccessTrue ZoneLogpushJobDeleteResponseSuccess = true +) + +type ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponse struct { + Errors []ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseError `json:"errors"` + Messages []ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseMessage `json:"messages"` + Result []ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseSuccess `json:"success"` + JSON zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseJSON `json:"-"` +} + +// zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseJSON contains the JSON +// metadata for the struct +// [ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponse] +type zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseErrorJSON `json:"-"` +} + +// zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseError] +type zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseMessageJSON `json:"-"` +} + +// zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseMessage] +type zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultJSON `json:"-"` +} + +// zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResult] +type zoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultFrequency string + +const ( + ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultFrequencyHigh ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultFrequency = "high" + ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultFrequencyLow ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseResultFrequency = "low" +) + +// Whether the API call was successful +type ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseSuccess bool + +const ( + ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseSuccessTrue ZoneLogpushJobGetZonesZoneIdentifierLogpushJobsResponseSuccess = true +) + +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponse struct { + Errors []ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseError `json:"errors"` + Messages []ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseMessage `json:"messages"` + Result ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseSuccess `json:"success"` + JSON zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseJSON `json:"-"` +} + +// zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseJSON contains the JSON +// metadata for the struct +// [ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponse] +type zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseErrorJSON `json:"-"` +} + +// zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseError] +type zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseMessageJSON `json:"-"` +} + +// zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseMessage] +type zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResult struct { + // Unique id of the job. + ID int64 `json:"id"` + // Name of the dataset. + Dataset string `json:"dataset,nullable"` + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf string `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled bool `json:"enabled"` + // If not null, the job is currently failing. Failures are usually repetitive + // (example: no permissions to write to destination bucket). Only the last failure + // is recorded. On successful execution of a job the error_message and last_error + // are set to null. + ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultFrequency `json:"frequency,nullable"` + // Records the last time for which logs have been successfully pushed. If the last + // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z + // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never + // run or has just been enabled and hasn't run yet then the field will be empty. + LastComplete time.Time `json:"last_complete,nullable" format:"date-time"` + // Records the last time the job failed. If not null, the job is currently failing. + // If null, the job has either never failed or has run successfully at least once + // since last failure. See also the error_message field. + LastError time.Time `json:"last_error,nullable" format:"date-time"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name string `json:"name,nullable"` + JSON zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultJSON `json:"-"` +} + +// zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResult] +type zoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultJSON struct { + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultFrequency string + +const ( + ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultFrequencyHigh ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultFrequency = "high" + ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultFrequencyLow ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseResultFrequency = "low" +) + +// Whether the API call was successful +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseSuccess bool + +const ( + ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseSuccessTrue ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsResponseSuccess = true +) + +type ZoneLogpushJobUpdateParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf" format:"uri"` + // Flag that indicates if the job is enabled. + Enabled param.Field[bool] `json:"enabled"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency param.Field[ZoneLogpushJobUpdateParamsFrequency] `json:"frequency"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions param.Field[string] `json:"logpull_options" format:"uri-reference"` + // Ownership challenge token to prove destination ownership. + OwnershipChallenge param.Field[string] `json:"ownership_challenge"` +} + +func (r ZoneLogpushJobUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type ZoneLogpushJobUpdateParamsFrequency string + +const ( + ZoneLogpushJobUpdateParamsFrequencyHigh ZoneLogpushJobUpdateParamsFrequency = "high" + ZoneLogpushJobUpdateParamsFrequencyLow ZoneLogpushJobUpdateParamsFrequency = "low" +) + +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` + // Name of the dataset. + Dataset param.Field[string] `json:"dataset"` + // Flag that indicates if the job is enabled. + Enabled param.Field[bool] `json:"enabled"` + // The frequency at which Cloudflare sends batches of logs to your destination. + // Setting frequency to high sends your logs in larger quantities of smaller files. + // Setting frequency to low sends logs in smaller quantities of larger files. + Frequency param.Field[ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParamsFrequency] `json:"frequency"` + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions param.Field[string] `json:"logpull_options" format:"uri-reference"` + // Optional human readable job name. Not unique. Cloudflare suggests that you set + // this to a meaningful string, like the domain name, to make it easier to identify + // your job. + Name param.Field[string] `json:"name"` + // Ownership challenge token to prove destination ownership. + OwnershipChallenge param.Field[string] `json:"ownership_challenge"` +} + +func (r ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The frequency at which Cloudflare sends batches of logs to your destination. +// Setting frequency to high sends your logs in larger quantities of smaller files. +// Setting frequency to low sends logs in smaller quantities of larger files. +type ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParamsFrequency string + +const ( + ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParamsFrequencyHigh ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParamsFrequency = "high" + ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParamsFrequencyLow ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParamsFrequency = "low" +) diff --git a/zonelogpushjob_test.go b/zonelogpushjob_test.go new file mode 100644 index 00000000000..eaa235bf7b5 --- /dev/null +++ b/zonelogpushjob_test.go @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushJobGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Jobs.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(1), + ) + 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 TestZoneLogpushJobUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Jobs.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(1), + cloudflare.ZoneLogpushJobUpdateParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + Enabled: cloudflare.F(false), + Frequency: cloudflare.F(cloudflare.ZoneLogpushJobUpdateParamsFrequencyHigh), + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + OwnershipChallenge: cloudflare.F("00000000000000000000"), + }, + ) + 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 TestZoneLogpushJobDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Jobs.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + int64(1), + ) + 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 TestZoneLogpushJobGetZonesZoneIdentifierLogpushJobs(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Jobs.GetZonesZoneIdentifierLogpushJobs(context.TODO(), "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()) + } +} + +func TestZoneLogpushJobPostZonesZoneIdentifierLogpushJobsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Jobs.PostZonesZoneIdentifierLogpushJobs( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + Dataset: cloudflare.F("http_requests"), + Enabled: cloudflare.F(false), + Frequency: cloudflare.F(cloudflare.ZoneLogpushJobPostZonesZoneIdentifierLogpushJobsParamsFrequencyHigh), + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + Name: cloudflare.F("example.com"), + OwnershipChallenge: cloudflare.F("00000000000000000000"), + }, + ) + 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/zonelogpushownership.go b/zonelogpushownership.go new file mode 100644 index 00000000000..1e592f218c2 --- /dev/null +++ b/zonelogpushownership.go @@ -0,0 +1,147 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushOwnershipService 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 [NewZoneLogpushOwnershipService] +// method instead. +type ZoneLogpushOwnershipService struct { + Options []option.RequestOption + Validates *ZoneLogpushOwnershipValidateService +} + +// NewZoneLogpushOwnershipService 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 NewZoneLogpushOwnershipService(opts ...option.RequestOption) (r *ZoneLogpushOwnershipService) { + r = &ZoneLogpushOwnershipService{} + r.Options = opts + r.Validates = NewZoneLogpushOwnershipValidateService(opts...) + return +} + +// Gets a new ownership challenge sent to your destination. +func (r *ZoneLogpushOwnershipService) PostZonesZoneIdentifierLogpushOwnership(ctx context.Context, zoneIdentifier string, body ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipParams, opts ...option.RequestOption) (res *ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/ownership", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponse struct { + Errors []ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseError `json:"errors"` + Messages []ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseMessage `json:"messages"` + Result ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseSuccess `json:"success"` + JSON zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseJSON `json:"-"` +} + +// zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseJSON contains +// the JSON metadata for the struct +// [ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponse] +type zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseErrorJSON `json:"-"` +} + +// zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseError] +type zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseMessageJSON `json:"-"` +} + +// zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseMessage] +type zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseResult struct { + Filename string `json:"filename"` + Message string `json:"message"` + Valid bool `json:"valid"` + JSON zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseResultJSON `json:"-"` +} + +// zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseResult] +type zoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseResultJSON struct { + Filename apijson.Field + Message apijson.Field + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseSuccess bool + +const ( + ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseSuccessTrue ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipResponseSuccess = true +) + +type ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` +} + +func (r ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonelogpushownership_test.go b/zonelogpushownership_test.go new file mode 100644 index 00000000000..c55c16fc8dd --- /dev/null +++ b/zonelogpushownership_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnership(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Ownerships.PostZonesZoneIdentifierLogpushOwnership( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogpushOwnershipPostZonesZoneIdentifierLogpushOwnershipParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + }, + ) + 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/zonelogpushownershipvalidate.go b/zonelogpushownershipvalidate.go new file mode 100644 index 00000000000..4d53459d94f --- /dev/null +++ b/zonelogpushownershipvalidate.go @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushOwnershipValidateService 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 +// [NewZoneLogpushOwnershipValidateService] method instead. +type ZoneLogpushOwnershipValidateService struct { + Options []option.RequestOption +} + +// NewZoneLogpushOwnershipValidateService 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 NewZoneLogpushOwnershipValidateService(opts ...option.RequestOption) (r *ZoneLogpushOwnershipValidateService) { + r = &ZoneLogpushOwnershipValidateService{} + r.Options = opts + return +} + +// Validates ownership challenge of the destination. +func (r *ZoneLogpushOwnershipValidateService) PostZonesZoneIdentifierLogpushOwnershipValidate(ctx context.Context, zoneIdentifier string, body ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateParams, opts ...option.RequestOption) (res *ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/ownership/validate", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponse struct { + Errors []ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseError `json:"errors"` + Messages []ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseMessage `json:"messages"` + Result ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseSuccess `json:"success"` + JSON zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseJSON `json:"-"` +} + +// zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseJSON +// contains the JSON metadata for the struct +// [ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponse] +type zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseErrorJSON `json:"-"` +} + +// zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseError] +type zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseMessageJSON `json:"-"` +} + +// zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseMessage] +type zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseResult struct { + Valid bool `json:"valid"` + JSON zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseResultJSON `json:"-"` +} + +// zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseResult] +type zoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseResultJSON struct { + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseSuccess bool + +const ( + ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseSuccessTrue ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateResponseSuccess = true +) + +type ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` + // Ownership challenge token to prove destination ownership. + OwnershipChallenge param.Field[string] `json:"ownership_challenge,required"` +} + +func (r ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonelogpushownershipvalidate_test.go b/zonelogpushownershipvalidate_test.go new file mode 100644 index 00000000000..3030653dd9f --- /dev/null +++ b/zonelogpushownershipvalidate_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Ownerships.Validates.PostZonesZoneIdentifierLogpushOwnershipValidate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogpushOwnershipValidatePostZonesZoneIdentifierLogpushOwnershipValidateParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + OwnershipChallenge: cloudflare.F("00000000000000000000"), + }, + ) + 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/zonelogpushvalidate.go b/zonelogpushvalidate.go new file mode 100644 index 00000000000..901cb9141cf --- /dev/null +++ b/zonelogpushvalidate.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushValidateService 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 [NewZoneLogpushValidateService] +// method instead. +type ZoneLogpushValidateService struct { + Options []option.RequestOption + Destinations *ZoneLogpushValidateDestinationService + Origins *ZoneLogpushValidateOriginService +} + +// NewZoneLogpushValidateService 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 NewZoneLogpushValidateService(opts ...option.RequestOption) (r *ZoneLogpushValidateService) { + r = &ZoneLogpushValidateService{} + r.Options = opts + r.Destinations = NewZoneLogpushValidateDestinationService(opts...) + r.Origins = NewZoneLogpushValidateOriginService(opts...) + return +} diff --git a/zonelogpushvalidatedestination.go b/zonelogpushvalidatedestination.go new file mode 100644 index 00000000000..50fb6de997d --- /dev/null +++ b/zonelogpushvalidatedestination.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushValidateDestinationService 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 +// [NewZoneLogpushValidateDestinationService] method instead. +type ZoneLogpushValidateDestinationService struct { + Options []option.RequestOption + Exists *ZoneLogpushValidateDestinationExistService +} + +// NewZoneLogpushValidateDestinationService 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 NewZoneLogpushValidateDestinationService(opts ...option.RequestOption) (r *ZoneLogpushValidateDestinationService) { + r = &ZoneLogpushValidateDestinationService{} + r.Options = opts + r.Exists = NewZoneLogpushValidateDestinationExistService(opts...) + return +} diff --git a/zonelogpushvalidatedestinationexist.go b/zonelogpushvalidatedestinationexist.go new file mode 100644 index 00000000000..c13e78c5f7f --- /dev/null +++ b/zonelogpushvalidatedestinationexist.go @@ -0,0 +1,142 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushValidateDestinationExistService 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 +// [NewZoneLogpushValidateDestinationExistService] method instead. +type ZoneLogpushValidateDestinationExistService struct { + Options []option.RequestOption +} + +// NewZoneLogpushValidateDestinationExistService 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 NewZoneLogpushValidateDestinationExistService(opts ...option.RequestOption) (r *ZoneLogpushValidateDestinationExistService) { + r = &ZoneLogpushValidateDestinationExistService{} + r.Options = opts + return +} + +// Checks if there is an existing job with a destination. +func (r *ZoneLogpushValidateDestinationExistService) PostZonesZoneIdentifierLogpushValidateDestinationExists(ctx context.Context, zoneIdentifier string, body ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsParams, opts ...option.RequestOption) (res *ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/validate/destination/exists", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponse struct { + Errors []ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseError `json:"errors"` + Messages []ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseMessage `json:"messages"` + Result ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseSuccess `json:"success"` + JSON zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseJSON `json:"-"` +} + +// zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponse] +type zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseErrorJSON `json:"-"` +} + +// zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseError] +type zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseMessageJSON `json:"-"` +} + +// zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseMessage] +type zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseResult struct { + Exists bool `json:"exists"` + JSON zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseResultJSON `json:"-"` +} + +// zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseResult] +type zoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseResultJSON struct { + Exists apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseSuccess bool + +const ( + ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseSuccessTrue ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsResponseSuccess = true +) + +type ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsParams struct { + // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + // Additional configuration parameters supported by the destination may be + // included. + DestinationConf param.Field[string] `json:"destination_conf,required" format:"uri"` +} + +func (r ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonelogpushvalidatedestinationexist_test.go b/zonelogpushvalidatedestinationexist_test.go new file mode 100644 index 00000000000..94267b68cb7 --- /dev/null +++ b/zonelogpushvalidatedestinationexist_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExists(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Validates.Destinations.Exists.PostZonesZoneIdentifierLogpushValidateDestinationExists( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogpushValidateDestinationExistPostZonesZoneIdentifierLogpushValidateDestinationExistsParams{ + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + }, + ) + 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/zonelogpushvalidateorigin.go b/zonelogpushvalidateorigin.go new file mode 100644 index 00000000000..fed481b30f5 --- /dev/null +++ b/zonelogpushvalidateorigin.go @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogpushValidateOriginService 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 +// [NewZoneLogpushValidateOriginService] method instead. +type ZoneLogpushValidateOriginService struct { + Options []option.RequestOption +} + +// NewZoneLogpushValidateOriginService 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 NewZoneLogpushValidateOriginService(opts ...option.RequestOption) (r *ZoneLogpushValidateOriginService) { + r = &ZoneLogpushValidateOriginService{} + r.Options = opts + return +} + +// Validates logpull origin with logpull_options. +func (r *ZoneLogpushValidateOriginService) PostZonesZoneIdentifierLogpushValidateOrigin(ctx context.Context, zoneIdentifier string, body ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginParams, opts ...option.RequestOption) (res *ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logpush/validate/origin", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponse struct { + Errors []ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseError `json:"errors"` + Messages []ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseMessage `json:"messages"` + Result ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseSuccess `json:"success"` + JSON zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseJSON `json:"-"` +} + +// zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponse] +type zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseErrorJSON `json:"-"` +} + +// zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseError] +type zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseMessageJSON `json:"-"` +} + +// zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseMessage] +type zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseResult struct { + Message string `json:"message"` + Valid bool `json:"valid"` + JSON zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseResultJSON `json:"-"` +} + +// zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseResult] +type zoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseResultJSON struct { + Message apijson.Field + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseSuccess bool + +const ( + ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseSuccessTrue ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginResponseSuccess = true +) + +type ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginParams struct { + // Configuration string. It specifies things like requested fields and timestamp + // formats. If migrating from the logpull api, copy the url (full url or just the + // query string) of your call here, and logpush will keep on making this call for + // you, setting start and end times appropriately. + LogpullOptions param.Field[string] `json:"logpull_options,required" format:"uri-reference"` +} + +func (r ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonelogpushvalidateorigin_test.go b/zonelogpushvalidateorigin_test.go new file mode 100644 index 00000000000..810b4db365d --- /dev/null +++ b/zonelogpushvalidateorigin_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOrigin(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logpushes.Validates.Origins.PostZonesZoneIdentifierLogpushValidateOrigin( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogpushValidateOriginPostZonesZoneIdentifierLogpushValidateOriginParams{ + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + }, + ) + 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/zonelograyid.go b/zonelograyid.go new file mode 100644 index 00000000000..7301ab40624 --- /dev/null +++ b/zonelograyid.go @@ -0,0 +1,105 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneLogRayidService 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 [NewZoneLogRayidService] method +// instead. +type ZoneLogRayidService struct { + Options []option.RequestOption +} + +// NewZoneLogRayidService 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 NewZoneLogRayidService(opts ...option.RequestOption) (r *ZoneLogRayidService) { + r = &ZoneLogRayidService{} + r.Options = opts + return +} + +// The `/rayids` api route allows lookups by specific rayid. The rayids route will +// return zero, one, or more records (ray ids are not unique). +func (r *ZoneLogRayidService) Get(ctx context.Context, zoneIdentifier string, rayIdentifier string, query ZoneLogRayidGetParams, opts ...option.RequestOption) (res *ZoneLogRayidGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logs/rayids/%s", zoneIdentifier, rayIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Union satisfied by [shared.UnionString] or [ZoneLogRayidGetResponseUnknown]. +type ZoneLogRayidGetResponse interface { + ImplementsZoneLogRayidGetResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneLogRayidGetResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ZoneLogRayidGetParams struct { + // The `/received` route by default returns a limited set of fields, and allows + // customers to override the default field set by specifying individual fields. The + // reasons for this are: 1. Most customers require only a small subset of fields, + // but that subset varies from customer to customer; 2. Flat schema is much easier + // to work with downstream (importing into BigTable etc); 3. Performance (time to + // process, file size). If `?fields=` is not specified, default field set is + // returned. This default field set may change at any time. When `?fields=` is + // provided, each record is returned with the specified fields. `fields` must be + // specified as a comma separated list without any whitespaces, and all fields must + // exist. The order in which fields are specified does not matter, and the order of + // fields in the response is not specified. + Fields param.Field[string] `query:"fields"` + // By default, timestamps in responses are returned as Unix nanosecond integers. + // The `?timestamps=` argument can be set to change the format in which response + // timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. + // Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns + // timestamps as strings. + Timestamps param.Field[ZoneLogRayidGetParamsTimestamps] `query:"timestamps"` +} + +// URLQuery serializes [ZoneLogRayidGetParams]'s query parameters as `url.Values`. +func (r ZoneLogRayidGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// By default, timestamps in responses are returned as Unix nanosecond integers. +// The `?timestamps=` argument can be set to change the format in which response +// timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. +// Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns +// timestamps as strings. +type ZoneLogRayidGetParamsTimestamps string + +const ( + ZoneLogRayidGetParamsTimestampsUnix ZoneLogRayidGetParamsTimestamps = "unix" + ZoneLogRayidGetParamsTimestampsUnixnano ZoneLogRayidGetParamsTimestamps = "unixnano" + ZoneLogRayidGetParamsTimestampsRfc3339 ZoneLogRayidGetParamsTimestamps = "rfc3339" +) diff --git a/zonelograyid_test.go b/zonelograyid_test.go new file mode 100644 index 00000000000..7e3ccf879b9 --- /dev/null +++ b/zonelograyid_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogRayidGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logs.Rayids.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "41ddf1740f67442d", + cloudflare.ZoneLogRayidGetParams{ + Fields: cloudflare.F("ClientIP,RayID,EdgeStartTimestamp"), + Timestamps: cloudflare.F(cloudflare.ZoneLogRayidGetParamsTimestampsUnixnano), + }, + ) + 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/zonelogreceived.go b/zonelogreceived.go new file mode 100644 index 00000000000..7ef87e689fa --- /dev/null +++ b/zonelogreceived.go @@ -0,0 +1,160 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneLogReceivedService 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 [NewZoneLogReceivedService] method +// instead. +type ZoneLogReceivedService struct { + Options []option.RequestOption + Fields *ZoneLogReceivedFieldService +} + +// NewZoneLogReceivedService 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 NewZoneLogReceivedService(opts ...option.RequestOption) (r *ZoneLogReceivedService) { + r = &ZoneLogReceivedService{} + r.Options = opts + r.Fields = NewZoneLogReceivedFieldService(opts...) + return +} + +// The `/received` api route allows customers to retrieve their edge HTTP logs. The +// basic access pattern is "give me all the logs for zone Z for minute M", where +// the minute M refers to the time records were received at Cloudflare's central +// data center. `start` is inclusive, and `end` is exclusive. Because of that, to +// get all data, at minutely cadence, starting at 10AM, the proper values are: +// `start=2018-05-20T10:00:00Z&end=2018-05-20T10:01:00Z`, then +// `start=2018-05-20T10:01:00Z&end=2018-05-20T10:02:00Z` and so on; the overlap +// will be handled properly. +func (r *ZoneLogReceivedService) ReceivedGetLogsReceived(ctx context.Context, zoneIdentifier string, query ZoneLogReceivedReceivedGetLogsReceivedParams, opts ...option.RequestOption) (res *ZoneLogReceivedReceivedGetLogsReceivedResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logs/received", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Union satisfied by [shared.UnionString] or +// [ZoneLogReceivedReceivedGetLogsReceivedResponseUnknown]. +type ZoneLogReceivedReceivedGetLogsReceivedResponse interface { + ImplementsZoneLogReceivedReceivedGetLogsReceivedResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneLogReceivedReceivedGetLogsReceivedResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ZoneLogReceivedReceivedGetLogsReceivedParams struct { + // Sets the (exclusive) end of the requested time frame. This can be a unix + // timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to + // RFC 3339. `end` must be at least five minutes earlier than now and must be later + // than `start`. Difference between `start` and `end` must be not greater than one + // hour. + End param.Field[ZoneLogReceivedReceivedGetLogsReceivedParamsEnd] `query:"end,required"` + // When `?count=` is provided, the response will contain up to `count` results. + // Since results are not sorted, you are likely to get different data for repeated + // requests. `count` must be an integer > 0. + Count param.Field[int64] `query:"count"` + // The `/received` route by default returns a limited set of fields, and allows + // customers to override the default field set by specifying individual fields. The + // reasons for this are: 1. Most customers require only a small subset of fields, + // but that subset varies from customer to customer; 2. Flat schema is much easier + // to work with downstream (importing into BigTable etc); 3. Performance (time to + // process, file size). If `?fields=` is not specified, default field set is + // returned. This default field set may change at any time. When `?fields=` is + // provided, each record is returned with the specified fields. `fields` must be + // specified as a comma separated list without any whitespaces, and all fields must + // exist. The order in which fields are specified does not matter, and the order of + // fields in the response is not specified. + Fields param.Field[string] `query:"fields"` + // When `?sample=` is provided, a sample of matching records is returned. If + // `sample=0.1` then 10% of records will be returned. Sampling is random: repeated + // calls will not only return different records, but likely will also vary slightly + // in number of returned records. When `?count=` is also specified, `count` is + // applied to the number of returned records, not the sampled records. So, with + // `sample=0.05` and `count=7`, when there is a total of 100 records available, + // approximately five will be returned. When there are 1000 records, seven will be + // returned. When there are 10,000 records, seven will be returned. + Sample param.Field[float64] `query:"sample"` + // Sets the (inclusive) beginning of the requested time frame. This can be a unix + // timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to + // RFC 3339. At this point in time, it cannot exceed a time in the past greater + // than seven days. + Start param.Field[ZoneLogReceivedReceivedGetLogsReceivedParamsStart] `query:"start"` + // By default, timestamps in responses are returned as Unix nanosecond integers. + // The `?timestamps=` argument can be set to change the format in which response + // timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. + // Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns + // timestamps as strings. + Timestamps param.Field[ZoneLogReceivedReceivedGetLogsReceivedParamsTimestamps] `query:"timestamps"` +} + +// URLQuery serializes [ZoneLogReceivedReceivedGetLogsReceivedParams]'s query +// parameters as `url.Values`. +func (r ZoneLogReceivedReceivedGetLogsReceivedParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Sets the (exclusive) end of the requested time frame. This can be a unix +// timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to +// RFC 3339. `end` must be at least five minutes earlier than now and must be later +// than `start`. Difference between `start` and `end` must be not greater than one +// hour. +// +// Satisfied by [shared.UnionString], [shared.UnionInt]. +type ZoneLogReceivedReceivedGetLogsReceivedParamsEnd interface { + ImplementsZoneLogReceivedReceivedGetLogsReceivedParamsEnd() +} + +// Sets the (inclusive) beginning of the requested time frame. This can be a unix +// timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to +// RFC 3339. At this point in time, it cannot exceed a time in the past greater +// than seven days. +// +// Satisfied by [shared.UnionString], [shared.UnionInt]. +type ZoneLogReceivedReceivedGetLogsReceivedParamsStart interface { + ImplementsZoneLogReceivedReceivedGetLogsReceivedParamsStart() +} + +// By default, timestamps in responses are returned as Unix nanosecond integers. +// The `?timestamps=` argument can be set to change the format in which response +// timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. +// Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns +// timestamps as strings. +type ZoneLogReceivedReceivedGetLogsReceivedParamsTimestamps string + +const ( + ZoneLogReceivedReceivedGetLogsReceivedParamsTimestampsUnix ZoneLogReceivedReceivedGetLogsReceivedParamsTimestamps = "unix" + ZoneLogReceivedReceivedGetLogsReceivedParamsTimestampsUnixnano ZoneLogReceivedReceivedGetLogsReceivedParamsTimestamps = "unixnano" + ZoneLogReceivedReceivedGetLogsReceivedParamsTimestampsRfc3339 ZoneLogReceivedReceivedGetLogsReceivedParamsTimestamps = "rfc3339" +) diff --git a/zonelogreceived_test.go b/zonelogreceived_test.go new file mode 100644 index 00000000000..676630eaa1a --- /dev/null +++ b/zonelogreceived_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogReceivedReceivedGetLogsReceivedWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logs.Receiveds.ReceivedGetLogsReceived( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneLogReceivedReceivedGetLogsReceivedParams{ + End: cloudflare.F[cloudflare.ZoneLogReceivedReceivedGetLogsReceivedParamsEnd](shared.UnionString("2018-05-20T10:01:00Z")), + Count: cloudflare.F(int64(1)), + Fields: cloudflare.F("ClientIP,RayID,EdgeStartTimestamp"), + Sample: cloudflare.F(0.100000), + Start: cloudflare.F[cloudflare.ZoneLogReceivedReceivedGetLogsReceivedParamsStart](shared.UnionString("2018-05-20T10:00:00Z")), + Timestamps: cloudflare.F(cloudflare.ZoneLogReceivedReceivedGetLogsReceivedParamsTimestampsUnixnano), + }, + ) + 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/zonelogreceivedfield.go b/zonelogreceivedfield.go new file mode 100644 index 00000000000..0b69d6ca7ee --- /dev/null +++ b/zonelogreceivedfield.go @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneLogReceivedFieldService 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 [NewZoneLogReceivedFieldService] +// method instead. +type ZoneLogReceivedFieldService struct { + Options []option.RequestOption +} + +// NewZoneLogReceivedFieldService 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 NewZoneLogReceivedFieldService(opts ...option.RequestOption) (r *ZoneLogReceivedFieldService) { + r = &ZoneLogReceivedFieldService{} + r.Options = opts + return +} + +// Lists all fields available. The response is json object with key-value pairs, +// where keys are field names, and values are descriptions. +func (r *ZoneLogReceivedFieldService) LogsReceivedListFields(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneLogReceivedFieldLogsReceivedListFieldsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/logs/received/fields", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneLogReceivedFieldLogsReceivedListFieldsResponse struct { + Key string `json:"key"` + JSON zoneLogReceivedFieldLogsReceivedListFieldsResponseJSON `json:"-"` +} + +// zoneLogReceivedFieldLogsReceivedListFieldsResponseJSON contains the JSON +// metadata for the struct [ZoneLogReceivedFieldLogsReceivedListFieldsResponse] +type zoneLogReceivedFieldLogsReceivedListFieldsResponseJSON struct { + Key apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneLogReceivedFieldLogsReceivedListFieldsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonelogreceivedfield_test.go b/zonelogreceivedfield_test.go new file mode 100644 index 00000000000..b8aa9de9b67 --- /dev/null +++ b/zonelogreceivedfield_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneLogReceivedFieldLogsReceivedListFields(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Logs.Receiveds.Fields.LogsReceivedListFields(context.TODO(), "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/zonemanagedheader.go b/zonemanagedheader.go new file mode 100644 index 00000000000..8ffe6ea9da7 --- /dev/null +++ b/zonemanagedheader.go @@ -0,0 +1,210 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneManagedHeaderService 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 [NewZoneManagedHeaderService] method +// instead. +type ZoneManagedHeaderService struct { + Options []option.RequestOption +} + +// NewZoneManagedHeaderService 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 NewZoneManagedHeaderService(opts ...option.RequestOption) (r *ZoneManagedHeaderService) { + r = &ZoneManagedHeaderService{} + r.Options = opts + return +} + +// Fetches a list of all Managed Transforms. +func (r *ZoneManagedHeaderService) List(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneManagedHeaderListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/managed_headers", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the status of one or more Managed Transforms. +func (r *ZoneManagedHeaderService) ManagedTransformsUpdateStatusOfManagedTransforms(ctx context.Context, zoneID string, body ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParams, opts ...option.RequestOption) (res *ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/managed_headers", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneManagedHeaderListResponse struct { + ManagedRequestHeaders []ZoneManagedHeaderListResponseManagedRequestHeader `json:"managed_request_headers"` + ManagedResponseHeaders []ZoneManagedHeaderListResponseManagedResponseHeader `json:"managed_response_headers"` + JSON zoneManagedHeaderListResponseJSON `json:"-"` +} + +// zoneManagedHeaderListResponseJSON contains the JSON metadata for the struct +// [ZoneManagedHeaderListResponse] +type zoneManagedHeaderListResponseJSON struct { + ManagedRequestHeaders apijson.Field + ManagedResponseHeaders apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneManagedHeaderListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneManagedHeaderListResponseManagedRequestHeader struct { + // Human-readable identifier of the Managed Transform. + ID string `json:"id"` + // When true, the Managed Transform is enabled. + Enabled bool `json:"enabled"` + JSON zoneManagedHeaderListResponseManagedRequestHeaderJSON `json:"-"` +} + +// zoneManagedHeaderListResponseManagedRequestHeaderJSON contains the JSON metadata +// for the struct [ZoneManagedHeaderListResponseManagedRequestHeader] +type zoneManagedHeaderListResponseManagedRequestHeaderJSON struct { + ID apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneManagedHeaderListResponseManagedRequestHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneManagedHeaderListResponseManagedResponseHeader struct { + // Human-readable identifier of the Managed Transform. + ID string `json:"id"` + // When true, the Managed Transform is enabled. + Enabled bool `json:"enabled"` + JSON zoneManagedHeaderListResponseManagedResponseHeaderJSON `json:"-"` +} + +// zoneManagedHeaderListResponseManagedResponseHeaderJSON contains the JSON +// metadata for the struct [ZoneManagedHeaderListResponseManagedResponseHeader] +type zoneManagedHeaderListResponseManagedResponseHeaderJSON struct { + ID apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneManagedHeaderListResponseManagedResponseHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponse struct { + ManagedRequestHeaders []ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedRequestHeader `json:"managed_request_headers"` + ManagedResponseHeaders []ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedResponseHeader `json:"managed_response_headers"` + JSON zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseJSON `json:"-"` +} + +// zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseJSON +// contains the JSON metadata for the struct +// [ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponse] +type zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseJSON struct { + ManagedRequestHeaders apijson.Field + ManagedResponseHeaders apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedRequestHeader struct { + // Human-readable identifier of the Managed Transform. + ID string `json:"id"` + // When true, the Managed Transform is available in the current Cloudflare plan. + Available bool `json:"available"` + // When true, the Managed Transform is enabled. + Enabled bool `json:"enabled"` + JSON zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedRequestHeaderJSON `json:"-"` +} + +// zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedRequestHeaderJSON +// contains the JSON metadata for the struct +// [ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedRequestHeader] +type zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedRequestHeaderJSON struct { + ID apijson.Field + Available apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedRequestHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedResponseHeader struct { + // Human-readable identifier of the Managed Transform. + ID string `json:"id"` + // When true, the Managed Transform is available in the current Cloudflare plan. + Available bool `json:"available"` + // When true, the Managed Transform is enabled. + Enabled bool `json:"enabled"` + JSON zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedResponseHeaderJSON `json:"-"` +} + +// zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedResponseHeaderJSON +// contains the JSON metadata for the struct +// [ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedResponseHeader] +type zoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedResponseHeaderJSON struct { + ID apijson.Field + Available apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsResponseManagedResponseHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParams struct { + ManagedRequestHeaders param.Field[[]ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedRequestHeader] `json:"managed_request_headers,required"` + ManagedResponseHeaders param.Field[[]ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedResponseHeader] `json:"managed_response_headers,required"` +} + +func (r ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedRequestHeader struct { + // Human-readable identifier of the Managed Transform. + ID param.Field[string] `json:"id"` + // When true, the Managed Transform is enabled. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedRequestHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedResponseHeader struct { + // Human-readable identifier of the Managed Transform. + ID param.Field[string] `json:"id"` + // When true, the Managed Transform is enabled. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedResponseHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonemanagedheader_test.go b/zonemanagedheader_test.go new file mode 100644 index 00000000000..05558d2d6f3 --- /dev/null +++ b/zonemanagedheader_test.go @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneManagedHeaderList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ManagedHeaders.List(context.TODO(), "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()) + } +} + +func TestZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransforms(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.ManagedHeaders.ManagedTransformsUpdateStatusOfManagedTransforms( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParams{ + ManagedRequestHeaders: cloudflare.F([]cloudflare.ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedRequestHeader{{ + Enabled: cloudflare.F(true), + ID: cloudflare.F("add_cf-bot-score_header"), + }, { + Enabled: cloudflare.F(true), + ID: cloudflare.F("add_cf-bot-score_header"), + }, { + Enabled: cloudflare.F(true), + ID: cloudflare.F("add_cf-bot-score_header"), + }}), + ManagedResponseHeaders: cloudflare.F([]cloudflare.ZoneManagedHeaderManagedTransformsUpdateStatusOfManagedTransformsParamsManagedResponseHeader{{ + Enabled: cloudflare.F(true), + ID: cloudflare.F("add_cf-bot-score_header"), + }, { + Enabled: cloudflare.F(true), + ID: cloudflare.F("add_cf-bot-score_header"), + }, { + Enabled: cloudflare.F(true), + ID: cloudflare.F("add_cf-bot-score_header"), + }}), + }, + ) + 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/zoneorigintlsclientauth.go b/zoneorigintlsclientauth.go new file mode 100644 index 00000000000..c15cb6716a0 --- /dev/null +++ b/zoneorigintlsclientauth.go @@ -0,0 +1,446 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneOriginTlsClientAuthService 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 +// [NewZoneOriginTlsClientAuthService] method instead. +type ZoneOriginTlsClientAuthService struct { + Options []option.RequestOption + Hostnames *ZoneOriginTlsClientAuthHostnameService + Settings *ZoneOriginTlsClientAuthSettingService +} + +// NewZoneOriginTlsClientAuthService 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 NewZoneOriginTlsClientAuthService(opts ...option.RequestOption) (r *ZoneOriginTlsClientAuthService) { + r = &ZoneOriginTlsClientAuthService{} + r.Options = opts + r.Hostnames = NewZoneOriginTlsClientAuthHostnameService(opts...) + r.Settings = NewZoneOriginTlsClientAuthSettingService(opts...) + return +} + +// Get Certificate Details +func (r *ZoneOriginTlsClientAuthService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete Certificate +func (r *ZoneOriginTlsClientAuthService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// List Certificates +func (r *ZoneOriginTlsClientAuthService) ZoneLevelAuthenticatedOriginPullsListCertificates(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Upload your own certificate you want Cloudflare to use for edge-to-origin +// communication to override the shared certificate. Please note that it is +// important to keep only one certificate active. Also, make sure to enable +// zone-level authenticated origin pulls by making a PUT call to settings endpoint +// to see the uploaded certificate in use. +func (r *ZoneOriginTlsClientAuthService) ZoneLevelAuthenticatedOriginPullsUploadCertificate(ctx context.Context, zoneIdentifier string, body ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateParams, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneOriginTlsClientAuthGetResponse struct { + Errors []ZoneOriginTlsClientAuthGetResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthGetResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthGetResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthGetResponseJSON contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthGetResponse] +type zoneOriginTlsClientAuthGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthGetResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneOriginTlsClientAuthGetResponseError] +type zoneOriginTlsClientAuthGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthGetResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneOriginTlsClientAuthGetResponseMessage] +type zoneOriginTlsClientAuthGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthGetResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthGetResponseSuccessTrue ZoneOriginTlsClientAuthGetResponseSuccess = true +) + +type ZoneOriginTlsClientAuthDeleteResponse struct { + Errors []ZoneOriginTlsClientAuthDeleteResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthDeleteResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthDeleteResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthDeleteResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneOriginTlsClientAuthDeleteResponse] +type zoneOriginTlsClientAuthDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthDeleteResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthDeleteResponseErrorJSON contains the JSON metadata for +// the struct [ZoneOriginTlsClientAuthDeleteResponseError] +type zoneOriginTlsClientAuthDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthDeleteResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneOriginTlsClientAuthDeleteResponseMessage] +type zoneOriginTlsClientAuthDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthDeleteResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthDeleteResponseSuccessTrue ZoneOriginTlsClientAuthDeleteResponseSuccess = true +) + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponse struct { + Errors []ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseMessage `json:"messages"` + Result []ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResult `json:"result"` + ResultInfo ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponse] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseError] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseMessage] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResult struct { + // Identifier + ID string `json:"id"` + // The zone's leaf certificate. + Certificate string `json:"certificate"` + // When the certificate from the authority expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // Status of the certificate activation. + Status ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus `json:"status"` + // This is the time the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResult] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + Signature apijson.Field + Status apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the certificate activation. +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus string + +const ( + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatusInitializing ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus = "initializing" + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatusPendingDeployment ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus = "pending_deployment" + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatusPendingDeletion ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus = "pending_deletion" + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatusActive ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus = "active" + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatusDeleted ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus = "deleted" + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatusDeploymentTimedOut ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatusDeletionTimedOut ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultStatus = "deletion_timed_out" +) + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultInfoJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultInfo] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseSuccessTrue ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificatesResponseSuccess = true +) + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponse struct { + Errors []ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponse] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseError] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseMessage] +type zoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseSuccessTrue ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateResponseSuccess = true +) + +type ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateParams struct { + // The zone's leaf certificate. + Certificate param.Field[string] `json:"certificate,required"` + // The zone's private key. + PrivateKey param.Field[string] `json:"private_key,required"` +} + +func (r ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneorigintlsclientauth_test.go b/zoneorigintlsclientauth_test.go new file mode 100644 index 00000000000..4c0038135c1 --- /dev/null +++ b/zoneorigintlsclientauth_test.go @@ -0,0 +1,133 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneOriginTlsClientAuthGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneOriginTlsClientAuthDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsListCertificates(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.ZoneLevelAuthenticatedOriginPullsListCertificates(context.TODO(), "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()) + } +} + +func TestZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.ZoneLevelAuthenticatedOriginPullsUploadCertificate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneOriginTlsClientAuthZoneLevelAuthenticatedOriginPullsUploadCertificateParams{ + Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), + PrivateKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), + }, + ) + 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/zoneorigintlsclientauthhostname.go b/zoneorigintlsclientauthhostname.go new file mode 100644 index 00000000000..ba18cf44373 --- /dev/null +++ b/zoneorigintlsclientauthhostname.go @@ -0,0 +1,420 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneOriginTlsClientAuthHostnameService 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 +// [NewZoneOriginTlsClientAuthHostnameService] method instead. +type ZoneOriginTlsClientAuthHostnameService struct { + Options []option.RequestOption + Certificates *ZoneOriginTlsClientAuthHostnameCertificateService +} + +// NewZoneOriginTlsClientAuthHostnameService 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 NewZoneOriginTlsClientAuthHostnameService(opts ...option.RequestOption) (r *ZoneOriginTlsClientAuthHostnameService) { + r = &ZoneOriginTlsClientAuthHostnameService{} + r.Options = opts + r.Certificates = NewZoneOriginTlsClientAuthHostnameCertificateService(opts...) + return +} + +// Get the Hostname Status for Client Authentication +func (r *ZoneOriginTlsClientAuthHostnameService) Get(ctx context.Context, zoneIdentifier string, hostname string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthHostnameGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/%s", zoneIdentifier, hostname) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Associate a hostname to a certificate and enable, disable or invalidate the +// association. If disabled, client certificate will not be sent to the hostname +// even if activated at the zone level. 100 maximum associations on a single +// certificate are allowed. Note: Use a null value for parameter _enabled_ to +// invalidate the association. +func (r *ZoneOriginTlsClientAuthHostnameService) PerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthentication(ctx context.Context, zoneIdentifier string, body ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParams, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneOriginTlsClientAuthHostnameGetResponse struct { + Errors []ZoneOriginTlsClientAuthHostnameGetResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthHostnameGetResponseMessage `json:"messages"` + Result ZoneOriginTlsClientAuthHostnameGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthHostnameGetResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthHostnameGetResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameGetResponseJSON contains the JSON metadata for +// the struct [ZoneOriginTlsClientAuthHostnameGetResponse] +type zoneOriginTlsClientAuthHostnameGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameGetResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameGetResponseErrorJSON contains the JSON metadata +// for the struct [ZoneOriginTlsClientAuthHostnameGetResponseError] +type zoneOriginTlsClientAuthHostnameGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameGetResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameGetResponseMessageJSON contains the JSON metadata +// for the struct [ZoneOriginTlsClientAuthHostnameGetResponseMessage] +type zoneOriginTlsClientAuthHostnameGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameGetResponseResult struct { + // Identifier + CertID string `json:"cert_id"` + // Status of the certificate or the association. + CertStatus ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus `json:"cert_status"` + // The time when the certificate was updated. + CertUpdatedAt time.Time `json:"cert_updated_at" format:"date-time"` + // The time when the certificate was uploaded. + CertUploadedOn time.Time `json:"cert_uploaded_on" format:"date-time"` + // The hostname certificate. + Certificate string `json:"certificate"` + // The time when the certificate was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Indicates whether hostname-level authenticated origin pulls is enabled. A null + // value voids the association. + Enabled bool `json:"enabled,nullable"` + // The date when the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The hostname on the origin for which the client certificate uploaded will be + // used. + Hostname string `json:"hostname"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // The serial number on the uploaded certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // Status of the certificate or the association. + Status ZoneOriginTlsClientAuthHostnameGetResponseResultStatus `json:"status"` + // The time when the certificate was updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneOriginTlsClientAuthHostnameGetResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameGetResponseResultJSON contains the JSON metadata +// for the struct [ZoneOriginTlsClientAuthHostnameGetResponseResult] +type zoneOriginTlsClientAuthHostnameGetResponseResultJSON struct { + CertID apijson.Field + CertStatus apijson.Field + CertUpdatedAt apijson.Field + CertUploadedOn apijson.Field + Certificate apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + ExpiresOn apijson.Field + Hostname apijson.Field + Issuer apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus string + +const ( + ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatusInitializing ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus = "initializing" + ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatusPendingDeployment ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatusPendingDeletion ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatusActive ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus = "active" + ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatusDeleted ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus = "deleted" + ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnameGetResponseResultCertStatus = "deletion_timed_out" +) + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnameGetResponseResultStatus string + +const ( + ZoneOriginTlsClientAuthHostnameGetResponseResultStatusInitializing ZoneOriginTlsClientAuthHostnameGetResponseResultStatus = "initializing" + ZoneOriginTlsClientAuthHostnameGetResponseResultStatusPendingDeployment ZoneOriginTlsClientAuthHostnameGetResponseResultStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnameGetResponseResultStatusPendingDeletion ZoneOriginTlsClientAuthHostnameGetResponseResultStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnameGetResponseResultStatusActive ZoneOriginTlsClientAuthHostnameGetResponseResultStatus = "active" + ZoneOriginTlsClientAuthHostnameGetResponseResultStatusDeleted ZoneOriginTlsClientAuthHostnameGetResponseResultStatus = "deleted" + ZoneOriginTlsClientAuthHostnameGetResponseResultStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnameGetResponseResultStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnameGetResponseResultStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnameGetResponseResultStatus = "deletion_timed_out" +) + +// Whether the API call was successful +type ZoneOriginTlsClientAuthHostnameGetResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthHostnameGetResponseSuccessTrue ZoneOriginTlsClientAuthHostnameGetResponseSuccess = true +) + +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponse struct { + Errors []ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseMessage `json:"messages"` + Result []ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResult `json:"result"` + ResultInfo ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponse] +type zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseError] +type zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseMessage] +type zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResult struct { + // Identifier + CertID string `json:"cert_id"` + // Status of the certificate or the association. + CertStatus ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus `json:"cert_status"` + // The time when the certificate was updated. + CertUpdatedAt time.Time `json:"cert_updated_at" format:"date-time"` + // The time when the certificate was uploaded. + CertUploadedOn time.Time `json:"cert_uploaded_on" format:"date-time"` + // The hostname certificate. + Certificate string `json:"certificate"` + // The time when the certificate was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Indicates whether hostname-level authenticated origin pulls is enabled. A null + // value voids the association. + Enabled bool `json:"enabled,nullable"` + // The date when the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The hostname on the origin for which the client certificate uploaded will be + // used. + Hostname string `json:"hostname"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // The serial number on the uploaded certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // Status of the certificate or the association. + Status ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus `json:"status"` + // The time when the certificate was updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResult] +type zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultJSON struct { + CertID apijson.Field + CertStatus apijson.Field + CertUpdatedAt apijson.Field + CertUploadedOn apijson.Field + Certificate apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + ExpiresOn apijson.Field + Hostname apijson.Field + Issuer apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus string + +const ( + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatusInitializing ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus = "initializing" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatusPendingDeployment ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatusPendingDeletion ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatusActive ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus = "active" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatusDeleted ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus = "deleted" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultCertStatus = "deletion_timed_out" +) + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus string + +const ( + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatusInitializing ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus = "initializing" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatusPendingDeployment ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatusPendingDeletion ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatusActive ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus = "active" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatusDeleted ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus = "deleted" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultStatus = "deletion_timed_out" +) + +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultInfoJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultInfo] +type zoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseSuccessTrue ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationResponseSuccess = true +) + +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParams struct { + Config param.Field[[]ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParamsConfig] `json:"config,required"` +} + +func (r ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParamsConfig struct { + // Certificate identifier tag. + CertID param.Field[string] `json:"cert_id"` + // Indicates whether hostname-level authenticated origin pulls is enabled. A null + // value voids the association. + Enabled param.Field[bool] `json:"enabled"` + // The hostname on the origin for which the client certificate uploaded will be + // used. + Hostname param.Field[string] `json:"hostname"` +} + +func (r ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParamsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneorigintlsclientauthhostname_test.go b/zoneorigintlsclientauthhostname_test.go new file mode 100644 index 00000000000..bbc72016dc7 --- /dev/null +++ b/zoneorigintlsclientauthhostname_test.go @@ -0,0 +1,88 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneOriginTlsClientAuthHostnameGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Hostnames.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "app.example.com", + ) + 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 TestZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthentication(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Hostnames.PerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthentication( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParams{ + Config: cloudflare.F([]cloudflare.ZoneOriginTlsClientAuthHostnamePerHostnameAuthenticatedOriginPullEnableOrDisableAHostnameForClientAuthenticationParamsConfig{{ + CertID: cloudflare.F("2458ce5a-0c35-4c7f-82c7-8e9487d3ff60"), + Enabled: cloudflare.F(true), + Hostname: cloudflare.F("app.example.com"), + }, { + CertID: cloudflare.F("2458ce5a-0c35-4c7f-82c7-8e9487d3ff60"), + Enabled: cloudflare.F(true), + Hostname: cloudflare.F("app.example.com"), + }, { + CertID: cloudflare.F("2458ce5a-0c35-4c7f-82c7-8e9487d3ff60"), + Enabled: cloudflare.F(true), + Hostname: cloudflare.F("app.example.com"), + }}), + }, + ) + 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/zoneorigintlsclientauthhostnamecertificate.go b/zoneorigintlsclientauthhostnamecertificate.go new file mode 100644 index 00000000000..8b374bb8085 --- /dev/null +++ b/zoneorigintlsclientauthhostnamecertificate.go @@ -0,0 +1,640 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneOriginTlsClientAuthHostnameCertificateService 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 [NewZoneOriginTlsClientAuthHostnameCertificateService] method instead. +type ZoneOriginTlsClientAuthHostnameCertificateService struct { + Options []option.RequestOption +} + +// NewZoneOriginTlsClientAuthHostnameCertificateService 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 NewZoneOriginTlsClientAuthHostnameCertificateService(opts ...option.RequestOption) (r *ZoneOriginTlsClientAuthHostnameCertificateService) { + r = &ZoneOriginTlsClientAuthHostnameCertificateService{} + r.Options = opts + return +} + +// Get the certificate by ID to be used for client authentication on a hostname. +func (r *ZoneOriginTlsClientAuthHostnameCertificateService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthHostnameCertificateGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete Hostname Client Certificate +func (r *ZoneOriginTlsClientAuthHostnameCertificateService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthHostnameCertificateDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/certificates/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// List Certificates +func (r *ZoneOriginTlsClientAuthHostnameCertificateService) PerHostnameAuthenticatedOriginPullListCertificates(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/certificates", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Upload a certificate to be used for client authentication on a hostname. 10 +// hostname certificates per zone are allowed. +func (r *ZoneOriginTlsClientAuthHostnameCertificateService) PerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificate(ctx context.Context, zoneIdentifier string, body ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateParams, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/certificates", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneOriginTlsClientAuthHostnameCertificateGetResponse struct { + Errors []ZoneOriginTlsClientAuthHostnameCertificateGetResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthHostnameCertificateGetResponseMessage `json:"messages"` + Result ZoneOriginTlsClientAuthHostnameCertificateGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthHostnameCertificateGetResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthHostnameCertificateGetResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateGetResponseJSON contains the JSON +// metadata for the struct [ZoneOriginTlsClientAuthHostnameCertificateGetResponse] +type zoneOriginTlsClientAuthHostnameCertificateGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificateGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificateGetResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateGetResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificateGetResponseError] +type zoneOriginTlsClientAuthHostnameCertificateGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificateGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificateGetResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateGetResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificateGetResponseMessage] +type zoneOriginTlsClientAuthHostnameCertificateGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificateGetResponseResult struct { + // Identifier + ID string `json:"id"` + // The hostname certificate. + Certificate string `json:"certificate"` + // The date when the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // The serial number on the uploaded certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // Status of the certificate or the association. + Status ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus `json:"status"` + // The time when the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON zoneOriginTlsClientAuthHostnameCertificateGetResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateGetResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificateGetResponseResult] +type zoneOriginTlsClientAuthHostnameCertificateGetResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Status apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus string + +const ( + ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatusInitializing ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus = "initializing" + ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatusPendingDeployment ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatusPendingDeletion ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatusActive ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus = "active" + ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatusDeleted ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus = "deleted" + ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnameCertificateGetResponseResultStatus = "deletion_timed_out" +) + +// Whether the API call was successful +type ZoneOriginTlsClientAuthHostnameCertificateGetResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthHostnameCertificateGetResponseSuccessTrue ZoneOriginTlsClientAuthHostnameCertificateGetResponseSuccess = true +) + +type ZoneOriginTlsClientAuthHostnameCertificateDeleteResponse struct { + Errors []ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseMessage `json:"messages"` + Result ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthHostnameCertificateDeleteResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateDeleteResponseJSON contains the JSON +// metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificateDeleteResponse] +type zoneOriginTlsClientAuthHostnameCertificateDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificateDeleteResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateDeleteResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseError] +type zoneOriginTlsClientAuthHostnameCertificateDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificateDeleteResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateDeleteResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseMessage] +type zoneOriginTlsClientAuthHostnameCertificateDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + // The hostname certificate. + Certificate string `json:"certificate"` + // The date when the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // The serial number on the uploaded certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // Status of the certificate or the association. + Status ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus `json:"status"` + // The time when the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON zoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResult] +type zoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Status apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus string + +const ( + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatusInitializing ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus = "initializing" + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatusPendingDeployment ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatusPendingDeletion ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatusActive ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus = "active" + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatusDeleted ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus = "deleted" + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseResultStatus = "deletion_timed_out" +) + +// Whether the API call was successful +type ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseSuccessTrue ZoneOriginTlsClientAuthHostnameCertificateDeleteResponseSuccess = true +) + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponse struct { + Errors []ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseMessage `json:"messages"` + Result []ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResult `json:"result"` + ResultInfo ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponse] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseError] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseMessage] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResult struct { + // Identifier + CertID string `json:"cert_id"` + // Status of the certificate or the association. + CertStatus ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus `json:"cert_status"` + // The time when the certificate was updated. + CertUpdatedAt time.Time `json:"cert_updated_at" format:"date-time"` + // The time when the certificate was uploaded. + CertUploadedOn time.Time `json:"cert_uploaded_on" format:"date-time"` + // The hostname certificate. + Certificate string `json:"certificate"` + // The time when the certificate was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Indicates whether hostname-level authenticated origin pulls is enabled. A null + // value voids the association. + Enabled bool `json:"enabled,nullable"` + // The date when the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The hostname on the origin for which the client certificate uploaded will be + // used. + Hostname string `json:"hostname"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // The serial number on the uploaded certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // Status of the certificate or the association. + Status ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus `json:"status"` + // The time when the certificate was updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResult] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultJSON struct { + CertID apijson.Field + CertStatus apijson.Field + CertUpdatedAt apijson.Field + CertUploadedOn apijson.Field + Certificate apijson.Field + CreatedAt apijson.Field + Enabled apijson.Field + ExpiresOn apijson.Field + Hostname apijson.Field + Issuer apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus string + +const ( + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatusInitializing ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus = "initializing" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatusPendingDeployment ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatusPendingDeletion ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatusActive ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus = "active" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatusDeleted ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus = "deleted" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultCertStatus = "deletion_timed_out" +) + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus string + +const ( + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatusInitializing ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus = "initializing" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatusPendingDeployment ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatusPendingDeletion ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatusActive ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus = "active" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatusDeleted ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus = "deleted" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultStatus = "deletion_timed_out" +) + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultInfoJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultInfo] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseSuccessTrue ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificatesResponseSuccess = true +) + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponse struct { + Errors []ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseMessage `json:"messages"` + Result ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponse] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseError] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseMessage] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResult struct { + // Identifier + ID string `json:"id"` + // The hostname certificate. + Certificate string `json:"certificate"` + // The date when the certificate expires. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // The certificate authority that issued the certificate. + Issuer string `json:"issuer"` + // The serial number on the uploaded certificate. + SerialNumber string `json:"serial_number"` + // The type of hash used for the certificate. + Signature string `json:"signature"` + // Status of the certificate or the association. + Status ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus `json:"status"` + // The time when the certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + JSON zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResult] +type zoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultJSON struct { + ID apijson.Field + Certificate apijson.Field + ExpiresOn apijson.Field + Issuer apijson.Field + SerialNumber apijson.Field + Signature apijson.Field + Status apijson.Field + UploadedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the certificate or the association. +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus string + +const ( + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatusInitializing ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus = "initializing" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatusPendingDeployment ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus = "pending_deployment" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatusPendingDeletion ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus = "pending_deletion" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatusActive ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus = "active" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatusDeleted ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus = "deleted" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatusDeploymentTimedOut ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus = "deployment_timed_out" + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatusDeletionTimedOut ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseResultStatus = "deletion_timed_out" +) + +// Whether the API call was successful +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseSuccessTrue ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateResponseSuccess = true +) + +type ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateParams struct { + // The hostname certificate. + Certificate param.Field[string] `json:"certificate,required"` + // The hostname certificate's private key. + PrivateKey param.Field[string] `json:"private_key,required"` +} + +func (r ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneorigintlsclientauthhostnamecertificate_test.go b/zoneorigintlsclientauthhostnamecertificate_test.go new file mode 100644 index 00000000000..a93baff3845 --- /dev/null +++ b/zoneorigintlsclientauthhostnamecertificate_test.go @@ -0,0 +1,133 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneOriginTlsClientAuthHostnameCertificateGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Hostnames.Certificates.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneOriginTlsClientAuthHostnameCertificateDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Hostnames.Certificates.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullListCertificates(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Hostnames.Certificates.PerHostnameAuthenticatedOriginPullListCertificates(context.TODO(), "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()) + } +} + +func TestZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Hostnames.Certificates.PerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneOriginTlsClientAuthHostnameCertificatePerHostnameAuthenticatedOriginPullUploadAHostnameClientCertificateParams{ + Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), + PrivateKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), + }, + ) + 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/zoneorigintlsclientauthsetting.go b/zoneorigintlsclientauthsetting.go new file mode 100644 index 00000000000..220acfddea9 --- /dev/null +++ b/zoneorigintlsclientauthsetting.go @@ -0,0 +1,242 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneOriginTlsClientAuthSettingService 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 +// [NewZoneOriginTlsClientAuthSettingService] method instead. +type ZoneOriginTlsClientAuthSettingService struct { + Options []option.RequestOption +} + +// NewZoneOriginTlsClientAuthSettingService 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 NewZoneOriginTlsClientAuthSettingService(opts ...option.RequestOption) (r *ZoneOriginTlsClientAuthSettingService) { + r = &ZoneOriginTlsClientAuthSettingService{} + r.Options = opts + return +} + +// Get whether zone-level authenticated origin pulls is enabled or not. It is false +// by default. +func (r *ZoneOriginTlsClientAuthSettingService) ZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZone(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Enable or disable zone-level authenticated origin pulls. 'enabled' should be set +// true either before/after the certificate is uploaded to see the certificate in +// use. +func (r *ZoneOriginTlsClientAuthSettingService) ZoneLevelAuthenticatedOriginPullsSetEnablementForZone(ctx context.Context, zoneIdentifier string, body ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneParams, opts ...option.RequestOption) (res *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponse struct { + Errors []ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseMessage `json:"messages"` + Result ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponse] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseError] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseMessage] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseResult struct { + // Indicates whether zone-level authenticated origin pulls is enabled. + Enabled bool `json:"enabled"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseResult] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseResultJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseSuccessTrue ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZoneResponseSuccess = true +) + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponse struct { + Errors []ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseError `json:"errors"` + Messages []ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseMessage `json:"messages"` + Result ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseSuccess `json:"success"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponse] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseErrorJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseError] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseMessageJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseMessage] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseResult struct { + // Indicates whether zone-level authenticated origin pulls is enabled. + Enabled bool `json:"enabled"` + JSON zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseResultJSON `json:"-"` +} + +// zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseResult] +type zoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseResultJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseSuccess bool + +const ( + ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseSuccessTrue ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneResponseSuccess = true +) + +type ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneParams struct { + // Indicates whether zone-level authenticated origin pulls is enabled. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneorigintlsclientauthsetting_test.go b/zoneorigintlsclientauthsetting_test.go new file mode 100644 index 00000000000..d1db3483d45 --- /dev/null +++ b/zoneorigintlsclientauthsetting_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZone(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Settings.ZoneLevelAuthenticatedOriginPullsGetEnablementSettingForZone(context.TODO(), "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()) + } +} + +func TestZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZone(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.OriginTlsClientAuths.Settings.ZoneLevelAuthenticatedOriginPullsSetEnablementForZone( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneOriginTlsClientAuthSettingZoneLevelAuthenticatedOriginPullsSetEnablementForZoneParams{ + Enabled: cloudflare.F(true), + }, + ) + 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/zonepagerule.go b/zonepagerule.go new file mode 100644 index 00000000000..28abe35fd4b --- /dev/null +++ b/zonepagerule.go @@ -0,0 +1,747 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZonePageruleService 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 [NewZonePageruleService] method +// instead. +type ZonePageruleService struct { + Options []option.RequestOption + Settings *ZonePageruleSettingService +} + +// NewZonePageruleService 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 NewZonePageruleService(opts ...option.RequestOption) (r *ZonePageruleService) { + r = &ZonePageruleService{} + r.Options = opts + r.Settings = NewZonePageruleSettingService(opts...) + return +} + +// Fetches the details of a Page Rule. +func (r *ZonePageruleService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *PageruleResponseSingle, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/pagerules/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Replaces the configuration of an existing Page Rule. The configuration of the +// updated Page Rule will exactly match the data passed in the API request. +func (r *ZonePageruleService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZonePageruleUpdateParams, opts ...option.RequestOption) (res *PageruleResponseSingle, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/pagerules/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an existing Page Rule. +func (r *ZonePageruleService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZonePageruleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/pagerules/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a new Page Rule. +func (r *ZonePageruleService) PageRulesNewAPageRule(ctx context.Context, zoneIdentifier string, body ZonePagerulePageRulesNewAPageRuleParams, opts ...option.RequestOption) (res *PageruleResponseSingle, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/pagerules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches Page Rules in a zone. +func (r *ZonePageruleService) PageRulesListPageRules(ctx context.Context, zoneIdentifier string, query ZonePagerulePageRulesListPageRulesParams, opts ...option.RequestOption) (res *ZonePagerulePageRulesListPageRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/pagerules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type PageruleResponseSingle struct { + Errors []PageruleResponseSingleError `json:"errors"` + Messages []PageruleResponseSingleMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success PageruleResponseSingleSuccess `json:"success"` + JSON pageruleResponseSingleJSON `json:"-"` +} + +// pageruleResponseSingleJSON contains the JSON metadata for the struct +// [PageruleResponseSingle] +type pageruleResponseSingleJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageruleResponseSingle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type PageruleResponseSingleError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON pageruleResponseSingleErrorJSON `json:"-"` +} + +// pageruleResponseSingleErrorJSON contains the JSON metadata for the struct +// [PageruleResponseSingleError] +type pageruleResponseSingleErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageruleResponseSingleError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type PageruleResponseSingleMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON pageruleResponseSingleMessageJSON `json:"-"` +} + +// pageruleResponseSingleMessageJSON contains the JSON metadata for the struct +// [PageruleResponseSingleMessage] +type pageruleResponseSingleMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageruleResponseSingleMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type PageruleResponseSingleSuccess bool + +const ( + PageruleResponseSingleSuccessTrue PageruleResponseSingleSuccess = true +) + +type ZonePageruleDeleteResponse struct { + Errors []ZonePageruleDeleteResponseError `json:"errors"` + Messages []ZonePageruleDeleteResponseMessage `json:"messages"` + Result ZonePageruleDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZonePageruleDeleteResponseSuccess `json:"success"` + JSON zonePageruleDeleteResponseJSON `json:"-"` +} + +// zonePageruleDeleteResponseJSON contains the JSON metadata for the struct +// [ZonePageruleDeleteResponse] +type zonePageruleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageruleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageruleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageruleDeleteResponseErrorJSON `json:"-"` +} + +// zonePageruleDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZonePageruleDeleteResponseError] +type zonePageruleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageruleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageruleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageruleDeleteResponseMessageJSON `json:"-"` +} + +// zonePageruleDeleteResponseMessageJSON contains the JSON metadata for the struct +// [ZonePageruleDeleteResponseMessage] +type zonePageruleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageruleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageruleDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON zonePageruleDeleteResponseResultJSON `json:"-"` +} + +// zonePageruleDeleteResponseResultJSON contains the JSON metadata for the struct +// [ZonePageruleDeleteResponseResult] +type zonePageruleDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageruleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePageruleDeleteResponseSuccess bool + +const ( + ZonePageruleDeleteResponseSuccessTrue ZonePageruleDeleteResponseSuccess = true +) + +type ZonePagerulePageRulesListPageRulesResponse struct { + Errors []ZonePagerulePageRulesListPageRulesResponseError `json:"errors"` + Messages []ZonePagerulePageRulesListPageRulesResponseMessage `json:"messages"` + Result []ZonePagerulePageRulesListPageRulesResponseResult `json:"result"` + // Whether the API call was successful + Success ZonePagerulePageRulesListPageRulesResponseSuccess `json:"success"` + JSON zonePagerulePageRulesListPageRulesResponseJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseJSON contains the JSON metadata for +// the struct [ZonePagerulePageRulesListPageRulesResponse] +type zonePagerulePageRulesListPageRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePagerulePageRulesListPageRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePagerulePageRulesListPageRulesResponseErrorJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseErrorJSON contains the JSON metadata +// for the struct [ZonePagerulePageRulesListPageRulesResponseError] +type zonePagerulePageRulesListPageRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePagerulePageRulesListPageRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePagerulePageRulesListPageRulesResponseMessageJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseMessageJSON contains the JSON metadata +// for the struct [ZonePagerulePageRulesListPageRulesResponseMessage] +type zonePagerulePageRulesListPageRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePagerulePageRulesListPageRulesResponseResult struct { + // Identifier + ID string `json:"id,required"` + // The set of actions to perform if the targets of this rule match the request. + // Actions can redirect to another URL or override settings, but not both. + Actions []ZonePagerulePageRulesListPageRulesResponseResultAction `json:"actions,required"` + // The timestamp of when the Page Rule was created. + CreatedOn time.Time `json:"created_on,required" format:"date-time"` + // The timestamp of when the Page Rule was last modified. + ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` + // The priority of the rule, used to define which Page Rule is processed over + // another. A higher number indicates a higher priority. For example, if you have a + // catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + // take precedence (rule B: `/images/special/*`), specify a higher priority for + // rule B so it overrides rule A. + Priority int64 `json:"priority,required"` + // The status of the Page Rule. + Status ZonePagerulePageRulesListPageRulesResponseResultStatus `json:"status,required"` + // The rule targets to evaluate on each request. + Targets []ZonePagerulePageRulesListPageRulesResponseResultTarget `json:"targets,required"` + JSON zonePagerulePageRulesListPageRulesResponseResultJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseResultJSON contains the JSON metadata +// for the struct [ZonePagerulePageRulesListPageRulesResponseResult] +type zonePagerulePageRulesListPageRulesResponseResultJSON struct { + ID apijson.Field + Actions apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Priority apijson.Field + Status apijson.Field + Targets apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePagerulePageRulesListPageRulesResponseResultAction struct { + // The timestamp of when the override was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The type of route. + Name ZonePagerulePageRulesListPageRulesResponseResultActionsName `json:"name"` + Value ZonePagerulePageRulesListPageRulesResponseResultActionsValue `json:"value"` + JSON zonePagerulePageRulesListPageRulesResponseResultActionJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseResultActionJSON contains the JSON +// metadata for the struct [ZonePagerulePageRulesListPageRulesResponseResultAction] +type zonePagerulePageRulesListPageRulesResponseResultActionJSON struct { + ModifiedOn apijson.Field + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponseResultAction) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of route. +type ZonePagerulePageRulesListPageRulesResponseResultActionsName string + +const ( + ZonePagerulePageRulesListPageRulesResponseResultActionsNameForwardURL ZonePagerulePageRulesListPageRulesResponseResultActionsName = "forward_url" +) + +type ZonePagerulePageRulesListPageRulesResponseResultActionsValue struct { + // The response type for the URL redirect. + Type ZonePagerulePageRulesListPageRulesResponseResultActionsValueType `json:"type"` + // The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + // in the constraint value. + URL string `json:"url"` + JSON zonePagerulePageRulesListPageRulesResponseResultActionsValueJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseResultActionsValueJSON contains the +// JSON metadata for the struct +// [ZonePagerulePageRulesListPageRulesResponseResultActionsValue] +type zonePagerulePageRulesListPageRulesResponseResultActionsValueJSON struct { + Type apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponseResultActionsValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The response type for the URL redirect. +type ZonePagerulePageRulesListPageRulesResponseResultActionsValueType string + +const ( + ZonePagerulePageRulesListPageRulesResponseResultActionsValueTypeTemporary ZonePagerulePageRulesListPageRulesResponseResultActionsValueType = "temporary" + ZonePagerulePageRulesListPageRulesResponseResultActionsValueTypePermanent ZonePagerulePageRulesListPageRulesResponseResultActionsValueType = "permanent" +) + +// The status of the Page Rule. +type ZonePagerulePageRulesListPageRulesResponseResultStatus string + +const ( + ZonePagerulePageRulesListPageRulesResponseResultStatusActive ZonePagerulePageRulesListPageRulesResponseResultStatus = "active" + ZonePagerulePageRulesListPageRulesResponseResultStatusDisabled ZonePagerulePageRulesListPageRulesResponseResultStatus = "disabled" +) + +// A request condition target. +type ZonePagerulePageRulesListPageRulesResponseResultTarget struct { + // The constraint of a target. + Constraint ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraint `json:"constraint,required"` + // A target based on the URL of the request. + Target ZonePagerulePageRulesListPageRulesResponseResultTargetsTarget `json:"target,required"` + JSON zonePagerulePageRulesListPageRulesResponseResultTargetJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseResultTargetJSON contains the JSON +// metadata for the struct [ZonePagerulePageRulesListPageRulesResponseResultTarget] +type zonePagerulePageRulesListPageRulesResponseResultTargetJSON struct { + Constraint apijson.Field + Target apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponseResultTarget) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The constraint of a target. +type ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraint struct { + // The matches operator can use asterisks and pipes as wildcard and 'or' operators. + Operator ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperator `json:"operator"` + // The URL pattern to match against the current request. The pattern may contain up + // to four asterisks ('\*') as placeholders. + Value string `json:"value"` + JSON zonePagerulePageRulesListPageRulesResponseResultTargetsConstraintJSON `json:"-"` +} + +// zonePagerulePageRulesListPageRulesResponseResultTargetsConstraintJSON contains +// the JSON metadata for the struct +// [ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraint] +type zonePagerulePageRulesListPageRulesResponseResultTargetsConstraintJSON struct { + Operator apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraint) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The matches operator can use asterisks and pipes as wildcard and 'or' operators. +type ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperator string + +const ( + ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperatorMatches ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperator = "matches" + ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperatorContains ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperator = "contains" + ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperatorEquals ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperator = "equals" + ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperatorNotEqual ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperator = "not_equal" + ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperatorNotContain ZonePagerulePageRulesListPageRulesResponseResultTargetsConstraintOperator = "not_contain" +) + +// A target based on the URL of the request. +type ZonePagerulePageRulesListPageRulesResponseResultTargetsTarget string + +const ( + ZonePagerulePageRulesListPageRulesResponseResultTargetsTargetURL ZonePagerulePageRulesListPageRulesResponseResultTargetsTarget = "url" +) + +// Whether the API call was successful +type ZonePagerulePageRulesListPageRulesResponseSuccess bool + +const ( + ZonePagerulePageRulesListPageRulesResponseSuccessTrue ZonePagerulePageRulesListPageRulesResponseSuccess = true +) + +type ZonePageruleUpdateParams struct { + // The set of actions to perform if the targets of this rule match the request. + // Actions can redirect to another URL or override settings, but not both. + Actions param.Field[[]ZonePageruleUpdateParamsAction] `json:"actions,required"` + // The rule targets to evaluate on each request. + Targets param.Field[[]ZonePageruleUpdateParamsTarget] `json:"targets,required"` + // The priority of the rule, used to define which Page Rule is processed over + // another. A higher number indicates a higher priority. For example, if you have a + // catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + // take precedence (rule B: `/images/special/*`), specify a higher priority for + // rule B so it overrides rule A. + Priority param.Field[int64] `json:"priority"` + // The status of the Page Rule. + Status param.Field[ZonePageruleUpdateParamsStatus] `json:"status"` +} + +func (r ZonePageruleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZonePageruleUpdateParamsAction struct { + // The type of route. + Name param.Field[ZonePageruleUpdateParamsActionsName] `json:"name"` + Value param.Field[ZonePageruleUpdateParamsActionsValue] `json:"value"` +} + +func (r ZonePageruleUpdateParamsAction) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of route. +type ZonePageruleUpdateParamsActionsName string + +const ( + ZonePageruleUpdateParamsActionsNameForwardURL ZonePageruleUpdateParamsActionsName = "forward_url" +) + +type ZonePageruleUpdateParamsActionsValue struct { + // The response type for the URL redirect. + Type param.Field[ZonePageruleUpdateParamsActionsValueType] `json:"type"` + // The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + // in the constraint value. + URL param.Field[string] `json:"url"` +} + +func (r ZonePageruleUpdateParamsActionsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response type for the URL redirect. +type ZonePageruleUpdateParamsActionsValueType string + +const ( + ZonePageruleUpdateParamsActionsValueTypeTemporary ZonePageruleUpdateParamsActionsValueType = "temporary" + ZonePageruleUpdateParamsActionsValueTypePermanent ZonePageruleUpdateParamsActionsValueType = "permanent" +) + +// A request condition target. +type ZonePageruleUpdateParamsTarget struct { + // The constraint of a target. + Constraint param.Field[ZonePageruleUpdateParamsTargetsConstraint] `json:"constraint,required"` + // A target based on the URL of the request. + Target param.Field[ZonePageruleUpdateParamsTargetsTarget] `json:"target,required"` +} + +func (r ZonePageruleUpdateParamsTarget) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The constraint of a target. +type ZonePageruleUpdateParamsTargetsConstraint struct { + // The matches operator can use asterisks and pipes as wildcard and 'or' operators. + Operator param.Field[ZonePageruleUpdateParamsTargetsConstraintOperator] `json:"operator"` + // The URL pattern to match against the current request. The pattern may contain up + // to four asterisks ('\*') as placeholders. + Value param.Field[string] `json:"value"` +} + +func (r ZonePageruleUpdateParamsTargetsConstraint) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The matches operator can use asterisks and pipes as wildcard and 'or' operators. +type ZonePageruleUpdateParamsTargetsConstraintOperator string + +const ( + ZonePageruleUpdateParamsTargetsConstraintOperatorMatches ZonePageruleUpdateParamsTargetsConstraintOperator = "matches" + ZonePageruleUpdateParamsTargetsConstraintOperatorContains ZonePageruleUpdateParamsTargetsConstraintOperator = "contains" + ZonePageruleUpdateParamsTargetsConstraintOperatorEquals ZonePageruleUpdateParamsTargetsConstraintOperator = "equals" + ZonePageruleUpdateParamsTargetsConstraintOperatorNotEqual ZonePageruleUpdateParamsTargetsConstraintOperator = "not_equal" + ZonePageruleUpdateParamsTargetsConstraintOperatorNotContain ZonePageruleUpdateParamsTargetsConstraintOperator = "not_contain" +) + +// A target based on the URL of the request. +type ZonePageruleUpdateParamsTargetsTarget string + +const ( + ZonePageruleUpdateParamsTargetsTargetURL ZonePageruleUpdateParamsTargetsTarget = "url" +) + +// The status of the Page Rule. +type ZonePageruleUpdateParamsStatus string + +const ( + ZonePageruleUpdateParamsStatusActive ZonePageruleUpdateParamsStatus = "active" + ZonePageruleUpdateParamsStatusDisabled ZonePageruleUpdateParamsStatus = "disabled" +) + +type ZonePagerulePageRulesNewAPageRuleParams struct { + // The set of actions to perform if the targets of this rule match the request. + // Actions can redirect to another URL or override settings, but not both. + Actions param.Field[[]ZonePagerulePageRulesNewAPageRuleParamsAction] `json:"actions,required"` + // The rule targets to evaluate on each request. + Targets param.Field[[]ZonePagerulePageRulesNewAPageRuleParamsTarget] `json:"targets,required"` + // The priority of the rule, used to define which Page Rule is processed over + // another. A higher number indicates a higher priority. For example, if you have a + // catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + // take precedence (rule B: `/images/special/*`), specify a higher priority for + // rule B so it overrides rule A. + Priority param.Field[int64] `json:"priority"` + // The status of the Page Rule. + Status param.Field[ZonePagerulePageRulesNewAPageRuleParamsStatus] `json:"status"` +} + +func (r ZonePagerulePageRulesNewAPageRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZonePagerulePageRulesNewAPageRuleParamsAction struct { + // The type of route. + Name param.Field[ZonePagerulePageRulesNewAPageRuleParamsActionsName] `json:"name"` + Value param.Field[ZonePagerulePageRulesNewAPageRuleParamsActionsValue] `json:"value"` +} + +func (r ZonePagerulePageRulesNewAPageRuleParamsAction) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of route. +type ZonePagerulePageRulesNewAPageRuleParamsActionsName string + +const ( + ZonePagerulePageRulesNewAPageRuleParamsActionsNameForwardURL ZonePagerulePageRulesNewAPageRuleParamsActionsName = "forward_url" +) + +type ZonePagerulePageRulesNewAPageRuleParamsActionsValue struct { + // The response type for the URL redirect. + Type param.Field[ZonePagerulePageRulesNewAPageRuleParamsActionsValueType] `json:"type"` + // The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + // in the constraint value. + URL param.Field[string] `json:"url"` +} + +func (r ZonePagerulePageRulesNewAPageRuleParamsActionsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response type for the URL redirect. +type ZonePagerulePageRulesNewAPageRuleParamsActionsValueType string + +const ( + ZonePagerulePageRulesNewAPageRuleParamsActionsValueTypeTemporary ZonePagerulePageRulesNewAPageRuleParamsActionsValueType = "temporary" + ZonePagerulePageRulesNewAPageRuleParamsActionsValueTypePermanent ZonePagerulePageRulesNewAPageRuleParamsActionsValueType = "permanent" +) + +// A request condition target. +type ZonePagerulePageRulesNewAPageRuleParamsTarget struct { + // The constraint of a target. + Constraint param.Field[ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraint] `json:"constraint,required"` + // A target based on the URL of the request. + Target param.Field[ZonePagerulePageRulesNewAPageRuleParamsTargetsTarget] `json:"target,required"` +} + +func (r ZonePagerulePageRulesNewAPageRuleParamsTarget) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The constraint of a target. +type ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraint struct { + // The matches operator can use asterisks and pipes as wildcard and 'or' operators. + Operator param.Field[ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperator] `json:"operator"` + // The URL pattern to match against the current request. The pattern may contain up + // to four asterisks ('\*') as placeholders. + Value param.Field[string] `json:"value"` +} + +func (r ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraint) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The matches operator can use asterisks and pipes as wildcard and 'or' operators. +type ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperator string + +const ( + ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperatorMatches ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperator = "matches" + ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperatorContains ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperator = "contains" + ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperatorEquals ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperator = "equals" + ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperatorNotEqual ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperator = "not_equal" + ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperatorNotContain ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperator = "not_contain" +) + +// A target based on the URL of the request. +type ZonePagerulePageRulesNewAPageRuleParamsTargetsTarget string + +const ( + ZonePagerulePageRulesNewAPageRuleParamsTargetsTargetURL ZonePagerulePageRulesNewAPageRuleParamsTargetsTarget = "url" +) + +// The status of the Page Rule. +type ZonePagerulePageRulesNewAPageRuleParamsStatus string + +const ( + ZonePagerulePageRulesNewAPageRuleParamsStatusActive ZonePagerulePageRulesNewAPageRuleParamsStatus = "active" + ZonePagerulePageRulesNewAPageRuleParamsStatusDisabled ZonePagerulePageRulesNewAPageRuleParamsStatus = "disabled" +) + +type ZonePagerulePageRulesListPageRulesParams struct { + // The direction used to sort returned Page Rules. + Direction param.Field[ZonePagerulePageRulesListPageRulesParamsDirection] `query:"direction"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[ZonePagerulePageRulesListPageRulesParamsMatch] `query:"match"` + // The field used to sort returned Page Rules. + Order param.Field[ZonePagerulePageRulesListPageRulesParamsOrder] `query:"order"` + // The status of the Page Rule. + Status param.Field[ZonePagerulePageRulesListPageRulesParamsStatus] `query:"status"` +} + +// URLQuery serializes [ZonePagerulePageRulesListPageRulesParams]'s query +// parameters as `url.Values`. +func (r ZonePagerulePageRulesListPageRulesParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned Page Rules. +type ZonePagerulePageRulesListPageRulesParamsDirection string + +const ( + ZonePagerulePageRulesListPageRulesParamsDirectionAsc ZonePagerulePageRulesListPageRulesParamsDirection = "asc" + ZonePagerulePageRulesListPageRulesParamsDirectionDesc ZonePagerulePageRulesListPageRulesParamsDirection = "desc" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type ZonePagerulePageRulesListPageRulesParamsMatch string + +const ( + ZonePagerulePageRulesListPageRulesParamsMatchAny ZonePagerulePageRulesListPageRulesParamsMatch = "any" + ZonePagerulePageRulesListPageRulesParamsMatchAll ZonePagerulePageRulesListPageRulesParamsMatch = "all" +) + +// The field used to sort returned Page Rules. +type ZonePagerulePageRulesListPageRulesParamsOrder string + +const ( + ZonePagerulePageRulesListPageRulesParamsOrderStatus ZonePagerulePageRulesListPageRulesParamsOrder = "status" + ZonePagerulePageRulesListPageRulesParamsOrderPriority ZonePagerulePageRulesListPageRulesParamsOrder = "priority" +) + +// The status of the Page Rule. +type ZonePagerulePageRulesListPageRulesParamsStatus string + +const ( + ZonePagerulePageRulesListPageRulesParamsStatusActive ZonePagerulePageRulesListPageRulesParamsStatus = "active" + ZonePagerulePageRulesListPageRulesParamsStatusDisabled ZonePagerulePageRulesListPageRulesParamsStatus = "disabled" +) diff --git a/zonepagerule_test.go b/zonepagerule_test.go new file mode 100644 index 00000000000..9400dbb0020 --- /dev/null +++ b/zonepagerule_test.go @@ -0,0 +1,228 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZonePageruleGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Pagerules.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZonePageruleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Pagerules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZonePageruleUpdateParams{ + Actions: cloudflare.F([]cloudflare.ZonePageruleUpdateParamsAction{{ + Name: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsValue{ + Type: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsValue{ + Type: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsValue{ + Type: cloudflare.F(cloudflare.ZonePageruleUpdateParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }}), + Targets: cloudflare.F([]cloudflare.ZonePageruleUpdateParamsTarget{{ + Constraint: cloudflare.F(cloudflare.ZonePageruleUpdateParamsTargetsConstraint{ + Operator: cloudflare.F(cloudflare.ZonePageruleUpdateParamsTargetsConstraintOperatorMatches), + Value: cloudflare.F("*example.com/images/*"), + }), + Target: cloudflare.F(cloudflare.ZonePageruleUpdateParamsTargetsTargetURL), + }}), + Priority: cloudflare.F(int64(0)), + Status: cloudflare.F(cloudflare.ZonePageruleUpdateParamsStatusActive), + }, + ) + 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 TestZonePageruleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Pagerules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZonePagerulePageRulesNewAPageRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Pagerules.PageRulesNewAPageRule( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZonePagerulePageRulesNewAPageRuleParams{ + Actions: cloudflare.F([]cloudflare.ZonePagerulePageRulesNewAPageRuleParamsAction{{ + Name: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsValue{ + Type: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsValue{ + Type: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsNameForwardURL), + Value: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsValue{ + Type: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsActionsValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }}), + Targets: cloudflare.F([]cloudflare.ZonePagerulePageRulesNewAPageRuleParamsTarget{{ + Constraint: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraint{ + Operator: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsTargetsConstraintOperatorMatches), + Value: cloudflare.F("*example.com/images/*"), + }), + Target: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsTargetsTargetURL), + }}), + Priority: cloudflare.F(int64(0)), + Status: cloudflare.F(cloudflare.ZonePagerulePageRulesNewAPageRuleParamsStatusActive), + }, + ) + 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 TestZonePagerulePageRulesListPageRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Pagerules.PageRulesListPageRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZonePagerulePageRulesListPageRulesParams{ + Direction: cloudflare.F(cloudflare.ZonePagerulePageRulesListPageRulesParamsDirectionDesc), + Match: cloudflare.F(cloudflare.ZonePagerulePageRulesListPageRulesParamsMatchAny), + Order: cloudflare.F(cloudflare.ZonePagerulePageRulesListPageRulesParamsOrderStatus), + Status: cloudflare.F(cloudflare.ZonePagerulePageRulesListPageRulesParamsStatusActive), + }, + ) + 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/zonepagerulesetting.go b/zonepagerulesetting.go new file mode 100644 index 00000000000..a9d205b98a2 --- /dev/null +++ b/zonepagerulesetting.go @@ -0,0 +1,113 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZonePageruleSettingService 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 [NewZonePageruleSettingService] +// method instead. +type ZonePageruleSettingService struct { + Options []option.RequestOption +} + +// NewZonePageruleSettingService 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 NewZonePageruleSettingService(opts ...option.RequestOption) (r *ZonePageruleSettingService) { + r = &ZonePageruleSettingService{} + r.Options = opts + return +} + +// Returns a list of settings (and their details) that Page Rules can apply to +// matching requests. +func (r *ZonePageruleSettingService) AvailablePageRulesSettingsListAvailablePageRulesSettings(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/pagerules/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponse struct { + Errors []ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseError `json:"errors"` + Messages []ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseMessage `json:"messages"` + // Settings available for the zone. + Result []interface{} `json:"result"` + // Whether the API call was successful + Success ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseSuccess `json:"success"` + JSON zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseJSON `json:"-"` +} + +// zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseJSON +// contains the JSON metadata for the struct +// [ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponse] +type zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseErrorJSON `json:"-"` +} + +// zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseError] +type zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseMessageJSON `json:"-"` +} + +// zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseMessage] +type zonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseSuccess bool + +const ( + ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseSuccessTrue ZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettingsResponseSuccess = true +) diff --git a/zonepagerulesetting_test.go b/zonepagerulesetting_test.go new file mode 100644 index 00000000000..8c60e80c825 --- /dev/null +++ b/zonepagerulesetting_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZonePageruleSettingAvailablePageRulesSettingsListAvailablePageRulesSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Pagerules.Settings.AvailablePageRulesSettingsListAvailablePageRulesSettings(context.TODO(), "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/zonepageshield.go b/zonepageshield.go new file mode 100644 index 00000000000..028c357a575 --- /dev/null +++ b/zonepageshield.go @@ -0,0 +1,266 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZonePageShieldService 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 [NewZonePageShieldService] method +// instead. +type ZonePageShieldService struct { + Options []option.RequestOption + Connections *ZonePageShieldConnectionService + Scripts *ZonePageShieldScriptService + Policies *ZonePageShieldPolicyService +} + +// NewZonePageShieldService 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 NewZonePageShieldService(opts ...option.RequestOption) (r *ZonePageShieldService) { + r = &ZonePageShieldService{} + r.Options = opts + r.Connections = NewZonePageShieldConnectionService(opts...) + r.Scripts = NewZonePageShieldScriptService(opts...) + r.Policies = NewZonePageShieldPolicyService(opts...) + return +} + +// Fetches the Page Shield settings. +func (r *ZonePageShieldService) List(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZonePageShieldListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates Page Shield settings. +func (r *ZonePageShieldService) PageShieldUpdatePageShieldSettings(ctx context.Context, zoneID string, body ZonePageShieldPageShieldUpdatePageShieldSettingsParams, opts ...option.RequestOption) (res *ZonePageShieldPageShieldUpdatePageShieldSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZonePageShieldListResponse struct { + Errors []ZonePageShieldListResponseError `json:"errors"` + Messages []ZonePageShieldListResponseMessage `json:"messages"` + Result ZonePageShieldListResponseResult `json:"result"` + // Whether the API call was successful + Success ZonePageShieldListResponseSuccess `json:"success"` + JSON zonePageShieldListResponseJSON `json:"-"` +} + +// zonePageShieldListResponseJSON contains the JSON metadata for the struct +// [ZonePageShieldListResponse] +type zonePageShieldListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldListResponseErrorJSON `json:"-"` +} + +// zonePageShieldListResponseErrorJSON contains the JSON metadata for the struct +// [ZonePageShieldListResponseError] +type zonePageShieldListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldListResponseMessageJSON `json:"-"` +} + +// zonePageShieldListResponseMessageJSON contains the JSON metadata for the struct +// [ZonePageShieldListResponseMessage] +type zonePageShieldListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldListResponseResult struct { + // When true, indicates that Page Shield is enabled. + Enabled bool `json:"enabled"` + // The timestamp of when Page Shield was last updated. + UpdatedAt string `json:"updated_at"` + // When true, CSP reports will be sent to + // https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report + UseCloudflareReportingEndpoint bool `json:"use_cloudflare_reporting_endpoint"` + // When true, the paths associated with connections URLs will also be analyzed. + UseConnectionURLPath bool `json:"use_connection_url_path"` + JSON zonePageShieldListResponseResultJSON `json:"-"` +} + +// zonePageShieldListResponseResultJSON contains the JSON metadata for the struct +// [ZonePageShieldListResponseResult] +type zonePageShieldListResponseResultJSON struct { + Enabled apijson.Field + UpdatedAt apijson.Field + UseCloudflareReportingEndpoint apijson.Field + UseConnectionURLPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePageShieldListResponseSuccess bool + +const ( + ZonePageShieldListResponseSuccessTrue ZonePageShieldListResponseSuccess = true +) + +type ZonePageShieldPageShieldUpdatePageShieldSettingsResponse struct { + Errors []ZonePageShieldPageShieldUpdatePageShieldSettingsResponseError `json:"errors"` + Messages []ZonePageShieldPageShieldUpdatePageShieldSettingsResponseMessage `json:"messages"` + Result ZonePageShieldPageShieldUpdatePageShieldSettingsResponseResult `json:"result"` + // Whether the API call was successful + Success ZonePageShieldPageShieldUpdatePageShieldSettingsResponseSuccess `json:"success"` + JSON zonePageShieldPageShieldUpdatePageShieldSettingsResponseJSON `json:"-"` +} + +// zonePageShieldPageShieldUpdatePageShieldSettingsResponseJSON contains the JSON +// metadata for the struct +// [ZonePageShieldPageShieldUpdatePageShieldSettingsResponse] +type zonePageShieldPageShieldUpdatePageShieldSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPageShieldUpdatePageShieldSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldPageShieldUpdatePageShieldSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldPageShieldUpdatePageShieldSettingsResponseErrorJSON `json:"-"` +} + +// zonePageShieldPageShieldUpdatePageShieldSettingsResponseErrorJSON contains the +// JSON metadata for the struct +// [ZonePageShieldPageShieldUpdatePageShieldSettingsResponseError] +type zonePageShieldPageShieldUpdatePageShieldSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPageShieldUpdatePageShieldSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldPageShieldUpdatePageShieldSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldPageShieldUpdatePageShieldSettingsResponseMessageJSON `json:"-"` +} + +// zonePageShieldPageShieldUpdatePageShieldSettingsResponseMessageJSON contains the +// JSON metadata for the struct +// [ZonePageShieldPageShieldUpdatePageShieldSettingsResponseMessage] +type zonePageShieldPageShieldUpdatePageShieldSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPageShieldUpdatePageShieldSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldPageShieldUpdatePageShieldSettingsResponseResult struct { + // When true, indicates that Page Shield is enabled. + Enabled bool `json:"enabled"` + // The timestamp of when Page Shield was last updated. + UpdatedAt string `json:"updated_at"` + // When true, CSP reports will be sent to + // https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report + UseCloudflareReportingEndpoint bool `json:"use_cloudflare_reporting_endpoint"` + // When true, the paths associated with connections URLs will also be analyzed. + UseConnectionURLPath bool `json:"use_connection_url_path"` + JSON zonePageShieldPageShieldUpdatePageShieldSettingsResponseResultJSON `json:"-"` +} + +// zonePageShieldPageShieldUpdatePageShieldSettingsResponseResultJSON contains the +// JSON metadata for the struct +// [ZonePageShieldPageShieldUpdatePageShieldSettingsResponseResult] +type zonePageShieldPageShieldUpdatePageShieldSettingsResponseResultJSON struct { + Enabled apijson.Field + UpdatedAt apijson.Field + UseCloudflareReportingEndpoint apijson.Field + UseConnectionURLPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPageShieldUpdatePageShieldSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePageShieldPageShieldUpdatePageShieldSettingsResponseSuccess bool + +const ( + ZonePageShieldPageShieldUpdatePageShieldSettingsResponseSuccessTrue ZonePageShieldPageShieldUpdatePageShieldSettingsResponseSuccess = true +) + +type ZonePageShieldPageShieldUpdatePageShieldSettingsParams struct { + // When true, indicates that Page Shield is enabled. + Enabled param.Field[bool] `json:"enabled"` + // When true, CSP reports will be sent to + // https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report + UseCloudflareReportingEndpoint param.Field[bool] `json:"use_cloudflare_reporting_endpoint"` + // When true, the paths associated with connections URLs will also be analyzed. + UseConnectionURLPath param.Field[bool] `json:"use_connection_url_path"` +} + +func (r ZonePageShieldPageShieldUpdatePageShieldSettingsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonepageshield_test.go b/zonepageshield_test.go new file mode 100644 index 00000000000..7bd91129984 --- /dev/null +++ b/zonepageshield_test.go @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZonePageShieldList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.List(context.TODO(), "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()) + } +} + +func TestZonePageShieldPageShieldUpdatePageShieldSettingsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.PageShieldUpdatePageShieldSettings( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZonePageShieldPageShieldUpdatePageShieldSettingsParams{ + Enabled: cloudflare.F(true), + UseCloudflareReportingEndpoint: cloudflare.F(true), + UseConnectionURLPath: cloudflare.F(true), + }, + ) + 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/zonepageshieldconnection.go b/zonepageshieldconnection.go new file mode 100644 index 00000000000..14e7ab01ad6 --- /dev/null +++ b/zonepageshieldconnection.go @@ -0,0 +1,306 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZonePageShieldConnectionService 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 +// [NewZonePageShieldConnectionService] method instead. +type ZonePageShieldConnectionService struct { + Options []option.RequestOption +} + +// NewZonePageShieldConnectionService 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 NewZonePageShieldConnectionService(opts ...option.RequestOption) (r *ZonePageShieldConnectionService) { + r = &ZonePageShieldConnectionService{} + r.Options = opts + return +} + +// Fetches a connection detected by Page Shield by connection ID. +func (r *ZonePageShieldConnectionService) Get(ctx context.Context, zoneID string, connectionID string, opts ...option.RequestOption) (res *ZonePageShieldConnectionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/connections/%s", zoneID, connectionID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Lists all connections detected by Page Shield. +func (r *ZonePageShieldConnectionService) PageShieldListPageShieldConnections(ctx context.Context, zoneID string, query ZonePageShieldConnectionPageShieldListPageShieldConnectionsParams, opts ...option.RequestOption) (res *ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/connections", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZonePageShieldConnectionGetResponse struct { + ID interface{} `json:"id"` + AddedAt interface{} `json:"added_at"` + DomainReportedMalicious interface{} `json:"domain_reported_malicious"` + FirstPageURL interface{} `json:"first_page_url"` + FirstSeenAt interface{} `json:"first_seen_at"` + Host interface{} `json:"host"` + LastSeenAt interface{} `json:"last_seen_at"` + PageURLs interface{} `json:"page_urls"` + URL interface{} `json:"url"` + URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"` + JSON zonePageShieldConnectionGetResponseJSON `json:"-"` +} + +// zonePageShieldConnectionGetResponseJSON contains the JSON metadata for the +// struct [ZonePageShieldConnectionGetResponse] +type zonePageShieldConnectionGetResponseJSON struct { + ID apijson.Field + AddedAt apijson.Field + DomainReportedMalicious apijson.Field + FirstPageURL apijson.Field + FirstSeenAt apijson.Field + Host apijson.Field + LastSeenAt apijson.Field + PageURLs apijson.Field + URL apijson.Field + URLContainsCdnCgiPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldConnectionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponse struct { + Errors []ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseError `json:"errors"` + Messages []ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseMessage `json:"messages"` + Result []ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResult `json:"result"` + ResultInfo ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseSuccess `json:"success"` + JSON zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseJSON `json:"-"` +} + +// zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseJSON contains +// the JSON metadata for the struct +// [ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponse] +type zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseErrorJSON `json:"-"` +} + +// zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseError] +type zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseMessageJSON `json:"-"` +} + +// zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseMessage] +type zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResult struct { + ID interface{} `json:"id"` + AddedAt interface{} `json:"added_at"` + DomainReportedMalicious interface{} `json:"domain_reported_malicious"` + FirstPageURL interface{} `json:"first_page_url"` + FirstSeenAt interface{} `json:"first_seen_at"` + Host interface{} `json:"host"` + LastSeenAt interface{} `json:"last_seen_at"` + PageURLs interface{} `json:"page_urls"` + URL interface{} `json:"url"` + URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"` + JSON zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultJSON `json:"-"` +} + +// zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultJSON +// contains the JSON metadata for the struct +// [ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResult] +type zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultJSON struct { + ID apijson.Field + AddedAt apijson.Field + DomainReportedMalicious apijson.Field + FirstPageURL apijson.Field + FirstSeenAt apijson.Field + Host apijson.Field + LastSeenAt apijson.Field + PageURLs apijson.Field + URL apijson.Field + URLContainsCdnCgiPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultInfoJSON `json:"-"` +} + +// zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultInfo] +type zonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseSuccess bool + +const ( + ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseSuccessTrue ZonePageShieldConnectionPageShieldListPageShieldConnectionsResponseSuccess = true +) + +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsParams struct { + // The direction used to sort returned connections. + Direction param.Field[ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsDirection] `query:"direction"` + // When true, excludes connections seen in a `/cdn-cgi` path from the returned + // connections. The default value is true. + ExcludeCdnCgi param.Field[bool] `query:"exclude_cdn_cgi"` + // Excludes connections whose URL contains one of the URL-encoded URLs separated by + // commas. + ExcludeURLs param.Field[string] `query:"exclude_urls"` + // Export the list of connections as a file. Cannot be used with per_page or page + // options. + Export param.Field[ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsExport] `query:"export"` + // Includes connections that match one or more URL-encoded hostnames separated by + // commas. + // + // Wildcards are supported at the start and end of each hostname to support starts + // with, ends with and contains. If no wildcards are used, results will be filtered + // by exact match + Hosts param.Field[string] `query:"hosts"` + // The field used to sort returned connections. + OrderBy param.Field[ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsOrderBy] `query:"order_by"` + // The current page number of the paginated results. + // + // We additionally support a special value "all". When "all" is used, the API will + // return all the connections with the applied filters in a single page. + // Additionally, when using this value, the API will not return the categorisation + // data for the URL and domain of the connections. This feature is best-effort and + // it may only work for zones with a low number of connections + Page param.Field[string] `query:"page"` + // Includes connections that match one or more page URLs (separated by commas) + // where they were last seen + // + // Wildcards are supported at the start and end of each page URL to support starts + // with, ends with and contains. If no wildcards are used, results will be filtered + // by exact match + PageURL param.Field[string] `query:"page_url"` + // The number of results per page. + PerPage param.Field[float64] `query:"per_page"` + // When true, malicious connections appear first in the returned connections. + PrioritizeMalicious param.Field[bool] `query:"prioritize_malicious"` + // Filters the returned connections using a comma-separated list of connection + // statuses. Accepted values: `active`, `infrequent`, and `inactive`. The default + // value is `active`. + Status param.Field[string] `query:"status"` + // Includes connections whose URL contain one or more URL-encoded URLs separated by + // commas. + URLs param.Field[string] `query:"urls"` +} + +// URLQuery serializes +// [ZonePageShieldConnectionPageShieldListPageShieldConnectionsParams]'s query +// parameters as `url.Values`. +func (r ZonePageShieldConnectionPageShieldListPageShieldConnectionsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned connections. +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsDirection string + +const ( + ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsDirectionAsc ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsDirection = "asc" + ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsDirectionDesc ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsDirection = "desc" +) + +// Export the list of connections as a file. Cannot be used with per_page or page +// options. +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsExport string + +const ( + ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsExportCsv ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsExport = "csv" +) + +// The field used to sort returned connections. +type ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsOrderBy string + +const ( + ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsOrderByFirstSeenAt ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsOrderBy = "first_seen_at" + ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsOrderByLastSeenAt ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsOrderBy = "last_seen_at" +) diff --git a/zonepageshieldconnection_test.go b/zonepageshieldconnection_test.go new file mode 100644 index 00000000000..d5a3839cb73 --- /dev/null +++ b/zonepageshieldconnection_test.go @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZonePageShieldConnectionGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Connections.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "c9ef84a6bf5e47138c75d95e2f933e8f", + ) + 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 TestZonePageShieldConnectionPageShieldListPageShieldConnectionsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Connections.PageShieldListPageShieldConnections( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZonePageShieldConnectionPageShieldListPageShieldConnectionsParams{ + Direction: cloudflare.F(cloudflare.ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsDirectionAsc), + ExcludeCdnCgi: cloudflare.F(true), + ExcludeURLs: cloudflare.F("blog.cloudflare.com,www.example"), + Export: cloudflare.F(cloudflare.ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsExportCsv), + Hosts: cloudflare.F("blog.cloudflare.com,www.example*,*cloudflare.com"), + OrderBy: cloudflare.F(cloudflare.ZonePageShieldConnectionPageShieldListPageShieldConnectionsParamsOrderByFirstSeenAt), + Page: cloudflare.F("2"), + PageURL: cloudflare.F("example.com/page,*/checkout,example.com/*,*checkout*"), + PerPage: cloudflare.F(100.000000), + PrioritizeMalicious: cloudflare.F(true), + Status: cloudflare.F("active,inactive"), + URLs: cloudflare.F("blog.cloudflare.com,www.example"), + }, + ) + 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/zonepageshieldpolicy.go b/zonepageshieldpolicy.go new file mode 100644 index 00000000000..d254790ebb6 --- /dev/null +++ b/zonepageshieldpolicy.go @@ -0,0 +1,391 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZonePageShieldPolicyService 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 [NewZonePageShieldPolicyService] +// method instead. +type ZonePageShieldPolicyService struct { + Options []option.RequestOption +} + +// NewZonePageShieldPolicyService 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 NewZonePageShieldPolicyService(opts ...option.RequestOption) (r *ZonePageShieldPolicyService) { + r = &ZonePageShieldPolicyService{} + r.Options = opts + return +} + +// Create a Page Shield policy. +func (r *ZonePageShieldPolicyService) New(ctx context.Context, zoneID string, body ZonePageShieldPolicyNewParams, opts ...option.RequestOption) (res *ZonePageShieldPolicyNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/policies", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches a Page Shield policy by ID. +func (r *ZonePageShieldPolicyService) Get(ctx context.Context, zoneID string, policyID string, opts ...option.RequestOption) (res *ZonePageShieldPolicyGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/policies/%s", zoneID, policyID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update a Page Shield policy by ID. +func (r *ZonePageShieldPolicyService) Update(ctx context.Context, zoneID string, policyID string, body ZonePageShieldPolicyUpdateParams, opts ...option.RequestOption) (res *ZonePageShieldPolicyUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/policies/%s", zoneID, policyID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists all Page Shield policies. +func (r *ZonePageShieldPolicyService) List(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZonePageShieldPolicyListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/policies", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete a Page Shield policy by ID. +func (r *ZonePageShieldPolicyService) Delete(ctx context.Context, zoneID string, policyID string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("zones/%s/page_shield/policies/%s", zoneID, policyID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +type ZonePageShieldPolicyNewResponse struct { + // The ID of the policy + ID string `json:"id"` + // The action to take if the expression matches + Action ZonePageShieldPolicyNewResponseAction `json:"action"` + // A description for the policy + Description string `json:"description"` + // Whether the policy is enabled + Enabled bool `json:"enabled"` + // The expression which must match for the policy to be applied, using the + // Cloudflare Firewall rule expression syntax + Expression string `json:"expression"` + // The policy which will be applied + Value string `json:"value"` + JSON zonePageShieldPolicyNewResponseJSON `json:"-"` +} + +// zonePageShieldPolicyNewResponseJSON contains the JSON metadata for the struct +// [ZonePageShieldPolicyNewResponse] +type zonePageShieldPolicyNewResponseJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take if the expression matches +type ZonePageShieldPolicyNewResponseAction string + +const ( + ZonePageShieldPolicyNewResponseActionAllow ZonePageShieldPolicyNewResponseAction = "allow" + ZonePageShieldPolicyNewResponseActionLog ZonePageShieldPolicyNewResponseAction = "log" +) + +type ZonePageShieldPolicyGetResponse struct { + // The ID of the policy + ID string `json:"id"` + // The action to take if the expression matches + Action ZonePageShieldPolicyGetResponseAction `json:"action"` + // A description for the policy + Description string `json:"description"` + // Whether the policy is enabled + Enabled bool `json:"enabled"` + // The expression which must match for the policy to be applied, using the + // Cloudflare Firewall rule expression syntax + Expression string `json:"expression"` + // The policy which will be applied + Value string `json:"value"` + JSON zonePageShieldPolicyGetResponseJSON `json:"-"` +} + +// zonePageShieldPolicyGetResponseJSON contains the JSON metadata for the struct +// [ZonePageShieldPolicyGetResponse] +type zonePageShieldPolicyGetResponseJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take if the expression matches +type ZonePageShieldPolicyGetResponseAction string + +const ( + ZonePageShieldPolicyGetResponseActionAllow ZonePageShieldPolicyGetResponseAction = "allow" + ZonePageShieldPolicyGetResponseActionLog ZonePageShieldPolicyGetResponseAction = "log" +) + +type ZonePageShieldPolicyUpdateResponse struct { + // The ID of the policy + ID string `json:"id"` + // The action to take if the expression matches + Action ZonePageShieldPolicyUpdateResponseAction `json:"action"` + // A description for the policy + Description string `json:"description"` + // Whether the policy is enabled + Enabled bool `json:"enabled"` + // The expression which must match for the policy to be applied, using the + // Cloudflare Firewall rule expression syntax + Expression string `json:"expression"` + // The policy which will be applied + Value string `json:"value"` + JSON zonePageShieldPolicyUpdateResponseJSON `json:"-"` +} + +// zonePageShieldPolicyUpdateResponseJSON contains the JSON metadata for the struct +// [ZonePageShieldPolicyUpdateResponse] +type zonePageShieldPolicyUpdateResponseJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take if the expression matches +type ZonePageShieldPolicyUpdateResponseAction string + +const ( + ZonePageShieldPolicyUpdateResponseActionAllow ZonePageShieldPolicyUpdateResponseAction = "allow" + ZonePageShieldPolicyUpdateResponseActionLog ZonePageShieldPolicyUpdateResponseAction = "log" +) + +type ZonePageShieldPolicyListResponse struct { + Errors []ZonePageShieldPolicyListResponseError `json:"errors"` + Messages []ZonePageShieldPolicyListResponseMessage `json:"messages"` + Result []ZonePageShieldPolicyListResponseResult `json:"result"` + ResultInfo ZonePageShieldPolicyListResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZonePageShieldPolicyListResponseSuccess `json:"success"` + JSON zonePageShieldPolicyListResponseJSON `json:"-"` +} + +// zonePageShieldPolicyListResponseJSON contains the JSON metadata for the struct +// [ZonePageShieldPolicyListResponse] +type zonePageShieldPolicyListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldPolicyListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldPolicyListResponseErrorJSON `json:"-"` +} + +// zonePageShieldPolicyListResponseErrorJSON contains the JSON metadata for the +// struct [ZonePageShieldPolicyListResponseError] +type zonePageShieldPolicyListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldPolicyListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldPolicyListResponseMessageJSON `json:"-"` +} + +// zonePageShieldPolicyListResponseMessageJSON contains the JSON metadata for the +// struct [ZonePageShieldPolicyListResponseMessage] +type zonePageShieldPolicyListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldPolicyListResponseResult struct { + // The ID of the policy + ID string `json:"id"` + // The action to take if the expression matches + Action ZonePageShieldPolicyListResponseResultAction `json:"action"` + // A description for the policy + Description string `json:"description"` + // Whether the policy is enabled + Enabled bool `json:"enabled"` + // The expression which must match for the policy to be applied, using the + // Cloudflare Firewall rule expression syntax + Expression string `json:"expression"` + // The policy which will be applied + Value string `json:"value"` + JSON zonePageShieldPolicyListResponseResultJSON `json:"-"` +} + +// zonePageShieldPolicyListResponseResultJSON contains the JSON metadata for the +// struct [ZonePageShieldPolicyListResponseResult] +type zonePageShieldPolicyListResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take if the expression matches +type ZonePageShieldPolicyListResponseResultAction string + +const ( + ZonePageShieldPolicyListResponseResultActionAllow ZonePageShieldPolicyListResponseResultAction = "allow" + ZonePageShieldPolicyListResponseResultActionLog ZonePageShieldPolicyListResponseResultAction = "log" +) + +type ZonePageShieldPolicyListResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zonePageShieldPolicyListResponseResultInfoJSON `json:"-"` +} + +// zonePageShieldPolicyListResponseResultInfoJSON contains the JSON metadata for +// the struct [ZonePageShieldPolicyListResponseResultInfo] +type zonePageShieldPolicyListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldPolicyListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePageShieldPolicyListResponseSuccess bool + +const ( + ZonePageShieldPolicyListResponseSuccessTrue ZonePageShieldPolicyListResponseSuccess = true +) + +type ZonePageShieldPolicyNewParams struct { + // The action to take if the expression matches + Action param.Field[ZonePageShieldPolicyNewParamsAction] `json:"action"` + // A description for the policy + Description param.Field[string] `json:"description"` + // Whether the policy is enabled + Enabled param.Field[bool] `json:"enabled"` + // The expression which must match for the policy to be applied, using the + // Cloudflare Firewall rule expression syntax + Expression param.Field[string] `json:"expression"` + // The policy which will be applied + Value param.Field[string] `json:"value"` +} + +func (r ZonePageShieldPolicyNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to take if the expression matches +type ZonePageShieldPolicyNewParamsAction string + +const ( + ZonePageShieldPolicyNewParamsActionAllow ZonePageShieldPolicyNewParamsAction = "allow" + ZonePageShieldPolicyNewParamsActionLog ZonePageShieldPolicyNewParamsAction = "log" +) + +type ZonePageShieldPolicyUpdateParams struct { + // The action to take if the expression matches + Action param.Field[ZonePageShieldPolicyUpdateParamsAction] `json:"action"` + // A description for the policy + Description param.Field[string] `json:"description"` + // Whether the policy is enabled + Enabled param.Field[bool] `json:"enabled"` + // The expression which must match for the policy to be applied, using the + // Cloudflare Firewall rule expression syntax + Expression param.Field[string] `json:"expression"` + // The policy which will be applied + Value param.Field[string] `json:"value"` +} + +func (r ZonePageShieldPolicyUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to take if the expression matches +type ZonePageShieldPolicyUpdateParamsAction string + +const ( + ZonePageShieldPolicyUpdateParamsActionAllow ZonePageShieldPolicyUpdateParamsAction = "allow" + ZonePageShieldPolicyUpdateParamsActionLog ZonePageShieldPolicyUpdateParamsAction = "log" +) diff --git a/zonepageshieldpolicy_test.go b/zonepageshieldpolicy_test.go new file mode 100644 index 00000000000..e8e68069419 --- /dev/null +++ b/zonepageshieldpolicy_test.go @@ -0,0 +1,173 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZonePageShieldPolicyNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Policies.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZonePageShieldPolicyNewParams{ + Action: cloudflare.F(cloudflare.ZonePageShieldPolicyNewParamsActionAllow), + Description: cloudflare.F("Checkout page CSP policy"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("ends_with(http.request.uri.path, \"/checkout\")"), + Value: cloudflare.F("script-src 'none';"), + }, + ) + 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 TestZonePageShieldPolicyGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Policies.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "c9ef84a6bf5e47138c75d95e2f933e8f", + ) + 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 TestZonePageShieldPolicyUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Policies.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "c9ef84a6bf5e47138c75d95e2f933e8f", + cloudflare.ZonePageShieldPolicyUpdateParams{ + Action: cloudflare.F(cloudflare.ZonePageShieldPolicyUpdateParamsActionAllow), + Description: cloudflare.F("Checkout page CSP policy"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("ends_with(http.request.uri.path, \"/checkout\")"), + Value: cloudflare.F("script-src 'none';"), + }, + ) + 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 TestZonePageShieldPolicyList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Policies.List(context.TODO(), "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()) + } +} + +func TestZonePageShieldPolicyDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Zones.PageShield.Policies.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "c9ef84a6bf5e47138c75d95e2f933e8f", + ) + 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/zonepageshieldscript.go b/zonepageshieldscript.go new file mode 100644 index 00000000000..5335ccb8c18 --- /dev/null +++ b/zonepageshieldscript.go @@ -0,0 +1,350 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZonePageShieldScriptService 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 [NewZonePageShieldScriptService] +// method instead. +type ZonePageShieldScriptService struct { + Options []option.RequestOption +} + +// NewZonePageShieldScriptService 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 NewZonePageShieldScriptService(opts ...option.RequestOption) (r *ZonePageShieldScriptService) { + r = &ZonePageShieldScriptService{} + r.Options = opts + return +} + +// Fetches a script detected by Page Shield by script ID. +func (r *ZonePageShieldScriptService) Get(ctx context.Context, zoneID string, scriptID string, opts ...option.RequestOption) (res *ZonePageShieldScriptGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/scripts/%s", zoneID, scriptID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Lists all scripts detected by Page Shield. +func (r *ZonePageShieldScriptService) PageShieldListPageShieldScripts(ctx context.Context, zoneID string, query ZonePageShieldScriptPageShieldListPageShieldScriptsParams, opts ...option.RequestOption) (res *ZonePageShieldScriptPageShieldListPageShieldScriptsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/page_shield/scripts", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZonePageShieldScriptGetResponse struct { + ID interface{} `json:"id"` + AddedAt interface{} `json:"added_at"` + DomainReportedMalicious interface{} `json:"domain_reported_malicious"` + FetchedAt interface{} `json:"fetched_at"` + FirstPageURL interface{} `json:"first_page_url"` + FirstSeenAt interface{} `json:"first_seen_at"` + Hash interface{} `json:"hash"` + Host interface{} `json:"host"` + JsIntegrityScore interface{} `json:"js_integrity_score"` + LastSeenAt interface{} `json:"last_seen_at"` + PageURLs interface{} `json:"page_urls"` + URL interface{} `json:"url"` + URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"` + Versions []ZonePageShieldScriptGetResponseVersion `json:"versions,nullable"` + JSON zonePageShieldScriptGetResponseJSON `json:"-"` +} + +// zonePageShieldScriptGetResponseJSON contains the JSON metadata for the struct +// [ZonePageShieldScriptGetResponse] +type zonePageShieldScriptGetResponseJSON struct { + ID apijson.Field + AddedAt apijson.Field + DomainReportedMalicious apijson.Field + FetchedAt apijson.Field + FirstPageURL apijson.Field + FirstSeenAt apijson.Field + Hash apijson.Field + Host apijson.Field + JsIntegrityScore apijson.Field + LastSeenAt apijson.Field + PageURLs apijson.Field + URL apijson.Field + URLContainsCdnCgiPath apijson.Field + Versions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldScriptGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The version of the analyzed script. +type ZonePageShieldScriptGetResponseVersion struct { + // The timestamp of when the script was last fetched. + FetchedAt string `json:"fetched_at,nullable"` + // The computed hash of the analyzed script. + Hash string `json:"hash,nullable"` + // The integrity score of the JavaScript content. + JsIntegrityScore int64 `json:"js_integrity_score,nullable"` + JSON zonePageShieldScriptGetResponseVersionJSON `json:"-"` +} + +// zonePageShieldScriptGetResponseVersionJSON contains the JSON metadata for the +// struct [ZonePageShieldScriptGetResponseVersion] +type zonePageShieldScriptGetResponseVersionJSON struct { + FetchedAt apijson.Field + Hash apijson.Field + JsIntegrityScore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldScriptGetResponseVersion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldScriptPageShieldListPageShieldScriptsResponse struct { + Errors []ZonePageShieldScriptPageShieldListPageShieldScriptsResponseError `json:"errors"` + Messages []ZonePageShieldScriptPageShieldListPageShieldScriptsResponseMessage `json:"messages"` + Result []ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResult `json:"result"` + ResultInfo ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZonePageShieldScriptPageShieldListPageShieldScriptsResponseSuccess `json:"success"` + JSON zonePageShieldScriptPageShieldListPageShieldScriptsResponseJSON `json:"-"` +} + +// zonePageShieldScriptPageShieldListPageShieldScriptsResponseJSON contains the +// JSON metadata for the struct +// [ZonePageShieldScriptPageShieldListPageShieldScriptsResponse] +type zonePageShieldScriptPageShieldListPageShieldScriptsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldScriptPageShieldListPageShieldScriptsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldScriptPageShieldListPageShieldScriptsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldScriptPageShieldListPageShieldScriptsResponseErrorJSON `json:"-"` +} + +// zonePageShieldScriptPageShieldListPageShieldScriptsResponseErrorJSON contains +// the JSON metadata for the struct +// [ZonePageShieldScriptPageShieldListPageShieldScriptsResponseError] +type zonePageShieldScriptPageShieldListPageShieldScriptsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldScriptPageShieldListPageShieldScriptsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldScriptPageShieldListPageShieldScriptsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePageShieldScriptPageShieldListPageShieldScriptsResponseMessageJSON `json:"-"` +} + +// zonePageShieldScriptPageShieldListPageShieldScriptsResponseMessageJSON contains +// the JSON metadata for the struct +// [ZonePageShieldScriptPageShieldListPageShieldScriptsResponseMessage] +type zonePageShieldScriptPageShieldListPageShieldScriptsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldScriptPageShieldListPageShieldScriptsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResult struct { + ID interface{} `json:"id"` + AddedAt interface{} `json:"added_at"` + DomainReportedMalicious interface{} `json:"domain_reported_malicious"` + FetchedAt interface{} `json:"fetched_at"` + FirstPageURL interface{} `json:"first_page_url"` + FirstSeenAt interface{} `json:"first_seen_at"` + Hash interface{} `json:"hash"` + Host interface{} `json:"host"` + JsIntegrityScore interface{} `json:"js_integrity_score"` + LastSeenAt interface{} `json:"last_seen_at"` + PageURLs interface{} `json:"page_urls"` + URL interface{} `json:"url"` + URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"` + JSON zonePageShieldScriptPageShieldListPageShieldScriptsResponseResultJSON `json:"-"` +} + +// zonePageShieldScriptPageShieldListPageShieldScriptsResponseResultJSON contains +// the JSON metadata for the struct +// [ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResult] +type zonePageShieldScriptPageShieldListPageShieldScriptsResponseResultJSON struct { + ID apijson.Field + AddedAt apijson.Field + DomainReportedMalicious apijson.Field + FetchedAt apijson.Field + FirstPageURL apijson.Field + FirstSeenAt apijson.Field + Hash apijson.Field + Host apijson.Field + JsIntegrityScore apijson.Field + LastSeenAt apijson.Field + PageURLs apijson.Field + URL apijson.Field + URLContainsCdnCgiPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zonePageShieldScriptPageShieldListPageShieldScriptsResponseResultInfoJSON `json:"-"` +} + +// zonePageShieldScriptPageShieldListPageShieldScriptsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResultInfo] +type zonePageShieldScriptPageShieldListPageShieldScriptsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePageShieldScriptPageShieldListPageShieldScriptsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePageShieldScriptPageShieldListPageShieldScriptsResponseSuccess bool + +const ( + ZonePageShieldScriptPageShieldListPageShieldScriptsResponseSuccessTrue ZonePageShieldScriptPageShieldListPageShieldScriptsResponseSuccess = true +) + +type ZonePageShieldScriptPageShieldListPageShieldScriptsParams struct { + // The direction used to sort returned scripts. + Direction param.Field[ZonePageShieldScriptPageShieldListPageShieldScriptsParamsDirection] `query:"direction"` + // When true, excludes scripts seen in a `/cdn-cgi` path from the returned scripts. + // The default value is true. + ExcludeCdnCgi param.Field[bool] `query:"exclude_cdn_cgi"` + // When true, excludes duplicate scripts. We consider a script duplicate of another + // if their javascript content matches and they share the same url host and zone + // hostname. In such case, we return the most recent script for the URL host and + // zone hostname combination. + ExcludeDuplicates param.Field[bool] `query:"exclude_duplicates"` + // Excludes scripts whose URL contains one of the URL-encoded URLs separated by + // commas. + ExcludeURLs param.Field[string] `query:"exclude_urls"` + // Export the list of scripts as a file. Cannot be used with per_page or page + // options. + Export param.Field[ZonePageShieldScriptPageShieldListPageShieldScriptsParamsExport] `query:"export"` + // Includes scripts that match one or more URL-encoded hostnames separated by + // commas. + // + // Wildcards are supported at the start and end of each hostname to support starts + // with, ends with and contains. If no wildcards are used, results will be filtered + // by exact match + Hosts param.Field[string] `query:"hosts"` + // The field used to sort returned scripts. + OrderBy param.Field[ZonePageShieldScriptPageShieldListPageShieldScriptsParamsOrderBy] `query:"order_by"` + // The current page number of the paginated results. + // + // We additionally support a special value "all". When "all" is used, the API will + // return all the scripts with the applied filters in a single page. Additionally, + // when using this value, the API will not return the script versions or + // categorisation data for the URL and domain of the scripts. This feature is + // best-effort and it may only work for zones with a low number of scripts + Page param.Field[string] `query:"page"` + // Includes scripts that match one or more page URLs (separated by commas) where + // they were last seen + // + // Wildcards are supported at the start and end of each page URL to support starts + // with, ends with and contains. If no wildcards are used, results will be filtered + // by exact match + PageURL param.Field[string] `query:"page_url"` + // The number of results per page. + PerPage param.Field[float64] `query:"per_page"` + // When true, malicious scripts appear first in the returned scripts. + PrioritizeMalicious param.Field[bool] `query:"prioritize_malicious"` + // Filters the returned scripts using a comma-separated list of scripts statuses. + // Accepted values: `active`, `infrequent`, and `inactive`. The default value is + // `active`. + Status param.Field[string] `query:"status"` + // Includes scripts whose URL contain one or more URL-encoded URLs separated by + // commas. + URLs param.Field[string] `query:"urls"` +} + +// URLQuery serializes +// [ZonePageShieldScriptPageShieldListPageShieldScriptsParams]'s query parameters +// as `url.Values`. +func (r ZonePageShieldScriptPageShieldListPageShieldScriptsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned scripts. +type ZonePageShieldScriptPageShieldListPageShieldScriptsParamsDirection string + +const ( + ZonePageShieldScriptPageShieldListPageShieldScriptsParamsDirectionAsc ZonePageShieldScriptPageShieldListPageShieldScriptsParamsDirection = "asc" + ZonePageShieldScriptPageShieldListPageShieldScriptsParamsDirectionDesc ZonePageShieldScriptPageShieldListPageShieldScriptsParamsDirection = "desc" +) + +// Export the list of scripts as a file. Cannot be used with per_page or page +// options. +type ZonePageShieldScriptPageShieldListPageShieldScriptsParamsExport string + +const ( + ZonePageShieldScriptPageShieldListPageShieldScriptsParamsExportCsv ZonePageShieldScriptPageShieldListPageShieldScriptsParamsExport = "csv" +) + +// The field used to sort returned scripts. +type ZonePageShieldScriptPageShieldListPageShieldScriptsParamsOrderBy string + +const ( + ZonePageShieldScriptPageShieldListPageShieldScriptsParamsOrderByFirstSeenAt ZonePageShieldScriptPageShieldListPageShieldScriptsParamsOrderBy = "first_seen_at" + ZonePageShieldScriptPageShieldListPageShieldScriptsParamsOrderByLastSeenAt ZonePageShieldScriptPageShieldListPageShieldScriptsParamsOrderBy = "last_seen_at" +) diff --git a/zonepageshieldscript_test.go b/zonepageshieldscript_test.go new file mode 100644 index 00000000000..0fea62767ca --- /dev/null +++ b/zonepageshieldscript_test.go @@ -0,0 +1,88 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZonePageShieldScriptGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Scripts.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "c9ef84a6bf5e47138c75d95e2f933e8f", + ) + 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 TestZonePageShieldScriptPageShieldListPageShieldScriptsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PageShield.Scripts.PageShieldListPageShieldScripts( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZonePageShieldScriptPageShieldListPageShieldScriptsParams{ + Direction: cloudflare.F(cloudflare.ZonePageShieldScriptPageShieldListPageShieldScriptsParamsDirectionAsc), + ExcludeCdnCgi: cloudflare.F(true), + ExcludeDuplicates: cloudflare.F(true), + ExcludeURLs: cloudflare.F("blog.cloudflare.com,www.example"), + Export: cloudflare.F(cloudflare.ZonePageShieldScriptPageShieldListPageShieldScriptsParamsExportCsv), + Hosts: cloudflare.F("blog.cloudflare.com,www.example*,*cloudflare.com"), + OrderBy: cloudflare.F(cloudflare.ZonePageShieldScriptPageShieldListPageShieldScriptsParamsOrderByFirstSeenAt), + Page: cloudflare.F("2"), + PageURL: cloudflare.F("example.com/page,*/checkout,example.com/*,*checkout*"), + PerPage: cloudflare.F(100.000000), + PrioritizeMalicious: cloudflare.F(true), + Status: cloudflare.F("active,inactive"), + URLs: cloudflare.F("blog.cloudflare.com,www.example"), + }, + ) + 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/zonepurgecach.go b/zonepurgecach.go new file mode 100644 index 00000000000..6c20981815e --- /dev/null +++ b/zonepurgecach.go @@ -0,0 +1,218 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZonePurgeCachService 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 [NewZonePurgeCachService] method +// instead. +type ZonePurgeCachService struct { + Options []option.RequestOption +} + +// NewZonePurgeCachService 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 NewZonePurgeCachService(opts ...option.RequestOption) (r *ZonePurgeCachService) { + r = &ZonePurgeCachService{} + r.Options = opts + return +} + +// ### Purge All Cached Content +// +// Removes ALL files from Cloudflare's cache. All tiers can purge everything. +// +// ### Purge Cached Content by URL +// +// Granularly removes one or more files from Cloudflare's cache by specifying URLs. +// All tiers can purge by URL. +// +// To purge files with custom cache keys, include the headers used to compute the +// cache key as in the example. If you have a device type or geo in your cache key, +// you will need to include the CF-Device-Type or CF-IPCountry headers. If you have +// lang in your cache key, you will need to include the Accept-Language header. +// +// **NB:** When including the Origin header, be sure to include the **scheme** and +// **hostname**. The port number can be omitted if it is the default port (80 for +// http, 443 for https), but must be included otherwise. +// +// ### Purge Cached Content by Tag, Host or Prefix +// +// Granularly removes one or more files from Cloudflare's cache either by +// specifying the host, the associated Cache-Tag, or a Prefix. Only Enterprise +// customers are permitted to purge by Tag, Host or Prefix. +// +// **NB:** Cache-Tag, host, and prefix purging each have a rate limit of 30,000 +// purge API calls in every 24 hour period. You may purge up to 30 tags, hosts, or +// prefixes in one API call. This rate limit can be raised for customers who need +// to purge at higher volume. +func (r *ZonePurgeCachService) ZonePurge(ctx context.Context, identifier string, body ZonePurgeCachZonePurgeParams, opts ...option.RequestOption) (res *ZonePurgeCachZonePurgeResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/purge_cache", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZonePurgeCachZonePurgeResponse struct { + Errors []ZonePurgeCachZonePurgeResponseError `json:"errors"` + Messages []ZonePurgeCachZonePurgeResponseMessage `json:"messages"` + Result ZonePurgeCachZonePurgeResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZonePurgeCachZonePurgeResponseSuccess `json:"success"` + JSON zonePurgeCachZonePurgeResponseJSON `json:"-"` +} + +// zonePurgeCachZonePurgeResponseJSON contains the JSON metadata for the struct +// [ZonePurgeCachZonePurgeResponse] +type zonePurgeCachZonePurgeResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePurgeCachZonePurgeResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePurgeCachZonePurgeResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePurgeCachZonePurgeResponseErrorJSON `json:"-"` +} + +// zonePurgeCachZonePurgeResponseErrorJSON contains the JSON metadata for the +// struct [ZonePurgeCachZonePurgeResponseError] +type zonePurgeCachZonePurgeResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePurgeCachZonePurgeResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePurgeCachZonePurgeResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zonePurgeCachZonePurgeResponseMessageJSON `json:"-"` +} + +// zonePurgeCachZonePurgeResponseMessageJSON contains the JSON metadata for the +// struct [ZonePurgeCachZonePurgeResponseMessage] +type zonePurgeCachZonePurgeResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePurgeCachZonePurgeResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZonePurgeCachZonePurgeResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON zonePurgeCachZonePurgeResponseResultJSON `json:"-"` +} + +// zonePurgeCachZonePurgeResponseResultJSON contains the JSON metadata for the +// struct [ZonePurgeCachZonePurgeResponseResult] +type zonePurgeCachZonePurgeResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZonePurgeCachZonePurgeResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZonePurgeCachZonePurgeResponseSuccess bool + +const ( + ZonePurgeCachZonePurgeResponseSuccessTrue ZonePurgeCachZonePurgeResponseSuccess = true +) + +// This interface is a union satisfied by one of the following: +// [ZonePurgeCachZonePurgeParamsBSSIfzalFlex], +// [ZonePurgeCachZonePurgeParamsBSSIfzalEverything], +// [ZonePurgeCachZonePurgeParamsBSSIfzalFiles]. +type ZonePurgeCachZonePurgeParams interface { + ImplementsZonePurgeCachZonePurgeParams() +} + +type ZonePurgeCachZonePurgeParamsBSSIfzalFlex struct { + Hosts param.Field[[]string] `json:"hosts"` + Prefixes param.Field[[]string] `json:"prefixes"` + Tags param.Field[[]string] `json:"tags"` +} + +func (r ZonePurgeCachZonePurgeParamsBSSIfzalFlex) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZonePurgeCachZonePurgeParamsBSSIfzalFlex) ImplementsZonePurgeCachZonePurgeParams() { + +} + +type ZonePurgeCachZonePurgeParamsBSSIfzalEverything struct { + PurgeEverything param.Field[bool] `json:"purge_everything"` +} + +func (r ZonePurgeCachZonePurgeParamsBSSIfzalEverything) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZonePurgeCachZonePurgeParamsBSSIfzalEverything) ImplementsZonePurgeCachZonePurgeParams() { + +} + +type ZonePurgeCachZonePurgeParamsBSSIfzalFiles struct { + Files param.Field[[]ZonePurgeCachZonePurgeParamsBssIfzalFilesFile] `json:"files"` +} + +func (r ZonePurgeCachZonePurgeParamsBSSIfzalFiles) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (ZonePurgeCachZonePurgeParamsBSSIfzalFiles) ImplementsZonePurgeCachZonePurgeParams() { + +} + +// Satisfied by [shared.UnionString], +// [ZonePurgeCachZonePurgeParamsBssIfzalFilesFilesBSSIfzalURLAndHeaders]. +type ZonePurgeCachZonePurgeParamsBssIfzalFilesFile interface { + ImplementsZonePurgeCachZonePurgeParamsBssIfzalFilesFile() +} + +type ZonePurgeCachZonePurgeParamsBssIfzalFilesFilesBSSIfzalURLAndHeaders struct { + Headers param.Field[interface{}] `json:"headers"` + URL param.Field[string] `json:"url"` +} + +func (r ZonePurgeCachZonePurgeParamsBssIfzalFilesFilesBSSIfzalURLAndHeaders) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZonePurgeCachZonePurgeParamsBssIfzalFilesFilesBSSIfzalURLAndHeaders) ImplementsZonePurgeCachZonePurgeParamsBssIfzalFilesFile() { +} diff --git a/zonepurgecach_test.go b/zonepurgecach_test.go new file mode 100644 index 00000000000..08e3b2db296 --- /dev/null +++ b/zonepurgecach_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZonePurgeCachZonePurgeWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.PurgeCaches.ZonePurge( + context.TODO(), + "string", + cloudflare.ZonePurgeCachZonePurgeParamsBSSIfzalFlex{ + Hosts: cloudflare.F([]string{"www.example.com", "images.example.com"}), + Prefixes: cloudflare.F([]string{"www.example.com/foo", "images.example.com/bar/baz"}), + Tags: cloudflare.F([]string{"some-tag", "another-tag"}), + }, + ) + 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/zonerailgun.go b/zonerailgun.go new file mode 100644 index 00000000000..e147646d207 --- /dev/null +++ b/zonerailgun.go @@ -0,0 +1,307 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRailgunService 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 [NewZoneRailgunService] method +// instead. +type ZoneRailgunService struct { + Options []option.RequestOption + Diagnoses *ZoneRailgunDiagnosisService +} + +// NewZoneRailgunService 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 NewZoneRailgunService(opts ...option.RequestOption) (r *ZoneRailgunService) { + r = &ZoneRailgunService{} + r.Options = opts + r.Diagnoses = NewZoneRailgunDiagnosisService(opts...) + return +} + +// Lists details about a specific Railgun. +func (r *ZoneRailgunService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneRailgunGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/railguns/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Connect or disconnect a Railgun. +func (r *ZoneRailgunService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneRailgunUpdateParams, opts ...option.RequestOption) (res *ZoneRailgunUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/railguns/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// A list of available Railguns the zone can use. +func (r *ZoneRailgunService) RailgunConnectionsForAZoneListAvailableRailguns(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/railguns", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneRailgunGetResponse struct { + Errors []ZoneRailgunGetResponseError `json:"errors"` + Messages []ZoneRailgunGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneRailgunGetResponseSuccess `json:"success"` + JSON zoneRailgunGetResponseJSON `json:"-"` +} + +// zoneRailgunGetResponseJSON contains the JSON metadata for the struct +// [ZoneRailgunGetResponse] +type zoneRailgunGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunGetResponseErrorJSON `json:"-"` +} + +// zoneRailgunGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneRailgunGetResponseError] +type zoneRailgunGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunGetResponseMessageJSON `json:"-"` +} + +// zoneRailgunGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRailgunGetResponseMessage] +type zoneRailgunGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneRailgunGetResponseSuccess bool + +const ( + ZoneRailgunGetResponseSuccessTrue ZoneRailgunGetResponseSuccess = true +) + +type ZoneRailgunUpdateResponse struct { + Errors []ZoneRailgunUpdateResponseError `json:"errors"` + Messages []ZoneRailgunUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneRailgunUpdateResponseSuccess `json:"success"` + JSON zoneRailgunUpdateResponseJSON `json:"-"` +} + +// zoneRailgunUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneRailgunUpdateResponse] +type zoneRailgunUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunUpdateResponseErrorJSON `json:"-"` +} + +// zoneRailgunUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneRailgunUpdateResponseError] +type zoneRailgunUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunUpdateResponseMessageJSON `json:"-"` +} + +// zoneRailgunUpdateResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRailgunUpdateResponseMessage] +type zoneRailgunUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneRailgunUpdateResponseSuccess bool + +const ( + ZoneRailgunUpdateResponseSuccessTrue ZoneRailgunUpdateResponseSuccess = true +) + +type ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponse struct { + Errors []ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseError `json:"errors"` + Messages []ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseSuccess `json:"success"` + JSON zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseJSON `json:"-"` +} + +// zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseJSON contains +// the JSON metadata for the struct +// [ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponse] +type zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseErrorJSON `json:"-"` +} + +// zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseError] +type zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseMessageJSON `json:"-"` +} + +// zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseMessage] +type zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseResultInfoJSON `json:"-"` +} + +// zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseResultInfo] +type zoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseSuccess bool + +const ( + ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseSuccessTrue ZoneRailgunRailgunConnectionsForAZoneListAvailableRailgunsResponseSuccess = true +) + +type ZoneRailgunUpdateParams struct { + // A flag indicating whether the given zone is connected to the Railgun. + Connected param.Field[bool] `json:"connected,required"` +} + +func (r ZoneRailgunUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonerailgun_test.go b/zonerailgun_test.go new file mode 100644 index 00000000000..5489bcbc5ea --- /dev/null +++ b/zonerailgun_test.go @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneRailgunGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Railguns.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + ) + 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 TestZoneRailgunUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Railguns.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + cloudflare.ZoneRailgunUpdateParams{ + Connected: cloudflare.F(true), + }, + ) + 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 TestZoneRailgunRailgunConnectionsForAZoneListAvailableRailguns(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Railguns.RailgunConnectionsForAZoneListAvailableRailguns(context.TODO(), "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/zonerailgundiagnosis.go b/zonerailgundiagnosis.go new file mode 100644 index 00000000000..ff54c7a5a8d --- /dev/null +++ b/zonerailgundiagnosis.go @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRailgunDiagnosisService 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 [NewZoneRailgunDiagnosisService] +// method instead. +type ZoneRailgunDiagnosisService struct { + Options []option.RequestOption +} + +// NewZoneRailgunDiagnosisService 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 NewZoneRailgunDiagnosisService(opts ...option.RequestOption) (r *ZoneRailgunDiagnosisService) { + r = &ZoneRailgunDiagnosisService{} + r.Options = opts + return +} + +// Tests the Railgun connection to the zone. +func (r *ZoneRailgunDiagnosisService) RailgunConnectionsForAZoneTestRailgunConnection(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/railguns/%s/diagnose", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponse struct { + Errors []ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseError `json:"errors"` + Messages []ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseMessage `json:"messages"` + Result ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseSuccess `json:"success"` + JSON zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseJSON `json:"-"` +} + +// zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseJSON +// contains the JSON metadata for the struct +// [ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponse] +type zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseErrorJSON `json:"-"` +} + +// zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseError] +type zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseMessageJSON `json:"-"` +} + +// zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseMessage] +type zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResult struct { + // Hash version of body. + BodyHash string `json:"body_hash"` + // Size of the body in bytes. + BodySize string `json:"body_size"` + // Lists any `cf-cache-status` present. + CfCacheStatus string `json:"cf-cache-status"` + // Lists any `cf-ray` present. + CfRay string `json:"cf-ray"` + // Lists any `cf-wan-error` present. + CfWanError string `json:"cf-wan-error"` + // Whether Cloudflare is enabled on the host. + Cloudflare string `json:"cloudflare"` + // Connection closed or open. + ConnectionClose bool `json:"connection_close"` + // Amount of seconds that the test lasted. + ElapsedTime string `json:"elapsed_time"` + // The hostname queried. + HostName string `json:"host_name"` + // The HTTP status response code. + HTTPStatus float64 `json:"http_status"` + // HTTP Method used to test the connection. + Method ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultMethod `json:"method"` + // What headers are missing. + MissingHeaders string `json:"missing_headers"` + // Protocol used to test the connection. + Protocol string `json:"protocol"` + // Indicates if Railgun is enabled on the queried hostname. + Railgun string `json:"railgun"` + // HTTP Status code. + ResponseStatus string `json:"response_status"` + // Url of the domain you can compare the connection to. + URL string `json:"url"` + JSON zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultJSON `json:"-"` +} + +// zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResult] +type zoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultJSON struct { + BodyHash apijson.Field + BodySize apijson.Field + CfCacheStatus apijson.Field + CfRay apijson.Field + CfWanError apijson.Field + Cloudflare apijson.Field + ConnectionClose apijson.Field + ElapsedTime apijson.Field + HostName apijson.Field + HTTPStatus apijson.Field + Method apijson.Field + MissingHeaders apijson.Field + Protocol apijson.Field + Railgun apijson.Field + ResponseStatus apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// HTTP Method used to test the connection. +type ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultMethod string + +const ( + ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultMethodGet ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultMethod = "GET" + ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultMethodPost ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseResultMethod = "POST" +) + +// Whether the API call was successful +type ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseSuccess bool + +const ( + ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseSuccessTrue ZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnectionResponseSuccess = true +) diff --git a/zonerailgundiagnosis_test.go b/zonerailgundiagnosis_test.go new file mode 100644 index 00000000000..7d1d6a26bea --- /dev/null +++ b/zonerailgundiagnosis_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneRailgunDiagnosisRailgunConnectionsForAZoneTestRailgunConnection(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Railguns.Diagnoses.RailgunConnectionsForAZoneTestRailgunConnection( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "e928d310693a83094309acf9ead50448", + ) + 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/zoneratelimit.go b/zoneratelimit.go index d5892143189..b3fe53bf4f8 100644 --- a/zoneratelimit.go +++ b/zoneratelimit.go @@ -12,6 +12,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" "github.com/cloudflare/cloudflare-sdk-go/internal/param" "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" "github.com/cloudflare/cloudflare-sdk-go/option" ) @@ -33,102 +34,280 @@ func NewZoneRateLimitService(opts ...option.RequestOption) (r *ZoneRateLimitServ return } +// Creates a new rate limit for a zone. Refer to the object definition for a list +// of required attributes. +func (r *ZoneRateLimitService) New(ctx context.Context, zoneIdentifier string, body ZoneRateLimitNewParams, opts ...option.RequestOption) (res *ZoneRateLimitNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rate_limits", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + // Fetches the details of a rate limit. -func (r *ZoneRateLimitService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *RatelimitSingle, err error) { +func (r *ZoneRateLimitService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneRateLimitGetResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("zones/%s/rate_limits/%s", zoneIdentifier, id) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) return } -// Fetches the rate limits for a zone. -func (r *ZoneRateLimitService) List(ctx context.Context, zoneIdentifier string, query ZoneRateLimitListParams, opts ...option.RequestOption) (res *RatelimitCollection, err error) { +// Updates an existing rate limit. +func (r *ZoneRateLimitService) Update(ctx context.Context, zoneIdentifier string, id string, body ZoneRateLimitUpdateParams, opts ...option.RequestOption) (res *ZoneRateLimitUpdateResponse, err error) { opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rate_limits/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Fetches the rate limits for a zone. +func (r *ZoneRateLimitService) List(ctx context.Context, zoneIdentifier string, query ZoneRateLimitListParams, opts ...option.RequestOption) (res *shared.Page[ZoneRateLimitListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/rate_limits", zoneIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Deletes an existing rate limit. +func (r *ZoneRateLimitService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *ZoneRateLimitDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rate_limits/%s", zoneIdentifier, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } -type RatelimitCollection struct { - Errors []RatelimitCollectionError `json:"errors"` - Messages []RatelimitCollectionMessage `json:"messages"` - Result []RatelimitCollectionResult `json:"result"` - ResultInfo RatelimitCollectionResultInfo `json:"result_info"` +type ZoneRateLimitNewResponse struct { + Errors []ZoneRateLimitNewResponseError `json:"errors"` + Messages []ZoneRateLimitNewResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneRateLimitNewResponseSuccess `json:"success"` + JSON zoneRateLimitNewResponseJSON `json:"-"` +} + +// zoneRateLimitNewResponseJSON contains the JSON metadata for the struct +// [ZoneRateLimitNewResponse] +type zoneRateLimitNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRateLimitNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRateLimitNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitNewResponseErrorJSON `json:"-"` +} + +// zoneRateLimitNewResponseErrorJSON contains the JSON metadata for the struct +// [ZoneRateLimitNewResponseError] +type zoneRateLimitNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRateLimitNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRateLimitNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitNewResponseMessageJSON `json:"-"` +} + +// zoneRateLimitNewResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRateLimitNewResponseMessage] +type zoneRateLimitNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRateLimitNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneRateLimitNewResponseSuccess bool + +const ( + ZoneRateLimitNewResponseSuccessTrue ZoneRateLimitNewResponseSuccess = true +) + +type ZoneRateLimitGetResponse struct { + Errors []ZoneRateLimitGetResponseError `json:"errors"` + Messages []ZoneRateLimitGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` // Whether the API call was successful - Success RatelimitCollectionSuccess `json:"success"` - JSON ratelimitCollectionJSON `json:"-"` + Success ZoneRateLimitGetResponseSuccess `json:"success"` + JSON zoneRateLimitGetResponseJSON `json:"-"` } -// ratelimitCollectionJSON contains the JSON metadata for the struct -// [RatelimitCollection] -type ratelimitCollectionJSON struct { +// zoneRateLimitGetResponseJSON contains the JSON metadata for the struct +// [ZoneRateLimitGetResponse] +type zoneRateLimitGetResponseJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field - ResultInfo apijson.Field Success apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitCollection) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitCollectionError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON ratelimitCollectionErrorJSON `json:"-"` +type ZoneRateLimitGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitGetResponseErrorJSON `json:"-"` } -// ratelimitCollectionErrorJSON contains the JSON metadata for the struct -// [RatelimitCollectionError] -type ratelimitCollectionErrorJSON struct { +// zoneRateLimitGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneRateLimitGetResponseError] +type zoneRateLimitGetResponseErrorJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionError) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitGetResponseError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitCollectionMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON ratelimitCollectionMessageJSON `json:"-"` +type ZoneRateLimitGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitGetResponseMessageJSON `json:"-"` } -// ratelimitCollectionMessageJSON contains the JSON metadata for the struct -// [RatelimitCollectionMessage] -type ratelimitCollectionMessageJSON struct { +// zoneRateLimitGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRateLimitGetResponseMessage] +type zoneRateLimitGetResponseMessageJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionMessage) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitGetResponseMessage) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitCollectionResult struct { +// Whether the API call was successful +type ZoneRateLimitGetResponseSuccess bool + +const ( + ZoneRateLimitGetResponseSuccessTrue ZoneRateLimitGetResponseSuccess = true +) + +type ZoneRateLimitUpdateResponse struct { + Errors []ZoneRateLimitUpdateResponseError `json:"errors"` + Messages []ZoneRateLimitUpdateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneRateLimitUpdateResponseSuccess `json:"success"` + JSON zoneRateLimitUpdateResponseJSON `json:"-"` +} + +// zoneRateLimitUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneRateLimitUpdateResponse] +type zoneRateLimitUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRateLimitUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRateLimitUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitUpdateResponseErrorJSON `json:"-"` +} + +// zoneRateLimitUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneRateLimitUpdateResponseError] +type zoneRateLimitUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRateLimitUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRateLimitUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitUpdateResponseMessageJSON `json:"-"` +} + +// zoneRateLimitUpdateResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRateLimitUpdateResponseMessage] +type zoneRateLimitUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRateLimitUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneRateLimitUpdateResponseSuccess bool + +const ( + ZoneRateLimitUpdateResponseSuccessTrue ZoneRateLimitUpdateResponseSuccess = true +) + +type ZoneRateLimitListResponse struct { // The unique identifier of the rate limit. ID string `json:"id"` // The action to perform when the threshold of matched traffic within the // configured period is exceeded. - Action RatelimitCollectionResultAction `json:"action"` + Action ZoneRateLimitListResponseAction `json:"action"` // Criteria specifying when the current rate limit should be bypassed. You can // specify that the rate limit should not apply to one or more URLs. - Bypass []RatelimitCollectionResultBypass `json:"bypass"` + Bypass []ZoneRateLimitListResponseBypass `json:"bypass"` // An informative summary of the rate limit. This value is sanitized and any tags // will be removed. Description string `json:"description"` // When true, indicates that the rate limit is currently disabled. Disabled bool `json:"disabled"` // Determines which traffic the rate limit counts towards the threshold. - Match RatelimitCollectionResultMatch `json:"match"` + Match ZoneRateLimitListResponseMatch `json:"match"` // The time in seconds (an integer value) to count matching traffic. If the count // exceeds the configured threshold within this period, Cloudflare will perform the // configured action. @@ -136,12 +315,12 @@ type RatelimitCollectionResult struct { // The threshold that will trigger the configured mitigation action. Configure this // value along with the `period` property to establish a threshold per period. Threshold float64 `json:"threshold"` - JSON ratelimitCollectionResultJSON `json:"-"` + JSON zoneRateLimitListResponseJSON `json:"-"` } -// ratelimitCollectionResultJSON contains the JSON metadata for the struct -// [RatelimitCollectionResult] -type ratelimitCollectionResultJSON struct { +// zoneRateLimitListResponseJSON contains the JSON metadata for the struct +// [ZoneRateLimitListResponse] +type zoneRateLimitListResponseJSON struct { ID apijson.Field Action apijson.Field Bypass apijson.Field @@ -154,33 +333,33 @@ type ratelimitCollectionResultJSON struct { ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResult) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // The action to perform when the threshold of matched traffic within the // configured period is exceeded. -type RatelimitCollectionResultAction struct { +type ZoneRateLimitListResponseAction struct { // The action to perform. - Mode RatelimitCollectionResultActionMode `json:"mode"` + Mode ZoneRateLimitListResponseActionMode `json:"mode"` // A custom content type and reponse to return when the threshold is exceeded. The // custom response configured in this object will override the custom error for the // zone. This object is optional. Notes: If you omit this object, Cloudflare will // use the default HTML error page. If "mode" is "challenge", "managed_challenge", // or "js_challenge", Cloudflare will use the zone challenge pages and you should // not provide the "response" object. - Response RatelimitCollectionResultActionResponse `json:"response"` + Response ZoneRateLimitListResponseActionResponse `json:"response"` // The time in seconds during which Cloudflare will perform the mitigation action. // Must be an integer value greater than or equal to the period. Notes: If "mode" // is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the // zone's Challenge Passage time and you should not provide this value. Timeout float64 `json:"timeout"` - JSON ratelimitCollectionResultActionJSON `json:"-"` + JSON zoneRateLimitListResponseActionJSON `json:"-"` } -// ratelimitCollectionResultActionJSON contains the JSON metadata for the struct -// [RatelimitCollectionResultAction] -type ratelimitCollectionResultActionJSON struct { +// zoneRateLimitListResponseActionJSON contains the JSON metadata for the struct +// [ZoneRateLimitListResponseAction] +type zoneRateLimitListResponseActionJSON struct { Mode apijson.Field Response apijson.Field Timeout apijson.Field @@ -188,19 +367,19 @@ type ratelimitCollectionResultActionJSON struct { ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResultAction) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponseAction) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // The action to perform. -type RatelimitCollectionResultActionMode string +type ZoneRateLimitListResponseActionMode string const ( - RatelimitCollectionResultActionModeSimulate RatelimitCollectionResultActionMode = "simulate" - RatelimitCollectionResultActionModeBan RatelimitCollectionResultActionMode = "ban" - RatelimitCollectionResultActionModeChallenge RatelimitCollectionResultActionMode = "challenge" - RatelimitCollectionResultActionModeJsChallenge RatelimitCollectionResultActionMode = "js_challenge" - RatelimitCollectionResultActionModeManagedChallenge RatelimitCollectionResultActionMode = "managed_challenge" + ZoneRateLimitListResponseActionModeSimulate ZoneRateLimitListResponseActionMode = "simulate" + ZoneRateLimitListResponseActionModeBan ZoneRateLimitListResponseActionMode = "ban" + ZoneRateLimitListResponseActionModeChallenge ZoneRateLimitListResponseActionMode = "challenge" + ZoneRateLimitListResponseActionModeJsChallenge ZoneRateLimitListResponseActionMode = "js_challenge" + ZoneRateLimitListResponseActionModeManagedChallenge ZoneRateLimitListResponseActionMode = "managed_challenge" ) // A custom content type and reponse to return when the threshold is exceeded. The @@ -209,66 +388,66 @@ const ( // use the default HTML error page. If "mode" is "challenge", "managed_challenge", // or "js_challenge", Cloudflare will use the zone challenge pages and you should // not provide the "response" object. -type RatelimitCollectionResultActionResponse struct { +type ZoneRateLimitListResponseActionResponse struct { // The response body to return. The value must conform to the configured content // type. Body string `json:"body"` // The content type of the body. Must be one of the following: `text/plain`, // `text/xml`, or `application/json`. ContentType string `json:"content_type"` - JSON ratelimitCollectionResultActionResponseJSON `json:"-"` + JSON zoneRateLimitListResponseActionResponseJSON `json:"-"` } -// ratelimitCollectionResultActionResponseJSON contains the JSON metadata for the -// struct [RatelimitCollectionResultActionResponse] -type ratelimitCollectionResultActionResponseJSON struct { +// zoneRateLimitListResponseActionResponseJSON contains the JSON metadata for the +// struct [ZoneRateLimitListResponseActionResponse] +type zoneRateLimitListResponseActionResponseJSON struct { Body apijson.Field ContentType apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResultActionResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponseActionResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitCollectionResultBypass struct { - Name RatelimitCollectionResultBypassName `json:"name"` +type ZoneRateLimitListResponseBypass struct { + Name ZoneRateLimitListResponseBypassName `json:"name"` // The URL to bypass. Value string `json:"value"` - JSON ratelimitCollectionResultBypassJSON `json:"-"` + JSON zoneRateLimitListResponseBypassJSON `json:"-"` } -// ratelimitCollectionResultBypassJSON contains the JSON metadata for the struct -// [RatelimitCollectionResultBypass] -type ratelimitCollectionResultBypassJSON struct { +// zoneRateLimitListResponseBypassJSON contains the JSON metadata for the struct +// [ZoneRateLimitListResponseBypass] +type zoneRateLimitListResponseBypassJSON struct { Name apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResultBypass) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponseBypass) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitCollectionResultBypassName string +type ZoneRateLimitListResponseBypassName string const ( - RatelimitCollectionResultBypassNameURL RatelimitCollectionResultBypassName = "url" + ZoneRateLimitListResponseBypassNameURL ZoneRateLimitListResponseBypassName = "url" ) // Determines which traffic the rate limit counts towards the threshold. -type RatelimitCollectionResultMatch struct { - Headers []RatelimitCollectionResultMatchHeader `json:"headers"` - Request RatelimitCollectionResultMatchRequest `json:"request"` - Response RatelimitCollectionResultMatchResponse `json:"response"` - JSON ratelimitCollectionResultMatchJSON `json:"-"` +type ZoneRateLimitListResponseMatch struct { + Headers []ZoneRateLimitListResponseMatchHeader `json:"headers"` + Request ZoneRateLimitListResponseMatchRequest `json:"request"` + Response ZoneRateLimitListResponseMatchResponse `json:"response"` + JSON zoneRateLimitListResponseMatchJSON `json:"-"` } -// ratelimitCollectionResultMatchJSON contains the JSON metadata for the struct -// [RatelimitCollectionResultMatch] -type ratelimitCollectionResultMatchJSON struct { +// zoneRateLimitListResponseMatchJSON contains the JSON metadata for the struct +// [ZoneRateLimitListResponseMatch] +type zoneRateLimitListResponseMatchJSON struct { Headers apijson.Field Request apijson.Field Response apijson.Field @@ -276,23 +455,23 @@ type ratelimitCollectionResultMatchJSON struct { ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResultMatch) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponseMatch) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitCollectionResultMatchHeader struct { +type ZoneRateLimitListResponseMatchHeader struct { // The name of the response header to match. Name string `json:"name"` // The operator used when matching: `eq` means "equal" and `ne` means "not equal". - Op RatelimitCollectionResultMatchHeadersOp `json:"op"` + Op ZoneRateLimitListResponseMatchHeadersOp `json:"op"` // The value of the response header, which must match exactly. Value string `json:"value"` - JSON ratelimitCollectionResultMatchHeaderJSON `json:"-"` + JSON zoneRateLimitListResponseMatchHeaderJSON `json:"-"` } -// ratelimitCollectionResultMatchHeaderJSON contains the JSON metadata for the -// struct [RatelimitCollectionResultMatchHeader] -type ratelimitCollectionResultMatchHeaderJSON struct { +// zoneRateLimitListResponseMatchHeaderJSON contains the JSON metadata for the +// struct [ZoneRateLimitListResponseMatchHeader] +type zoneRateLimitListResponseMatchHeaderJSON struct { Name apijson.Field Op apijson.Field Value apijson.Field @@ -300,23 +479,23 @@ type ratelimitCollectionResultMatchHeaderJSON struct { ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResultMatchHeader) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponseMatchHeader) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // The operator used when matching: `eq` means "equal" and `ne` means "not equal". -type RatelimitCollectionResultMatchHeadersOp string +type ZoneRateLimitListResponseMatchHeadersOp string const ( - RatelimitCollectionResultMatchHeadersOpEq RatelimitCollectionResultMatchHeadersOp = "eq" - RatelimitCollectionResultMatchHeadersOpNe RatelimitCollectionResultMatchHeadersOp = "ne" + ZoneRateLimitListResponseMatchHeadersOpEq ZoneRateLimitListResponseMatchHeadersOp = "eq" + ZoneRateLimitListResponseMatchHeadersOpNe ZoneRateLimitListResponseMatchHeadersOp = "ne" ) -type RatelimitCollectionResultMatchRequest struct { +type ZoneRateLimitListResponseMatchRequest struct { // The HTTP methods to match. You can specify a subset (for example, // `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when // creating a rate limit. - Methods []RatelimitCollectionResultMatchRequestMethod `json:"methods"` + Methods []ZoneRateLimitListResponseMatchRequestMethod `json:"methods"` // The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both // schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is // optional. @@ -326,12 +505,12 @@ type RatelimitCollectionResultMatchRequest struct { // wildcards are expanded to match applicable traffic. Query strings are not // matched. Set the value to `*` to match all traffic to your zone. URL string `json:"url"` - JSON ratelimitCollectionResultMatchRequestJSON `json:"-"` + JSON zoneRateLimitListResponseMatchRequestJSON `json:"-"` } -// ratelimitCollectionResultMatchRequestJSON contains the JSON metadata for the -// struct [RatelimitCollectionResultMatchRequest] -type ratelimitCollectionResultMatchRequestJSON struct { +// zoneRateLimitListResponseMatchRequestJSON contains the JSON metadata for the +// struct [ZoneRateLimitListResponseMatchRequest] +type zoneRateLimitListResponseMatchRequestJSON struct { Methods apijson.Field Schemes apijson.Field URL apijson.Field @@ -339,90 +518,57 @@ type ratelimitCollectionResultMatchRequestJSON struct { ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResultMatchRequest) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponseMatchRequest) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // An HTTP method or `_ALL_` to indicate all methods. -type RatelimitCollectionResultMatchRequestMethod string +type ZoneRateLimitListResponseMatchRequestMethod string const ( - RatelimitCollectionResultMatchRequestMethodGet RatelimitCollectionResultMatchRequestMethod = "GET" - RatelimitCollectionResultMatchRequestMethodPost RatelimitCollectionResultMatchRequestMethod = "POST" - RatelimitCollectionResultMatchRequestMethodPut RatelimitCollectionResultMatchRequestMethod = "PUT" - RatelimitCollectionResultMatchRequestMethodDelete RatelimitCollectionResultMatchRequestMethod = "DELETE" - RatelimitCollectionResultMatchRequestMethodPatch RatelimitCollectionResultMatchRequestMethod = "PATCH" - RatelimitCollectionResultMatchRequestMethodHead RatelimitCollectionResultMatchRequestMethod = "HEAD" - RatelimitCollectionResultMatchRequestMethod_All RatelimitCollectionResultMatchRequestMethod = "_ALL_" + ZoneRateLimitListResponseMatchRequestMethodGet ZoneRateLimitListResponseMatchRequestMethod = "GET" + ZoneRateLimitListResponseMatchRequestMethodPost ZoneRateLimitListResponseMatchRequestMethod = "POST" + ZoneRateLimitListResponseMatchRequestMethodPut ZoneRateLimitListResponseMatchRequestMethod = "PUT" + ZoneRateLimitListResponseMatchRequestMethodDelete ZoneRateLimitListResponseMatchRequestMethod = "DELETE" + ZoneRateLimitListResponseMatchRequestMethodPatch ZoneRateLimitListResponseMatchRequestMethod = "PATCH" + ZoneRateLimitListResponseMatchRequestMethodHead ZoneRateLimitListResponseMatchRequestMethod = "HEAD" + ZoneRateLimitListResponseMatchRequestMethod_All ZoneRateLimitListResponseMatchRequestMethod = "_ALL_" ) -type RatelimitCollectionResultMatchResponse struct { +type ZoneRateLimitListResponseMatchResponse struct { // When true, only the uncached traffic served from your origin servers will count // towards rate limiting. In this case, any cached traffic served by Cloudflare // will not count towards rate limiting. This field is optional. Notes: This field // is deprecated. Instead, use response headers and set "origin_traffic" to "false" // to avoid legacy behaviour interacting with the "response_headers" property. OriginTraffic bool `json:"origin_traffic"` - JSON ratelimitCollectionResultMatchResponseJSON `json:"-"` + JSON zoneRateLimitListResponseMatchResponseJSON `json:"-"` } -// ratelimitCollectionResultMatchResponseJSON contains the JSON metadata for the -// struct [RatelimitCollectionResultMatchResponse] -type ratelimitCollectionResultMatchResponseJSON struct { +// zoneRateLimitListResponseMatchResponseJSON contains the JSON metadata for the +// struct [ZoneRateLimitListResponseMatchResponse] +type zoneRateLimitListResponseMatchResponseJSON struct { OriginTraffic apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitCollectionResultMatchResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type RatelimitCollectionResultInfo struct { - // Total number of results for the requested service - Count float64 `json:"count"` - // Current page within paginated list of results - Page float64 `json:"page"` - // Number of results per page of results - PerPage float64 `json:"per_page"` - // Total results available without any search parameters - TotalCount float64 `json:"total_count"` - JSON ratelimitCollectionResultInfoJSON `json:"-"` -} - -// ratelimitCollectionResultInfoJSON contains the JSON metadata for the struct -// [RatelimitCollectionResultInfo] -type ratelimitCollectionResultInfoJSON struct { - Count apijson.Field - Page apijson.Field - PerPage apijson.Field - TotalCount apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RatelimitCollectionResultInfo) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitListResponseMatchResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -// Whether the API call was successful -type RatelimitCollectionSuccess bool - -const ( - RatelimitCollectionSuccessTrue RatelimitCollectionSuccess = true -) - -type RatelimitSingle struct { - Errors []RatelimitSingleError `json:"errors"` - Messages []RatelimitSingleMessage `json:"messages"` - Result interface{} `json:"result"` +type ZoneRateLimitDeleteResponse struct { + Errors []ZoneRateLimitDeleteResponseError `json:"errors"` + Messages []ZoneRateLimitDeleteResponseMessage `json:"messages"` + Result ZoneRateLimitDeleteResponseResult `json:"result"` // Whether the API call was successful - Success RatelimitSingleSuccess `json:"success"` - JSON ratelimitSingleJSON `json:"-"` + Success ZoneRateLimitDeleteResponseSuccess `json:"success"` + JSON zoneRateLimitDeleteResponseJSON `json:"-"` } -// ratelimitSingleJSON contains the JSON metadata for the struct [RatelimitSingle] -type ratelimitSingleJSON struct { +// zoneRateLimitDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneRateLimitDeleteResponse] +type zoneRateLimitDeleteResponseJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -431,55 +577,89 @@ type ratelimitSingleJSON struct { ExtraFields map[string]apijson.Field } -func (r *RatelimitSingle) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitDeleteResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitSingleError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON ratelimitSingleErrorJSON `json:"-"` +type ZoneRateLimitDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitDeleteResponseErrorJSON `json:"-"` } -// ratelimitSingleErrorJSON contains the JSON metadata for the struct -// [RatelimitSingleError] -type ratelimitSingleErrorJSON struct { +// zoneRateLimitDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneRateLimitDeleteResponseError] +type zoneRateLimitDeleteResponseErrorJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitSingleError) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitDeleteResponseError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type RatelimitSingleMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON ratelimitSingleMessageJSON `json:"-"` +type ZoneRateLimitDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneRateLimitDeleteResponseMessageJSON `json:"-"` } -// ratelimitSingleMessageJSON contains the JSON metadata for the struct -// [RatelimitSingleMessage] -type ratelimitSingleMessageJSON struct { +// zoneRateLimitDeleteResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRateLimitDeleteResponseMessage] +type zoneRateLimitDeleteResponseMessageJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RatelimitSingleMessage) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneRateLimitDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRateLimitDeleteResponseResult struct { + // The unique identifier of the rate limit. + ID string `json:"id"` + JSON zoneRateLimitDeleteResponseResultJSON `json:"-"` +} + +// zoneRateLimitDeleteResponseResultJSON contains the JSON metadata for the struct +// [ZoneRateLimitDeleteResponseResult] +type zoneRateLimitDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRateLimitDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type RatelimitSingleSuccess bool +type ZoneRateLimitDeleteResponseSuccess bool const ( - RatelimitSingleSuccessTrue RatelimitSingleSuccess = true + ZoneRateLimitDeleteResponseSuccessTrue ZoneRateLimitDeleteResponseSuccess = true ) +type ZoneRateLimitNewParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneRateLimitNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneRateLimitUpdateParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r ZoneRateLimitUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + type ZoneRateLimitListParams struct { // The page number of paginated results. Page param.Field[float64] `query:"page"` diff --git a/zoneratelimit_test.go b/zoneratelimit_test.go index 01b60cecad7..b78424430f3 100644 --- a/zoneratelimit_test.go +++ b/zoneratelimit_test.go @@ -13,7 +13,40 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) +func TestZoneRateLimitNew(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.RateLimits.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneRateLimitNewParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneRateLimitGet(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 @@ -23,8 +56,10 @@ func TestZoneRateLimitGet(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.RateLimits.Get( context.TODO(), @@ -40,7 +75,41 @@ func TestZoneRateLimitGet(t *testing.T) { } } +func TestZoneRateLimitUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.RateLimits.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + cloudflare.ZoneRateLimitUpdateParams{ + Body: cloudflare.F[any](map[string]interface{}{}), + }, + ) + 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 TestZoneRateLimitListWithOptionalParams(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 @@ -50,8 +119,10 @@ func TestZoneRateLimitListWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.RateLimits.List( context.TODO(), @@ -69,3 +140,33 @@ func TestZoneRateLimitListWithOptionalParams(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestZoneRateLimitDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.RateLimits.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "372e67954025e0ba6aaa6d586b9e0b59", + ) + 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/zoneruleset.go b/zoneruleset.go new file mode 100644 index 00000000000..e6003f98281 --- /dev/null +++ b/zoneruleset.go @@ -0,0 +1,1382 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRulesetService 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 [NewZoneRulesetService] method +// instead. +type ZoneRulesetService struct { + Options []option.RequestOption + Phases *ZoneRulesetPhaseService + Rules *ZoneRulesetRuleService + Versions *ZoneRulesetVersionService +} + +// NewZoneRulesetService 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 NewZoneRulesetService(opts ...option.RequestOption) (r *ZoneRulesetService) { + r = &ZoneRulesetService{} + r.Options = opts + r.Phases = NewZoneRulesetPhaseService(opts...) + r.Rules = NewZoneRulesetRuleService(opts...) + r.Versions = NewZoneRulesetVersionService(opts...) + return +} + +// Fetches the latest version of a zone ruleset. +func (r *ZoneRulesetService) Get(ctx context.Context, zoneID string, rulesetID string, opts ...option.RequestOption) (res *ZoneRulesetGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s", zoneID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a zone ruleset, creating a new version. +func (r *ZoneRulesetService) Update(ctx context.Context, zoneID string, rulesetID string, body ZoneRulesetUpdateParams, opts ...option.RequestOption) (res *ZoneRulesetUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s", zoneID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes all versions of an existing zone ruleset. +func (r *ZoneRulesetService) Delete(ctx context.Context, zoneID string, rulesetID string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s", zoneID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Creates a ruleset at the zone level. +func (r *ZoneRulesetService) ZoneRulesetsNewAZoneRuleset(ctx context.Context, zoneID string, body ZoneRulesetZoneRulesetsNewAZoneRulesetParams, opts ...option.RequestOption) (res *ZoneRulesetZoneRulesetsNewAZoneRulesetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Fetches all rulesets at the zone level. +func (r *ZoneRulesetService) ZoneRulesetsListZoneRulesets(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneRulesetZoneRulesetsListZoneRulesetsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneRulesetGetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetGetResponseMessage `json:"messages"` + Result ZoneRulesetGetResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetGetResponseSuccess `json:"success"` + JSON zoneRulesetGetResponseJSON `json:"-"` +} + +// zoneRulesetGetResponseJSON contains the JSON metadata for the struct +// [ZoneRulesetGetResponse] +type zoneRulesetGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetGetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetGetResponseMessagesSource `json:"source"` + JSON zoneRulesetGetResponseMessageJSON `json:"-"` +} + +// zoneRulesetGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRulesetGetResponseMessage] +type zoneRulesetGetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetGetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetGetResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetGetResponseMessagesSourceJSON contains the JSON metadata for the +// struct [ZoneRulesetGetResponseMessagesSource] +type zoneRulesetGetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetGetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetGetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetGetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetGetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetGetResponseResultJSON `json:"-"` +} + +// zoneRulesetGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneRulesetGetResponseResult] +type zoneRulesetGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetGetResponseResultKind string + +const ( + ZoneRulesetGetResponseResultKindManaged ZoneRulesetGetResponseResultKind = "managed" + ZoneRulesetGetResponseResultKindCustom ZoneRulesetGetResponseResultKind = "custom" + ZoneRulesetGetResponseResultKindRoot ZoneRulesetGetResponseResultKind = "root" + ZoneRulesetGetResponseResultKindZone ZoneRulesetGetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetGetResponseResultPhase string + +const ( + ZoneRulesetGetResponseResultPhaseDdosL4 ZoneRulesetGetResponseResultPhase = "ddos_l4" + ZoneRulesetGetResponseResultPhaseDdosL7 ZoneRulesetGetResponseResultPhase = "ddos_l7" + ZoneRulesetGetResponseResultPhaseHTTPConfigSettings ZoneRulesetGetResponseResultPhase = "http_config_settings" + ZoneRulesetGetResponseResultPhaseHTTPCustomErrors ZoneRulesetGetResponseResultPhase = "http_custom_errors" + ZoneRulesetGetResponseResultPhaseHTTPLogCustomFields ZoneRulesetGetResponseResultPhase = "http_log_custom_fields" + ZoneRulesetGetResponseResultPhaseHTTPRatelimit ZoneRulesetGetResponseResultPhase = "http_ratelimit" + ZoneRulesetGetResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetGetResponseResultPhase = "http_request_cache_settings" + ZoneRulesetGetResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetGetResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetGetResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetGetResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetGetResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetGetResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetGetResponseResultPhaseHTTPRequestLateTransform ZoneRulesetGetResponseResultPhase = "http_request_late_transform" + ZoneRulesetGetResponseResultPhaseHTTPRequestOrigin ZoneRulesetGetResponseResultPhase = "http_request_origin" + ZoneRulesetGetResponseResultPhaseHTTPRequestRedirect ZoneRulesetGetResponseResultPhase = "http_request_redirect" + ZoneRulesetGetResponseResultPhaseHTTPRequestSanitize ZoneRulesetGetResponseResultPhase = "http_request_sanitize" + ZoneRulesetGetResponseResultPhaseHTTPRequestSbfm ZoneRulesetGetResponseResultPhase = "http_request_sbfm" + ZoneRulesetGetResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetGetResponseResultPhase = "http_request_select_configuration" + ZoneRulesetGetResponseResultPhaseHTTPRequestTransform ZoneRulesetGetResponseResultPhase = "http_request_transform" + ZoneRulesetGetResponseResultPhaseHTTPResponseCompression ZoneRulesetGetResponseResultPhase = "http_response_compression" + ZoneRulesetGetResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetGetResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetGetResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetGetResponseResultPhase = "http_response_headers_transform" + ZoneRulesetGetResponseResultPhaseMagicTransit ZoneRulesetGetResponseResultPhase = "magic_transit" + ZoneRulesetGetResponseResultPhaseMagicTransitIDsManaged ZoneRulesetGetResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetGetResponseResultPhaseMagicTransitManaged ZoneRulesetGetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetGetResponseSuccess bool + +const ( + ZoneRulesetGetResponseSuccessTrue ZoneRulesetGetResponseSuccess = true +) + +type ZoneRulesetUpdateResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetUpdateResponseMessage `json:"messages"` + Result ZoneRulesetUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetUpdateResponseSuccess `json:"success"` + JSON zoneRulesetUpdateResponseJSON `json:"-"` +} + +// zoneRulesetUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneRulesetUpdateResponse] +type zoneRulesetUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetUpdateResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetUpdateResponseMessagesSource `json:"source"` + JSON zoneRulesetUpdateResponseMessageJSON `json:"-"` +} + +// zoneRulesetUpdateResponseMessageJSON contains the JSON metadata for the struct +// [ZoneRulesetUpdateResponseMessage] +type zoneRulesetUpdateResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetUpdateResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetUpdateResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetUpdateResponseMessagesSourceJSON contains the JSON metadata for the +// struct [ZoneRulesetUpdateResponseMessagesSource] +type zoneRulesetUpdateResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetUpdateResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetUpdateResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetUpdateResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetUpdateResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetUpdateResponseResultJSON `json:"-"` +} + +// zoneRulesetUpdateResponseResultJSON contains the JSON metadata for the struct +// [ZoneRulesetUpdateResponseResult] +type zoneRulesetUpdateResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetUpdateResponseResultKind string + +const ( + ZoneRulesetUpdateResponseResultKindManaged ZoneRulesetUpdateResponseResultKind = "managed" + ZoneRulesetUpdateResponseResultKindCustom ZoneRulesetUpdateResponseResultKind = "custom" + ZoneRulesetUpdateResponseResultKindRoot ZoneRulesetUpdateResponseResultKind = "root" + ZoneRulesetUpdateResponseResultKindZone ZoneRulesetUpdateResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetUpdateResponseResultPhase string + +const ( + ZoneRulesetUpdateResponseResultPhaseDdosL4 ZoneRulesetUpdateResponseResultPhase = "ddos_l4" + ZoneRulesetUpdateResponseResultPhaseDdosL7 ZoneRulesetUpdateResponseResultPhase = "ddos_l7" + ZoneRulesetUpdateResponseResultPhaseHTTPConfigSettings ZoneRulesetUpdateResponseResultPhase = "http_config_settings" + ZoneRulesetUpdateResponseResultPhaseHTTPCustomErrors ZoneRulesetUpdateResponseResultPhase = "http_custom_errors" + ZoneRulesetUpdateResponseResultPhaseHTTPLogCustomFields ZoneRulesetUpdateResponseResultPhase = "http_log_custom_fields" + ZoneRulesetUpdateResponseResultPhaseHTTPRatelimit ZoneRulesetUpdateResponseResultPhase = "http_ratelimit" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetUpdateResponseResultPhase = "http_request_cache_settings" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetUpdateResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetUpdateResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetUpdateResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestLateTransform ZoneRulesetUpdateResponseResultPhase = "http_request_late_transform" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestOrigin ZoneRulesetUpdateResponseResultPhase = "http_request_origin" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestRedirect ZoneRulesetUpdateResponseResultPhase = "http_request_redirect" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestSanitize ZoneRulesetUpdateResponseResultPhase = "http_request_sanitize" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestSbfm ZoneRulesetUpdateResponseResultPhase = "http_request_sbfm" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetUpdateResponseResultPhase = "http_request_select_configuration" + ZoneRulesetUpdateResponseResultPhaseHTTPRequestTransform ZoneRulesetUpdateResponseResultPhase = "http_request_transform" + ZoneRulesetUpdateResponseResultPhaseHTTPResponseCompression ZoneRulesetUpdateResponseResultPhase = "http_response_compression" + ZoneRulesetUpdateResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetUpdateResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetUpdateResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetUpdateResponseResultPhase = "http_response_headers_transform" + ZoneRulesetUpdateResponseResultPhaseMagicTransit ZoneRulesetUpdateResponseResultPhase = "magic_transit" + ZoneRulesetUpdateResponseResultPhaseMagicTransitIDsManaged ZoneRulesetUpdateResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetUpdateResponseResultPhaseMagicTransitManaged ZoneRulesetUpdateResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetUpdateResponseSuccess bool + +const ( + ZoneRulesetUpdateResponseSuccessTrue ZoneRulesetUpdateResponseSuccess = true +) + +type ZoneRulesetZoneRulesetsNewAZoneRulesetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessage `json:"messages"` + Result ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetZoneRulesetsNewAZoneRulesetResponseSuccess `json:"success"` + JSON zoneRulesetZoneRulesetsNewAZoneRulesetResponseJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsNewAZoneRulesetResponseJSON contains the JSON metadata +// for the struct [ZoneRulesetZoneRulesetsNewAZoneRulesetResponse] +type zoneRulesetZoneRulesetsNewAZoneRulesetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsNewAZoneRulesetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessagesSource `json:"source"` + JSON zoneRulesetZoneRulesetsNewAZoneRulesetResponseMessageJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsNewAZoneRulesetResponseMessageJSON contains the JSON +// metadata for the struct [ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessage] +type zoneRulesetZoneRulesetsNewAZoneRulesetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetZoneRulesetsNewAZoneRulesetResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsNewAZoneRulesetResponseMessagesSourceJSON contains the +// JSON metadata for the struct +// [ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessagesSource] +type zoneRulesetZoneRulesetsNewAZoneRulesetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsNewAZoneRulesetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetZoneRulesetsNewAZoneRulesetResponseResultJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsNewAZoneRulesetResponseResultJSON contains the JSON +// metadata for the struct [ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResult] +type zoneRulesetZoneRulesetsNewAZoneRulesetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKind string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKindManaged ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKind = "managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKindCustom ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKind = "custom" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKindRoot ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKind = "root" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKindZone ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseDdosL4 ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "ddos_l4" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseDdosL7 ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "ddos_l7" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPConfigSettings ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_config_settings" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPCustomErrors ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_custom_errors" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPLogCustomFields ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_log_custom_fields" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRatelimit ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_ratelimit" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_cache_settings" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestLateTransform ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_late_transform" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestOrigin ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_origin" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestRedirect ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_redirect" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestSanitize ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_sanitize" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestSbfm ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_sbfm" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_select_configuration" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPRequestTransform ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_request_transform" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPResponseCompression ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_response_compression" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "http_response_headers_transform" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseMagicTransit ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "magic_transit" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseMagicTransitIDsManaged ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhaseMagicTransitManaged ZoneRulesetZoneRulesetsNewAZoneRulesetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetZoneRulesetsNewAZoneRulesetResponseSuccess bool + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetResponseSuccessTrue ZoneRulesetZoneRulesetsNewAZoneRulesetResponseSuccess = true +) + +type ZoneRulesetZoneRulesetsListZoneRulesetsResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessage `json:"messages"` + // A list of rulesets. The returned information will not include the rules in each + // ruleset. + Result []ZoneRulesetZoneRulesetsListZoneRulesetsResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetZoneRulesetsListZoneRulesetsResponseSuccess `json:"success"` + JSON zoneRulesetZoneRulesetsListZoneRulesetsResponseJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsListZoneRulesetsResponseJSON contains the JSON metadata +// for the struct [ZoneRulesetZoneRulesetsListZoneRulesetsResponse] +type zoneRulesetZoneRulesetsListZoneRulesetsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsListZoneRulesetsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessagesSource `json:"source"` + JSON zoneRulesetZoneRulesetsListZoneRulesetsResponseMessageJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsListZoneRulesetsResponseMessageJSON contains the JSON +// metadata for the struct [ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessage] +type zoneRulesetZoneRulesetsListZoneRulesetsResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetZoneRulesetsListZoneRulesetsResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsListZoneRulesetsResponseMessagesSourceJSON contains the +// JSON metadata for the struct +// [ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessagesSource] +type zoneRulesetZoneRulesetsListZoneRulesetsResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsListZoneRulesetsResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetZoneRulesetsListZoneRulesetsResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase `json:"phase"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetZoneRulesetsListZoneRulesetsResponseResultJSON `json:"-"` +} + +// zoneRulesetZoneRulesetsListZoneRulesetsResponseResultJSON contains the JSON +// metadata for the struct [ZoneRulesetZoneRulesetsListZoneRulesetsResponseResult] +type zoneRulesetZoneRulesetsListZoneRulesetsResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetZoneRulesetsListZoneRulesetsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKind string + +const ( + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKindManaged ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKind = "managed" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKindCustom ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKind = "custom" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKindRoot ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKind = "root" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKindZone ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase string + +const ( + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseDdosL4 ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "ddos_l4" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseDdosL7 ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "ddos_l7" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPConfigSettings ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_config_settings" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPCustomErrors ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_custom_errors" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPLogCustomFields ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_log_custom_fields" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRatelimit ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_ratelimit" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_cache_settings" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestLateTransform ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_late_transform" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestOrigin ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_origin" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestRedirect ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_redirect" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestSanitize ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_sanitize" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestSbfm ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_sbfm" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_select_configuration" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPRequestTransform ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_request_transform" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPResponseCompression ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_response_compression" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "http_response_headers_transform" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseMagicTransit ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "magic_transit" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseMagicTransitIDsManaged ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhaseMagicTransitManaged ZoneRulesetZoneRulesetsListZoneRulesetsResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetZoneRulesetsListZoneRulesetsResponseSuccess bool + +const ( + ZoneRulesetZoneRulesetsListZoneRulesetsResponseSuccessTrue ZoneRulesetZoneRulesetsListZoneRulesetsResponseSuccess = true +) + +type ZoneRulesetUpdateParams struct { + ID param.Field[interface{}] `json:"id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[ZoneRulesetUpdateParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[ZoneRulesetUpdateParamsPhase] `json:"phase"` + // The list of rules in the ruleset. + Rules param.Field[[]ZoneRulesetUpdateParamsRule] `json:"rules"` +} + +func (r ZoneRulesetUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The kind of the ruleset. +type ZoneRulesetUpdateParamsKind string + +const ( + ZoneRulesetUpdateParamsKindManaged ZoneRulesetUpdateParamsKind = "managed" + ZoneRulesetUpdateParamsKindCustom ZoneRulesetUpdateParamsKind = "custom" + ZoneRulesetUpdateParamsKindRoot ZoneRulesetUpdateParamsKind = "root" + ZoneRulesetUpdateParamsKindZone ZoneRulesetUpdateParamsKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetUpdateParamsPhase string + +const ( + ZoneRulesetUpdateParamsPhaseDdosL4 ZoneRulesetUpdateParamsPhase = "ddos_l4" + ZoneRulesetUpdateParamsPhaseDdosL7 ZoneRulesetUpdateParamsPhase = "ddos_l7" + ZoneRulesetUpdateParamsPhaseHTTPConfigSettings ZoneRulesetUpdateParamsPhase = "http_config_settings" + ZoneRulesetUpdateParamsPhaseHTTPCustomErrors ZoneRulesetUpdateParamsPhase = "http_custom_errors" + ZoneRulesetUpdateParamsPhaseHTTPLogCustomFields ZoneRulesetUpdateParamsPhase = "http_log_custom_fields" + ZoneRulesetUpdateParamsPhaseHTTPRatelimit ZoneRulesetUpdateParamsPhase = "http_ratelimit" + ZoneRulesetUpdateParamsPhaseHTTPRequestCacheSettings ZoneRulesetUpdateParamsPhase = "http_request_cache_settings" + ZoneRulesetUpdateParamsPhaseHTTPRequestDynamicRedirect ZoneRulesetUpdateParamsPhase = "http_request_dynamic_redirect" + ZoneRulesetUpdateParamsPhaseHTTPRequestFirewallCustom ZoneRulesetUpdateParamsPhase = "http_request_firewall_custom" + ZoneRulesetUpdateParamsPhaseHTTPRequestFirewallManaged ZoneRulesetUpdateParamsPhase = "http_request_firewall_managed" + ZoneRulesetUpdateParamsPhaseHTTPRequestLateTransform ZoneRulesetUpdateParamsPhase = "http_request_late_transform" + ZoneRulesetUpdateParamsPhaseHTTPRequestOrigin ZoneRulesetUpdateParamsPhase = "http_request_origin" + ZoneRulesetUpdateParamsPhaseHTTPRequestRedirect ZoneRulesetUpdateParamsPhase = "http_request_redirect" + ZoneRulesetUpdateParamsPhaseHTTPRequestSanitize ZoneRulesetUpdateParamsPhase = "http_request_sanitize" + ZoneRulesetUpdateParamsPhaseHTTPRequestSbfm ZoneRulesetUpdateParamsPhase = "http_request_sbfm" + ZoneRulesetUpdateParamsPhaseHTTPRequestSelectConfiguration ZoneRulesetUpdateParamsPhase = "http_request_select_configuration" + ZoneRulesetUpdateParamsPhaseHTTPRequestTransform ZoneRulesetUpdateParamsPhase = "http_request_transform" + ZoneRulesetUpdateParamsPhaseHTTPResponseCompression ZoneRulesetUpdateParamsPhase = "http_response_compression" + ZoneRulesetUpdateParamsPhaseHTTPResponseFirewallManaged ZoneRulesetUpdateParamsPhase = "http_response_firewall_managed" + ZoneRulesetUpdateParamsPhaseHTTPResponseHeadersTransform ZoneRulesetUpdateParamsPhase = "http_response_headers_transform" + ZoneRulesetUpdateParamsPhaseMagicTransit ZoneRulesetUpdateParamsPhase = "magic_transit" + ZoneRulesetUpdateParamsPhaseMagicTransitIDsManaged ZoneRulesetUpdateParamsPhase = "magic_transit_ids_managed" + ZoneRulesetUpdateParamsPhaseMagicTransitManaged ZoneRulesetUpdateParamsPhase = "magic_transit_managed" +) + +// Satisfied by [ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule], +// [ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRule], +// [ZoneRulesetUpdateParamsRulesOexZd8xKLogRule], +// [ZoneRulesetUpdateParamsRulesOexZd8xKSkipRule]. +type ZoneRulesetUpdateParamsRule interface { + implementsZoneRulesetUpdateParamsRule() +} + +type ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule) implementsZoneRulesetUpdateParamsRule() {} + +type ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleAction string + +const ( + ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleAction = "block" +) + +type ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse] `json:"response"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response to show when the block is applied. +type ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRule) implementsZoneRulesetUpdateParamsRule() {} + +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleAction string + +const ( + ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionExecute ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleAction = "execute" +) + +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParameters struct { + ID param.Field[interface{}] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration to use for matched data logging. +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A set of overrides to apply to the target ruleset. +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverrides struct { + Action param.Field[interface{}] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory] `json:"categories"` + Enabled param.Field[interface{}] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule] `json:"rules"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A category-level override +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory struct { + Category param.Field[interface{}] `json:"category,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A rule-level override +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule struct { + ID param.Field[interface{}] `json:"id,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetUpdateParamsRulesOexZd8xKLogRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKLogRuleAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKLogRule) implementsZoneRulesetUpdateParamsRule() {} + +type ZoneRulesetUpdateParamsRulesOexZd8xKLogRuleAction string + +const ( + ZoneRulesetUpdateParamsRulesOexZd8xKLogRuleActionLog ZoneRulesetUpdateParamsRulesOexZd8xKLogRuleAction = "log" +) + +// An object configuring the rule's logging behavior. +type ZoneRulesetUpdateParamsRulesOexZd8xKLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetUpdateParamsRulesOexZd8xKSkipRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKSkipRule) implementsZoneRulesetUpdateParamsRule() {} + +type ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleAction string + +const ( + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionSkip ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleAction = "skip" +) + +type ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]interface{}] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct] `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules param.Field[interface{}] `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset param.Field[ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRuleset] `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets param.Field[[]interface{}] `json:"rulesets"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The name of a legacy security product to skip the execution of. +type ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct string + +const ( + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductBic ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "bic" + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductHot ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "hot" + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductRateLimit ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "rateLimit" + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductSecurityLevel ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "securityLevel" + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductUaBlock ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "uaBlock" + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductWaf ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "waf" + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProductZoneLockdown ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersProduct = "zoneLockdown" +) + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRuleset string + +const ( + ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRulesetCurrent ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleActionParametersRuleset = "current" +) + +// An object configuring the rule's logging behavior. +type ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetUpdateParamsRulesOexZd8xKSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParams struct { + ID param.Field[interface{}] `json:"id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase] `json:"phase"` + // The list of rules in the ruleset. + Rules param.Field[[]ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule] `json:"rules"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The kind of the ruleset. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKind string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKindManaged ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKind = "managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKindCustom ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKind = "custom" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKindRoot ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKind = "root" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKindZone ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseDdosL4 ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "ddos_l4" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseDdosL7 ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "ddos_l7" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPConfigSettings ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_config_settings" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPCustomErrors ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_custom_errors" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPLogCustomFields ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_log_custom_fields" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRatelimit ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_ratelimit" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestCacheSettings ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_cache_settings" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestDynamicRedirect ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_dynamic_redirect" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestFirewallCustom ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_firewall_custom" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestFirewallManaged ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_firewall_managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestLateTransform ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_late_transform" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestOrigin ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_origin" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestRedirect ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_redirect" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestSanitize ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_sanitize" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestSbfm ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_sbfm" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestSelectConfiguration ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_select_configuration" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestTransform ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_request_transform" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPResponseCompression ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_response_compression" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPResponseFirewallManaged ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_response_firewall_managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPResponseHeadersTransform ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "http_response_headers_transform" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseMagicTransit ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "magic_transit" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseMagicTransitIDsManaged ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "magic_transit_ids_managed" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseMagicTransitManaged ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhase = "magic_transit_managed" +) + +// Satisfied by +// [ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule], +// [ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRule], +// [ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRule], +// [ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRule]. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule interface { + implementsZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule() +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule) implementsZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule() { +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleAction string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionBlock ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleAction = "block" +) + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse] `json:"response"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response to show when the block is applied. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRule) implementsZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule() { +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleAction string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionExecute ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleAction = "execute" +) + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParameters struct { + ID param.Field[interface{}] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration to use for matched data logging. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A set of overrides to apply to the target ruleset. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides struct { + Action param.Field[interface{}] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory] `json:"categories"` + Enabled param.Field[interface{}] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule] `json:"rules"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A category-level override +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory struct { + Category param.Field[interface{}] `json:"category,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A rule-level override +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule struct { + ID param.Field[interface{}] `json:"id,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRuleAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRule) implementsZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule() { +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRuleAction string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRuleActionLog ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRuleAction = "log" +) + +// An object configuring the rule's logging behavior. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRule) implementsZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule() { +} + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleAction string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionSkip ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleAction = "skip" +) + +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]interface{}] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct] `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules param.Field[interface{}] `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset param.Field[ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset] `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets param.Field[[]interface{}] `json:"rulesets"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The name of a legacy security product to skip the execution of. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductBic ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "bic" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductHot ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "hot" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductRateLimit ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "rateLimit" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductSecurityLevel ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "securityLevel" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductUaBlock ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "uaBlock" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductWaf ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "waf" + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProductZoneLockdown ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersProduct = "zoneLockdown" +) + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset string + +const ( + ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersRulesetCurrent ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleActionParametersRuleset = "current" +) + +// An object configuring the rule's logging behavior. +type ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneruleset_test.go b/zoneruleset_test.go new file mode 100644 index 00000000000..34192396b06 --- /dev/null +++ b/zoneruleset_test.go @@ -0,0 +1,277 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneRulesetGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Get( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + ) + 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 TestZoneRulesetUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Update( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + cloudflare.ZoneRulesetUpdateParams{ + ID: cloudflare.F[any](map[string]interface{}{}), + Description: cloudflare.F("My ruleset to execute managed rulesets"), + Kind: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsKindRoot), + Name: cloudflare.F("My ruleset"), + Phase: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsPhaseHTTPRequestFirewallCustom), + Rules: cloudflare.F([]cloudflare.ZoneRulesetUpdateParamsRule{cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetUpdateParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + })}), + }, + ) + 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 TestZoneRulesetDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Zones.Rulesets.Delete( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + ) + 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 TestZoneRulesetZoneRulesetsNewAZoneRulesetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.ZoneRulesetsNewAZoneRuleset( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParams{ + ID: cloudflare.F[any](map[string]interface{}{}), + Description: cloudflare.F("My ruleset to execute managed rulesets"), + Kind: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsKindRoot), + Name: cloudflare.F("My ruleset"), + Phase: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsPhaseHTTPRequestFirewallCustom), + Rules: cloudflare.F([]cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRule{cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetZoneRulesetsNewAZoneRulesetParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + })}), + }, + ) + 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 TestZoneRulesetZoneRulesetsListZoneRulesets(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.ZoneRulesetsListZoneRulesets(context.TODO(), "9f1839b6152d298aca64c4e906b6d074") + 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/zonerulesetphase.go b/zonerulesetphase.go new file mode 100644 index 00000000000..0dda7aee2d3 --- /dev/null +++ b/zonerulesetphase.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRulesetPhaseService 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 [NewZoneRulesetPhaseService] method +// instead. +type ZoneRulesetPhaseService struct { + Options []option.RequestOption + Entrypoints *ZoneRulesetPhaseEntrypointService +} + +// NewZoneRulesetPhaseService 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 NewZoneRulesetPhaseService(opts ...option.RequestOption) (r *ZoneRulesetPhaseService) { + r = &ZoneRulesetPhaseService{} + r.Options = opts + r.Entrypoints = NewZoneRulesetPhaseEntrypointService(opts...) + return +} diff --git a/zonerulesetphaseentrypoint.go b/zonerulesetphaseentrypoint.go new file mode 100644 index 00000000000..4d188b2d33e --- /dev/null +++ b/zonerulesetphaseentrypoint.go @@ -0,0 +1,770 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRulesetPhaseEntrypointService 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 +// [NewZoneRulesetPhaseEntrypointService] method instead. +type ZoneRulesetPhaseEntrypointService struct { + Options []option.RequestOption + Versions *ZoneRulesetPhaseEntrypointVersionService +} + +// NewZoneRulesetPhaseEntrypointService 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 NewZoneRulesetPhaseEntrypointService(opts ...option.RequestOption) (r *ZoneRulesetPhaseEntrypointService) { + r = &ZoneRulesetPhaseEntrypointService{} + r.Options = opts + r.Versions = NewZoneRulesetPhaseEntrypointVersionService(opts...) + return +} + +// Fetches the latest version of the zone entry point ruleset for a given phase. +func (r *ZoneRulesetPhaseEntrypointService) TransformRulesListTransformRules(ctx context.Context, zoneID string, rulesetPhase ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase, opts ...option.RequestOption) (res *ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/phases/%v/entrypoint", zoneID, rulesetPhase) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a zone entry point ruleset, creating a new version. +func (r *ZoneRulesetPhaseEntrypointService) TransformRulesUpdateTransformRules(ctx context.Context, zoneID string, rulesetPhase ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase, body ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParams, opts ...option.RequestOption) (res *ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/phases/%v/entrypoint", zoneID, rulesetPhase) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessage `json:"messages"` + Result ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseSuccess `json:"success"` + JSON zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseJSON contains +// the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponse] +type zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessagesSource `json:"source"` + JSON zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessageJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessage] +type zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessagesSource] +type zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResult] +type zoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKind string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKindManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKind = "managed" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKindCustom ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKind = "custom" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKindRoot ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKind = "root" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKindZone ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseDdosL4 ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseDdosL7 ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseMagicTransit ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "magic_transit" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseSuccess bool + +const ( + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseSuccessTrue ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesResponseSuccess = true +) + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessage `json:"messages"` + Result ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseSuccess `json:"success"` + JSON zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponse] +type zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessagesSource `json:"source"` + JSON zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessageJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessage] +type zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessagesSource] +type zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResult] +type zoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKind string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKindManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKind = "managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKindCustom ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKind = "custom" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKindRoot ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKind = "root" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKindZone ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseDdosL4 ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseDdosL7 ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseMagicTransit ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "magic_transit" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseSuccess bool + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseSuccessTrue ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesResponseSuccess = true +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseDdosL4 ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseDdosL7 ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseMagicTransit ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "magic_transit" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhase = "magic_transit_managed" +) + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParams struct { + ID param.Field[interface{}] `json:"id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase] `json:"phase"` + // The list of rules in the ruleset. + Rules param.Field[[]ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule] `json:"rules"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseDdosL4 ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseDdosL7 ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseMagicTransit ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "magic_transit" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhase = "magic_transit_managed" +) + +// The kind of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKind string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKindManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKind = "managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKindCustom ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKind = "custom" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKindRoot ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKind = "root" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKindZone ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseDdosL4 ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseDdosL7 ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseMagicTransit ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "magic_transit" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhase = "magic_transit_managed" +) + +// Satisfied by +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule], +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRule], +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRule], +// [ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRule]. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule interface { + implementsZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule() +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule) implementsZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule() { +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleAction string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionBlock ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleAction = "block" +) + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParametersResponse] `json:"response"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The response to show when the block is applied. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRule) implementsZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule() { +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleAction string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionExecute ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleAction = "execute" +) + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParameters struct { + ID param.Field[interface{}] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration to use for matched data logging. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A set of overrides to apply to the target ruleset. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverrides struct { + Action param.Field[interface{}] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory] `json:"categories"` + Enabled param.Field[interface{}] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule] `json:"rules"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A category-level override +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory struct { + Category param.Field[interface{}] `json:"category,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A rule-level override +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule struct { + ID param.Field[interface{}] `json:"id,required"` + Action param.Field[interface{}] `json:"action"` + Enabled param.Field[interface{}] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + SensitivityLevel param.Field[interface{}] `json:"sensitivity_level"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRuleAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRule) implementsZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule() { +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRuleAction string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRuleActionLog ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRuleAction = "log" +) + +// An object configuring the rule's logging behavior. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRule struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + Action param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleAction] `json:"action"` + ActionParameters param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParameters] `json:"action_parameters"` + Description param.Field[interface{}] `json:"description"` + Enabled param.Field[interface{}] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRule) implementsZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule() { +} + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleAction string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionSkip ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleAction = "skip" +) + +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]interface{}] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct] `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules param.Field[interface{}] `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset param.Field[ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersRuleset] `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets param.Field[[]interface{}] `json:"rulesets"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The name of a legacy security product to skip the execution of. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProductBic ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct = "bic" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProductHot ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct = "hot" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProductRateLimit ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct = "rateLimit" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProductSecurityLevel ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct = "securityLevel" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProductUaBlock ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct = "uaBlock" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProductWaf ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct = "waf" + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProductZoneLockdown ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersProduct = "zoneLockdown" +) + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersRuleset string + +const ( + ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersRulesetCurrent ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleActionParametersRuleset = "current" +) + +// An object configuring the rule's logging behavior. +type ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonerulesetphaseentrypoint_test.go b/zonerulesetphaseentrypoint_test.go new file mode 100644 index 00000000000..bf7caddd241 --- /dev/null +++ b/zonerulesetphaseentrypoint_test.go @@ -0,0 +1,133 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneRulesetPhaseEntrypointTransformRulesListTransformRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Phases.Entrypoints.TransformRulesListTransformRules( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + cloudflare.ZoneRulesetPhaseEntrypointTransformRulesListTransformRulesParamsRulesetPhaseHTTPRequestFirewallCustom, + ) + 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 TestZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Phases.Entrypoints.TransformRulesUpdateTransformRules( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesetPhaseHTTPRequestFirewallCustom, + cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParams{ + ID: cloudflare.F[any](map[string]interface{}{}), + Description: cloudflare.F("My ruleset to execute managed rulesets"), + Kind: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsKindRoot), + Name: cloudflare.F("My ruleset"), + Phase: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsPhaseHTTPRequestFirewallCustom), + Rules: cloudflare.F([]cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRule{cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + }), cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRule{ + Action: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionBlock), + ActionParameters: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParameters{ + Response: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F[any]("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F[any](map[string]interface{}{}), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Logging: cloudflare.F(cloudflare.ZoneRulesetPhaseEntrypointTransformRulesUpdateTransformRulesParamsRulesOexZd8xKBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), + })}), + }, + ) + 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/zonerulesetphaseentrypointversion.go b/zonerulesetphaseentrypointversion.go new file mode 100644 index 00000000000..646b956985e --- /dev/null +++ b/zonerulesetphaseentrypointversion.go @@ -0,0 +1,416 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRulesetPhaseEntrypointVersionService 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 +// [NewZoneRulesetPhaseEntrypointVersionService] method instead. +type ZoneRulesetPhaseEntrypointVersionService struct { + Options []option.RequestOption +} + +// NewZoneRulesetPhaseEntrypointVersionService 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 NewZoneRulesetPhaseEntrypointVersionService(opts ...option.RequestOption) (r *ZoneRulesetPhaseEntrypointVersionService) { + r = &ZoneRulesetPhaseEntrypointVersionService{} + r.Options = opts + return +} + +// Fetches a specific version of a zone entry point ruleset. +func (r *ZoneRulesetPhaseEntrypointVersionService) Get(ctx context.Context, zoneID string, rulesetPhase ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase, rulesetVersion string, opts ...option.RequestOption) (res *ZoneRulesetPhaseEntrypointVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/phases/%v/entrypoint/versions/%s", zoneID, rulesetPhase, rulesetVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Fetches the versions of a zone entry point ruleset. +func (r *ZoneRulesetPhaseEntrypointVersionService) ZoneRulesetsListAZoneEntryPointRulesetSVersions(ctx context.Context, zoneID string, rulesetPhase ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase, opts ...option.RequestOption) (res *ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/phases/%v/entrypoint/versions", zoneID, rulesetPhase) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneRulesetPhaseEntrypointVersionGetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetPhaseEntrypointVersionGetResponseMessage `json:"messages"` + Result ZoneRulesetPhaseEntrypointVersionGetResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetPhaseEntrypointVersionGetResponseSuccess `json:"success"` + JSON zoneRulesetPhaseEntrypointVersionGetResponseJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionGetResponseJSON contains the JSON metadata for +// the struct [ZoneRulesetPhaseEntrypointVersionGetResponse] +type zoneRulesetPhaseEntrypointVersionGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetPhaseEntrypointVersionGetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetPhaseEntrypointVersionGetResponseMessagesSource `json:"source"` + JSON zoneRulesetPhaseEntrypointVersionGetResponseMessageJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionGetResponseMessageJSON contains the JSON +// metadata for the struct [ZoneRulesetPhaseEntrypointVersionGetResponseMessage] +type zoneRulesetPhaseEntrypointVersionGetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetPhaseEntrypointVersionGetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetPhaseEntrypointVersionGetResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionGetResponseMessagesSourceJSON contains the JSON +// metadata for the struct +// [ZoneRulesetPhaseEntrypointVersionGetResponseMessagesSource] +type zoneRulesetPhaseEntrypointVersionGetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionGetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetPhaseEntrypointVersionGetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetPhaseEntrypointVersionGetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetPhaseEntrypointVersionGetResponseResultJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionGetResponseResultJSON contains the JSON +// metadata for the struct [ZoneRulesetPhaseEntrypointVersionGetResponseResult] +type zoneRulesetPhaseEntrypointVersionGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetPhaseEntrypointVersionGetResponseResultKind string + +const ( + ZoneRulesetPhaseEntrypointVersionGetResponseResultKindManaged ZoneRulesetPhaseEntrypointVersionGetResponseResultKind = "managed" + ZoneRulesetPhaseEntrypointVersionGetResponseResultKindCustom ZoneRulesetPhaseEntrypointVersionGetResponseResultKind = "custom" + ZoneRulesetPhaseEntrypointVersionGetResponseResultKindRoot ZoneRulesetPhaseEntrypointVersionGetResponseResultKind = "root" + ZoneRulesetPhaseEntrypointVersionGetResponseResultKindZone ZoneRulesetPhaseEntrypointVersionGetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase string + +const ( + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseDdosL4 ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseDdosL7 ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseMagicTransit ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "magic_transit" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointVersionGetResponseResultPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointVersionGetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetPhaseEntrypointVersionGetResponseSuccess bool + +const ( + ZoneRulesetPhaseEntrypointVersionGetResponseSuccessTrue ZoneRulesetPhaseEntrypointVersionGetResponseSuccess = true +) + +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessage `json:"messages"` + // A list of rulesets. The returned information will not include the rules in each + // ruleset. + Result []ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseSuccess `json:"success"` + JSON zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponse] +type zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessagesSource `json:"source"` + JSON zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessageJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessage] +type zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessagesSource] +type zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase `json:"phase"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultJSON `json:"-"` +} + +// zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResult] +type zoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKind string + +const ( + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKindManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKind = "managed" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKindCustom ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKind = "custom" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKindRoot ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKind = "root" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKindZone ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase string + +const ( + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseDdosL4 ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseDdosL7 ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseMagicTransit ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "magic_transit" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseSuccess bool + +const ( + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseSuccessTrue ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsResponseSuccess = true +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase string + +const ( + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseDdosL4 ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseDdosL7 ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseMagicTransit ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "magic_transit" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhase = "magic_transit_managed" +) + +// The phase of the ruleset. +type ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase string + +const ( + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseDdosL4 ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "ddos_l4" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseDdosL7 ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "ddos_l7" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPConfigSettings ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_config_settings" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPCustomErrors ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_custom_errors" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPLogCustomFields ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_log_custom_fields" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRatelimit ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_ratelimit" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestCacheSettings ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_cache_settings" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestDynamicRedirect ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_dynamic_redirect" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestFirewallCustom ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_firewall_custom" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestFirewallManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_firewall_managed" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestLateTransform ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_late_transform" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestOrigin ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_origin" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestRedirect ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_redirect" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestSanitize ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_sanitize" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestSbfm ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_sbfm" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestSelectConfiguration ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_select_configuration" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestTransform ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_request_transform" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPResponseCompression ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_response_compression" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPResponseFirewallManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_response_firewall_managed" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPResponseHeadersTransform ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "http_response_headers_transform" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseMagicTransit ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "magic_transit" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseMagicTransitIDsManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "magic_transit_ids_managed" + ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseMagicTransitManaged ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhase = "magic_transit_managed" +) diff --git a/zonerulesetphaseentrypointversion_test.go b/zonerulesetphaseentrypointversion_test.go new file mode 100644 index 00000000000..8da4ac14d1d --- /dev/null +++ b/zonerulesetphaseentrypointversion_test.go @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneRulesetPhaseEntrypointVersionGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Phases.Entrypoints.Versions.Get( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + cloudflare.ZoneRulesetPhaseEntrypointVersionGetParamsRulesetPhaseHTTPRequestFirewallCustom, + "1", + ) + 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 TestZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersions(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Phases.Entrypoints.Versions.ZoneRulesetsListAZoneEntryPointRulesetSVersions( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + cloudflare.ZoneRulesetPhaseEntrypointVersionZoneRulesetsListAZoneEntryPointRulesetSVersionsParamsRulesetPhaseHTTPRequestFirewallCustom, + ) + 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/zonerulesetrule.go b/zonerulesetrule.go new file mode 100644 index 00000000000..99add779830 --- /dev/null +++ b/zonerulesetrule.go @@ -0,0 +1,576 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRulesetRuleService 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 [NewZoneRulesetRuleService] method +// instead. +type ZoneRulesetRuleService struct { + Options []option.RequestOption +} + +// NewZoneRulesetRuleService 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 NewZoneRulesetRuleService(opts ...option.RequestOption) (r *ZoneRulesetRuleService) { + r = &ZoneRulesetRuleService{} + r.Options = opts + return +} + +// Updates an existing rule in a zone ruleset. +func (r *ZoneRulesetRuleService) Update(ctx context.Context, zoneID string, rulesetID string, ruleID string, body ZoneRulesetRuleUpdateParams, opts ...option.RequestOption) (res *ZoneRulesetRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s/rules/%s", zoneID, rulesetID, ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes an existing rule from a zone ruleset. +func (r *ZoneRulesetRuleService) Delete(ctx context.Context, zoneID string, rulesetID string, ruleID string, opts ...option.RequestOption) (res *ZoneRulesetRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s/rules/%s", zoneID, rulesetID, ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Adds a new rule to a zone ruleset. The rule will be added to the end of the +// existing list of rules in the ruleset by default. +func (r *ZoneRulesetRuleService) ZoneRulesetsNewAZoneRulesetRule(ctx context.Context, zoneID string, rulesetID string, body ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParams, opts ...option.RequestOption) (res *ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s/rules", zoneID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneRulesetRuleUpdateResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetRuleUpdateResponseMessage `json:"messages"` + Result ZoneRulesetRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetRuleUpdateResponseSuccess `json:"success"` + JSON zoneRulesetRuleUpdateResponseJSON `json:"-"` +} + +// zoneRulesetRuleUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneRulesetRuleUpdateResponse] +type zoneRulesetRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetRuleUpdateResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetRuleUpdateResponseMessagesSource `json:"source"` + JSON zoneRulesetRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneRulesetRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneRulesetRuleUpdateResponseMessage] +type zoneRulesetRuleUpdateResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetRuleUpdateResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetRuleUpdateResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetRuleUpdateResponseMessagesSourceJSON contains the JSON metadata for +// the struct [ZoneRulesetRuleUpdateResponseMessagesSource] +type zoneRulesetRuleUpdateResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleUpdateResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetRuleUpdateResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetRuleUpdateResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetRuleUpdateResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetRuleUpdateResponseResultJSON `json:"-"` +} + +// zoneRulesetRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneRulesetRuleUpdateResponseResult] +type zoneRulesetRuleUpdateResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetRuleUpdateResponseResultKind string + +const ( + ZoneRulesetRuleUpdateResponseResultKindManaged ZoneRulesetRuleUpdateResponseResultKind = "managed" + ZoneRulesetRuleUpdateResponseResultKindCustom ZoneRulesetRuleUpdateResponseResultKind = "custom" + ZoneRulesetRuleUpdateResponseResultKindRoot ZoneRulesetRuleUpdateResponseResultKind = "root" + ZoneRulesetRuleUpdateResponseResultKindZone ZoneRulesetRuleUpdateResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetRuleUpdateResponseResultPhase string + +const ( + ZoneRulesetRuleUpdateResponseResultPhaseDdosL4 ZoneRulesetRuleUpdateResponseResultPhase = "ddos_l4" + ZoneRulesetRuleUpdateResponseResultPhaseDdosL7 ZoneRulesetRuleUpdateResponseResultPhase = "ddos_l7" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPConfigSettings ZoneRulesetRuleUpdateResponseResultPhase = "http_config_settings" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPCustomErrors ZoneRulesetRuleUpdateResponseResultPhase = "http_custom_errors" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPLogCustomFields ZoneRulesetRuleUpdateResponseResultPhase = "http_log_custom_fields" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRatelimit ZoneRulesetRuleUpdateResponseResultPhase = "http_ratelimit" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetRuleUpdateResponseResultPhase = "http_request_cache_settings" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetRuleUpdateResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetRuleUpdateResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetRuleUpdateResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestLateTransform ZoneRulesetRuleUpdateResponseResultPhase = "http_request_late_transform" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestOrigin ZoneRulesetRuleUpdateResponseResultPhase = "http_request_origin" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestRedirect ZoneRulesetRuleUpdateResponseResultPhase = "http_request_redirect" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestSanitize ZoneRulesetRuleUpdateResponseResultPhase = "http_request_sanitize" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestSbfm ZoneRulesetRuleUpdateResponseResultPhase = "http_request_sbfm" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetRuleUpdateResponseResultPhase = "http_request_select_configuration" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPRequestTransform ZoneRulesetRuleUpdateResponseResultPhase = "http_request_transform" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPResponseCompression ZoneRulesetRuleUpdateResponseResultPhase = "http_response_compression" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetRuleUpdateResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetRuleUpdateResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetRuleUpdateResponseResultPhase = "http_response_headers_transform" + ZoneRulesetRuleUpdateResponseResultPhaseMagicTransit ZoneRulesetRuleUpdateResponseResultPhase = "magic_transit" + ZoneRulesetRuleUpdateResponseResultPhaseMagicTransitIDsManaged ZoneRulesetRuleUpdateResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetRuleUpdateResponseResultPhaseMagicTransitManaged ZoneRulesetRuleUpdateResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetRuleUpdateResponseSuccess bool + +const ( + ZoneRulesetRuleUpdateResponseSuccessTrue ZoneRulesetRuleUpdateResponseSuccess = true +) + +type ZoneRulesetRuleDeleteResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetRuleDeleteResponseMessage `json:"messages"` + Result ZoneRulesetRuleDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetRuleDeleteResponseSuccess `json:"success"` + JSON zoneRulesetRuleDeleteResponseJSON `json:"-"` +} + +// zoneRulesetRuleDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneRulesetRuleDeleteResponse] +type zoneRulesetRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetRuleDeleteResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetRuleDeleteResponseMessagesSource `json:"source"` + JSON zoneRulesetRuleDeleteResponseMessageJSON `json:"-"` +} + +// zoneRulesetRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneRulesetRuleDeleteResponseMessage] +type zoneRulesetRuleDeleteResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetRuleDeleteResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetRuleDeleteResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetRuleDeleteResponseMessagesSourceJSON contains the JSON metadata for +// the struct [ZoneRulesetRuleDeleteResponseMessagesSource] +type zoneRulesetRuleDeleteResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleDeleteResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetRuleDeleteResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetRuleDeleteResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetRuleDeleteResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetRuleDeleteResponseResultJSON `json:"-"` +} + +// zoneRulesetRuleDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneRulesetRuleDeleteResponseResult] +type zoneRulesetRuleDeleteResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetRuleDeleteResponseResultKind string + +const ( + ZoneRulesetRuleDeleteResponseResultKindManaged ZoneRulesetRuleDeleteResponseResultKind = "managed" + ZoneRulesetRuleDeleteResponseResultKindCustom ZoneRulesetRuleDeleteResponseResultKind = "custom" + ZoneRulesetRuleDeleteResponseResultKindRoot ZoneRulesetRuleDeleteResponseResultKind = "root" + ZoneRulesetRuleDeleteResponseResultKindZone ZoneRulesetRuleDeleteResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetRuleDeleteResponseResultPhase string + +const ( + ZoneRulesetRuleDeleteResponseResultPhaseDdosL4 ZoneRulesetRuleDeleteResponseResultPhase = "ddos_l4" + ZoneRulesetRuleDeleteResponseResultPhaseDdosL7 ZoneRulesetRuleDeleteResponseResultPhase = "ddos_l7" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPConfigSettings ZoneRulesetRuleDeleteResponseResultPhase = "http_config_settings" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPCustomErrors ZoneRulesetRuleDeleteResponseResultPhase = "http_custom_errors" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPLogCustomFields ZoneRulesetRuleDeleteResponseResultPhase = "http_log_custom_fields" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRatelimit ZoneRulesetRuleDeleteResponseResultPhase = "http_ratelimit" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetRuleDeleteResponseResultPhase = "http_request_cache_settings" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetRuleDeleteResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetRuleDeleteResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetRuleDeleteResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestLateTransform ZoneRulesetRuleDeleteResponseResultPhase = "http_request_late_transform" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestOrigin ZoneRulesetRuleDeleteResponseResultPhase = "http_request_origin" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestRedirect ZoneRulesetRuleDeleteResponseResultPhase = "http_request_redirect" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestSanitize ZoneRulesetRuleDeleteResponseResultPhase = "http_request_sanitize" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestSbfm ZoneRulesetRuleDeleteResponseResultPhase = "http_request_sbfm" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetRuleDeleteResponseResultPhase = "http_request_select_configuration" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPRequestTransform ZoneRulesetRuleDeleteResponseResultPhase = "http_request_transform" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPResponseCompression ZoneRulesetRuleDeleteResponseResultPhase = "http_response_compression" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetRuleDeleteResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetRuleDeleteResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetRuleDeleteResponseResultPhase = "http_response_headers_transform" + ZoneRulesetRuleDeleteResponseResultPhaseMagicTransit ZoneRulesetRuleDeleteResponseResultPhase = "magic_transit" + ZoneRulesetRuleDeleteResponseResultPhaseMagicTransitIDsManaged ZoneRulesetRuleDeleteResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetRuleDeleteResponseResultPhaseMagicTransitManaged ZoneRulesetRuleDeleteResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetRuleDeleteResponseSuccess bool + +const ( + ZoneRulesetRuleDeleteResponseSuccessTrue ZoneRulesetRuleDeleteResponseSuccess = true +) + +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessage `json:"messages"` + Result ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseSuccess `json:"success"` + JSON zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseJSON `json:"-"` +} + +// zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseJSON contains the JSON +// metadata for the struct [ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponse] +type zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessagesSource `json:"source"` + JSON zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessageJSON `json:"-"` +} + +// zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessage] +type zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessagesSource] +type zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultJSON `json:"-"` +} + +// zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResult] +type zoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKind string + +const ( + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKindManaged ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKind = "managed" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKindCustom ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKind = "custom" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKindRoot ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKind = "root" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKindZone ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase string + +const ( + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseDdosL4 ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "ddos_l4" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseDdosL7 ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "ddos_l7" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPConfigSettings ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_config_settings" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPCustomErrors ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_custom_errors" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPLogCustomFields ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_log_custom_fields" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRatelimit ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_ratelimit" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_cache_settings" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestLateTransform ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_late_transform" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestOrigin ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_origin" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestRedirect ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_redirect" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestSanitize ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_sanitize" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestSbfm ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_sbfm" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_select_configuration" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPRequestTransform ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_request_transform" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPResponseCompression ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_response_compression" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "http_response_headers_transform" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseMagicTransit ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "magic_transit" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseMagicTransitIDsManaged ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhaseMagicTransitManaged ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseSuccess bool + +const ( + ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseSuccessTrue ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleResponseSuccess = true +) + +type ZoneRulesetRuleUpdateParams struct { + Position param.Field[ZoneRulesetRuleUpdateParamsPosition] `json:"position"` +} + +func (r ZoneRulesetRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Satisfied by [ZoneRulesetRuleUpdateParamsPositionObject], +// [ZoneRulesetRuleUpdateParamsPositionObject], +// [ZoneRulesetRuleUpdateParamsPositionObject]. +type ZoneRulesetRuleUpdateParamsPosition interface { + implementsZoneRulesetRuleUpdateParamsPosition() +} + +type ZoneRulesetRuleUpdateParamsPositionObject struct { + // The ID of another rule to place the rule before. An empty value causes the rule + // to be placed at the top. + Before param.Field[string] `json:"before"` +} + +func (r ZoneRulesetRuleUpdateParamsPositionObject) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetRuleUpdateParamsPositionObject) implementsZoneRulesetRuleUpdateParamsPosition() {} + +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParams struct { + Position param.Field[ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPosition] `json:"position"` +} + +func (r ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Satisfied by +// [ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject], +// [ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject], +// [ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject]. +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPosition interface { + implementsZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPosition() +} + +type ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject struct { + // The ID of another rule to place the rule before. An empty value causes the rule + // to be placed at the top. + Before param.Field[string] `json:"before"` +} + +func (r ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject) implementsZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPosition() { +} diff --git a/zonerulesetrule_test.go b/zonerulesetrule_test.go new file mode 100644 index 00000000000..0e0e163b08d --- /dev/null +++ b/zonerulesetrule_test.go @@ -0,0 +1,116 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneRulesetRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Rules.Update( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + "3a03d665bac047339bb530ecb439a90d", + cloudflare.ZoneRulesetRuleUpdateParams{ + Position: cloudflare.F[cloudflare.ZoneRulesetRuleUpdateParamsPosition](cloudflare.ZoneRulesetRuleUpdateParamsPositionObject(cloudflare.ZoneRulesetRuleUpdateParamsPositionObject{ + Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), + })), + }, + ) + 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 TestZoneRulesetRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Rules.Delete( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + "3a03d665bac047339bb530ecb439a90d", + ) + 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 TestZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Rules.ZoneRulesetsNewAZoneRulesetRule( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + cloudflare.ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParams{ + Position: cloudflare.F[cloudflare.ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPosition](cloudflare.ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject(cloudflare.ZoneRulesetRuleZoneRulesetsNewAZoneRulesetRuleParamsPositionObject{ + Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), + })), + }, + ) + 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/zonerulesetversion.go b/zonerulesetversion.go new file mode 100644 index 00000000000..0388b6f65cc --- /dev/null +++ b/zonerulesetversion.go @@ -0,0 +1,366 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneRulesetVersionService 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 [NewZoneRulesetVersionService] method +// instead. +type ZoneRulesetVersionService struct { + Options []option.RequestOption +} + +// NewZoneRulesetVersionService 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 NewZoneRulesetVersionService(opts ...option.RequestOption) (r *ZoneRulesetVersionService) { + r = &ZoneRulesetVersionService{} + r.Options = opts + return +} + +// Fetches a specific version of a zone ruleset. +func (r *ZoneRulesetVersionService) Get(ctx context.Context, zoneID string, rulesetID string, rulesetVersion string, opts ...option.RequestOption) (res *ZoneRulesetVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s/versions/%s", zoneID, rulesetID, rulesetVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Deletes an existing version of a zone ruleset. +func (r *ZoneRulesetVersionService) Delete(ctx context.Context, zoneID string, rulesetID string, rulesetVersion string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s/versions/%s", zoneID, rulesetID, rulesetVersion) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Fetches the versions of a zone ruleset. +func (r *ZoneRulesetVersionService) ZoneRulesetsListAZoneRulesetSVersions(ctx context.Context, zoneID string, rulesetID string, opts ...option.RequestOption) (res *ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/rulesets/%s/versions", zoneID, rulesetID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneRulesetVersionGetResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetVersionGetResponseMessage `json:"messages"` + Result ZoneRulesetVersionGetResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetVersionGetResponseSuccess `json:"success"` + JSON zoneRulesetVersionGetResponseJSON `json:"-"` +} + +// zoneRulesetVersionGetResponseJSON contains the JSON metadata for the struct +// [ZoneRulesetVersionGetResponse] +type zoneRulesetVersionGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetVersionGetResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetVersionGetResponseMessagesSource `json:"source"` + JSON zoneRulesetVersionGetResponseMessageJSON `json:"-"` +} + +// zoneRulesetVersionGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneRulesetVersionGetResponseMessage] +type zoneRulesetVersionGetResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetVersionGetResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetVersionGetResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetVersionGetResponseMessagesSourceJSON contains the JSON metadata for +// the struct [ZoneRulesetVersionGetResponseMessagesSource] +type zoneRulesetVersionGetResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionGetResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetVersionGetResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetVersionGetResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetVersionGetResponseResultPhase `json:"phase"` + // The list of rules in the ruleset. + Rules []interface{} `json:"rules"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetVersionGetResponseResultJSON `json:"-"` +} + +// zoneRulesetVersionGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneRulesetVersionGetResponseResult] +type zoneRulesetVersionGetResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetVersionGetResponseResultKind string + +const ( + ZoneRulesetVersionGetResponseResultKindManaged ZoneRulesetVersionGetResponseResultKind = "managed" + ZoneRulesetVersionGetResponseResultKindCustom ZoneRulesetVersionGetResponseResultKind = "custom" + ZoneRulesetVersionGetResponseResultKindRoot ZoneRulesetVersionGetResponseResultKind = "root" + ZoneRulesetVersionGetResponseResultKindZone ZoneRulesetVersionGetResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetVersionGetResponseResultPhase string + +const ( + ZoneRulesetVersionGetResponseResultPhaseDdosL4 ZoneRulesetVersionGetResponseResultPhase = "ddos_l4" + ZoneRulesetVersionGetResponseResultPhaseDdosL7 ZoneRulesetVersionGetResponseResultPhase = "ddos_l7" + ZoneRulesetVersionGetResponseResultPhaseHTTPConfigSettings ZoneRulesetVersionGetResponseResultPhase = "http_config_settings" + ZoneRulesetVersionGetResponseResultPhaseHTTPCustomErrors ZoneRulesetVersionGetResponseResultPhase = "http_custom_errors" + ZoneRulesetVersionGetResponseResultPhaseHTTPLogCustomFields ZoneRulesetVersionGetResponseResultPhase = "http_log_custom_fields" + ZoneRulesetVersionGetResponseResultPhaseHTTPRatelimit ZoneRulesetVersionGetResponseResultPhase = "http_ratelimit" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetVersionGetResponseResultPhase = "http_request_cache_settings" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetVersionGetResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetVersionGetResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetVersionGetResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestLateTransform ZoneRulesetVersionGetResponseResultPhase = "http_request_late_transform" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestOrigin ZoneRulesetVersionGetResponseResultPhase = "http_request_origin" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestRedirect ZoneRulesetVersionGetResponseResultPhase = "http_request_redirect" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestSanitize ZoneRulesetVersionGetResponseResultPhase = "http_request_sanitize" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestSbfm ZoneRulesetVersionGetResponseResultPhase = "http_request_sbfm" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetVersionGetResponseResultPhase = "http_request_select_configuration" + ZoneRulesetVersionGetResponseResultPhaseHTTPRequestTransform ZoneRulesetVersionGetResponseResultPhase = "http_request_transform" + ZoneRulesetVersionGetResponseResultPhaseHTTPResponseCompression ZoneRulesetVersionGetResponseResultPhase = "http_response_compression" + ZoneRulesetVersionGetResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetVersionGetResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetVersionGetResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetVersionGetResponseResultPhase = "http_response_headers_transform" + ZoneRulesetVersionGetResponseResultPhaseMagicTransit ZoneRulesetVersionGetResponseResultPhase = "magic_transit" + ZoneRulesetVersionGetResponseResultPhaseMagicTransitIDsManaged ZoneRulesetVersionGetResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetVersionGetResponseResultPhaseMagicTransitManaged ZoneRulesetVersionGetResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetVersionGetResponseSuccess bool + +const ( + ZoneRulesetVersionGetResponseSuccessTrue ZoneRulesetVersionGetResponseSuccess = true +) + +type ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponse struct { + Errors interface{} `json:"errors"` + // A list of warning messages. + Messages []ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessage `json:"messages"` + // A list of rulesets. The returned information will not include the rules in each + // ruleset. + Result []ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResult `json:"result"` + // Whether the API call was successful. + Success ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseSuccess `json:"success"` + JSON zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseJSON `json:"-"` +} + +// zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseJSON contains the +// JSON metadata for the struct +// [ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponse] +type zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A message. +type ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessage struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessagesSource `json:"source"` + JSON zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessageJSON `json:"-"` +} + +// zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessage] +type zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessageJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The source of this message. +type ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessagesSourceJSON `json:"-"` +} + +// zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessagesSourceJSON +// contains the JSON metadata for the struct +// [ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessagesSource] +type zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResult struct { + ID interface{} `json:"id"` + // An informative description of the ruleset. + Description string `json:"description"` + // The kind of the ruleset. + Kind ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKind `json:"kind"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name"` + // The phase of the ruleset. + Phase ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase `json:"phase"` + // The version of the ruleset. + Version string `json:"version"` + JSON zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultJSON `json:"-"` +} + +// zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResult] +type zoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultJSON struct { + ID apijson.Field + Description apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The kind of the ruleset. +type ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKind string + +const ( + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKindManaged ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKind = "managed" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKindCustom ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKind = "custom" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKindRoot ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKind = "root" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKindZone ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultKind = "zone" +) + +// The phase of the ruleset. +type ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase string + +const ( + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseDdosL4 ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "ddos_l4" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseDdosL7 ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "ddos_l7" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPConfigSettings ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_config_settings" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPCustomErrors ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_custom_errors" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPLogCustomFields ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_log_custom_fields" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRatelimit ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_ratelimit" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestCacheSettings ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_cache_settings" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestDynamicRedirect ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_dynamic_redirect" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestFirewallCustom ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_firewall_custom" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestFirewallManaged ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_firewall_managed" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestLateTransform ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_late_transform" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestOrigin ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_origin" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestRedirect ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_redirect" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestSanitize ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_sanitize" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestSbfm ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_sbfm" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestSelectConfiguration ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_select_configuration" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPRequestTransform ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_request_transform" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPResponseCompression ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_response_compression" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPResponseFirewallManaged ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_response_firewall_managed" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseHTTPResponseHeadersTransform ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "http_response_headers_transform" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseMagicTransit ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "magic_transit" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseMagicTransitIDsManaged ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "magic_transit_ids_managed" + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhaseMagicTransitManaged ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseResultPhase = "magic_transit_managed" +) + +// Whether the API call was successful. +type ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseSuccess bool + +const ( + ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseSuccessTrue ZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersionsResponseSuccess = true +) diff --git a/zonerulesetversion_test.go b/zonerulesetversion_test.go new file mode 100644 index 00000000000..525f7a18820 --- /dev/null +++ b/zonerulesetversion_test.go @@ -0,0 +1,106 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneRulesetVersionGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Versions.Get( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + "1", + ) + 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 TestZoneRulesetVersionDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Zones.Rulesets.Versions.Delete( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + "1", + ) + 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 TestZoneRulesetVersionZoneRulesetsListAZoneRulesetSVersions(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Rulesets.Versions.ZoneRulesetsListAZoneRulesetSVersions( + context.TODO(), + "9f1839b6152d298aca64c4e906b6d074", + "2f2feab2026849078ba485f918791bdc", + ) + 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/zonesecondarydns.go b/zonesecondarydns.go new file mode 100644 index 00000000000..2d6aeecb90a --- /dev/null +++ b/zonesecondarydns.go @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSService 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 [NewZoneSecondaryDNSService] method +// instead. +type ZoneSecondaryDNSService struct { + Options []option.RequestOption + ForceAxfrs *ZoneSecondaryDNSForceAxfrService + Incomings *ZoneSecondaryDNSIncomingService + Outgoings *ZoneSecondaryDNSOutgoingService +} + +// NewZoneSecondaryDNSService 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 NewZoneSecondaryDNSService(opts ...option.RequestOption) (r *ZoneSecondaryDNSService) { + r = &ZoneSecondaryDNSService{} + r.Options = opts + r.ForceAxfrs = NewZoneSecondaryDNSForceAxfrService(opts...) + r.Incomings = NewZoneSecondaryDNSIncomingService(opts...) + r.Outgoings = NewZoneSecondaryDNSOutgoingService(opts...) + return +} diff --git a/zonesecondarydnsforceaxfr.go b/zonesecondarydnsforceaxfr.go new file mode 100644 index 00000000000..f1ec8392a4c --- /dev/null +++ b/zonesecondarydnsforceaxfr.go @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSForceAxfrService 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 +// [NewZoneSecondaryDNSForceAxfrService] method instead. +type ZoneSecondaryDNSForceAxfrService struct { + Options []option.RequestOption +} + +// NewZoneSecondaryDNSForceAxfrService 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 NewZoneSecondaryDNSForceAxfrService(opts ...option.RequestOption) (r *ZoneSecondaryDNSForceAxfrService) { + r = &ZoneSecondaryDNSForceAxfrService{} + r.Options = opts + return +} + +// Sends AXFR zone transfer request to primary nameserver(s). +func (r *ZoneSecondaryDNSForceAxfrService) SecondaryDNSSecondaryZoneForceAxfr(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/force_axfr", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponse struct { + Errors []ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseError `json:"errors"` + Messages []ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseMessage `json:"messages"` + // When force_axfr query parameter is set to true, the response is a simple string + Result string `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseSuccess `json:"success"` + JSON zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseJSON `json:"-"` +} + +// zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseJSON contains +// the JSON metadata for the struct +// [ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponse] +type zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseError] +type zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseMessage] +type zoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseSuccess bool + +const ( + ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseSuccessTrue ZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfrResponseSuccess = true +) diff --git a/zonesecondarydnsforceaxfr_test.go b/zonesecondarydnsforceaxfr_test.go new file mode 100644 index 00000000000..a5e4e943c2e --- /dev/null +++ b/zonesecondarydnsforceaxfr_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSecondaryDNSForceAxfrSecondaryDNSSecondaryZoneForceAxfr(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.ForceAxfrs.SecondaryDNSSecondaryZoneForceAxfr(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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/zonesecondarydnsincoming.go b/zonesecondarydnsincoming.go new file mode 100644 index 00000000000..716d2375919 --- /dev/null +++ b/zonesecondarydnsincoming.go @@ -0,0 +1,514 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSIncomingService 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 +// [NewZoneSecondaryDNSIncomingService] method instead. +type ZoneSecondaryDNSIncomingService struct { + Options []option.RequestOption +} + +// NewZoneSecondaryDNSIncomingService 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 NewZoneSecondaryDNSIncomingService(opts ...option.RequestOption) (r *ZoneSecondaryDNSIncomingService) { + r = &ZoneSecondaryDNSIncomingService{} + r.Options = opts + return +} + +// Delete secondary zone configuration for incoming zone transfers. +func (r *ZoneSecondaryDNSIncomingService) Delete(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSIncomingDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/incoming", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create secondary zone configuration for incoming zone transfers. +func (r *ZoneSecondaryDNSIncomingService) SecondaryDNSSecondaryZoneNewSecondaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationParams, opts ...option.RequestOption) (res *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/incoming", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get secondary zone configuration for incoming zone transfers. +func (r *ZoneSecondaryDNSIncomingService) SecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetails(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/incoming", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update secondary zone configuration for incoming zone transfers. +func (r *ZoneSecondaryDNSIncomingService) SecondaryDNSSecondaryZoneUpdateSecondaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationParams, opts ...option.RequestOption) (res *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/incoming", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneSecondaryDNSIncomingDeleteResponse struct { + Errors []ZoneSecondaryDNSIncomingDeleteResponseError `json:"errors"` + Messages []ZoneSecondaryDNSIncomingDeleteResponseMessage `json:"messages"` + Result ZoneSecondaryDNSIncomingDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSIncomingDeleteResponseSuccess `json:"success"` + JSON zoneSecondaryDNSIncomingDeleteResponseJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneSecondaryDNSIncomingDeleteResponse] +type zoneSecondaryDNSIncomingDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingDeleteResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingDeleteResponseErrorJSON contains the JSON metadata for +// the struct [ZoneSecondaryDNSIncomingDeleteResponseError] +type zoneSecondaryDNSIncomingDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingDeleteResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneSecondaryDNSIncomingDeleteResponseMessage] +type zoneSecondaryDNSIncomingDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingDeleteResponseResult struct { + ID interface{} `json:"id"` + JSON zoneSecondaryDNSIncomingDeleteResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingDeleteResponseResultJSON contains the JSON metadata for +// the struct [ZoneSecondaryDNSIncomingDeleteResponseResult] +type zoneSecondaryDNSIncomingDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSIncomingDeleteResponseSuccess bool + +const ( + ZoneSecondaryDNSIncomingDeleteResponseSuccessTrue ZoneSecondaryDNSIncomingDeleteResponseSuccess = true +) + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponse struct { + Errors []ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseError `json:"errors"` + Messages []ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseMessage `json:"messages"` + Result ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseSuccess `json:"success"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponse] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseError] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseMessage] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseResult struct { + ID interface{} `json:"id"` + // How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not + // applicable for primary zones. + AutoRefreshSeconds float64 `json:"auto_refresh_seconds"` + // The time for a specific event. + CheckedTime string `json:"checked_time"` + // The time for a specific event. + CreatedTime string `json:"created_time"` + // The time for a specific event. + ModifiedTime string `json:"modified_time"` + // Zone name. + Name string `json:"name"` + // A list of peer tags. + Peers []interface{} `json:"peers"` + // The serial number of the SOA for the given zone. + SoaSerial float64 `json:"soa_serial"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseResult] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseResultJSON struct { + ID apijson.Field + AutoRefreshSeconds apijson.Field + CheckedTime apijson.Field + CreatedTime apijson.Field + ModifiedTime apijson.Field + Name apijson.Field + Peers apijson.Field + SoaSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseSuccess bool + +const ( + ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseSuccessTrue ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationResponseSuccess = true +) + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponse struct { + Errors []ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseError `json:"errors"` + Messages []ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseMessage `json:"messages"` + Result ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseSuccess `json:"success"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponse] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseError] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseMessage] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseResult struct { + ID interface{} `json:"id"` + // How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not + // applicable for primary zones. + AutoRefreshSeconds float64 `json:"auto_refresh_seconds"` + // The time for a specific event. + CheckedTime string `json:"checked_time"` + // The time for a specific event. + CreatedTime string `json:"created_time"` + // The time for a specific event. + ModifiedTime string `json:"modified_time"` + // Zone name. + Name string `json:"name"` + // A list of peer tags. + Peers []interface{} `json:"peers"` + // The serial number of the SOA for the given zone. + SoaSerial float64 `json:"soa_serial"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseResult] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseResultJSON struct { + ID apijson.Field + AutoRefreshSeconds apijson.Field + CheckedTime apijson.Field + CreatedTime apijson.Field + ModifiedTime apijson.Field + Name apijson.Field + Peers apijson.Field + SoaSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseSuccess bool + +const ( + ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseSuccessTrue ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetailsResponseSuccess = true +) + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponse struct { + Errors []ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseError `json:"errors"` + Messages []ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseMessage `json:"messages"` + Result ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseSuccess `json:"success"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponse] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseError] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseMessage] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseResult struct { + ID interface{} `json:"id"` + // How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not + // applicable for primary zones. + AutoRefreshSeconds float64 `json:"auto_refresh_seconds"` + // The time for a specific event. + CheckedTime string `json:"checked_time"` + // The time for a specific event. + CreatedTime string `json:"created_time"` + // The time for a specific event. + ModifiedTime string `json:"modified_time"` + // Zone name. + Name string `json:"name"` + // A list of peer tags. + Peers []interface{} `json:"peers"` + // The serial number of the SOA for the given zone. + SoaSerial float64 `json:"soa_serial"` + JSON zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseResult] +type zoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseResultJSON struct { + ID apijson.Field + AutoRefreshSeconds apijson.Field + CheckedTime apijson.Field + CreatedTime apijson.Field + ModifiedTime apijson.Field + Name apijson.Field + Peers apijson.Field + SoaSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseSuccess bool + +const ( + ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseSuccessTrue ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationResponseSuccess = true +) + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationParams struct { + // How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not + // applicable for primary zones. + AutoRefreshSeconds param.Field[float64] `json:"auto_refresh_seconds,required"` + // Zone name. + Name param.Field[string] `json:"name,required"` + // A list of peer tags. + Peers param.Field[[]interface{}] `json:"peers,required"` +} + +func (r ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationParams struct { + // How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not + // applicable for primary zones. + AutoRefreshSeconds param.Field[float64] `json:"auto_refresh_seconds,required"` + // Zone name. + Name param.Field[string] `json:"name,required"` + // A list of peer tags. + Peers param.Field[[]interface{}] `json:"peers,required"` +} + +func (r ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonesecondarydnsincoming_test.go b/zonesecondarydnsincoming_test.go new file mode 100644 index 00000000000..f1154625204 --- /dev/null +++ b/zonesecondarydnsincoming_test.go @@ -0,0 +1,134 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSecondaryDNSIncomingDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Incomings.Delete(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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 TestZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Incomings.SecondaryDNSSecondaryZoneNewSecondaryZoneConfiguration( + context.TODO(), + "269d8f4853475ca241c4e730be286b20", + cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneNewSecondaryZoneConfigurationParams{ + AutoRefreshSeconds: cloudflare.F(86400.000000), + Name: cloudflare.F("www.example.com."), + Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}), + }, + ) + 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 TestZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Incomings.SecondaryDNSSecondaryZoneSecondaryZoneConfigurationDetails(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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 TestZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Incomings.SecondaryDNSSecondaryZoneUpdateSecondaryZoneConfiguration( + context.TODO(), + "269d8f4853475ca241c4e730be286b20", + cloudflare.ZoneSecondaryDNSIncomingSecondaryDNSSecondaryZoneUpdateSecondaryZoneConfigurationParams{ + AutoRefreshSeconds: cloudflare.F(86400.000000), + Name: cloudflare.F("www.example.com."), + Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}), + }, + ) + 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/zonesecondarydnsoutgoing.go b/zonesecondarydnsoutgoing.go new file mode 100644 index 00000000000..603c5e5f7c1 --- /dev/null +++ b/zonesecondarydnsoutgoing.go @@ -0,0 +1,504 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSOutgoingService 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 +// [NewZoneSecondaryDNSOutgoingService] method instead. +type ZoneSecondaryDNSOutgoingService struct { + Options []option.RequestOption + Disables *ZoneSecondaryDNSOutgoingDisableService + Enables *ZoneSecondaryDNSOutgoingEnableService + ForceNotifies *ZoneSecondaryDNSOutgoingForceNotifyService + Statuses *ZoneSecondaryDNSOutgoingStatusService +} + +// NewZoneSecondaryDNSOutgoingService 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 NewZoneSecondaryDNSOutgoingService(opts ...option.RequestOption) (r *ZoneSecondaryDNSOutgoingService) { + r = &ZoneSecondaryDNSOutgoingService{} + r.Options = opts + r.Disables = NewZoneSecondaryDNSOutgoingDisableService(opts...) + r.Enables = NewZoneSecondaryDNSOutgoingEnableService(opts...) + r.ForceNotifies = NewZoneSecondaryDNSOutgoingForceNotifyService(opts...) + r.Statuses = NewZoneSecondaryDNSOutgoingStatusService(opts...) + return +} + +// Delete primary zone configuration for outgoing zone transfers. +func (r *ZoneSecondaryDNSOutgoingService) Delete(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create primary zone configuration for outgoing zone transfers. +func (r *ZoneSecondaryDNSOutgoingService) SecondaryDNSPrimaryZoneNewPrimaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationParams, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Get primary zone configuration for outgoing zone transfers. +func (r *ZoneSecondaryDNSOutgoingService) SecondaryDNSPrimaryZonePrimaryZoneConfigurationDetails(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update primary zone configuration for outgoing zone transfers. +func (r *ZoneSecondaryDNSOutgoingService) SecondaryDNSPrimaryZoneUpdatePrimaryZoneConfiguration(ctx context.Context, zoneIdentifier interface{}, body ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationParams, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneSecondaryDNSOutgoingDeleteResponse struct { + Errors []ZoneSecondaryDNSOutgoingDeleteResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingDeleteResponseMessage `json:"messages"` + Result ZoneSecondaryDNSOutgoingDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingDeleteResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingDeleteResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneSecondaryDNSOutgoingDeleteResponse] +type zoneSecondaryDNSOutgoingDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingDeleteResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingDeleteResponseErrorJSON contains the JSON metadata for +// the struct [ZoneSecondaryDNSOutgoingDeleteResponseError] +type zoneSecondaryDNSOutgoingDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingDeleteResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneSecondaryDNSOutgoingDeleteResponseMessage] +type zoneSecondaryDNSOutgoingDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingDeleteResponseResult struct { + ID interface{} `json:"id"` + JSON zoneSecondaryDNSOutgoingDeleteResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingDeleteResponseResultJSON contains the JSON metadata for +// the struct [ZoneSecondaryDNSOutgoingDeleteResponseResult] +type zoneSecondaryDNSOutgoingDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingDeleteResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingDeleteResponseSuccessTrue ZoneSecondaryDNSOutgoingDeleteResponseSuccess = true +) + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponse struct { + Errors []ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseMessage `json:"messages"` + Result ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponse] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseError] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseMessage] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseResult struct { + ID interface{} `json:"id"` + // The time for a specific event. + CheckedTime string `json:"checked_time"` + // The time for a specific event. + CreatedTime string `json:"created_time"` + // The time for a specific event. + LastTransferredTime string `json:"last_transferred_time"` + // Zone name. + Name string `json:"name"` + // A list of peer tags. + Peers []interface{} `json:"peers"` + // The serial number of the SOA for the given zone. + SoaSerial float64 `json:"soa_serial"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseResult] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseResultJSON struct { + ID apijson.Field + CheckedTime apijson.Field + CreatedTime apijson.Field + LastTransferredTime apijson.Field + Name apijson.Field + Peers apijson.Field + SoaSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseSuccessTrue ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationResponseSuccess = true +) + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponse struct { + Errors []ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseMessage `json:"messages"` + Result ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponse] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseError] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseMessage] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseResult struct { + ID interface{} `json:"id"` + // The time for a specific event. + CheckedTime string `json:"checked_time"` + // The time for a specific event. + CreatedTime string `json:"created_time"` + // The time for a specific event. + LastTransferredTime string `json:"last_transferred_time"` + // Zone name. + Name string `json:"name"` + // A list of peer tags. + Peers []interface{} `json:"peers"` + // The serial number of the SOA for the given zone. + SoaSerial float64 `json:"soa_serial"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseResult] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseResultJSON struct { + ID apijson.Field + CheckedTime apijson.Field + CreatedTime apijson.Field + LastTransferredTime apijson.Field + Name apijson.Field + Peers apijson.Field + SoaSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseSuccessTrue ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetailsResponseSuccess = true +) + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponse struct { + Errors []ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseMessage `json:"messages"` + Result ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponse] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseError] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseMessage] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseResult struct { + ID interface{} `json:"id"` + // The time for a specific event. + CheckedTime string `json:"checked_time"` + // The time for a specific event. + CreatedTime string `json:"created_time"` + // The time for a specific event. + LastTransferredTime string `json:"last_transferred_time"` + // Zone name. + Name string `json:"name"` + // A list of peer tags. + Peers []interface{} `json:"peers"` + // The serial number of the SOA for the given zone. + SoaSerial float64 `json:"soa_serial"` + JSON zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseResultJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseResult] +type zoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseResultJSON struct { + ID apijson.Field + CheckedTime apijson.Field + CreatedTime apijson.Field + LastTransferredTime apijson.Field + Name apijson.Field + Peers apijson.Field + SoaSerial apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseSuccessTrue ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationResponseSuccess = true +) + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationParams struct { + // Zone name. + Name param.Field[string] `json:"name,required"` + // A list of peer tags. + Peers param.Field[[]interface{}] `json:"peers,required"` +} + +func (r ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationParams struct { + // Zone name. + Name param.Field[string] `json:"name,required"` + // A list of peer tags. + Peers param.Field[[]interface{}] `json:"peers,required"` +} + +func (r ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonesecondarydnsoutgoing_test.go b/zonesecondarydnsoutgoing_test.go new file mode 100644 index 00000000000..6e8a40c9584 --- /dev/null +++ b/zonesecondarydnsoutgoing_test.go @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSecondaryDNSOutgoingDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.Delete(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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 TestZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.SecondaryDNSPrimaryZoneNewPrimaryZoneConfiguration( + context.TODO(), + "269d8f4853475ca241c4e730be286b20", + cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneNewPrimaryZoneConfigurationParams{ + Name: cloudflare.F("www.example.com."), + Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}), + }, + ) + 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 TestZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZonePrimaryZoneConfigurationDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.SecondaryDNSPrimaryZonePrimaryZoneConfigurationDetails(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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 TestZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfiguration(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.SecondaryDNSPrimaryZoneUpdatePrimaryZoneConfiguration( + context.TODO(), + "269d8f4853475ca241c4e730be286b20", + cloudflare.ZoneSecondaryDNSOutgoingSecondaryDNSPrimaryZoneUpdatePrimaryZoneConfigurationParams{ + Name: cloudflare.F("www.example.com."), + Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}), + }, + ) + 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/zonesecondarydnsoutgoingdisable.go b/zonesecondarydnsoutgoingdisable.go new file mode 100644 index 00000000000..f4e3017d9c5 --- /dev/null +++ b/zonesecondarydnsoutgoingdisable.go @@ -0,0 +1,113 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSOutgoingDisableService 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 +// [NewZoneSecondaryDNSOutgoingDisableService] method instead. +type ZoneSecondaryDNSOutgoingDisableService struct { + Options []option.RequestOption +} + +// NewZoneSecondaryDNSOutgoingDisableService 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 NewZoneSecondaryDNSOutgoingDisableService(opts ...option.RequestOption) (r *ZoneSecondaryDNSOutgoingDisableService) { + r = &ZoneSecondaryDNSOutgoingDisableService{} + r.Options = opts + return +} + +// Disable outgoing zone transfers for primary zone and clears IXFR backlog of +// primary zone. +func (r *ZoneSecondaryDNSOutgoingDisableService) SecondaryDNSPrimaryZoneDisableOutgoingZoneTransfers(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing/disable", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponse struct { + Errors []ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseMessage `json:"messages"` + // The zone transfer status of a primary zone + Result string `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponse] +type zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseError] +type zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseMessage] +type zoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseSuccessTrue ZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfersResponseSuccess = true +) diff --git a/zonesecondarydnsoutgoingdisable_test.go b/zonesecondarydnsoutgoingdisable_test.go new file mode 100644 index 00000000000..26b2eb18a8a --- /dev/null +++ b/zonesecondarydnsoutgoingdisable_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSecondaryDNSOutgoingDisableSecondaryDNSPrimaryZoneDisableOutgoingZoneTransfers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.Disables.SecondaryDNSPrimaryZoneDisableOutgoingZoneTransfers(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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/zonesecondarydnsoutgoingenable.go b/zonesecondarydnsoutgoingenable.go new file mode 100644 index 00000000000..d7a97845e88 --- /dev/null +++ b/zonesecondarydnsoutgoingenable.go @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSOutgoingEnableService 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 +// [NewZoneSecondaryDNSOutgoingEnableService] method instead. +type ZoneSecondaryDNSOutgoingEnableService struct { + Options []option.RequestOption +} + +// NewZoneSecondaryDNSOutgoingEnableService 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 NewZoneSecondaryDNSOutgoingEnableService(opts ...option.RequestOption) (r *ZoneSecondaryDNSOutgoingEnableService) { + r = &ZoneSecondaryDNSOutgoingEnableService{} + r.Options = opts + return +} + +// Enable outgoing zone transfers for primary zone. +func (r *ZoneSecondaryDNSOutgoingEnableService) SecondaryDNSPrimaryZoneEnableOutgoingZoneTransfers(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing/enable", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponse struct { + Errors []ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseMessage `json:"messages"` + // The zone transfer status of a primary zone + Result string `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponse] +type zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseError] +type zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseMessage] +type zoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseSuccessTrue ZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfersResponseSuccess = true +) diff --git a/zonesecondarydnsoutgoingenable_test.go b/zonesecondarydnsoutgoingenable_test.go new file mode 100644 index 00000000000..838891b55b4 --- /dev/null +++ b/zonesecondarydnsoutgoingenable_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSecondaryDNSOutgoingEnableSecondaryDNSPrimaryZoneEnableOutgoingZoneTransfers(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.Enables.SecondaryDNSPrimaryZoneEnableOutgoingZoneTransfers(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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/zonesecondarydnsoutgoingforcenotify.go b/zonesecondarydnsoutgoingforcenotify.go new file mode 100644 index 00000000000..340a35ece6f --- /dev/null +++ b/zonesecondarydnsoutgoingforcenotify.go @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSOutgoingForceNotifyService 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 +// [NewZoneSecondaryDNSOutgoingForceNotifyService] method instead. +type ZoneSecondaryDNSOutgoingForceNotifyService struct { + Options []option.RequestOption +} + +// NewZoneSecondaryDNSOutgoingForceNotifyService 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 NewZoneSecondaryDNSOutgoingForceNotifyService(opts ...option.RequestOption) (r *ZoneSecondaryDNSOutgoingForceNotifyService) { + r = &ZoneSecondaryDNSOutgoingForceNotifyService{} + r.Options = opts + return +} + +// Notifies the secondary nameserver(s) and clears IXFR backlog of primary zone. +func (r *ZoneSecondaryDNSOutgoingForceNotifyService) SecondaryDNSPrimaryZoneForceDNSNotify(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing/force_notify", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) + return +} + +type ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponse struct { + Errors []ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseMessage `json:"messages"` + // When force_notify query parameter is set to true, the response is a simple + // string + Result string `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponse] +type zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseError] +type zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseMessage] +type zoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseSuccessTrue ZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotifyResponseSuccess = true +) diff --git a/zonesecondarydnsoutgoingforcenotify_test.go b/zonesecondarydnsoutgoingforcenotify_test.go new file mode 100644 index 00000000000..f1c85c75b61 --- /dev/null +++ b/zonesecondarydnsoutgoingforcenotify_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSecondaryDNSOutgoingForceNotifySecondaryDNSPrimaryZoneForceDNSNotify(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.ForceNotifies.SecondaryDNSPrimaryZoneForceDNSNotify(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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/zonesecondarydnsoutgoingstatus.go b/zonesecondarydnsoutgoingstatus.go new file mode 100644 index 00000000000..0f5327bfe07 --- /dev/null +++ b/zonesecondarydnsoutgoingstatus.go @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSecondaryDNSOutgoingStatusService 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 +// [NewZoneSecondaryDNSOutgoingStatusService] method instead. +type ZoneSecondaryDNSOutgoingStatusService struct { + Options []option.RequestOption +} + +// NewZoneSecondaryDNSOutgoingStatusService 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 NewZoneSecondaryDNSOutgoingStatusService(opts ...option.RequestOption) (r *ZoneSecondaryDNSOutgoingStatusService) { + r = &ZoneSecondaryDNSOutgoingStatusService{} + r.Options = opts + return +} + +// Get primary zone transfer status. +func (r *ZoneSecondaryDNSOutgoingStatusService) SecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatus(ctx context.Context, zoneIdentifier interface{}, opts ...option.RequestOption) (res *ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%v/secondary_dns/outgoing/status", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponse struct { + Errors []ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseError `json:"errors"` + Messages []ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseMessage `json:"messages"` + // The zone transfer status of a primary zone + Result string `json:"result"` + // Whether the API call was successful + Success ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseSuccess `json:"success"` + JSON zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponse] +type zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseErrorJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseError] +type zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseMessageJSON `json:"-"` +} + +// zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseMessage] +type zoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseSuccess bool + +const ( + ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseSuccessTrue ZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatusResponseSuccess = true +) diff --git a/zonesecondarydnsoutgoingstatus_test.go b/zonesecondarydnsoutgoingstatus_test.go new file mode 100644 index 00000000000..ed73695223a --- /dev/null +++ b/zonesecondarydnsoutgoingstatus_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSecondaryDNSOutgoingStatusSecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatus(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SecondaryDNS.Outgoings.Statuses.SecondaryDNSPrimaryZoneGetOutgoingZoneTransferStatus(context.TODO(), "269d8f4853475ca241c4e730be286b20") + 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/zonesetting.go b/zonesetting.go index 7df91562c1d..b49eca8120a 100644 --- a/zonesetting.go +++ b/zonesetting.go @@ -22,6 +22,7 @@ import ( // instead. type ZoneSettingService struct { Options []option.RequestOption + ZeroRtts *ZoneSettingZeroRttService AdvancedDdos *ZoneSettingAdvancedDdoService AlwaysOnlines *ZoneSettingAlwaysOnlineService AlwaysUseHTTPs *ZoneSettingAlwaysUseHTTPService @@ -55,7 +56,6 @@ type ZoneSettingService struct { OriginMaxHTTPVersions *ZoneSettingOriginMaxHTTPVersionService Polishes *ZoneSettingPolishService PrefetchPreloads *ZoneSettingPrefetchPreloadService - PrivacyPasses *ZoneSettingPrivacyPassService ProxyReadTimeouts *ZoneSettingProxyReadTimeoutService PseudoIpv4s *ZoneSettingPseudoIpv4Service ResponseBufferings *ZoneSettingResponseBufferingService @@ -72,6 +72,8 @@ type ZoneSettingService struct { Wafs *ZoneSettingWafService Webps *ZoneSettingWebpService Websockets *ZoneSettingWebsocketService + Fonts *ZoneSettingFontService + Zaraz *ZoneSettingZarazService } // NewZoneSettingService generates a new service that applies the given options to @@ -80,6 +82,7 @@ type ZoneSettingService struct { func NewZoneSettingService(opts ...option.RequestOption) (r *ZoneSettingService) { r = &ZoneSettingService{} r.Options = opts + r.ZeroRtts = NewZoneSettingZeroRttService(opts...) r.AdvancedDdos = NewZoneSettingAdvancedDdoService(opts...) r.AlwaysOnlines = NewZoneSettingAlwaysOnlineService(opts...) r.AlwaysUseHTTPs = NewZoneSettingAlwaysUseHTTPService(opts...) @@ -113,7 +116,6 @@ func NewZoneSettingService(opts ...option.RequestOption) (r *ZoneSettingService) r.OriginMaxHTTPVersions = NewZoneSettingOriginMaxHTTPVersionService(opts...) r.Polishes = NewZoneSettingPolishService(opts...) r.PrefetchPreloads = NewZoneSettingPrefetchPreloadService(opts...) - r.PrivacyPasses = NewZoneSettingPrivacyPassService(opts...) r.ProxyReadTimeouts = NewZoneSettingProxyReadTimeoutService(opts...) r.PseudoIpv4s = NewZoneSettingPseudoIpv4Service(opts...) r.ResponseBufferings = NewZoneSettingResponseBufferingService(opts...) @@ -130,11 +132,13 @@ func NewZoneSettingService(opts ...option.RequestOption) (r *ZoneSettingService) r.Wafs = NewZoneSettingWafService(opts...) r.Webps = NewZoneSettingWebpService(opts...) r.Websockets = NewZoneSettingWebsocketService(opts...) + r.Fonts = NewZoneSettingFontService(opts...) + r.Zaraz = NewZoneSettingZarazService(opts...) return } // Available settings for your user in relation to a zone. -func (r *ZoneSettingService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSettingsCollection, err error) { +func (r *ZoneSettingService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSettingListResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("zones/%s/settings", zoneIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) @@ -142,29 +146,3335 @@ func (r *ZoneSettingService) List(ctx context.Context, zoneIdentifier string, op } // Edit settings for a zone. -func (r *ZoneSettingService) Edit(ctx context.Context, zoneIdentifier string, body ZoneSettingEditParams, opts ...option.RequestOption) (res *ZoneSettingsCollection, err error) { +func (r *ZoneSettingService) Edit(ctx context.Context, zoneIdentifier string, body ZoneSettingEditParams, opts ...option.RequestOption) (res *ZoneSettingEditResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("zones/%s/settings", zoneIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) return } +type ZoneSettingListResponse struct { + Errors []ZoneSettingListResponseError `json:"errors"` + Messages []ZoneSettingListResponseMessage `json:"messages"` + Result []ZoneSettingListResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingListResponseJSON `json:"-"` +} + +// zoneSettingListResponseJSON contains the JSON metadata for the struct +// [ZoneSettingListResponse] +type zoneSettingListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingListResponseErrorJSON `json:"-"` +} + +// zoneSettingListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseError] +type zoneSettingListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingListResponseMessageJSON `json:"-"` +} + +// zoneSettingListResponseMessageJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseMessage] +type zoneSettingListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// 0-RTT session resumption enabled for this zone. +// +// Union satisfied by [ZoneSettingListResponseResultZones0rtt], +// [ZoneSettingListResponseResultZonesAdvancedDdos], +// [ZoneSettingListResponseResultZonesAlwaysOnline], +// [ZoneSettingListResponseResultZonesAlwaysUseHTTPs], +// [ZoneSettingListResponseResultZonesAutomaticHTTPsRewrites], +// [ZoneSettingListResponseResultZonesBrotli], +// [ZoneSettingListResponseResultZonesBrowserCacheTtl], +// [ZoneSettingListResponseResultZonesBrowserCheck], +// [ZoneSettingListResponseResultZonesCacheLevel], +// [ZoneSettingListResponseResultZonesChallengeTtl], +// [ZoneSettingListResponseResultZonesCiphers], +// [ZoneSettingListResponseResultZonesCnameFlattening], +// [ZoneSettingListResponseResultZonesDevelopmentMode], +// [ZoneSettingListResponseResultZonesEarlyHints], +// [ZoneSettingListResponseResultZonesEdgeCacheTtl], +// [ZoneSettingListResponseResultZonesEmailObfuscation], +// [ZoneSettingListResponseResultZonesH2Prioritization], +// [ZoneSettingListResponseResultZonesHotlinkProtection], +// [ZoneSettingListResponseResultZonesHttp2], +// [ZoneSettingListResponseResultZonesHttp3], +// [ZoneSettingListResponseResultZonesImageResizing], +// [ZoneSettingListResponseResultZonesIPGeolocation], +// [ZoneSettingListResponseResultZonesIpv6], +// [ZoneSettingListResponseResultZonesMaxUpload], +// [ZoneSettingListResponseResultZonesMinTlsVersion], +// [ZoneSettingListResponseResultZonesMinify], +// [ZoneSettingListResponseResultZonesMirage], +// [ZoneSettingListResponseResultZonesMobileRedirect], +// [ZoneSettingListResponseResultZonesNel], +// [ZoneSettingListResponseResultZonesOpportunisticEncryption], +// [ZoneSettingListResponseResultZonesOpportunisticOnion], +// [ZoneSettingListResponseResultZonesOrangeToOrange], +// [ZoneSettingListResponseResultZonesOriginErrorPagePassThru], +// [ZoneSettingListResponseResultZonesOriginMaxHTTPVersion], +// [ZoneSettingListResponseResultZonesPolish], +// [ZoneSettingListResponseResultZonesPrefetchPreload], +// [ZoneSettingListResponseResultZonesProxyReadTimeout], +// [ZoneSettingListResponseResultZonesPseudoIpv4], +// [ZoneSettingListResponseResultZonesResponseBuffering], +// [ZoneSettingListResponseResultZonesRocketLoader], +// [ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimization], +// [ZoneSettingListResponseResultZonesSecurityHeader], +// [ZoneSettingListResponseResultZonesSecurityLevel], +// [ZoneSettingListResponseResultZonesServerSideExclude], +// [ZoneSettingListResponseResultZonesSha1Support], +// [ZoneSettingListResponseResultZonesSortQueryStringForCache], +// [ZoneSettingListResponseResultZonesSsl], +// [ZoneSettingListResponseResultZonesSslRecommender], +// [ZoneSettingListResponseResultZonesTls1_2Only], +// [ZoneSettingListResponseResultZonesTls1_3], +// [ZoneSettingListResponseResultZonesTlsClientAuth], +// [ZoneSettingListResponseResultZonesTrueClientIPHeader], +// [ZoneSettingListResponseResultZonesWaf], +// [ZoneSettingListResponseResultZonesWebp] or +// [ZoneSettingListResponseResultZonesWebsockets]. +type ZoneSettingListResponseResult interface { + implementsZoneSettingListResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneSettingListResponseResult)(nil)).Elem(), "") +} + // 0-RTT session resumption enabled for this zone. -type ZeroRtt struct { +type ZoneSettingListResponseResultZones0rtt struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZones0rttID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZones0rttEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the 0-RTT setting. + Value ZoneSettingListResponseResultZones0rttValue `json:"value"` + JSON zoneSettingListResponseResultZones0rttJSON `json:"-"` +} + +// zoneSettingListResponseResultZones0rttJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZones0rtt] +type zoneSettingListResponseResultZones0rttJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZones0rtt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZones0rtt) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZones0rttID string + +const ( + ZoneSettingListResponseResultZones0rttID0rtt ZoneSettingListResponseResultZones0rttID = "0rtt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZones0rttEditable bool + +const ( + ZoneSettingListResponseResultZones0rttEditableTrue ZoneSettingListResponseResultZones0rttEditable = true + ZoneSettingListResponseResultZones0rttEditableFalse ZoneSettingListResponseResultZones0rttEditable = false +) + +// Value of the 0-RTT setting. +type ZoneSettingListResponseResultZones0rttValue string + +const ( + ZoneSettingListResponseResultZones0rttValueOn ZoneSettingListResponseResultZones0rttValue = "on" + ZoneSettingListResponseResultZones0rttValueOff ZoneSettingListResponseResultZones0rttValue = "off" +) + +// Advanced protection from Distributed Denial of Service (DDoS) attacks on your +// website. This is an uneditable value that is 'on' in the case of Business and +// Enterprise zones. +type ZoneSettingListResponseResultZonesAdvancedDdos struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesAdvancedDdosID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesAdvancedDdosEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Defaults to on for Business+ plans + Value ZoneSettingListResponseResultZonesAdvancedDdosValue `json:"value"` + JSON zoneSettingListResponseResultZonesAdvancedDdosJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesAdvancedDdosJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesAdvancedDdos] +type zoneSettingListResponseResultZonesAdvancedDdosJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesAdvancedDdos) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesAdvancedDdos) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesAdvancedDdosID string + +const ( + ZoneSettingListResponseResultZonesAdvancedDdosIDAdvancedDdos ZoneSettingListResponseResultZonesAdvancedDdosID = "advanced_ddos" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesAdvancedDdosEditable bool + +const ( + ZoneSettingListResponseResultZonesAdvancedDdosEditableTrue ZoneSettingListResponseResultZonesAdvancedDdosEditable = true + ZoneSettingListResponseResultZonesAdvancedDdosEditableFalse ZoneSettingListResponseResultZonesAdvancedDdosEditable = false +) + +// Value of the zone setting. Notes: Defaults to on for Business+ plans +type ZoneSettingListResponseResultZonesAdvancedDdosValue string + +const ( + ZoneSettingListResponseResultZonesAdvancedDdosValueOn ZoneSettingListResponseResultZonesAdvancedDdosValue = "on" + ZoneSettingListResponseResultZonesAdvancedDdosValueOff ZoneSettingListResponseResultZonesAdvancedDdosValue = "off" +) + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +type ZoneSettingListResponseResultZonesAlwaysOnline struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesAlwaysOnlineID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesAlwaysOnlineEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesAlwaysOnlineValue `json:"value"` + JSON zoneSettingListResponseResultZonesAlwaysOnlineJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesAlwaysOnlineJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesAlwaysOnline] +type zoneSettingListResponseResultZonesAlwaysOnlineJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesAlwaysOnline) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesAlwaysOnline) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesAlwaysOnlineID string + +const ( + ZoneSettingListResponseResultZonesAlwaysOnlineIDAlwaysOnline ZoneSettingListResponseResultZonesAlwaysOnlineID = "always_online" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesAlwaysOnlineEditable bool + +const ( + ZoneSettingListResponseResultZonesAlwaysOnlineEditableTrue ZoneSettingListResponseResultZonesAlwaysOnlineEditable = true + ZoneSettingListResponseResultZonesAlwaysOnlineEditableFalse ZoneSettingListResponseResultZonesAlwaysOnlineEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesAlwaysOnlineValue string + +const ( + ZoneSettingListResponseResultZonesAlwaysOnlineValueOn ZoneSettingListResponseResultZonesAlwaysOnlineValue = "on" + ZoneSettingListResponseResultZonesAlwaysOnlineValueOff ZoneSettingListResponseResultZonesAlwaysOnlineValue = "off" +) + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +type ZoneSettingListResponseResultZonesAlwaysUseHTTPs struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesAlwaysUseHTTPsID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesAlwaysUseHTTPsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesAlwaysUseHTTPsValue `json:"value"` + JSON zoneSettingListResponseResultZonesAlwaysUseHTTPsJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesAlwaysUseHTTPsJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesAlwaysUseHTTPs] +type zoneSettingListResponseResultZonesAlwaysUseHTTPsJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesAlwaysUseHTTPs) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesAlwaysUseHTTPs) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesAlwaysUseHTTPsID string + +const ( + ZoneSettingListResponseResultZonesAlwaysUseHTTPsIDAlwaysUseHTTPs ZoneSettingListResponseResultZonesAlwaysUseHTTPsID = "always_use_https" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesAlwaysUseHTTPsEditable bool + +const ( + ZoneSettingListResponseResultZonesAlwaysUseHTTPsEditableTrue ZoneSettingListResponseResultZonesAlwaysUseHTTPsEditable = true + ZoneSettingListResponseResultZonesAlwaysUseHTTPsEditableFalse ZoneSettingListResponseResultZonesAlwaysUseHTTPsEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesAlwaysUseHTTPsValue string + +const ( + ZoneSettingListResponseResultZonesAlwaysUseHTTPsValueOn ZoneSettingListResponseResultZonesAlwaysUseHTTPsValue = "on" + ZoneSettingListResponseResultZonesAlwaysUseHTTPsValueOff ZoneSettingListResponseResultZonesAlwaysUseHTTPsValue = "off" +) + +// Enable the Automatic HTTPS Rewrites feature for this zone. +type ZoneSettingListResponseResultZonesAutomaticHTTPsRewrites struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesValue `json:"value"` + JSON zoneSettingListResponseResultZonesAutomaticHTTPsRewritesJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesAutomaticHTTPsRewritesJSON contains the JSON +// metadata for the struct +// [ZoneSettingListResponseResultZonesAutomaticHTTPsRewrites] +type zoneSettingListResponseResultZonesAutomaticHTTPsRewritesJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesAutomaticHTTPsRewrites) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesAutomaticHTTPsRewrites) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesID string + +const ( + ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesIDAutomaticHTTPsRewrites ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesID = "automatic_https_rewrites" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesEditable bool + +const ( + ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesEditableTrue ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesEditable = true + ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesEditableFalse ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesEditable = false +) + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesValue string + +const ( + ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesValueOn ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesValue = "on" + ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesValueOff ZoneSettingListResponseResultZonesAutomaticHTTPsRewritesValue = "off" +) + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +type ZoneSettingListResponseResultZonesBrotli struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesBrotliID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesBrotliEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesBrotliValue `json:"value"` + JSON zoneSettingListResponseResultZonesBrotliJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesBrotliJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesBrotli] +type zoneSettingListResponseResultZonesBrotliJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesBrotli) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesBrotli) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesBrotliID string + +const ( + ZoneSettingListResponseResultZonesBrotliIDBrotli ZoneSettingListResponseResultZonesBrotliID = "brotli" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesBrotliEditable bool + +const ( + ZoneSettingListResponseResultZonesBrotliEditableTrue ZoneSettingListResponseResultZonesBrotliEditable = true + ZoneSettingListResponseResultZonesBrotliEditableFalse ZoneSettingListResponseResultZonesBrotliEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesBrotliValue string + +const ( + ZoneSettingListResponseResultZonesBrotliValueOff ZoneSettingListResponseResultZonesBrotliValue = "off" + ZoneSettingListResponseResultZonesBrotliValueOn ZoneSettingListResponseResultZonesBrotliValue = "on" +) + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +type ZoneSettingListResponseResultZonesBrowserCacheTtl struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesBrowserCacheTtlID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesBrowserCacheTtlEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting + // `Respect Existing Headers` + Value ZoneSettingListResponseResultZonesBrowserCacheTtlValue `json:"value"` + JSON zoneSettingListResponseResultZonesBrowserCacheTtlJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesBrowserCacheTtlJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesBrowserCacheTtl] +type zoneSettingListResponseResultZonesBrowserCacheTtlJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesBrowserCacheTtl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesBrowserCacheTtl) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesBrowserCacheTtlID string + +const ( + ZoneSettingListResponseResultZonesBrowserCacheTtlIDBrowserCacheTtl ZoneSettingListResponseResultZonesBrowserCacheTtlID = "browser_cache_ttl" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesBrowserCacheTtlEditable bool + +const ( + ZoneSettingListResponseResultZonesBrowserCacheTtlEditableTrue ZoneSettingListResponseResultZonesBrowserCacheTtlEditable = true + ZoneSettingListResponseResultZonesBrowserCacheTtlEditableFalse ZoneSettingListResponseResultZonesBrowserCacheTtlEditable = false +) + +// Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting +// `Respect Existing Headers` +type ZoneSettingListResponseResultZonesBrowserCacheTtlValue float64 + +const ( + ZoneSettingListResponseResultZonesBrowserCacheTtlValue0 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 0 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue30 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 30 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue60 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 60 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue120 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 120 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue300 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 300 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue1200 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 1200 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue1800 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 1800 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue3600 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 3600 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue7200 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 7200 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue10800 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 10800 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue14400 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 14400 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue18000 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 18000 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue28800 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 28800 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue43200 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 43200 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue57600 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 57600 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue72000 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 72000 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue86400 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 86400 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue172800 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 172800 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue259200 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 259200 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue345600 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 345600 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue432000 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 432000 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue691200 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 691200 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue1382400 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 1382400 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue2073600 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 2073600 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue2678400 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 2678400 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue5356800 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 5356800 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue16070400 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 16070400 + ZoneSettingListResponseResultZonesBrowserCacheTtlValue31536000 ZoneSettingListResponseResultZonesBrowserCacheTtlValue = 31536000 +) + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +type ZoneSettingListResponseResultZonesBrowserCheck struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesBrowserCheckID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesBrowserCheckEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesBrowserCheckValue `json:"value"` + JSON zoneSettingListResponseResultZonesBrowserCheckJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesBrowserCheckJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesBrowserCheck] +type zoneSettingListResponseResultZonesBrowserCheckJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesBrowserCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesBrowserCheck) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesBrowserCheckID string + +const ( + ZoneSettingListResponseResultZonesBrowserCheckIDBrowserCheck ZoneSettingListResponseResultZonesBrowserCheckID = "browser_check" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesBrowserCheckEditable bool + +const ( + ZoneSettingListResponseResultZonesBrowserCheckEditableTrue ZoneSettingListResponseResultZonesBrowserCheckEditable = true + ZoneSettingListResponseResultZonesBrowserCheckEditableFalse ZoneSettingListResponseResultZonesBrowserCheckEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesBrowserCheckValue string + +const ( + ZoneSettingListResponseResultZonesBrowserCheckValueOn ZoneSettingListResponseResultZonesBrowserCheckValue = "on" + ZoneSettingListResponseResultZonesBrowserCheckValueOff ZoneSettingListResponseResultZonesBrowserCheckValue = "off" +) + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +type ZoneSettingListResponseResultZonesCacheLevel struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesCacheLevelID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesCacheLevelEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesCacheLevelValue `json:"value"` + JSON zoneSettingListResponseResultZonesCacheLevelJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesCacheLevelJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesCacheLevel] +type zoneSettingListResponseResultZonesCacheLevelJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesCacheLevel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesCacheLevel) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesCacheLevelID string + +const ( + ZoneSettingListResponseResultZonesCacheLevelIDCacheLevel ZoneSettingListResponseResultZonesCacheLevelID = "cache_level" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesCacheLevelEditable bool + +const ( + ZoneSettingListResponseResultZonesCacheLevelEditableTrue ZoneSettingListResponseResultZonesCacheLevelEditable = true + ZoneSettingListResponseResultZonesCacheLevelEditableFalse ZoneSettingListResponseResultZonesCacheLevelEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesCacheLevelValue string + +const ( + ZoneSettingListResponseResultZonesCacheLevelValueAggressive ZoneSettingListResponseResultZonesCacheLevelValue = "aggressive" + ZoneSettingListResponseResultZonesCacheLevelValueBasic ZoneSettingListResponseResultZonesCacheLevelValue = "basic" + ZoneSettingListResponseResultZonesCacheLevelValueSimplified ZoneSettingListResponseResultZonesCacheLevelValue = "simplified" +) + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +type ZoneSettingListResponseResultZonesChallengeTtl struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesChallengeTtlID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesChallengeTtlEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesChallengeTtlValue `json:"value"` + JSON zoneSettingListResponseResultZonesChallengeTtlJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesChallengeTtlJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesChallengeTtl] +type zoneSettingListResponseResultZonesChallengeTtlJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesChallengeTtl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesChallengeTtl) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesChallengeTtlID string + +const ( + ZoneSettingListResponseResultZonesChallengeTtlIDChallengeTtl ZoneSettingListResponseResultZonesChallengeTtlID = "challenge_ttl" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesChallengeTtlEditable bool + +const ( + ZoneSettingListResponseResultZonesChallengeTtlEditableTrue ZoneSettingListResponseResultZonesChallengeTtlEditable = true + ZoneSettingListResponseResultZonesChallengeTtlEditableFalse ZoneSettingListResponseResultZonesChallengeTtlEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesChallengeTtlValue float64 + +const ( + ZoneSettingListResponseResultZonesChallengeTtlValue300 ZoneSettingListResponseResultZonesChallengeTtlValue = 300 + ZoneSettingListResponseResultZonesChallengeTtlValue900 ZoneSettingListResponseResultZonesChallengeTtlValue = 900 + ZoneSettingListResponseResultZonesChallengeTtlValue1800 ZoneSettingListResponseResultZonesChallengeTtlValue = 1800 + ZoneSettingListResponseResultZonesChallengeTtlValue2700 ZoneSettingListResponseResultZonesChallengeTtlValue = 2700 + ZoneSettingListResponseResultZonesChallengeTtlValue3600 ZoneSettingListResponseResultZonesChallengeTtlValue = 3600 + ZoneSettingListResponseResultZonesChallengeTtlValue7200 ZoneSettingListResponseResultZonesChallengeTtlValue = 7200 + ZoneSettingListResponseResultZonesChallengeTtlValue10800 ZoneSettingListResponseResultZonesChallengeTtlValue = 10800 + ZoneSettingListResponseResultZonesChallengeTtlValue14400 ZoneSettingListResponseResultZonesChallengeTtlValue = 14400 + ZoneSettingListResponseResultZonesChallengeTtlValue28800 ZoneSettingListResponseResultZonesChallengeTtlValue = 28800 + ZoneSettingListResponseResultZonesChallengeTtlValue57600 ZoneSettingListResponseResultZonesChallengeTtlValue = 57600 + ZoneSettingListResponseResultZonesChallengeTtlValue86400 ZoneSettingListResponseResultZonesChallengeTtlValue = 86400 + ZoneSettingListResponseResultZonesChallengeTtlValue604800 ZoneSettingListResponseResultZonesChallengeTtlValue = 604800 + ZoneSettingListResponseResultZonesChallengeTtlValue2592000 ZoneSettingListResponseResultZonesChallengeTtlValue = 2592000 + ZoneSettingListResponseResultZonesChallengeTtlValue31536000 ZoneSettingListResponseResultZonesChallengeTtlValue = 31536000 +) + +// An allowlist of ciphers for TLS termination. These ciphers must be in the +// BoringSSL format. +type ZoneSettingListResponseResultZonesCiphers struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesCiphersID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesCiphersEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value []string `json:"value"` + JSON zoneSettingListResponseResultZonesCiphersJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesCiphersJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesCiphers] +type zoneSettingListResponseResultZonesCiphersJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesCiphers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesCiphers) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesCiphersID string + +const ( + ZoneSettingListResponseResultZonesCiphersIDCiphers ZoneSettingListResponseResultZonesCiphersID = "ciphers" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesCiphersEditable bool + +const ( + ZoneSettingListResponseResultZonesCiphersEditableTrue ZoneSettingListResponseResultZonesCiphersEditable = true + ZoneSettingListResponseResultZonesCiphersEditableFalse ZoneSettingListResponseResultZonesCiphersEditable = false +) + +// Whether or not cname flattening is on. +type ZoneSettingListResponseResultZonesCnameFlattening struct { + // How to flatten the cname destination. + ID ZoneSettingListResponseResultZonesCnameFlatteningID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesCnameFlatteningEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the cname flattening setting. + Value ZoneSettingListResponseResultZonesCnameFlatteningValue `json:"value"` + JSON zoneSettingListResponseResultZonesCnameFlatteningJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesCnameFlatteningJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesCnameFlattening] +type zoneSettingListResponseResultZonesCnameFlatteningJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesCnameFlattening) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesCnameFlattening) implementsZoneSettingListResponseResult() { +} + +// How to flatten the cname destination. +type ZoneSettingListResponseResultZonesCnameFlatteningID string + +const ( + ZoneSettingListResponseResultZonesCnameFlatteningIDCnameFlattening ZoneSettingListResponseResultZonesCnameFlatteningID = "cname_flattening" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesCnameFlatteningEditable bool + +const ( + ZoneSettingListResponseResultZonesCnameFlatteningEditableTrue ZoneSettingListResponseResultZonesCnameFlatteningEditable = true + ZoneSettingListResponseResultZonesCnameFlatteningEditableFalse ZoneSettingListResponseResultZonesCnameFlatteningEditable = false +) + +// Value of the cname flattening setting. +type ZoneSettingListResponseResultZonesCnameFlatteningValue string + +const ( + ZoneSettingListResponseResultZonesCnameFlatteningValueFlattenAtRoot ZoneSettingListResponseResultZonesCnameFlatteningValue = "flatten_at_root" + ZoneSettingListResponseResultZonesCnameFlatteningValueFlattenAll ZoneSettingListResponseResultZonesCnameFlatteningValue = "flatten_all" +) + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +type ZoneSettingListResponseResultZonesDevelopmentMode struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesDevelopmentModeID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesDevelopmentModeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: The interval (in seconds) from when + // development mode expires (positive integer) or last expired (negative integer) + // for the domain. If development mode has never been enabled, this value is false. + TimeRemaining float64 `json:"time_remaining"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesDevelopmentModeValue `json:"value"` + JSON zoneSettingListResponseResultZonesDevelopmentModeJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesDevelopmentModeJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesDevelopmentMode] +type zoneSettingListResponseResultZonesDevelopmentModeJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + TimeRemaining apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesDevelopmentMode) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesDevelopmentMode) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesDevelopmentModeID string + +const ( + ZoneSettingListResponseResultZonesDevelopmentModeIDDevelopmentMode ZoneSettingListResponseResultZonesDevelopmentModeID = "development_mode" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesDevelopmentModeEditable bool + +const ( + ZoneSettingListResponseResultZonesDevelopmentModeEditableTrue ZoneSettingListResponseResultZonesDevelopmentModeEditable = true + ZoneSettingListResponseResultZonesDevelopmentModeEditableFalse ZoneSettingListResponseResultZonesDevelopmentModeEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesDevelopmentModeValue string + +const ( + ZoneSettingListResponseResultZonesDevelopmentModeValueOn ZoneSettingListResponseResultZonesDevelopmentModeValue = "on" + ZoneSettingListResponseResultZonesDevelopmentModeValueOff ZoneSettingListResponseResultZonesDevelopmentModeValue = "off" +) + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +type ZoneSettingListResponseResultZonesEarlyHints struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesEarlyHintsID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesEarlyHintsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesEarlyHintsValue `json:"value"` + JSON zoneSettingListResponseResultZonesEarlyHintsJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesEarlyHintsJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesEarlyHints] +type zoneSettingListResponseResultZonesEarlyHintsJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesEarlyHints) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesEarlyHints) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesEarlyHintsID string + +const ( + ZoneSettingListResponseResultZonesEarlyHintsIDEarlyHints ZoneSettingListResponseResultZonesEarlyHintsID = "early_hints" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesEarlyHintsEditable bool + +const ( + ZoneSettingListResponseResultZonesEarlyHintsEditableTrue ZoneSettingListResponseResultZonesEarlyHintsEditable = true + ZoneSettingListResponseResultZonesEarlyHintsEditableFalse ZoneSettingListResponseResultZonesEarlyHintsEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesEarlyHintsValue string + +const ( + ZoneSettingListResponseResultZonesEarlyHintsValueOn ZoneSettingListResponseResultZonesEarlyHintsValue = "on" + ZoneSettingListResponseResultZonesEarlyHintsValueOff ZoneSettingListResponseResultZonesEarlyHintsValue = "off" +) + +// Time (in seconds) that a resource will be ensured to remain on Cloudflare's +// cache servers. +type ZoneSettingListResponseResultZonesEdgeCacheTtl struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesEdgeCacheTtlID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesEdgeCacheTtlEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: The minimum TTL available depends on the plan + // level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200) + Value ZoneSettingListResponseResultZonesEdgeCacheTtlValue `json:"value"` + JSON zoneSettingListResponseResultZonesEdgeCacheTtlJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesEdgeCacheTtlJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesEdgeCacheTtl] +type zoneSettingListResponseResultZonesEdgeCacheTtlJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesEdgeCacheTtl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesEdgeCacheTtl) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesEdgeCacheTtlID string + +const ( + ZoneSettingListResponseResultZonesEdgeCacheTtlIDEdgeCacheTtl ZoneSettingListResponseResultZonesEdgeCacheTtlID = "edge_cache_ttl" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesEdgeCacheTtlEditable bool + +const ( + ZoneSettingListResponseResultZonesEdgeCacheTtlEditableTrue ZoneSettingListResponseResultZonesEdgeCacheTtlEditable = true + ZoneSettingListResponseResultZonesEdgeCacheTtlEditableFalse ZoneSettingListResponseResultZonesEdgeCacheTtlEditable = false +) + +// Value of the zone setting. Notes: The minimum TTL available depends on the plan +// level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200) +type ZoneSettingListResponseResultZonesEdgeCacheTtlValue float64 + +const ( + ZoneSettingListResponseResultZonesEdgeCacheTtlValue30 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 30 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue60 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 60 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue300 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 300 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue1200 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 1200 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue1800 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 1800 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue3600 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 3600 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue7200 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 7200 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue10800 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 10800 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue14400 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 14400 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue18000 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 18000 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue28800 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 28800 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue43200 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 43200 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue57600 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 57600 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue72000 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 72000 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue86400 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 86400 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue172800 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 172800 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue259200 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 259200 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue345600 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 345600 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue432000 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 432000 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue518400 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 518400 + ZoneSettingListResponseResultZonesEdgeCacheTtlValue604800 ZoneSettingListResponseResultZonesEdgeCacheTtlValue = 604800 +) + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +type ZoneSettingListResponseResultZonesEmailObfuscation struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesEmailObfuscationID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesEmailObfuscationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesEmailObfuscationValue `json:"value"` + JSON zoneSettingListResponseResultZonesEmailObfuscationJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesEmailObfuscationJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesEmailObfuscation] +type zoneSettingListResponseResultZonesEmailObfuscationJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesEmailObfuscation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesEmailObfuscation) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesEmailObfuscationID string + +const ( + ZoneSettingListResponseResultZonesEmailObfuscationIDEmailObfuscation ZoneSettingListResponseResultZonesEmailObfuscationID = "email_obfuscation" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesEmailObfuscationEditable bool + +const ( + ZoneSettingListResponseResultZonesEmailObfuscationEditableTrue ZoneSettingListResponseResultZonesEmailObfuscationEditable = true + ZoneSettingListResponseResultZonesEmailObfuscationEditableFalse ZoneSettingListResponseResultZonesEmailObfuscationEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesEmailObfuscationValue string + +const ( + ZoneSettingListResponseResultZonesEmailObfuscationValueOn ZoneSettingListResponseResultZonesEmailObfuscationValue = "on" + ZoneSettingListResponseResultZonesEmailObfuscationValueOff ZoneSettingListResponseResultZonesEmailObfuscationValue = "off" +) + +// HTTP/2 Edge Prioritization optimises the delivery of resources served through +// HTTP/2 to improve page load performance. It also supports fine control of +// content delivery when used in conjunction with Workers. +type ZoneSettingListResponseResultZonesH2Prioritization struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesH2PrioritizationID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesH2PrioritizationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesH2PrioritizationValue `json:"value"` + JSON zoneSettingListResponseResultZonesH2PrioritizationJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesH2PrioritizationJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesH2Prioritization] +type zoneSettingListResponseResultZonesH2PrioritizationJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesH2Prioritization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesH2Prioritization) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesH2PrioritizationID string + +const ( + ZoneSettingListResponseResultZonesH2PrioritizationIDH2Prioritization ZoneSettingListResponseResultZonesH2PrioritizationID = "h2_prioritization" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesH2PrioritizationEditable bool + +const ( + ZoneSettingListResponseResultZonesH2PrioritizationEditableTrue ZoneSettingListResponseResultZonesH2PrioritizationEditable = true + ZoneSettingListResponseResultZonesH2PrioritizationEditableFalse ZoneSettingListResponseResultZonesH2PrioritizationEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesH2PrioritizationValue string + +const ( + ZoneSettingListResponseResultZonesH2PrioritizationValueOn ZoneSettingListResponseResultZonesH2PrioritizationValue = "on" + ZoneSettingListResponseResultZonesH2PrioritizationValueOff ZoneSettingListResponseResultZonesH2PrioritizationValue = "off" + ZoneSettingListResponseResultZonesH2PrioritizationValueCustom ZoneSettingListResponseResultZonesH2PrioritizationValue = "custom" +) + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +type ZoneSettingListResponseResultZonesHotlinkProtection struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesHotlinkProtectionID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesHotlinkProtectionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesHotlinkProtectionValue `json:"value"` + JSON zoneSettingListResponseResultZonesHotlinkProtectionJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesHotlinkProtectionJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesHotlinkProtection] +type zoneSettingListResponseResultZonesHotlinkProtectionJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesHotlinkProtection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesHotlinkProtection) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesHotlinkProtectionID string + +const ( + ZoneSettingListResponseResultZonesHotlinkProtectionIDHotlinkProtection ZoneSettingListResponseResultZonesHotlinkProtectionID = "hotlink_protection" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesHotlinkProtectionEditable bool + +const ( + ZoneSettingListResponseResultZonesHotlinkProtectionEditableTrue ZoneSettingListResponseResultZonesHotlinkProtectionEditable = true + ZoneSettingListResponseResultZonesHotlinkProtectionEditableFalse ZoneSettingListResponseResultZonesHotlinkProtectionEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesHotlinkProtectionValue string + +const ( + ZoneSettingListResponseResultZonesHotlinkProtectionValueOn ZoneSettingListResponseResultZonesHotlinkProtectionValue = "on" + ZoneSettingListResponseResultZonesHotlinkProtectionValueOff ZoneSettingListResponseResultZonesHotlinkProtectionValue = "off" +) + +// HTTP2 enabled for this zone. +type ZoneSettingListResponseResultZonesHttp2 struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesHttp2ID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesHttp2Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the HTTP2 setting. + Value ZoneSettingListResponseResultZonesHttp2Value `json:"value"` + JSON zoneSettingListResponseResultZonesHttp2JSON `json:"-"` +} + +// zoneSettingListResponseResultZonesHttp2JSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesHttp2] +type zoneSettingListResponseResultZonesHttp2JSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesHttp2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesHttp2) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesHttp2ID string + +const ( + ZoneSettingListResponseResultZonesHttp2IDHttp2 ZoneSettingListResponseResultZonesHttp2ID = "http2" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesHttp2Editable bool + +const ( + ZoneSettingListResponseResultZonesHttp2EditableTrue ZoneSettingListResponseResultZonesHttp2Editable = true + ZoneSettingListResponseResultZonesHttp2EditableFalse ZoneSettingListResponseResultZonesHttp2Editable = false +) + +// Value of the HTTP2 setting. +type ZoneSettingListResponseResultZonesHttp2Value string + +const ( + ZoneSettingListResponseResultZonesHttp2ValueOn ZoneSettingListResponseResultZonesHttp2Value = "on" + ZoneSettingListResponseResultZonesHttp2ValueOff ZoneSettingListResponseResultZonesHttp2Value = "off" +) + +// HTTP3 enabled for this zone. +type ZoneSettingListResponseResultZonesHttp3 struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesHttp3ID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesHttp3Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the HTTP3 setting. + Value ZoneSettingListResponseResultZonesHttp3Value `json:"value"` + JSON zoneSettingListResponseResultZonesHttp3JSON `json:"-"` +} + +// zoneSettingListResponseResultZonesHttp3JSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesHttp3] +type zoneSettingListResponseResultZonesHttp3JSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesHttp3) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesHttp3) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesHttp3ID string + +const ( + ZoneSettingListResponseResultZonesHttp3IDHttp3 ZoneSettingListResponseResultZonesHttp3ID = "http3" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesHttp3Editable bool + +const ( + ZoneSettingListResponseResultZonesHttp3EditableTrue ZoneSettingListResponseResultZonesHttp3Editable = true + ZoneSettingListResponseResultZonesHttp3EditableFalse ZoneSettingListResponseResultZonesHttp3Editable = false +) + +// Value of the HTTP3 setting. +type ZoneSettingListResponseResultZonesHttp3Value string + +const ( + ZoneSettingListResponseResultZonesHttp3ValueOn ZoneSettingListResponseResultZonesHttp3Value = "on" + ZoneSettingListResponseResultZonesHttp3ValueOff ZoneSettingListResponseResultZonesHttp3Value = "off" +) + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +type ZoneSettingListResponseResultZonesImageResizing struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesImageResizingID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesImageResizingEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Whether the feature is enabled, disabled, or enabled in `open proxy` mode. + Value ZoneSettingListResponseResultZonesImageResizingValue `json:"value"` + JSON zoneSettingListResponseResultZonesImageResizingJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesImageResizingJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesImageResizing] +type zoneSettingListResponseResultZonesImageResizingJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesImageResizing) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesImageResizing) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesImageResizingID string + +const ( + ZoneSettingListResponseResultZonesImageResizingIDImageResizing ZoneSettingListResponseResultZonesImageResizingID = "image_resizing" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesImageResizingEditable bool + +const ( + ZoneSettingListResponseResultZonesImageResizingEditableTrue ZoneSettingListResponseResultZonesImageResizingEditable = true + ZoneSettingListResponseResultZonesImageResizingEditableFalse ZoneSettingListResponseResultZonesImageResizingEditable = false +) + +// Whether the feature is enabled, disabled, or enabled in `open proxy` mode. +type ZoneSettingListResponseResultZonesImageResizingValue string + +const ( + ZoneSettingListResponseResultZonesImageResizingValueOn ZoneSettingListResponseResultZonesImageResizingValue = "on" + ZoneSettingListResponseResultZonesImageResizingValueOff ZoneSettingListResponseResultZonesImageResizingValue = "off" + ZoneSettingListResponseResultZonesImageResizingValueOpen ZoneSettingListResponseResultZonesImageResizingValue = "open" +) + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +type ZoneSettingListResponseResultZonesIPGeolocation struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesIPGeolocationID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesIPGeolocationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesIPGeolocationValue `json:"value"` + JSON zoneSettingListResponseResultZonesIPGeolocationJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesIPGeolocationJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesIPGeolocation] +type zoneSettingListResponseResultZonesIPGeolocationJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesIPGeolocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesIPGeolocation) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesIPGeolocationID string + +const ( + ZoneSettingListResponseResultZonesIPGeolocationIDIPGeolocation ZoneSettingListResponseResultZonesIPGeolocationID = "ip_geolocation" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesIPGeolocationEditable bool + +const ( + ZoneSettingListResponseResultZonesIPGeolocationEditableTrue ZoneSettingListResponseResultZonesIPGeolocationEditable = true + ZoneSettingListResponseResultZonesIPGeolocationEditableFalse ZoneSettingListResponseResultZonesIPGeolocationEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesIPGeolocationValue string + +const ( + ZoneSettingListResponseResultZonesIPGeolocationValueOn ZoneSettingListResponseResultZonesIPGeolocationValue = "on" + ZoneSettingListResponseResultZonesIPGeolocationValueOff ZoneSettingListResponseResultZonesIPGeolocationValue = "off" +) + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +type ZoneSettingListResponseResultZonesIpv6 struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesIpv6ID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesIpv6Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesIpv6Value `json:"value"` + JSON zoneSettingListResponseResultZonesIpv6JSON `json:"-"` +} + +// zoneSettingListResponseResultZonesIpv6JSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesIpv6] +type zoneSettingListResponseResultZonesIpv6JSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesIpv6) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesIpv6) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesIpv6ID string + +const ( + ZoneSettingListResponseResultZonesIpv6IDIpv6 ZoneSettingListResponseResultZonesIpv6ID = "ipv6" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesIpv6Editable bool + +const ( + ZoneSettingListResponseResultZonesIpv6EditableTrue ZoneSettingListResponseResultZonesIpv6Editable = true + ZoneSettingListResponseResultZonesIpv6EditableFalse ZoneSettingListResponseResultZonesIpv6Editable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesIpv6Value string + +const ( + ZoneSettingListResponseResultZonesIpv6ValueOff ZoneSettingListResponseResultZonesIpv6Value = "off" + ZoneSettingListResponseResultZonesIpv6ValueOn ZoneSettingListResponseResultZonesIpv6Value = "on" +) + +// Maximum size of an allowable upload. +type ZoneSettingListResponseResultZonesMaxUpload struct { + // identifier of the zone setting. + ID ZoneSettingListResponseResultZonesMaxUploadID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesMaxUploadEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: The size depends on the plan level of the + // zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100) + Value ZoneSettingListResponseResultZonesMaxUploadValue `json:"value"` + JSON zoneSettingListResponseResultZonesMaxUploadJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesMaxUploadJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesMaxUpload] +type zoneSettingListResponseResultZonesMaxUploadJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesMaxUpload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesMaxUpload) implementsZoneSettingListResponseResult() {} + +// identifier of the zone setting. +type ZoneSettingListResponseResultZonesMaxUploadID string + +const ( + ZoneSettingListResponseResultZonesMaxUploadIDMaxUpload ZoneSettingListResponseResultZonesMaxUploadID = "max_upload" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesMaxUploadEditable bool + +const ( + ZoneSettingListResponseResultZonesMaxUploadEditableTrue ZoneSettingListResponseResultZonesMaxUploadEditable = true + ZoneSettingListResponseResultZonesMaxUploadEditableFalse ZoneSettingListResponseResultZonesMaxUploadEditable = false +) + +// Value of the zone setting. Notes: The size depends on the plan level of the +// zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100) +type ZoneSettingListResponseResultZonesMaxUploadValue float64 + +const ( + ZoneSettingListResponseResultZonesMaxUploadValue100 ZoneSettingListResponseResultZonesMaxUploadValue = 100 + ZoneSettingListResponseResultZonesMaxUploadValue200 ZoneSettingListResponseResultZonesMaxUploadValue = 200 + ZoneSettingListResponseResultZonesMaxUploadValue500 ZoneSettingListResponseResultZonesMaxUploadValue = 500 +) + +// Only accepts HTTPS requests that use at least the TLS protocol version +// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be +// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. +type ZoneSettingListResponseResultZonesMinTlsVersion struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesMinTlsVersionID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesMinTlsVersionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesMinTlsVersionValue `json:"value"` + JSON zoneSettingListResponseResultZonesMinTlsVersionJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesMinTlsVersionJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesMinTlsVersion] +type zoneSettingListResponseResultZonesMinTlsVersionJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesMinTlsVersion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesMinTlsVersion) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesMinTlsVersionID string + +const ( + ZoneSettingListResponseResultZonesMinTlsVersionIDMinTlsVersion ZoneSettingListResponseResultZonesMinTlsVersionID = "min_tls_version" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesMinTlsVersionEditable bool + +const ( + ZoneSettingListResponseResultZonesMinTlsVersionEditableTrue ZoneSettingListResponseResultZonesMinTlsVersionEditable = true + ZoneSettingListResponseResultZonesMinTlsVersionEditableFalse ZoneSettingListResponseResultZonesMinTlsVersionEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesMinTlsVersionValue string + +const ( + ZoneSettingListResponseResultZonesMinTlsVersionValue1_0 ZoneSettingListResponseResultZonesMinTlsVersionValue = "1.0" + ZoneSettingListResponseResultZonesMinTlsVersionValue1_1 ZoneSettingListResponseResultZonesMinTlsVersionValue = "1.1" + ZoneSettingListResponseResultZonesMinTlsVersionValue1_2 ZoneSettingListResponseResultZonesMinTlsVersionValue = "1.2" + ZoneSettingListResponseResultZonesMinTlsVersionValue1_3 ZoneSettingListResponseResultZonesMinTlsVersionValue = "1.3" +) + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +type ZoneSettingListResponseResultZonesMinify struct { + // Zone setting identifier. + ID ZoneSettingListResponseResultZonesMinifyID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesMinifyEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesMinifyValue `json:"value"` + JSON zoneSettingListResponseResultZonesMinifyJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesMinifyJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesMinify] +type zoneSettingListResponseResultZonesMinifyJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesMinify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesMinify) implementsZoneSettingListResponseResult() {} + +// Zone setting identifier. +type ZoneSettingListResponseResultZonesMinifyID string + +const ( + ZoneSettingListResponseResultZonesMinifyIDMinify ZoneSettingListResponseResultZonesMinifyID = "minify" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesMinifyEditable bool + +const ( + ZoneSettingListResponseResultZonesMinifyEditableTrue ZoneSettingListResponseResultZonesMinifyEditable = true + ZoneSettingListResponseResultZonesMinifyEditableFalse ZoneSettingListResponseResultZonesMinifyEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesMinifyValue struct { + // Automatically minify all CSS files for your website. + Css ZoneSettingListResponseResultZonesMinifyValueCss `json:"css"` + // Automatically minify all HTML files for your website. + HTML ZoneSettingListResponseResultZonesMinifyValueHTML `json:"html"` + // Automatically minify all JavaScript files for your website. + Js ZoneSettingListResponseResultZonesMinifyValueJs `json:"js"` + JSON zoneSettingListResponseResultZonesMinifyValueJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesMinifyValueJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesMinifyValue] +type zoneSettingListResponseResultZonesMinifyValueJSON struct { + Css apijson.Field + HTML apijson.Field + Js apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesMinifyValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Automatically minify all CSS files for your website. +type ZoneSettingListResponseResultZonesMinifyValueCss string + +const ( + ZoneSettingListResponseResultZonesMinifyValueCssOn ZoneSettingListResponseResultZonesMinifyValueCss = "on" + ZoneSettingListResponseResultZonesMinifyValueCssOff ZoneSettingListResponseResultZonesMinifyValueCss = "off" +) + +// Automatically minify all HTML files for your website. +type ZoneSettingListResponseResultZonesMinifyValueHTML string + +const ( + ZoneSettingListResponseResultZonesMinifyValueHTMLOn ZoneSettingListResponseResultZonesMinifyValueHTML = "on" + ZoneSettingListResponseResultZonesMinifyValueHTMLOff ZoneSettingListResponseResultZonesMinifyValueHTML = "off" +) + +// Automatically minify all JavaScript files for your website. +type ZoneSettingListResponseResultZonesMinifyValueJs string + +const ( + ZoneSettingListResponseResultZonesMinifyValueJsOn ZoneSettingListResponseResultZonesMinifyValueJs = "on" + ZoneSettingListResponseResultZonesMinifyValueJsOff ZoneSettingListResponseResultZonesMinifyValueJs = "off" +) + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to +// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for +// more information. +type ZoneSettingListResponseResultZonesMirage struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesMirageID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesMirageEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesMirageValue `json:"value"` + JSON zoneSettingListResponseResultZonesMirageJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesMirageJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesMirage] +type zoneSettingListResponseResultZonesMirageJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesMirage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesMirage) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesMirageID string + +const ( + ZoneSettingListResponseResultZonesMirageIDMirage ZoneSettingListResponseResultZonesMirageID = "mirage" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesMirageEditable bool + +const ( + ZoneSettingListResponseResultZonesMirageEditableTrue ZoneSettingListResponseResultZonesMirageEditable = true + ZoneSettingListResponseResultZonesMirageEditableFalse ZoneSettingListResponseResultZonesMirageEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesMirageValue string + +const ( + ZoneSettingListResponseResultZonesMirageValueOn ZoneSettingListResponseResultZonesMirageValue = "on" + ZoneSettingListResponseResultZonesMirageValueOff ZoneSettingListResponseResultZonesMirageValue = "off" +) + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +type ZoneSettingListResponseResultZonesMobileRedirect struct { + // Identifier of the zone setting. + ID ZoneSettingListResponseResultZonesMobileRedirectID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesMobileRedirectEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesMobileRedirectValue `json:"value"` + JSON zoneSettingListResponseResultZonesMobileRedirectJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesMobileRedirectJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesMobileRedirect] +type zoneSettingListResponseResultZonesMobileRedirectJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesMobileRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesMobileRedirect) implementsZoneSettingListResponseResult() {} + +// Identifier of the zone setting. +type ZoneSettingListResponseResultZonesMobileRedirectID string + +const ( + ZoneSettingListResponseResultZonesMobileRedirectIDMobileRedirect ZoneSettingListResponseResultZonesMobileRedirectID = "mobile_redirect" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesMobileRedirectEditable bool + +const ( + ZoneSettingListResponseResultZonesMobileRedirectEditableTrue ZoneSettingListResponseResultZonesMobileRedirectEditable = true + ZoneSettingListResponseResultZonesMobileRedirectEditableFalse ZoneSettingListResponseResultZonesMobileRedirectEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesMobileRedirectValue struct { + // Which subdomain prefix you wish to redirect visitors on mobile devices to + // (subdomain must already exist). + MobileSubdomain string `json:"mobile_subdomain,nullable"` + // Whether or not mobile redirect is enabled. + Status ZoneSettingListResponseResultZonesMobileRedirectValueStatus `json:"status"` + // Whether to drop the current page path and redirect to the mobile subdomain URL + // root, or keep the path and redirect to the same page on the mobile subdomain. + StripUri bool `json:"strip_uri"` + JSON zoneSettingListResponseResultZonesMobileRedirectValueJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesMobileRedirectValueJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesMobileRedirectValue] +type zoneSettingListResponseResultZonesMobileRedirectValueJSON struct { + MobileSubdomain apijson.Field + Status apijson.Field + StripUri apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesMobileRedirectValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not mobile redirect is enabled. +type ZoneSettingListResponseResultZonesMobileRedirectValueStatus string + +const ( + ZoneSettingListResponseResultZonesMobileRedirectValueStatusOn ZoneSettingListResponseResultZonesMobileRedirectValueStatus = "on" + ZoneSettingListResponseResultZonesMobileRedirectValueStatusOff ZoneSettingListResponseResultZonesMobileRedirectValueStatus = "off" +) + +// Enable Network Error Logging reporting on your zone. (Beta) +type ZoneSettingListResponseResultZonesNel struct { + // Zone setting identifier. + ID ZoneSettingListResponseResultZonesNelID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesNelEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesNelValue `json:"value"` + JSON zoneSettingListResponseResultZonesNelJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesNelJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesNel] +type zoneSettingListResponseResultZonesNelJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesNel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesNel) implementsZoneSettingListResponseResult() {} + +// Zone setting identifier. +type ZoneSettingListResponseResultZonesNelID string + +const ( + ZoneSettingListResponseResultZonesNelIDNel ZoneSettingListResponseResultZonesNelID = "nel" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesNelEditable bool + +const ( + ZoneSettingListResponseResultZonesNelEditableTrue ZoneSettingListResponseResultZonesNelEditable = true + ZoneSettingListResponseResultZonesNelEditableFalse ZoneSettingListResponseResultZonesNelEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesNelValue struct { + Enabled bool `json:"enabled"` + JSON zoneSettingListResponseResultZonesNelValueJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesNelValueJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesNelValue] +type zoneSettingListResponseResultZonesNelValueJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesNelValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enables the Opportunistic Encryption feature for a zone. +type ZoneSettingListResponseResultZonesOpportunisticEncryption struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesOpportunisticEncryptionID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesOpportunisticEncryptionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value ZoneSettingListResponseResultZonesOpportunisticEncryptionValue `json:"value"` + JSON zoneSettingListResponseResultZonesOpportunisticEncryptionJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesOpportunisticEncryptionJSON contains the JSON +// metadata for the struct +// [ZoneSettingListResponseResultZonesOpportunisticEncryption] +type zoneSettingListResponseResultZonesOpportunisticEncryptionJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesOpportunisticEncryption) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesOpportunisticEncryption) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesOpportunisticEncryptionID string + +const ( + ZoneSettingListResponseResultZonesOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingListResponseResultZonesOpportunisticEncryptionID = "opportunistic_encryption" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesOpportunisticEncryptionEditable bool + +const ( + ZoneSettingListResponseResultZonesOpportunisticEncryptionEditableTrue ZoneSettingListResponseResultZonesOpportunisticEncryptionEditable = true + ZoneSettingListResponseResultZonesOpportunisticEncryptionEditableFalse ZoneSettingListResponseResultZonesOpportunisticEncryptionEditable = false +) + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingListResponseResultZonesOpportunisticEncryptionValue string + +const ( + ZoneSettingListResponseResultZonesOpportunisticEncryptionValueOn ZoneSettingListResponseResultZonesOpportunisticEncryptionValue = "on" + ZoneSettingListResponseResultZonesOpportunisticEncryptionValueOff ZoneSettingListResponseResultZonesOpportunisticEncryptionValue = "off" +) + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +type ZoneSettingListResponseResultZonesOpportunisticOnion struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesOpportunisticOnionID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesOpportunisticOnionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value ZoneSettingListResponseResultZonesOpportunisticOnionValue `json:"value"` + JSON zoneSettingListResponseResultZonesOpportunisticOnionJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesOpportunisticOnionJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesOpportunisticOnion] +type zoneSettingListResponseResultZonesOpportunisticOnionJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesOpportunisticOnion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesOpportunisticOnion) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesOpportunisticOnionID string + +const ( + ZoneSettingListResponseResultZonesOpportunisticOnionIDOpportunisticOnion ZoneSettingListResponseResultZonesOpportunisticOnionID = "opportunistic_onion" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesOpportunisticOnionEditable bool + +const ( + ZoneSettingListResponseResultZonesOpportunisticOnionEditableTrue ZoneSettingListResponseResultZonesOpportunisticOnionEditable = true + ZoneSettingListResponseResultZonesOpportunisticOnionEditableFalse ZoneSettingListResponseResultZonesOpportunisticOnionEditable = false +) + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingListResponseResultZonesOpportunisticOnionValue string + +const ( + ZoneSettingListResponseResultZonesOpportunisticOnionValueOn ZoneSettingListResponseResultZonesOpportunisticOnionValue = "on" + ZoneSettingListResponseResultZonesOpportunisticOnionValueOff ZoneSettingListResponseResultZonesOpportunisticOnionValue = "off" +) + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +type ZoneSettingListResponseResultZonesOrangeToOrange struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesOrangeToOrangeID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesOrangeToOrangeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesOrangeToOrangeValue `json:"value"` + JSON zoneSettingListResponseResultZonesOrangeToOrangeJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesOrangeToOrangeJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesOrangeToOrange] +type zoneSettingListResponseResultZonesOrangeToOrangeJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesOrangeToOrange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesOrangeToOrange) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesOrangeToOrangeID string + +const ( + ZoneSettingListResponseResultZonesOrangeToOrangeIDOrangeToOrange ZoneSettingListResponseResultZonesOrangeToOrangeID = "orange_to_orange" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesOrangeToOrangeEditable bool + +const ( + ZoneSettingListResponseResultZonesOrangeToOrangeEditableTrue ZoneSettingListResponseResultZonesOrangeToOrangeEditable = true + ZoneSettingListResponseResultZonesOrangeToOrangeEditableFalse ZoneSettingListResponseResultZonesOrangeToOrangeEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesOrangeToOrangeValue string + +const ( + ZoneSettingListResponseResultZonesOrangeToOrangeValueOn ZoneSettingListResponseResultZonesOrangeToOrangeValue = "on" + ZoneSettingListResponseResultZonesOrangeToOrangeValueOff ZoneSettingListResponseResultZonesOrangeToOrangeValue = "off" +) + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +type ZoneSettingListResponseResultZonesOriginErrorPagePassThru struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesOriginErrorPagePassThruID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesOriginErrorPagePassThruEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesOriginErrorPagePassThruValue `json:"value"` + JSON zoneSettingListResponseResultZonesOriginErrorPagePassThruJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesOriginErrorPagePassThruJSON contains the JSON +// metadata for the struct +// [ZoneSettingListResponseResultZonesOriginErrorPagePassThru] +type zoneSettingListResponseResultZonesOriginErrorPagePassThruJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesOriginErrorPagePassThru) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesOriginErrorPagePassThru) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesOriginErrorPagePassThruID string + +const ( + ZoneSettingListResponseResultZonesOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingListResponseResultZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesOriginErrorPagePassThruEditable bool + +const ( + ZoneSettingListResponseResultZonesOriginErrorPagePassThruEditableTrue ZoneSettingListResponseResultZonesOriginErrorPagePassThruEditable = true + ZoneSettingListResponseResultZonesOriginErrorPagePassThruEditableFalse ZoneSettingListResponseResultZonesOriginErrorPagePassThruEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesOriginErrorPagePassThruValue string + +const ( + ZoneSettingListResponseResultZonesOriginErrorPagePassThruValueOn ZoneSettingListResponseResultZonesOriginErrorPagePassThruValue = "on" + ZoneSettingListResponseResultZonesOriginErrorPagePassThruValueOff ZoneSettingListResponseResultZonesOriginErrorPagePassThruValue = "off" +) + +type ZoneSettingListResponseResultZonesOriginMaxHTTPVersion struct { + // Identifier of the zone setting. + ID ZoneSettingListResponseResultZonesOriginMaxHTTPVersionID `json:"id,required"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseResultZonesOriginMaxHTTPVersionJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesOriginMaxHTTPVersionJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesOriginMaxHTTPVersion] +type zoneSettingListResponseResultZonesOriginMaxHTTPVersionJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesOriginMaxHTTPVersion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesOriginMaxHTTPVersion) implementsZoneSettingListResponseResult() { +} + +// Identifier of the zone setting. +type ZoneSettingListResponseResultZonesOriginMaxHTTPVersionID string + +const ( + ZoneSettingListResponseResultZonesOriginMaxHTTPVersionIDOriginMaxHTTPVersion ZoneSettingListResponseResultZonesOriginMaxHTTPVersionID = "origin_max_http_version" +) + +// Removes metadata and compresses your images for faster page load times. Basic +// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual +// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster +// image loading. Larger JPEGs are converted to progressive images, loading a +// lower-resolution image first and ending in a higher-resolution version. Not +// recommended for hi-res photography sites. +type ZoneSettingListResponseResultZonesPolish struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesPolishID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesPolishEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesPolishValue `json:"value"` + JSON zoneSettingListResponseResultZonesPolishJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesPolishJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesPolish] +type zoneSettingListResponseResultZonesPolishJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesPolish) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesPolish) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesPolishID string + +const ( + ZoneSettingListResponseResultZonesPolishIDPolish ZoneSettingListResponseResultZonesPolishID = "polish" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesPolishEditable bool + +const ( + ZoneSettingListResponseResultZonesPolishEditableTrue ZoneSettingListResponseResultZonesPolishEditable = true + ZoneSettingListResponseResultZonesPolishEditableFalse ZoneSettingListResponseResultZonesPolishEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesPolishValue string + +const ( + ZoneSettingListResponseResultZonesPolishValueOff ZoneSettingListResponseResultZonesPolishValue = "off" + ZoneSettingListResponseResultZonesPolishValueLossless ZoneSettingListResponseResultZonesPolishValue = "lossless" + ZoneSettingListResponseResultZonesPolishValueLossy ZoneSettingListResponseResultZonesPolishValue = "lossy" +) + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +type ZoneSettingListResponseResultZonesPrefetchPreload struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesPrefetchPreloadID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesPrefetchPreloadEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesPrefetchPreloadValue `json:"value"` + JSON zoneSettingListResponseResultZonesPrefetchPreloadJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesPrefetchPreloadJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesPrefetchPreload] +type zoneSettingListResponseResultZonesPrefetchPreloadJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesPrefetchPreload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesPrefetchPreload) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesPrefetchPreloadID string + +const ( + ZoneSettingListResponseResultZonesPrefetchPreloadIDPrefetchPreload ZoneSettingListResponseResultZonesPrefetchPreloadID = "prefetch_preload" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesPrefetchPreloadEditable bool + +const ( + ZoneSettingListResponseResultZonesPrefetchPreloadEditableTrue ZoneSettingListResponseResultZonesPrefetchPreloadEditable = true + ZoneSettingListResponseResultZonesPrefetchPreloadEditableFalse ZoneSettingListResponseResultZonesPrefetchPreloadEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesPrefetchPreloadValue string + +const ( + ZoneSettingListResponseResultZonesPrefetchPreloadValueOn ZoneSettingListResponseResultZonesPrefetchPreloadValue = "on" + ZoneSettingListResponseResultZonesPrefetchPreloadValueOff ZoneSettingListResponseResultZonesPrefetchPreloadValue = "off" +) + +// Maximum time between two read operations from origin. +type ZoneSettingListResponseResultZonesProxyReadTimeout struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesProxyReadTimeoutID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesProxyReadTimeoutEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Value must be between 1 and 6000 + Value float64 `json:"value"` + JSON zoneSettingListResponseResultZonesProxyReadTimeoutJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesProxyReadTimeoutJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesProxyReadTimeout] +type zoneSettingListResponseResultZonesProxyReadTimeoutJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesProxyReadTimeout) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesProxyReadTimeout) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesProxyReadTimeoutID string + +const ( + ZoneSettingListResponseResultZonesProxyReadTimeoutIDProxyReadTimeout ZoneSettingListResponseResultZonesProxyReadTimeoutID = "proxy_read_timeout" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesProxyReadTimeoutEditable bool + +const ( + ZoneSettingListResponseResultZonesProxyReadTimeoutEditableTrue ZoneSettingListResponseResultZonesProxyReadTimeoutEditable = true + ZoneSettingListResponseResultZonesProxyReadTimeoutEditableFalse ZoneSettingListResponseResultZonesProxyReadTimeoutEditable = false +) + +// The value set for the Pseudo IPv4 setting. +type ZoneSettingListResponseResultZonesPseudoIpv4 struct { + // Value of the Pseudo IPv4 setting. + ID ZoneSettingListResponseResultZonesPseudoIpv4ID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesPseudoIpv4Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the Pseudo IPv4 setting. + Value ZoneSettingListResponseResultZonesPseudoIpv4Value `json:"value"` + JSON zoneSettingListResponseResultZonesPseudoIpv4JSON `json:"-"` +} + +// zoneSettingListResponseResultZonesPseudoIpv4JSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesPseudoIpv4] +type zoneSettingListResponseResultZonesPseudoIpv4JSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesPseudoIpv4) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesPseudoIpv4) implementsZoneSettingListResponseResult() {} + +// Value of the Pseudo IPv4 setting. +type ZoneSettingListResponseResultZonesPseudoIpv4ID string + +const ( + ZoneSettingListResponseResultZonesPseudoIpv4IDPseudoIpv4 ZoneSettingListResponseResultZonesPseudoIpv4ID = "pseudo_ipv4" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesPseudoIpv4Editable bool + +const ( + ZoneSettingListResponseResultZonesPseudoIpv4EditableTrue ZoneSettingListResponseResultZonesPseudoIpv4Editable = true + ZoneSettingListResponseResultZonesPseudoIpv4EditableFalse ZoneSettingListResponseResultZonesPseudoIpv4Editable = false +) + +// Value of the Pseudo IPv4 setting. +type ZoneSettingListResponseResultZonesPseudoIpv4Value string + +const ( + ZoneSettingListResponseResultZonesPseudoIpv4ValueOff ZoneSettingListResponseResultZonesPseudoIpv4Value = "off" + ZoneSettingListResponseResultZonesPseudoIpv4ValueAddHeader ZoneSettingListResponseResultZonesPseudoIpv4Value = "add_header" + ZoneSettingListResponseResultZonesPseudoIpv4ValueOverwriteHeader ZoneSettingListResponseResultZonesPseudoIpv4Value = "overwrite_header" +) + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +type ZoneSettingListResponseResultZonesResponseBuffering struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesResponseBufferingID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesResponseBufferingEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesResponseBufferingValue `json:"value"` + JSON zoneSettingListResponseResultZonesResponseBufferingJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesResponseBufferingJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesResponseBuffering] +type zoneSettingListResponseResultZonesResponseBufferingJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesResponseBuffering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesResponseBuffering) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesResponseBufferingID string + +const ( + ZoneSettingListResponseResultZonesResponseBufferingIDResponseBuffering ZoneSettingListResponseResultZonesResponseBufferingID = "response_buffering" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesResponseBufferingEditable bool + +const ( + ZoneSettingListResponseResultZonesResponseBufferingEditableTrue ZoneSettingListResponseResultZonesResponseBufferingEditable = true + ZoneSettingListResponseResultZonesResponseBufferingEditableFalse ZoneSettingListResponseResultZonesResponseBufferingEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesResponseBufferingValue string + +const ( + ZoneSettingListResponseResultZonesResponseBufferingValueOn ZoneSettingListResponseResultZonesResponseBufferingValue = "on" + ZoneSettingListResponseResultZonesResponseBufferingValueOff ZoneSettingListResponseResultZonesResponseBufferingValue = "off" +) + +// Rocket Loader is a general-purpose asynchronous JavaScript optimisation that +// prioritises rendering your content while loading your site's Javascript +// asynchronously. Turning on Rocket Loader will immediately improve a web page's +// rendering time sometimes measured as Time to First Paint (TTFP), and also the +// `window.onload` time (assuming there is JavaScript on the page). This can have a +// positive impact on your Google search ranking. When turned on, Rocket Loader +// will automatically defer the loading of all Javascript referenced in your HTML, +// with no configuration required. Refer to +// [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) +// for more information. +type ZoneSettingListResponseResultZonesRocketLoader struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesRocketLoaderID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesRocketLoaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesRocketLoaderValue `json:"value"` + JSON zoneSettingListResponseResultZonesRocketLoaderJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesRocketLoaderJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesRocketLoader] +type zoneSettingListResponseResultZonesRocketLoaderJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesRocketLoader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesRocketLoader) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesRocketLoaderID string + +const ( + ZoneSettingListResponseResultZonesRocketLoaderIDRocketLoader ZoneSettingListResponseResultZonesRocketLoaderID = "rocket_loader" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesRocketLoaderEditable bool + +const ( + ZoneSettingListResponseResultZonesRocketLoaderEditableTrue ZoneSettingListResponseResultZonesRocketLoaderEditable = true + ZoneSettingListResponseResultZonesRocketLoaderEditableFalse ZoneSettingListResponseResultZonesRocketLoaderEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesRocketLoaderValue string + +const ( + ZoneSettingListResponseResultZonesRocketLoaderValueOn ZoneSettingListResponseResultZonesRocketLoaderValue = "on" + ZoneSettingListResponseResultZonesRocketLoaderValueOff ZoneSettingListResponseResultZonesRocketLoaderValue = "off" +) + +// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) +// serves your WordPress site from Cloudflare's edge network and caches third-party +// fonts. +type ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimization struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + Value ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationValue `json:"value"` + JSON zoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationJSON +// contains the JSON metadata for the struct +// [ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimization] +type zoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimization) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationID string + +const ( + ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationEditable bool + +const ( + ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationEditable = true + ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationEditable = false +) + +type ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationValue struct { + // Indicates whether or not + // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + // is enabled. + CacheByDeviceType bool `json:"cache_by_device_type,required"` + // Indicates whether or not Cloudflare proxy is enabled. + Cf bool `json:"cf,required"` + // Indicates whether or not Automatic Platform Optimization is enabled. + Enabled bool `json:"enabled,required"` + // An array of hostnames where Automatic Platform Optimization for WordPress is + // activated. + Hostnames []string `json:"hostnames,required" format:"hostname"` + // Indicates whether or not site is powered by WordPress. + Wordpress bool `json:"wordpress,required"` + // Indicates whether or not + // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + // installed. + WpPlugin bool `json:"wp_plugin,required"` + JSON zoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationValueJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationValueJSON +// contains the JSON metadata for the struct +// [ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationValue] +type zoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationValueJSON struct { + CacheByDeviceType apijson.Field + Cf apijson.Field + Enabled apijson.Field + Hostnames apijson.Field + Wordpress apijson.Field + WpPlugin apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSchemasAutomaticPlatformOptimizationValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Cloudflare security header for a zone. +type ZoneSettingListResponseResultZonesSecurityHeader struct { + // ID of the zone's security header. + ID ZoneSettingListResponseResultZonesSecurityHeaderID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesSecurityHeaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + Value ZoneSettingListResponseResultZonesSecurityHeaderValue `json:"value"` + JSON zoneSettingListResponseResultZonesSecurityHeaderJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSecurityHeaderJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesSecurityHeader] +type zoneSettingListResponseResultZonesSecurityHeaderJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSecurityHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesSecurityHeader) implementsZoneSettingListResponseResult() {} + +// ID of the zone's security header. +type ZoneSettingListResponseResultZonesSecurityHeaderID string + +const ( + ZoneSettingListResponseResultZonesSecurityHeaderIDSecurityHeader ZoneSettingListResponseResultZonesSecurityHeaderID = "security_header" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesSecurityHeaderEditable bool + +const ( + ZoneSettingListResponseResultZonesSecurityHeaderEditableTrue ZoneSettingListResponseResultZonesSecurityHeaderEditable = true + ZoneSettingListResponseResultZonesSecurityHeaderEditableFalse ZoneSettingListResponseResultZonesSecurityHeaderEditable = false +) + +type ZoneSettingListResponseResultZonesSecurityHeaderValue struct { + // Strict Transport Security. + StrictTransportSecurity ZoneSettingListResponseResultZonesSecurityHeaderValueStrictTransportSecurity `json:"strict_transport_security"` + JSON zoneSettingListResponseResultZonesSecurityHeaderValueJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSecurityHeaderValueJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesSecurityHeaderValue] +type zoneSettingListResponseResultZonesSecurityHeaderValueJSON struct { + StrictTransportSecurity apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSecurityHeaderValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Strict Transport Security. +type ZoneSettingListResponseResultZonesSecurityHeaderValueStrictTransportSecurity struct { + // Whether or not strict transport security is enabled. + Enabled bool `json:"enabled"` + // Include all subdomains for strict transport security. + IncludeSubdomains bool `json:"include_subdomains"` + // Max age in seconds of the strict transport security. + MaxAge float64 `json:"max_age"` + // Whether or not to include 'X-Content-Type-Options: nosniff' header. + Nosniff bool `json:"nosniff"` + JSON zoneSettingListResponseResultZonesSecurityHeaderValueStrictTransportSecurityJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSecurityHeaderValueStrictTransportSecurityJSON +// contains the JSON metadata for the struct +// [ZoneSettingListResponseResultZonesSecurityHeaderValueStrictTransportSecurity] +type zoneSettingListResponseResultZonesSecurityHeaderValueStrictTransportSecurityJSON struct { + Enabled apijson.Field + IncludeSubdomains apijson.Field + MaxAge apijson.Field + Nosniff apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSecurityHeaderValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +type ZoneSettingListResponseResultZonesSecurityLevel struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesSecurityLevelID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesSecurityLevelEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesSecurityLevelValue `json:"value"` + JSON zoneSettingListResponseResultZonesSecurityLevelJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSecurityLevelJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesSecurityLevel] +type zoneSettingListResponseResultZonesSecurityLevelJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSecurityLevel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesSecurityLevel) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesSecurityLevelID string + +const ( + ZoneSettingListResponseResultZonesSecurityLevelIDSecurityLevel ZoneSettingListResponseResultZonesSecurityLevelID = "security_level" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesSecurityLevelEditable bool + +const ( + ZoneSettingListResponseResultZonesSecurityLevelEditableTrue ZoneSettingListResponseResultZonesSecurityLevelEditable = true + ZoneSettingListResponseResultZonesSecurityLevelEditableFalse ZoneSettingListResponseResultZonesSecurityLevelEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesSecurityLevelValue string + +const ( + ZoneSettingListResponseResultZonesSecurityLevelValueOff ZoneSettingListResponseResultZonesSecurityLevelValue = "off" + ZoneSettingListResponseResultZonesSecurityLevelValueEssentiallyOff ZoneSettingListResponseResultZonesSecurityLevelValue = "essentially_off" + ZoneSettingListResponseResultZonesSecurityLevelValueLow ZoneSettingListResponseResultZonesSecurityLevelValue = "low" + ZoneSettingListResponseResultZonesSecurityLevelValueMedium ZoneSettingListResponseResultZonesSecurityLevelValue = "medium" + ZoneSettingListResponseResultZonesSecurityLevelValueHigh ZoneSettingListResponseResultZonesSecurityLevelValue = "high" + ZoneSettingListResponseResultZonesSecurityLevelValueUnderAttack ZoneSettingListResponseResultZonesSecurityLevelValue = "under_attack" +) + +// If there is sensitive content on your website that you want visible to real +// visitors, but that you want to hide from suspicious visitors, all you have to do +// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to +// be excluded from suspicious visitors in the following SSE tags: +// . For example: Bad visitors won't see my phone +// number, 555-555-5555 . Note: SSE only will work with HTML. If you +// have HTML minification enabled, you won't see the SSE tags in your HTML source +// when it's served through Cloudflare. SSE will still function in this case, as +// Cloudflare's HTML minification and SSE functionality occur on-the-fly as the +// resource moves through our network to the visitor's computer. +// (https://support.cloudflare.com/hc/en-us/articles/200170036). +type ZoneSettingListResponseResultZonesServerSideExclude struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesServerSideExcludeID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesServerSideExcludeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesServerSideExcludeValue `json:"value"` + JSON zoneSettingListResponseResultZonesServerSideExcludeJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesServerSideExcludeJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesServerSideExclude] +type zoneSettingListResponseResultZonesServerSideExcludeJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesServerSideExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesServerSideExclude) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesServerSideExcludeID string + +const ( + ZoneSettingListResponseResultZonesServerSideExcludeIDServerSideExclude ZoneSettingListResponseResultZonesServerSideExcludeID = "server_side_exclude" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesServerSideExcludeEditable bool + +const ( + ZoneSettingListResponseResultZonesServerSideExcludeEditableTrue ZoneSettingListResponseResultZonesServerSideExcludeEditable = true + ZoneSettingListResponseResultZonesServerSideExcludeEditableFalse ZoneSettingListResponseResultZonesServerSideExcludeEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesServerSideExcludeValue string + +const ( + ZoneSettingListResponseResultZonesServerSideExcludeValueOn ZoneSettingListResponseResultZonesServerSideExcludeValue = "on" + ZoneSettingListResponseResultZonesServerSideExcludeValueOff ZoneSettingListResponseResultZonesServerSideExcludeValue = "off" +) + +// Allow SHA1 support. +type ZoneSettingListResponseResultZonesSha1Support struct { + // Zone setting identifier. + ID ZoneSettingListResponseResultZonesSha1SupportID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesSha1SupportEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesSha1SupportValue `json:"value"` + JSON zoneSettingListResponseResultZonesSha1SupportJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSha1SupportJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesSha1Support] +type zoneSettingListResponseResultZonesSha1SupportJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSha1Support) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesSha1Support) implementsZoneSettingListResponseResult() {} + +// Zone setting identifier. +type ZoneSettingListResponseResultZonesSha1SupportID string + +const ( + ZoneSettingListResponseResultZonesSha1SupportIDSha1Support ZoneSettingListResponseResultZonesSha1SupportID = "sha1_support" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesSha1SupportEditable bool + +const ( + ZoneSettingListResponseResultZonesSha1SupportEditableTrue ZoneSettingListResponseResultZonesSha1SupportEditable = true + ZoneSettingListResponseResultZonesSha1SupportEditableFalse ZoneSettingListResponseResultZonesSha1SupportEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesSha1SupportValue string + +const ( + ZoneSettingListResponseResultZonesSha1SupportValueOff ZoneSettingListResponseResultZonesSha1SupportValue = "off" + ZoneSettingListResponseResultZonesSha1SupportValueOn ZoneSettingListResponseResultZonesSha1SupportValue = "on" +) + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +type ZoneSettingListResponseResultZonesSortQueryStringForCache struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesSortQueryStringForCacheID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesSortQueryStringForCacheEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesSortQueryStringForCacheValue `json:"value"` + JSON zoneSettingListResponseResultZonesSortQueryStringForCacheJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSortQueryStringForCacheJSON contains the JSON +// metadata for the struct +// [ZoneSettingListResponseResultZonesSortQueryStringForCache] +type zoneSettingListResponseResultZonesSortQueryStringForCacheJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSortQueryStringForCache) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesSortQueryStringForCache) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesSortQueryStringForCacheID string + +const ( + ZoneSettingListResponseResultZonesSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingListResponseResultZonesSortQueryStringForCacheID = "sort_query_string_for_cache" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesSortQueryStringForCacheEditable bool + +const ( + ZoneSettingListResponseResultZonesSortQueryStringForCacheEditableTrue ZoneSettingListResponseResultZonesSortQueryStringForCacheEditable = true + ZoneSettingListResponseResultZonesSortQueryStringForCacheEditableFalse ZoneSettingListResponseResultZonesSortQueryStringForCacheEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesSortQueryStringForCacheValue string + +const ( + ZoneSettingListResponseResultZonesSortQueryStringForCacheValueOn ZoneSettingListResponseResultZonesSortQueryStringForCacheValue = "on" + ZoneSettingListResponseResultZonesSortQueryStringForCacheValueOff ZoneSettingListResponseResultZonesSortQueryStringForCacheValue = "off" +) + +// SSL encrypts your visitor's connection and safeguards credit card numbers and +// other personal data to and from your website. SSL can take up to 5 minutes to +// fully activate. Requires Cloudflare active on your root domain or www domain. +// Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare +// and your web server (all HTTP traffic). Flexible: SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and +// your web server. You don't need to have an SSL cert on your web server, but your +// vistors will still see the site as being HTTPS enabled. Full: SSL between the +// visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between +// Cloudflare and your web server. You'll need to have your own SSL cert or +// self-signed cert at the very least. Full (Strict): SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and +// your web server. You'll need to have a valid SSL certificate installed on your +// web server. This certificate must be signed by a certificate authority, have an +// expiration date in the future, and respond for the request domain name +// (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). +type ZoneSettingListResponseResultZonesSsl struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesSslID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesSslEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Depends on the zone's plan level + Value ZoneSettingListResponseResultZonesSslValue `json:"value"` + JSON zoneSettingListResponseResultZonesSslJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSslJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesSsl] +type zoneSettingListResponseResultZonesSslJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSsl) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesSsl) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesSslID string + +const ( + ZoneSettingListResponseResultZonesSslIDSsl ZoneSettingListResponseResultZonesSslID = "ssl" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesSslEditable bool + +const ( + ZoneSettingListResponseResultZonesSslEditableTrue ZoneSettingListResponseResultZonesSslEditable = true + ZoneSettingListResponseResultZonesSslEditableFalse ZoneSettingListResponseResultZonesSslEditable = false +) + +// Value of the zone setting. Notes: Depends on the zone's plan level +type ZoneSettingListResponseResultZonesSslValue string + +const ( + ZoneSettingListResponseResultZonesSslValueOff ZoneSettingListResponseResultZonesSslValue = "off" + ZoneSettingListResponseResultZonesSslValueFlexible ZoneSettingListResponseResultZonesSslValue = "flexible" + ZoneSettingListResponseResultZonesSslValueFull ZoneSettingListResponseResultZonesSslValue = "full" + ZoneSettingListResponseResultZonesSslValueStrict ZoneSettingListResponseResultZonesSslValue = "strict" +) + +type ZoneSettingListResponseResultZonesSslRecommender struct { + // Enrollment value for SSL/TLS Recommender. + ID ZoneSettingListResponseResultZonesSslRecommenderID `json:"id"` + // ssl-recommender enrollment setting. + Enabled bool `json:"enabled"` + JSON zoneSettingListResponseResultZonesSslRecommenderJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesSslRecommenderJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesSslRecommender] +type zoneSettingListResponseResultZonesSslRecommenderJSON struct { + ID apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesSslRecommender) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesSslRecommender) implementsZoneSettingListResponseResult() {} + +// Enrollment value for SSL/TLS Recommender. +type ZoneSettingListResponseResultZonesSslRecommenderID string + +const ( + ZoneSettingListResponseResultZonesSslRecommenderIDSslRecommender ZoneSettingListResponseResultZonesSslRecommenderID = "ssl_recommender" +) + +// Only allows TLS1.2. +type ZoneSettingListResponseResultZonesTls1_2Only struct { + // Zone setting identifier. + ID ZoneSettingListResponseResultZonesTls1_2OnlyID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesTls1_2OnlyEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesTls1_2OnlyValue `json:"value"` + JSON zoneSettingListResponseResultZonesTls1_2OnlyJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesTls1_2OnlyJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesTls1_2Only] +type zoneSettingListResponseResultZonesTls1_2OnlyJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesTls1_2Only) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesTls1_2Only) implementsZoneSettingListResponseResult() {} + +// Zone setting identifier. +type ZoneSettingListResponseResultZonesTls1_2OnlyID string + +const ( + ZoneSettingListResponseResultZonesTls1_2OnlyIDTls1_2Only ZoneSettingListResponseResultZonesTls1_2OnlyID = "tls_1_2_only" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesTls1_2OnlyEditable bool + +const ( + ZoneSettingListResponseResultZonesTls1_2OnlyEditableTrue ZoneSettingListResponseResultZonesTls1_2OnlyEditable = true + ZoneSettingListResponseResultZonesTls1_2OnlyEditableFalse ZoneSettingListResponseResultZonesTls1_2OnlyEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesTls1_2OnlyValue string + +const ( + ZoneSettingListResponseResultZonesTls1_2OnlyValueOff ZoneSettingListResponseResultZonesTls1_2OnlyValue = "off" + ZoneSettingListResponseResultZonesTls1_2OnlyValueOn ZoneSettingListResponseResultZonesTls1_2OnlyValue = "on" +) + +// Enables Crypto TLS 1.3 feature for a zone. +type ZoneSettingListResponseResultZonesTls1_3 struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesTls1_3ID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesTls1_3Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value ZoneSettingListResponseResultZonesTls1_3Value `json:"value"` + JSON zoneSettingListResponseResultZonesTls1_3JSON `json:"-"` +} + +// zoneSettingListResponseResultZonesTls1_3JSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesTls1_3] +type zoneSettingListResponseResultZonesTls1_3JSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesTls1_3) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesTls1_3) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesTls1_3ID string + +const ( + ZoneSettingListResponseResultZonesTls1_3IDTls1_3 ZoneSettingListResponseResultZonesTls1_3ID = "tls_1_3" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesTls1_3Editable bool + +const ( + ZoneSettingListResponseResultZonesTls1_3EditableTrue ZoneSettingListResponseResultZonesTls1_3Editable = true + ZoneSettingListResponseResultZonesTls1_3EditableFalse ZoneSettingListResponseResultZonesTls1_3Editable = false +) + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingListResponseResultZonesTls1_3Value string + +const ( + ZoneSettingListResponseResultZonesTls1_3ValueOn ZoneSettingListResponseResultZonesTls1_3Value = "on" + ZoneSettingListResponseResultZonesTls1_3ValueOff ZoneSettingListResponseResultZonesTls1_3Value = "off" + ZoneSettingListResponseResultZonesTls1_3ValueZrt ZoneSettingListResponseResultZonesTls1_3Value = "zrt" +) + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +type ZoneSettingListResponseResultZonesTlsClientAuth struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesTlsClientAuthID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesTlsClientAuthEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // value of the zone setting. + Value ZoneSettingListResponseResultZonesTlsClientAuthValue `json:"value"` + JSON zoneSettingListResponseResultZonesTlsClientAuthJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesTlsClientAuthJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseResultZonesTlsClientAuth] +type zoneSettingListResponseResultZonesTlsClientAuthJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesTlsClientAuth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesTlsClientAuth) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesTlsClientAuthID string + +const ( + ZoneSettingListResponseResultZonesTlsClientAuthIDTlsClientAuth ZoneSettingListResponseResultZonesTlsClientAuthID = "tls_client_auth" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesTlsClientAuthEditable bool + +const ( + ZoneSettingListResponseResultZonesTlsClientAuthEditableTrue ZoneSettingListResponseResultZonesTlsClientAuthEditable = true + ZoneSettingListResponseResultZonesTlsClientAuthEditableFalse ZoneSettingListResponseResultZonesTlsClientAuthEditable = false +) + +// value of the zone setting. +type ZoneSettingListResponseResultZonesTlsClientAuthValue string + +const ( + ZoneSettingListResponseResultZonesTlsClientAuthValueOn ZoneSettingListResponseResultZonesTlsClientAuthValue = "on" + ZoneSettingListResponseResultZonesTlsClientAuthValueOff ZoneSettingListResponseResultZonesTlsClientAuthValue = "off" +) + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +type ZoneSettingListResponseResultZonesTrueClientIPHeader struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesTrueClientIPHeaderID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesTrueClientIPHeaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesTrueClientIPHeaderValue `json:"value"` + JSON zoneSettingListResponseResultZonesTrueClientIPHeaderJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesTrueClientIPHeaderJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseResultZonesTrueClientIPHeader] +type zoneSettingListResponseResultZonesTrueClientIPHeaderJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesTrueClientIPHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesTrueClientIPHeader) implementsZoneSettingListResponseResult() { +} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesTrueClientIPHeaderID string + +const ( + ZoneSettingListResponseResultZonesTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingListResponseResultZonesTrueClientIPHeaderID = "true_client_ip_header" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesTrueClientIPHeaderEditable bool + +const ( + ZoneSettingListResponseResultZonesTrueClientIPHeaderEditableTrue ZoneSettingListResponseResultZonesTrueClientIPHeaderEditable = true + ZoneSettingListResponseResultZonesTrueClientIPHeaderEditableFalse ZoneSettingListResponseResultZonesTrueClientIPHeaderEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesTrueClientIPHeaderValue string + +const ( + ZoneSettingListResponseResultZonesTrueClientIPHeaderValueOn ZoneSettingListResponseResultZonesTrueClientIPHeaderValue = "on" + ZoneSettingListResponseResultZonesTrueClientIPHeaderValueOff ZoneSettingListResponseResultZonesTrueClientIPHeaderValue = "off" +) + +// The WAF examines HTTP requests to your website. It inspects both GET and POST +// requests and applies rules to help filter out illegitimate traffic from +// legitimate website visitors. The Cloudflare WAF inspects website addresses or +// URLs to detect anything out of the ordinary. If the Cloudflare WAF determines +// suspicious user behavior, then the WAF will 'challenge' the web visitor with a +// page that asks them to submit a CAPTCHA successfully to continue their action. +// If the challenge is failed, the action will be stopped. What this means is that +// Cloudflare's WAF will block any traffic identified as illegitimate before it +// reaches your origin web server. +// (https://support.cloudflare.com/hc/en-us/articles/200172016). +type ZoneSettingListResponseResultZonesWaf struct { // ID of the zone setting. - ID ZeroRttID `json:"id"` + ID ZoneSettingListResponseResultZonesWafID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZeroRttEditable `json:"editable"` + Editable ZoneSettingListResponseResultZonesWafEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the 0-RTT setting. - Value ZeroRttValue `json:"value"` - JSON zeroRttJSON `json:"-"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesWafValue `json:"value"` + JSON zoneSettingListResponseResultZonesWafJSON `json:"-"` } -// zeroRttJSON contains the JSON metadata for the struct [ZeroRtt] -type zeroRttJSON struct { +// zoneSettingListResponseResultZonesWafJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesWaf] +type zoneSettingListResponseResultZonesWafJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -173,62 +3483,166 @@ type zeroRttJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZeroRtt) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingListResponseResultZonesWaf) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZeroRtt) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingListResponseResultZonesWaf) implementsZoneSettingListResponseResult() {} // ID of the zone setting. -type ZeroRttID string +type ZoneSettingListResponseResultZonesWafID string const ( - ZeroRttID0rtt ZeroRttID = "0rtt" + ZoneSettingListResponseResultZonesWafIDWaf ZoneSettingListResponseResultZonesWafID = "waf" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZeroRttEditable bool +type ZoneSettingListResponseResultZonesWafEditable bool const ( - ZeroRttEditableTrue ZeroRttEditable = true - ZeroRttEditableFalse ZeroRttEditable = false + ZoneSettingListResponseResultZonesWafEditableTrue ZoneSettingListResponseResultZonesWafEditable = true + ZoneSettingListResponseResultZonesWafEditableFalse ZoneSettingListResponseResultZonesWafEditable = false ) -// 0-RTT session resumption enabled for this zone. -type ZeroRttParam struct { +// Value of the zone setting. +type ZoneSettingListResponseResultZonesWafValue string + +const ( + ZoneSettingListResponseResultZonesWafValueOn ZoneSettingListResponseResultZonesWafValue = "on" + ZoneSettingListResponseResultZonesWafValueOff ZoneSettingListResponseResultZonesWafValue = "off" +) + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +type ZoneSettingListResponseResultZonesWebp struct { // ID of the zone setting. - ID param.Field[ZeroRttID] `json:"id"` - // Value of the 0-RTT setting. - Value param.Field[ZeroRttValue] `json:"value"` + ID ZoneSettingListResponseResultZonesWebpID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesWebpEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesWebpValue `json:"value"` + JSON zoneSettingListResponseResultZonesWebpJSON `json:"-"` } -func (r ZeroRttParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// zoneSettingListResponseResultZonesWebpJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseResultZonesWebp] +type zoneSettingListResponseResultZonesWebpJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r ZeroRttParam) implementsZoneSettingEditParamsItem() {} +func (r *ZoneSettingListResponseResultZonesWebp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} -// Value of the 0-RTT setting. -type ZeroRttValue string +func (r ZoneSettingListResponseResultZonesWebp) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesWebpID string + +const ( + ZoneSettingListResponseResultZonesWebpIDWebp ZoneSettingListResponseResultZonesWebpID = "webp" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesWebpEditable bool + +const ( + ZoneSettingListResponseResultZonesWebpEditableTrue ZoneSettingListResponseResultZonesWebpEditable = true + ZoneSettingListResponseResultZonesWebpEditableFalse ZoneSettingListResponseResultZonesWebpEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesWebpValue string + +const ( + ZoneSettingListResponseResultZonesWebpValueOff ZoneSettingListResponseResultZonesWebpValue = "off" + ZoneSettingListResponseResultZonesWebpValueOn ZoneSettingListResponseResultZonesWebpValue = "on" +) + +// WebSockets are open connections sustained between the client and the origin +// server. Inside a WebSockets connection, the client and the origin can pass data +// back and forth without having to reestablish sessions. This makes exchanging +// data within a WebSockets connection fast. WebSockets are often used for +// real-time applications such as live chat and gaming. For more information refer +// to +// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). +type ZoneSettingListResponseResultZonesWebsockets struct { + // ID of the zone setting. + ID ZoneSettingListResponseResultZonesWebsocketsID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseResultZonesWebsocketsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. + Value ZoneSettingListResponseResultZonesWebsocketsValue `json:"value"` + JSON zoneSettingListResponseResultZonesWebsocketsJSON `json:"-"` +} + +// zoneSettingListResponseResultZonesWebsocketsJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseResultZonesWebsockets] +type zoneSettingListResponseResultZonesWebsocketsJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseResultZonesWebsockets) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseResultZonesWebsockets) implementsZoneSettingListResponseResult() {} + +// ID of the zone setting. +type ZoneSettingListResponseResultZonesWebsocketsID string + +const ( + ZoneSettingListResponseResultZonesWebsocketsIDWebsockets ZoneSettingListResponseResultZonesWebsocketsID = "websockets" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseResultZonesWebsocketsEditable bool + +const ( + ZoneSettingListResponseResultZonesWebsocketsEditableTrue ZoneSettingListResponseResultZonesWebsocketsEditable = true + ZoneSettingListResponseResultZonesWebsocketsEditableFalse ZoneSettingListResponseResultZonesWebsocketsEditable = false +) + +// Value of the zone setting. +type ZoneSettingListResponseResultZonesWebsocketsValue string const ( - ZeroRttValueOn ZeroRttValue = "on" - ZeroRttValueOff ZeroRttValue = "off" + ZoneSettingListResponseResultZonesWebsocketsValueOff ZoneSettingListResponseResultZonesWebsocketsValue = "off" + ZoneSettingListResponseResultZonesWebsocketsValueOn ZoneSettingListResponseResultZonesWebsocketsValue = "on" ) -type ZoneSettingsCollection struct { - Errors []ZoneSettingsCollectionError `json:"errors"` - Messages []ZoneSettingsCollectionMessage `json:"messages"` - Result []ZoneSettingsCollectionResult `json:"result"` +type ZoneSettingEditResponse struct { + Errors []ZoneSettingEditResponseError `json:"errors"` + Messages []ZoneSettingEditResponseMessage `json:"messages"` + Result []ZoneSettingEditResponseResult `json:"result"` // Whether the API call was successful - Success bool `json:"success"` - JSON zoneSettingsCollectionJSON `json:"-"` + Success bool `json:"success"` + JSON zoneSettingEditResponseJSON `json:"-"` } -// zoneSettingsCollectionJSON contains the JSON metadata for the struct -// [ZoneSettingsCollection] -type zoneSettingsCollectionJSON struct { +// zoneSettingEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponse] +type zoneSettingEditResponseJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -237,125 +3651,187 @@ type zoneSettingsCollectionJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollection) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZoneSettingsCollectionError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneSettingsCollectionErrorJSON `json:"-"` +type ZoneSettingEditResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEditResponseErrorJSON `json:"-"` } -// zoneSettingsCollectionErrorJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionError] -type zoneSettingsCollectionErrorJSON struct { +// zoneSettingEditResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseError] +type zoneSettingEditResponseErrorJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionError) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZoneSettingsCollectionMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneSettingsCollectionMessageJSON `json:"-"` +type ZoneSettingEditResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEditResponseMessageJSON `json:"-"` } -// zoneSettingsCollectionMessageJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionMessage] -type zoneSettingsCollectionMessageJSON struct { +// zoneSettingEditResponseMessageJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseMessage] +type zoneSettingEditResponseMessageJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionMessage) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseMessage) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // 0-RTT session resumption enabled for this zone. // -// Union satisfied by [ZeroRtt], [ZoneSettingsCollectionResultAdvancedDdos], -// [ZoneSettingsCollectionResultAlwaysOnline], -// [ZoneSettingsCollectionResultAlwaysUseHTTPs], -// [ZoneSettingsCollectionResultAutomaticHTTPsRewrites], -// [ZoneSettingsCollectionResultBrotli], -// [ZoneSettingsCollectionResultBrowserCacheTtl], -// [ZoneSettingsCollectionResultBrowserCheck], -// [ZoneSettingsCollectionResultCacheLevel], -// [ZoneSettingsCollectionResultChallengeTtl], -// [ZoneSettingsCollectionResultCiphers], -// [ZoneSettingsCollectionResultCnameFlattening], -// [ZoneSettingsCollectionResultDevelopmentMode], -// [ZoneSettingsCollectionResultEarlyHints], -// [ZoneSettingsCollectionResultEdgeCacheTtl], -// [ZoneSettingsCollectionResultEmailObfuscation], -// [ZoneSettingsCollectionResultH2Prioritization], -// [ZoneSettingsCollectionResultHotlinkProtection], -// [ZoneSettingsCollectionResultHttp2], [ZoneSettingsCollectionResultHttp3], -// [ZoneSettingsCollectionResultImageResizing], -// [ZoneSettingsCollectionResultIPGeolocation], [ZoneSettingsCollectionResultIpv6], -// [ZoneSettingsCollectionResultMaxUpload], -// [ZoneSettingsCollectionResultMinTlsVersion], -// [ZoneSettingsCollectionResultMinify], [ZoneSettingsCollectionResultMirage], -// [ZoneSettingsCollectionResultMobileRedirect], [ZoneSettingsCollectionResultNel], -// [ZoneSettingsCollectionResultOpportunisticEncryption], -// [ZoneSettingsCollectionResultOpportunisticOnion], -// [ZoneSettingsCollectionResultOrangeToOrange], -// [ZoneSettingsCollectionResultOriginErrorPagePassThru], -// [ZoneSettingsCollectionResultOriginMaxHTTPVersion], -// [ZoneSettingsCollectionResultPolish], -// [ZoneSettingsCollectionResultPrefetchPreload], -// [ZoneSettingsCollectionResultPrivacyPass], -// [ZoneSettingsCollectionResultProxyReadTimeout], -// [ZoneSettingsCollectionResultPseudoIpv4], -// [ZoneSettingsCollectionResultResponseBuffering], -// [ZoneSettingsCollectionResultRocketLoader], -// [ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimization], -// [ZoneSettingsCollectionResultSecurityHeader], -// [ZoneSettingsCollectionResultSecurityLevel], -// [ZoneSettingsCollectionResultServerSideExclude], -// [ZoneSettingsCollectionResultSha1Support], -// [ZoneSettingsCollectionResultSortQueryStringForCache], -// [ZoneSettingsCollectionResultSsl], [ZoneSettingsCollectionResultSslRecommender], -// [ZoneSettingsCollectionResultTls1_2Only], [ZoneSettingsCollectionResultTls1_3], -// [ZoneSettingsCollectionResultTlsClientAuth], -// [ZoneSettingsCollectionResultTrueClientIPHeader], -// [ZoneSettingsCollectionResultWaf], [ZoneSettingsCollectionResultWebp] or -// [ZoneSettingsCollectionResultWebsockets]. -type ZoneSettingsCollectionResult interface { - implementsZoneSettingsCollectionResult() +// Union satisfied by [ZoneSettingEditResponseResultZones0rtt], +// [ZoneSettingEditResponseResultZonesAdvancedDdos], +// [ZoneSettingEditResponseResultZonesAlwaysOnline], +// [ZoneSettingEditResponseResultZonesAlwaysUseHTTPs], +// [ZoneSettingEditResponseResultZonesAutomaticHTTPsRewrites], +// [ZoneSettingEditResponseResultZonesBrotli], +// [ZoneSettingEditResponseResultZonesBrowserCacheTtl], +// [ZoneSettingEditResponseResultZonesBrowserCheck], +// [ZoneSettingEditResponseResultZonesCacheLevel], +// [ZoneSettingEditResponseResultZonesChallengeTtl], +// [ZoneSettingEditResponseResultZonesCiphers], +// [ZoneSettingEditResponseResultZonesCnameFlattening], +// [ZoneSettingEditResponseResultZonesDevelopmentMode], +// [ZoneSettingEditResponseResultZonesEarlyHints], +// [ZoneSettingEditResponseResultZonesEdgeCacheTtl], +// [ZoneSettingEditResponseResultZonesEmailObfuscation], +// [ZoneSettingEditResponseResultZonesH2Prioritization], +// [ZoneSettingEditResponseResultZonesHotlinkProtection], +// [ZoneSettingEditResponseResultZonesHttp2], +// [ZoneSettingEditResponseResultZonesHttp3], +// [ZoneSettingEditResponseResultZonesImageResizing], +// [ZoneSettingEditResponseResultZonesIPGeolocation], +// [ZoneSettingEditResponseResultZonesIpv6], +// [ZoneSettingEditResponseResultZonesMaxUpload], +// [ZoneSettingEditResponseResultZonesMinTlsVersion], +// [ZoneSettingEditResponseResultZonesMinify], +// [ZoneSettingEditResponseResultZonesMirage], +// [ZoneSettingEditResponseResultZonesMobileRedirect], +// [ZoneSettingEditResponseResultZonesNel], +// [ZoneSettingEditResponseResultZonesOpportunisticEncryption], +// [ZoneSettingEditResponseResultZonesOpportunisticOnion], +// [ZoneSettingEditResponseResultZonesOrangeToOrange], +// [ZoneSettingEditResponseResultZonesOriginErrorPagePassThru], +// [ZoneSettingEditResponseResultZonesOriginMaxHTTPVersion], +// [ZoneSettingEditResponseResultZonesPolish], +// [ZoneSettingEditResponseResultZonesPrefetchPreload], +// [ZoneSettingEditResponseResultZonesProxyReadTimeout], +// [ZoneSettingEditResponseResultZonesPseudoIpv4], +// [ZoneSettingEditResponseResultZonesResponseBuffering], +// [ZoneSettingEditResponseResultZonesRocketLoader], +// [ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimization], +// [ZoneSettingEditResponseResultZonesSecurityHeader], +// [ZoneSettingEditResponseResultZonesSecurityLevel], +// [ZoneSettingEditResponseResultZonesServerSideExclude], +// [ZoneSettingEditResponseResultZonesSha1Support], +// [ZoneSettingEditResponseResultZonesSortQueryStringForCache], +// [ZoneSettingEditResponseResultZonesSsl], +// [ZoneSettingEditResponseResultZonesSslRecommender], +// [ZoneSettingEditResponseResultZonesTls1_2Only], +// [ZoneSettingEditResponseResultZonesTls1_3], +// [ZoneSettingEditResponseResultZonesTlsClientAuth], +// [ZoneSettingEditResponseResultZonesTrueClientIPHeader], +// [ZoneSettingEditResponseResultZonesWaf], +// [ZoneSettingEditResponseResultZonesWebp] or +// [ZoneSettingEditResponseResultZonesWebsockets]. +type ZoneSettingEditResponseResult interface { + implementsZoneSettingEditResponseResult() } func init() { - apijson.RegisterUnion(reflect.TypeOf((*ZoneSettingsCollectionResult)(nil)).Elem(), "") + apijson.RegisterUnion(reflect.TypeOf((*ZoneSettingEditResponseResult)(nil)).Elem(), "") +} + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingEditResponseResultZones0rtt struct { + // ID of the zone setting. + ID ZoneSettingEditResponseResultZones0rttID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseResultZones0rttEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the 0-RTT setting. + Value ZoneSettingEditResponseResultZones0rttValue `json:"value"` + JSON zoneSettingEditResponseResultZones0rttJSON `json:"-"` +} + +// zoneSettingEditResponseResultZones0rttJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZones0rtt] +type zoneSettingEditResponseResultZones0rttJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseResultZones0rtt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } +func (r ZoneSettingEditResponseResultZones0rtt) implementsZoneSettingEditResponseResult() {} + +// ID of the zone setting. +type ZoneSettingEditResponseResultZones0rttID string + +const ( + ZoneSettingEditResponseResultZones0rttID0rtt ZoneSettingEditResponseResultZones0rttID = "0rtt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseResultZones0rttEditable bool + +const ( + ZoneSettingEditResponseResultZones0rttEditableTrue ZoneSettingEditResponseResultZones0rttEditable = true + ZoneSettingEditResponseResultZones0rttEditableFalse ZoneSettingEditResponseResultZones0rttEditable = false +) + +// Value of the 0-RTT setting. +type ZoneSettingEditResponseResultZones0rttValue string + +const ( + ZoneSettingEditResponseResultZones0rttValueOn ZoneSettingEditResponseResultZones0rttValue = "on" + ZoneSettingEditResponseResultZones0rttValueOff ZoneSettingEditResponseResultZones0rttValue = "off" +) + // Advanced protection from Distributed Denial of Service (DDoS) attacks on your // website. This is an uneditable value that is 'on' in the case of Business and // Enterprise zones. -type ZoneSettingsCollectionResultAdvancedDdos struct { +type ZoneSettingEditResponseResultZonesAdvancedDdos struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultAdvancedDdosID `json:"id"` + ID ZoneSettingEditResponseResultZonesAdvancedDdosID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultAdvancedDdosEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesAdvancedDdosEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Defaults to on for Business+ plans - Value ZoneSettingsCollectionResultAdvancedDdosValue `json:"value"` - JSON zoneSettingsCollectionResultAdvancedDdosJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesAdvancedDdosValue `json:"value"` + JSON zoneSettingEditResponseResultZonesAdvancedDdosJSON `json:"-"` } -// zoneSettingsCollectionResultAdvancedDdosJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultAdvancedDdos] -type zoneSettingsCollectionResultAdvancedDdosJSON struct { +// zoneSettingEditResponseResultZonesAdvancedDdosJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesAdvancedDdos] +type zoneSettingEditResponseResultZonesAdvancedDdosJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -364,34 +3840,34 @@ type zoneSettingsCollectionResultAdvancedDdosJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultAdvancedDdos) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesAdvancedDdos) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultAdvancedDdos) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesAdvancedDdos) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultAdvancedDdosID string +type ZoneSettingEditResponseResultZonesAdvancedDdosID string const ( - ZoneSettingsCollectionResultAdvancedDdosIDAdvancedDdos ZoneSettingsCollectionResultAdvancedDdosID = "advanced_ddos" + ZoneSettingEditResponseResultZonesAdvancedDdosIDAdvancedDdos ZoneSettingEditResponseResultZonesAdvancedDdosID = "advanced_ddos" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultAdvancedDdosEditable bool +type ZoneSettingEditResponseResultZonesAdvancedDdosEditable bool const ( - ZoneSettingsCollectionResultAdvancedDdosEditableTrue ZoneSettingsCollectionResultAdvancedDdosEditable = true - ZoneSettingsCollectionResultAdvancedDdosEditableFalse ZoneSettingsCollectionResultAdvancedDdosEditable = false + ZoneSettingEditResponseResultZonesAdvancedDdosEditableTrue ZoneSettingEditResponseResultZonesAdvancedDdosEditable = true + ZoneSettingEditResponseResultZonesAdvancedDdosEditableFalse ZoneSettingEditResponseResultZonesAdvancedDdosEditable = false ) // Value of the zone setting. Notes: Defaults to on for Business+ plans -type ZoneSettingsCollectionResultAdvancedDdosValue string +type ZoneSettingEditResponseResultZonesAdvancedDdosValue string const ( - ZoneSettingsCollectionResultAdvancedDdosValueOn ZoneSettingsCollectionResultAdvancedDdosValue = "on" - ZoneSettingsCollectionResultAdvancedDdosValueOff ZoneSettingsCollectionResultAdvancedDdosValue = "off" + ZoneSettingEditResponseResultZonesAdvancedDdosValueOn ZoneSettingEditResponseResultZonesAdvancedDdosValue = "on" + ZoneSettingEditResponseResultZonesAdvancedDdosValueOff ZoneSettingEditResponseResultZonesAdvancedDdosValue = "off" ) // When enabled, Cloudflare serves limited copies of web pages available from the @@ -399,22 +3875,22 @@ const ( // offline. Refer to // [Always Online](https://developers.cloudflare.com/cache/about/always-online) for // more information. -type ZoneSettingsCollectionResultAlwaysOnline struct { +type ZoneSettingEditResponseResultZonesAlwaysOnline struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultAlwaysOnlineID `json:"id"` + ID ZoneSettingEditResponseResultZonesAlwaysOnlineID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultAlwaysOnlineEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesAlwaysOnlineEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultAlwaysOnlineValue `json:"value"` - JSON zoneSettingsCollectionResultAlwaysOnlineJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesAlwaysOnlineValue `json:"value"` + JSON zoneSettingEditResponseResultZonesAlwaysOnlineJSON `json:"-"` } -// zoneSettingsCollectionResultAlwaysOnlineJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultAlwaysOnline] -type zoneSettingsCollectionResultAlwaysOnlineJSON struct { +// zoneSettingEditResponseResultZonesAlwaysOnlineJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesAlwaysOnline] +type zoneSettingEditResponseResultZonesAlwaysOnlineJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -423,55 +3899,55 @@ type zoneSettingsCollectionResultAlwaysOnlineJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultAlwaysOnline) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesAlwaysOnline) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultAlwaysOnline) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesAlwaysOnline) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultAlwaysOnlineID string +type ZoneSettingEditResponseResultZonesAlwaysOnlineID string const ( - ZoneSettingsCollectionResultAlwaysOnlineIDAlwaysOnline ZoneSettingsCollectionResultAlwaysOnlineID = "always_online" + ZoneSettingEditResponseResultZonesAlwaysOnlineIDAlwaysOnline ZoneSettingEditResponseResultZonesAlwaysOnlineID = "always_online" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultAlwaysOnlineEditable bool +type ZoneSettingEditResponseResultZonesAlwaysOnlineEditable bool const ( - ZoneSettingsCollectionResultAlwaysOnlineEditableTrue ZoneSettingsCollectionResultAlwaysOnlineEditable = true - ZoneSettingsCollectionResultAlwaysOnlineEditableFalse ZoneSettingsCollectionResultAlwaysOnlineEditable = false + ZoneSettingEditResponseResultZonesAlwaysOnlineEditableTrue ZoneSettingEditResponseResultZonesAlwaysOnlineEditable = true + ZoneSettingEditResponseResultZonesAlwaysOnlineEditableFalse ZoneSettingEditResponseResultZonesAlwaysOnlineEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultAlwaysOnlineValue string +type ZoneSettingEditResponseResultZonesAlwaysOnlineValue string const ( - ZoneSettingsCollectionResultAlwaysOnlineValueOn ZoneSettingsCollectionResultAlwaysOnlineValue = "on" - ZoneSettingsCollectionResultAlwaysOnlineValueOff ZoneSettingsCollectionResultAlwaysOnlineValue = "off" + ZoneSettingEditResponseResultZonesAlwaysOnlineValueOn ZoneSettingEditResponseResultZonesAlwaysOnlineValue = "on" + ZoneSettingEditResponseResultZonesAlwaysOnlineValueOff ZoneSettingEditResponseResultZonesAlwaysOnlineValue = "off" ) // Reply to all requests for URLs that use "http" with a 301 redirect to the // equivalent "https" URL. If you only want to redirect for a subset of requests, // consider creating an "Always use HTTPS" page rule. -type ZoneSettingsCollectionResultAlwaysUseHTTPs struct { +type ZoneSettingEditResponseResultZonesAlwaysUseHTTPs struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultAlwaysUseHTTPsID `json:"id"` + ID ZoneSettingEditResponseResultZonesAlwaysUseHTTPsID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultAlwaysUseHTTPsEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesAlwaysUseHTTPsEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultAlwaysUseHTTPsValue `json:"value"` - JSON zoneSettingsCollectionResultAlwaysUseHTTPsJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesAlwaysUseHTTPsValue `json:"value"` + JSON zoneSettingEditResponseResultZonesAlwaysUseHTTPsJSON `json:"-"` } -// zoneSettingsCollectionResultAlwaysUseHTTPsJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultAlwaysUseHTTPs] -type zoneSettingsCollectionResultAlwaysUseHTTPsJSON struct { +// zoneSettingEditResponseResultZonesAlwaysUseHTTPsJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesAlwaysUseHTTPs] +type zoneSettingEditResponseResultZonesAlwaysUseHTTPsJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -480,54 +3956,55 @@ type zoneSettingsCollectionResultAlwaysUseHTTPsJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultAlwaysUseHTTPs) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesAlwaysUseHTTPs) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultAlwaysUseHTTPs) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesAlwaysUseHTTPs) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultAlwaysUseHTTPsID string +type ZoneSettingEditResponseResultZonesAlwaysUseHTTPsID string const ( - ZoneSettingsCollectionResultAlwaysUseHTTPsIDAlwaysUseHTTPs ZoneSettingsCollectionResultAlwaysUseHTTPsID = "always_use_https" + ZoneSettingEditResponseResultZonesAlwaysUseHTTPsIDAlwaysUseHTTPs ZoneSettingEditResponseResultZonesAlwaysUseHTTPsID = "always_use_https" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultAlwaysUseHTTPsEditable bool +type ZoneSettingEditResponseResultZonesAlwaysUseHTTPsEditable bool const ( - ZoneSettingsCollectionResultAlwaysUseHTTPsEditableTrue ZoneSettingsCollectionResultAlwaysUseHTTPsEditable = true - ZoneSettingsCollectionResultAlwaysUseHTTPsEditableFalse ZoneSettingsCollectionResultAlwaysUseHTTPsEditable = false + ZoneSettingEditResponseResultZonesAlwaysUseHTTPsEditableTrue ZoneSettingEditResponseResultZonesAlwaysUseHTTPsEditable = true + ZoneSettingEditResponseResultZonesAlwaysUseHTTPsEditableFalse ZoneSettingEditResponseResultZonesAlwaysUseHTTPsEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultAlwaysUseHTTPsValue string +type ZoneSettingEditResponseResultZonesAlwaysUseHTTPsValue string const ( - ZoneSettingsCollectionResultAlwaysUseHTTPsValueOn ZoneSettingsCollectionResultAlwaysUseHTTPsValue = "on" - ZoneSettingsCollectionResultAlwaysUseHTTPsValueOff ZoneSettingsCollectionResultAlwaysUseHTTPsValue = "off" + ZoneSettingEditResponseResultZonesAlwaysUseHTTPsValueOn ZoneSettingEditResponseResultZonesAlwaysUseHTTPsValue = "on" + ZoneSettingEditResponseResultZonesAlwaysUseHTTPsValueOff ZoneSettingEditResponseResultZonesAlwaysUseHTTPsValue = "off" ) // Enable the Automatic HTTPS Rewrites feature for this zone. -type ZoneSettingsCollectionResultAutomaticHTTPsRewrites struct { +type ZoneSettingEditResponseResultZonesAutomaticHTTPsRewrites struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultAutomaticHTTPsRewritesID `json:"id"` + ID ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultAutomaticHTTPsRewritesEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value ZoneSettingsCollectionResultAutomaticHTTPsRewritesValue `json:"value"` - JSON zoneSettingsCollectionResultAutomaticHTTPsRewritesJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesValue `json:"value"` + JSON zoneSettingEditResponseResultZonesAutomaticHTTPsRewritesJSON `json:"-"` } -// zoneSettingsCollectionResultAutomaticHTTPsRewritesJSON contains the JSON -// metadata for the struct [ZoneSettingsCollectionResultAutomaticHTTPsRewrites] -type zoneSettingsCollectionResultAutomaticHTTPsRewritesJSON struct { +// zoneSettingEditResponseResultZonesAutomaticHTTPsRewritesJSON contains the JSON +// metadata for the struct +// [ZoneSettingEditResponseResultZonesAutomaticHTTPsRewrites] +type zoneSettingEditResponseResultZonesAutomaticHTTPsRewritesJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -536,56 +4013,56 @@ type zoneSettingsCollectionResultAutomaticHTTPsRewritesJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultAutomaticHTTPsRewrites) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesAutomaticHTTPsRewrites) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultAutomaticHTTPsRewrites) implementsZoneSettingsCollectionResult() { +func (r ZoneSettingEditResponseResultZonesAutomaticHTTPsRewrites) implementsZoneSettingEditResponseResult() { } // ID of the zone setting. -type ZoneSettingsCollectionResultAutomaticHTTPsRewritesID string +type ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesID string const ( - ZoneSettingsCollectionResultAutomaticHTTPsRewritesIDAutomaticHTTPsRewrites ZoneSettingsCollectionResultAutomaticHTTPsRewritesID = "automatic_https_rewrites" + ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesIDAutomaticHTTPsRewrites ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesID = "automatic_https_rewrites" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultAutomaticHTTPsRewritesEditable bool +type ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesEditable bool const ( - ZoneSettingsCollectionResultAutomaticHTTPsRewritesEditableTrue ZoneSettingsCollectionResultAutomaticHTTPsRewritesEditable = true - ZoneSettingsCollectionResultAutomaticHTTPsRewritesEditableFalse ZoneSettingsCollectionResultAutomaticHTTPsRewritesEditable = false + ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesEditableTrue ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesEditable = true + ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesEditableFalse ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesEditable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingsCollectionResultAutomaticHTTPsRewritesValue string +type ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesValue string const ( - ZoneSettingsCollectionResultAutomaticHTTPsRewritesValueOn ZoneSettingsCollectionResultAutomaticHTTPsRewritesValue = "on" - ZoneSettingsCollectionResultAutomaticHTTPsRewritesValueOff ZoneSettingsCollectionResultAutomaticHTTPsRewritesValue = "off" + ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesValueOn ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesValue = "on" + ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesValueOff ZoneSettingEditResponseResultZonesAutomaticHTTPsRewritesValue = "off" ) // When the client requesting an asset supports the Brotli compression algorithm, // Cloudflare will serve a Brotli compressed version of the asset. -type ZoneSettingsCollectionResultBrotli struct { +type ZoneSettingEditResponseResultZonesBrotli struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultBrotliID `json:"id"` + ID ZoneSettingEditResponseResultZonesBrotliID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultBrotliEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesBrotliEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultBrotliValue `json:"value"` - JSON zoneSettingsCollectionResultBrotliJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesBrotliValue `json:"value"` + JSON zoneSettingEditResponseResultZonesBrotliJSON `json:"-"` } -// zoneSettingsCollectionResultBrotliJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultBrotli] -type zoneSettingsCollectionResultBrotliJSON struct { +// zoneSettingEditResponseResultZonesBrotliJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesBrotli] +type zoneSettingEditResponseResultZonesBrotliJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -594,57 +4071,57 @@ type zoneSettingsCollectionResultBrotliJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultBrotli) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesBrotli) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultBrotli) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesBrotli) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultBrotliID string +type ZoneSettingEditResponseResultZonesBrotliID string const ( - ZoneSettingsCollectionResultBrotliIDBrotli ZoneSettingsCollectionResultBrotliID = "brotli" + ZoneSettingEditResponseResultZonesBrotliIDBrotli ZoneSettingEditResponseResultZonesBrotliID = "brotli" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultBrotliEditable bool +type ZoneSettingEditResponseResultZonesBrotliEditable bool const ( - ZoneSettingsCollectionResultBrotliEditableTrue ZoneSettingsCollectionResultBrotliEditable = true - ZoneSettingsCollectionResultBrotliEditableFalse ZoneSettingsCollectionResultBrotliEditable = false + ZoneSettingEditResponseResultZonesBrotliEditableTrue ZoneSettingEditResponseResultZonesBrotliEditable = true + ZoneSettingEditResponseResultZonesBrotliEditableFalse ZoneSettingEditResponseResultZonesBrotliEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultBrotliValue string +type ZoneSettingEditResponseResultZonesBrotliValue string const ( - ZoneSettingsCollectionResultBrotliValueOff ZoneSettingsCollectionResultBrotliValue = "off" - ZoneSettingsCollectionResultBrotliValueOn ZoneSettingsCollectionResultBrotliValue = "on" + ZoneSettingEditResponseResultZonesBrotliValueOff ZoneSettingEditResponseResultZonesBrotliValue = "off" + ZoneSettingEditResponseResultZonesBrotliValueOn ZoneSettingEditResponseResultZonesBrotliValue = "on" ) // Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources // will remain on your visitors' computers. Cloudflare will honor any larger times // specified by your server. // (https://support.cloudflare.com/hc/en-us/articles/200168276). -type ZoneSettingsCollectionResultBrowserCacheTtl struct { +type ZoneSettingEditResponseResultZonesBrowserCacheTtl struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultBrowserCacheTtlID `json:"id"` + ID ZoneSettingEditResponseResultZonesBrowserCacheTtlID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultBrowserCacheTtlEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesBrowserCacheTtlEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting // `Respect Existing Headers` - Value ZoneSettingsCollectionResultBrowserCacheTtlValue `json:"value"` - JSON zoneSettingsCollectionResultBrowserCacheTtlJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesBrowserCacheTtlValue `json:"value"` + JSON zoneSettingEditResponseResultZonesBrowserCacheTtlJSON `json:"-"` } -// zoneSettingsCollectionResultBrowserCacheTtlJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultBrowserCacheTtl] -type zoneSettingsCollectionResultBrowserCacheTtlJSON struct { +// zoneSettingEditResponseResultZonesBrowserCacheTtlJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesBrowserCacheTtl] +type zoneSettingEditResponseResultZonesBrowserCacheTtlJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -653,61 +4130,62 @@ type zoneSettingsCollectionResultBrowserCacheTtlJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultBrowserCacheTtl) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesBrowserCacheTtl) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultBrowserCacheTtl) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesBrowserCacheTtl) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultBrowserCacheTtlID string +type ZoneSettingEditResponseResultZonesBrowserCacheTtlID string const ( - ZoneSettingsCollectionResultBrowserCacheTtlIDBrowserCacheTtl ZoneSettingsCollectionResultBrowserCacheTtlID = "browser_cache_ttl" + ZoneSettingEditResponseResultZonesBrowserCacheTtlIDBrowserCacheTtl ZoneSettingEditResponseResultZonesBrowserCacheTtlID = "browser_cache_ttl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultBrowserCacheTtlEditable bool +type ZoneSettingEditResponseResultZonesBrowserCacheTtlEditable bool const ( - ZoneSettingsCollectionResultBrowserCacheTtlEditableTrue ZoneSettingsCollectionResultBrowserCacheTtlEditable = true - ZoneSettingsCollectionResultBrowserCacheTtlEditableFalse ZoneSettingsCollectionResultBrowserCacheTtlEditable = false + ZoneSettingEditResponseResultZonesBrowserCacheTtlEditableTrue ZoneSettingEditResponseResultZonesBrowserCacheTtlEditable = true + ZoneSettingEditResponseResultZonesBrowserCacheTtlEditableFalse ZoneSettingEditResponseResultZonesBrowserCacheTtlEditable = false ) // Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting // `Respect Existing Headers` -type ZoneSettingsCollectionResultBrowserCacheTtlValue float64 - -const ( - ZoneSettingsCollectionResultBrowserCacheTtlValue0 ZoneSettingsCollectionResultBrowserCacheTtlValue = 0 - ZoneSettingsCollectionResultBrowserCacheTtlValue30 ZoneSettingsCollectionResultBrowserCacheTtlValue = 30 - ZoneSettingsCollectionResultBrowserCacheTtlValue60 ZoneSettingsCollectionResultBrowserCacheTtlValue = 60 - ZoneSettingsCollectionResultBrowserCacheTtlValue120 ZoneSettingsCollectionResultBrowserCacheTtlValue = 120 - ZoneSettingsCollectionResultBrowserCacheTtlValue300 ZoneSettingsCollectionResultBrowserCacheTtlValue = 300 - ZoneSettingsCollectionResultBrowserCacheTtlValue1200 ZoneSettingsCollectionResultBrowserCacheTtlValue = 1200 - ZoneSettingsCollectionResultBrowserCacheTtlValue1800 ZoneSettingsCollectionResultBrowserCacheTtlValue = 1800 - ZoneSettingsCollectionResultBrowserCacheTtlValue3600 ZoneSettingsCollectionResultBrowserCacheTtlValue = 3600 - ZoneSettingsCollectionResultBrowserCacheTtlValue7200 ZoneSettingsCollectionResultBrowserCacheTtlValue = 7200 - ZoneSettingsCollectionResultBrowserCacheTtlValue10800 ZoneSettingsCollectionResultBrowserCacheTtlValue = 10800 - ZoneSettingsCollectionResultBrowserCacheTtlValue14400 ZoneSettingsCollectionResultBrowserCacheTtlValue = 14400 - ZoneSettingsCollectionResultBrowserCacheTtlValue18000 ZoneSettingsCollectionResultBrowserCacheTtlValue = 18000 - ZoneSettingsCollectionResultBrowserCacheTtlValue28800 ZoneSettingsCollectionResultBrowserCacheTtlValue = 28800 - ZoneSettingsCollectionResultBrowserCacheTtlValue43200 ZoneSettingsCollectionResultBrowserCacheTtlValue = 43200 - ZoneSettingsCollectionResultBrowserCacheTtlValue57600 ZoneSettingsCollectionResultBrowserCacheTtlValue = 57600 - ZoneSettingsCollectionResultBrowserCacheTtlValue72000 ZoneSettingsCollectionResultBrowserCacheTtlValue = 72000 - ZoneSettingsCollectionResultBrowserCacheTtlValue86400 ZoneSettingsCollectionResultBrowserCacheTtlValue = 86400 - ZoneSettingsCollectionResultBrowserCacheTtlValue172800 ZoneSettingsCollectionResultBrowserCacheTtlValue = 172800 - ZoneSettingsCollectionResultBrowserCacheTtlValue259200 ZoneSettingsCollectionResultBrowserCacheTtlValue = 259200 - ZoneSettingsCollectionResultBrowserCacheTtlValue345600 ZoneSettingsCollectionResultBrowserCacheTtlValue = 345600 - ZoneSettingsCollectionResultBrowserCacheTtlValue432000 ZoneSettingsCollectionResultBrowserCacheTtlValue = 432000 - ZoneSettingsCollectionResultBrowserCacheTtlValue691200 ZoneSettingsCollectionResultBrowserCacheTtlValue = 691200 - ZoneSettingsCollectionResultBrowserCacheTtlValue1382400 ZoneSettingsCollectionResultBrowserCacheTtlValue = 1382400 - ZoneSettingsCollectionResultBrowserCacheTtlValue2073600 ZoneSettingsCollectionResultBrowserCacheTtlValue = 2073600 - ZoneSettingsCollectionResultBrowserCacheTtlValue2678400 ZoneSettingsCollectionResultBrowserCacheTtlValue = 2678400 - ZoneSettingsCollectionResultBrowserCacheTtlValue5356800 ZoneSettingsCollectionResultBrowserCacheTtlValue = 5356800 - ZoneSettingsCollectionResultBrowserCacheTtlValue16070400 ZoneSettingsCollectionResultBrowserCacheTtlValue = 16070400 - ZoneSettingsCollectionResultBrowserCacheTtlValue31536000 ZoneSettingsCollectionResultBrowserCacheTtlValue = 31536000 +type ZoneSettingEditResponseResultZonesBrowserCacheTtlValue float64 + +const ( + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue0 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 0 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue30 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 30 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue60 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 60 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue120 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 120 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue300 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 300 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue1200 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 1200 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue1800 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 1800 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue3600 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 3600 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue7200 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 7200 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue10800 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 10800 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue14400 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 14400 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue18000 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 18000 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue28800 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 28800 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue43200 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 43200 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue57600 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 57600 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue72000 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 72000 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue86400 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 86400 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue172800 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 172800 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue259200 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 259200 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue345600 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 345600 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue432000 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 432000 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue691200 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 691200 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue1382400 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 1382400 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue2073600 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 2073600 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue2678400 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 2678400 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue5356800 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 5356800 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue16070400 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 16070400 + ZoneSettingEditResponseResultZonesBrowserCacheTtlValue31536000 ZoneSettingEditResponseResultZonesBrowserCacheTtlValue = 31536000 ) // Browser Integrity Check is similar to Bad Behavior and looks for common HTTP @@ -715,22 +4193,22 @@ const ( // also challenge visitors that do not have a user agent or a non standard user // agent (also commonly used by abuse bots, crawlers or visitors). // (https://support.cloudflare.com/hc/en-us/articles/200170086). -type ZoneSettingsCollectionResultBrowserCheck struct { +type ZoneSettingEditResponseResultZonesBrowserCheck struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultBrowserCheckID `json:"id"` + ID ZoneSettingEditResponseResultZonesBrowserCheckID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultBrowserCheckEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesBrowserCheckEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultBrowserCheckValue `json:"value"` - JSON zoneSettingsCollectionResultBrowserCheckJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesBrowserCheckValue `json:"value"` + JSON zoneSettingEditResponseResultZonesBrowserCheckJSON `json:"-"` } -// zoneSettingsCollectionResultBrowserCheckJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultBrowserCheck] -type zoneSettingsCollectionResultBrowserCheckJSON struct { +// zoneSettingEditResponseResultZonesBrowserCheckJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesBrowserCheck] +type zoneSettingEditResponseResultZonesBrowserCheckJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -739,34 +4217,34 @@ type zoneSettingsCollectionResultBrowserCheckJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultBrowserCheck) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesBrowserCheck) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultBrowserCheck) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesBrowserCheck) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultBrowserCheckID string +type ZoneSettingEditResponseResultZonesBrowserCheckID string const ( - ZoneSettingsCollectionResultBrowserCheckIDBrowserCheck ZoneSettingsCollectionResultBrowserCheckID = "browser_check" + ZoneSettingEditResponseResultZonesBrowserCheckIDBrowserCheck ZoneSettingEditResponseResultZonesBrowserCheckID = "browser_check" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultBrowserCheckEditable bool +type ZoneSettingEditResponseResultZonesBrowserCheckEditable bool const ( - ZoneSettingsCollectionResultBrowserCheckEditableTrue ZoneSettingsCollectionResultBrowserCheckEditable = true - ZoneSettingsCollectionResultBrowserCheckEditableFalse ZoneSettingsCollectionResultBrowserCheckEditable = false + ZoneSettingEditResponseResultZonesBrowserCheckEditableTrue ZoneSettingEditResponseResultZonesBrowserCheckEditable = true + ZoneSettingEditResponseResultZonesBrowserCheckEditableFalse ZoneSettingEditResponseResultZonesBrowserCheckEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultBrowserCheckValue string +type ZoneSettingEditResponseResultZonesBrowserCheckValue string const ( - ZoneSettingsCollectionResultBrowserCheckValueOn ZoneSettingsCollectionResultBrowserCheckValue = "on" - ZoneSettingsCollectionResultBrowserCheckValueOff ZoneSettingsCollectionResultBrowserCheckValue = "off" + ZoneSettingEditResponseResultZonesBrowserCheckValueOn ZoneSettingEditResponseResultZonesBrowserCheckValue = "on" + ZoneSettingEditResponseResultZonesBrowserCheckValueOff ZoneSettingEditResponseResultZonesBrowserCheckValue = "off" ) // Cache Level functions based off the setting level. The basic setting will cache @@ -774,22 +4252,22 @@ const ( // setting will ignore the query string when delivering a cached resource. The // aggressive setting will cache all static resources, including ones with a query // string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -type ZoneSettingsCollectionResultCacheLevel struct { +type ZoneSettingEditResponseResultZonesCacheLevel struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultCacheLevelID `json:"id"` + ID ZoneSettingEditResponseResultZonesCacheLevelID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultCacheLevelEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesCacheLevelEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultCacheLevelValue `json:"value"` - JSON zoneSettingsCollectionResultCacheLevelJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesCacheLevelValue `json:"value"` + JSON zoneSettingEditResponseResultZonesCacheLevelJSON `json:"-"` } -// zoneSettingsCollectionResultCacheLevelJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultCacheLevel] -type zoneSettingsCollectionResultCacheLevelJSON struct { +// zoneSettingEditResponseResultZonesCacheLevelJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesCacheLevel] +type zoneSettingEditResponseResultZonesCacheLevelJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -798,35 +4276,35 @@ type zoneSettingsCollectionResultCacheLevelJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultCacheLevel) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesCacheLevel) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultCacheLevel) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesCacheLevel) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultCacheLevelID string +type ZoneSettingEditResponseResultZonesCacheLevelID string const ( - ZoneSettingsCollectionResultCacheLevelIDCacheLevel ZoneSettingsCollectionResultCacheLevelID = "cache_level" + ZoneSettingEditResponseResultZonesCacheLevelIDCacheLevel ZoneSettingEditResponseResultZonesCacheLevelID = "cache_level" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultCacheLevelEditable bool +type ZoneSettingEditResponseResultZonesCacheLevelEditable bool const ( - ZoneSettingsCollectionResultCacheLevelEditableTrue ZoneSettingsCollectionResultCacheLevelEditable = true - ZoneSettingsCollectionResultCacheLevelEditableFalse ZoneSettingsCollectionResultCacheLevelEditable = false + ZoneSettingEditResponseResultZonesCacheLevelEditableTrue ZoneSettingEditResponseResultZonesCacheLevelEditable = true + ZoneSettingEditResponseResultZonesCacheLevelEditableFalse ZoneSettingEditResponseResultZonesCacheLevelEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultCacheLevelValue string +type ZoneSettingEditResponseResultZonesCacheLevelValue string const ( - ZoneSettingsCollectionResultCacheLevelValueAggressive ZoneSettingsCollectionResultCacheLevelValue = "aggressive" - ZoneSettingsCollectionResultCacheLevelValueBasic ZoneSettingsCollectionResultCacheLevelValue = "basic" - ZoneSettingsCollectionResultCacheLevelValueSimplified ZoneSettingsCollectionResultCacheLevelValue = "simplified" + ZoneSettingEditResponseResultZonesCacheLevelValueAggressive ZoneSettingEditResponseResultZonesCacheLevelValue = "aggressive" + ZoneSettingEditResponseResultZonesCacheLevelValueBasic ZoneSettingEditResponseResultZonesCacheLevelValue = "basic" + ZoneSettingEditResponseResultZonesCacheLevelValueSimplified ZoneSettingEditResponseResultZonesCacheLevelValue = "simplified" ) // Specify how long a visitor is allowed access to your site after successfully @@ -834,22 +4312,22 @@ const ( // visitor will have to complete a new challenge. We recommend a 15 - 45 minute // setting and will attempt to honor any setting above 45 minutes. // (https://support.cloudflare.com/hc/en-us/articles/200170136). -type ZoneSettingsCollectionResultChallengeTtl struct { +type ZoneSettingEditResponseResultZonesChallengeTtl struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultChallengeTtlID `json:"id"` + ID ZoneSettingEditResponseResultZonesChallengeTtlID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultChallengeTtlEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesChallengeTtlEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultChallengeTtlValue `json:"value"` - JSON zoneSettingsCollectionResultChallengeTtlJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesChallengeTtlValue `json:"value"` + JSON zoneSettingEditResponseResultZonesChallengeTtlJSON `json:"-"` } -// zoneSettingsCollectionResultChallengeTtlJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultChallengeTtl] -type zoneSettingsCollectionResultChallengeTtlJSON struct { +// zoneSettingEditResponseResultZonesChallengeTtlJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesChallengeTtl] +type zoneSettingEditResponseResultZonesChallengeTtlJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -858,66 +4336,66 @@ type zoneSettingsCollectionResultChallengeTtlJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultChallengeTtl) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesChallengeTtl) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultChallengeTtl) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesChallengeTtl) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultChallengeTtlID string +type ZoneSettingEditResponseResultZonesChallengeTtlID string const ( - ZoneSettingsCollectionResultChallengeTtlIDChallengeTtl ZoneSettingsCollectionResultChallengeTtlID = "challenge_ttl" + ZoneSettingEditResponseResultZonesChallengeTtlIDChallengeTtl ZoneSettingEditResponseResultZonesChallengeTtlID = "challenge_ttl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultChallengeTtlEditable bool +type ZoneSettingEditResponseResultZonesChallengeTtlEditable bool const ( - ZoneSettingsCollectionResultChallengeTtlEditableTrue ZoneSettingsCollectionResultChallengeTtlEditable = true - ZoneSettingsCollectionResultChallengeTtlEditableFalse ZoneSettingsCollectionResultChallengeTtlEditable = false + ZoneSettingEditResponseResultZonesChallengeTtlEditableTrue ZoneSettingEditResponseResultZonesChallengeTtlEditable = true + ZoneSettingEditResponseResultZonesChallengeTtlEditableFalse ZoneSettingEditResponseResultZonesChallengeTtlEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultChallengeTtlValue float64 +type ZoneSettingEditResponseResultZonesChallengeTtlValue float64 const ( - ZoneSettingsCollectionResultChallengeTtlValue300 ZoneSettingsCollectionResultChallengeTtlValue = 300 - ZoneSettingsCollectionResultChallengeTtlValue900 ZoneSettingsCollectionResultChallengeTtlValue = 900 - ZoneSettingsCollectionResultChallengeTtlValue1800 ZoneSettingsCollectionResultChallengeTtlValue = 1800 - ZoneSettingsCollectionResultChallengeTtlValue2700 ZoneSettingsCollectionResultChallengeTtlValue = 2700 - ZoneSettingsCollectionResultChallengeTtlValue3600 ZoneSettingsCollectionResultChallengeTtlValue = 3600 - ZoneSettingsCollectionResultChallengeTtlValue7200 ZoneSettingsCollectionResultChallengeTtlValue = 7200 - ZoneSettingsCollectionResultChallengeTtlValue10800 ZoneSettingsCollectionResultChallengeTtlValue = 10800 - ZoneSettingsCollectionResultChallengeTtlValue14400 ZoneSettingsCollectionResultChallengeTtlValue = 14400 - ZoneSettingsCollectionResultChallengeTtlValue28800 ZoneSettingsCollectionResultChallengeTtlValue = 28800 - ZoneSettingsCollectionResultChallengeTtlValue57600 ZoneSettingsCollectionResultChallengeTtlValue = 57600 - ZoneSettingsCollectionResultChallengeTtlValue86400 ZoneSettingsCollectionResultChallengeTtlValue = 86400 - ZoneSettingsCollectionResultChallengeTtlValue604800 ZoneSettingsCollectionResultChallengeTtlValue = 604800 - ZoneSettingsCollectionResultChallengeTtlValue2592000 ZoneSettingsCollectionResultChallengeTtlValue = 2592000 - ZoneSettingsCollectionResultChallengeTtlValue31536000 ZoneSettingsCollectionResultChallengeTtlValue = 31536000 + ZoneSettingEditResponseResultZonesChallengeTtlValue300 ZoneSettingEditResponseResultZonesChallengeTtlValue = 300 + ZoneSettingEditResponseResultZonesChallengeTtlValue900 ZoneSettingEditResponseResultZonesChallengeTtlValue = 900 + ZoneSettingEditResponseResultZonesChallengeTtlValue1800 ZoneSettingEditResponseResultZonesChallengeTtlValue = 1800 + ZoneSettingEditResponseResultZonesChallengeTtlValue2700 ZoneSettingEditResponseResultZonesChallengeTtlValue = 2700 + ZoneSettingEditResponseResultZonesChallengeTtlValue3600 ZoneSettingEditResponseResultZonesChallengeTtlValue = 3600 + ZoneSettingEditResponseResultZonesChallengeTtlValue7200 ZoneSettingEditResponseResultZonesChallengeTtlValue = 7200 + ZoneSettingEditResponseResultZonesChallengeTtlValue10800 ZoneSettingEditResponseResultZonesChallengeTtlValue = 10800 + ZoneSettingEditResponseResultZonesChallengeTtlValue14400 ZoneSettingEditResponseResultZonesChallengeTtlValue = 14400 + ZoneSettingEditResponseResultZonesChallengeTtlValue28800 ZoneSettingEditResponseResultZonesChallengeTtlValue = 28800 + ZoneSettingEditResponseResultZonesChallengeTtlValue57600 ZoneSettingEditResponseResultZonesChallengeTtlValue = 57600 + ZoneSettingEditResponseResultZonesChallengeTtlValue86400 ZoneSettingEditResponseResultZonesChallengeTtlValue = 86400 + ZoneSettingEditResponseResultZonesChallengeTtlValue604800 ZoneSettingEditResponseResultZonesChallengeTtlValue = 604800 + ZoneSettingEditResponseResultZonesChallengeTtlValue2592000 ZoneSettingEditResponseResultZonesChallengeTtlValue = 2592000 + ZoneSettingEditResponseResultZonesChallengeTtlValue31536000 ZoneSettingEditResponseResultZonesChallengeTtlValue = 31536000 ) // An allowlist of ciphers for TLS termination. These ciphers must be in the // BoringSSL format. -type ZoneSettingsCollectionResultCiphers struct { +type ZoneSettingEditResponseResultZonesCiphers struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultCiphersID `json:"id"` + ID ZoneSettingEditResponseResultZonesCiphersID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultCiphersEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesCiphersEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value []string `json:"value"` - JSON zoneSettingsCollectionResultCiphersJSON `json:"-"` + Value []string `json:"value"` + JSON zoneSettingEditResponseResultZonesCiphersJSON `json:"-"` } -// zoneSettingsCollectionResultCiphersJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultCiphers] -type zoneSettingsCollectionResultCiphersJSON struct { +// zoneSettingEditResponseResultZonesCiphersJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesCiphers] +type zoneSettingEditResponseResultZonesCiphersJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -926,45 +4404,45 @@ type zoneSettingsCollectionResultCiphersJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultCiphers) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesCiphers) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultCiphers) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesCiphers) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultCiphersID string +type ZoneSettingEditResponseResultZonesCiphersID string const ( - ZoneSettingsCollectionResultCiphersIDCiphers ZoneSettingsCollectionResultCiphersID = "ciphers" + ZoneSettingEditResponseResultZonesCiphersIDCiphers ZoneSettingEditResponseResultZonesCiphersID = "ciphers" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultCiphersEditable bool +type ZoneSettingEditResponseResultZonesCiphersEditable bool const ( - ZoneSettingsCollectionResultCiphersEditableTrue ZoneSettingsCollectionResultCiphersEditable = true - ZoneSettingsCollectionResultCiphersEditableFalse ZoneSettingsCollectionResultCiphersEditable = false + ZoneSettingEditResponseResultZonesCiphersEditableTrue ZoneSettingEditResponseResultZonesCiphersEditable = true + ZoneSettingEditResponseResultZonesCiphersEditableFalse ZoneSettingEditResponseResultZonesCiphersEditable = false ) // Whether or not cname flattening is on. -type ZoneSettingsCollectionResultCnameFlattening struct { +type ZoneSettingEditResponseResultZonesCnameFlattening struct { // How to flatten the cname destination. - ID ZoneSettingsCollectionResultCnameFlatteningID `json:"id"` + ID ZoneSettingEditResponseResultZonesCnameFlatteningID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultCnameFlatteningEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesCnameFlatteningEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the cname flattening setting. - Value ZoneSettingsCollectionResultCnameFlatteningValue `json:"value"` - JSON zoneSettingsCollectionResultCnameFlatteningJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesCnameFlatteningValue `json:"value"` + JSON zoneSettingEditResponseResultZonesCnameFlatteningJSON `json:"-"` } -// zoneSettingsCollectionResultCnameFlatteningJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultCnameFlattening] -type zoneSettingsCollectionResultCnameFlatteningJSON struct { +// zoneSettingEditResponseResultZonesCnameFlatteningJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesCnameFlattening] +type zoneSettingEditResponseResultZonesCnameFlatteningJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -973,34 +4451,35 @@ type zoneSettingsCollectionResultCnameFlatteningJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultCnameFlattening) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesCnameFlattening) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultCnameFlattening) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesCnameFlattening) implementsZoneSettingEditResponseResult() { +} // How to flatten the cname destination. -type ZoneSettingsCollectionResultCnameFlatteningID string +type ZoneSettingEditResponseResultZonesCnameFlatteningID string const ( - ZoneSettingsCollectionResultCnameFlatteningIDCnameFlattening ZoneSettingsCollectionResultCnameFlatteningID = "cname_flattening" + ZoneSettingEditResponseResultZonesCnameFlatteningIDCnameFlattening ZoneSettingEditResponseResultZonesCnameFlatteningID = "cname_flattening" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultCnameFlatteningEditable bool +type ZoneSettingEditResponseResultZonesCnameFlatteningEditable bool const ( - ZoneSettingsCollectionResultCnameFlatteningEditableTrue ZoneSettingsCollectionResultCnameFlatteningEditable = true - ZoneSettingsCollectionResultCnameFlatteningEditableFalse ZoneSettingsCollectionResultCnameFlatteningEditable = false + ZoneSettingEditResponseResultZonesCnameFlatteningEditableTrue ZoneSettingEditResponseResultZonesCnameFlatteningEditable = true + ZoneSettingEditResponseResultZonesCnameFlatteningEditableFalse ZoneSettingEditResponseResultZonesCnameFlatteningEditable = false ) // Value of the cname flattening setting. -type ZoneSettingsCollectionResultCnameFlatteningValue string +type ZoneSettingEditResponseResultZonesCnameFlatteningValue string const ( - ZoneSettingsCollectionResultCnameFlatteningValueFlattenAtRoot ZoneSettingsCollectionResultCnameFlatteningValue = "flatten_at_root" - ZoneSettingsCollectionResultCnameFlatteningValueFlattenAll ZoneSettingsCollectionResultCnameFlatteningValue = "flatten_all" + ZoneSettingEditResponseResultZonesCnameFlatteningValueFlattenAtRoot ZoneSettingEditResponseResultZonesCnameFlatteningValue = "flatten_at_root" + ZoneSettingEditResponseResultZonesCnameFlatteningValueFlattenAll ZoneSettingEditResponseResultZonesCnameFlatteningValue = "flatten_all" ) // Development Mode temporarily allows you to enter development mode for your @@ -1009,12 +4488,12 @@ const ( // changes to cacheable content (like images, css, or JavaScript) and would like to // see those changes right away. Once entered, development mode will last for 3 // hours and then automatically toggle off. -type ZoneSettingsCollectionResultDevelopmentMode struct { +type ZoneSettingEditResponseResultZonesDevelopmentMode struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultDevelopmentModeID `json:"id"` + ID ZoneSettingEditResponseResultZonesDevelopmentModeID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultDevelopmentModeEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesDevelopmentModeEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: The interval (in seconds) from when @@ -1022,13 +4501,13 @@ type ZoneSettingsCollectionResultDevelopmentMode struct { // for the domain. If development mode has never been enabled, this value is false. TimeRemaining float64 `json:"time_remaining"` // Value of the zone setting. - Value ZoneSettingsCollectionResultDevelopmentModeValue `json:"value"` - JSON zoneSettingsCollectionResultDevelopmentModeJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesDevelopmentModeValue `json:"value"` + JSON zoneSettingEditResponseResultZonesDevelopmentModeJSON `json:"-"` } -// zoneSettingsCollectionResultDevelopmentModeJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultDevelopmentMode] -type zoneSettingsCollectionResultDevelopmentModeJSON struct { +// zoneSettingEditResponseResultZonesDevelopmentModeJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesDevelopmentMode] +type zoneSettingEditResponseResultZonesDevelopmentModeJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1038,56 +4517,57 @@ type zoneSettingsCollectionResultDevelopmentModeJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultDevelopmentMode) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesDevelopmentMode) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultDevelopmentMode) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesDevelopmentMode) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultDevelopmentModeID string +type ZoneSettingEditResponseResultZonesDevelopmentModeID string const ( - ZoneSettingsCollectionResultDevelopmentModeIDDevelopmentMode ZoneSettingsCollectionResultDevelopmentModeID = "development_mode" + ZoneSettingEditResponseResultZonesDevelopmentModeIDDevelopmentMode ZoneSettingEditResponseResultZonesDevelopmentModeID = "development_mode" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultDevelopmentModeEditable bool +type ZoneSettingEditResponseResultZonesDevelopmentModeEditable bool const ( - ZoneSettingsCollectionResultDevelopmentModeEditableTrue ZoneSettingsCollectionResultDevelopmentModeEditable = true - ZoneSettingsCollectionResultDevelopmentModeEditableFalse ZoneSettingsCollectionResultDevelopmentModeEditable = false + ZoneSettingEditResponseResultZonesDevelopmentModeEditableTrue ZoneSettingEditResponseResultZonesDevelopmentModeEditable = true + ZoneSettingEditResponseResultZonesDevelopmentModeEditableFalse ZoneSettingEditResponseResultZonesDevelopmentModeEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultDevelopmentModeValue string +type ZoneSettingEditResponseResultZonesDevelopmentModeValue string const ( - ZoneSettingsCollectionResultDevelopmentModeValueOn ZoneSettingsCollectionResultDevelopmentModeValue = "on" - ZoneSettingsCollectionResultDevelopmentModeValueOff ZoneSettingsCollectionResultDevelopmentModeValue = "off" + ZoneSettingEditResponseResultZonesDevelopmentModeValueOn ZoneSettingEditResponseResultZonesDevelopmentModeValue = "on" + ZoneSettingEditResponseResultZonesDevelopmentModeValueOff ZoneSettingEditResponseResultZonesDevelopmentModeValue = "off" ) // When enabled, Cloudflare will attempt to speed up overall page loads by serving // `103` responses with `Link` headers from the final response. Refer to // [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for // more information. -type ZoneSettingsCollectionResultEarlyHints struct { +type ZoneSettingEditResponseResultZonesEarlyHints struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultEarlyHintsID `json:"id"` + ID ZoneSettingEditResponseResultZonesEarlyHintsID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultEarlyHintsEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesEarlyHintsEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultEarlyHintsValue `json:"value"` - JSON zoneSettingsCollectionResultEarlyHintsJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesEarlyHintsValue `json:"value"` + JSON zoneSettingEditResponseResultZonesEarlyHintsJSON `json:"-"` } -// zoneSettingsCollectionResultEarlyHintsJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultEarlyHints] -type zoneSettingsCollectionResultEarlyHintsJSON struct { +// zoneSettingEditResponseResultZonesEarlyHintsJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesEarlyHints] +type zoneSettingEditResponseResultZonesEarlyHintsJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1096,55 +4576,55 @@ type zoneSettingsCollectionResultEarlyHintsJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultEarlyHints) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesEarlyHints) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultEarlyHints) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesEarlyHints) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultEarlyHintsID string +type ZoneSettingEditResponseResultZonesEarlyHintsID string const ( - ZoneSettingsCollectionResultEarlyHintsIDEarlyHints ZoneSettingsCollectionResultEarlyHintsID = "early_hints" + ZoneSettingEditResponseResultZonesEarlyHintsIDEarlyHints ZoneSettingEditResponseResultZonesEarlyHintsID = "early_hints" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultEarlyHintsEditable bool +type ZoneSettingEditResponseResultZonesEarlyHintsEditable bool const ( - ZoneSettingsCollectionResultEarlyHintsEditableTrue ZoneSettingsCollectionResultEarlyHintsEditable = true - ZoneSettingsCollectionResultEarlyHintsEditableFalse ZoneSettingsCollectionResultEarlyHintsEditable = false + ZoneSettingEditResponseResultZonesEarlyHintsEditableTrue ZoneSettingEditResponseResultZonesEarlyHintsEditable = true + ZoneSettingEditResponseResultZonesEarlyHintsEditableFalse ZoneSettingEditResponseResultZonesEarlyHintsEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultEarlyHintsValue string +type ZoneSettingEditResponseResultZonesEarlyHintsValue string const ( - ZoneSettingsCollectionResultEarlyHintsValueOn ZoneSettingsCollectionResultEarlyHintsValue = "on" - ZoneSettingsCollectionResultEarlyHintsValueOff ZoneSettingsCollectionResultEarlyHintsValue = "off" + ZoneSettingEditResponseResultZonesEarlyHintsValueOn ZoneSettingEditResponseResultZonesEarlyHintsValue = "on" + ZoneSettingEditResponseResultZonesEarlyHintsValueOff ZoneSettingEditResponseResultZonesEarlyHintsValue = "off" ) // Time (in seconds) that a resource will be ensured to remain on Cloudflare's // cache servers. -type ZoneSettingsCollectionResultEdgeCacheTtl struct { +type ZoneSettingEditResponseResultZonesEdgeCacheTtl struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultEdgeCacheTtlID `json:"id"` + ID ZoneSettingEditResponseResultZonesEdgeCacheTtlID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultEdgeCacheTtlEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesEdgeCacheTtlEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: The minimum TTL available depends on the plan // level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200) - Value ZoneSettingsCollectionResultEdgeCacheTtlValue `json:"value"` - JSON zoneSettingsCollectionResultEdgeCacheTtlJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesEdgeCacheTtlValue `json:"value"` + JSON zoneSettingEditResponseResultZonesEdgeCacheTtlJSON `json:"-"` } -// zoneSettingsCollectionResultEdgeCacheTtlJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultEdgeCacheTtl] -type zoneSettingsCollectionResultEdgeCacheTtlJSON struct { +// zoneSettingEditResponseResultZonesEdgeCacheTtlJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesEdgeCacheTtl] +type zoneSettingEditResponseResultZonesEdgeCacheTtlJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1153,74 +4633,74 @@ type zoneSettingsCollectionResultEdgeCacheTtlJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultEdgeCacheTtl) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesEdgeCacheTtl) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultEdgeCacheTtl) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesEdgeCacheTtl) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultEdgeCacheTtlID string +type ZoneSettingEditResponseResultZonesEdgeCacheTtlID string const ( - ZoneSettingsCollectionResultEdgeCacheTtlIDEdgeCacheTtl ZoneSettingsCollectionResultEdgeCacheTtlID = "edge_cache_ttl" + ZoneSettingEditResponseResultZonesEdgeCacheTtlIDEdgeCacheTtl ZoneSettingEditResponseResultZonesEdgeCacheTtlID = "edge_cache_ttl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultEdgeCacheTtlEditable bool +type ZoneSettingEditResponseResultZonesEdgeCacheTtlEditable bool const ( - ZoneSettingsCollectionResultEdgeCacheTtlEditableTrue ZoneSettingsCollectionResultEdgeCacheTtlEditable = true - ZoneSettingsCollectionResultEdgeCacheTtlEditableFalse ZoneSettingsCollectionResultEdgeCacheTtlEditable = false + ZoneSettingEditResponseResultZonesEdgeCacheTtlEditableTrue ZoneSettingEditResponseResultZonesEdgeCacheTtlEditable = true + ZoneSettingEditResponseResultZonesEdgeCacheTtlEditableFalse ZoneSettingEditResponseResultZonesEdgeCacheTtlEditable = false ) // Value of the zone setting. Notes: The minimum TTL available depends on the plan // level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200) -type ZoneSettingsCollectionResultEdgeCacheTtlValue float64 - -const ( - ZoneSettingsCollectionResultEdgeCacheTtlValue30 ZoneSettingsCollectionResultEdgeCacheTtlValue = 30 - ZoneSettingsCollectionResultEdgeCacheTtlValue60 ZoneSettingsCollectionResultEdgeCacheTtlValue = 60 - ZoneSettingsCollectionResultEdgeCacheTtlValue300 ZoneSettingsCollectionResultEdgeCacheTtlValue = 300 - ZoneSettingsCollectionResultEdgeCacheTtlValue1200 ZoneSettingsCollectionResultEdgeCacheTtlValue = 1200 - ZoneSettingsCollectionResultEdgeCacheTtlValue1800 ZoneSettingsCollectionResultEdgeCacheTtlValue = 1800 - ZoneSettingsCollectionResultEdgeCacheTtlValue3600 ZoneSettingsCollectionResultEdgeCacheTtlValue = 3600 - ZoneSettingsCollectionResultEdgeCacheTtlValue7200 ZoneSettingsCollectionResultEdgeCacheTtlValue = 7200 - ZoneSettingsCollectionResultEdgeCacheTtlValue10800 ZoneSettingsCollectionResultEdgeCacheTtlValue = 10800 - ZoneSettingsCollectionResultEdgeCacheTtlValue14400 ZoneSettingsCollectionResultEdgeCacheTtlValue = 14400 - ZoneSettingsCollectionResultEdgeCacheTtlValue18000 ZoneSettingsCollectionResultEdgeCacheTtlValue = 18000 - ZoneSettingsCollectionResultEdgeCacheTtlValue28800 ZoneSettingsCollectionResultEdgeCacheTtlValue = 28800 - ZoneSettingsCollectionResultEdgeCacheTtlValue43200 ZoneSettingsCollectionResultEdgeCacheTtlValue = 43200 - ZoneSettingsCollectionResultEdgeCacheTtlValue57600 ZoneSettingsCollectionResultEdgeCacheTtlValue = 57600 - ZoneSettingsCollectionResultEdgeCacheTtlValue72000 ZoneSettingsCollectionResultEdgeCacheTtlValue = 72000 - ZoneSettingsCollectionResultEdgeCacheTtlValue86400 ZoneSettingsCollectionResultEdgeCacheTtlValue = 86400 - ZoneSettingsCollectionResultEdgeCacheTtlValue172800 ZoneSettingsCollectionResultEdgeCacheTtlValue = 172800 - ZoneSettingsCollectionResultEdgeCacheTtlValue259200 ZoneSettingsCollectionResultEdgeCacheTtlValue = 259200 - ZoneSettingsCollectionResultEdgeCacheTtlValue345600 ZoneSettingsCollectionResultEdgeCacheTtlValue = 345600 - ZoneSettingsCollectionResultEdgeCacheTtlValue432000 ZoneSettingsCollectionResultEdgeCacheTtlValue = 432000 - ZoneSettingsCollectionResultEdgeCacheTtlValue518400 ZoneSettingsCollectionResultEdgeCacheTtlValue = 518400 - ZoneSettingsCollectionResultEdgeCacheTtlValue604800 ZoneSettingsCollectionResultEdgeCacheTtlValue = 604800 +type ZoneSettingEditResponseResultZonesEdgeCacheTtlValue float64 + +const ( + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue30 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 30 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue60 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 60 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue300 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 300 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue1200 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 1200 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue1800 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 1800 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue3600 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 3600 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue7200 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 7200 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue10800 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 10800 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue14400 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 14400 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue18000 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 18000 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue28800 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 28800 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue43200 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 43200 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue57600 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 57600 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue72000 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 72000 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue86400 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 86400 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue172800 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 172800 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue259200 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 259200 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue345600 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 345600 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue432000 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 432000 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue518400 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 518400 + ZoneSettingEditResponseResultZonesEdgeCacheTtlValue604800 ZoneSettingEditResponseResultZonesEdgeCacheTtlValue = 604800 ) // Encrypt email adresses on your web page from bots, while keeping them visible to // humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -type ZoneSettingsCollectionResultEmailObfuscation struct { +type ZoneSettingEditResponseResultZonesEmailObfuscation struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultEmailObfuscationID `json:"id"` + ID ZoneSettingEditResponseResultZonesEmailObfuscationID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultEmailObfuscationEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesEmailObfuscationEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultEmailObfuscationValue `json:"value"` - JSON zoneSettingsCollectionResultEmailObfuscationJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesEmailObfuscationValue `json:"value"` + JSON zoneSettingEditResponseResultZonesEmailObfuscationJSON `json:"-"` } -// zoneSettingsCollectionResultEmailObfuscationJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultEmailObfuscation] -type zoneSettingsCollectionResultEmailObfuscationJSON struct { +// zoneSettingEditResponseResultZonesEmailObfuscationJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesEmailObfuscation] +type zoneSettingEditResponseResultZonesEmailObfuscationJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1229,55 +4709,56 @@ type zoneSettingsCollectionResultEmailObfuscationJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultEmailObfuscation) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesEmailObfuscation) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultEmailObfuscation) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesEmailObfuscation) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultEmailObfuscationID string +type ZoneSettingEditResponseResultZonesEmailObfuscationID string const ( - ZoneSettingsCollectionResultEmailObfuscationIDEmailObfuscation ZoneSettingsCollectionResultEmailObfuscationID = "email_obfuscation" + ZoneSettingEditResponseResultZonesEmailObfuscationIDEmailObfuscation ZoneSettingEditResponseResultZonesEmailObfuscationID = "email_obfuscation" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultEmailObfuscationEditable bool +type ZoneSettingEditResponseResultZonesEmailObfuscationEditable bool const ( - ZoneSettingsCollectionResultEmailObfuscationEditableTrue ZoneSettingsCollectionResultEmailObfuscationEditable = true - ZoneSettingsCollectionResultEmailObfuscationEditableFalse ZoneSettingsCollectionResultEmailObfuscationEditable = false + ZoneSettingEditResponseResultZonesEmailObfuscationEditableTrue ZoneSettingEditResponseResultZonesEmailObfuscationEditable = true + ZoneSettingEditResponseResultZonesEmailObfuscationEditableFalse ZoneSettingEditResponseResultZonesEmailObfuscationEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultEmailObfuscationValue string +type ZoneSettingEditResponseResultZonesEmailObfuscationValue string const ( - ZoneSettingsCollectionResultEmailObfuscationValueOn ZoneSettingsCollectionResultEmailObfuscationValue = "on" - ZoneSettingsCollectionResultEmailObfuscationValueOff ZoneSettingsCollectionResultEmailObfuscationValue = "off" + ZoneSettingEditResponseResultZonesEmailObfuscationValueOn ZoneSettingEditResponseResultZonesEmailObfuscationValue = "on" + ZoneSettingEditResponseResultZonesEmailObfuscationValueOff ZoneSettingEditResponseResultZonesEmailObfuscationValue = "off" ) // HTTP/2 Edge Prioritization optimises the delivery of resources served through // HTTP/2 to improve page load performance. It also supports fine control of // content delivery when used in conjunction with Workers. -type ZoneSettingsCollectionResultH2Prioritization struct { +type ZoneSettingEditResponseResultZonesH2Prioritization struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultH2PrioritizationID `json:"id"` + ID ZoneSettingEditResponseResultZonesH2PrioritizationID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultH2PrioritizationEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesH2PrioritizationEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultH2PrioritizationValue `json:"value"` - JSON zoneSettingsCollectionResultH2PrioritizationJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesH2PrioritizationValue `json:"value"` + JSON zoneSettingEditResponseResultZonesH2PrioritizationJSON `json:"-"` } -// zoneSettingsCollectionResultH2PrioritizationJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultH2Prioritization] -type zoneSettingsCollectionResultH2PrioritizationJSON struct { +// zoneSettingEditResponseResultZonesH2PrioritizationJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesH2Prioritization] +type zoneSettingEditResponseResultZonesH2PrioritizationJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1286,35 +4767,36 @@ type zoneSettingsCollectionResultH2PrioritizationJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultH2Prioritization) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesH2Prioritization) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultH2Prioritization) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesH2Prioritization) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultH2PrioritizationID string +type ZoneSettingEditResponseResultZonesH2PrioritizationID string const ( - ZoneSettingsCollectionResultH2PrioritizationIDH2Prioritization ZoneSettingsCollectionResultH2PrioritizationID = "h2_prioritization" + ZoneSettingEditResponseResultZonesH2PrioritizationIDH2Prioritization ZoneSettingEditResponseResultZonesH2PrioritizationID = "h2_prioritization" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultH2PrioritizationEditable bool +type ZoneSettingEditResponseResultZonesH2PrioritizationEditable bool const ( - ZoneSettingsCollectionResultH2PrioritizationEditableTrue ZoneSettingsCollectionResultH2PrioritizationEditable = true - ZoneSettingsCollectionResultH2PrioritizationEditableFalse ZoneSettingsCollectionResultH2PrioritizationEditable = false + ZoneSettingEditResponseResultZonesH2PrioritizationEditableTrue ZoneSettingEditResponseResultZonesH2PrioritizationEditable = true + ZoneSettingEditResponseResultZonesH2PrioritizationEditableFalse ZoneSettingEditResponseResultZonesH2PrioritizationEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultH2PrioritizationValue string +type ZoneSettingEditResponseResultZonesH2PrioritizationValue string const ( - ZoneSettingsCollectionResultH2PrioritizationValueOn ZoneSettingsCollectionResultH2PrioritizationValue = "on" - ZoneSettingsCollectionResultH2PrioritizationValueOff ZoneSettingsCollectionResultH2PrioritizationValue = "off" - ZoneSettingsCollectionResultH2PrioritizationValueCustom ZoneSettingsCollectionResultH2PrioritizationValue = "custom" + ZoneSettingEditResponseResultZonesH2PrioritizationValueOn ZoneSettingEditResponseResultZonesH2PrioritizationValue = "on" + ZoneSettingEditResponseResultZonesH2PrioritizationValueOff ZoneSettingEditResponseResultZonesH2PrioritizationValue = "off" + ZoneSettingEditResponseResultZonesH2PrioritizationValueCustom ZoneSettingEditResponseResultZonesH2PrioritizationValue = "custom" ) // When enabled, the Hotlink Protection option ensures that other sites cannot suck @@ -1324,22 +4806,22 @@ const ( // view images from your page, but other sites won't be able to steal them for use // on their own pages. // (https://support.cloudflare.com/hc/en-us/articles/200170026). -type ZoneSettingsCollectionResultHotlinkProtection struct { +type ZoneSettingEditResponseResultZonesHotlinkProtection struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultHotlinkProtectionID `json:"id"` + ID ZoneSettingEditResponseResultZonesHotlinkProtectionID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultHotlinkProtectionEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesHotlinkProtectionEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultHotlinkProtectionValue `json:"value"` - JSON zoneSettingsCollectionResultHotlinkProtectionJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesHotlinkProtectionValue `json:"value"` + JSON zoneSettingEditResponseResultZonesHotlinkProtectionJSON `json:"-"` } -// zoneSettingsCollectionResultHotlinkProtectionJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultHotlinkProtection] -type zoneSettingsCollectionResultHotlinkProtectionJSON struct { +// zoneSettingEditResponseResultZonesHotlinkProtectionJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesHotlinkProtection] +type zoneSettingEditResponseResultZonesHotlinkProtectionJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1348,53 +4830,54 @@ type zoneSettingsCollectionResultHotlinkProtectionJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultHotlinkProtection) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesHotlinkProtection) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultHotlinkProtection) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesHotlinkProtection) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultHotlinkProtectionID string +type ZoneSettingEditResponseResultZonesHotlinkProtectionID string const ( - ZoneSettingsCollectionResultHotlinkProtectionIDHotlinkProtection ZoneSettingsCollectionResultHotlinkProtectionID = "hotlink_protection" + ZoneSettingEditResponseResultZonesHotlinkProtectionIDHotlinkProtection ZoneSettingEditResponseResultZonesHotlinkProtectionID = "hotlink_protection" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultHotlinkProtectionEditable bool +type ZoneSettingEditResponseResultZonesHotlinkProtectionEditable bool const ( - ZoneSettingsCollectionResultHotlinkProtectionEditableTrue ZoneSettingsCollectionResultHotlinkProtectionEditable = true - ZoneSettingsCollectionResultHotlinkProtectionEditableFalse ZoneSettingsCollectionResultHotlinkProtectionEditable = false + ZoneSettingEditResponseResultZonesHotlinkProtectionEditableTrue ZoneSettingEditResponseResultZonesHotlinkProtectionEditable = true + ZoneSettingEditResponseResultZonesHotlinkProtectionEditableFalse ZoneSettingEditResponseResultZonesHotlinkProtectionEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultHotlinkProtectionValue string +type ZoneSettingEditResponseResultZonesHotlinkProtectionValue string const ( - ZoneSettingsCollectionResultHotlinkProtectionValueOn ZoneSettingsCollectionResultHotlinkProtectionValue = "on" - ZoneSettingsCollectionResultHotlinkProtectionValueOff ZoneSettingsCollectionResultHotlinkProtectionValue = "off" + ZoneSettingEditResponseResultZonesHotlinkProtectionValueOn ZoneSettingEditResponseResultZonesHotlinkProtectionValue = "on" + ZoneSettingEditResponseResultZonesHotlinkProtectionValueOff ZoneSettingEditResponseResultZonesHotlinkProtectionValue = "off" ) // HTTP2 enabled for this zone. -type ZoneSettingsCollectionResultHttp2 struct { +type ZoneSettingEditResponseResultZonesHttp2 struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultHttp2ID `json:"id"` + ID ZoneSettingEditResponseResultZonesHttp2ID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultHttp2Editable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesHttp2Editable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the HTTP2 setting. - Value ZoneSettingsCollectionResultHttp2Value `json:"value"` - JSON zoneSettingsCollectionResultHttp2JSON `json:"-"` + Value ZoneSettingEditResponseResultZonesHttp2Value `json:"value"` + JSON zoneSettingEditResponseResultZonesHttp2JSON `json:"-"` } -// zoneSettingsCollectionResultHttp2JSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultHttp2] -type zoneSettingsCollectionResultHttp2JSON struct { +// zoneSettingEditResponseResultZonesHttp2JSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesHttp2] +type zoneSettingEditResponseResultZonesHttp2JSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1403,53 +4886,53 @@ type zoneSettingsCollectionResultHttp2JSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultHttp2) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesHttp2) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultHttp2) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesHttp2) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultHttp2ID string +type ZoneSettingEditResponseResultZonesHttp2ID string const ( - ZoneSettingsCollectionResultHttp2IDHttp2 ZoneSettingsCollectionResultHttp2ID = "http2" + ZoneSettingEditResponseResultZonesHttp2IDHttp2 ZoneSettingEditResponseResultZonesHttp2ID = "http2" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultHttp2Editable bool +type ZoneSettingEditResponseResultZonesHttp2Editable bool const ( - ZoneSettingsCollectionResultHttp2EditableTrue ZoneSettingsCollectionResultHttp2Editable = true - ZoneSettingsCollectionResultHttp2EditableFalse ZoneSettingsCollectionResultHttp2Editable = false + ZoneSettingEditResponseResultZonesHttp2EditableTrue ZoneSettingEditResponseResultZonesHttp2Editable = true + ZoneSettingEditResponseResultZonesHttp2EditableFalse ZoneSettingEditResponseResultZonesHttp2Editable = false ) // Value of the HTTP2 setting. -type ZoneSettingsCollectionResultHttp2Value string +type ZoneSettingEditResponseResultZonesHttp2Value string const ( - ZoneSettingsCollectionResultHttp2ValueOn ZoneSettingsCollectionResultHttp2Value = "on" - ZoneSettingsCollectionResultHttp2ValueOff ZoneSettingsCollectionResultHttp2Value = "off" + ZoneSettingEditResponseResultZonesHttp2ValueOn ZoneSettingEditResponseResultZonesHttp2Value = "on" + ZoneSettingEditResponseResultZonesHttp2ValueOff ZoneSettingEditResponseResultZonesHttp2Value = "off" ) // HTTP3 enabled for this zone. -type ZoneSettingsCollectionResultHttp3 struct { +type ZoneSettingEditResponseResultZonesHttp3 struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultHttp3ID `json:"id"` + ID ZoneSettingEditResponseResultZonesHttp3ID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultHttp3Editable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesHttp3Editable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the HTTP3 setting. - Value ZoneSettingsCollectionResultHttp3Value `json:"value"` - JSON zoneSettingsCollectionResultHttp3JSON `json:"-"` + Value ZoneSettingEditResponseResultZonesHttp3Value `json:"value"` + JSON zoneSettingEditResponseResultZonesHttp3JSON `json:"-"` } -// zoneSettingsCollectionResultHttp3JSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultHttp3] -type zoneSettingsCollectionResultHttp3JSON struct { +// zoneSettingEditResponseResultZonesHttp3JSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesHttp3] +type zoneSettingEditResponseResultZonesHttp3JSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1458,56 +4941,56 @@ type zoneSettingsCollectionResultHttp3JSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultHttp3) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesHttp3) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultHttp3) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesHttp3) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultHttp3ID string +type ZoneSettingEditResponseResultZonesHttp3ID string const ( - ZoneSettingsCollectionResultHttp3IDHttp3 ZoneSettingsCollectionResultHttp3ID = "http3" + ZoneSettingEditResponseResultZonesHttp3IDHttp3 ZoneSettingEditResponseResultZonesHttp3ID = "http3" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultHttp3Editable bool +type ZoneSettingEditResponseResultZonesHttp3Editable bool const ( - ZoneSettingsCollectionResultHttp3EditableTrue ZoneSettingsCollectionResultHttp3Editable = true - ZoneSettingsCollectionResultHttp3EditableFalse ZoneSettingsCollectionResultHttp3Editable = false + ZoneSettingEditResponseResultZonesHttp3EditableTrue ZoneSettingEditResponseResultZonesHttp3Editable = true + ZoneSettingEditResponseResultZonesHttp3EditableFalse ZoneSettingEditResponseResultZonesHttp3Editable = false ) // Value of the HTTP3 setting. -type ZoneSettingsCollectionResultHttp3Value string +type ZoneSettingEditResponseResultZonesHttp3Value string const ( - ZoneSettingsCollectionResultHttp3ValueOn ZoneSettingsCollectionResultHttp3Value = "on" - ZoneSettingsCollectionResultHttp3ValueOff ZoneSettingsCollectionResultHttp3Value = "off" + ZoneSettingEditResponseResultZonesHttp3ValueOn ZoneSettingEditResponseResultZonesHttp3Value = "on" + ZoneSettingEditResponseResultZonesHttp3ValueOff ZoneSettingEditResponseResultZonesHttp3Value = "off" ) // Image Resizing provides on-demand resizing, conversion and optimisation for // images served through Cloudflare's network. Refer to the // [Image Resizing documentation](https://developers.cloudflare.com/images/) for // more information. -type ZoneSettingsCollectionResultImageResizing struct { +type ZoneSettingEditResponseResultZonesImageResizing struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultImageResizingID `json:"id"` + ID ZoneSettingEditResponseResultZonesImageResizingID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultImageResizingEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesImageResizingEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Whether the feature is enabled, disabled, or enabled in `open proxy` mode. - Value ZoneSettingsCollectionResultImageResizingValue `json:"value"` - JSON zoneSettingsCollectionResultImageResizingJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesImageResizingValue `json:"value"` + JSON zoneSettingEditResponseResultZonesImageResizingJSON `json:"-"` } -// zoneSettingsCollectionResultImageResizingJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultImageResizing] -type zoneSettingsCollectionResultImageResizingJSON struct { +// zoneSettingEditResponseResultZonesImageResizingJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesImageResizing] +type zoneSettingEditResponseResultZonesImageResizingJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1516,56 +4999,56 @@ type zoneSettingsCollectionResultImageResizingJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultImageResizing) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesImageResizing) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultImageResizing) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesImageResizing) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultImageResizingID string +type ZoneSettingEditResponseResultZonesImageResizingID string const ( - ZoneSettingsCollectionResultImageResizingIDImageResizing ZoneSettingsCollectionResultImageResizingID = "image_resizing" + ZoneSettingEditResponseResultZonesImageResizingIDImageResizing ZoneSettingEditResponseResultZonesImageResizingID = "image_resizing" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultImageResizingEditable bool +type ZoneSettingEditResponseResultZonesImageResizingEditable bool const ( - ZoneSettingsCollectionResultImageResizingEditableTrue ZoneSettingsCollectionResultImageResizingEditable = true - ZoneSettingsCollectionResultImageResizingEditableFalse ZoneSettingsCollectionResultImageResizingEditable = false + ZoneSettingEditResponseResultZonesImageResizingEditableTrue ZoneSettingEditResponseResultZonesImageResizingEditable = true + ZoneSettingEditResponseResultZonesImageResizingEditableFalse ZoneSettingEditResponseResultZonesImageResizingEditable = false ) // Whether the feature is enabled, disabled, or enabled in `open proxy` mode. -type ZoneSettingsCollectionResultImageResizingValue string +type ZoneSettingEditResponseResultZonesImageResizingValue string const ( - ZoneSettingsCollectionResultImageResizingValueOn ZoneSettingsCollectionResultImageResizingValue = "on" - ZoneSettingsCollectionResultImageResizingValueOff ZoneSettingsCollectionResultImageResizingValue = "off" - ZoneSettingsCollectionResultImageResizingValueOpen ZoneSettingsCollectionResultImageResizingValue = "open" + ZoneSettingEditResponseResultZonesImageResizingValueOn ZoneSettingEditResponseResultZonesImageResizingValue = "on" + ZoneSettingEditResponseResultZonesImageResizingValueOff ZoneSettingEditResponseResultZonesImageResizingValue = "off" + ZoneSettingEditResponseResultZonesImageResizingValueOpen ZoneSettingEditResponseResultZonesImageResizingValue = "open" ) // Enable IP Geolocation to have Cloudflare geolocate visitors to your website and // pass the country code to you. // (https://support.cloudflare.com/hc/en-us/articles/200168236). -type ZoneSettingsCollectionResultIPGeolocation struct { +type ZoneSettingEditResponseResultZonesIPGeolocation struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultIPGeolocationID `json:"id"` + ID ZoneSettingEditResponseResultZonesIPGeolocationID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultIPGeolocationEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesIPGeolocationEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultIPGeolocationValue `json:"value"` - JSON zoneSettingsCollectionResultIPGeolocationJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesIPGeolocationValue `json:"value"` + JSON zoneSettingEditResponseResultZonesIPGeolocationJSON `json:"-"` } -// zoneSettingsCollectionResultIPGeolocationJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultIPGeolocation] -type zoneSettingsCollectionResultIPGeolocationJSON struct { +// zoneSettingEditResponseResultZonesIPGeolocationJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesIPGeolocation] +type zoneSettingEditResponseResultZonesIPGeolocationJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1574,54 +5057,54 @@ type zoneSettingsCollectionResultIPGeolocationJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultIPGeolocation) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesIPGeolocation) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultIPGeolocation) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesIPGeolocation) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultIPGeolocationID string +type ZoneSettingEditResponseResultZonesIPGeolocationID string const ( - ZoneSettingsCollectionResultIPGeolocationIDIPGeolocation ZoneSettingsCollectionResultIPGeolocationID = "ip_geolocation" + ZoneSettingEditResponseResultZonesIPGeolocationIDIPGeolocation ZoneSettingEditResponseResultZonesIPGeolocationID = "ip_geolocation" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultIPGeolocationEditable bool +type ZoneSettingEditResponseResultZonesIPGeolocationEditable bool const ( - ZoneSettingsCollectionResultIPGeolocationEditableTrue ZoneSettingsCollectionResultIPGeolocationEditable = true - ZoneSettingsCollectionResultIPGeolocationEditableFalse ZoneSettingsCollectionResultIPGeolocationEditable = false + ZoneSettingEditResponseResultZonesIPGeolocationEditableTrue ZoneSettingEditResponseResultZonesIPGeolocationEditable = true + ZoneSettingEditResponseResultZonesIPGeolocationEditableFalse ZoneSettingEditResponseResultZonesIPGeolocationEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultIPGeolocationValue string +type ZoneSettingEditResponseResultZonesIPGeolocationValue string const ( - ZoneSettingsCollectionResultIPGeolocationValueOn ZoneSettingsCollectionResultIPGeolocationValue = "on" - ZoneSettingsCollectionResultIPGeolocationValueOff ZoneSettingsCollectionResultIPGeolocationValue = "off" + ZoneSettingEditResponseResultZonesIPGeolocationValueOn ZoneSettingEditResponseResultZonesIPGeolocationValue = "on" + ZoneSettingEditResponseResultZonesIPGeolocationValueOff ZoneSettingEditResponseResultZonesIPGeolocationValue = "off" ) // Enable IPv6 on all subdomains that are Cloudflare enabled. // (https://support.cloudflare.com/hc/en-us/articles/200168586). -type ZoneSettingsCollectionResultIpv6 struct { +type ZoneSettingEditResponseResultZonesIpv6 struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultIpv6ID `json:"id"` + ID ZoneSettingEditResponseResultZonesIpv6ID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultIpv6Editable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesIpv6Editable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultIpv6Value `json:"value"` - JSON zoneSettingsCollectionResultIpv6JSON `json:"-"` + Value ZoneSettingEditResponseResultZonesIpv6Value `json:"value"` + JSON zoneSettingEditResponseResultZonesIpv6JSON `json:"-"` } -// zoneSettingsCollectionResultIpv6JSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultIpv6] -type zoneSettingsCollectionResultIpv6JSON struct { +// zoneSettingEditResponseResultZonesIpv6JSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesIpv6] +type zoneSettingEditResponseResultZonesIpv6JSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1630,54 +5113,54 @@ type zoneSettingsCollectionResultIpv6JSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultIpv6) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesIpv6) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultIpv6) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesIpv6) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultIpv6ID string +type ZoneSettingEditResponseResultZonesIpv6ID string const ( - ZoneSettingsCollectionResultIpv6IDIpv6 ZoneSettingsCollectionResultIpv6ID = "ipv6" + ZoneSettingEditResponseResultZonesIpv6IDIpv6 ZoneSettingEditResponseResultZonesIpv6ID = "ipv6" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultIpv6Editable bool +type ZoneSettingEditResponseResultZonesIpv6Editable bool const ( - ZoneSettingsCollectionResultIpv6EditableTrue ZoneSettingsCollectionResultIpv6Editable = true - ZoneSettingsCollectionResultIpv6EditableFalse ZoneSettingsCollectionResultIpv6Editable = false + ZoneSettingEditResponseResultZonesIpv6EditableTrue ZoneSettingEditResponseResultZonesIpv6Editable = true + ZoneSettingEditResponseResultZonesIpv6EditableFalse ZoneSettingEditResponseResultZonesIpv6Editable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultIpv6Value string +type ZoneSettingEditResponseResultZonesIpv6Value string const ( - ZoneSettingsCollectionResultIpv6ValueOff ZoneSettingsCollectionResultIpv6Value = "off" - ZoneSettingsCollectionResultIpv6ValueOn ZoneSettingsCollectionResultIpv6Value = "on" + ZoneSettingEditResponseResultZonesIpv6ValueOff ZoneSettingEditResponseResultZonesIpv6Value = "off" + ZoneSettingEditResponseResultZonesIpv6ValueOn ZoneSettingEditResponseResultZonesIpv6Value = "on" ) // Maximum size of an allowable upload. -type ZoneSettingsCollectionResultMaxUpload struct { +type ZoneSettingEditResponseResultZonesMaxUpload struct { // identifier of the zone setting. - ID ZoneSettingsCollectionResultMaxUploadID `json:"id"` + ID ZoneSettingEditResponseResultZonesMaxUploadID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultMaxUploadEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesMaxUploadEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: The size depends on the plan level of the // zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100) - Value ZoneSettingsCollectionResultMaxUploadValue `json:"value"` - JSON zoneSettingsCollectionResultMaxUploadJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesMaxUploadValue `json:"value"` + JSON zoneSettingEditResponseResultZonesMaxUploadJSON `json:"-"` } -// zoneSettingsCollectionResultMaxUploadJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultMaxUpload] -type zoneSettingsCollectionResultMaxUploadJSON struct { +// zoneSettingEditResponseResultZonesMaxUploadJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesMaxUpload] +type zoneSettingEditResponseResultZonesMaxUploadJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1686,57 +5169,57 @@ type zoneSettingsCollectionResultMaxUploadJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultMaxUpload) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesMaxUpload) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultMaxUpload) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesMaxUpload) implementsZoneSettingEditResponseResult() {} // identifier of the zone setting. -type ZoneSettingsCollectionResultMaxUploadID string +type ZoneSettingEditResponseResultZonesMaxUploadID string const ( - ZoneSettingsCollectionResultMaxUploadIDMaxUpload ZoneSettingsCollectionResultMaxUploadID = "max_upload" + ZoneSettingEditResponseResultZonesMaxUploadIDMaxUpload ZoneSettingEditResponseResultZonesMaxUploadID = "max_upload" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultMaxUploadEditable bool +type ZoneSettingEditResponseResultZonesMaxUploadEditable bool const ( - ZoneSettingsCollectionResultMaxUploadEditableTrue ZoneSettingsCollectionResultMaxUploadEditable = true - ZoneSettingsCollectionResultMaxUploadEditableFalse ZoneSettingsCollectionResultMaxUploadEditable = false + ZoneSettingEditResponseResultZonesMaxUploadEditableTrue ZoneSettingEditResponseResultZonesMaxUploadEditable = true + ZoneSettingEditResponseResultZonesMaxUploadEditableFalse ZoneSettingEditResponseResultZonesMaxUploadEditable = false ) // Value of the zone setting. Notes: The size depends on the plan level of the // zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100) -type ZoneSettingsCollectionResultMaxUploadValue float64 +type ZoneSettingEditResponseResultZonesMaxUploadValue float64 const ( - ZoneSettingsCollectionResultMaxUploadValue100 ZoneSettingsCollectionResultMaxUploadValue = 100 - ZoneSettingsCollectionResultMaxUploadValue200 ZoneSettingsCollectionResultMaxUploadValue = 200 - ZoneSettingsCollectionResultMaxUploadValue500 ZoneSettingsCollectionResultMaxUploadValue = 500 + ZoneSettingEditResponseResultZonesMaxUploadValue100 ZoneSettingEditResponseResultZonesMaxUploadValue = 100 + ZoneSettingEditResponseResultZonesMaxUploadValue200 ZoneSettingEditResponseResultZonesMaxUploadValue = 200 + ZoneSettingEditResponseResultZonesMaxUploadValue500 ZoneSettingEditResponseResultZonesMaxUploadValue = 500 ) // Only accepts HTTPS requests that use at least the TLS protocol version // specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be // rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. -type ZoneSettingsCollectionResultMinTlsVersion struct { +type ZoneSettingEditResponseResultZonesMinTlsVersion struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultMinTlsVersionID `json:"id"` + ID ZoneSettingEditResponseResultZonesMinTlsVersionID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultMinTlsVersionEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesMinTlsVersionEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultMinTlsVersionValue `json:"value"` - JSON zoneSettingsCollectionResultMinTlsVersionJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesMinTlsVersionValue `json:"value"` + JSON zoneSettingEditResponseResultZonesMinTlsVersionJSON `json:"-"` } -// zoneSettingsCollectionResultMinTlsVersionJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultMinTlsVersion] -type zoneSettingsCollectionResultMinTlsVersionJSON struct { +// zoneSettingEditResponseResultZonesMinTlsVersionJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesMinTlsVersion] +type zoneSettingEditResponseResultZonesMinTlsVersionJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1745,57 +5228,57 @@ type zoneSettingsCollectionResultMinTlsVersionJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultMinTlsVersion) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesMinTlsVersion) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultMinTlsVersion) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesMinTlsVersion) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultMinTlsVersionID string +type ZoneSettingEditResponseResultZonesMinTlsVersionID string const ( - ZoneSettingsCollectionResultMinTlsVersionIDMinTlsVersion ZoneSettingsCollectionResultMinTlsVersionID = "min_tls_version" + ZoneSettingEditResponseResultZonesMinTlsVersionIDMinTlsVersion ZoneSettingEditResponseResultZonesMinTlsVersionID = "min_tls_version" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultMinTlsVersionEditable bool +type ZoneSettingEditResponseResultZonesMinTlsVersionEditable bool const ( - ZoneSettingsCollectionResultMinTlsVersionEditableTrue ZoneSettingsCollectionResultMinTlsVersionEditable = true - ZoneSettingsCollectionResultMinTlsVersionEditableFalse ZoneSettingsCollectionResultMinTlsVersionEditable = false + ZoneSettingEditResponseResultZonesMinTlsVersionEditableTrue ZoneSettingEditResponseResultZonesMinTlsVersionEditable = true + ZoneSettingEditResponseResultZonesMinTlsVersionEditableFalse ZoneSettingEditResponseResultZonesMinTlsVersionEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultMinTlsVersionValue string +type ZoneSettingEditResponseResultZonesMinTlsVersionValue string const ( - ZoneSettingsCollectionResultMinTlsVersionValue1_0 ZoneSettingsCollectionResultMinTlsVersionValue = "1.0" - ZoneSettingsCollectionResultMinTlsVersionValue1_1 ZoneSettingsCollectionResultMinTlsVersionValue = "1.1" - ZoneSettingsCollectionResultMinTlsVersionValue1_2 ZoneSettingsCollectionResultMinTlsVersionValue = "1.2" - ZoneSettingsCollectionResultMinTlsVersionValue1_3 ZoneSettingsCollectionResultMinTlsVersionValue = "1.3" + ZoneSettingEditResponseResultZonesMinTlsVersionValue1_0 ZoneSettingEditResponseResultZonesMinTlsVersionValue = "1.0" + ZoneSettingEditResponseResultZonesMinTlsVersionValue1_1 ZoneSettingEditResponseResultZonesMinTlsVersionValue = "1.1" + ZoneSettingEditResponseResultZonesMinTlsVersionValue1_2 ZoneSettingEditResponseResultZonesMinTlsVersionValue = "1.2" + ZoneSettingEditResponseResultZonesMinTlsVersionValue1_3 ZoneSettingEditResponseResultZonesMinTlsVersionValue = "1.3" ) // Automatically minify certain assets for your website. Refer to // [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) // for more information. -type ZoneSettingsCollectionResultMinify struct { +type ZoneSettingEditResponseResultZonesMinify struct { // Zone setting identifier. - ID ZoneSettingsCollectionResultMinifyID `json:"id"` + ID ZoneSettingEditResponseResultZonesMinifyID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultMinifyEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesMinifyEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultMinifyValue `json:"value"` - JSON zoneSettingsCollectionResultMinifyJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesMinifyValue `json:"value"` + JSON zoneSettingEditResponseResultZonesMinifyJSON `json:"-"` } -// zoneSettingsCollectionResultMinifyJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultMinify] -type zoneSettingsCollectionResultMinifyJSON struct { +// zoneSettingEditResponseResultZonesMinifyJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesMinify] +type zoneSettingEditResponseResultZonesMinifyJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1804,42 +5287,42 @@ type zoneSettingsCollectionResultMinifyJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultMinify) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesMinify) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultMinify) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesMinify) implementsZoneSettingEditResponseResult() {} // Zone setting identifier. -type ZoneSettingsCollectionResultMinifyID string +type ZoneSettingEditResponseResultZonesMinifyID string const ( - ZoneSettingsCollectionResultMinifyIDMinify ZoneSettingsCollectionResultMinifyID = "minify" + ZoneSettingEditResponseResultZonesMinifyIDMinify ZoneSettingEditResponseResultZonesMinifyID = "minify" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultMinifyEditable bool +type ZoneSettingEditResponseResultZonesMinifyEditable bool const ( - ZoneSettingsCollectionResultMinifyEditableTrue ZoneSettingsCollectionResultMinifyEditable = true - ZoneSettingsCollectionResultMinifyEditableFalse ZoneSettingsCollectionResultMinifyEditable = false + ZoneSettingEditResponseResultZonesMinifyEditableTrue ZoneSettingEditResponseResultZonesMinifyEditable = true + ZoneSettingEditResponseResultZonesMinifyEditableFalse ZoneSettingEditResponseResultZonesMinifyEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultMinifyValue struct { +type ZoneSettingEditResponseResultZonesMinifyValue struct { // Automatically minify all CSS files for your website. - Css ZoneSettingsCollectionResultMinifyValueCss `json:"css"` + Css ZoneSettingEditResponseResultZonesMinifyValueCss `json:"css"` // Automatically minify all HTML files for your website. - HTML ZoneSettingsCollectionResultMinifyValueHTML `json:"html"` + HTML ZoneSettingEditResponseResultZonesMinifyValueHTML `json:"html"` // Automatically minify all JavaScript files for your website. - Js ZoneSettingsCollectionResultMinifyValueJs `json:"js"` - JSON zoneSettingsCollectionResultMinifyValueJSON `json:"-"` + Js ZoneSettingEditResponseResultZonesMinifyValueJs `json:"js"` + JSON zoneSettingEditResponseResultZonesMinifyValueJSON `json:"-"` } -// zoneSettingsCollectionResultMinifyValueJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultMinifyValue] -type zoneSettingsCollectionResultMinifyValueJSON struct { +// zoneSettingEditResponseResultZonesMinifyValueJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesMinifyValue] +type zoneSettingEditResponseResultZonesMinifyValueJSON struct { Css apijson.Field HTML apijson.Field Js apijson.Field @@ -1847,54 +5330,54 @@ type zoneSettingsCollectionResultMinifyValueJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultMinifyValue) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesMinifyValue) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Automatically minify all CSS files for your website. -type ZoneSettingsCollectionResultMinifyValueCss string +type ZoneSettingEditResponseResultZonesMinifyValueCss string const ( - ZoneSettingsCollectionResultMinifyValueCssOn ZoneSettingsCollectionResultMinifyValueCss = "on" - ZoneSettingsCollectionResultMinifyValueCssOff ZoneSettingsCollectionResultMinifyValueCss = "off" + ZoneSettingEditResponseResultZonesMinifyValueCssOn ZoneSettingEditResponseResultZonesMinifyValueCss = "on" + ZoneSettingEditResponseResultZonesMinifyValueCssOff ZoneSettingEditResponseResultZonesMinifyValueCss = "off" ) // Automatically minify all HTML files for your website. -type ZoneSettingsCollectionResultMinifyValueHTML string +type ZoneSettingEditResponseResultZonesMinifyValueHTML string const ( - ZoneSettingsCollectionResultMinifyValueHTMLOn ZoneSettingsCollectionResultMinifyValueHTML = "on" - ZoneSettingsCollectionResultMinifyValueHTMLOff ZoneSettingsCollectionResultMinifyValueHTML = "off" + ZoneSettingEditResponseResultZonesMinifyValueHTMLOn ZoneSettingEditResponseResultZonesMinifyValueHTML = "on" + ZoneSettingEditResponseResultZonesMinifyValueHTMLOff ZoneSettingEditResponseResultZonesMinifyValueHTML = "off" ) // Automatically minify all JavaScript files for your website. -type ZoneSettingsCollectionResultMinifyValueJs string +type ZoneSettingEditResponseResultZonesMinifyValueJs string const ( - ZoneSettingsCollectionResultMinifyValueJsOn ZoneSettingsCollectionResultMinifyValueJs = "on" - ZoneSettingsCollectionResultMinifyValueJsOff ZoneSettingsCollectionResultMinifyValueJs = "off" + ZoneSettingEditResponseResultZonesMinifyValueJsOn ZoneSettingEditResponseResultZonesMinifyValueJs = "on" + ZoneSettingEditResponseResultZonesMinifyValueJsOff ZoneSettingEditResponseResultZonesMinifyValueJs = "off" ) // Automatically optimize image loading for website visitors on mobile devices. // Refer to // [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for // more information. -type ZoneSettingsCollectionResultMirage struct { +type ZoneSettingEditResponseResultZonesMirage struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultMirageID `json:"id"` + ID ZoneSettingEditResponseResultZonesMirageID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultMirageEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesMirageEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultMirageValue `json:"value"` - JSON zoneSettingsCollectionResultMirageJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesMirageValue `json:"value"` + JSON zoneSettingEditResponseResultZonesMirageJSON `json:"-"` } -// zoneSettingsCollectionResultMirageJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultMirage] -type zoneSettingsCollectionResultMirageJSON struct { +// zoneSettingEditResponseResultZonesMirageJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesMirage] +type zoneSettingEditResponseResultZonesMirageJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1903,56 +5386,56 @@ type zoneSettingsCollectionResultMirageJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultMirage) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesMirage) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultMirage) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesMirage) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultMirageID string +type ZoneSettingEditResponseResultZonesMirageID string const ( - ZoneSettingsCollectionResultMirageIDMirage ZoneSettingsCollectionResultMirageID = "mirage" + ZoneSettingEditResponseResultZonesMirageIDMirage ZoneSettingEditResponseResultZonesMirageID = "mirage" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultMirageEditable bool +type ZoneSettingEditResponseResultZonesMirageEditable bool const ( - ZoneSettingsCollectionResultMirageEditableTrue ZoneSettingsCollectionResultMirageEditable = true - ZoneSettingsCollectionResultMirageEditableFalse ZoneSettingsCollectionResultMirageEditable = false + ZoneSettingEditResponseResultZonesMirageEditableTrue ZoneSettingEditResponseResultZonesMirageEditable = true + ZoneSettingEditResponseResultZonesMirageEditableFalse ZoneSettingEditResponseResultZonesMirageEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultMirageValue string +type ZoneSettingEditResponseResultZonesMirageValue string const ( - ZoneSettingsCollectionResultMirageValueOn ZoneSettingsCollectionResultMirageValue = "on" - ZoneSettingsCollectionResultMirageValueOff ZoneSettingsCollectionResultMirageValue = "off" + ZoneSettingEditResponseResultZonesMirageValueOn ZoneSettingEditResponseResultZonesMirageValue = "on" + ZoneSettingEditResponseResultZonesMirageValueOff ZoneSettingEditResponseResultZonesMirageValue = "off" ) // Automatically redirect visitors on mobile devices to a mobile-optimized // subdomain. Refer to // [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) // for more information. -type ZoneSettingsCollectionResultMobileRedirect struct { +type ZoneSettingEditResponseResultZonesMobileRedirect struct { // Identifier of the zone setting. - ID ZoneSettingsCollectionResultMobileRedirectID `json:"id"` + ID ZoneSettingEditResponseResultZonesMobileRedirectID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultMobileRedirectEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesMobileRedirectEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultMobileRedirectValue `json:"value"` - JSON zoneSettingsCollectionResultMobileRedirectJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesMobileRedirectValue `json:"value"` + JSON zoneSettingEditResponseResultZonesMobileRedirectJSON `json:"-"` } -// zoneSettingsCollectionResultMobileRedirectJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultMobileRedirect] -type zoneSettingsCollectionResultMobileRedirectJSON struct { +// zoneSettingEditResponseResultZonesMobileRedirectJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesMobileRedirect] +type zoneSettingEditResponseResultZonesMobileRedirectJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -1961,44 +5444,44 @@ type zoneSettingsCollectionResultMobileRedirectJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultMobileRedirect) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesMobileRedirect) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultMobileRedirect) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesMobileRedirect) implementsZoneSettingEditResponseResult() {} // Identifier of the zone setting. -type ZoneSettingsCollectionResultMobileRedirectID string +type ZoneSettingEditResponseResultZonesMobileRedirectID string const ( - ZoneSettingsCollectionResultMobileRedirectIDMobileRedirect ZoneSettingsCollectionResultMobileRedirectID = "mobile_redirect" + ZoneSettingEditResponseResultZonesMobileRedirectIDMobileRedirect ZoneSettingEditResponseResultZonesMobileRedirectID = "mobile_redirect" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultMobileRedirectEditable bool +type ZoneSettingEditResponseResultZonesMobileRedirectEditable bool const ( - ZoneSettingsCollectionResultMobileRedirectEditableTrue ZoneSettingsCollectionResultMobileRedirectEditable = true - ZoneSettingsCollectionResultMobileRedirectEditableFalse ZoneSettingsCollectionResultMobileRedirectEditable = false + ZoneSettingEditResponseResultZonesMobileRedirectEditableTrue ZoneSettingEditResponseResultZonesMobileRedirectEditable = true + ZoneSettingEditResponseResultZonesMobileRedirectEditableFalse ZoneSettingEditResponseResultZonesMobileRedirectEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultMobileRedirectValue struct { +type ZoneSettingEditResponseResultZonesMobileRedirectValue struct { // Which subdomain prefix you wish to redirect visitors on mobile devices to // (subdomain must already exist). MobileSubdomain string `json:"mobile_subdomain,nullable"` // Whether or not mobile redirect is enabled. - Status ZoneSettingsCollectionResultMobileRedirectValueStatus `json:"status"` + Status ZoneSettingEditResponseResultZonesMobileRedirectValueStatus `json:"status"` // Whether to drop the current page path and redirect to the mobile subdomain URL // root, or keep the path and redirect to the same page on the mobile subdomain. - StripUri bool `json:"strip_uri"` - JSON zoneSettingsCollectionResultMobileRedirectValueJSON `json:"-"` + StripUri bool `json:"strip_uri"` + JSON zoneSettingEditResponseResultZonesMobileRedirectValueJSON `json:"-"` } -// zoneSettingsCollectionResultMobileRedirectValueJSON contains the JSON metadata -// for the struct [ZoneSettingsCollectionResultMobileRedirectValue] -type zoneSettingsCollectionResultMobileRedirectValueJSON struct { +// zoneSettingEditResponseResultZonesMobileRedirectValueJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesMobileRedirectValue] +type zoneSettingEditResponseResultZonesMobileRedirectValueJSON struct { MobileSubdomain apijson.Field Status apijson.Field StripUri apijson.Field @@ -2006,35 +5489,35 @@ type zoneSettingsCollectionResultMobileRedirectValueJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultMobileRedirectValue) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesMobileRedirectValue) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether or not mobile redirect is enabled. -type ZoneSettingsCollectionResultMobileRedirectValueStatus string +type ZoneSettingEditResponseResultZonesMobileRedirectValueStatus string const ( - ZoneSettingsCollectionResultMobileRedirectValueStatusOn ZoneSettingsCollectionResultMobileRedirectValueStatus = "on" - ZoneSettingsCollectionResultMobileRedirectValueStatusOff ZoneSettingsCollectionResultMobileRedirectValueStatus = "off" + ZoneSettingEditResponseResultZonesMobileRedirectValueStatusOn ZoneSettingEditResponseResultZonesMobileRedirectValueStatus = "on" + ZoneSettingEditResponseResultZonesMobileRedirectValueStatusOff ZoneSettingEditResponseResultZonesMobileRedirectValueStatus = "off" ) // Enable Network Error Logging reporting on your zone. (Beta) -type ZoneSettingsCollectionResultNel struct { +type ZoneSettingEditResponseResultZonesNel struct { // Zone setting identifier. - ID ZoneSettingsCollectionResultNelID `json:"id"` + ID ZoneSettingEditResponseResultZonesNelID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultNelEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesNelEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultNelValue `json:"value"` - JSON zoneSettingsCollectionResultNelJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesNelValue `json:"value"` + JSON zoneSettingEditResponseResultZonesNelJSON `json:"-"` } -// zoneSettingsCollectionResultNelJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultNel] -type zoneSettingsCollectionResultNelJSON struct { +// zoneSettingEditResponseResultZonesNelJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesNel] +type zoneSettingEditResponseResultZonesNelJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2043,64 +5526,65 @@ type zoneSettingsCollectionResultNelJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultNel) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesNel) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultNel) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesNel) implementsZoneSettingEditResponseResult() {} // Zone setting identifier. -type ZoneSettingsCollectionResultNelID string +type ZoneSettingEditResponseResultZonesNelID string const ( - ZoneSettingsCollectionResultNelIDNel ZoneSettingsCollectionResultNelID = "nel" + ZoneSettingEditResponseResultZonesNelIDNel ZoneSettingEditResponseResultZonesNelID = "nel" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultNelEditable bool +type ZoneSettingEditResponseResultZonesNelEditable bool const ( - ZoneSettingsCollectionResultNelEditableTrue ZoneSettingsCollectionResultNelEditable = true - ZoneSettingsCollectionResultNelEditableFalse ZoneSettingsCollectionResultNelEditable = false + ZoneSettingEditResponseResultZonesNelEditableTrue ZoneSettingEditResponseResultZonesNelEditable = true + ZoneSettingEditResponseResultZonesNelEditableFalse ZoneSettingEditResponseResultZonesNelEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultNelValue struct { - Enabled bool `json:"enabled"` - JSON zoneSettingsCollectionResultNelValueJSON `json:"-"` +type ZoneSettingEditResponseResultZonesNelValue struct { + Enabled bool `json:"enabled"` + JSON zoneSettingEditResponseResultZonesNelValueJSON `json:"-"` } -// zoneSettingsCollectionResultNelValueJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultNelValue] -type zoneSettingsCollectionResultNelValueJSON struct { +// zoneSettingEditResponseResultZonesNelValueJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesNelValue] +type zoneSettingEditResponseResultZonesNelValueJSON struct { Enabled apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultNelValue) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesNelValue) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Enables the Opportunistic Encryption feature for a zone. -type ZoneSettingsCollectionResultOpportunisticEncryption struct { +type ZoneSettingEditResponseResultZonesOpportunisticEncryption struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultOpportunisticEncryptionID `json:"id"` + ID ZoneSettingEditResponseResultZonesOpportunisticEncryptionID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultOpportunisticEncryptionEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesOpportunisticEncryptionEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value ZoneSettingsCollectionResultOpportunisticEncryptionValue `json:"value"` - JSON zoneSettingsCollectionResultOpportunisticEncryptionJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesOpportunisticEncryptionValue `json:"value"` + JSON zoneSettingEditResponseResultZonesOpportunisticEncryptionJSON `json:"-"` } -// zoneSettingsCollectionResultOpportunisticEncryptionJSON contains the JSON -// metadata for the struct [ZoneSettingsCollectionResultOpportunisticEncryption] -type zoneSettingsCollectionResultOpportunisticEncryptionJSON struct { +// zoneSettingEditResponseResultZonesOpportunisticEncryptionJSON contains the JSON +// metadata for the struct +// [ZoneSettingEditResponseResultZonesOpportunisticEncryption] +type zoneSettingEditResponseResultZonesOpportunisticEncryptionJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2109,57 +5593,57 @@ type zoneSettingsCollectionResultOpportunisticEncryptionJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultOpportunisticEncryption) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesOpportunisticEncryption) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultOpportunisticEncryption) implementsZoneSettingsCollectionResult() { +func (r ZoneSettingEditResponseResultZonesOpportunisticEncryption) implementsZoneSettingEditResponseResult() { } // ID of the zone setting. -type ZoneSettingsCollectionResultOpportunisticEncryptionID string +type ZoneSettingEditResponseResultZonesOpportunisticEncryptionID string const ( - ZoneSettingsCollectionResultOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingsCollectionResultOpportunisticEncryptionID = "opportunistic_encryption" + ZoneSettingEditResponseResultZonesOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingEditResponseResultZonesOpportunisticEncryptionID = "opportunistic_encryption" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultOpportunisticEncryptionEditable bool +type ZoneSettingEditResponseResultZonesOpportunisticEncryptionEditable bool const ( - ZoneSettingsCollectionResultOpportunisticEncryptionEditableTrue ZoneSettingsCollectionResultOpportunisticEncryptionEditable = true - ZoneSettingsCollectionResultOpportunisticEncryptionEditableFalse ZoneSettingsCollectionResultOpportunisticEncryptionEditable = false + ZoneSettingEditResponseResultZonesOpportunisticEncryptionEditableTrue ZoneSettingEditResponseResultZonesOpportunisticEncryptionEditable = true + ZoneSettingEditResponseResultZonesOpportunisticEncryptionEditableFalse ZoneSettingEditResponseResultZonesOpportunisticEncryptionEditable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingsCollectionResultOpportunisticEncryptionValue string +type ZoneSettingEditResponseResultZonesOpportunisticEncryptionValue string const ( - ZoneSettingsCollectionResultOpportunisticEncryptionValueOn ZoneSettingsCollectionResultOpportunisticEncryptionValue = "on" - ZoneSettingsCollectionResultOpportunisticEncryptionValueOff ZoneSettingsCollectionResultOpportunisticEncryptionValue = "off" + ZoneSettingEditResponseResultZonesOpportunisticEncryptionValueOn ZoneSettingEditResponseResultZonesOpportunisticEncryptionValue = "on" + ZoneSettingEditResponseResultZonesOpportunisticEncryptionValueOff ZoneSettingEditResponseResultZonesOpportunisticEncryptionValue = "off" ) // Add an Alt-Svc header to all legitimate requests from Tor, allowing the // connection to use our onion services instead of exit nodes. -type ZoneSettingsCollectionResultOpportunisticOnion struct { +type ZoneSettingEditResponseResultZonesOpportunisticOnion struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultOpportunisticOnionID `json:"id"` + ID ZoneSettingEditResponseResultZonesOpportunisticOnionID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultOpportunisticOnionEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesOpportunisticOnionEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value ZoneSettingsCollectionResultOpportunisticOnionValue `json:"value"` - JSON zoneSettingsCollectionResultOpportunisticOnionJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesOpportunisticOnionValue `json:"value"` + JSON zoneSettingEditResponseResultZonesOpportunisticOnionJSON `json:"-"` } -// zoneSettingsCollectionResultOpportunisticOnionJSON contains the JSON metadata -// for the struct [ZoneSettingsCollectionResultOpportunisticOnion] -type zoneSettingsCollectionResultOpportunisticOnionJSON struct { +// zoneSettingEditResponseResultZonesOpportunisticOnionJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesOpportunisticOnion] +type zoneSettingEditResponseResultZonesOpportunisticOnionJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2168,55 +5652,56 @@ type zoneSettingsCollectionResultOpportunisticOnionJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultOpportunisticOnion) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesOpportunisticOnion) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultOpportunisticOnion) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesOpportunisticOnion) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultOpportunisticOnionID string +type ZoneSettingEditResponseResultZonesOpportunisticOnionID string const ( - ZoneSettingsCollectionResultOpportunisticOnionIDOpportunisticOnion ZoneSettingsCollectionResultOpportunisticOnionID = "opportunistic_onion" + ZoneSettingEditResponseResultZonesOpportunisticOnionIDOpportunisticOnion ZoneSettingEditResponseResultZonesOpportunisticOnionID = "opportunistic_onion" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultOpportunisticOnionEditable bool +type ZoneSettingEditResponseResultZonesOpportunisticOnionEditable bool const ( - ZoneSettingsCollectionResultOpportunisticOnionEditableTrue ZoneSettingsCollectionResultOpportunisticOnionEditable = true - ZoneSettingsCollectionResultOpportunisticOnionEditableFalse ZoneSettingsCollectionResultOpportunisticOnionEditable = false + ZoneSettingEditResponseResultZonesOpportunisticOnionEditableTrue ZoneSettingEditResponseResultZonesOpportunisticOnionEditable = true + ZoneSettingEditResponseResultZonesOpportunisticOnionEditableFalse ZoneSettingEditResponseResultZonesOpportunisticOnionEditable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingsCollectionResultOpportunisticOnionValue string +type ZoneSettingEditResponseResultZonesOpportunisticOnionValue string const ( - ZoneSettingsCollectionResultOpportunisticOnionValueOn ZoneSettingsCollectionResultOpportunisticOnionValue = "on" - ZoneSettingsCollectionResultOpportunisticOnionValueOff ZoneSettingsCollectionResultOpportunisticOnionValue = "off" + ZoneSettingEditResponseResultZonesOpportunisticOnionValueOn ZoneSettingEditResponseResultZonesOpportunisticOnionValue = "on" + ZoneSettingEditResponseResultZonesOpportunisticOnionValueOff ZoneSettingEditResponseResultZonesOpportunisticOnionValue = "off" ) // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also // on Cloudflare. -type ZoneSettingsCollectionResultOrangeToOrange struct { +type ZoneSettingEditResponseResultZonesOrangeToOrange struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultOrangeToOrangeID `json:"id"` + ID ZoneSettingEditResponseResultZonesOrangeToOrangeID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultOrangeToOrangeEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesOrangeToOrangeEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultOrangeToOrangeValue `json:"value"` - JSON zoneSettingsCollectionResultOrangeToOrangeJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesOrangeToOrangeValue `json:"value"` + JSON zoneSettingEditResponseResultZonesOrangeToOrangeJSON `json:"-"` } -// zoneSettingsCollectionResultOrangeToOrangeJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultOrangeToOrange] -type zoneSettingsCollectionResultOrangeToOrangeJSON struct { +// zoneSettingEditResponseResultZonesOrangeToOrangeJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesOrangeToOrange] +type zoneSettingEditResponseResultZonesOrangeToOrangeJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2225,55 +5710,56 @@ type zoneSettingsCollectionResultOrangeToOrangeJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultOrangeToOrange) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesOrangeToOrange) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultOrangeToOrange) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesOrangeToOrange) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultOrangeToOrangeID string +type ZoneSettingEditResponseResultZonesOrangeToOrangeID string const ( - ZoneSettingsCollectionResultOrangeToOrangeIDOrangeToOrange ZoneSettingsCollectionResultOrangeToOrangeID = "orange_to_orange" + ZoneSettingEditResponseResultZonesOrangeToOrangeIDOrangeToOrange ZoneSettingEditResponseResultZonesOrangeToOrangeID = "orange_to_orange" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultOrangeToOrangeEditable bool +type ZoneSettingEditResponseResultZonesOrangeToOrangeEditable bool const ( - ZoneSettingsCollectionResultOrangeToOrangeEditableTrue ZoneSettingsCollectionResultOrangeToOrangeEditable = true - ZoneSettingsCollectionResultOrangeToOrangeEditableFalse ZoneSettingsCollectionResultOrangeToOrangeEditable = false + ZoneSettingEditResponseResultZonesOrangeToOrangeEditableTrue ZoneSettingEditResponseResultZonesOrangeToOrangeEditable = true + ZoneSettingEditResponseResultZonesOrangeToOrangeEditableFalse ZoneSettingEditResponseResultZonesOrangeToOrangeEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultOrangeToOrangeValue string +type ZoneSettingEditResponseResultZonesOrangeToOrangeValue string const ( - ZoneSettingsCollectionResultOrangeToOrangeValueOn ZoneSettingsCollectionResultOrangeToOrangeValue = "on" - ZoneSettingsCollectionResultOrangeToOrangeValueOff ZoneSettingsCollectionResultOrangeToOrangeValue = "off" + ZoneSettingEditResponseResultZonesOrangeToOrangeValueOn ZoneSettingEditResponseResultZonesOrangeToOrangeValue = "on" + ZoneSettingEditResponseResultZonesOrangeToOrangeValueOff ZoneSettingEditResponseResultZonesOrangeToOrangeValue = "off" ) // Cloudflare will proxy customer error pages on any 502,504 errors on origin // server instead of showing a default Cloudflare error page. This does not apply // to 522 errors and is limited to Enterprise Zones. -type ZoneSettingsCollectionResultOriginErrorPagePassThru struct { +type ZoneSettingEditResponseResultZonesOriginErrorPagePassThru struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultOriginErrorPagePassThruID `json:"id"` + ID ZoneSettingEditResponseResultZonesOriginErrorPagePassThruID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultOriginErrorPagePassThruEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesOriginErrorPagePassThruEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultOriginErrorPagePassThruValue `json:"value"` - JSON zoneSettingsCollectionResultOriginErrorPagePassThruJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesOriginErrorPagePassThruValue `json:"value"` + JSON zoneSettingEditResponseResultZonesOriginErrorPagePassThruJSON `json:"-"` } -// zoneSettingsCollectionResultOriginErrorPagePassThruJSON contains the JSON -// metadata for the struct [ZoneSettingsCollectionResultOriginErrorPagePassThru] -type zoneSettingsCollectionResultOriginErrorPagePassThruJSON struct { +// zoneSettingEditResponseResultZonesOriginErrorPagePassThruJSON contains the JSON +// metadata for the struct +// [ZoneSettingEditResponseResultZonesOriginErrorPagePassThru] +type zoneSettingEditResponseResultZonesOriginErrorPagePassThruJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2282,65 +5768,66 @@ type zoneSettingsCollectionResultOriginErrorPagePassThruJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultOriginErrorPagePassThru) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesOriginErrorPagePassThru) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultOriginErrorPagePassThru) implementsZoneSettingsCollectionResult() { +func (r ZoneSettingEditResponseResultZonesOriginErrorPagePassThru) implementsZoneSettingEditResponseResult() { } // ID of the zone setting. -type ZoneSettingsCollectionResultOriginErrorPagePassThruID string +type ZoneSettingEditResponseResultZonesOriginErrorPagePassThruID string const ( - ZoneSettingsCollectionResultOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingsCollectionResultOriginErrorPagePassThruID = "origin_error_page_pass_thru" + ZoneSettingEditResponseResultZonesOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingEditResponseResultZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultOriginErrorPagePassThruEditable bool +type ZoneSettingEditResponseResultZonesOriginErrorPagePassThruEditable bool const ( - ZoneSettingsCollectionResultOriginErrorPagePassThruEditableTrue ZoneSettingsCollectionResultOriginErrorPagePassThruEditable = true - ZoneSettingsCollectionResultOriginErrorPagePassThruEditableFalse ZoneSettingsCollectionResultOriginErrorPagePassThruEditable = false + ZoneSettingEditResponseResultZonesOriginErrorPagePassThruEditableTrue ZoneSettingEditResponseResultZonesOriginErrorPagePassThruEditable = true + ZoneSettingEditResponseResultZonesOriginErrorPagePassThruEditableFalse ZoneSettingEditResponseResultZonesOriginErrorPagePassThruEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultOriginErrorPagePassThruValue string +type ZoneSettingEditResponseResultZonesOriginErrorPagePassThruValue string const ( - ZoneSettingsCollectionResultOriginErrorPagePassThruValueOn ZoneSettingsCollectionResultOriginErrorPagePassThruValue = "on" - ZoneSettingsCollectionResultOriginErrorPagePassThruValueOff ZoneSettingsCollectionResultOriginErrorPagePassThruValue = "off" + ZoneSettingEditResponseResultZonesOriginErrorPagePassThruValueOn ZoneSettingEditResponseResultZonesOriginErrorPagePassThruValue = "on" + ZoneSettingEditResponseResultZonesOriginErrorPagePassThruValueOff ZoneSettingEditResponseResultZonesOriginErrorPagePassThruValue = "off" ) -type ZoneSettingsCollectionResultOriginMaxHTTPVersion struct { +type ZoneSettingEditResponseResultZonesOriginMaxHTTPVersion struct { // Identifier of the zone setting. - ID ZoneSettingsCollectionResultOriginMaxHTTPVersionID `json:"id,required"` + ID ZoneSettingEditResponseResultZonesOriginMaxHTTPVersionID `json:"id,required"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON zoneSettingsCollectionResultOriginMaxHTTPVersionJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseResultZonesOriginMaxHTTPVersionJSON `json:"-"` } -// zoneSettingsCollectionResultOriginMaxHTTPVersionJSON contains the JSON metadata -// for the struct [ZoneSettingsCollectionResultOriginMaxHTTPVersion] -type zoneSettingsCollectionResultOriginMaxHTTPVersionJSON struct { +// zoneSettingEditResponseResultZonesOriginMaxHTTPVersionJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesOriginMaxHTTPVersion] +type zoneSettingEditResponseResultZonesOriginMaxHTTPVersionJSON struct { ID apijson.Field ModifiedOn apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultOriginMaxHTTPVersion) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesOriginMaxHTTPVersion) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultOriginMaxHTTPVersion) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesOriginMaxHTTPVersion) implementsZoneSettingEditResponseResult() { +} // Identifier of the zone setting. -type ZoneSettingsCollectionResultOriginMaxHTTPVersionID string +type ZoneSettingEditResponseResultZonesOriginMaxHTTPVersionID string const ( - ZoneSettingsCollectionResultOriginMaxHTTPVersionIDOriginMaxHTTPVersion ZoneSettingsCollectionResultOriginMaxHTTPVersionID = "origin_max_http_version" + ZoneSettingEditResponseResultZonesOriginMaxHTTPVersionIDOriginMaxHTTPVersion ZoneSettingEditResponseResultZonesOriginMaxHTTPVersionID = "origin_max_http_version" ) // Removes metadata and compresses your images for faster page load times. Basic @@ -2349,22 +5836,22 @@ const ( // image loading. Larger JPEGs are converted to progressive images, loading a // lower-resolution image first and ending in a higher-resolution version. Not // recommended for hi-res photography sites. -type ZoneSettingsCollectionResultPolish struct { +type ZoneSettingEditResponseResultZonesPolish struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultPolishID `json:"id"` + ID ZoneSettingEditResponseResultZonesPolishID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultPolishEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesPolishEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultPolishValue `json:"value"` - JSON zoneSettingsCollectionResultPolishJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesPolishValue `json:"value"` + JSON zoneSettingEditResponseResultZonesPolishJSON `json:"-"` } -// zoneSettingsCollectionResultPolishJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultPolish] -type zoneSettingsCollectionResultPolishJSON struct { +// zoneSettingEditResponseResultZonesPolishJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesPolish] +type zoneSettingEditResponseResultZonesPolishJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2373,55 +5860,55 @@ type zoneSettingsCollectionResultPolishJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultPolish) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesPolish) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultPolish) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesPolish) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultPolishID string +type ZoneSettingEditResponseResultZonesPolishID string const ( - ZoneSettingsCollectionResultPolishIDPolish ZoneSettingsCollectionResultPolishID = "polish" + ZoneSettingEditResponseResultZonesPolishIDPolish ZoneSettingEditResponseResultZonesPolishID = "polish" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultPolishEditable bool +type ZoneSettingEditResponseResultZonesPolishEditable bool const ( - ZoneSettingsCollectionResultPolishEditableTrue ZoneSettingsCollectionResultPolishEditable = true - ZoneSettingsCollectionResultPolishEditableFalse ZoneSettingsCollectionResultPolishEditable = false + ZoneSettingEditResponseResultZonesPolishEditableTrue ZoneSettingEditResponseResultZonesPolishEditable = true + ZoneSettingEditResponseResultZonesPolishEditableFalse ZoneSettingEditResponseResultZonesPolishEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultPolishValue string +type ZoneSettingEditResponseResultZonesPolishValue string const ( - ZoneSettingsCollectionResultPolishValueOff ZoneSettingsCollectionResultPolishValue = "off" - ZoneSettingsCollectionResultPolishValueLossless ZoneSettingsCollectionResultPolishValue = "lossless" - ZoneSettingsCollectionResultPolishValueLossy ZoneSettingsCollectionResultPolishValue = "lossy" + ZoneSettingEditResponseResultZonesPolishValueOff ZoneSettingEditResponseResultZonesPolishValue = "off" + ZoneSettingEditResponseResultZonesPolishValueLossless ZoneSettingEditResponseResultZonesPolishValue = "lossless" + ZoneSettingEditResponseResultZonesPolishValueLossy ZoneSettingEditResponseResultZonesPolishValue = "lossy" ) // Cloudflare will prefetch any URLs that are included in the response headers. // This is limited to Enterprise Zones. -type ZoneSettingsCollectionResultPrefetchPreload struct { +type ZoneSettingEditResponseResultZonesPrefetchPreload struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultPrefetchPreloadID `json:"id"` + ID ZoneSettingEditResponseResultZonesPrefetchPreloadID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultPrefetchPreloadEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesPrefetchPreloadEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultPrefetchPreloadValue `json:"value"` - JSON zoneSettingsCollectionResultPrefetchPreloadJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesPrefetchPreloadValue `json:"value"` + JSON zoneSettingEditResponseResultZonesPrefetchPreloadJSON `json:"-"` } -// zoneSettingsCollectionResultPrefetchPreloadJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultPrefetchPreload] -type zoneSettingsCollectionResultPrefetchPreloadJSON struct { +// zoneSettingEditResponseResultZonesPrefetchPreloadJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesPrefetchPreload] +type zoneSettingEditResponseResultZonesPrefetchPreloadJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2430,111 +5917,54 @@ type zoneSettingsCollectionResultPrefetchPreloadJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultPrefetchPreload) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesPrefetchPreload) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultPrefetchPreload) implementsZoneSettingsCollectionResult() {} - -// ID of the zone setting. -type ZoneSettingsCollectionResultPrefetchPreloadID string - -const ( - ZoneSettingsCollectionResultPrefetchPreloadIDPrefetchPreload ZoneSettingsCollectionResultPrefetchPreloadID = "prefetch_preload" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingsCollectionResultPrefetchPreloadEditable bool - -const ( - ZoneSettingsCollectionResultPrefetchPreloadEditableTrue ZoneSettingsCollectionResultPrefetchPreloadEditable = true - ZoneSettingsCollectionResultPrefetchPreloadEditableFalse ZoneSettingsCollectionResultPrefetchPreloadEditable = false -) - -// Value of the zone setting. -type ZoneSettingsCollectionResultPrefetchPreloadValue string - -const ( - ZoneSettingsCollectionResultPrefetchPreloadValueOn ZoneSettingsCollectionResultPrefetchPreloadValue = "on" - ZoneSettingsCollectionResultPrefetchPreloadValueOff ZoneSettingsCollectionResultPrefetchPreloadValue = "off" -) - -// Privacy Pass is a browser extension developed by the Privacy Pass Team to -// improve the browsing experience for your visitors. Enabling Privacy Pass will -// reduce the number of CAPTCHAs shown to your visitors. -// (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). -type ZoneSettingsCollectionResultPrivacyPass struct { - // ID of the zone setting. - ID ZoneSettingsCollectionResultPrivacyPassID `json:"id"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable ZoneSettingsCollectionResultPrivacyPassEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the zone setting. - Value ZoneSettingsCollectionResultPrivacyPassValue `json:"value"` - JSON zoneSettingsCollectionResultPrivacyPassJSON `json:"-"` -} - -// zoneSettingsCollectionResultPrivacyPassJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultPrivacyPass] -type zoneSettingsCollectionResultPrivacyPassJSON struct { - ID apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingsCollectionResultPrivacyPass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r ZoneSettingEditResponseResultZonesPrefetchPreload) implementsZoneSettingEditResponseResult() { } -func (r ZoneSettingsCollectionResultPrivacyPass) implementsZoneSettingsCollectionResult() {} - // ID of the zone setting. -type ZoneSettingsCollectionResultPrivacyPassID string +type ZoneSettingEditResponseResultZonesPrefetchPreloadID string const ( - ZoneSettingsCollectionResultPrivacyPassIDPrivacyPass ZoneSettingsCollectionResultPrivacyPassID = "privacy_pass" + ZoneSettingEditResponseResultZonesPrefetchPreloadIDPrefetchPreload ZoneSettingEditResponseResultZonesPrefetchPreloadID = "prefetch_preload" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultPrivacyPassEditable bool +type ZoneSettingEditResponseResultZonesPrefetchPreloadEditable bool const ( - ZoneSettingsCollectionResultPrivacyPassEditableTrue ZoneSettingsCollectionResultPrivacyPassEditable = true - ZoneSettingsCollectionResultPrivacyPassEditableFalse ZoneSettingsCollectionResultPrivacyPassEditable = false + ZoneSettingEditResponseResultZonesPrefetchPreloadEditableTrue ZoneSettingEditResponseResultZonesPrefetchPreloadEditable = true + ZoneSettingEditResponseResultZonesPrefetchPreloadEditableFalse ZoneSettingEditResponseResultZonesPrefetchPreloadEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultPrivacyPassValue string +type ZoneSettingEditResponseResultZonesPrefetchPreloadValue string const ( - ZoneSettingsCollectionResultPrivacyPassValueOn ZoneSettingsCollectionResultPrivacyPassValue = "on" - ZoneSettingsCollectionResultPrivacyPassValueOff ZoneSettingsCollectionResultPrivacyPassValue = "off" + ZoneSettingEditResponseResultZonesPrefetchPreloadValueOn ZoneSettingEditResponseResultZonesPrefetchPreloadValue = "on" + ZoneSettingEditResponseResultZonesPrefetchPreloadValueOff ZoneSettingEditResponseResultZonesPrefetchPreloadValue = "off" ) // Maximum time between two read operations from origin. -type ZoneSettingsCollectionResultProxyReadTimeout struct { +type ZoneSettingEditResponseResultZonesProxyReadTimeout struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultProxyReadTimeoutID `json:"id"` + ID ZoneSettingEditResponseResultZonesProxyReadTimeoutID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultProxyReadTimeoutEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesProxyReadTimeoutEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Value must be between 1 and 6000 - Value float64 `json:"value"` - JSON zoneSettingsCollectionResultProxyReadTimeoutJSON `json:"-"` + Value float64 `json:"value"` + JSON zoneSettingEditResponseResultZonesProxyReadTimeoutJSON `json:"-"` } -// zoneSettingsCollectionResultProxyReadTimeoutJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultProxyReadTimeout] -type zoneSettingsCollectionResultProxyReadTimeoutJSON struct { +// zoneSettingEditResponseResultZonesProxyReadTimeoutJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesProxyReadTimeout] +type zoneSettingEditResponseResultZonesProxyReadTimeoutJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2543,45 +5973,46 @@ type zoneSettingsCollectionResultProxyReadTimeoutJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultProxyReadTimeout) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesProxyReadTimeout) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultProxyReadTimeout) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesProxyReadTimeout) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultProxyReadTimeoutID string +type ZoneSettingEditResponseResultZonesProxyReadTimeoutID string const ( - ZoneSettingsCollectionResultProxyReadTimeoutIDProxyReadTimeout ZoneSettingsCollectionResultProxyReadTimeoutID = "proxy_read_timeout" + ZoneSettingEditResponseResultZonesProxyReadTimeoutIDProxyReadTimeout ZoneSettingEditResponseResultZonesProxyReadTimeoutID = "proxy_read_timeout" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultProxyReadTimeoutEditable bool +type ZoneSettingEditResponseResultZonesProxyReadTimeoutEditable bool const ( - ZoneSettingsCollectionResultProxyReadTimeoutEditableTrue ZoneSettingsCollectionResultProxyReadTimeoutEditable = true - ZoneSettingsCollectionResultProxyReadTimeoutEditableFalse ZoneSettingsCollectionResultProxyReadTimeoutEditable = false + ZoneSettingEditResponseResultZonesProxyReadTimeoutEditableTrue ZoneSettingEditResponseResultZonesProxyReadTimeoutEditable = true + ZoneSettingEditResponseResultZonesProxyReadTimeoutEditableFalse ZoneSettingEditResponseResultZonesProxyReadTimeoutEditable = false ) // The value set for the Pseudo IPv4 setting. -type ZoneSettingsCollectionResultPseudoIpv4 struct { +type ZoneSettingEditResponseResultZonesPseudoIpv4 struct { // Value of the Pseudo IPv4 setting. - ID ZoneSettingsCollectionResultPseudoIpv4ID `json:"id"` + ID ZoneSettingEditResponseResultZonesPseudoIpv4ID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultPseudoIpv4Editable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesPseudoIpv4Editable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the Pseudo IPv4 setting. - Value ZoneSettingsCollectionResultPseudoIpv4Value `json:"value"` - JSON zoneSettingsCollectionResultPseudoIpv4JSON `json:"-"` + Value ZoneSettingEditResponseResultZonesPseudoIpv4Value `json:"value"` + JSON zoneSettingEditResponseResultZonesPseudoIpv4JSON `json:"-"` } -// zoneSettingsCollectionResultPseudoIpv4JSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultPseudoIpv4] -type zoneSettingsCollectionResultPseudoIpv4JSON struct { +// zoneSettingEditResponseResultZonesPseudoIpv4JSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesPseudoIpv4] +type zoneSettingEditResponseResultZonesPseudoIpv4JSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2590,57 +6021,57 @@ type zoneSettingsCollectionResultPseudoIpv4JSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultPseudoIpv4) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesPseudoIpv4) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultPseudoIpv4) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesPseudoIpv4) implementsZoneSettingEditResponseResult() {} // Value of the Pseudo IPv4 setting. -type ZoneSettingsCollectionResultPseudoIpv4ID string +type ZoneSettingEditResponseResultZonesPseudoIpv4ID string const ( - ZoneSettingsCollectionResultPseudoIpv4IDPseudoIpv4 ZoneSettingsCollectionResultPseudoIpv4ID = "pseudo_ipv4" + ZoneSettingEditResponseResultZonesPseudoIpv4IDPseudoIpv4 ZoneSettingEditResponseResultZonesPseudoIpv4ID = "pseudo_ipv4" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultPseudoIpv4Editable bool +type ZoneSettingEditResponseResultZonesPseudoIpv4Editable bool const ( - ZoneSettingsCollectionResultPseudoIpv4EditableTrue ZoneSettingsCollectionResultPseudoIpv4Editable = true - ZoneSettingsCollectionResultPseudoIpv4EditableFalse ZoneSettingsCollectionResultPseudoIpv4Editable = false + ZoneSettingEditResponseResultZonesPseudoIpv4EditableTrue ZoneSettingEditResponseResultZonesPseudoIpv4Editable = true + ZoneSettingEditResponseResultZonesPseudoIpv4EditableFalse ZoneSettingEditResponseResultZonesPseudoIpv4Editable = false ) // Value of the Pseudo IPv4 setting. -type ZoneSettingsCollectionResultPseudoIpv4Value string +type ZoneSettingEditResponseResultZonesPseudoIpv4Value string const ( - ZoneSettingsCollectionResultPseudoIpv4ValueOff ZoneSettingsCollectionResultPseudoIpv4Value = "off" - ZoneSettingsCollectionResultPseudoIpv4ValueAddHeader ZoneSettingsCollectionResultPseudoIpv4Value = "add_header" - ZoneSettingsCollectionResultPseudoIpv4ValueOverwriteHeader ZoneSettingsCollectionResultPseudoIpv4Value = "overwrite_header" + ZoneSettingEditResponseResultZonesPseudoIpv4ValueOff ZoneSettingEditResponseResultZonesPseudoIpv4Value = "off" + ZoneSettingEditResponseResultZonesPseudoIpv4ValueAddHeader ZoneSettingEditResponseResultZonesPseudoIpv4Value = "add_header" + ZoneSettingEditResponseResultZonesPseudoIpv4ValueOverwriteHeader ZoneSettingEditResponseResultZonesPseudoIpv4Value = "overwrite_header" ) // Enables or disables buffering of responses from the proxied server. Cloudflare // may buffer the whole payload to deliver it at once to the client versus allowing // it to be delivered in chunks. By default, the proxied server streams directly // and is not buffered by Cloudflare. This is limited to Enterprise Zones. -type ZoneSettingsCollectionResultResponseBuffering struct { +type ZoneSettingEditResponseResultZonesResponseBuffering struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultResponseBufferingID `json:"id"` + ID ZoneSettingEditResponseResultZonesResponseBufferingID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultResponseBufferingEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesResponseBufferingEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultResponseBufferingValue `json:"value"` - JSON zoneSettingsCollectionResultResponseBufferingJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesResponseBufferingValue `json:"value"` + JSON zoneSettingEditResponseResultZonesResponseBufferingJSON `json:"-"` } -// zoneSettingsCollectionResultResponseBufferingJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultResponseBuffering] -type zoneSettingsCollectionResultResponseBufferingJSON struct { +// zoneSettingEditResponseResultZonesResponseBufferingJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesResponseBuffering] +type zoneSettingEditResponseResultZonesResponseBufferingJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2649,34 +6080,35 @@ type zoneSettingsCollectionResultResponseBufferingJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultResponseBuffering) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesResponseBuffering) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultResponseBuffering) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesResponseBuffering) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultResponseBufferingID string +type ZoneSettingEditResponseResultZonesResponseBufferingID string const ( - ZoneSettingsCollectionResultResponseBufferingIDResponseBuffering ZoneSettingsCollectionResultResponseBufferingID = "response_buffering" + ZoneSettingEditResponseResultZonesResponseBufferingIDResponseBuffering ZoneSettingEditResponseResultZonesResponseBufferingID = "response_buffering" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultResponseBufferingEditable bool +type ZoneSettingEditResponseResultZonesResponseBufferingEditable bool const ( - ZoneSettingsCollectionResultResponseBufferingEditableTrue ZoneSettingsCollectionResultResponseBufferingEditable = true - ZoneSettingsCollectionResultResponseBufferingEditableFalse ZoneSettingsCollectionResultResponseBufferingEditable = false + ZoneSettingEditResponseResultZonesResponseBufferingEditableTrue ZoneSettingEditResponseResultZonesResponseBufferingEditable = true + ZoneSettingEditResponseResultZonesResponseBufferingEditableFalse ZoneSettingEditResponseResultZonesResponseBufferingEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultResponseBufferingValue string +type ZoneSettingEditResponseResultZonesResponseBufferingValue string const ( - ZoneSettingsCollectionResultResponseBufferingValueOn ZoneSettingsCollectionResultResponseBufferingValue = "on" - ZoneSettingsCollectionResultResponseBufferingValueOff ZoneSettingsCollectionResultResponseBufferingValue = "off" + ZoneSettingEditResponseResultZonesResponseBufferingValueOn ZoneSettingEditResponseResultZonesResponseBufferingValue = "on" + ZoneSettingEditResponseResultZonesResponseBufferingValueOff ZoneSettingEditResponseResultZonesResponseBufferingValue = "off" ) // Rocket Loader is a general-purpose asynchronous JavaScript optimisation that @@ -2689,22 +6121,22 @@ const ( // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. -type ZoneSettingsCollectionResultRocketLoader struct { +type ZoneSettingEditResponseResultZonesRocketLoader struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultRocketLoaderID `json:"id"` + ID ZoneSettingEditResponseResultZonesRocketLoaderID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultRocketLoaderEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesRocketLoaderEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultRocketLoaderValue `json:"value"` - JSON zoneSettingsCollectionResultRocketLoaderJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesRocketLoaderValue `json:"value"` + JSON zoneSettingEditResponseResultZonesRocketLoaderJSON `json:"-"` } -// zoneSettingsCollectionResultRocketLoaderJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultRocketLoader] -type zoneSettingsCollectionResultRocketLoaderJSON struct { +// zoneSettingEditResponseResultZonesRocketLoaderJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesRocketLoader] +type zoneSettingEditResponseResultZonesRocketLoaderJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2713,55 +6145,55 @@ type zoneSettingsCollectionResultRocketLoaderJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultRocketLoader) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesRocketLoader) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultRocketLoader) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesRocketLoader) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultRocketLoaderID string +type ZoneSettingEditResponseResultZonesRocketLoaderID string const ( - ZoneSettingsCollectionResultRocketLoaderIDRocketLoader ZoneSettingsCollectionResultRocketLoaderID = "rocket_loader" + ZoneSettingEditResponseResultZonesRocketLoaderIDRocketLoader ZoneSettingEditResponseResultZonesRocketLoaderID = "rocket_loader" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultRocketLoaderEditable bool +type ZoneSettingEditResponseResultZonesRocketLoaderEditable bool const ( - ZoneSettingsCollectionResultRocketLoaderEditableTrue ZoneSettingsCollectionResultRocketLoaderEditable = true - ZoneSettingsCollectionResultRocketLoaderEditableFalse ZoneSettingsCollectionResultRocketLoaderEditable = false + ZoneSettingEditResponseResultZonesRocketLoaderEditableTrue ZoneSettingEditResponseResultZonesRocketLoaderEditable = true + ZoneSettingEditResponseResultZonesRocketLoaderEditableFalse ZoneSettingEditResponseResultZonesRocketLoaderEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultRocketLoaderValue string +type ZoneSettingEditResponseResultZonesRocketLoaderValue string const ( - ZoneSettingsCollectionResultRocketLoaderValueOn ZoneSettingsCollectionResultRocketLoaderValue = "on" - ZoneSettingsCollectionResultRocketLoaderValueOff ZoneSettingsCollectionResultRocketLoaderValue = "off" + ZoneSettingEditResponseResultZonesRocketLoaderValueOn ZoneSettingEditResponseResultZonesRocketLoaderValue = "on" + ZoneSettingEditResponseResultZonesRocketLoaderValueOff ZoneSettingEditResponseResultZonesRocketLoaderValue = "off" ) // [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) // serves your WordPress site from Cloudflare's edge network and caches third-party // fonts. -type ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimization struct { +type ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimization struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationID `json:"id"` + ID ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - Value ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValue `json:"value"` - JSON zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + Value ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationValue `json:"value"` + JSON zoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationJSON `json:"-"` } -// zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationJSON contains -// the JSON metadata for the struct -// [ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimization] -type zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationJSON struct { +// zoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationJSON +// contains the JSON metadata for the struct +// [ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimization] +type zoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2770,30 +6202,30 @@ type zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationJSON struct ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimization) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimization) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimization) implementsZoneSettingsCollectionResult() { +func (r ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimization) implementsZoneSettingEditResponseResult() { } // ID of the zone setting. -type ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationID string +type ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationID string const ( - ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" + ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationEditable bool +type ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationEditable bool const ( - ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationEditable = true - ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationEditable = false + ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationEditable = true + ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationEditable = false ) -type ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValue struct { +type ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationValue struct { // Indicates whether or not // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) // is enabled. @@ -2810,14 +6242,14 @@ type ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValue struc // Indicates whether or not // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is // installed. - WpPlugin bool `json:"wp_plugin,required"` - JSON zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValueJSON `json:"-"` + WpPlugin bool `json:"wp_plugin,required"` + JSON zoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationValueJSON `json:"-"` } -// zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValueJSON +// zoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationValueJSON // contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValue] -type zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValueJSON struct { +// [ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationValue] +type zoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationValueJSON struct { CacheByDeviceType apijson.Field Cf apijson.Field Enabled apijson.Field @@ -2828,26 +6260,26 @@ type zoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValueJSON s ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSchemasAutomaticPlatformOptimizationValue) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSchemasAutomaticPlatformOptimizationValue) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Cloudflare security header for a zone. -type ZoneSettingsCollectionResultSecurityHeader struct { +type ZoneSettingEditResponseResultZonesSecurityHeader struct { // ID of the zone's security header. - ID ZoneSettingsCollectionResultSecurityHeaderID `json:"id"` + ID ZoneSettingEditResponseResultZonesSecurityHeaderID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultSecurityHeaderEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesSecurityHeaderEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - Value ZoneSettingsCollectionResultSecurityHeaderValue `json:"value"` - JSON zoneSettingsCollectionResultSecurityHeaderJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + Value ZoneSettingEditResponseResultZonesSecurityHeaderValue `json:"value"` + JSON zoneSettingEditResponseResultZonesSecurityHeaderJSON `json:"-"` } -// zoneSettingsCollectionResultSecurityHeaderJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultSecurityHeader] -type zoneSettingsCollectionResultSecurityHeaderJSON struct { +// zoneSettingEditResponseResultZonesSecurityHeaderJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesSecurityHeader] +type zoneSettingEditResponseResultZonesSecurityHeaderJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2856,48 +6288,48 @@ type zoneSettingsCollectionResultSecurityHeaderJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSecurityHeader) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSecurityHeader) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultSecurityHeader) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesSecurityHeader) implementsZoneSettingEditResponseResult() {} // ID of the zone's security header. -type ZoneSettingsCollectionResultSecurityHeaderID string +type ZoneSettingEditResponseResultZonesSecurityHeaderID string const ( - ZoneSettingsCollectionResultSecurityHeaderIDSecurityHeader ZoneSettingsCollectionResultSecurityHeaderID = "security_header" + ZoneSettingEditResponseResultZonesSecurityHeaderIDSecurityHeader ZoneSettingEditResponseResultZonesSecurityHeaderID = "security_header" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultSecurityHeaderEditable bool +type ZoneSettingEditResponseResultZonesSecurityHeaderEditable bool const ( - ZoneSettingsCollectionResultSecurityHeaderEditableTrue ZoneSettingsCollectionResultSecurityHeaderEditable = true - ZoneSettingsCollectionResultSecurityHeaderEditableFalse ZoneSettingsCollectionResultSecurityHeaderEditable = false + ZoneSettingEditResponseResultZonesSecurityHeaderEditableTrue ZoneSettingEditResponseResultZonesSecurityHeaderEditable = true + ZoneSettingEditResponseResultZonesSecurityHeaderEditableFalse ZoneSettingEditResponseResultZonesSecurityHeaderEditable = false ) -type ZoneSettingsCollectionResultSecurityHeaderValue struct { +type ZoneSettingEditResponseResultZonesSecurityHeaderValue struct { // Strict Transport Security. - StrictTransportSecurity ZoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurity `json:"strict_transport_security"` - JSON zoneSettingsCollectionResultSecurityHeaderValueJSON `json:"-"` + StrictTransportSecurity ZoneSettingEditResponseResultZonesSecurityHeaderValueStrictTransportSecurity `json:"strict_transport_security"` + JSON zoneSettingEditResponseResultZonesSecurityHeaderValueJSON `json:"-"` } -// zoneSettingsCollectionResultSecurityHeaderValueJSON contains the JSON metadata -// for the struct [ZoneSettingsCollectionResultSecurityHeaderValue] -type zoneSettingsCollectionResultSecurityHeaderValueJSON struct { +// zoneSettingEditResponseResultZonesSecurityHeaderValueJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesSecurityHeaderValue] +type zoneSettingEditResponseResultZonesSecurityHeaderValueJSON struct { StrictTransportSecurity apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSecurityHeaderValue) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSecurityHeaderValue) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Strict Transport Security. -type ZoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurity struct { +type ZoneSettingEditResponseResultZonesSecurityHeaderValueStrictTransportSecurity struct { // Whether or not strict transport security is enabled. Enabled bool `json:"enabled"` // Include all subdomains for strict transport security. @@ -2905,14 +6337,14 @@ type ZoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurity stru // Max age in seconds of the strict transport security. MaxAge float64 `json:"max_age"` // Whether or not to include 'X-Content-Type-Options: nosniff' header. - Nosniff bool `json:"nosniff"` - JSON zoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurityJSON `json:"-"` + Nosniff bool `json:"nosniff"` + JSON zoneSettingEditResponseResultZonesSecurityHeaderValueStrictTransportSecurityJSON `json:"-"` } -// zoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurityJSON +// zoneSettingEditResponseResultZonesSecurityHeaderValueStrictTransportSecurityJSON // contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurity] -type zoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurityJSON struct { +// [ZoneSettingEditResponseResultZonesSecurityHeaderValueStrictTransportSecurity] +type zoneSettingEditResponseResultZonesSecurityHeaderValueStrictTransportSecurityJSON struct { Enabled apijson.Field IncludeSubdomains apijson.Field MaxAge apijson.Field @@ -2921,7 +6353,7 @@ type zoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurityJSON ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSecurityHeaderValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } @@ -2929,22 +6361,22 @@ func (r *ZoneSettingsCollectionResultSecurityHeaderValueStrictTransportSecurity) // automatically adjust each of the security settings. If you choose to customize // an individual security setting, the profile will become Custom. // (https://support.cloudflare.com/hc/en-us/articles/200170056). -type ZoneSettingsCollectionResultSecurityLevel struct { +type ZoneSettingEditResponseResultZonesSecurityLevel struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultSecurityLevelID `json:"id"` + ID ZoneSettingEditResponseResultZonesSecurityLevelID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultSecurityLevelEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesSecurityLevelEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultSecurityLevelValue `json:"value"` - JSON zoneSettingsCollectionResultSecurityLevelJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesSecurityLevelValue `json:"value"` + JSON zoneSettingEditResponseResultZonesSecurityLevelJSON `json:"-"` } -// zoneSettingsCollectionResultSecurityLevelJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultSecurityLevel] -type zoneSettingsCollectionResultSecurityLevelJSON struct { +// zoneSettingEditResponseResultZonesSecurityLevelJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesSecurityLevel] +type zoneSettingEditResponseResultZonesSecurityLevelJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -2953,38 +6385,38 @@ type zoneSettingsCollectionResultSecurityLevelJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSecurityLevel) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSecurityLevel) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultSecurityLevel) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesSecurityLevel) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultSecurityLevelID string +type ZoneSettingEditResponseResultZonesSecurityLevelID string const ( - ZoneSettingsCollectionResultSecurityLevelIDSecurityLevel ZoneSettingsCollectionResultSecurityLevelID = "security_level" + ZoneSettingEditResponseResultZonesSecurityLevelIDSecurityLevel ZoneSettingEditResponseResultZonesSecurityLevelID = "security_level" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultSecurityLevelEditable bool +type ZoneSettingEditResponseResultZonesSecurityLevelEditable bool const ( - ZoneSettingsCollectionResultSecurityLevelEditableTrue ZoneSettingsCollectionResultSecurityLevelEditable = true - ZoneSettingsCollectionResultSecurityLevelEditableFalse ZoneSettingsCollectionResultSecurityLevelEditable = false + ZoneSettingEditResponseResultZonesSecurityLevelEditableTrue ZoneSettingEditResponseResultZonesSecurityLevelEditable = true + ZoneSettingEditResponseResultZonesSecurityLevelEditableFalse ZoneSettingEditResponseResultZonesSecurityLevelEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultSecurityLevelValue string +type ZoneSettingEditResponseResultZonesSecurityLevelValue string const ( - ZoneSettingsCollectionResultSecurityLevelValueOff ZoneSettingsCollectionResultSecurityLevelValue = "off" - ZoneSettingsCollectionResultSecurityLevelValueEssentiallyOff ZoneSettingsCollectionResultSecurityLevelValue = "essentially_off" - ZoneSettingsCollectionResultSecurityLevelValueLow ZoneSettingsCollectionResultSecurityLevelValue = "low" - ZoneSettingsCollectionResultSecurityLevelValueMedium ZoneSettingsCollectionResultSecurityLevelValue = "medium" - ZoneSettingsCollectionResultSecurityLevelValueHigh ZoneSettingsCollectionResultSecurityLevelValue = "high" - ZoneSettingsCollectionResultSecurityLevelValueUnderAttack ZoneSettingsCollectionResultSecurityLevelValue = "under_attack" + ZoneSettingEditResponseResultZonesSecurityLevelValueOff ZoneSettingEditResponseResultZonesSecurityLevelValue = "off" + ZoneSettingEditResponseResultZonesSecurityLevelValueEssentiallyOff ZoneSettingEditResponseResultZonesSecurityLevelValue = "essentially_off" + ZoneSettingEditResponseResultZonesSecurityLevelValueLow ZoneSettingEditResponseResultZonesSecurityLevelValue = "low" + ZoneSettingEditResponseResultZonesSecurityLevelValueMedium ZoneSettingEditResponseResultZonesSecurityLevelValue = "medium" + ZoneSettingEditResponseResultZonesSecurityLevelValueHigh ZoneSettingEditResponseResultZonesSecurityLevelValue = "high" + ZoneSettingEditResponseResultZonesSecurityLevelValueUnderAttack ZoneSettingEditResponseResultZonesSecurityLevelValue = "under_attack" ) // If there is sensitive content on your website that you want visible to real @@ -2998,22 +6430,22 @@ const ( // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). -type ZoneSettingsCollectionResultServerSideExclude struct { +type ZoneSettingEditResponseResultZonesServerSideExclude struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultServerSideExcludeID `json:"id"` + ID ZoneSettingEditResponseResultZonesServerSideExcludeID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultServerSideExcludeEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesServerSideExcludeEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultServerSideExcludeValue `json:"value"` - JSON zoneSettingsCollectionResultServerSideExcludeJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesServerSideExcludeValue `json:"value"` + JSON zoneSettingEditResponseResultZonesServerSideExcludeJSON `json:"-"` } -// zoneSettingsCollectionResultServerSideExcludeJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultServerSideExclude] -type zoneSettingsCollectionResultServerSideExcludeJSON struct { +// zoneSettingEditResponseResultZonesServerSideExcludeJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesServerSideExclude] +type zoneSettingEditResponseResultZonesServerSideExcludeJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3022,53 +6454,54 @@ type zoneSettingsCollectionResultServerSideExcludeJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultServerSideExclude) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesServerSideExclude) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultServerSideExclude) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesServerSideExclude) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultServerSideExcludeID string +type ZoneSettingEditResponseResultZonesServerSideExcludeID string const ( - ZoneSettingsCollectionResultServerSideExcludeIDServerSideExclude ZoneSettingsCollectionResultServerSideExcludeID = "server_side_exclude" + ZoneSettingEditResponseResultZonesServerSideExcludeIDServerSideExclude ZoneSettingEditResponseResultZonesServerSideExcludeID = "server_side_exclude" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultServerSideExcludeEditable bool +type ZoneSettingEditResponseResultZonesServerSideExcludeEditable bool const ( - ZoneSettingsCollectionResultServerSideExcludeEditableTrue ZoneSettingsCollectionResultServerSideExcludeEditable = true - ZoneSettingsCollectionResultServerSideExcludeEditableFalse ZoneSettingsCollectionResultServerSideExcludeEditable = false + ZoneSettingEditResponseResultZonesServerSideExcludeEditableTrue ZoneSettingEditResponseResultZonesServerSideExcludeEditable = true + ZoneSettingEditResponseResultZonesServerSideExcludeEditableFalse ZoneSettingEditResponseResultZonesServerSideExcludeEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultServerSideExcludeValue string +type ZoneSettingEditResponseResultZonesServerSideExcludeValue string const ( - ZoneSettingsCollectionResultServerSideExcludeValueOn ZoneSettingsCollectionResultServerSideExcludeValue = "on" - ZoneSettingsCollectionResultServerSideExcludeValueOff ZoneSettingsCollectionResultServerSideExcludeValue = "off" + ZoneSettingEditResponseResultZonesServerSideExcludeValueOn ZoneSettingEditResponseResultZonesServerSideExcludeValue = "on" + ZoneSettingEditResponseResultZonesServerSideExcludeValueOff ZoneSettingEditResponseResultZonesServerSideExcludeValue = "off" ) // Allow SHA1 support. -type ZoneSettingsCollectionResultSha1Support struct { +type ZoneSettingEditResponseResultZonesSha1Support struct { // Zone setting identifier. - ID ZoneSettingsCollectionResultSha1SupportID `json:"id"` + ID ZoneSettingEditResponseResultZonesSha1SupportID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultSha1SupportEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesSha1SupportEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultSha1SupportValue `json:"value"` - JSON zoneSettingsCollectionResultSha1SupportJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesSha1SupportValue `json:"value"` + JSON zoneSettingEditResponseResultZonesSha1SupportJSON `json:"-"` } -// zoneSettingsCollectionResultSha1SupportJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultSha1Support] -type zoneSettingsCollectionResultSha1SupportJSON struct { +// zoneSettingEditResponseResultZonesSha1SupportJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesSha1Support] +type zoneSettingEditResponseResultZonesSha1SupportJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3077,55 +6510,56 @@ type zoneSettingsCollectionResultSha1SupportJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSha1Support) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSha1Support) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultSha1Support) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesSha1Support) implementsZoneSettingEditResponseResult() {} // Zone setting identifier. -type ZoneSettingsCollectionResultSha1SupportID string +type ZoneSettingEditResponseResultZonesSha1SupportID string const ( - ZoneSettingsCollectionResultSha1SupportIDSha1Support ZoneSettingsCollectionResultSha1SupportID = "sha1_support" + ZoneSettingEditResponseResultZonesSha1SupportIDSha1Support ZoneSettingEditResponseResultZonesSha1SupportID = "sha1_support" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultSha1SupportEditable bool +type ZoneSettingEditResponseResultZonesSha1SupportEditable bool const ( - ZoneSettingsCollectionResultSha1SupportEditableTrue ZoneSettingsCollectionResultSha1SupportEditable = true - ZoneSettingsCollectionResultSha1SupportEditableFalse ZoneSettingsCollectionResultSha1SupportEditable = false + ZoneSettingEditResponseResultZonesSha1SupportEditableTrue ZoneSettingEditResponseResultZonesSha1SupportEditable = true + ZoneSettingEditResponseResultZonesSha1SupportEditableFalse ZoneSettingEditResponseResultZonesSha1SupportEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultSha1SupportValue string +type ZoneSettingEditResponseResultZonesSha1SupportValue string const ( - ZoneSettingsCollectionResultSha1SupportValueOff ZoneSettingsCollectionResultSha1SupportValue = "off" - ZoneSettingsCollectionResultSha1SupportValueOn ZoneSettingsCollectionResultSha1SupportValue = "on" + ZoneSettingEditResponseResultZonesSha1SupportValueOff ZoneSettingEditResponseResultZonesSha1SupportValue = "off" + ZoneSettingEditResponseResultZonesSha1SupportValueOn ZoneSettingEditResponseResultZonesSha1SupportValue = "on" ) // Cloudflare will treat files with the same query strings as the same file in // cache, regardless of the order of the query strings. This is limited to // Enterprise Zones. -type ZoneSettingsCollectionResultSortQueryStringForCache struct { +type ZoneSettingEditResponseResultZonesSortQueryStringForCache struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultSortQueryStringForCacheID `json:"id"` + ID ZoneSettingEditResponseResultZonesSortQueryStringForCacheID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultSortQueryStringForCacheEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesSortQueryStringForCacheEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultSortQueryStringForCacheValue `json:"value"` - JSON zoneSettingsCollectionResultSortQueryStringForCacheJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesSortQueryStringForCacheValue `json:"value"` + JSON zoneSettingEditResponseResultZonesSortQueryStringForCacheJSON `json:"-"` } -// zoneSettingsCollectionResultSortQueryStringForCacheJSON contains the JSON -// metadata for the struct [ZoneSettingsCollectionResultSortQueryStringForCache] -type zoneSettingsCollectionResultSortQueryStringForCacheJSON struct { +// zoneSettingEditResponseResultZonesSortQueryStringForCacheJSON contains the JSON +// metadata for the struct +// [ZoneSettingEditResponseResultZonesSortQueryStringForCache] +type zoneSettingEditResponseResultZonesSortQueryStringForCacheJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3134,35 +6568,35 @@ type zoneSettingsCollectionResultSortQueryStringForCacheJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSortQueryStringForCache) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSortQueryStringForCache) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultSortQueryStringForCache) implementsZoneSettingsCollectionResult() { +func (r ZoneSettingEditResponseResultZonesSortQueryStringForCache) implementsZoneSettingEditResponseResult() { } // ID of the zone setting. -type ZoneSettingsCollectionResultSortQueryStringForCacheID string +type ZoneSettingEditResponseResultZonesSortQueryStringForCacheID string const ( - ZoneSettingsCollectionResultSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingsCollectionResultSortQueryStringForCacheID = "sort_query_string_for_cache" + ZoneSettingEditResponseResultZonesSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingEditResponseResultZonesSortQueryStringForCacheID = "sort_query_string_for_cache" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultSortQueryStringForCacheEditable bool +type ZoneSettingEditResponseResultZonesSortQueryStringForCacheEditable bool const ( - ZoneSettingsCollectionResultSortQueryStringForCacheEditableTrue ZoneSettingsCollectionResultSortQueryStringForCacheEditable = true - ZoneSettingsCollectionResultSortQueryStringForCacheEditableFalse ZoneSettingsCollectionResultSortQueryStringForCacheEditable = false + ZoneSettingEditResponseResultZonesSortQueryStringForCacheEditableTrue ZoneSettingEditResponseResultZonesSortQueryStringForCacheEditable = true + ZoneSettingEditResponseResultZonesSortQueryStringForCacheEditableFalse ZoneSettingEditResponseResultZonesSortQueryStringForCacheEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultSortQueryStringForCacheValue string +type ZoneSettingEditResponseResultZonesSortQueryStringForCacheValue string const ( - ZoneSettingsCollectionResultSortQueryStringForCacheValueOn ZoneSettingsCollectionResultSortQueryStringForCacheValue = "on" - ZoneSettingsCollectionResultSortQueryStringForCacheValueOff ZoneSettingsCollectionResultSortQueryStringForCacheValue = "off" + ZoneSettingEditResponseResultZonesSortQueryStringForCacheValueOn ZoneSettingEditResponseResultZonesSortQueryStringForCacheValue = "on" + ZoneSettingEditResponseResultZonesSortQueryStringForCacheValueOff ZoneSettingEditResponseResultZonesSortQueryStringForCacheValue = "off" ) // SSL encrypts your visitor's connection and safeguards credit card numbers and @@ -3181,22 +6615,22 @@ const ( // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -type ZoneSettingsCollectionResultSsl struct { +type ZoneSettingEditResponseResultZonesSsl struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultSslID `json:"id"` + ID ZoneSettingEditResponseResultZonesSslID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultSslEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesSslEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Depends on the zone's plan level - Value ZoneSettingsCollectionResultSslValue `json:"value"` - JSON zoneSettingsCollectionResultSslJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesSslValue `json:"value"` + JSON zoneSettingEditResponseResultZonesSslJSON `json:"-"` } -// zoneSettingsCollectionResultSslJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultSsl] -type zoneSettingsCollectionResultSslJSON struct { +// zoneSettingEditResponseResultZonesSslJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesSsl] +type zoneSettingEditResponseResultZonesSslJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3205,104 +6639,85 @@ type zoneSettingsCollectionResultSslJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSsl) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSsl) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultSsl) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesSsl) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultSslID string +type ZoneSettingEditResponseResultZonesSslID string const ( - ZoneSettingsCollectionResultSslIDSsl ZoneSettingsCollectionResultSslID = "ssl" + ZoneSettingEditResponseResultZonesSslIDSsl ZoneSettingEditResponseResultZonesSslID = "ssl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultSslEditable bool +type ZoneSettingEditResponseResultZonesSslEditable bool const ( - ZoneSettingsCollectionResultSslEditableTrue ZoneSettingsCollectionResultSslEditable = true - ZoneSettingsCollectionResultSslEditableFalse ZoneSettingsCollectionResultSslEditable = false + ZoneSettingEditResponseResultZonesSslEditableTrue ZoneSettingEditResponseResultZonesSslEditable = true + ZoneSettingEditResponseResultZonesSslEditableFalse ZoneSettingEditResponseResultZonesSslEditable = false ) // Value of the zone setting. Notes: Depends on the zone's plan level -type ZoneSettingsCollectionResultSslValue string +type ZoneSettingEditResponseResultZonesSslValue string const ( - ZoneSettingsCollectionResultSslValueOff ZoneSettingsCollectionResultSslValue = "off" - ZoneSettingsCollectionResultSslValueFlexible ZoneSettingsCollectionResultSslValue = "flexible" - ZoneSettingsCollectionResultSslValueFull ZoneSettingsCollectionResultSslValue = "full" - ZoneSettingsCollectionResultSslValueStrict ZoneSettingsCollectionResultSslValue = "strict" + ZoneSettingEditResponseResultZonesSslValueOff ZoneSettingEditResponseResultZonesSslValue = "off" + ZoneSettingEditResponseResultZonesSslValueFlexible ZoneSettingEditResponseResultZonesSslValue = "flexible" + ZoneSettingEditResponseResultZonesSslValueFull ZoneSettingEditResponseResultZonesSslValue = "full" + ZoneSettingEditResponseResultZonesSslValueStrict ZoneSettingEditResponseResultZonesSslValue = "strict" ) -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type ZoneSettingsCollectionResultSslRecommender struct { +type ZoneSettingEditResponseResultZonesSslRecommender struct { // Enrollment value for SSL/TLS Recommender. - ID ZoneSettingsCollectionResultSslRecommenderID `json:"id"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable ZoneSettingsCollectionResultSslRecommenderEditable `json:"editable"` + ID ZoneSettingEditResponseResultZonesSslRecommenderID `json:"id"` // ssl-recommender enrollment setting. - Enabled bool `json:"enabled"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON zoneSettingsCollectionResultSslRecommenderJSON `json:"-"` + Enabled bool `json:"enabled"` + JSON zoneSettingEditResponseResultZonesSslRecommenderJSON `json:"-"` } -// zoneSettingsCollectionResultSslRecommenderJSON contains the JSON metadata for -// the struct [ZoneSettingsCollectionResultSslRecommender] -type zoneSettingsCollectionResultSslRecommenderJSON struct { +// zoneSettingEditResponseResultZonesSslRecommenderJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesSslRecommender] +type zoneSettingEditResponseResultZonesSslRecommenderJSON struct { ID apijson.Field - Editable apijson.Field Enabled apijson.Field - ModifiedOn apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultSslRecommender) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesSslRecommender) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultSslRecommender) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesSslRecommender) implementsZoneSettingEditResponseResult() {} // Enrollment value for SSL/TLS Recommender. -type ZoneSettingsCollectionResultSslRecommenderID string - -const ( - ZoneSettingsCollectionResultSslRecommenderIDSslRecommender ZoneSettingsCollectionResultSslRecommenderID = "ssl_recommender" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingsCollectionResultSslRecommenderEditable bool +type ZoneSettingEditResponseResultZonesSslRecommenderID string const ( - ZoneSettingsCollectionResultSslRecommenderEditableTrue ZoneSettingsCollectionResultSslRecommenderEditable = true - ZoneSettingsCollectionResultSslRecommenderEditableFalse ZoneSettingsCollectionResultSslRecommenderEditable = false + ZoneSettingEditResponseResultZonesSslRecommenderIDSslRecommender ZoneSettingEditResponseResultZonesSslRecommenderID = "ssl_recommender" ) // Only allows TLS1.2. -type ZoneSettingsCollectionResultTls1_2Only struct { +type ZoneSettingEditResponseResultZonesTls1_2Only struct { // Zone setting identifier. - ID ZoneSettingsCollectionResultTls1_2OnlyID `json:"id"` + ID ZoneSettingEditResponseResultZonesTls1_2OnlyID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultTls1_2OnlyEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesTls1_2OnlyEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultTls1_2OnlyValue `json:"value"` - JSON zoneSettingsCollectionResultTls1_2OnlyJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesTls1_2OnlyValue `json:"value"` + JSON zoneSettingEditResponseResultZonesTls1_2OnlyJSON `json:"-"` } -// zoneSettingsCollectionResultTls1_2OnlyJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultTls1_2Only] -type zoneSettingsCollectionResultTls1_2OnlyJSON struct { +// zoneSettingEditResponseResultZonesTls1_2OnlyJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesTls1_2Only] +type zoneSettingEditResponseResultZonesTls1_2OnlyJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3311,54 +6726,54 @@ type zoneSettingsCollectionResultTls1_2OnlyJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultTls1_2Only) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesTls1_2Only) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultTls1_2Only) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesTls1_2Only) implementsZoneSettingEditResponseResult() {} // Zone setting identifier. -type ZoneSettingsCollectionResultTls1_2OnlyID string +type ZoneSettingEditResponseResultZonesTls1_2OnlyID string const ( - ZoneSettingsCollectionResultTls1_2OnlyIDTls1_2Only ZoneSettingsCollectionResultTls1_2OnlyID = "tls_1_2_only" + ZoneSettingEditResponseResultZonesTls1_2OnlyIDTls1_2Only ZoneSettingEditResponseResultZonesTls1_2OnlyID = "tls_1_2_only" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultTls1_2OnlyEditable bool +type ZoneSettingEditResponseResultZonesTls1_2OnlyEditable bool const ( - ZoneSettingsCollectionResultTls1_2OnlyEditableTrue ZoneSettingsCollectionResultTls1_2OnlyEditable = true - ZoneSettingsCollectionResultTls1_2OnlyEditableFalse ZoneSettingsCollectionResultTls1_2OnlyEditable = false + ZoneSettingEditResponseResultZonesTls1_2OnlyEditableTrue ZoneSettingEditResponseResultZonesTls1_2OnlyEditable = true + ZoneSettingEditResponseResultZonesTls1_2OnlyEditableFalse ZoneSettingEditResponseResultZonesTls1_2OnlyEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultTls1_2OnlyValue string +type ZoneSettingEditResponseResultZonesTls1_2OnlyValue string const ( - ZoneSettingsCollectionResultTls1_2OnlyValueOff ZoneSettingsCollectionResultTls1_2OnlyValue = "off" - ZoneSettingsCollectionResultTls1_2OnlyValueOn ZoneSettingsCollectionResultTls1_2OnlyValue = "on" + ZoneSettingEditResponseResultZonesTls1_2OnlyValueOff ZoneSettingEditResponseResultZonesTls1_2OnlyValue = "off" + ZoneSettingEditResponseResultZonesTls1_2OnlyValueOn ZoneSettingEditResponseResultZonesTls1_2OnlyValue = "on" ) // Enables Crypto TLS 1.3 feature for a zone. -type ZoneSettingsCollectionResultTls1_3 struct { +type ZoneSettingEditResponseResultZonesTls1_3 struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultTls1_3ID `json:"id"` + ID ZoneSettingEditResponseResultZonesTls1_3ID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultTls1_3Editable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesTls1_3Editable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value ZoneSettingsCollectionResultTls1_3Value `json:"value"` - JSON zoneSettingsCollectionResultTls1_3JSON `json:"-"` + Value ZoneSettingEditResponseResultZonesTls1_3Value `json:"value"` + JSON zoneSettingEditResponseResultZonesTls1_3JSON `json:"-"` } -// zoneSettingsCollectionResultTls1_3JSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultTls1_3] -type zoneSettingsCollectionResultTls1_3JSON struct { +// zoneSettingEditResponseResultZonesTls1_3JSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesTls1_3] +type zoneSettingEditResponseResultZonesTls1_3JSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3367,56 +6782,56 @@ type zoneSettingsCollectionResultTls1_3JSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultTls1_3) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesTls1_3) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultTls1_3) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesTls1_3) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultTls1_3ID string +type ZoneSettingEditResponseResultZonesTls1_3ID string const ( - ZoneSettingsCollectionResultTls1_3IDTls1_3 ZoneSettingsCollectionResultTls1_3ID = "tls_1_3" + ZoneSettingEditResponseResultZonesTls1_3IDTls1_3 ZoneSettingEditResponseResultZonesTls1_3ID = "tls_1_3" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultTls1_3Editable bool +type ZoneSettingEditResponseResultZonesTls1_3Editable bool const ( - ZoneSettingsCollectionResultTls1_3EditableTrue ZoneSettingsCollectionResultTls1_3Editable = true - ZoneSettingsCollectionResultTls1_3EditableFalse ZoneSettingsCollectionResultTls1_3Editable = false + ZoneSettingEditResponseResultZonesTls1_3EditableTrue ZoneSettingEditResponseResultZonesTls1_3Editable = true + ZoneSettingEditResponseResultZonesTls1_3EditableFalse ZoneSettingEditResponseResultZonesTls1_3Editable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingsCollectionResultTls1_3Value string +type ZoneSettingEditResponseResultZonesTls1_3Value string const ( - ZoneSettingsCollectionResultTls1_3ValueOn ZoneSettingsCollectionResultTls1_3Value = "on" - ZoneSettingsCollectionResultTls1_3ValueOff ZoneSettingsCollectionResultTls1_3Value = "off" - ZoneSettingsCollectionResultTls1_3ValueZrt ZoneSettingsCollectionResultTls1_3Value = "zrt" + ZoneSettingEditResponseResultZonesTls1_3ValueOn ZoneSettingEditResponseResultZonesTls1_3Value = "on" + ZoneSettingEditResponseResultZonesTls1_3ValueOff ZoneSettingEditResponseResultZonesTls1_3Value = "off" + ZoneSettingEditResponseResultZonesTls1_3ValueZrt ZoneSettingEditResponseResultZonesTls1_3Value = "zrt" ) // TLS Client Auth requires Cloudflare to connect to your origin server using a // client certificate (Enterprise Only). -type ZoneSettingsCollectionResultTlsClientAuth struct { +type ZoneSettingEditResponseResultZonesTlsClientAuth struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultTlsClientAuthID `json:"id"` + ID ZoneSettingEditResponseResultZonesTlsClientAuthID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultTlsClientAuthEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesTlsClientAuthEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // value of the zone setting. - Value ZoneSettingsCollectionResultTlsClientAuthValue `json:"value"` - JSON zoneSettingsCollectionResultTlsClientAuthJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesTlsClientAuthValue `json:"value"` + JSON zoneSettingEditResponseResultZonesTlsClientAuthJSON `json:"-"` } -// zoneSettingsCollectionResultTlsClientAuthJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultTlsClientAuth] -type zoneSettingsCollectionResultTlsClientAuthJSON struct { +// zoneSettingEditResponseResultZonesTlsClientAuthJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseResultZonesTlsClientAuth] +type zoneSettingEditResponseResultZonesTlsClientAuthJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3425,54 +6840,54 @@ type zoneSettingsCollectionResultTlsClientAuthJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultTlsClientAuth) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesTlsClientAuth) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultTlsClientAuth) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesTlsClientAuth) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultTlsClientAuthID string +type ZoneSettingEditResponseResultZonesTlsClientAuthID string const ( - ZoneSettingsCollectionResultTlsClientAuthIDTlsClientAuth ZoneSettingsCollectionResultTlsClientAuthID = "tls_client_auth" + ZoneSettingEditResponseResultZonesTlsClientAuthIDTlsClientAuth ZoneSettingEditResponseResultZonesTlsClientAuthID = "tls_client_auth" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultTlsClientAuthEditable bool +type ZoneSettingEditResponseResultZonesTlsClientAuthEditable bool const ( - ZoneSettingsCollectionResultTlsClientAuthEditableTrue ZoneSettingsCollectionResultTlsClientAuthEditable = true - ZoneSettingsCollectionResultTlsClientAuthEditableFalse ZoneSettingsCollectionResultTlsClientAuthEditable = false + ZoneSettingEditResponseResultZonesTlsClientAuthEditableTrue ZoneSettingEditResponseResultZonesTlsClientAuthEditable = true + ZoneSettingEditResponseResultZonesTlsClientAuthEditableFalse ZoneSettingEditResponseResultZonesTlsClientAuthEditable = false ) // value of the zone setting. -type ZoneSettingsCollectionResultTlsClientAuthValue string +type ZoneSettingEditResponseResultZonesTlsClientAuthValue string const ( - ZoneSettingsCollectionResultTlsClientAuthValueOn ZoneSettingsCollectionResultTlsClientAuthValue = "on" - ZoneSettingsCollectionResultTlsClientAuthValueOff ZoneSettingsCollectionResultTlsClientAuthValue = "off" + ZoneSettingEditResponseResultZonesTlsClientAuthValueOn ZoneSettingEditResponseResultZonesTlsClientAuthValue = "on" + ZoneSettingEditResponseResultZonesTlsClientAuthValueOff ZoneSettingEditResponseResultZonesTlsClientAuthValue = "off" ) // Allows customer to continue to use True Client IP (Akamai feature) in the // headers we send to the origin. This is limited to Enterprise Zones. -type ZoneSettingsCollectionResultTrueClientIPHeader struct { +type ZoneSettingEditResponseResultZonesTrueClientIPHeader struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultTrueClientIPHeaderID `json:"id"` + ID ZoneSettingEditResponseResultZonesTrueClientIPHeaderID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultTrueClientIPHeaderEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesTrueClientIPHeaderEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultTrueClientIPHeaderValue `json:"value"` - JSON zoneSettingsCollectionResultTrueClientIPHeaderJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesTrueClientIPHeaderValue `json:"value"` + JSON zoneSettingEditResponseResultZonesTrueClientIPHeaderJSON `json:"-"` } -// zoneSettingsCollectionResultTrueClientIPHeaderJSON contains the JSON metadata -// for the struct [ZoneSettingsCollectionResultTrueClientIPHeader] -type zoneSettingsCollectionResultTrueClientIPHeaderJSON struct { +// zoneSettingEditResponseResultZonesTrueClientIPHeaderJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseResultZonesTrueClientIPHeader] +type zoneSettingEditResponseResultZonesTrueClientIPHeaderJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3481,34 +6896,35 @@ type zoneSettingsCollectionResultTrueClientIPHeaderJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultTrueClientIPHeader) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesTrueClientIPHeader) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultTrueClientIPHeader) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesTrueClientIPHeader) implementsZoneSettingEditResponseResult() { +} // ID of the zone setting. -type ZoneSettingsCollectionResultTrueClientIPHeaderID string +type ZoneSettingEditResponseResultZonesTrueClientIPHeaderID string const ( - ZoneSettingsCollectionResultTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingsCollectionResultTrueClientIPHeaderID = "true_client_ip_header" + ZoneSettingEditResponseResultZonesTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingEditResponseResultZonesTrueClientIPHeaderID = "true_client_ip_header" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultTrueClientIPHeaderEditable bool +type ZoneSettingEditResponseResultZonesTrueClientIPHeaderEditable bool const ( - ZoneSettingsCollectionResultTrueClientIPHeaderEditableTrue ZoneSettingsCollectionResultTrueClientIPHeaderEditable = true - ZoneSettingsCollectionResultTrueClientIPHeaderEditableFalse ZoneSettingsCollectionResultTrueClientIPHeaderEditable = false + ZoneSettingEditResponseResultZonesTrueClientIPHeaderEditableTrue ZoneSettingEditResponseResultZonesTrueClientIPHeaderEditable = true + ZoneSettingEditResponseResultZonesTrueClientIPHeaderEditableFalse ZoneSettingEditResponseResultZonesTrueClientIPHeaderEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultTrueClientIPHeaderValue string +type ZoneSettingEditResponseResultZonesTrueClientIPHeaderValue string const ( - ZoneSettingsCollectionResultTrueClientIPHeaderValueOn ZoneSettingsCollectionResultTrueClientIPHeaderValue = "on" - ZoneSettingsCollectionResultTrueClientIPHeaderValueOff ZoneSettingsCollectionResultTrueClientIPHeaderValue = "off" + ZoneSettingEditResponseResultZonesTrueClientIPHeaderValueOn ZoneSettingEditResponseResultZonesTrueClientIPHeaderValue = "on" + ZoneSettingEditResponseResultZonesTrueClientIPHeaderValueOff ZoneSettingEditResponseResultZonesTrueClientIPHeaderValue = "off" ) // The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -3521,22 +6937,22 @@ const ( // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). -type ZoneSettingsCollectionResultWaf struct { +type ZoneSettingEditResponseResultZonesWaf struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultWafID `json:"id"` + ID ZoneSettingEditResponseResultZonesWafID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultWafEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesWafEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultWafValue `json:"value"` - JSON zoneSettingsCollectionResultWafJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesWafValue `json:"value"` + JSON zoneSettingEditResponseResultZonesWafJSON `json:"-"` } -// zoneSettingsCollectionResultWafJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultWaf] -type zoneSettingsCollectionResultWafJSON struct { +// zoneSettingEditResponseResultZonesWafJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesWaf] +type zoneSettingEditResponseResultZonesWafJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3545,55 +6961,55 @@ type zoneSettingsCollectionResultWafJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultWaf) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesWaf) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultWaf) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesWaf) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultWafID string +type ZoneSettingEditResponseResultZonesWafID string const ( - ZoneSettingsCollectionResultWafIDWaf ZoneSettingsCollectionResultWafID = "waf" + ZoneSettingEditResponseResultZonesWafIDWaf ZoneSettingEditResponseResultZonesWafID = "waf" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultWafEditable bool +type ZoneSettingEditResponseResultZonesWafEditable bool const ( - ZoneSettingsCollectionResultWafEditableTrue ZoneSettingsCollectionResultWafEditable = true - ZoneSettingsCollectionResultWafEditableFalse ZoneSettingsCollectionResultWafEditable = false + ZoneSettingEditResponseResultZonesWafEditableTrue ZoneSettingEditResponseResultZonesWafEditable = true + ZoneSettingEditResponseResultZonesWafEditableFalse ZoneSettingEditResponseResultZonesWafEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultWafValue string +type ZoneSettingEditResponseResultZonesWafValue string const ( - ZoneSettingsCollectionResultWafValueOn ZoneSettingsCollectionResultWafValue = "on" - ZoneSettingsCollectionResultWafValueOff ZoneSettingsCollectionResultWafValue = "off" + ZoneSettingEditResponseResultZonesWafValueOn ZoneSettingEditResponseResultZonesWafValue = "on" + ZoneSettingEditResponseResultZonesWafValueOff ZoneSettingEditResponseResultZonesWafValue = "off" ) // When the client requesting the image supports the WebP image codec, and WebP // offers a performance advantage over the original image format, Cloudflare will // serve a WebP version of the original image. -type ZoneSettingsCollectionResultWebp struct { +type ZoneSettingEditResponseResultZonesWebp struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultWebpID `json:"id"` + ID ZoneSettingEditResponseResultZonesWebpID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultWebpEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesWebpEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultWebpValue `json:"value"` - JSON zoneSettingsCollectionResultWebpJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesWebpValue `json:"value"` + JSON zoneSettingEditResponseResultZonesWebpJSON `json:"-"` } -// zoneSettingsCollectionResultWebpJSON contains the JSON metadata for the struct -// [ZoneSettingsCollectionResultWebp] -type zoneSettingsCollectionResultWebpJSON struct { +// zoneSettingEditResponseResultZonesWebpJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseResultZonesWebp] +type zoneSettingEditResponseResultZonesWebpJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3602,34 +7018,34 @@ type zoneSettingsCollectionResultWebpJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultWebp) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesWebp) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultWebp) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesWebp) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultWebpID string +type ZoneSettingEditResponseResultZonesWebpID string const ( - ZoneSettingsCollectionResultWebpIDWebp ZoneSettingsCollectionResultWebpID = "webp" + ZoneSettingEditResponseResultZonesWebpIDWebp ZoneSettingEditResponseResultZonesWebpID = "webp" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultWebpEditable bool +type ZoneSettingEditResponseResultZonesWebpEditable bool const ( - ZoneSettingsCollectionResultWebpEditableTrue ZoneSettingsCollectionResultWebpEditable = true - ZoneSettingsCollectionResultWebpEditableFalse ZoneSettingsCollectionResultWebpEditable = false + ZoneSettingEditResponseResultZonesWebpEditableTrue ZoneSettingEditResponseResultZonesWebpEditable = true + ZoneSettingEditResponseResultZonesWebpEditableFalse ZoneSettingEditResponseResultZonesWebpEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultWebpValue string +type ZoneSettingEditResponseResultZonesWebpValue string const ( - ZoneSettingsCollectionResultWebpValueOff ZoneSettingsCollectionResultWebpValue = "off" - ZoneSettingsCollectionResultWebpValueOn ZoneSettingsCollectionResultWebpValue = "on" + ZoneSettingEditResponseResultZonesWebpValueOff ZoneSettingEditResponseResultZonesWebpValue = "off" + ZoneSettingEditResponseResultZonesWebpValueOn ZoneSettingEditResponseResultZonesWebpValue = "on" ) // WebSockets are open connections sustained between the client and the origin @@ -3639,22 +7055,22 @@ const ( // real-time applications such as live chat and gaming. For more information refer // to // [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). -type ZoneSettingsCollectionResultWebsockets struct { +type ZoneSettingEditResponseResultZonesWebsockets struct { // ID of the zone setting. - ID ZoneSettingsCollectionResultWebsocketsID `json:"id"` + ID ZoneSettingEditResponseResultZonesWebsocketsID `json:"id"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable ZoneSettingsCollectionResultWebsocketsEditable `json:"editable"` + Editable ZoneSettingEditResponseResultZonesWebsocketsEditable `json:"editable"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` // Value of the zone setting. - Value ZoneSettingsCollectionResultWebsocketsValue `json:"value"` - JSON zoneSettingsCollectionResultWebsocketsJSON `json:"-"` + Value ZoneSettingEditResponseResultZonesWebsocketsValue `json:"value"` + JSON zoneSettingEditResponseResultZonesWebsocketsJSON `json:"-"` } -// zoneSettingsCollectionResultWebsocketsJSON contains the JSON metadata for the -// struct [ZoneSettingsCollectionResultWebsockets] -type zoneSettingsCollectionResultWebsocketsJSON struct { +// zoneSettingEditResponseResultZonesWebsocketsJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseResultZonesWebsockets] +type zoneSettingEditResponseResultZonesWebsocketsJSON struct { ID apijson.Field Editable apijson.Field ModifiedOn apijson.Field @@ -3663,34 +7079,34 @@ type zoneSettingsCollectionResultWebsocketsJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZoneSettingsCollectionResultWebsockets) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingEditResponseResultZonesWebsockets) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ZoneSettingsCollectionResultWebsockets) implementsZoneSettingsCollectionResult() {} +func (r ZoneSettingEditResponseResultZonesWebsockets) implementsZoneSettingEditResponseResult() {} // ID of the zone setting. -type ZoneSettingsCollectionResultWebsocketsID string +type ZoneSettingEditResponseResultZonesWebsocketsID string const ( - ZoneSettingsCollectionResultWebsocketsIDWebsockets ZoneSettingsCollectionResultWebsocketsID = "websockets" + ZoneSettingEditResponseResultZonesWebsocketsIDWebsockets ZoneSettingEditResponseResultZonesWebsocketsID = "websockets" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingsCollectionResultWebsocketsEditable bool +type ZoneSettingEditResponseResultZonesWebsocketsEditable bool const ( - ZoneSettingsCollectionResultWebsocketsEditableTrue ZoneSettingsCollectionResultWebsocketsEditable = true - ZoneSettingsCollectionResultWebsocketsEditableFalse ZoneSettingsCollectionResultWebsocketsEditable = false + ZoneSettingEditResponseResultZonesWebsocketsEditableTrue ZoneSettingEditResponseResultZonesWebsocketsEditable = true + ZoneSettingEditResponseResultZonesWebsocketsEditableFalse ZoneSettingEditResponseResultZonesWebsocketsEditable = false ) // Value of the zone setting. -type ZoneSettingsCollectionResultWebsocketsValue string +type ZoneSettingEditResponseResultZonesWebsocketsValue string const ( - ZoneSettingsCollectionResultWebsocketsValueOff ZoneSettingsCollectionResultWebsocketsValue = "off" - ZoneSettingsCollectionResultWebsocketsValueOn ZoneSettingsCollectionResultWebsocketsValue = "on" + ZoneSettingEditResponseResultZonesWebsocketsValueOff ZoneSettingEditResponseResultZonesWebsocketsValue = "off" + ZoneSettingEditResponseResultZonesWebsocketsValueOn ZoneSettingEditResponseResultZonesWebsocketsValue = "on" ) type ZoneSettingEditParams struct { @@ -3704,92 +7120,139 @@ func (r ZoneSettingEditParams) MarshalJSON() (data []byte, err error) { // 0-RTT session resumption enabled for this zone. // -// Satisfied by [ZeroRttParam], [ZoneSettingEditParamsItemsAdvancedDdos], -// [ZoneSettingEditParamsItemsAlwaysOnline], -// [ZoneSettingEditParamsItemsAlwaysUseHTTPs], -// [ZoneSettingEditParamsItemsAutomaticHTTPsRewrites], -// [ZoneSettingEditParamsItemsBrotli], [ZoneSettingEditParamsItemsBrowserCacheTtl], -// [ZoneSettingEditParamsItemsBrowserCheck], -// [ZoneSettingEditParamsItemsCacheLevel], -// [ZoneSettingEditParamsItemsChallengeTtl], [ZoneSettingEditParamsItemsCiphers], -// [ZoneSettingEditParamsItemsCnameFlattening], -// [ZoneSettingEditParamsItemsDevelopmentMode], -// [ZoneSettingEditParamsItemsEarlyHints], -// [ZoneSettingEditParamsItemsEdgeCacheTtl], -// [ZoneSettingEditParamsItemsEmailObfuscation], -// [ZoneSettingEditParamsItemsH2Prioritization], -// [ZoneSettingEditParamsItemsHotlinkProtection], -// [ZoneSettingEditParamsItemsHttp2], [ZoneSettingEditParamsItemsHttp3], -// [ZoneSettingEditParamsItemsImageResizing], -// [ZoneSettingEditParamsItemsIPGeolocation], [ZoneSettingEditParamsItemsIpv6], -// [ZoneSettingEditParamsItemsMaxUpload], -// [ZoneSettingEditParamsItemsMinTlsVersion], [ZoneSettingEditParamsItemsMinify], -// [ZoneSettingEditParamsItemsMirage], [ZoneSettingEditParamsItemsMobileRedirect], -// [ZoneSettingEditParamsItemsNel], -// [ZoneSettingEditParamsItemsOpportunisticEncryption], -// [ZoneSettingEditParamsItemsOpportunisticOnion], -// [ZoneSettingEditParamsItemsOrangeToOrange], -// [ZoneSettingEditParamsItemsOriginErrorPagePassThru], -// [ZoneSettingEditParamsItemsOriginMaxHTTPVersion], -// [ZoneSettingEditParamsItemsPolish], [ZoneSettingEditParamsItemsPrefetchPreload], -// [ZoneSettingEditParamsItemsPrivacyPass], -// [ZoneSettingEditParamsItemsProxyReadTimeout], -// [ZoneSettingEditParamsItemsPseudoIpv4], -// [ZoneSettingEditParamsItemsResponseBuffering], -// [ZoneSettingEditParamsItemsRocketLoader], -// [ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimization], -// [ZoneSettingEditParamsItemsSecurityHeader], -// [ZoneSettingEditParamsItemsSecurityLevel], -// [ZoneSettingEditParamsItemsServerSideExclude], -// [ZoneSettingEditParamsItemsSha1Support], -// [ZoneSettingEditParamsItemsSortQueryStringForCache], -// [ZoneSettingEditParamsItemsSsl], [ZoneSettingEditParamsItemsSslRecommender], -// [ZoneSettingEditParamsItemsTls1_2Only], [ZoneSettingEditParamsItemsTls1_3], -// [ZoneSettingEditParamsItemsTlsClientAuth], -// [ZoneSettingEditParamsItemsTrueClientIPHeader], [ZoneSettingEditParamsItemsWaf], -// [ZoneSettingEditParamsItemsWebp], [ZoneSettingEditParamsItemsWebsockets]. +// Satisfied by [ZoneSettingEditParamsItemsZones0rtt], +// [ZoneSettingEditParamsItemsZonesAdvancedDdos], +// [ZoneSettingEditParamsItemsZonesAlwaysOnline], +// [ZoneSettingEditParamsItemsZonesAlwaysUseHTTPs], +// [ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewrites], +// [ZoneSettingEditParamsItemsZonesBrotli], +// [ZoneSettingEditParamsItemsZonesBrowserCacheTtl], +// [ZoneSettingEditParamsItemsZonesBrowserCheck], +// [ZoneSettingEditParamsItemsZonesCacheLevel], +// [ZoneSettingEditParamsItemsZonesChallengeTtl], +// [ZoneSettingEditParamsItemsZonesCiphers], +// [ZoneSettingEditParamsItemsZonesCnameFlattening], +// [ZoneSettingEditParamsItemsZonesDevelopmentMode], +// [ZoneSettingEditParamsItemsZonesEarlyHints], +// [ZoneSettingEditParamsItemsZonesEdgeCacheTtl], +// [ZoneSettingEditParamsItemsZonesEmailObfuscation], +// [ZoneSettingEditParamsItemsZonesH2Prioritization], +// [ZoneSettingEditParamsItemsZonesHotlinkProtection], +// [ZoneSettingEditParamsItemsZonesHttp2], [ZoneSettingEditParamsItemsZonesHttp3], +// [ZoneSettingEditParamsItemsZonesImageResizing], +// [ZoneSettingEditParamsItemsZonesIPGeolocation], +// [ZoneSettingEditParamsItemsZonesIpv6], +// [ZoneSettingEditParamsItemsZonesMaxUpload], +// [ZoneSettingEditParamsItemsZonesMinTlsVersion], +// [ZoneSettingEditParamsItemsZonesMinify], +// [ZoneSettingEditParamsItemsZonesMirage], +// [ZoneSettingEditParamsItemsZonesMobileRedirect], +// [ZoneSettingEditParamsItemsZonesNel], +// [ZoneSettingEditParamsItemsZonesOpportunisticEncryption], +// [ZoneSettingEditParamsItemsZonesOpportunisticOnion], +// [ZoneSettingEditParamsItemsZonesOrangeToOrange], +// [ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru], +// [ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersion], +// [ZoneSettingEditParamsItemsZonesPolish], +// [ZoneSettingEditParamsItemsZonesPrefetchPreload], +// [ZoneSettingEditParamsItemsZonesProxyReadTimeout], +// [ZoneSettingEditParamsItemsZonesPseudoIpv4], +// [ZoneSettingEditParamsItemsZonesResponseBuffering], +// [ZoneSettingEditParamsItemsZonesRocketLoader], +// [ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization], +// [ZoneSettingEditParamsItemsZonesSecurityHeader], +// [ZoneSettingEditParamsItemsZonesSecurityLevel], +// [ZoneSettingEditParamsItemsZonesServerSideExclude], +// [ZoneSettingEditParamsItemsZonesSha1Support], +// [ZoneSettingEditParamsItemsZonesSortQueryStringForCache], +// [ZoneSettingEditParamsItemsZonesSsl], +// [ZoneSettingEditParamsItemsZonesSslRecommender], +// [ZoneSettingEditParamsItemsZonesTls1_2Only], +// [ZoneSettingEditParamsItemsZonesTls1_3], +// [ZoneSettingEditParamsItemsZonesTlsClientAuth], +// [ZoneSettingEditParamsItemsZonesTrueClientIPHeader], +// [ZoneSettingEditParamsItemsZonesWaf], [ZoneSettingEditParamsItemsZonesWebp], +// [ZoneSettingEditParamsItemsZonesWebsockets]. type ZoneSettingEditParamsItem interface { implementsZoneSettingEditParamsItem() } +// 0-RTT session resumption enabled for this zone. +type ZoneSettingEditParamsItemsZones0rtt struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZones0rttID] `json:"id"` + // Value of the 0-RTT setting. + Value param.Field[ZoneSettingEditParamsItemsZones0rttValue] `json:"value"` +} + +func (r ZoneSettingEditParamsItemsZones0rtt) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZones0rtt) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZones0rttID string + +const ( + ZoneSettingEditParamsItemsZones0rttID0rtt ZoneSettingEditParamsItemsZones0rttID = "0rtt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZones0rttEditable bool + +const ( + ZoneSettingEditParamsItemsZones0rttEditableTrue ZoneSettingEditParamsItemsZones0rttEditable = true + ZoneSettingEditParamsItemsZones0rttEditableFalse ZoneSettingEditParamsItemsZones0rttEditable = false +) + +// Value of the 0-RTT setting. +type ZoneSettingEditParamsItemsZones0rttValue string + +const ( + ZoneSettingEditParamsItemsZones0rttValueOn ZoneSettingEditParamsItemsZones0rttValue = "on" + ZoneSettingEditParamsItemsZones0rttValueOff ZoneSettingEditParamsItemsZones0rttValue = "off" +) + // Advanced protection from Distributed Denial of Service (DDoS) attacks on your // website. This is an uneditable value that is 'on' in the case of Business and // Enterprise zones. -type ZoneSettingEditParamsItemsAdvancedDdos struct { +type ZoneSettingEditParamsItemsZonesAdvancedDdos struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsAdvancedDdosID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesAdvancedDdosID] `json:"id"` // Value of the zone setting. Notes: Defaults to on for Business+ plans - Value param.Field[ZoneSettingEditParamsItemsAdvancedDdosValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesAdvancedDdosValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsAdvancedDdos) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesAdvancedDdos) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsAdvancedDdos) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesAdvancedDdos) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsAdvancedDdosID string +type ZoneSettingEditParamsItemsZonesAdvancedDdosID string const ( - ZoneSettingEditParamsItemsAdvancedDdosIDAdvancedDdos ZoneSettingEditParamsItemsAdvancedDdosID = "advanced_ddos" + ZoneSettingEditParamsItemsZonesAdvancedDdosIDAdvancedDdos ZoneSettingEditParamsItemsZonesAdvancedDdosID = "advanced_ddos" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsAdvancedDdosEditable bool +type ZoneSettingEditParamsItemsZonesAdvancedDdosEditable bool const ( - ZoneSettingEditParamsItemsAdvancedDdosEditableTrue ZoneSettingEditParamsItemsAdvancedDdosEditable = true - ZoneSettingEditParamsItemsAdvancedDdosEditableFalse ZoneSettingEditParamsItemsAdvancedDdosEditable = false + ZoneSettingEditParamsItemsZonesAdvancedDdosEditableTrue ZoneSettingEditParamsItemsZonesAdvancedDdosEditable = true + ZoneSettingEditParamsItemsZonesAdvancedDdosEditableFalse ZoneSettingEditParamsItemsZonesAdvancedDdosEditable = false ) // Value of the zone setting. Notes: Defaults to on for Business+ plans -type ZoneSettingEditParamsItemsAdvancedDdosValue string +type ZoneSettingEditParamsItemsZonesAdvancedDdosValue string const ( - ZoneSettingEditParamsItemsAdvancedDdosValueOn ZoneSettingEditParamsItemsAdvancedDdosValue = "on" - ZoneSettingEditParamsItemsAdvancedDdosValueOff ZoneSettingEditParamsItemsAdvancedDdosValue = "off" + ZoneSettingEditParamsItemsZonesAdvancedDdosValueOn ZoneSettingEditParamsItemsZonesAdvancedDdosValue = "on" + ZoneSettingEditParamsItemsZonesAdvancedDdosValueOff ZoneSettingEditParamsItemsZonesAdvancedDdosValue = "off" ) // When enabled, Cloudflare serves limited copies of web pages available from the @@ -3797,229 +7260,230 @@ const ( // offline. Refer to // [Always Online](https://developers.cloudflare.com/cache/about/always-online) for // more information. -type ZoneSettingEditParamsItemsAlwaysOnline struct { +type ZoneSettingEditParamsItemsZonesAlwaysOnline struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsAlwaysOnlineID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesAlwaysOnlineID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsAlwaysOnlineValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesAlwaysOnlineValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsAlwaysOnline) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesAlwaysOnline) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsAlwaysOnline) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesAlwaysOnline) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsAlwaysOnlineID string +type ZoneSettingEditParamsItemsZonesAlwaysOnlineID string const ( - ZoneSettingEditParamsItemsAlwaysOnlineIDAlwaysOnline ZoneSettingEditParamsItemsAlwaysOnlineID = "always_online" + ZoneSettingEditParamsItemsZonesAlwaysOnlineIDAlwaysOnline ZoneSettingEditParamsItemsZonesAlwaysOnlineID = "always_online" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsAlwaysOnlineEditable bool +type ZoneSettingEditParamsItemsZonesAlwaysOnlineEditable bool const ( - ZoneSettingEditParamsItemsAlwaysOnlineEditableTrue ZoneSettingEditParamsItemsAlwaysOnlineEditable = true - ZoneSettingEditParamsItemsAlwaysOnlineEditableFalse ZoneSettingEditParamsItemsAlwaysOnlineEditable = false + ZoneSettingEditParamsItemsZonesAlwaysOnlineEditableTrue ZoneSettingEditParamsItemsZonesAlwaysOnlineEditable = true + ZoneSettingEditParamsItemsZonesAlwaysOnlineEditableFalse ZoneSettingEditParamsItemsZonesAlwaysOnlineEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsAlwaysOnlineValue string +type ZoneSettingEditParamsItemsZonesAlwaysOnlineValue string const ( - ZoneSettingEditParamsItemsAlwaysOnlineValueOn ZoneSettingEditParamsItemsAlwaysOnlineValue = "on" - ZoneSettingEditParamsItemsAlwaysOnlineValueOff ZoneSettingEditParamsItemsAlwaysOnlineValue = "off" + ZoneSettingEditParamsItemsZonesAlwaysOnlineValueOn ZoneSettingEditParamsItemsZonesAlwaysOnlineValue = "on" + ZoneSettingEditParamsItemsZonesAlwaysOnlineValueOff ZoneSettingEditParamsItemsZonesAlwaysOnlineValue = "off" ) // Reply to all requests for URLs that use "http" with a 301 redirect to the // equivalent "https" URL. If you only want to redirect for a subset of requests, // consider creating an "Always use HTTPS" page rule. -type ZoneSettingEditParamsItemsAlwaysUseHTTPs struct { +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPs struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsAlwaysUseHTTPsID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsAlwaysUseHTTPsValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsAlwaysUseHTTPs) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesAlwaysUseHTTPs) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsAlwaysUseHTTPs) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesAlwaysUseHTTPs) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsAlwaysUseHTTPsID string +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsID string const ( - ZoneSettingEditParamsItemsAlwaysUseHTTPsIDAlwaysUseHTTPs ZoneSettingEditParamsItemsAlwaysUseHTTPsID = "always_use_https" + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsIDAlwaysUseHTTPs ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsID = "always_use_https" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsAlwaysUseHTTPsEditable bool +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsEditable bool const ( - ZoneSettingEditParamsItemsAlwaysUseHTTPsEditableTrue ZoneSettingEditParamsItemsAlwaysUseHTTPsEditable = true - ZoneSettingEditParamsItemsAlwaysUseHTTPsEditableFalse ZoneSettingEditParamsItemsAlwaysUseHTTPsEditable = false + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsEditableTrue ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsEditable = true + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsEditableFalse ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsAlwaysUseHTTPsValue string +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsValue string const ( - ZoneSettingEditParamsItemsAlwaysUseHTTPsValueOn ZoneSettingEditParamsItemsAlwaysUseHTTPsValue = "on" - ZoneSettingEditParamsItemsAlwaysUseHTTPsValueOff ZoneSettingEditParamsItemsAlwaysUseHTTPsValue = "off" + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsValueOn ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsValue = "on" + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsValueOff ZoneSettingEditParamsItemsZonesAlwaysUseHTTPsValue = "off" ) // Enable the Automatic HTTPS Rewrites feature for this zone. -type ZoneSettingEditParamsItemsAutomaticHTTPsRewrites struct { +type ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewrites struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsAutomaticHTTPsRewritesID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesID] `json:"id"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value param.Field[ZoneSettingEditParamsItemsAutomaticHTTPsRewritesValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsAutomaticHTTPsRewrites) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewrites) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsAutomaticHTTPsRewrites) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewrites) implementsZoneSettingEditParamsItem() { +} // ID of the zone setting. -type ZoneSettingEditParamsItemsAutomaticHTTPsRewritesID string +type ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesID string const ( - ZoneSettingEditParamsItemsAutomaticHTTPsRewritesIDAutomaticHTTPsRewrites ZoneSettingEditParamsItemsAutomaticHTTPsRewritesID = "automatic_https_rewrites" + ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesIDAutomaticHTTPsRewrites ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesID = "automatic_https_rewrites" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsAutomaticHTTPsRewritesEditable bool +type ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesEditable bool const ( - ZoneSettingEditParamsItemsAutomaticHTTPsRewritesEditableTrue ZoneSettingEditParamsItemsAutomaticHTTPsRewritesEditable = true - ZoneSettingEditParamsItemsAutomaticHTTPsRewritesEditableFalse ZoneSettingEditParamsItemsAutomaticHTTPsRewritesEditable = false + ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesEditableTrue ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesEditable = true + ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesEditableFalse ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesEditable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingEditParamsItemsAutomaticHTTPsRewritesValue string +type ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesValue string const ( - ZoneSettingEditParamsItemsAutomaticHTTPsRewritesValueOn ZoneSettingEditParamsItemsAutomaticHTTPsRewritesValue = "on" - ZoneSettingEditParamsItemsAutomaticHTTPsRewritesValueOff ZoneSettingEditParamsItemsAutomaticHTTPsRewritesValue = "off" + ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesValueOn ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesValue = "on" + ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesValueOff ZoneSettingEditParamsItemsZonesAutomaticHTTPsRewritesValue = "off" ) // When the client requesting an asset supports the Brotli compression algorithm, // Cloudflare will serve a Brotli compressed version of the asset. -type ZoneSettingEditParamsItemsBrotli struct { +type ZoneSettingEditParamsItemsZonesBrotli struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsBrotliID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesBrotliID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsBrotliValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesBrotliValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsBrotli) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesBrotli) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsBrotli) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesBrotli) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsBrotliID string +type ZoneSettingEditParamsItemsZonesBrotliID string const ( - ZoneSettingEditParamsItemsBrotliIDBrotli ZoneSettingEditParamsItemsBrotliID = "brotli" + ZoneSettingEditParamsItemsZonesBrotliIDBrotli ZoneSettingEditParamsItemsZonesBrotliID = "brotli" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsBrotliEditable bool +type ZoneSettingEditParamsItemsZonesBrotliEditable bool const ( - ZoneSettingEditParamsItemsBrotliEditableTrue ZoneSettingEditParamsItemsBrotliEditable = true - ZoneSettingEditParamsItemsBrotliEditableFalse ZoneSettingEditParamsItemsBrotliEditable = false + ZoneSettingEditParamsItemsZonesBrotliEditableTrue ZoneSettingEditParamsItemsZonesBrotliEditable = true + ZoneSettingEditParamsItemsZonesBrotliEditableFalse ZoneSettingEditParamsItemsZonesBrotliEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsBrotliValue string +type ZoneSettingEditParamsItemsZonesBrotliValue string const ( - ZoneSettingEditParamsItemsBrotliValueOff ZoneSettingEditParamsItemsBrotliValue = "off" - ZoneSettingEditParamsItemsBrotliValueOn ZoneSettingEditParamsItemsBrotliValue = "on" + ZoneSettingEditParamsItemsZonesBrotliValueOff ZoneSettingEditParamsItemsZonesBrotliValue = "off" + ZoneSettingEditParamsItemsZonesBrotliValueOn ZoneSettingEditParamsItemsZonesBrotliValue = "on" ) // Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources // will remain on your visitors' computers. Cloudflare will honor any larger times // specified by your server. // (https://support.cloudflare.com/hc/en-us/articles/200168276). -type ZoneSettingEditParamsItemsBrowserCacheTtl struct { +type ZoneSettingEditParamsItemsZonesBrowserCacheTtl struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsBrowserCacheTtlID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesBrowserCacheTtlID] `json:"id"` // Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting // `Respect Existing Headers` - Value param.Field[ZoneSettingEditParamsItemsBrowserCacheTtlValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsBrowserCacheTtl) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesBrowserCacheTtl) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsBrowserCacheTtl) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesBrowserCacheTtl) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsBrowserCacheTtlID string +type ZoneSettingEditParamsItemsZonesBrowserCacheTtlID string const ( - ZoneSettingEditParamsItemsBrowserCacheTtlIDBrowserCacheTtl ZoneSettingEditParamsItemsBrowserCacheTtlID = "browser_cache_ttl" + ZoneSettingEditParamsItemsZonesBrowserCacheTtlIDBrowserCacheTtl ZoneSettingEditParamsItemsZonesBrowserCacheTtlID = "browser_cache_ttl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsBrowserCacheTtlEditable bool +type ZoneSettingEditParamsItemsZonesBrowserCacheTtlEditable bool const ( - ZoneSettingEditParamsItemsBrowserCacheTtlEditableTrue ZoneSettingEditParamsItemsBrowserCacheTtlEditable = true - ZoneSettingEditParamsItemsBrowserCacheTtlEditableFalse ZoneSettingEditParamsItemsBrowserCacheTtlEditable = false + ZoneSettingEditParamsItemsZonesBrowserCacheTtlEditableTrue ZoneSettingEditParamsItemsZonesBrowserCacheTtlEditable = true + ZoneSettingEditParamsItemsZonesBrowserCacheTtlEditableFalse ZoneSettingEditParamsItemsZonesBrowserCacheTtlEditable = false ) // Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting // `Respect Existing Headers` -type ZoneSettingEditParamsItemsBrowserCacheTtlValue float64 - -const ( - ZoneSettingEditParamsItemsBrowserCacheTtlValue0 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 0 - ZoneSettingEditParamsItemsBrowserCacheTtlValue30 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 30 - ZoneSettingEditParamsItemsBrowserCacheTtlValue60 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 60 - ZoneSettingEditParamsItemsBrowserCacheTtlValue120 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 120 - ZoneSettingEditParamsItemsBrowserCacheTtlValue300 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 300 - ZoneSettingEditParamsItemsBrowserCacheTtlValue1200 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 1200 - ZoneSettingEditParamsItemsBrowserCacheTtlValue1800 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 1800 - ZoneSettingEditParamsItemsBrowserCacheTtlValue3600 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 3600 - ZoneSettingEditParamsItemsBrowserCacheTtlValue7200 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 7200 - ZoneSettingEditParamsItemsBrowserCacheTtlValue10800 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 10800 - ZoneSettingEditParamsItemsBrowserCacheTtlValue14400 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 14400 - ZoneSettingEditParamsItemsBrowserCacheTtlValue18000 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 18000 - ZoneSettingEditParamsItemsBrowserCacheTtlValue28800 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 28800 - ZoneSettingEditParamsItemsBrowserCacheTtlValue43200 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 43200 - ZoneSettingEditParamsItemsBrowserCacheTtlValue57600 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 57600 - ZoneSettingEditParamsItemsBrowserCacheTtlValue72000 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 72000 - ZoneSettingEditParamsItemsBrowserCacheTtlValue86400 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 86400 - ZoneSettingEditParamsItemsBrowserCacheTtlValue172800 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 172800 - ZoneSettingEditParamsItemsBrowserCacheTtlValue259200 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 259200 - ZoneSettingEditParamsItemsBrowserCacheTtlValue345600 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 345600 - ZoneSettingEditParamsItemsBrowserCacheTtlValue432000 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 432000 - ZoneSettingEditParamsItemsBrowserCacheTtlValue691200 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 691200 - ZoneSettingEditParamsItemsBrowserCacheTtlValue1382400 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 1382400 - ZoneSettingEditParamsItemsBrowserCacheTtlValue2073600 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 2073600 - ZoneSettingEditParamsItemsBrowserCacheTtlValue2678400 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 2678400 - ZoneSettingEditParamsItemsBrowserCacheTtlValue5356800 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 5356800 - ZoneSettingEditParamsItemsBrowserCacheTtlValue16070400 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 16070400 - ZoneSettingEditParamsItemsBrowserCacheTtlValue31536000 ZoneSettingEditParamsItemsBrowserCacheTtlValue = 31536000 +type ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue float64 + +const ( + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue0 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 0 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue30 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 30 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue60 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 60 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue120 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 120 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue300 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 300 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue1200 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 1200 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue1800 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 1800 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue3600 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 3600 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue7200 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 7200 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue10800 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 10800 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue14400 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 14400 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue18000 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 18000 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue28800 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 28800 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue43200 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 43200 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue57600 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 57600 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue72000 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 72000 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue86400 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 86400 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue172800 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 172800 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue259200 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 259200 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue345600 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 345600 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue432000 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 432000 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue691200 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 691200 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue1382400 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 1382400 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue2073600 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 2073600 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue2678400 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 2678400 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue5356800 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 5356800 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue16070400 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 16070400 + ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue31536000 ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue = 31536000 ) // Browser Integrity Check is similar to Bad Behavior and looks for common HTTP @@ -4027,41 +7491,41 @@ const ( // also challenge visitors that do not have a user agent or a non standard user // agent (also commonly used by abuse bots, crawlers or visitors). // (https://support.cloudflare.com/hc/en-us/articles/200170086). -type ZoneSettingEditParamsItemsBrowserCheck struct { +type ZoneSettingEditParamsItemsZonesBrowserCheck struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsBrowserCheckID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesBrowserCheckID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsBrowserCheckValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesBrowserCheckValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsBrowserCheck) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesBrowserCheck) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsBrowserCheck) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesBrowserCheck) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsBrowserCheckID string +type ZoneSettingEditParamsItemsZonesBrowserCheckID string const ( - ZoneSettingEditParamsItemsBrowserCheckIDBrowserCheck ZoneSettingEditParamsItemsBrowserCheckID = "browser_check" + ZoneSettingEditParamsItemsZonesBrowserCheckIDBrowserCheck ZoneSettingEditParamsItemsZonesBrowserCheckID = "browser_check" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsBrowserCheckEditable bool +type ZoneSettingEditParamsItemsZonesBrowserCheckEditable bool const ( - ZoneSettingEditParamsItemsBrowserCheckEditableTrue ZoneSettingEditParamsItemsBrowserCheckEditable = true - ZoneSettingEditParamsItemsBrowserCheckEditableFalse ZoneSettingEditParamsItemsBrowserCheckEditable = false + ZoneSettingEditParamsItemsZonesBrowserCheckEditableTrue ZoneSettingEditParamsItemsZonesBrowserCheckEditable = true + ZoneSettingEditParamsItemsZonesBrowserCheckEditableFalse ZoneSettingEditParamsItemsZonesBrowserCheckEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsBrowserCheckValue string +type ZoneSettingEditParamsItemsZonesBrowserCheckValue string const ( - ZoneSettingEditParamsItemsBrowserCheckValueOn ZoneSettingEditParamsItemsBrowserCheckValue = "on" - ZoneSettingEditParamsItemsBrowserCheckValueOff ZoneSettingEditParamsItemsBrowserCheckValue = "off" + ZoneSettingEditParamsItemsZonesBrowserCheckValueOn ZoneSettingEditParamsItemsZonesBrowserCheckValue = "on" + ZoneSettingEditParamsItemsZonesBrowserCheckValueOff ZoneSettingEditParamsItemsZonesBrowserCheckValue = "off" ) // Cache Level functions based off the setting level. The basic setting will cache @@ -4069,42 +7533,42 @@ const ( // setting will ignore the query string when delivering a cached resource. The // aggressive setting will cache all static resources, including ones with a query // string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -type ZoneSettingEditParamsItemsCacheLevel struct { +type ZoneSettingEditParamsItemsZonesCacheLevel struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsCacheLevelID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesCacheLevelID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsCacheLevelValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesCacheLevelValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsCacheLevel) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesCacheLevel) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsCacheLevel) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesCacheLevel) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsCacheLevelID string +type ZoneSettingEditParamsItemsZonesCacheLevelID string const ( - ZoneSettingEditParamsItemsCacheLevelIDCacheLevel ZoneSettingEditParamsItemsCacheLevelID = "cache_level" + ZoneSettingEditParamsItemsZonesCacheLevelIDCacheLevel ZoneSettingEditParamsItemsZonesCacheLevelID = "cache_level" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsCacheLevelEditable bool +type ZoneSettingEditParamsItemsZonesCacheLevelEditable bool const ( - ZoneSettingEditParamsItemsCacheLevelEditableTrue ZoneSettingEditParamsItemsCacheLevelEditable = true - ZoneSettingEditParamsItemsCacheLevelEditableFalse ZoneSettingEditParamsItemsCacheLevelEditable = false + ZoneSettingEditParamsItemsZonesCacheLevelEditableTrue ZoneSettingEditParamsItemsZonesCacheLevelEditable = true + ZoneSettingEditParamsItemsZonesCacheLevelEditableFalse ZoneSettingEditParamsItemsZonesCacheLevelEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsCacheLevelValue string +type ZoneSettingEditParamsItemsZonesCacheLevelValue string const ( - ZoneSettingEditParamsItemsCacheLevelValueAggressive ZoneSettingEditParamsItemsCacheLevelValue = "aggressive" - ZoneSettingEditParamsItemsCacheLevelValueBasic ZoneSettingEditParamsItemsCacheLevelValue = "basic" - ZoneSettingEditParamsItemsCacheLevelValueSimplified ZoneSettingEditParamsItemsCacheLevelValue = "simplified" + ZoneSettingEditParamsItemsZonesCacheLevelValueAggressive ZoneSettingEditParamsItemsZonesCacheLevelValue = "aggressive" + ZoneSettingEditParamsItemsZonesCacheLevelValueBasic ZoneSettingEditParamsItemsZonesCacheLevelValue = "basic" + ZoneSettingEditParamsItemsZonesCacheLevelValueSimplified ZoneSettingEditParamsItemsZonesCacheLevelValue = "simplified" ) // Specify how long a visitor is allowed access to your site after successfully @@ -4112,122 +7576,122 @@ const ( // visitor will have to complete a new challenge. We recommend a 15 - 45 minute // setting and will attempt to honor any setting above 45 minutes. // (https://support.cloudflare.com/hc/en-us/articles/200170136). -type ZoneSettingEditParamsItemsChallengeTtl struct { +type ZoneSettingEditParamsItemsZonesChallengeTtl struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsChallengeTtlID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesChallengeTtlID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsChallengeTtlValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesChallengeTtlValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsChallengeTtl) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesChallengeTtl) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsChallengeTtl) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesChallengeTtl) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsChallengeTtlID string +type ZoneSettingEditParamsItemsZonesChallengeTtlID string const ( - ZoneSettingEditParamsItemsChallengeTtlIDChallengeTtl ZoneSettingEditParamsItemsChallengeTtlID = "challenge_ttl" + ZoneSettingEditParamsItemsZonesChallengeTtlIDChallengeTtl ZoneSettingEditParamsItemsZonesChallengeTtlID = "challenge_ttl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsChallengeTtlEditable bool +type ZoneSettingEditParamsItemsZonesChallengeTtlEditable bool const ( - ZoneSettingEditParamsItemsChallengeTtlEditableTrue ZoneSettingEditParamsItemsChallengeTtlEditable = true - ZoneSettingEditParamsItemsChallengeTtlEditableFalse ZoneSettingEditParamsItemsChallengeTtlEditable = false + ZoneSettingEditParamsItemsZonesChallengeTtlEditableTrue ZoneSettingEditParamsItemsZonesChallengeTtlEditable = true + ZoneSettingEditParamsItemsZonesChallengeTtlEditableFalse ZoneSettingEditParamsItemsZonesChallengeTtlEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsChallengeTtlValue float64 +type ZoneSettingEditParamsItemsZonesChallengeTtlValue float64 const ( - ZoneSettingEditParamsItemsChallengeTtlValue300 ZoneSettingEditParamsItemsChallengeTtlValue = 300 - ZoneSettingEditParamsItemsChallengeTtlValue900 ZoneSettingEditParamsItemsChallengeTtlValue = 900 - ZoneSettingEditParamsItemsChallengeTtlValue1800 ZoneSettingEditParamsItemsChallengeTtlValue = 1800 - ZoneSettingEditParamsItemsChallengeTtlValue2700 ZoneSettingEditParamsItemsChallengeTtlValue = 2700 - ZoneSettingEditParamsItemsChallengeTtlValue3600 ZoneSettingEditParamsItemsChallengeTtlValue = 3600 - ZoneSettingEditParamsItemsChallengeTtlValue7200 ZoneSettingEditParamsItemsChallengeTtlValue = 7200 - ZoneSettingEditParamsItemsChallengeTtlValue10800 ZoneSettingEditParamsItemsChallengeTtlValue = 10800 - ZoneSettingEditParamsItemsChallengeTtlValue14400 ZoneSettingEditParamsItemsChallengeTtlValue = 14400 - ZoneSettingEditParamsItemsChallengeTtlValue28800 ZoneSettingEditParamsItemsChallengeTtlValue = 28800 - ZoneSettingEditParamsItemsChallengeTtlValue57600 ZoneSettingEditParamsItemsChallengeTtlValue = 57600 - ZoneSettingEditParamsItemsChallengeTtlValue86400 ZoneSettingEditParamsItemsChallengeTtlValue = 86400 - ZoneSettingEditParamsItemsChallengeTtlValue604800 ZoneSettingEditParamsItemsChallengeTtlValue = 604800 - ZoneSettingEditParamsItemsChallengeTtlValue2592000 ZoneSettingEditParamsItemsChallengeTtlValue = 2592000 - ZoneSettingEditParamsItemsChallengeTtlValue31536000 ZoneSettingEditParamsItemsChallengeTtlValue = 31536000 + ZoneSettingEditParamsItemsZonesChallengeTtlValue300 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 300 + ZoneSettingEditParamsItemsZonesChallengeTtlValue900 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 900 + ZoneSettingEditParamsItemsZonesChallengeTtlValue1800 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 1800 + ZoneSettingEditParamsItemsZonesChallengeTtlValue2700 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 2700 + ZoneSettingEditParamsItemsZonesChallengeTtlValue3600 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 3600 + ZoneSettingEditParamsItemsZonesChallengeTtlValue7200 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 7200 + ZoneSettingEditParamsItemsZonesChallengeTtlValue10800 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 10800 + ZoneSettingEditParamsItemsZonesChallengeTtlValue14400 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 14400 + ZoneSettingEditParamsItemsZonesChallengeTtlValue28800 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 28800 + ZoneSettingEditParamsItemsZonesChallengeTtlValue57600 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 57600 + ZoneSettingEditParamsItemsZonesChallengeTtlValue86400 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 86400 + ZoneSettingEditParamsItemsZonesChallengeTtlValue604800 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 604800 + ZoneSettingEditParamsItemsZonesChallengeTtlValue2592000 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 2592000 + ZoneSettingEditParamsItemsZonesChallengeTtlValue31536000 ZoneSettingEditParamsItemsZonesChallengeTtlValue = 31536000 ) // An allowlist of ciphers for TLS termination. These ciphers must be in the // BoringSSL format. -type ZoneSettingEditParamsItemsCiphers struct { +type ZoneSettingEditParamsItemsZonesCiphers struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsCiphersID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesCiphersID] `json:"id"` // Value of the zone setting. Value param.Field[[]string] `json:"value"` } -func (r ZoneSettingEditParamsItemsCiphers) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesCiphers) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsCiphers) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesCiphers) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsCiphersID string +type ZoneSettingEditParamsItemsZonesCiphersID string const ( - ZoneSettingEditParamsItemsCiphersIDCiphers ZoneSettingEditParamsItemsCiphersID = "ciphers" + ZoneSettingEditParamsItemsZonesCiphersIDCiphers ZoneSettingEditParamsItemsZonesCiphersID = "ciphers" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsCiphersEditable bool +type ZoneSettingEditParamsItemsZonesCiphersEditable bool const ( - ZoneSettingEditParamsItemsCiphersEditableTrue ZoneSettingEditParamsItemsCiphersEditable = true - ZoneSettingEditParamsItemsCiphersEditableFalse ZoneSettingEditParamsItemsCiphersEditable = false + ZoneSettingEditParamsItemsZonesCiphersEditableTrue ZoneSettingEditParamsItemsZonesCiphersEditable = true + ZoneSettingEditParamsItemsZonesCiphersEditableFalse ZoneSettingEditParamsItemsZonesCiphersEditable = false ) // Whether or not cname flattening is on. -type ZoneSettingEditParamsItemsCnameFlattening struct { +type ZoneSettingEditParamsItemsZonesCnameFlattening struct { // How to flatten the cname destination. - ID param.Field[ZoneSettingEditParamsItemsCnameFlatteningID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesCnameFlatteningID] `json:"id"` // Value of the cname flattening setting. - Value param.Field[ZoneSettingEditParamsItemsCnameFlatteningValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesCnameFlatteningValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsCnameFlattening) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesCnameFlattening) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsCnameFlattening) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesCnameFlattening) implementsZoneSettingEditParamsItem() {} // How to flatten the cname destination. -type ZoneSettingEditParamsItemsCnameFlatteningID string +type ZoneSettingEditParamsItemsZonesCnameFlatteningID string const ( - ZoneSettingEditParamsItemsCnameFlatteningIDCnameFlattening ZoneSettingEditParamsItemsCnameFlatteningID = "cname_flattening" + ZoneSettingEditParamsItemsZonesCnameFlatteningIDCnameFlattening ZoneSettingEditParamsItemsZonesCnameFlatteningID = "cname_flattening" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsCnameFlatteningEditable bool +type ZoneSettingEditParamsItemsZonesCnameFlatteningEditable bool const ( - ZoneSettingEditParamsItemsCnameFlatteningEditableTrue ZoneSettingEditParamsItemsCnameFlatteningEditable = true - ZoneSettingEditParamsItemsCnameFlatteningEditableFalse ZoneSettingEditParamsItemsCnameFlatteningEditable = false + ZoneSettingEditParamsItemsZonesCnameFlatteningEditableTrue ZoneSettingEditParamsItemsZonesCnameFlatteningEditable = true + ZoneSettingEditParamsItemsZonesCnameFlatteningEditableFalse ZoneSettingEditParamsItemsZonesCnameFlatteningEditable = false ) // Value of the cname flattening setting. -type ZoneSettingEditParamsItemsCnameFlatteningValue string +type ZoneSettingEditParamsItemsZonesCnameFlatteningValue string const ( - ZoneSettingEditParamsItemsCnameFlatteningValueFlattenAtRoot ZoneSettingEditParamsItemsCnameFlatteningValue = "flatten_at_root" - ZoneSettingEditParamsItemsCnameFlatteningValueFlattenAll ZoneSettingEditParamsItemsCnameFlatteningValue = "flatten_all" + ZoneSettingEditParamsItemsZonesCnameFlatteningValueFlattenAtRoot ZoneSettingEditParamsItemsZonesCnameFlatteningValue = "flatten_at_root" + ZoneSettingEditParamsItemsZonesCnameFlatteningValueFlattenAll ZoneSettingEditParamsItemsZonesCnameFlatteningValue = "flatten_all" ) // Development Mode temporarily allows you to enter development mode for your @@ -4236,222 +7700,222 @@ const ( // changes to cacheable content (like images, css, or JavaScript) and would like to // see those changes right away. Once entered, development mode will last for 3 // hours and then automatically toggle off. -type ZoneSettingEditParamsItemsDevelopmentMode struct { +type ZoneSettingEditParamsItemsZonesDevelopmentMode struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsDevelopmentModeID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesDevelopmentModeID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsDevelopmentModeValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesDevelopmentModeValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsDevelopmentMode) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesDevelopmentMode) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsDevelopmentMode) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesDevelopmentMode) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsDevelopmentModeID string +type ZoneSettingEditParamsItemsZonesDevelopmentModeID string const ( - ZoneSettingEditParamsItemsDevelopmentModeIDDevelopmentMode ZoneSettingEditParamsItemsDevelopmentModeID = "development_mode" + ZoneSettingEditParamsItemsZonesDevelopmentModeIDDevelopmentMode ZoneSettingEditParamsItemsZonesDevelopmentModeID = "development_mode" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsDevelopmentModeEditable bool +type ZoneSettingEditParamsItemsZonesDevelopmentModeEditable bool const ( - ZoneSettingEditParamsItemsDevelopmentModeEditableTrue ZoneSettingEditParamsItemsDevelopmentModeEditable = true - ZoneSettingEditParamsItemsDevelopmentModeEditableFalse ZoneSettingEditParamsItemsDevelopmentModeEditable = false + ZoneSettingEditParamsItemsZonesDevelopmentModeEditableTrue ZoneSettingEditParamsItemsZonesDevelopmentModeEditable = true + ZoneSettingEditParamsItemsZonesDevelopmentModeEditableFalse ZoneSettingEditParamsItemsZonesDevelopmentModeEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsDevelopmentModeValue string +type ZoneSettingEditParamsItemsZonesDevelopmentModeValue string const ( - ZoneSettingEditParamsItemsDevelopmentModeValueOn ZoneSettingEditParamsItemsDevelopmentModeValue = "on" - ZoneSettingEditParamsItemsDevelopmentModeValueOff ZoneSettingEditParamsItemsDevelopmentModeValue = "off" + ZoneSettingEditParamsItemsZonesDevelopmentModeValueOn ZoneSettingEditParamsItemsZonesDevelopmentModeValue = "on" + ZoneSettingEditParamsItemsZonesDevelopmentModeValueOff ZoneSettingEditParamsItemsZonesDevelopmentModeValue = "off" ) // When enabled, Cloudflare will attempt to speed up overall page loads by serving // `103` responses with `Link` headers from the final response. Refer to // [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for // more information. -type ZoneSettingEditParamsItemsEarlyHints struct { +type ZoneSettingEditParamsItemsZonesEarlyHints struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsEarlyHintsID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesEarlyHintsID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsEarlyHintsValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesEarlyHintsValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsEarlyHints) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesEarlyHints) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsEarlyHints) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesEarlyHints) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsEarlyHintsID string +type ZoneSettingEditParamsItemsZonesEarlyHintsID string const ( - ZoneSettingEditParamsItemsEarlyHintsIDEarlyHints ZoneSettingEditParamsItemsEarlyHintsID = "early_hints" + ZoneSettingEditParamsItemsZonesEarlyHintsIDEarlyHints ZoneSettingEditParamsItemsZonesEarlyHintsID = "early_hints" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsEarlyHintsEditable bool +type ZoneSettingEditParamsItemsZonesEarlyHintsEditable bool const ( - ZoneSettingEditParamsItemsEarlyHintsEditableTrue ZoneSettingEditParamsItemsEarlyHintsEditable = true - ZoneSettingEditParamsItemsEarlyHintsEditableFalse ZoneSettingEditParamsItemsEarlyHintsEditable = false + ZoneSettingEditParamsItemsZonesEarlyHintsEditableTrue ZoneSettingEditParamsItemsZonesEarlyHintsEditable = true + ZoneSettingEditParamsItemsZonesEarlyHintsEditableFalse ZoneSettingEditParamsItemsZonesEarlyHintsEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsEarlyHintsValue string +type ZoneSettingEditParamsItemsZonesEarlyHintsValue string const ( - ZoneSettingEditParamsItemsEarlyHintsValueOn ZoneSettingEditParamsItemsEarlyHintsValue = "on" - ZoneSettingEditParamsItemsEarlyHintsValueOff ZoneSettingEditParamsItemsEarlyHintsValue = "off" + ZoneSettingEditParamsItemsZonesEarlyHintsValueOn ZoneSettingEditParamsItemsZonesEarlyHintsValue = "on" + ZoneSettingEditParamsItemsZonesEarlyHintsValueOff ZoneSettingEditParamsItemsZonesEarlyHintsValue = "off" ) // Time (in seconds) that a resource will be ensured to remain on Cloudflare's // cache servers. -type ZoneSettingEditParamsItemsEdgeCacheTtl struct { +type ZoneSettingEditParamsItemsZonesEdgeCacheTtl struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsEdgeCacheTtlID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesEdgeCacheTtlID] `json:"id"` // Value of the zone setting. Notes: The minimum TTL available depends on the plan // level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200) - Value param.Field[ZoneSettingEditParamsItemsEdgeCacheTtlValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsEdgeCacheTtl) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesEdgeCacheTtl) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsEdgeCacheTtl) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesEdgeCacheTtl) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsEdgeCacheTtlID string +type ZoneSettingEditParamsItemsZonesEdgeCacheTtlID string const ( - ZoneSettingEditParamsItemsEdgeCacheTtlIDEdgeCacheTtl ZoneSettingEditParamsItemsEdgeCacheTtlID = "edge_cache_ttl" + ZoneSettingEditParamsItemsZonesEdgeCacheTtlIDEdgeCacheTtl ZoneSettingEditParamsItemsZonesEdgeCacheTtlID = "edge_cache_ttl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsEdgeCacheTtlEditable bool +type ZoneSettingEditParamsItemsZonesEdgeCacheTtlEditable bool const ( - ZoneSettingEditParamsItemsEdgeCacheTtlEditableTrue ZoneSettingEditParamsItemsEdgeCacheTtlEditable = true - ZoneSettingEditParamsItemsEdgeCacheTtlEditableFalse ZoneSettingEditParamsItemsEdgeCacheTtlEditable = false + ZoneSettingEditParamsItemsZonesEdgeCacheTtlEditableTrue ZoneSettingEditParamsItemsZonesEdgeCacheTtlEditable = true + ZoneSettingEditParamsItemsZonesEdgeCacheTtlEditableFalse ZoneSettingEditParamsItemsZonesEdgeCacheTtlEditable = false ) // Value of the zone setting. Notes: The minimum TTL available depends on the plan // level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200) -type ZoneSettingEditParamsItemsEdgeCacheTtlValue float64 - -const ( - ZoneSettingEditParamsItemsEdgeCacheTtlValue30 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 30 - ZoneSettingEditParamsItemsEdgeCacheTtlValue60 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 60 - ZoneSettingEditParamsItemsEdgeCacheTtlValue300 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 300 - ZoneSettingEditParamsItemsEdgeCacheTtlValue1200 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 1200 - ZoneSettingEditParamsItemsEdgeCacheTtlValue1800 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 1800 - ZoneSettingEditParamsItemsEdgeCacheTtlValue3600 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 3600 - ZoneSettingEditParamsItemsEdgeCacheTtlValue7200 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 7200 - ZoneSettingEditParamsItemsEdgeCacheTtlValue10800 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 10800 - ZoneSettingEditParamsItemsEdgeCacheTtlValue14400 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 14400 - ZoneSettingEditParamsItemsEdgeCacheTtlValue18000 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 18000 - ZoneSettingEditParamsItemsEdgeCacheTtlValue28800 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 28800 - ZoneSettingEditParamsItemsEdgeCacheTtlValue43200 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 43200 - ZoneSettingEditParamsItemsEdgeCacheTtlValue57600 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 57600 - ZoneSettingEditParamsItemsEdgeCacheTtlValue72000 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 72000 - ZoneSettingEditParamsItemsEdgeCacheTtlValue86400 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 86400 - ZoneSettingEditParamsItemsEdgeCacheTtlValue172800 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 172800 - ZoneSettingEditParamsItemsEdgeCacheTtlValue259200 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 259200 - ZoneSettingEditParamsItemsEdgeCacheTtlValue345600 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 345600 - ZoneSettingEditParamsItemsEdgeCacheTtlValue432000 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 432000 - ZoneSettingEditParamsItemsEdgeCacheTtlValue518400 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 518400 - ZoneSettingEditParamsItemsEdgeCacheTtlValue604800 ZoneSettingEditParamsItemsEdgeCacheTtlValue = 604800 +type ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue float64 + +const ( + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue30 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 30 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue60 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 60 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue300 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 300 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue1200 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 1200 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue1800 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 1800 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue3600 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 3600 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue7200 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 7200 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue10800 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 10800 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue14400 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 14400 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue18000 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 18000 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue28800 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 28800 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue43200 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 43200 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue57600 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 57600 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue72000 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 72000 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue86400 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 86400 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue172800 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 172800 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue259200 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 259200 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue345600 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 345600 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue432000 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 432000 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue518400 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 518400 + ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue604800 ZoneSettingEditParamsItemsZonesEdgeCacheTtlValue = 604800 ) // Encrypt email adresses on your web page from bots, while keeping them visible to // humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -type ZoneSettingEditParamsItemsEmailObfuscation struct { +type ZoneSettingEditParamsItemsZonesEmailObfuscation struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsEmailObfuscationID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesEmailObfuscationID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsEmailObfuscationValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesEmailObfuscationValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsEmailObfuscation) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesEmailObfuscation) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsEmailObfuscation) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesEmailObfuscation) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsEmailObfuscationID string +type ZoneSettingEditParamsItemsZonesEmailObfuscationID string const ( - ZoneSettingEditParamsItemsEmailObfuscationIDEmailObfuscation ZoneSettingEditParamsItemsEmailObfuscationID = "email_obfuscation" + ZoneSettingEditParamsItemsZonesEmailObfuscationIDEmailObfuscation ZoneSettingEditParamsItemsZonesEmailObfuscationID = "email_obfuscation" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsEmailObfuscationEditable bool +type ZoneSettingEditParamsItemsZonesEmailObfuscationEditable bool const ( - ZoneSettingEditParamsItemsEmailObfuscationEditableTrue ZoneSettingEditParamsItemsEmailObfuscationEditable = true - ZoneSettingEditParamsItemsEmailObfuscationEditableFalse ZoneSettingEditParamsItemsEmailObfuscationEditable = false + ZoneSettingEditParamsItemsZonesEmailObfuscationEditableTrue ZoneSettingEditParamsItemsZonesEmailObfuscationEditable = true + ZoneSettingEditParamsItemsZonesEmailObfuscationEditableFalse ZoneSettingEditParamsItemsZonesEmailObfuscationEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsEmailObfuscationValue string +type ZoneSettingEditParamsItemsZonesEmailObfuscationValue string const ( - ZoneSettingEditParamsItemsEmailObfuscationValueOn ZoneSettingEditParamsItemsEmailObfuscationValue = "on" - ZoneSettingEditParamsItemsEmailObfuscationValueOff ZoneSettingEditParamsItemsEmailObfuscationValue = "off" + ZoneSettingEditParamsItemsZonesEmailObfuscationValueOn ZoneSettingEditParamsItemsZonesEmailObfuscationValue = "on" + ZoneSettingEditParamsItemsZonesEmailObfuscationValueOff ZoneSettingEditParamsItemsZonesEmailObfuscationValue = "off" ) // HTTP/2 Edge Prioritization optimises the delivery of resources served through // HTTP/2 to improve page load performance. It also supports fine control of // content delivery when used in conjunction with Workers. -type ZoneSettingEditParamsItemsH2Prioritization struct { +type ZoneSettingEditParamsItemsZonesH2Prioritization struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsH2PrioritizationID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesH2PrioritizationID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsH2PrioritizationValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesH2PrioritizationValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsH2Prioritization) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesH2Prioritization) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsH2Prioritization) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesH2Prioritization) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsH2PrioritizationID string +type ZoneSettingEditParamsItemsZonesH2PrioritizationID string const ( - ZoneSettingEditParamsItemsH2PrioritizationIDH2Prioritization ZoneSettingEditParamsItemsH2PrioritizationID = "h2_prioritization" + ZoneSettingEditParamsItemsZonesH2PrioritizationIDH2Prioritization ZoneSettingEditParamsItemsZonesH2PrioritizationID = "h2_prioritization" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsH2PrioritizationEditable bool +type ZoneSettingEditParamsItemsZonesH2PrioritizationEditable bool const ( - ZoneSettingEditParamsItemsH2PrioritizationEditableTrue ZoneSettingEditParamsItemsH2PrioritizationEditable = true - ZoneSettingEditParamsItemsH2PrioritizationEditableFalse ZoneSettingEditParamsItemsH2PrioritizationEditable = false + ZoneSettingEditParamsItemsZonesH2PrioritizationEditableTrue ZoneSettingEditParamsItemsZonesH2PrioritizationEditable = true + ZoneSettingEditParamsItemsZonesH2PrioritizationEditableFalse ZoneSettingEditParamsItemsZonesH2PrioritizationEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsH2PrioritizationValue string +type ZoneSettingEditParamsItemsZonesH2PrioritizationValue string const ( - ZoneSettingEditParamsItemsH2PrioritizationValueOn ZoneSettingEditParamsItemsH2PrioritizationValue = "on" - ZoneSettingEditParamsItemsH2PrioritizationValueOff ZoneSettingEditParamsItemsH2PrioritizationValue = "off" - ZoneSettingEditParamsItemsH2PrioritizationValueCustom ZoneSettingEditParamsItemsH2PrioritizationValue = "custom" + ZoneSettingEditParamsItemsZonesH2PrioritizationValueOn ZoneSettingEditParamsItemsZonesH2PrioritizationValue = "on" + ZoneSettingEditParamsItemsZonesH2PrioritizationValueOff ZoneSettingEditParamsItemsZonesH2PrioritizationValue = "off" + ZoneSettingEditParamsItemsZonesH2PrioritizationValueCustom ZoneSettingEditParamsItemsZonesH2PrioritizationValue = "custom" ) // When enabled, the Hotlink Protection option ensures that other sites cannot suck @@ -4461,706 +7925,708 @@ const ( // view images from your page, but other sites won't be able to steal them for use // on their own pages. // (https://support.cloudflare.com/hc/en-us/articles/200170026). -type ZoneSettingEditParamsItemsHotlinkProtection struct { +type ZoneSettingEditParamsItemsZonesHotlinkProtection struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsHotlinkProtectionID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesHotlinkProtectionID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsHotlinkProtectionValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesHotlinkProtectionValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsHotlinkProtection) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesHotlinkProtection) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsHotlinkProtection) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesHotlinkProtection) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsHotlinkProtectionID string +type ZoneSettingEditParamsItemsZonesHotlinkProtectionID string const ( - ZoneSettingEditParamsItemsHotlinkProtectionIDHotlinkProtection ZoneSettingEditParamsItemsHotlinkProtectionID = "hotlink_protection" + ZoneSettingEditParamsItemsZonesHotlinkProtectionIDHotlinkProtection ZoneSettingEditParamsItemsZonesHotlinkProtectionID = "hotlink_protection" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsHotlinkProtectionEditable bool +type ZoneSettingEditParamsItemsZonesHotlinkProtectionEditable bool const ( - ZoneSettingEditParamsItemsHotlinkProtectionEditableTrue ZoneSettingEditParamsItemsHotlinkProtectionEditable = true - ZoneSettingEditParamsItemsHotlinkProtectionEditableFalse ZoneSettingEditParamsItemsHotlinkProtectionEditable = false + ZoneSettingEditParamsItemsZonesHotlinkProtectionEditableTrue ZoneSettingEditParamsItemsZonesHotlinkProtectionEditable = true + ZoneSettingEditParamsItemsZonesHotlinkProtectionEditableFalse ZoneSettingEditParamsItemsZonesHotlinkProtectionEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsHotlinkProtectionValue string +type ZoneSettingEditParamsItemsZonesHotlinkProtectionValue string const ( - ZoneSettingEditParamsItemsHotlinkProtectionValueOn ZoneSettingEditParamsItemsHotlinkProtectionValue = "on" - ZoneSettingEditParamsItemsHotlinkProtectionValueOff ZoneSettingEditParamsItemsHotlinkProtectionValue = "off" + ZoneSettingEditParamsItemsZonesHotlinkProtectionValueOn ZoneSettingEditParamsItemsZonesHotlinkProtectionValue = "on" + ZoneSettingEditParamsItemsZonesHotlinkProtectionValueOff ZoneSettingEditParamsItemsZonesHotlinkProtectionValue = "off" ) // HTTP2 enabled for this zone. -type ZoneSettingEditParamsItemsHttp2 struct { +type ZoneSettingEditParamsItemsZonesHttp2 struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsHttp2ID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesHttp2ID] `json:"id"` // Value of the HTTP2 setting. - Value param.Field[ZoneSettingEditParamsItemsHttp2Value] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesHttp2Value] `json:"value"` } -func (r ZoneSettingEditParamsItemsHttp2) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesHttp2) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsHttp2) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesHttp2) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsHttp2ID string +type ZoneSettingEditParamsItemsZonesHttp2ID string const ( - ZoneSettingEditParamsItemsHttp2IDHttp2 ZoneSettingEditParamsItemsHttp2ID = "http2" + ZoneSettingEditParamsItemsZonesHttp2IDHttp2 ZoneSettingEditParamsItemsZonesHttp2ID = "http2" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsHttp2Editable bool +type ZoneSettingEditParamsItemsZonesHttp2Editable bool const ( - ZoneSettingEditParamsItemsHttp2EditableTrue ZoneSettingEditParamsItemsHttp2Editable = true - ZoneSettingEditParamsItemsHttp2EditableFalse ZoneSettingEditParamsItemsHttp2Editable = false + ZoneSettingEditParamsItemsZonesHttp2EditableTrue ZoneSettingEditParamsItemsZonesHttp2Editable = true + ZoneSettingEditParamsItemsZonesHttp2EditableFalse ZoneSettingEditParamsItemsZonesHttp2Editable = false ) // Value of the HTTP2 setting. -type ZoneSettingEditParamsItemsHttp2Value string +type ZoneSettingEditParamsItemsZonesHttp2Value string const ( - ZoneSettingEditParamsItemsHttp2ValueOn ZoneSettingEditParamsItemsHttp2Value = "on" - ZoneSettingEditParamsItemsHttp2ValueOff ZoneSettingEditParamsItemsHttp2Value = "off" + ZoneSettingEditParamsItemsZonesHttp2ValueOn ZoneSettingEditParamsItemsZonesHttp2Value = "on" + ZoneSettingEditParamsItemsZonesHttp2ValueOff ZoneSettingEditParamsItemsZonesHttp2Value = "off" ) // HTTP3 enabled for this zone. -type ZoneSettingEditParamsItemsHttp3 struct { +type ZoneSettingEditParamsItemsZonesHttp3 struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsHttp3ID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesHttp3ID] `json:"id"` // Value of the HTTP3 setting. - Value param.Field[ZoneSettingEditParamsItemsHttp3Value] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesHttp3Value] `json:"value"` } -func (r ZoneSettingEditParamsItemsHttp3) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesHttp3) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsHttp3) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesHttp3) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsHttp3ID string +type ZoneSettingEditParamsItemsZonesHttp3ID string const ( - ZoneSettingEditParamsItemsHttp3IDHttp3 ZoneSettingEditParamsItemsHttp3ID = "http3" + ZoneSettingEditParamsItemsZonesHttp3IDHttp3 ZoneSettingEditParamsItemsZonesHttp3ID = "http3" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsHttp3Editable bool +type ZoneSettingEditParamsItemsZonesHttp3Editable bool const ( - ZoneSettingEditParamsItemsHttp3EditableTrue ZoneSettingEditParamsItemsHttp3Editable = true - ZoneSettingEditParamsItemsHttp3EditableFalse ZoneSettingEditParamsItemsHttp3Editable = false + ZoneSettingEditParamsItemsZonesHttp3EditableTrue ZoneSettingEditParamsItemsZonesHttp3Editable = true + ZoneSettingEditParamsItemsZonesHttp3EditableFalse ZoneSettingEditParamsItemsZonesHttp3Editable = false ) // Value of the HTTP3 setting. -type ZoneSettingEditParamsItemsHttp3Value string +type ZoneSettingEditParamsItemsZonesHttp3Value string const ( - ZoneSettingEditParamsItemsHttp3ValueOn ZoneSettingEditParamsItemsHttp3Value = "on" - ZoneSettingEditParamsItemsHttp3ValueOff ZoneSettingEditParamsItemsHttp3Value = "off" + ZoneSettingEditParamsItemsZonesHttp3ValueOn ZoneSettingEditParamsItemsZonesHttp3Value = "on" + ZoneSettingEditParamsItemsZonesHttp3ValueOff ZoneSettingEditParamsItemsZonesHttp3Value = "off" ) // Image Resizing provides on-demand resizing, conversion and optimisation for // images served through Cloudflare's network. Refer to the // [Image Resizing documentation](https://developers.cloudflare.com/images/) for // more information. -type ZoneSettingEditParamsItemsImageResizing struct { +type ZoneSettingEditParamsItemsZonesImageResizing struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsImageResizingID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesImageResizingID] `json:"id"` // Whether the feature is enabled, disabled, or enabled in `open proxy` mode. - Value param.Field[ZoneSettingEditParamsItemsImageResizingValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesImageResizingValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsImageResizing) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesImageResizing) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsImageResizing) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesImageResizing) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsImageResizingID string +type ZoneSettingEditParamsItemsZonesImageResizingID string const ( - ZoneSettingEditParamsItemsImageResizingIDImageResizing ZoneSettingEditParamsItemsImageResizingID = "image_resizing" + ZoneSettingEditParamsItemsZonesImageResizingIDImageResizing ZoneSettingEditParamsItemsZonesImageResizingID = "image_resizing" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsImageResizingEditable bool +type ZoneSettingEditParamsItemsZonesImageResizingEditable bool const ( - ZoneSettingEditParamsItemsImageResizingEditableTrue ZoneSettingEditParamsItemsImageResizingEditable = true - ZoneSettingEditParamsItemsImageResizingEditableFalse ZoneSettingEditParamsItemsImageResizingEditable = false + ZoneSettingEditParamsItemsZonesImageResizingEditableTrue ZoneSettingEditParamsItemsZonesImageResizingEditable = true + ZoneSettingEditParamsItemsZonesImageResizingEditableFalse ZoneSettingEditParamsItemsZonesImageResizingEditable = false ) // Whether the feature is enabled, disabled, or enabled in `open proxy` mode. -type ZoneSettingEditParamsItemsImageResizingValue string +type ZoneSettingEditParamsItemsZonesImageResizingValue string const ( - ZoneSettingEditParamsItemsImageResizingValueOn ZoneSettingEditParamsItemsImageResizingValue = "on" - ZoneSettingEditParamsItemsImageResizingValueOff ZoneSettingEditParamsItemsImageResizingValue = "off" - ZoneSettingEditParamsItemsImageResizingValueOpen ZoneSettingEditParamsItemsImageResizingValue = "open" + ZoneSettingEditParamsItemsZonesImageResizingValueOn ZoneSettingEditParamsItemsZonesImageResizingValue = "on" + ZoneSettingEditParamsItemsZonesImageResizingValueOff ZoneSettingEditParamsItemsZonesImageResizingValue = "off" + ZoneSettingEditParamsItemsZonesImageResizingValueOpen ZoneSettingEditParamsItemsZonesImageResizingValue = "open" ) // Enable IP Geolocation to have Cloudflare geolocate visitors to your website and // pass the country code to you. // (https://support.cloudflare.com/hc/en-us/articles/200168236). -type ZoneSettingEditParamsItemsIPGeolocation struct { +type ZoneSettingEditParamsItemsZonesIPGeolocation struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsIPGeolocationID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesIPGeolocationID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsIPGeolocationValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesIPGeolocationValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsIPGeolocation) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesIPGeolocation) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsIPGeolocation) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesIPGeolocation) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsIPGeolocationID string +type ZoneSettingEditParamsItemsZonesIPGeolocationID string const ( - ZoneSettingEditParamsItemsIPGeolocationIDIPGeolocation ZoneSettingEditParamsItemsIPGeolocationID = "ip_geolocation" + ZoneSettingEditParamsItemsZonesIPGeolocationIDIPGeolocation ZoneSettingEditParamsItemsZonesIPGeolocationID = "ip_geolocation" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsIPGeolocationEditable bool +type ZoneSettingEditParamsItemsZonesIPGeolocationEditable bool const ( - ZoneSettingEditParamsItemsIPGeolocationEditableTrue ZoneSettingEditParamsItemsIPGeolocationEditable = true - ZoneSettingEditParamsItemsIPGeolocationEditableFalse ZoneSettingEditParamsItemsIPGeolocationEditable = false + ZoneSettingEditParamsItemsZonesIPGeolocationEditableTrue ZoneSettingEditParamsItemsZonesIPGeolocationEditable = true + ZoneSettingEditParamsItemsZonesIPGeolocationEditableFalse ZoneSettingEditParamsItemsZonesIPGeolocationEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsIPGeolocationValue string +type ZoneSettingEditParamsItemsZonesIPGeolocationValue string const ( - ZoneSettingEditParamsItemsIPGeolocationValueOn ZoneSettingEditParamsItemsIPGeolocationValue = "on" - ZoneSettingEditParamsItemsIPGeolocationValueOff ZoneSettingEditParamsItemsIPGeolocationValue = "off" + ZoneSettingEditParamsItemsZonesIPGeolocationValueOn ZoneSettingEditParamsItemsZonesIPGeolocationValue = "on" + ZoneSettingEditParamsItemsZonesIPGeolocationValueOff ZoneSettingEditParamsItemsZonesIPGeolocationValue = "off" ) // Enable IPv6 on all subdomains that are Cloudflare enabled. // (https://support.cloudflare.com/hc/en-us/articles/200168586). -type ZoneSettingEditParamsItemsIpv6 struct { +type ZoneSettingEditParamsItemsZonesIpv6 struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsIpv6ID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesIpv6ID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsIpv6Value] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesIpv6Value] `json:"value"` } -func (r ZoneSettingEditParamsItemsIpv6) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesIpv6) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsIpv6) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesIpv6) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsIpv6ID string +type ZoneSettingEditParamsItemsZonesIpv6ID string const ( - ZoneSettingEditParamsItemsIpv6IDIpv6 ZoneSettingEditParamsItemsIpv6ID = "ipv6" + ZoneSettingEditParamsItemsZonesIpv6IDIpv6 ZoneSettingEditParamsItemsZonesIpv6ID = "ipv6" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsIpv6Editable bool +type ZoneSettingEditParamsItemsZonesIpv6Editable bool const ( - ZoneSettingEditParamsItemsIpv6EditableTrue ZoneSettingEditParamsItemsIpv6Editable = true - ZoneSettingEditParamsItemsIpv6EditableFalse ZoneSettingEditParamsItemsIpv6Editable = false + ZoneSettingEditParamsItemsZonesIpv6EditableTrue ZoneSettingEditParamsItemsZonesIpv6Editable = true + ZoneSettingEditParamsItemsZonesIpv6EditableFalse ZoneSettingEditParamsItemsZonesIpv6Editable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsIpv6Value string +type ZoneSettingEditParamsItemsZonesIpv6Value string const ( - ZoneSettingEditParamsItemsIpv6ValueOff ZoneSettingEditParamsItemsIpv6Value = "off" - ZoneSettingEditParamsItemsIpv6ValueOn ZoneSettingEditParamsItemsIpv6Value = "on" + ZoneSettingEditParamsItemsZonesIpv6ValueOff ZoneSettingEditParamsItemsZonesIpv6Value = "off" + ZoneSettingEditParamsItemsZonesIpv6ValueOn ZoneSettingEditParamsItemsZonesIpv6Value = "on" ) // Maximum size of an allowable upload. -type ZoneSettingEditParamsItemsMaxUpload struct { +type ZoneSettingEditParamsItemsZonesMaxUpload struct { // identifier of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsMaxUploadID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesMaxUploadID] `json:"id"` // Value of the zone setting. Notes: The size depends on the plan level of the // zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100) - Value param.Field[ZoneSettingEditParamsItemsMaxUploadValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesMaxUploadValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsMaxUpload) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesMaxUpload) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsMaxUpload) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesMaxUpload) implementsZoneSettingEditParamsItem() {} // identifier of the zone setting. -type ZoneSettingEditParamsItemsMaxUploadID string +type ZoneSettingEditParamsItemsZonesMaxUploadID string const ( - ZoneSettingEditParamsItemsMaxUploadIDMaxUpload ZoneSettingEditParamsItemsMaxUploadID = "max_upload" + ZoneSettingEditParamsItemsZonesMaxUploadIDMaxUpload ZoneSettingEditParamsItemsZonesMaxUploadID = "max_upload" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsMaxUploadEditable bool +type ZoneSettingEditParamsItemsZonesMaxUploadEditable bool const ( - ZoneSettingEditParamsItemsMaxUploadEditableTrue ZoneSettingEditParamsItemsMaxUploadEditable = true - ZoneSettingEditParamsItemsMaxUploadEditableFalse ZoneSettingEditParamsItemsMaxUploadEditable = false + ZoneSettingEditParamsItemsZonesMaxUploadEditableTrue ZoneSettingEditParamsItemsZonesMaxUploadEditable = true + ZoneSettingEditParamsItemsZonesMaxUploadEditableFalse ZoneSettingEditParamsItemsZonesMaxUploadEditable = false ) // Value of the zone setting. Notes: The size depends on the plan level of the // zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100) -type ZoneSettingEditParamsItemsMaxUploadValue float64 +type ZoneSettingEditParamsItemsZonesMaxUploadValue float64 const ( - ZoneSettingEditParamsItemsMaxUploadValue100 ZoneSettingEditParamsItemsMaxUploadValue = 100 - ZoneSettingEditParamsItemsMaxUploadValue200 ZoneSettingEditParamsItemsMaxUploadValue = 200 - ZoneSettingEditParamsItemsMaxUploadValue500 ZoneSettingEditParamsItemsMaxUploadValue = 500 + ZoneSettingEditParamsItemsZonesMaxUploadValue100 ZoneSettingEditParamsItemsZonesMaxUploadValue = 100 + ZoneSettingEditParamsItemsZonesMaxUploadValue200 ZoneSettingEditParamsItemsZonesMaxUploadValue = 200 + ZoneSettingEditParamsItemsZonesMaxUploadValue500 ZoneSettingEditParamsItemsZonesMaxUploadValue = 500 ) // Only accepts HTTPS requests that use at least the TLS protocol version // specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be // rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. -type ZoneSettingEditParamsItemsMinTlsVersion struct { +type ZoneSettingEditParamsItemsZonesMinTlsVersion struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsMinTlsVersionID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesMinTlsVersionID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsMinTlsVersionValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesMinTlsVersionValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsMinTlsVersion) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesMinTlsVersion) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsMinTlsVersion) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesMinTlsVersion) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsMinTlsVersionID string +type ZoneSettingEditParamsItemsZonesMinTlsVersionID string const ( - ZoneSettingEditParamsItemsMinTlsVersionIDMinTlsVersion ZoneSettingEditParamsItemsMinTlsVersionID = "min_tls_version" + ZoneSettingEditParamsItemsZonesMinTlsVersionIDMinTlsVersion ZoneSettingEditParamsItemsZonesMinTlsVersionID = "min_tls_version" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsMinTlsVersionEditable bool +type ZoneSettingEditParamsItemsZonesMinTlsVersionEditable bool const ( - ZoneSettingEditParamsItemsMinTlsVersionEditableTrue ZoneSettingEditParamsItemsMinTlsVersionEditable = true - ZoneSettingEditParamsItemsMinTlsVersionEditableFalse ZoneSettingEditParamsItemsMinTlsVersionEditable = false + ZoneSettingEditParamsItemsZonesMinTlsVersionEditableTrue ZoneSettingEditParamsItemsZonesMinTlsVersionEditable = true + ZoneSettingEditParamsItemsZonesMinTlsVersionEditableFalse ZoneSettingEditParamsItemsZonesMinTlsVersionEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsMinTlsVersionValue string +type ZoneSettingEditParamsItemsZonesMinTlsVersionValue string const ( - ZoneSettingEditParamsItemsMinTlsVersionValue1_0 ZoneSettingEditParamsItemsMinTlsVersionValue = "1.0" - ZoneSettingEditParamsItemsMinTlsVersionValue1_1 ZoneSettingEditParamsItemsMinTlsVersionValue = "1.1" - ZoneSettingEditParamsItemsMinTlsVersionValue1_2 ZoneSettingEditParamsItemsMinTlsVersionValue = "1.2" - ZoneSettingEditParamsItemsMinTlsVersionValue1_3 ZoneSettingEditParamsItemsMinTlsVersionValue = "1.3" + ZoneSettingEditParamsItemsZonesMinTlsVersionValue1_0 ZoneSettingEditParamsItemsZonesMinTlsVersionValue = "1.0" + ZoneSettingEditParamsItemsZonesMinTlsVersionValue1_1 ZoneSettingEditParamsItemsZonesMinTlsVersionValue = "1.1" + ZoneSettingEditParamsItemsZonesMinTlsVersionValue1_2 ZoneSettingEditParamsItemsZonesMinTlsVersionValue = "1.2" + ZoneSettingEditParamsItemsZonesMinTlsVersionValue1_3 ZoneSettingEditParamsItemsZonesMinTlsVersionValue = "1.3" ) // Automatically minify certain assets for your website. Refer to // [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) // for more information. -type ZoneSettingEditParamsItemsMinify struct { +type ZoneSettingEditParamsItemsZonesMinify struct { // Zone setting identifier. - ID param.Field[ZoneSettingEditParamsItemsMinifyID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesMinifyID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsMinifyValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesMinifyValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsMinify) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesMinify) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsMinify) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesMinify) implementsZoneSettingEditParamsItem() {} // Zone setting identifier. -type ZoneSettingEditParamsItemsMinifyID string +type ZoneSettingEditParamsItemsZonesMinifyID string const ( - ZoneSettingEditParamsItemsMinifyIDMinify ZoneSettingEditParamsItemsMinifyID = "minify" + ZoneSettingEditParamsItemsZonesMinifyIDMinify ZoneSettingEditParamsItemsZonesMinifyID = "minify" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsMinifyEditable bool +type ZoneSettingEditParamsItemsZonesMinifyEditable bool const ( - ZoneSettingEditParamsItemsMinifyEditableTrue ZoneSettingEditParamsItemsMinifyEditable = true - ZoneSettingEditParamsItemsMinifyEditableFalse ZoneSettingEditParamsItemsMinifyEditable = false + ZoneSettingEditParamsItemsZonesMinifyEditableTrue ZoneSettingEditParamsItemsZonesMinifyEditable = true + ZoneSettingEditParamsItemsZonesMinifyEditableFalse ZoneSettingEditParamsItemsZonesMinifyEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsMinifyValue struct { +type ZoneSettingEditParamsItemsZonesMinifyValue struct { // Automatically minify all CSS files for your website. - Css param.Field[ZoneSettingEditParamsItemsMinifyValueCss] `json:"css"` + Css param.Field[ZoneSettingEditParamsItemsZonesMinifyValueCss] `json:"css"` // Automatically minify all HTML files for your website. - HTML param.Field[ZoneSettingEditParamsItemsMinifyValueHTML] `json:"html"` + HTML param.Field[ZoneSettingEditParamsItemsZonesMinifyValueHTML] `json:"html"` // Automatically minify all JavaScript files for your website. - Js param.Field[ZoneSettingEditParamsItemsMinifyValueJs] `json:"js"` + Js param.Field[ZoneSettingEditParamsItemsZonesMinifyValueJs] `json:"js"` } -func (r ZoneSettingEditParamsItemsMinifyValue) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesMinifyValue) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Automatically minify all CSS files for your website. -type ZoneSettingEditParamsItemsMinifyValueCss string +type ZoneSettingEditParamsItemsZonesMinifyValueCss string const ( - ZoneSettingEditParamsItemsMinifyValueCssOn ZoneSettingEditParamsItemsMinifyValueCss = "on" - ZoneSettingEditParamsItemsMinifyValueCssOff ZoneSettingEditParamsItemsMinifyValueCss = "off" + ZoneSettingEditParamsItemsZonesMinifyValueCssOn ZoneSettingEditParamsItemsZonesMinifyValueCss = "on" + ZoneSettingEditParamsItemsZonesMinifyValueCssOff ZoneSettingEditParamsItemsZonesMinifyValueCss = "off" ) // Automatically minify all HTML files for your website. -type ZoneSettingEditParamsItemsMinifyValueHTML string +type ZoneSettingEditParamsItemsZonesMinifyValueHTML string const ( - ZoneSettingEditParamsItemsMinifyValueHTMLOn ZoneSettingEditParamsItemsMinifyValueHTML = "on" - ZoneSettingEditParamsItemsMinifyValueHTMLOff ZoneSettingEditParamsItemsMinifyValueHTML = "off" + ZoneSettingEditParamsItemsZonesMinifyValueHTMLOn ZoneSettingEditParamsItemsZonesMinifyValueHTML = "on" + ZoneSettingEditParamsItemsZonesMinifyValueHTMLOff ZoneSettingEditParamsItemsZonesMinifyValueHTML = "off" ) // Automatically minify all JavaScript files for your website. -type ZoneSettingEditParamsItemsMinifyValueJs string +type ZoneSettingEditParamsItemsZonesMinifyValueJs string const ( - ZoneSettingEditParamsItemsMinifyValueJsOn ZoneSettingEditParamsItemsMinifyValueJs = "on" - ZoneSettingEditParamsItemsMinifyValueJsOff ZoneSettingEditParamsItemsMinifyValueJs = "off" + ZoneSettingEditParamsItemsZonesMinifyValueJsOn ZoneSettingEditParamsItemsZonesMinifyValueJs = "on" + ZoneSettingEditParamsItemsZonesMinifyValueJsOff ZoneSettingEditParamsItemsZonesMinifyValueJs = "off" ) // Automatically optimize image loading for website visitors on mobile devices. // Refer to // [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for // more information. -type ZoneSettingEditParamsItemsMirage struct { +type ZoneSettingEditParamsItemsZonesMirage struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsMirageID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesMirageID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsMirageValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesMirageValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsMirage) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesMirage) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsMirage) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesMirage) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsMirageID string +type ZoneSettingEditParamsItemsZonesMirageID string const ( - ZoneSettingEditParamsItemsMirageIDMirage ZoneSettingEditParamsItemsMirageID = "mirage" + ZoneSettingEditParamsItemsZonesMirageIDMirage ZoneSettingEditParamsItemsZonesMirageID = "mirage" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsMirageEditable bool +type ZoneSettingEditParamsItemsZonesMirageEditable bool const ( - ZoneSettingEditParamsItemsMirageEditableTrue ZoneSettingEditParamsItemsMirageEditable = true - ZoneSettingEditParamsItemsMirageEditableFalse ZoneSettingEditParamsItemsMirageEditable = false + ZoneSettingEditParamsItemsZonesMirageEditableTrue ZoneSettingEditParamsItemsZonesMirageEditable = true + ZoneSettingEditParamsItemsZonesMirageEditableFalse ZoneSettingEditParamsItemsZonesMirageEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsMirageValue string +type ZoneSettingEditParamsItemsZonesMirageValue string const ( - ZoneSettingEditParamsItemsMirageValueOn ZoneSettingEditParamsItemsMirageValue = "on" - ZoneSettingEditParamsItemsMirageValueOff ZoneSettingEditParamsItemsMirageValue = "off" + ZoneSettingEditParamsItemsZonesMirageValueOn ZoneSettingEditParamsItemsZonesMirageValue = "on" + ZoneSettingEditParamsItemsZonesMirageValueOff ZoneSettingEditParamsItemsZonesMirageValue = "off" ) // Automatically redirect visitors on mobile devices to a mobile-optimized // subdomain. Refer to // [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) // for more information. -type ZoneSettingEditParamsItemsMobileRedirect struct { +type ZoneSettingEditParamsItemsZonesMobileRedirect struct { // Identifier of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsMobileRedirectID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesMobileRedirectID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsMobileRedirectValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesMobileRedirectValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsMobileRedirect) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesMobileRedirect) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsMobileRedirect) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesMobileRedirect) implementsZoneSettingEditParamsItem() {} // Identifier of the zone setting. -type ZoneSettingEditParamsItemsMobileRedirectID string +type ZoneSettingEditParamsItemsZonesMobileRedirectID string const ( - ZoneSettingEditParamsItemsMobileRedirectIDMobileRedirect ZoneSettingEditParamsItemsMobileRedirectID = "mobile_redirect" + ZoneSettingEditParamsItemsZonesMobileRedirectIDMobileRedirect ZoneSettingEditParamsItemsZonesMobileRedirectID = "mobile_redirect" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsMobileRedirectEditable bool +type ZoneSettingEditParamsItemsZonesMobileRedirectEditable bool const ( - ZoneSettingEditParamsItemsMobileRedirectEditableTrue ZoneSettingEditParamsItemsMobileRedirectEditable = true - ZoneSettingEditParamsItemsMobileRedirectEditableFalse ZoneSettingEditParamsItemsMobileRedirectEditable = false + ZoneSettingEditParamsItemsZonesMobileRedirectEditableTrue ZoneSettingEditParamsItemsZonesMobileRedirectEditable = true + ZoneSettingEditParamsItemsZonesMobileRedirectEditableFalse ZoneSettingEditParamsItemsZonesMobileRedirectEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsMobileRedirectValue struct { +type ZoneSettingEditParamsItemsZonesMobileRedirectValue struct { // Which subdomain prefix you wish to redirect visitors on mobile devices to // (subdomain must already exist). MobileSubdomain param.Field[string] `json:"mobile_subdomain"` // Whether or not mobile redirect is enabled. - Status param.Field[ZoneSettingEditParamsItemsMobileRedirectValueStatus] `json:"status"` + Status param.Field[ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus] `json:"status"` // Whether to drop the current page path and redirect to the mobile subdomain URL // root, or keep the path and redirect to the same page on the mobile subdomain. StripUri param.Field[bool] `json:"strip_uri"` } -func (r ZoneSettingEditParamsItemsMobileRedirectValue) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesMobileRedirectValue) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Whether or not mobile redirect is enabled. -type ZoneSettingEditParamsItemsMobileRedirectValueStatus string +type ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus string const ( - ZoneSettingEditParamsItemsMobileRedirectValueStatusOn ZoneSettingEditParamsItemsMobileRedirectValueStatus = "on" - ZoneSettingEditParamsItemsMobileRedirectValueStatusOff ZoneSettingEditParamsItemsMobileRedirectValueStatus = "off" + ZoneSettingEditParamsItemsZonesMobileRedirectValueStatusOn ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus = "on" + ZoneSettingEditParamsItemsZonesMobileRedirectValueStatusOff ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus = "off" ) // Enable Network Error Logging reporting on your zone. (Beta) -type ZoneSettingEditParamsItemsNel struct { +type ZoneSettingEditParamsItemsZonesNel struct { // Zone setting identifier. - ID param.Field[ZoneSettingEditParamsItemsNelID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesNelID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsNelValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesNelValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsNel) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesNel) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsNel) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesNel) implementsZoneSettingEditParamsItem() {} // Zone setting identifier. -type ZoneSettingEditParamsItemsNelID string +type ZoneSettingEditParamsItemsZonesNelID string const ( - ZoneSettingEditParamsItemsNelIDNel ZoneSettingEditParamsItemsNelID = "nel" + ZoneSettingEditParamsItemsZonesNelIDNel ZoneSettingEditParamsItemsZonesNelID = "nel" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsNelEditable bool +type ZoneSettingEditParamsItemsZonesNelEditable bool const ( - ZoneSettingEditParamsItemsNelEditableTrue ZoneSettingEditParamsItemsNelEditable = true - ZoneSettingEditParamsItemsNelEditableFalse ZoneSettingEditParamsItemsNelEditable = false + ZoneSettingEditParamsItemsZonesNelEditableTrue ZoneSettingEditParamsItemsZonesNelEditable = true + ZoneSettingEditParamsItemsZonesNelEditableFalse ZoneSettingEditParamsItemsZonesNelEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsNelValue struct { +type ZoneSettingEditParamsItemsZonesNelValue struct { Enabled param.Field[bool] `json:"enabled"` } -func (r ZoneSettingEditParamsItemsNelValue) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesNelValue) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Enables the Opportunistic Encryption feature for a zone. -type ZoneSettingEditParamsItemsOpportunisticEncryption struct { +type ZoneSettingEditParamsItemsZonesOpportunisticEncryption struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsOpportunisticEncryptionID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesOpportunisticEncryptionID] `json:"id"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value param.Field[ZoneSettingEditParamsItemsOpportunisticEncryptionValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsOpportunisticEncryption) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesOpportunisticEncryption) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsOpportunisticEncryption) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesOpportunisticEncryption) implementsZoneSettingEditParamsItem() { +} // ID of the zone setting. -type ZoneSettingEditParamsItemsOpportunisticEncryptionID string +type ZoneSettingEditParamsItemsZonesOpportunisticEncryptionID string const ( - ZoneSettingEditParamsItemsOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingEditParamsItemsOpportunisticEncryptionID = "opportunistic_encryption" + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingEditParamsItemsZonesOpportunisticEncryptionID = "opportunistic_encryption" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsOpportunisticEncryptionEditable bool +type ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditable bool const ( - ZoneSettingEditParamsItemsOpportunisticEncryptionEditableTrue ZoneSettingEditParamsItemsOpportunisticEncryptionEditable = true - ZoneSettingEditParamsItemsOpportunisticEncryptionEditableFalse ZoneSettingEditParamsItemsOpportunisticEncryptionEditable = false + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditableTrue ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditable = true + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditableFalse ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingEditParamsItemsOpportunisticEncryptionValue string +type ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue string const ( - ZoneSettingEditParamsItemsOpportunisticEncryptionValueOn ZoneSettingEditParamsItemsOpportunisticEncryptionValue = "on" - ZoneSettingEditParamsItemsOpportunisticEncryptionValueOff ZoneSettingEditParamsItemsOpportunisticEncryptionValue = "off" + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValueOn ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue = "on" + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValueOff ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue = "off" ) // Add an Alt-Svc header to all legitimate requests from Tor, allowing the // connection to use our onion services instead of exit nodes. -type ZoneSettingEditParamsItemsOpportunisticOnion struct { +type ZoneSettingEditParamsItemsZonesOpportunisticOnion struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsOpportunisticOnionID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesOpportunisticOnionID] `json:"id"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value param.Field[ZoneSettingEditParamsItemsOpportunisticOnionValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesOpportunisticOnionValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsOpportunisticOnion) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesOpportunisticOnion) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsOpportunisticOnion) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesOpportunisticOnion) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsOpportunisticOnionID string +type ZoneSettingEditParamsItemsZonesOpportunisticOnionID string const ( - ZoneSettingEditParamsItemsOpportunisticOnionIDOpportunisticOnion ZoneSettingEditParamsItemsOpportunisticOnionID = "opportunistic_onion" + ZoneSettingEditParamsItemsZonesOpportunisticOnionIDOpportunisticOnion ZoneSettingEditParamsItemsZonesOpportunisticOnionID = "opportunistic_onion" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsOpportunisticOnionEditable bool +type ZoneSettingEditParamsItemsZonesOpportunisticOnionEditable bool const ( - ZoneSettingEditParamsItemsOpportunisticOnionEditableTrue ZoneSettingEditParamsItemsOpportunisticOnionEditable = true - ZoneSettingEditParamsItemsOpportunisticOnionEditableFalse ZoneSettingEditParamsItemsOpportunisticOnionEditable = false + ZoneSettingEditParamsItemsZonesOpportunisticOnionEditableTrue ZoneSettingEditParamsItemsZonesOpportunisticOnionEditable = true + ZoneSettingEditParamsItemsZonesOpportunisticOnionEditableFalse ZoneSettingEditParamsItemsZonesOpportunisticOnionEditable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingEditParamsItemsOpportunisticOnionValue string +type ZoneSettingEditParamsItemsZonesOpportunisticOnionValue string const ( - ZoneSettingEditParamsItemsOpportunisticOnionValueOn ZoneSettingEditParamsItemsOpportunisticOnionValue = "on" - ZoneSettingEditParamsItemsOpportunisticOnionValueOff ZoneSettingEditParamsItemsOpportunisticOnionValue = "off" + ZoneSettingEditParamsItemsZonesOpportunisticOnionValueOn ZoneSettingEditParamsItemsZonesOpportunisticOnionValue = "on" + ZoneSettingEditParamsItemsZonesOpportunisticOnionValueOff ZoneSettingEditParamsItemsZonesOpportunisticOnionValue = "off" ) // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also // on Cloudflare. -type ZoneSettingEditParamsItemsOrangeToOrange struct { +type ZoneSettingEditParamsItemsZonesOrangeToOrange struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsOrangeToOrangeID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesOrangeToOrangeID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsOrangeToOrangeValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesOrangeToOrangeValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsOrangeToOrange) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesOrangeToOrange) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsOrangeToOrange) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesOrangeToOrange) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsOrangeToOrangeID string +type ZoneSettingEditParamsItemsZonesOrangeToOrangeID string const ( - ZoneSettingEditParamsItemsOrangeToOrangeIDOrangeToOrange ZoneSettingEditParamsItemsOrangeToOrangeID = "orange_to_orange" + ZoneSettingEditParamsItemsZonesOrangeToOrangeIDOrangeToOrange ZoneSettingEditParamsItemsZonesOrangeToOrangeID = "orange_to_orange" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsOrangeToOrangeEditable bool +type ZoneSettingEditParamsItemsZonesOrangeToOrangeEditable bool const ( - ZoneSettingEditParamsItemsOrangeToOrangeEditableTrue ZoneSettingEditParamsItemsOrangeToOrangeEditable = true - ZoneSettingEditParamsItemsOrangeToOrangeEditableFalse ZoneSettingEditParamsItemsOrangeToOrangeEditable = false + ZoneSettingEditParamsItemsZonesOrangeToOrangeEditableTrue ZoneSettingEditParamsItemsZonesOrangeToOrangeEditable = true + ZoneSettingEditParamsItemsZonesOrangeToOrangeEditableFalse ZoneSettingEditParamsItemsZonesOrangeToOrangeEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsOrangeToOrangeValue string +type ZoneSettingEditParamsItemsZonesOrangeToOrangeValue string const ( - ZoneSettingEditParamsItemsOrangeToOrangeValueOn ZoneSettingEditParamsItemsOrangeToOrangeValue = "on" - ZoneSettingEditParamsItemsOrangeToOrangeValueOff ZoneSettingEditParamsItemsOrangeToOrangeValue = "off" + ZoneSettingEditParamsItemsZonesOrangeToOrangeValueOn ZoneSettingEditParamsItemsZonesOrangeToOrangeValue = "on" + ZoneSettingEditParamsItemsZonesOrangeToOrangeValueOff ZoneSettingEditParamsItemsZonesOrangeToOrangeValue = "off" ) // Cloudflare will proxy customer error pages on any 502,504 errors on origin // server instead of showing a default Cloudflare error page. This does not apply // to 522 errors and is limited to Enterprise Zones. -type ZoneSettingEditParamsItemsOriginErrorPagePassThru struct { +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsOriginErrorPagePassThruID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsOriginErrorPagePassThruValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsOriginErrorPagePassThru) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsOriginErrorPagePassThru) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru) implementsZoneSettingEditParamsItem() { +} // ID of the zone setting. -type ZoneSettingEditParamsItemsOriginErrorPagePassThruID string +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruID string const ( - ZoneSettingEditParamsItemsOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingEditParamsItemsOriginErrorPagePassThruID = "origin_error_page_pass_thru" + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsOriginErrorPagePassThruEditable bool +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditable bool const ( - ZoneSettingEditParamsItemsOriginErrorPagePassThruEditableTrue ZoneSettingEditParamsItemsOriginErrorPagePassThruEditable = true - ZoneSettingEditParamsItemsOriginErrorPagePassThruEditableFalse ZoneSettingEditParamsItemsOriginErrorPagePassThruEditable = false + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditableTrue ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditable = true + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditableFalse ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsOriginErrorPagePassThruValue string +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue string const ( - ZoneSettingEditParamsItemsOriginErrorPagePassThruValueOn ZoneSettingEditParamsItemsOriginErrorPagePassThruValue = "on" - ZoneSettingEditParamsItemsOriginErrorPagePassThruValueOff ZoneSettingEditParamsItemsOriginErrorPagePassThruValue = "off" + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValueOn ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue = "on" + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValueOff ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue = "off" ) -type ZoneSettingEditParamsItemsOriginMaxHTTPVersion struct { +type ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersion struct { // Identifier of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsOriginMaxHTTPVersionID] `json:"id,required"` + ID param.Field[ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersionID] `json:"id,required"` } -func (r ZoneSettingEditParamsItemsOriginMaxHTTPVersion) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersion) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsOriginMaxHTTPVersion) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersion) implementsZoneSettingEditParamsItem() {} // Identifier of the zone setting. -type ZoneSettingEditParamsItemsOriginMaxHTTPVersionID string +type ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersionID string const ( - ZoneSettingEditParamsItemsOriginMaxHTTPVersionIDOriginMaxHTTPVersion ZoneSettingEditParamsItemsOriginMaxHTTPVersionID = "origin_max_http_version" + ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersionIDOriginMaxHTTPVersion ZoneSettingEditParamsItemsZonesOriginMaxHTTPVersionID = "origin_max_http_version" ) // Removes metadata and compresses your images for faster page load times. Basic @@ -5169,232 +8635,191 @@ const ( // image loading. Larger JPEGs are converted to progressive images, loading a // lower-resolution image first and ending in a higher-resolution version. Not // recommended for hi-res photography sites. -type ZoneSettingEditParamsItemsPolish struct { +type ZoneSettingEditParamsItemsZonesPolish struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsPolishID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesPolishID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsPolishValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesPolishValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsPolish) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesPolish) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsPolish) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesPolish) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsPolishID string +type ZoneSettingEditParamsItemsZonesPolishID string const ( - ZoneSettingEditParamsItemsPolishIDPolish ZoneSettingEditParamsItemsPolishID = "polish" + ZoneSettingEditParamsItemsZonesPolishIDPolish ZoneSettingEditParamsItemsZonesPolishID = "polish" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsPolishEditable bool +type ZoneSettingEditParamsItemsZonesPolishEditable bool const ( - ZoneSettingEditParamsItemsPolishEditableTrue ZoneSettingEditParamsItemsPolishEditable = true - ZoneSettingEditParamsItemsPolishEditableFalse ZoneSettingEditParamsItemsPolishEditable = false + ZoneSettingEditParamsItemsZonesPolishEditableTrue ZoneSettingEditParamsItemsZonesPolishEditable = true + ZoneSettingEditParamsItemsZonesPolishEditableFalse ZoneSettingEditParamsItemsZonesPolishEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsPolishValue string +type ZoneSettingEditParamsItemsZonesPolishValue string const ( - ZoneSettingEditParamsItemsPolishValueOff ZoneSettingEditParamsItemsPolishValue = "off" - ZoneSettingEditParamsItemsPolishValueLossless ZoneSettingEditParamsItemsPolishValue = "lossless" - ZoneSettingEditParamsItemsPolishValueLossy ZoneSettingEditParamsItemsPolishValue = "lossy" + ZoneSettingEditParamsItemsZonesPolishValueOff ZoneSettingEditParamsItemsZonesPolishValue = "off" + ZoneSettingEditParamsItemsZonesPolishValueLossless ZoneSettingEditParamsItemsZonesPolishValue = "lossless" + ZoneSettingEditParamsItemsZonesPolishValueLossy ZoneSettingEditParamsItemsZonesPolishValue = "lossy" ) // Cloudflare will prefetch any URLs that are included in the response headers. // This is limited to Enterprise Zones. -type ZoneSettingEditParamsItemsPrefetchPreload struct { - // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsPrefetchPreloadID] `json:"id"` - // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsPrefetchPreloadValue] `json:"value"` -} - -func (r ZoneSettingEditParamsItemsPrefetchPreload) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ZoneSettingEditParamsItemsPrefetchPreload) implementsZoneSettingEditParamsItem() {} - -// ID of the zone setting. -type ZoneSettingEditParamsItemsPrefetchPreloadID string - -const ( - ZoneSettingEditParamsItemsPrefetchPreloadIDPrefetchPreload ZoneSettingEditParamsItemsPrefetchPreloadID = "prefetch_preload" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingEditParamsItemsPrefetchPreloadEditable bool - -const ( - ZoneSettingEditParamsItemsPrefetchPreloadEditableTrue ZoneSettingEditParamsItemsPrefetchPreloadEditable = true - ZoneSettingEditParamsItemsPrefetchPreloadEditableFalse ZoneSettingEditParamsItemsPrefetchPreloadEditable = false -) - -// Value of the zone setting. -type ZoneSettingEditParamsItemsPrefetchPreloadValue string - -const ( - ZoneSettingEditParamsItemsPrefetchPreloadValueOn ZoneSettingEditParamsItemsPrefetchPreloadValue = "on" - ZoneSettingEditParamsItemsPrefetchPreloadValueOff ZoneSettingEditParamsItemsPrefetchPreloadValue = "off" -) - -// Privacy Pass is a browser extension developed by the Privacy Pass Team to -// improve the browsing experience for your visitors. Enabling Privacy Pass will -// reduce the number of CAPTCHAs shown to your visitors. -// (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). -type ZoneSettingEditParamsItemsPrivacyPass struct { +type ZoneSettingEditParamsItemsZonesPrefetchPreload struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsPrivacyPassID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesPrefetchPreloadID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsPrivacyPassValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesPrefetchPreloadValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsPrivacyPass) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesPrefetchPreload) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsPrivacyPass) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesPrefetchPreload) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsPrivacyPassID string +type ZoneSettingEditParamsItemsZonesPrefetchPreloadID string const ( - ZoneSettingEditParamsItemsPrivacyPassIDPrivacyPass ZoneSettingEditParamsItemsPrivacyPassID = "privacy_pass" + ZoneSettingEditParamsItemsZonesPrefetchPreloadIDPrefetchPreload ZoneSettingEditParamsItemsZonesPrefetchPreloadID = "prefetch_preload" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsPrivacyPassEditable bool +type ZoneSettingEditParamsItemsZonesPrefetchPreloadEditable bool const ( - ZoneSettingEditParamsItemsPrivacyPassEditableTrue ZoneSettingEditParamsItemsPrivacyPassEditable = true - ZoneSettingEditParamsItemsPrivacyPassEditableFalse ZoneSettingEditParamsItemsPrivacyPassEditable = false + ZoneSettingEditParamsItemsZonesPrefetchPreloadEditableTrue ZoneSettingEditParamsItemsZonesPrefetchPreloadEditable = true + ZoneSettingEditParamsItemsZonesPrefetchPreloadEditableFalse ZoneSettingEditParamsItemsZonesPrefetchPreloadEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsPrivacyPassValue string +type ZoneSettingEditParamsItemsZonesPrefetchPreloadValue string const ( - ZoneSettingEditParamsItemsPrivacyPassValueOn ZoneSettingEditParamsItemsPrivacyPassValue = "on" - ZoneSettingEditParamsItemsPrivacyPassValueOff ZoneSettingEditParamsItemsPrivacyPassValue = "off" + ZoneSettingEditParamsItemsZonesPrefetchPreloadValueOn ZoneSettingEditParamsItemsZonesPrefetchPreloadValue = "on" + ZoneSettingEditParamsItemsZonesPrefetchPreloadValueOff ZoneSettingEditParamsItemsZonesPrefetchPreloadValue = "off" ) // Maximum time between two read operations from origin. -type ZoneSettingEditParamsItemsProxyReadTimeout struct { +type ZoneSettingEditParamsItemsZonesProxyReadTimeout struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsProxyReadTimeoutID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesProxyReadTimeoutID] `json:"id"` // Value of the zone setting. Notes: Value must be between 1 and 6000 Value param.Field[float64] `json:"value"` } -func (r ZoneSettingEditParamsItemsProxyReadTimeout) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesProxyReadTimeout) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsProxyReadTimeout) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesProxyReadTimeout) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsProxyReadTimeoutID string +type ZoneSettingEditParamsItemsZonesProxyReadTimeoutID string const ( - ZoneSettingEditParamsItemsProxyReadTimeoutIDProxyReadTimeout ZoneSettingEditParamsItemsProxyReadTimeoutID = "proxy_read_timeout" + ZoneSettingEditParamsItemsZonesProxyReadTimeoutIDProxyReadTimeout ZoneSettingEditParamsItemsZonesProxyReadTimeoutID = "proxy_read_timeout" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsProxyReadTimeoutEditable bool +type ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditable bool const ( - ZoneSettingEditParamsItemsProxyReadTimeoutEditableTrue ZoneSettingEditParamsItemsProxyReadTimeoutEditable = true - ZoneSettingEditParamsItemsProxyReadTimeoutEditableFalse ZoneSettingEditParamsItemsProxyReadTimeoutEditable = false + ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditableTrue ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditable = true + ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditableFalse ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditable = false ) // The value set for the Pseudo IPv4 setting. -type ZoneSettingEditParamsItemsPseudoIpv4 struct { +type ZoneSettingEditParamsItemsZonesPseudoIpv4 struct { // Value of the Pseudo IPv4 setting. - ID param.Field[ZoneSettingEditParamsItemsPseudoIpv4ID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesPseudoIpv4ID] `json:"id"` // Value of the Pseudo IPv4 setting. - Value param.Field[ZoneSettingEditParamsItemsPseudoIpv4Value] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesPseudoIpv4Value] `json:"value"` } -func (r ZoneSettingEditParamsItemsPseudoIpv4) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesPseudoIpv4) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsPseudoIpv4) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesPseudoIpv4) implementsZoneSettingEditParamsItem() {} // Value of the Pseudo IPv4 setting. -type ZoneSettingEditParamsItemsPseudoIpv4ID string +type ZoneSettingEditParamsItemsZonesPseudoIpv4ID string const ( - ZoneSettingEditParamsItemsPseudoIpv4IDPseudoIpv4 ZoneSettingEditParamsItemsPseudoIpv4ID = "pseudo_ipv4" + ZoneSettingEditParamsItemsZonesPseudoIpv4IDPseudoIpv4 ZoneSettingEditParamsItemsZonesPseudoIpv4ID = "pseudo_ipv4" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsPseudoIpv4Editable bool +type ZoneSettingEditParamsItemsZonesPseudoIpv4Editable bool const ( - ZoneSettingEditParamsItemsPseudoIpv4EditableTrue ZoneSettingEditParamsItemsPseudoIpv4Editable = true - ZoneSettingEditParamsItemsPseudoIpv4EditableFalse ZoneSettingEditParamsItemsPseudoIpv4Editable = false + ZoneSettingEditParamsItemsZonesPseudoIpv4EditableTrue ZoneSettingEditParamsItemsZonesPseudoIpv4Editable = true + ZoneSettingEditParamsItemsZonesPseudoIpv4EditableFalse ZoneSettingEditParamsItemsZonesPseudoIpv4Editable = false ) // Value of the Pseudo IPv4 setting. -type ZoneSettingEditParamsItemsPseudoIpv4Value string +type ZoneSettingEditParamsItemsZonesPseudoIpv4Value string const ( - ZoneSettingEditParamsItemsPseudoIpv4ValueOff ZoneSettingEditParamsItemsPseudoIpv4Value = "off" - ZoneSettingEditParamsItemsPseudoIpv4ValueAddHeader ZoneSettingEditParamsItemsPseudoIpv4Value = "add_header" - ZoneSettingEditParamsItemsPseudoIpv4ValueOverwriteHeader ZoneSettingEditParamsItemsPseudoIpv4Value = "overwrite_header" + ZoneSettingEditParamsItemsZonesPseudoIpv4ValueOff ZoneSettingEditParamsItemsZonesPseudoIpv4Value = "off" + ZoneSettingEditParamsItemsZonesPseudoIpv4ValueAddHeader ZoneSettingEditParamsItemsZonesPseudoIpv4Value = "add_header" + ZoneSettingEditParamsItemsZonesPseudoIpv4ValueOverwriteHeader ZoneSettingEditParamsItemsZonesPseudoIpv4Value = "overwrite_header" ) // Enables or disables buffering of responses from the proxied server. Cloudflare // may buffer the whole payload to deliver it at once to the client versus allowing // it to be delivered in chunks. By default, the proxied server streams directly // and is not buffered by Cloudflare. This is limited to Enterprise Zones. -type ZoneSettingEditParamsItemsResponseBuffering struct { +type ZoneSettingEditParamsItemsZonesResponseBuffering struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsResponseBufferingID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesResponseBufferingID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsResponseBufferingValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesResponseBufferingValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsResponseBuffering) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesResponseBuffering) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsResponseBuffering) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesResponseBuffering) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsResponseBufferingID string +type ZoneSettingEditParamsItemsZonesResponseBufferingID string const ( - ZoneSettingEditParamsItemsResponseBufferingIDResponseBuffering ZoneSettingEditParamsItemsResponseBufferingID = "response_buffering" + ZoneSettingEditParamsItemsZonesResponseBufferingIDResponseBuffering ZoneSettingEditParamsItemsZonesResponseBufferingID = "response_buffering" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsResponseBufferingEditable bool +type ZoneSettingEditParamsItemsZonesResponseBufferingEditable bool const ( - ZoneSettingEditParamsItemsResponseBufferingEditableTrue ZoneSettingEditParamsItemsResponseBufferingEditable = true - ZoneSettingEditParamsItemsResponseBufferingEditableFalse ZoneSettingEditParamsItemsResponseBufferingEditable = false + ZoneSettingEditParamsItemsZonesResponseBufferingEditableTrue ZoneSettingEditParamsItemsZonesResponseBufferingEditable = true + ZoneSettingEditParamsItemsZonesResponseBufferingEditableFalse ZoneSettingEditParamsItemsZonesResponseBufferingEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsResponseBufferingValue string +type ZoneSettingEditParamsItemsZonesResponseBufferingValue string const ( - ZoneSettingEditParamsItemsResponseBufferingValueOn ZoneSettingEditParamsItemsResponseBufferingValue = "on" - ZoneSettingEditParamsItemsResponseBufferingValueOff ZoneSettingEditParamsItemsResponseBufferingValue = "off" + ZoneSettingEditParamsItemsZonesResponseBufferingValueOn ZoneSettingEditParamsItemsZonesResponseBufferingValue = "on" + ZoneSettingEditParamsItemsZonesResponseBufferingValueOff ZoneSettingEditParamsItemsZonesResponseBufferingValue = "off" ) // Rocket Loader is a general-purpose asynchronous JavaScript optimisation that @@ -5407,76 +8832,76 @@ const ( // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. -type ZoneSettingEditParamsItemsRocketLoader struct { +type ZoneSettingEditParamsItemsZonesRocketLoader struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsRocketLoaderID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesRocketLoaderID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsRocketLoaderValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesRocketLoaderValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsRocketLoader) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesRocketLoader) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsRocketLoader) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesRocketLoader) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsRocketLoaderID string +type ZoneSettingEditParamsItemsZonesRocketLoaderID string const ( - ZoneSettingEditParamsItemsRocketLoaderIDRocketLoader ZoneSettingEditParamsItemsRocketLoaderID = "rocket_loader" + ZoneSettingEditParamsItemsZonesRocketLoaderIDRocketLoader ZoneSettingEditParamsItemsZonesRocketLoaderID = "rocket_loader" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsRocketLoaderEditable bool +type ZoneSettingEditParamsItemsZonesRocketLoaderEditable bool const ( - ZoneSettingEditParamsItemsRocketLoaderEditableTrue ZoneSettingEditParamsItemsRocketLoaderEditable = true - ZoneSettingEditParamsItemsRocketLoaderEditableFalse ZoneSettingEditParamsItemsRocketLoaderEditable = false + ZoneSettingEditParamsItemsZonesRocketLoaderEditableTrue ZoneSettingEditParamsItemsZonesRocketLoaderEditable = true + ZoneSettingEditParamsItemsZonesRocketLoaderEditableFalse ZoneSettingEditParamsItemsZonesRocketLoaderEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsRocketLoaderValue string +type ZoneSettingEditParamsItemsZonesRocketLoaderValue string const ( - ZoneSettingEditParamsItemsRocketLoaderValueOn ZoneSettingEditParamsItemsRocketLoaderValue = "on" - ZoneSettingEditParamsItemsRocketLoaderValueOff ZoneSettingEditParamsItemsRocketLoaderValue = "off" + ZoneSettingEditParamsItemsZonesRocketLoaderValueOn ZoneSettingEditParamsItemsZonesRocketLoaderValue = "on" + ZoneSettingEditParamsItemsZonesRocketLoaderValueOff ZoneSettingEditParamsItemsZonesRocketLoaderValue = "off" ) // [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) // serves your WordPress site from Cloudflare's edge network and caches third-party // fonts. -type ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimization struct { +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationID] `json:"id"` - Value param.Field[ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationValue] `json:"value"` + ID param.Field[ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID] `json:"id"` + Value param.Field[ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimization) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimization) implementsZoneSettingEditParamsItem() { +func (r ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization) implementsZoneSettingEditParamsItem() { } // ID of the zone setting. -type ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationID string +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID string const ( - ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" + ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationEditable bool +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable bool const ( - ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationEditable = true - ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationEditable = false + ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable = true + ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable = false ) -type ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationValue struct { +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue struct { // Indicates whether or not // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) // is enabled. @@ -5496,50 +8921,50 @@ type ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationValue struct WpPlugin param.Field[bool] `json:"wp_plugin,required"` } -func (r ZoneSettingEditParamsItemsSchemasAutomaticPlatformOptimizationValue) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Cloudflare security header for a zone. -type ZoneSettingEditParamsItemsSecurityHeader struct { +type ZoneSettingEditParamsItemsZonesSecurityHeader struct { // ID of the zone's security header. - ID param.Field[ZoneSettingEditParamsItemsSecurityHeaderID] `json:"id"` - Value param.Field[ZoneSettingEditParamsItemsSecurityHeaderValue] `json:"value"` + ID param.Field[ZoneSettingEditParamsItemsZonesSecurityHeaderID] `json:"id"` + Value param.Field[ZoneSettingEditParamsItemsZonesSecurityHeaderValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsSecurityHeader) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSecurityHeader) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsSecurityHeader) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesSecurityHeader) implementsZoneSettingEditParamsItem() {} // ID of the zone's security header. -type ZoneSettingEditParamsItemsSecurityHeaderID string +type ZoneSettingEditParamsItemsZonesSecurityHeaderID string const ( - ZoneSettingEditParamsItemsSecurityHeaderIDSecurityHeader ZoneSettingEditParamsItemsSecurityHeaderID = "security_header" + ZoneSettingEditParamsItemsZonesSecurityHeaderIDSecurityHeader ZoneSettingEditParamsItemsZonesSecurityHeaderID = "security_header" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsSecurityHeaderEditable bool +type ZoneSettingEditParamsItemsZonesSecurityHeaderEditable bool const ( - ZoneSettingEditParamsItemsSecurityHeaderEditableTrue ZoneSettingEditParamsItemsSecurityHeaderEditable = true - ZoneSettingEditParamsItemsSecurityHeaderEditableFalse ZoneSettingEditParamsItemsSecurityHeaderEditable = false + ZoneSettingEditParamsItemsZonesSecurityHeaderEditableTrue ZoneSettingEditParamsItemsZonesSecurityHeaderEditable = true + ZoneSettingEditParamsItemsZonesSecurityHeaderEditableFalse ZoneSettingEditParamsItemsZonesSecurityHeaderEditable = false ) -type ZoneSettingEditParamsItemsSecurityHeaderValue struct { +type ZoneSettingEditParamsItemsZonesSecurityHeaderValue struct { // Strict Transport Security. - StrictTransportSecurity param.Field[ZoneSettingEditParamsItemsSecurityHeaderValueStrictTransportSecurity] `json:"strict_transport_security"` + StrictTransportSecurity param.Field[ZoneSettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity] `json:"strict_transport_security"` } -func (r ZoneSettingEditParamsItemsSecurityHeaderValue) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSecurityHeaderValue) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Strict Transport Security. -type ZoneSettingEditParamsItemsSecurityHeaderValueStrictTransportSecurity struct { +type ZoneSettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity struct { // Whether or not strict transport security is enabled. Enabled param.Field[bool] `json:"enabled"` // Include all subdomains for strict transport security. @@ -5550,7 +8975,7 @@ type ZoneSettingEditParamsItemsSecurityHeaderValueStrictTransportSecurity struct Nosniff param.Field[bool] `json:"nosniff"` } -func (r ZoneSettingEditParamsItemsSecurityHeaderValueStrictTransportSecurity) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -5558,45 +8983,45 @@ func (r ZoneSettingEditParamsItemsSecurityHeaderValueStrictTransportSecurity) Ma // automatically adjust each of the security settings. If you choose to customize // an individual security setting, the profile will become Custom. // (https://support.cloudflare.com/hc/en-us/articles/200170056). -type ZoneSettingEditParamsItemsSecurityLevel struct { +type ZoneSettingEditParamsItemsZonesSecurityLevel struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsSecurityLevelID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesSecurityLevelID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsSecurityLevelValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesSecurityLevelValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsSecurityLevel) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSecurityLevel) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsSecurityLevel) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesSecurityLevel) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsSecurityLevelID string +type ZoneSettingEditParamsItemsZonesSecurityLevelID string const ( - ZoneSettingEditParamsItemsSecurityLevelIDSecurityLevel ZoneSettingEditParamsItemsSecurityLevelID = "security_level" + ZoneSettingEditParamsItemsZonesSecurityLevelIDSecurityLevel ZoneSettingEditParamsItemsZonesSecurityLevelID = "security_level" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsSecurityLevelEditable bool +type ZoneSettingEditParamsItemsZonesSecurityLevelEditable bool const ( - ZoneSettingEditParamsItemsSecurityLevelEditableTrue ZoneSettingEditParamsItemsSecurityLevelEditable = true - ZoneSettingEditParamsItemsSecurityLevelEditableFalse ZoneSettingEditParamsItemsSecurityLevelEditable = false + ZoneSettingEditParamsItemsZonesSecurityLevelEditableTrue ZoneSettingEditParamsItemsZonesSecurityLevelEditable = true + ZoneSettingEditParamsItemsZonesSecurityLevelEditableFalse ZoneSettingEditParamsItemsZonesSecurityLevelEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsSecurityLevelValue string +type ZoneSettingEditParamsItemsZonesSecurityLevelValue string const ( - ZoneSettingEditParamsItemsSecurityLevelValueOff ZoneSettingEditParamsItemsSecurityLevelValue = "off" - ZoneSettingEditParamsItemsSecurityLevelValueEssentiallyOff ZoneSettingEditParamsItemsSecurityLevelValue = "essentially_off" - ZoneSettingEditParamsItemsSecurityLevelValueLow ZoneSettingEditParamsItemsSecurityLevelValue = "low" - ZoneSettingEditParamsItemsSecurityLevelValueMedium ZoneSettingEditParamsItemsSecurityLevelValue = "medium" - ZoneSettingEditParamsItemsSecurityLevelValueHigh ZoneSettingEditParamsItemsSecurityLevelValue = "high" - ZoneSettingEditParamsItemsSecurityLevelValueUnderAttack ZoneSettingEditParamsItemsSecurityLevelValue = "under_attack" + ZoneSettingEditParamsItemsZonesSecurityLevelValueOff ZoneSettingEditParamsItemsZonesSecurityLevelValue = "off" + ZoneSettingEditParamsItemsZonesSecurityLevelValueEssentiallyOff ZoneSettingEditParamsItemsZonesSecurityLevelValue = "essentially_off" + ZoneSettingEditParamsItemsZonesSecurityLevelValueLow ZoneSettingEditParamsItemsZonesSecurityLevelValue = "low" + ZoneSettingEditParamsItemsZonesSecurityLevelValueMedium ZoneSettingEditParamsItemsZonesSecurityLevelValue = "medium" + ZoneSettingEditParamsItemsZonesSecurityLevelValueHigh ZoneSettingEditParamsItemsZonesSecurityLevelValue = "high" + ZoneSettingEditParamsItemsZonesSecurityLevelValueUnderAttack ZoneSettingEditParamsItemsZonesSecurityLevelValue = "under_attack" ) // If there is sensitive content on your website that you want visible to real @@ -5610,119 +9035,120 @@ const ( // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). -type ZoneSettingEditParamsItemsServerSideExclude struct { +type ZoneSettingEditParamsItemsZonesServerSideExclude struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsServerSideExcludeID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesServerSideExcludeID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsServerSideExcludeValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesServerSideExcludeValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsServerSideExclude) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesServerSideExclude) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsServerSideExclude) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesServerSideExclude) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsServerSideExcludeID string +type ZoneSettingEditParamsItemsZonesServerSideExcludeID string const ( - ZoneSettingEditParamsItemsServerSideExcludeIDServerSideExclude ZoneSettingEditParamsItemsServerSideExcludeID = "server_side_exclude" + ZoneSettingEditParamsItemsZonesServerSideExcludeIDServerSideExclude ZoneSettingEditParamsItemsZonesServerSideExcludeID = "server_side_exclude" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsServerSideExcludeEditable bool +type ZoneSettingEditParamsItemsZonesServerSideExcludeEditable bool const ( - ZoneSettingEditParamsItemsServerSideExcludeEditableTrue ZoneSettingEditParamsItemsServerSideExcludeEditable = true - ZoneSettingEditParamsItemsServerSideExcludeEditableFalse ZoneSettingEditParamsItemsServerSideExcludeEditable = false + ZoneSettingEditParamsItemsZonesServerSideExcludeEditableTrue ZoneSettingEditParamsItemsZonesServerSideExcludeEditable = true + ZoneSettingEditParamsItemsZonesServerSideExcludeEditableFalse ZoneSettingEditParamsItemsZonesServerSideExcludeEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsServerSideExcludeValue string +type ZoneSettingEditParamsItemsZonesServerSideExcludeValue string const ( - ZoneSettingEditParamsItemsServerSideExcludeValueOn ZoneSettingEditParamsItemsServerSideExcludeValue = "on" - ZoneSettingEditParamsItemsServerSideExcludeValueOff ZoneSettingEditParamsItemsServerSideExcludeValue = "off" + ZoneSettingEditParamsItemsZonesServerSideExcludeValueOn ZoneSettingEditParamsItemsZonesServerSideExcludeValue = "on" + ZoneSettingEditParamsItemsZonesServerSideExcludeValueOff ZoneSettingEditParamsItemsZonesServerSideExcludeValue = "off" ) // Allow SHA1 support. -type ZoneSettingEditParamsItemsSha1Support struct { +type ZoneSettingEditParamsItemsZonesSha1Support struct { // Zone setting identifier. - ID param.Field[ZoneSettingEditParamsItemsSha1SupportID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesSha1SupportID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsSha1SupportValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesSha1SupportValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsSha1Support) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSha1Support) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsSha1Support) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesSha1Support) implementsZoneSettingEditParamsItem() {} // Zone setting identifier. -type ZoneSettingEditParamsItemsSha1SupportID string +type ZoneSettingEditParamsItemsZonesSha1SupportID string const ( - ZoneSettingEditParamsItemsSha1SupportIDSha1Support ZoneSettingEditParamsItemsSha1SupportID = "sha1_support" + ZoneSettingEditParamsItemsZonesSha1SupportIDSha1Support ZoneSettingEditParamsItemsZonesSha1SupportID = "sha1_support" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsSha1SupportEditable bool +type ZoneSettingEditParamsItemsZonesSha1SupportEditable bool const ( - ZoneSettingEditParamsItemsSha1SupportEditableTrue ZoneSettingEditParamsItemsSha1SupportEditable = true - ZoneSettingEditParamsItemsSha1SupportEditableFalse ZoneSettingEditParamsItemsSha1SupportEditable = false + ZoneSettingEditParamsItemsZonesSha1SupportEditableTrue ZoneSettingEditParamsItemsZonesSha1SupportEditable = true + ZoneSettingEditParamsItemsZonesSha1SupportEditableFalse ZoneSettingEditParamsItemsZonesSha1SupportEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsSha1SupportValue string +type ZoneSettingEditParamsItemsZonesSha1SupportValue string const ( - ZoneSettingEditParamsItemsSha1SupportValueOff ZoneSettingEditParamsItemsSha1SupportValue = "off" - ZoneSettingEditParamsItemsSha1SupportValueOn ZoneSettingEditParamsItemsSha1SupportValue = "on" + ZoneSettingEditParamsItemsZonesSha1SupportValueOff ZoneSettingEditParamsItemsZonesSha1SupportValue = "off" + ZoneSettingEditParamsItemsZonesSha1SupportValueOn ZoneSettingEditParamsItemsZonesSha1SupportValue = "on" ) // Cloudflare will treat files with the same query strings as the same file in // cache, regardless of the order of the query strings. This is limited to // Enterprise Zones. -type ZoneSettingEditParamsItemsSortQueryStringForCache struct { +type ZoneSettingEditParamsItemsZonesSortQueryStringForCache struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsSortQueryStringForCacheID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesSortQueryStringForCacheID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsSortQueryStringForCacheValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsSortQueryStringForCache) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSortQueryStringForCache) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsSortQueryStringForCache) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesSortQueryStringForCache) implementsZoneSettingEditParamsItem() { +} // ID of the zone setting. -type ZoneSettingEditParamsItemsSortQueryStringForCacheID string +type ZoneSettingEditParamsItemsZonesSortQueryStringForCacheID string const ( - ZoneSettingEditParamsItemsSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingEditParamsItemsSortQueryStringForCacheID = "sort_query_string_for_cache" + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingEditParamsItemsZonesSortQueryStringForCacheID = "sort_query_string_for_cache" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsSortQueryStringForCacheEditable bool +type ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditable bool const ( - ZoneSettingEditParamsItemsSortQueryStringForCacheEditableTrue ZoneSettingEditParamsItemsSortQueryStringForCacheEditable = true - ZoneSettingEditParamsItemsSortQueryStringForCacheEditableFalse ZoneSettingEditParamsItemsSortQueryStringForCacheEditable = false + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditableTrue ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditable = true + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditableFalse ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsSortQueryStringForCacheValue string +type ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue string const ( - ZoneSettingEditParamsItemsSortQueryStringForCacheValueOn ZoneSettingEditParamsItemsSortQueryStringForCacheValue = "on" - ZoneSettingEditParamsItemsSortQueryStringForCacheValueOff ZoneSettingEditParamsItemsSortQueryStringForCacheValue = "off" + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValueOn ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue = "on" + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValueOff ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue = "off" ) // SSL encrypts your visitor's connection and safeguards credit card numbers and @@ -5741,232 +9167,220 @@ const ( // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -type ZoneSettingEditParamsItemsSsl struct { +type ZoneSettingEditParamsItemsZonesSsl struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsSslID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesSslID] `json:"id"` // Value of the zone setting. Notes: Depends on the zone's plan level - Value param.Field[ZoneSettingEditParamsItemsSslValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesSslValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsSsl) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSsl) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsSsl) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesSsl) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsSslID string +type ZoneSettingEditParamsItemsZonesSslID string const ( - ZoneSettingEditParamsItemsSslIDSsl ZoneSettingEditParamsItemsSslID = "ssl" + ZoneSettingEditParamsItemsZonesSslIDSsl ZoneSettingEditParamsItemsZonesSslID = "ssl" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsSslEditable bool +type ZoneSettingEditParamsItemsZonesSslEditable bool const ( - ZoneSettingEditParamsItemsSslEditableTrue ZoneSettingEditParamsItemsSslEditable = true - ZoneSettingEditParamsItemsSslEditableFalse ZoneSettingEditParamsItemsSslEditable = false + ZoneSettingEditParamsItemsZonesSslEditableTrue ZoneSettingEditParamsItemsZonesSslEditable = true + ZoneSettingEditParamsItemsZonesSslEditableFalse ZoneSettingEditParamsItemsZonesSslEditable = false ) // Value of the zone setting. Notes: Depends on the zone's plan level -type ZoneSettingEditParamsItemsSslValue string +type ZoneSettingEditParamsItemsZonesSslValue string const ( - ZoneSettingEditParamsItemsSslValueOff ZoneSettingEditParamsItemsSslValue = "off" - ZoneSettingEditParamsItemsSslValueFlexible ZoneSettingEditParamsItemsSslValue = "flexible" - ZoneSettingEditParamsItemsSslValueFull ZoneSettingEditParamsItemsSslValue = "full" - ZoneSettingEditParamsItemsSslValueStrict ZoneSettingEditParamsItemsSslValue = "strict" + ZoneSettingEditParamsItemsZonesSslValueOff ZoneSettingEditParamsItemsZonesSslValue = "off" + ZoneSettingEditParamsItemsZonesSslValueFlexible ZoneSettingEditParamsItemsZonesSslValue = "flexible" + ZoneSettingEditParamsItemsZonesSslValueFull ZoneSettingEditParamsItemsZonesSslValue = "full" + ZoneSettingEditParamsItemsZonesSslValueStrict ZoneSettingEditParamsItemsZonesSslValue = "strict" ) -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type ZoneSettingEditParamsItemsSslRecommender struct { +type ZoneSettingEditParamsItemsZonesSslRecommender struct { // Enrollment value for SSL/TLS Recommender. - ID param.Field[ZoneSettingEditParamsItemsSslRecommenderID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesSslRecommenderID] `json:"id"` // ssl-recommender enrollment setting. Enabled param.Field[bool] `json:"enabled"` } -func (r ZoneSettingEditParamsItemsSslRecommender) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesSslRecommender) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsSslRecommender) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesSslRecommender) implementsZoneSettingEditParamsItem() {} // Enrollment value for SSL/TLS Recommender. -type ZoneSettingEditParamsItemsSslRecommenderID string - -const ( - ZoneSettingEditParamsItemsSslRecommenderIDSslRecommender ZoneSettingEditParamsItemsSslRecommenderID = "ssl_recommender" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingEditParamsItemsSslRecommenderEditable bool +type ZoneSettingEditParamsItemsZonesSslRecommenderID string const ( - ZoneSettingEditParamsItemsSslRecommenderEditableTrue ZoneSettingEditParamsItemsSslRecommenderEditable = true - ZoneSettingEditParamsItemsSslRecommenderEditableFalse ZoneSettingEditParamsItemsSslRecommenderEditable = false + ZoneSettingEditParamsItemsZonesSslRecommenderIDSslRecommender ZoneSettingEditParamsItemsZonesSslRecommenderID = "ssl_recommender" ) // Only allows TLS1.2. -type ZoneSettingEditParamsItemsTls1_2Only struct { +type ZoneSettingEditParamsItemsZonesTls1_2Only struct { // Zone setting identifier. - ID param.Field[ZoneSettingEditParamsItemsTls1_2OnlyID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesTls1_2OnlyID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsTls1_2OnlyValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesTls1_2OnlyValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsTls1_2Only) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesTls1_2Only) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsTls1_2Only) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesTls1_2Only) implementsZoneSettingEditParamsItem() {} // Zone setting identifier. -type ZoneSettingEditParamsItemsTls1_2OnlyID string +type ZoneSettingEditParamsItemsZonesTls1_2OnlyID string const ( - ZoneSettingEditParamsItemsTls1_2OnlyIDTls1_2Only ZoneSettingEditParamsItemsTls1_2OnlyID = "tls_1_2_only" + ZoneSettingEditParamsItemsZonesTls1_2OnlyIDTls1_2Only ZoneSettingEditParamsItemsZonesTls1_2OnlyID = "tls_1_2_only" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsTls1_2OnlyEditable bool +type ZoneSettingEditParamsItemsZonesTls1_2OnlyEditable bool const ( - ZoneSettingEditParamsItemsTls1_2OnlyEditableTrue ZoneSettingEditParamsItemsTls1_2OnlyEditable = true - ZoneSettingEditParamsItemsTls1_2OnlyEditableFalse ZoneSettingEditParamsItemsTls1_2OnlyEditable = false + ZoneSettingEditParamsItemsZonesTls1_2OnlyEditableTrue ZoneSettingEditParamsItemsZonesTls1_2OnlyEditable = true + ZoneSettingEditParamsItemsZonesTls1_2OnlyEditableFalse ZoneSettingEditParamsItemsZonesTls1_2OnlyEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsTls1_2OnlyValue string +type ZoneSettingEditParamsItemsZonesTls1_2OnlyValue string const ( - ZoneSettingEditParamsItemsTls1_2OnlyValueOff ZoneSettingEditParamsItemsTls1_2OnlyValue = "off" - ZoneSettingEditParamsItemsTls1_2OnlyValueOn ZoneSettingEditParamsItemsTls1_2OnlyValue = "on" + ZoneSettingEditParamsItemsZonesTls1_2OnlyValueOff ZoneSettingEditParamsItemsZonesTls1_2OnlyValue = "off" + ZoneSettingEditParamsItemsZonesTls1_2OnlyValueOn ZoneSettingEditParamsItemsZonesTls1_2OnlyValue = "on" ) // Enables Crypto TLS 1.3 feature for a zone. -type ZoneSettingEditParamsItemsTls1_3 struct { +type ZoneSettingEditParamsItemsZonesTls1_3 struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsTls1_3ID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesTls1_3ID] `json:"id"` // Value of the zone setting. Notes: Default value depends on the zone's plan // level. - Value param.Field[ZoneSettingEditParamsItemsTls1_3Value] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesTls1_3Value] `json:"value"` } -func (r ZoneSettingEditParamsItemsTls1_3) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesTls1_3) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsTls1_3) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesTls1_3) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsTls1_3ID string +type ZoneSettingEditParamsItemsZonesTls1_3ID string const ( - ZoneSettingEditParamsItemsTls1_3IDTls1_3 ZoneSettingEditParamsItemsTls1_3ID = "tls_1_3" + ZoneSettingEditParamsItemsZonesTls1_3IDTls1_3 ZoneSettingEditParamsItemsZonesTls1_3ID = "tls_1_3" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsTls1_3Editable bool +type ZoneSettingEditParamsItemsZonesTls1_3Editable bool const ( - ZoneSettingEditParamsItemsTls1_3EditableTrue ZoneSettingEditParamsItemsTls1_3Editable = true - ZoneSettingEditParamsItemsTls1_3EditableFalse ZoneSettingEditParamsItemsTls1_3Editable = false + ZoneSettingEditParamsItemsZonesTls1_3EditableTrue ZoneSettingEditParamsItemsZonesTls1_3Editable = true + ZoneSettingEditParamsItemsZonesTls1_3EditableFalse ZoneSettingEditParamsItemsZonesTls1_3Editable = false ) // Value of the zone setting. Notes: Default value depends on the zone's plan // level. -type ZoneSettingEditParamsItemsTls1_3Value string +type ZoneSettingEditParamsItemsZonesTls1_3Value string const ( - ZoneSettingEditParamsItemsTls1_3ValueOn ZoneSettingEditParamsItemsTls1_3Value = "on" - ZoneSettingEditParamsItemsTls1_3ValueOff ZoneSettingEditParamsItemsTls1_3Value = "off" - ZoneSettingEditParamsItemsTls1_3ValueZrt ZoneSettingEditParamsItemsTls1_3Value = "zrt" + ZoneSettingEditParamsItemsZonesTls1_3ValueOn ZoneSettingEditParamsItemsZonesTls1_3Value = "on" + ZoneSettingEditParamsItemsZonesTls1_3ValueOff ZoneSettingEditParamsItemsZonesTls1_3Value = "off" + ZoneSettingEditParamsItemsZonesTls1_3ValueZrt ZoneSettingEditParamsItemsZonesTls1_3Value = "zrt" ) // TLS Client Auth requires Cloudflare to connect to your origin server using a // client certificate (Enterprise Only). -type ZoneSettingEditParamsItemsTlsClientAuth struct { +type ZoneSettingEditParamsItemsZonesTlsClientAuth struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsTlsClientAuthID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesTlsClientAuthID] `json:"id"` // value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsTlsClientAuthValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesTlsClientAuthValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsTlsClientAuth) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesTlsClientAuth) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsTlsClientAuth) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesTlsClientAuth) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsTlsClientAuthID string +type ZoneSettingEditParamsItemsZonesTlsClientAuthID string const ( - ZoneSettingEditParamsItemsTlsClientAuthIDTlsClientAuth ZoneSettingEditParamsItemsTlsClientAuthID = "tls_client_auth" + ZoneSettingEditParamsItemsZonesTlsClientAuthIDTlsClientAuth ZoneSettingEditParamsItemsZonesTlsClientAuthID = "tls_client_auth" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsTlsClientAuthEditable bool +type ZoneSettingEditParamsItemsZonesTlsClientAuthEditable bool const ( - ZoneSettingEditParamsItemsTlsClientAuthEditableTrue ZoneSettingEditParamsItemsTlsClientAuthEditable = true - ZoneSettingEditParamsItemsTlsClientAuthEditableFalse ZoneSettingEditParamsItemsTlsClientAuthEditable = false + ZoneSettingEditParamsItemsZonesTlsClientAuthEditableTrue ZoneSettingEditParamsItemsZonesTlsClientAuthEditable = true + ZoneSettingEditParamsItemsZonesTlsClientAuthEditableFalse ZoneSettingEditParamsItemsZonesTlsClientAuthEditable = false ) // value of the zone setting. -type ZoneSettingEditParamsItemsTlsClientAuthValue string +type ZoneSettingEditParamsItemsZonesTlsClientAuthValue string const ( - ZoneSettingEditParamsItemsTlsClientAuthValueOn ZoneSettingEditParamsItemsTlsClientAuthValue = "on" - ZoneSettingEditParamsItemsTlsClientAuthValueOff ZoneSettingEditParamsItemsTlsClientAuthValue = "off" + ZoneSettingEditParamsItemsZonesTlsClientAuthValueOn ZoneSettingEditParamsItemsZonesTlsClientAuthValue = "on" + ZoneSettingEditParamsItemsZonesTlsClientAuthValueOff ZoneSettingEditParamsItemsZonesTlsClientAuthValue = "off" ) // Allows customer to continue to use True Client IP (Akamai feature) in the // headers we send to the origin. This is limited to Enterprise Zones. -type ZoneSettingEditParamsItemsTrueClientIPHeader struct { +type ZoneSettingEditParamsItemsZonesTrueClientIPHeader struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsTrueClientIPHeaderID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesTrueClientIPHeaderID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsTrueClientIPHeaderValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsTrueClientIPHeader) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesTrueClientIPHeader) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsTrueClientIPHeader) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesTrueClientIPHeader) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsTrueClientIPHeaderID string +type ZoneSettingEditParamsItemsZonesTrueClientIPHeaderID string const ( - ZoneSettingEditParamsItemsTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingEditParamsItemsTrueClientIPHeaderID = "true_client_ip_header" + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingEditParamsItemsZonesTrueClientIPHeaderID = "true_client_ip_header" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsTrueClientIPHeaderEditable bool +type ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditable bool const ( - ZoneSettingEditParamsItemsTrueClientIPHeaderEditableTrue ZoneSettingEditParamsItemsTrueClientIPHeaderEditable = true - ZoneSettingEditParamsItemsTrueClientIPHeaderEditableFalse ZoneSettingEditParamsItemsTrueClientIPHeaderEditable = false + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditableTrue ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditable = true + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditableFalse ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsTrueClientIPHeaderValue string +type ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue string const ( - ZoneSettingEditParamsItemsTrueClientIPHeaderValueOn ZoneSettingEditParamsItemsTrueClientIPHeaderValue = "on" - ZoneSettingEditParamsItemsTrueClientIPHeaderValueOff ZoneSettingEditParamsItemsTrueClientIPHeaderValue = "off" + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValueOn ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue = "on" + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValueOff ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue = "off" ) // The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -5979,81 +9393,81 @@ const ( // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). -type ZoneSettingEditParamsItemsWaf struct { +type ZoneSettingEditParamsItemsZonesWaf struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsWafID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesWafID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsWafValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesWafValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsWaf) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesWaf) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsWaf) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesWaf) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsWafID string +type ZoneSettingEditParamsItemsZonesWafID string const ( - ZoneSettingEditParamsItemsWafIDWaf ZoneSettingEditParamsItemsWafID = "waf" + ZoneSettingEditParamsItemsZonesWafIDWaf ZoneSettingEditParamsItemsZonesWafID = "waf" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsWafEditable bool +type ZoneSettingEditParamsItemsZonesWafEditable bool const ( - ZoneSettingEditParamsItemsWafEditableTrue ZoneSettingEditParamsItemsWafEditable = true - ZoneSettingEditParamsItemsWafEditableFalse ZoneSettingEditParamsItemsWafEditable = false + ZoneSettingEditParamsItemsZonesWafEditableTrue ZoneSettingEditParamsItemsZonesWafEditable = true + ZoneSettingEditParamsItemsZonesWafEditableFalse ZoneSettingEditParamsItemsZonesWafEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsWafValue string +type ZoneSettingEditParamsItemsZonesWafValue string const ( - ZoneSettingEditParamsItemsWafValueOn ZoneSettingEditParamsItemsWafValue = "on" - ZoneSettingEditParamsItemsWafValueOff ZoneSettingEditParamsItemsWafValue = "off" + ZoneSettingEditParamsItemsZonesWafValueOn ZoneSettingEditParamsItemsZonesWafValue = "on" + ZoneSettingEditParamsItemsZonesWafValueOff ZoneSettingEditParamsItemsZonesWafValue = "off" ) // When the client requesting the image supports the WebP image codec, and WebP // offers a performance advantage over the original image format, Cloudflare will // serve a WebP version of the original image. -type ZoneSettingEditParamsItemsWebp struct { +type ZoneSettingEditParamsItemsZonesWebp struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsWebpID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesWebpID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsWebpValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesWebpValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsWebp) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesWebp) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsWebp) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesWebp) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsWebpID string +type ZoneSettingEditParamsItemsZonesWebpID string const ( - ZoneSettingEditParamsItemsWebpIDWebp ZoneSettingEditParamsItemsWebpID = "webp" + ZoneSettingEditParamsItemsZonesWebpIDWebp ZoneSettingEditParamsItemsZonesWebpID = "webp" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsWebpEditable bool +type ZoneSettingEditParamsItemsZonesWebpEditable bool const ( - ZoneSettingEditParamsItemsWebpEditableTrue ZoneSettingEditParamsItemsWebpEditable = true - ZoneSettingEditParamsItemsWebpEditableFalse ZoneSettingEditParamsItemsWebpEditable = false + ZoneSettingEditParamsItemsZonesWebpEditableTrue ZoneSettingEditParamsItemsZonesWebpEditable = true + ZoneSettingEditParamsItemsZonesWebpEditableFalse ZoneSettingEditParamsItemsZonesWebpEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsWebpValue string +type ZoneSettingEditParamsItemsZonesWebpValue string const ( - ZoneSettingEditParamsItemsWebpValueOff ZoneSettingEditParamsItemsWebpValue = "off" - ZoneSettingEditParamsItemsWebpValueOn ZoneSettingEditParamsItemsWebpValue = "on" + ZoneSettingEditParamsItemsZonesWebpValueOff ZoneSettingEditParamsItemsZonesWebpValue = "off" + ZoneSettingEditParamsItemsZonesWebpValueOn ZoneSettingEditParamsItemsZonesWebpValue = "on" ) // WebSockets are open connections sustained between the client and the origin @@ -6063,39 +9477,39 @@ const ( // real-time applications such as live chat and gaming. For more information refer // to // [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). -type ZoneSettingEditParamsItemsWebsockets struct { +type ZoneSettingEditParamsItemsZonesWebsockets struct { // ID of the zone setting. - ID param.Field[ZoneSettingEditParamsItemsWebsocketsID] `json:"id"` + ID param.Field[ZoneSettingEditParamsItemsZonesWebsocketsID] `json:"id"` // Value of the zone setting. - Value param.Field[ZoneSettingEditParamsItemsWebsocketsValue] `json:"value"` + Value param.Field[ZoneSettingEditParamsItemsZonesWebsocketsValue] `json:"value"` } -func (r ZoneSettingEditParamsItemsWebsockets) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingEditParamsItemsZonesWebsockets) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ZoneSettingEditParamsItemsWebsockets) implementsZoneSettingEditParamsItem() {} +func (r ZoneSettingEditParamsItemsZonesWebsockets) implementsZoneSettingEditParamsItem() {} // ID of the zone setting. -type ZoneSettingEditParamsItemsWebsocketsID string +type ZoneSettingEditParamsItemsZonesWebsocketsID string const ( - ZoneSettingEditParamsItemsWebsocketsIDWebsockets ZoneSettingEditParamsItemsWebsocketsID = "websockets" + ZoneSettingEditParamsItemsZonesWebsocketsIDWebsockets ZoneSettingEditParamsItemsZonesWebsocketsID = "websockets" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type ZoneSettingEditParamsItemsWebsocketsEditable bool +type ZoneSettingEditParamsItemsZonesWebsocketsEditable bool const ( - ZoneSettingEditParamsItemsWebsocketsEditableTrue ZoneSettingEditParamsItemsWebsocketsEditable = true - ZoneSettingEditParamsItemsWebsocketsEditableFalse ZoneSettingEditParamsItemsWebsocketsEditable = false + ZoneSettingEditParamsItemsZonesWebsocketsEditableTrue ZoneSettingEditParamsItemsZonesWebsocketsEditable = true + ZoneSettingEditParamsItemsZonesWebsocketsEditableFalse ZoneSettingEditParamsItemsZonesWebsocketsEditable = false ) // Value of the zone setting. -type ZoneSettingEditParamsItemsWebsocketsValue string +type ZoneSettingEditParamsItemsZonesWebsocketsValue string const ( - ZoneSettingEditParamsItemsWebsocketsValueOff ZoneSettingEditParamsItemsWebsocketsValue = "off" - ZoneSettingEditParamsItemsWebsocketsValueOn ZoneSettingEditParamsItemsWebsocketsValue = "on" + ZoneSettingEditParamsItemsZonesWebsocketsValueOff ZoneSettingEditParamsItemsZonesWebsocketsValue = "off" + ZoneSettingEditParamsItemsZonesWebsocketsValueOn ZoneSettingEditParamsItemsZonesWebsocketsValue = "on" ) diff --git a/zonesetting_test.go b/zonesetting_test.go index 7deb584d969..7d5ae0bc323 100644 --- a/zonesetting_test.go +++ b/zonesetting_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingList(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 @@ -23,8 +24,10 @@ func TestZoneSettingList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { @@ -47,22 +50,24 @@ func TestZoneSettingEdit(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.ZoneSettingEditParams{ - Items: cloudflare.F([]cloudflare.ZoneSettingEditParamsItem{cloudflare.ZoneSettingEditParamsItemsAlwaysOnline(cloudflare.ZoneSettingEditParamsItemsAlwaysOnline{ - ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsAlwaysOnlineIDAlwaysOnline), - Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsAlwaysOnlineValueOn), - }), cloudflare.ZoneSettingEditParamsItemsBrowserCacheTtl(cloudflare.ZoneSettingEditParamsItemsBrowserCacheTtl{ - ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsBrowserCacheTtlIDBrowserCacheTtl), - Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsBrowserCacheTtlValue18000), - }), cloudflare.ZoneSettingEditParamsItemsIPGeolocation(cloudflare.ZoneSettingEditParamsItemsIPGeolocation{ - ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsIPGeolocationIDIPGeolocation), - Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsIPGeolocationValueOff), + Items: cloudflare.F([]cloudflare.ZoneSettingEditParamsItem{cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnline(cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnline{ + ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnlineIDAlwaysOnline), + Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnlineValueOn), + }), cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTtl(cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTtl{ + ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTtlIDBrowserCacheTtl), + Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTtlValue18000), + }), cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocation(cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocation{ + ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocationIDIPGeolocation), + Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocationValueOff), })}), }, ) diff --git a/zonesettingadvancedddo_test.go b/zonesettingadvancedddo_test.go index 926247521a6..d49bddd0bf3 100644 --- a/zonesettingadvancedddo_test.go +++ b/zonesettingadvancedddo_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingAdvancedDdoList(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 @@ -23,8 +24,10 @@ func TestZoneSettingAdvancedDdoList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AdvancedDdos.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingalwaysonline_test.go b/zonesettingalwaysonline_test.go index 06b42f59740..f58eca610b8 100644 --- a/zonesettingalwaysonline_test.go +++ b/zonesettingalwaysonline_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingAlwaysOnlineUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingAlwaysOnlineUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AlwaysOnlines.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingAlwaysOnlineUpdate(t *testing.T) { } func TestZoneSettingAlwaysOnlineList(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 @@ -52,8 +56,10 @@ func TestZoneSettingAlwaysOnlineList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AlwaysOnlines.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingalwaysusehttp_test.go b/zonesettingalwaysusehttp_test.go index f8140569739..e76d5419c18 100644 --- a/zonesettingalwaysusehttp_test.go +++ b/zonesettingalwaysusehttp_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingAlwaysUseHTTPUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingAlwaysUseHTTPUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AlwaysUseHTTPs.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingAlwaysUseHTTPUpdate(t *testing.T) { } func TestZoneSettingAlwaysUseHTTPList(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 @@ -52,8 +56,10 @@ func TestZoneSettingAlwaysUseHTTPList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AlwaysUseHTTPs.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingautomatichttpsrewrite_test.go b/zonesettingautomatichttpsrewrite_test.go index 481d2080ded..cefd513a24a 100644 --- a/zonesettingautomatichttpsrewrite_test.go +++ b/zonesettingautomatichttpsrewrite_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingAutomaticHTTPsRewriteUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingAutomaticHTTPsRewriteUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AutomaticHTTPsRewrites.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingAutomaticHTTPsRewriteUpdate(t *testing.T) { } func TestZoneSettingAutomaticHTTPsRewriteList(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 @@ -52,8 +56,10 @@ func TestZoneSettingAutomaticHTTPsRewriteList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AutomaticHTTPsRewrites.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingautomaticplatformoptimization_test.go b/zonesettingautomaticplatformoptimization_test.go index a81b8a7da75..080b373998e 100644 --- a/zonesettingautomaticplatformoptimization_test.go +++ b/zonesettingautomaticplatformoptimization_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingAutomaticPlatformOptimizationUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingAutomaticPlatformOptimizationUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AutomaticPlatformOptimizations.Update( context.TODO(), @@ -50,6 +53,7 @@ func TestZoneSettingAutomaticPlatformOptimizationUpdate(t *testing.T) { } func TestZoneSettingAutomaticPlatformOptimizationList(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 @@ -59,8 +63,10 @@ func TestZoneSettingAutomaticPlatformOptimizationList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.AutomaticPlatformOptimizations.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingbrotli_test.go b/zonesettingbrotli_test.go index a57816afa4e..54f8051aacd 100644 --- a/zonesettingbrotli_test.go +++ b/zonesettingbrotli_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingBrotliUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingBrotliUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Brotli.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingBrotliUpdate(t *testing.T) { } func TestZoneSettingBrotliList(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 @@ -52,8 +56,10 @@ func TestZoneSettingBrotliList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Brotli.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingbrowsercachettl_test.go b/zonesettingbrowsercachettl_test.go index 4d667fc1f79..67f6a88c7a4 100644 --- a/zonesettingbrowsercachettl_test.go +++ b/zonesettingbrowsercachettl_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingBrowserCacheTtlUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingBrowserCacheTtlUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.BrowserCacheTtls.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingBrowserCacheTtlUpdate(t *testing.T) { } func TestZoneSettingBrowserCacheTtlList(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 @@ -52,8 +56,10 @@ func TestZoneSettingBrowserCacheTtlList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.BrowserCacheTtls.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingbrowsercheck_test.go b/zonesettingbrowsercheck_test.go index 30a07581b35..35c7813d837 100644 --- a/zonesettingbrowsercheck_test.go +++ b/zonesettingbrowsercheck_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingBrowserCheckUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingBrowserCheckUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.BrowserChecks.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingBrowserCheckUpdate(t *testing.T) { } func TestZoneSettingBrowserCheckList(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 @@ -52,8 +56,10 @@ func TestZoneSettingBrowserCheckList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.BrowserChecks.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingcachelevel_test.go b/zonesettingcachelevel_test.go index b62d2547a78..41dcf246353 100644 --- a/zonesettingcachelevel_test.go +++ b/zonesettingcachelevel_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingCacheLevelUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingCacheLevelUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.CacheLevels.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingCacheLevelUpdate(t *testing.T) { } func TestZoneSettingCacheLevelList(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 @@ -52,8 +56,10 @@ func TestZoneSettingCacheLevelList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.CacheLevels.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingchallengettl_test.go b/zonesettingchallengettl_test.go index 079b43e9151..3b4b80dc7d9 100644 --- a/zonesettingchallengettl_test.go +++ b/zonesettingchallengettl_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingChallengeTtlUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingChallengeTtlUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ChallengeTtls.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingChallengeTtlUpdate(t *testing.T) { } func TestZoneSettingChallengeTtlList(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 @@ -52,8 +56,10 @@ func TestZoneSettingChallengeTtlList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ChallengeTtls.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingcipher_test.go b/zonesettingcipher_test.go index c5cd3a35487..e8c10318211 100644 --- a/zonesettingcipher_test.go +++ b/zonesettingcipher_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingCipherUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingCipherUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Ciphers.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingCipherUpdate(t *testing.T) { } func TestZoneSettingCipherList(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 @@ -52,8 +56,10 @@ func TestZoneSettingCipherList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Ciphers.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingdevelopmentmode_test.go b/zonesettingdevelopmentmode_test.go index d8bf821ed08..af89947075e 100644 --- a/zonesettingdevelopmentmode_test.go +++ b/zonesettingdevelopmentmode_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingDevelopmentModeUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingDevelopmentModeUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.DevelopmentModes.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingDevelopmentModeUpdate(t *testing.T) { } func TestZoneSettingDevelopmentModeList(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 @@ -52,8 +56,10 @@ func TestZoneSettingDevelopmentModeList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.DevelopmentModes.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingearlyhint_test.go b/zonesettingearlyhint_test.go index 6f7221c5fff..997f6cc2b66 100644 --- a/zonesettingearlyhint_test.go +++ b/zonesettingearlyhint_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingEarlyHintUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingEarlyHintUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.EarlyHints.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingEarlyHintUpdate(t *testing.T) { } func TestZoneSettingEarlyHintList(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 @@ -52,8 +56,10 @@ func TestZoneSettingEarlyHintList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.EarlyHints.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingemailobfuscation_test.go b/zonesettingemailobfuscation_test.go index c7fcdf3a0ca..0da6532cf9a 100644 --- a/zonesettingemailobfuscation_test.go +++ b/zonesettingemailobfuscation_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingEmailObfuscationUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingEmailObfuscationUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.EmailObfuscations.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingEmailObfuscationUpdate(t *testing.T) { } func TestZoneSettingEmailObfuscationList(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 @@ -52,8 +56,10 @@ func TestZoneSettingEmailObfuscationList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.EmailObfuscations.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingfont.go b/zonesettingfont.go new file mode 100644 index 00000000000..b65cd9e3df6 --- /dev/null +++ b/zonesettingfont.go @@ -0,0 +1,254 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingFontService 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 [NewZoneSettingFontService] method +// instead. +type ZoneSettingFontService struct { + Options []option.RequestOption +} + +// NewZoneSettingFontService 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 NewZoneSettingFontService(opts ...option.RequestOption) (r *ZoneSettingFontService) { + r = &ZoneSettingFontService{} + r.Options = opts + return +} + +// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google +// Hosted fonts from your own domain, boost performance, and enhance user privacy. +// Refer to the Cloudflare Fonts documentation for more information. +func (r *ZoneSettingFontService) Get(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSettingFontGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/fonts", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google +// Hosted fonts from your own domain, boost performance, and enhance user privacy. +// Refer to the Cloudflare Fonts documentation for more information. +func (r *ZoneSettingFontService) Update(ctx context.Context, zoneIdentifier string, body ZoneSettingFontUpdateParams, opts ...option.RequestOption) (res *ZoneSettingFontUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/fonts", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google +// Hosted fonts from your own domain, boost performance, and enhance user privacy. +// Refer to the Cloudflare Fonts documentation for more information. +type CloudflareFonts struct { + // ID of the zone setting. + ID CloudflareFontsID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable CloudflareFontsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Whether the feature is enabled or disabled. + Value CloudflareFontsValue `json:"value"` + JSON cloudflareFontsJSON `json:"-"` +} + +// cloudflareFontsJSON contains the JSON metadata for the struct [CloudflareFonts] +type cloudflareFontsJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CloudflareFonts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type CloudflareFontsID string + +const ( + CloudflareFontsIDFonts CloudflareFontsID = "fonts" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type CloudflareFontsEditable bool + +const ( + CloudflareFontsEditableTrue CloudflareFontsEditable = true + CloudflareFontsEditableFalse CloudflareFontsEditable = false +) + +// Whether the feature is enabled or disabled. +type CloudflareFontsValue string + +const ( + CloudflareFontsValueOn CloudflareFontsValue = "on" + CloudflareFontsValueOff CloudflareFontsValue = "off" +) + +type ZoneSettingFontGetResponse struct { + Errors []ZoneSettingFontGetResponseError `json:"errors"` + Messages []ZoneSettingFontGetResponseMessage `json:"messages"` + // Enhance your website's font delivery with Cloudflare Fonts. Deliver Google + // Hosted fonts from your own domain, boost performance, and enhance user privacy. + // Refer to the Cloudflare Fonts documentation for more information. + Result CloudflareFonts `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingFontGetResponseJSON `json:"-"` +} + +// zoneSettingFontGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingFontGetResponse] +type zoneSettingFontGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontGetResponseErrorJSON `json:"-"` +} + +// zoneSettingFontGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSettingFontGetResponseError] +type zoneSettingFontGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontGetResponseMessageJSON `json:"-"` +} + +// zoneSettingFontGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneSettingFontGetResponseMessage] +type zoneSettingFontGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontUpdateResponse struct { + Errors []ZoneSettingFontUpdateResponseError `json:"errors"` + Messages []ZoneSettingFontUpdateResponseMessage `json:"messages"` + // Enhance your website's font delivery with Cloudflare Fonts. Deliver Google + // Hosted fonts from your own domain, boost performance, and enhance user privacy. + // Refer to the Cloudflare Fonts documentation for more information. + Result CloudflareFonts `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingFontUpdateResponseJSON `json:"-"` +} + +// zoneSettingFontUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneSettingFontUpdateResponse] +type zoneSettingFontUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontUpdateResponseErrorJSON `json:"-"` +} + +// zoneSettingFontUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSettingFontUpdateResponseError] +type zoneSettingFontUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontUpdateResponseMessageJSON `json:"-"` +} + +// zoneSettingFontUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSettingFontUpdateResponseMessage] +type zoneSettingFontUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontUpdateParams struct { + // Whether the feature is enabled or disabled. + Value param.Field[ZoneSettingFontUpdateParamsValue] `json:"value,required"` +} + +func (r ZoneSettingFontUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether the feature is enabled or disabled. +type ZoneSettingFontUpdateParamsValue string + +const ( + ZoneSettingFontUpdateParamsValueOn ZoneSettingFontUpdateParamsValue = "on" + ZoneSettingFontUpdateParamsValueOff ZoneSettingFontUpdateParamsValue = "off" +) diff --git a/zonesettingfont_test.go b/zonesettingfont_test.go new file mode 100644 index 00000000000..fb976574e53 --- /dev/null +++ b/zonesettingfont_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingFontGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Fonts.Get(context.TODO(), "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()) + } +} + +func TestZoneSettingFontUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Fonts.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSettingFontUpdateParams{ + Value: cloudflare.F(cloudflare.ZoneSettingFontUpdateParamsValueOn), + }, + ) + 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/zonesettingh2prioritization_test.go b/zonesettingh2prioritization_test.go index 85eb939304d..8d6b8877b6a 100644 --- a/zonesettingh2prioritization_test.go +++ b/zonesettingh2prioritization_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingH2PrioritizationUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingH2PrioritizationUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.H2Prioritizations.Update( context.TODO(), @@ -46,6 +49,7 @@ func TestZoneSettingH2PrioritizationUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingH2PrioritizationList(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 @@ -55,8 +59,10 @@ func TestZoneSettingH2PrioritizationList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.H2Prioritizations.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettinghotlinkprotection_test.go b/zonesettinghotlinkprotection_test.go index b1d1dcc1d56..281557b53ed 100644 --- a/zonesettinghotlinkprotection_test.go +++ b/zonesettinghotlinkprotection_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingHotlinkProtectionUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingHotlinkProtectionUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.HotlinkProtections.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingHotlinkProtectionUpdate(t *testing.T) { } func TestZoneSettingHotlinkProtectionList(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 @@ -52,8 +56,10 @@ func TestZoneSettingHotlinkProtectionList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.HotlinkProtections.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettinghttp2_test.go b/zonesettinghttp2_test.go index aee69f47a69..c102f17584e 100644 --- a/zonesettinghttp2_test.go +++ b/zonesettinghttp2_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingHttp2Update(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 @@ -23,8 +24,10 @@ func TestZoneSettingHttp2Update(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Http2s.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingHttp2Update(t *testing.T) { } func TestZoneSettingHttp2List(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 @@ -52,8 +56,10 @@ func TestZoneSettingHttp2List(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Http2s.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettinghttp3_test.go b/zonesettinghttp3_test.go index ae8b26b169f..3fe6e3ad801 100644 --- a/zonesettinghttp3_test.go +++ b/zonesettinghttp3_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingHttp3Update(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 @@ -23,8 +24,10 @@ func TestZoneSettingHttp3Update(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Http3s.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingHttp3Update(t *testing.T) { } func TestZoneSettingHttp3List(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 @@ -52,8 +56,10 @@ func TestZoneSettingHttp3List(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Http3s.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingimageresizing_test.go b/zonesettingimageresizing_test.go index ee2e3954a0a..ee20b2762bb 100644 --- a/zonesettingimageresizing_test.go +++ b/zonesettingimageresizing_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingImageResizingUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingImageResizingUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ImageResizings.Update( context.TODO(), @@ -46,6 +49,7 @@ func TestZoneSettingImageResizingUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingImageResizingList(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 @@ -55,8 +59,10 @@ func TestZoneSettingImageResizingList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ImageResizings.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingipgeolocation_test.go b/zonesettingipgeolocation_test.go index 1d59338af63..3b8d90a7ed9 100644 --- a/zonesettingipgeolocation_test.go +++ b/zonesettingipgeolocation_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingIPGeolocationUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingIPGeolocationUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.IPGeolocations.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingIPGeolocationUpdate(t *testing.T) { } func TestZoneSettingIPGeolocationList(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 @@ -52,8 +56,10 @@ func TestZoneSettingIPGeolocationList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.IPGeolocations.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingipv6_test.go b/zonesettingipv6_test.go index b7fcd48fb47..86a655d533b 100644 --- a/zonesettingipv6_test.go +++ b/zonesettingipv6_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingIpv6Update(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 @@ -23,8 +24,10 @@ func TestZoneSettingIpv6Update(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Ipv6s.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingIpv6Update(t *testing.T) { } func TestZoneSettingIpv6List(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 @@ -52,8 +56,10 @@ func TestZoneSettingIpv6List(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Ipv6s.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingminify_test.go b/zonesettingminify_test.go index c5cf46e0f3a..d2ece891c42 100644 --- a/zonesettingminify_test.go +++ b/zonesettingminify_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingMinifyUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingMinifyUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Minifies.Update( context.TODO(), @@ -47,6 +50,7 @@ func TestZoneSettingMinifyUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingMinifyList(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 @@ -56,8 +60,10 @@ func TestZoneSettingMinifyList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Minifies.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingmintlsversion_test.go b/zonesettingmintlsversion_test.go index a7ac0cd655e..f5b4e5bcb16 100644 --- a/zonesettingmintlsversion_test.go +++ b/zonesettingmintlsversion_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingMinTlsVersionUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingMinTlsVersionUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.MinTlsVersions.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingMinTlsVersionUpdate(t *testing.T) { } func TestZoneSettingMinTlsVersionList(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 @@ -52,8 +56,10 @@ func TestZoneSettingMinTlsVersionList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.MinTlsVersions.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingmirage_test.go b/zonesettingmirage_test.go index 5447e4f6ff8..65ace09fed0 100644 --- a/zonesettingmirage_test.go +++ b/zonesettingmirage_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingMirageUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingMirageUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Mirages.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingMirageUpdate(t *testing.T) { } func TestZoneSettingMirageList(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 @@ -52,8 +56,10 @@ func TestZoneSettingMirageList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Mirages.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingmobileredirect_test.go b/zonesettingmobileredirect_test.go index 1f3197d0696..fda61636568 100644 --- a/zonesettingmobileredirect_test.go +++ b/zonesettingmobileredirect_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingMobileRedirectUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingMobileRedirectUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.MobileRedirects.Update( context.TODO(), @@ -47,6 +50,7 @@ func TestZoneSettingMobileRedirectUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingMobileRedirectList(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 @@ -56,8 +60,10 @@ func TestZoneSettingMobileRedirectList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.MobileRedirects.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingnel_test.go b/zonesettingnel_test.go index 5301459430e..eddbe0f79ed 100644 --- a/zonesettingnel_test.go +++ b/zonesettingnel_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingNelUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingNelUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Nels.Update( context.TODO(), @@ -48,6 +51,7 @@ func TestZoneSettingNelUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingNelList(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 @@ -57,8 +61,10 @@ func TestZoneSettingNelList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Nels.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingopportunisticencryption_test.go b/zonesettingopportunisticencryption_test.go index c3c5c99ab55..9ddbd2620f0 100644 --- a/zonesettingopportunisticencryption_test.go +++ b/zonesettingopportunisticencryption_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingOpportunisticEncryptionUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingOpportunisticEncryptionUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OpportunisticEncryptions.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingOpportunisticEncryptionUpdate(t *testing.T) { } func TestZoneSettingOpportunisticEncryptionList(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 @@ -52,8 +56,10 @@ func TestZoneSettingOpportunisticEncryptionList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OpportunisticEncryptions.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingopportunisticonion_test.go b/zonesettingopportunisticonion_test.go index 6c7e7795744..48ed690958e 100644 --- a/zonesettingopportunisticonion_test.go +++ b/zonesettingopportunisticonion_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingOpportunisticOnionUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingOpportunisticOnionUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OpportunisticOnions.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingOpportunisticOnionUpdate(t *testing.T) { } func TestZoneSettingOpportunisticOnionList(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 @@ -52,8 +56,10 @@ func TestZoneSettingOpportunisticOnionList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OpportunisticOnions.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingorangetoorange_test.go b/zonesettingorangetoorange_test.go index c5dd216bfab..da9b635785e 100644 --- a/zonesettingorangetoorange_test.go +++ b/zonesettingorangetoorange_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingOrangeToOrangeUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingOrangeToOrangeUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OrangeToOranges.Update( context.TODO(), @@ -46,6 +49,7 @@ func TestZoneSettingOrangeToOrangeUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingOrangeToOrangeList(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 @@ -55,8 +59,10 @@ func TestZoneSettingOrangeToOrangeList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OrangeToOranges.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingoriginerrorpagepassthrus_test.go b/zonesettingoriginerrorpagepassthrus_test.go index 877fa38eaa5..0fa5273de69 100644 --- a/zonesettingoriginerrorpagepassthrus_test.go +++ b/zonesettingoriginerrorpagepassthrus_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingOriginErrorPagePassThrusUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingOriginErrorPagePassThrusUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OriginErrorPagePassThrus.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingOriginErrorPagePassThrusUpdate(t *testing.T) { } func TestZoneSettingOriginErrorPagePassThrusList(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 @@ -52,8 +56,10 @@ func TestZoneSettingOriginErrorPagePassThrusList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OriginErrorPagePassThrus.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingoriginmaxhttpversion_test.go b/zonesettingoriginmaxhttpversion_test.go index 110bf1f6a64..681db2ae464 100644 --- a/zonesettingoriginmaxhttpversion_test.go +++ b/zonesettingoriginmaxhttpversion_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingOriginMaxHTTPVersionUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingOriginMaxHTTPVersionUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OriginMaxHTTPVersions.Update( context.TODO(), @@ -45,6 +48,7 @@ func TestZoneSettingOriginMaxHTTPVersionUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingOriginMaxHTTPVersionList(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 @@ -54,8 +58,10 @@ func TestZoneSettingOriginMaxHTTPVersionList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.OriginMaxHTTPVersions.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingpolish_test.go b/zonesettingpolish_test.go index 8656c8d3fcf..c31006379d6 100644 --- a/zonesettingpolish_test.go +++ b/zonesettingpolish_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingPolishUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingPolishUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Polishes.Update( context.TODO(), @@ -46,6 +49,7 @@ func TestZoneSettingPolishUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingPolishList(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 @@ -55,8 +59,10 @@ func TestZoneSettingPolishList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Polishes.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingprefetchpreload_test.go b/zonesettingprefetchpreload_test.go index d50d884c4f1..d7352ee3212 100644 --- a/zonesettingprefetchpreload_test.go +++ b/zonesettingprefetchpreload_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingPrefetchPreloadUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingPrefetchPreloadUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.PrefetchPreloads.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingPrefetchPreloadUpdate(t *testing.T) { } func TestZoneSettingPrefetchPreloadList(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 @@ -52,8 +56,10 @@ func TestZoneSettingPrefetchPreloadList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.PrefetchPreloads.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingprivacypass.go b/zonesettingprivacypass.go deleted file mode 100644 index f59f25b0348..00000000000 --- a/zonesettingprivacypass.go +++ /dev/null @@ -1,316 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// ZoneSettingPrivacyPassService 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 [NewZoneSettingPrivacyPassService] -// method instead. -type ZoneSettingPrivacyPassService struct { - Options []option.RequestOption -} - -// NewZoneSettingPrivacyPassService 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 NewZoneSettingPrivacyPassService(opts ...option.RequestOption) (r *ZoneSettingPrivacyPassService) { - r = &ZoneSettingPrivacyPassService{} - r.Options = opts - return -} - -// Privacy Pass is a browser extension developed by the Privacy Pass Team to -// improve the browsing experience for your visitors. Enabling Privacy Pass will -// reduce the number of CAPTCHAs shown to your visitors. -// (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). -func (r *ZoneSettingPrivacyPassService) Update(ctx context.Context, zoneIdentifier string, body ZoneSettingPrivacyPassUpdateParams, opts ...option.RequestOption) (res *ZoneSettingPrivacyPassUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%s/settings/privacy_pass", zoneIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) - return -} - -// Privacy Pass is a browser extension developed by the Privacy Pass Team to -// improve the browsing experience for your visitors. Enabling Privacy Pass will -// reduce the number of CAPTCHAs shown to your visitors. -// (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). -func (r *ZoneSettingPrivacyPassService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSettingPrivacyPassListResponse, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%s/settings/privacy_pass", zoneIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) - return -} - -type ZoneSettingPrivacyPassUpdateResponse struct { - Errors []ZoneSettingPrivacyPassUpdateResponseError `json:"errors"` - Messages []ZoneSettingPrivacyPassUpdateResponseMessage `json:"messages"` - // Privacy Pass is a browser extension developed by the Privacy Pass Team to - // improve the browsing experience for your visitors. Enabling Privacy Pass will - // reduce the number of CAPTCHAs shown to your visitors. - // (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). - Result ZoneSettingPrivacyPassUpdateResponseResult `json:"result"` - // Whether the API call was successful - Success bool `json:"success"` - JSON zoneSettingPrivacyPassUpdateResponseJSON `json:"-"` -} - -// zoneSettingPrivacyPassUpdateResponseJSON contains the JSON metadata for the -// struct [ZoneSettingPrivacyPassUpdateResponse] -type zoneSettingPrivacyPassUpdateResponseJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ZoneSettingPrivacyPassUpdateResponseError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneSettingPrivacyPassUpdateResponseErrorJSON `json:"-"` -} - -// zoneSettingPrivacyPassUpdateResponseErrorJSON contains the JSON metadata for the -// struct [ZoneSettingPrivacyPassUpdateResponseError] -type zoneSettingPrivacyPassUpdateResponseErrorJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassUpdateResponseError) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ZoneSettingPrivacyPassUpdateResponseMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneSettingPrivacyPassUpdateResponseMessageJSON `json:"-"` -} - -// zoneSettingPrivacyPassUpdateResponseMessageJSON contains the JSON metadata for -// the struct [ZoneSettingPrivacyPassUpdateResponseMessage] -type zoneSettingPrivacyPassUpdateResponseMessageJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Privacy Pass is a browser extension developed by the Privacy Pass Team to -// improve the browsing experience for your visitors. Enabling Privacy Pass will -// reduce the number of CAPTCHAs shown to your visitors. -// (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). -type ZoneSettingPrivacyPassUpdateResponseResult struct { - // ID of the zone setting. - ID ZoneSettingPrivacyPassUpdateResponseResultID `json:"id"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable ZoneSettingPrivacyPassUpdateResponseResultEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the zone setting. - Value ZoneSettingPrivacyPassUpdateResponseResultValue `json:"value"` - JSON zoneSettingPrivacyPassUpdateResponseResultJSON `json:"-"` -} - -// zoneSettingPrivacyPassUpdateResponseResultJSON contains the JSON metadata for -// the struct [ZoneSettingPrivacyPassUpdateResponseResult] -type zoneSettingPrivacyPassUpdateResponseResultJSON struct { - ID apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type ZoneSettingPrivacyPassUpdateResponseResultID string - -const ( - ZoneSettingPrivacyPassUpdateResponseResultIDPrivacyPass ZoneSettingPrivacyPassUpdateResponseResultID = "privacy_pass" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingPrivacyPassUpdateResponseResultEditable bool - -const ( - ZoneSettingPrivacyPassUpdateResponseResultEditableTrue ZoneSettingPrivacyPassUpdateResponseResultEditable = true - ZoneSettingPrivacyPassUpdateResponseResultEditableFalse ZoneSettingPrivacyPassUpdateResponseResultEditable = false -) - -// Value of the zone setting. -type ZoneSettingPrivacyPassUpdateResponseResultValue string - -const ( - ZoneSettingPrivacyPassUpdateResponseResultValueOn ZoneSettingPrivacyPassUpdateResponseResultValue = "on" - ZoneSettingPrivacyPassUpdateResponseResultValueOff ZoneSettingPrivacyPassUpdateResponseResultValue = "off" -) - -type ZoneSettingPrivacyPassListResponse struct { - Errors []ZoneSettingPrivacyPassListResponseError `json:"errors"` - Messages []ZoneSettingPrivacyPassListResponseMessage `json:"messages"` - // Privacy Pass is a browser extension developed by the Privacy Pass Team to - // improve the browsing experience for your visitors. Enabling Privacy Pass will - // reduce the number of CAPTCHAs shown to your visitors. - // (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). - Result ZoneSettingPrivacyPassListResponseResult `json:"result"` - // Whether the API call was successful - Success bool `json:"success"` - JSON zoneSettingPrivacyPassListResponseJSON `json:"-"` -} - -// zoneSettingPrivacyPassListResponseJSON contains the JSON metadata for the struct -// [ZoneSettingPrivacyPassListResponse] -type zoneSettingPrivacyPassListResponseJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ZoneSettingPrivacyPassListResponseError struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneSettingPrivacyPassListResponseErrorJSON `json:"-"` -} - -// zoneSettingPrivacyPassListResponseErrorJSON contains the JSON metadata for the -// struct [ZoneSettingPrivacyPassListResponseError] -type zoneSettingPrivacyPassListResponseErrorJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassListResponseError) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ZoneSettingPrivacyPassListResponseMessage struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON zoneSettingPrivacyPassListResponseMessageJSON `json:"-"` -} - -// zoneSettingPrivacyPassListResponseMessageJSON contains the JSON metadata for the -// struct [ZoneSettingPrivacyPassListResponseMessage] -type zoneSettingPrivacyPassListResponseMessageJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassListResponseMessage) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Privacy Pass is a browser extension developed by the Privacy Pass Team to -// improve the browsing experience for your visitors. Enabling Privacy Pass will -// reduce the number of CAPTCHAs shown to your visitors. -// (https://support.cloudflare.com/hc/en-us/articles/115001992652-Privacy-Pass). -type ZoneSettingPrivacyPassListResponseResult struct { - // ID of the zone setting. - ID ZoneSettingPrivacyPassListResponseResultID `json:"id"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable ZoneSettingPrivacyPassListResponseResultEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the zone setting. - Value ZoneSettingPrivacyPassListResponseResultValue `json:"value"` - JSON zoneSettingPrivacyPassListResponseResultJSON `json:"-"` -} - -// zoneSettingPrivacyPassListResponseResultJSON contains the JSON metadata for the -// struct [ZoneSettingPrivacyPassListResponseResult] -type zoneSettingPrivacyPassListResponseResultJSON struct { - ID apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ZoneSettingPrivacyPassListResponseResult) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type ZoneSettingPrivacyPassListResponseResultID string - -const ( - ZoneSettingPrivacyPassListResponseResultIDPrivacyPass ZoneSettingPrivacyPassListResponseResultID = "privacy_pass" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingPrivacyPassListResponseResultEditable bool - -const ( - ZoneSettingPrivacyPassListResponseResultEditableTrue ZoneSettingPrivacyPassListResponseResultEditable = true - ZoneSettingPrivacyPassListResponseResultEditableFalse ZoneSettingPrivacyPassListResponseResultEditable = false -) - -// Value of the zone setting. -type ZoneSettingPrivacyPassListResponseResultValue string - -const ( - ZoneSettingPrivacyPassListResponseResultValueOn ZoneSettingPrivacyPassListResponseResultValue = "on" - ZoneSettingPrivacyPassListResponseResultValueOff ZoneSettingPrivacyPassListResponseResultValue = "off" -) - -type ZoneSettingPrivacyPassUpdateParams struct { - // Value of the zone setting. - Value param.Field[ZoneSettingPrivacyPassUpdateParamsValue] `json:"value,required"` -} - -func (r ZoneSettingPrivacyPassUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type ZoneSettingPrivacyPassUpdateParamsValue string - -const ( - ZoneSettingPrivacyPassUpdateParamsValueOn ZoneSettingPrivacyPassUpdateParamsValue = "on" - ZoneSettingPrivacyPassUpdateParamsValueOff ZoneSettingPrivacyPassUpdateParamsValue = "off" -) diff --git a/zonesettingproxyreadtimeout_test.go b/zonesettingproxyreadtimeout_test.go index dc2d24f50f4..93aefa73d0b 100644 --- a/zonesettingproxyreadtimeout_test.go +++ b/zonesettingproxyreadtimeout_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingProxyReadTimeoutUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingProxyReadTimeoutUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ProxyReadTimeouts.Update( context.TODO(), @@ -46,6 +49,7 @@ func TestZoneSettingProxyReadTimeoutUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingProxyReadTimeoutList(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 @@ -55,8 +59,10 @@ func TestZoneSettingProxyReadTimeoutList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ProxyReadTimeouts.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingpseudoipv4_test.go b/zonesettingpseudoipv4_test.go index 99ea8af50b5..f2eb766f247 100644 --- a/zonesettingpseudoipv4_test.go +++ b/zonesettingpseudoipv4_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingPseudoIpv4Update(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 @@ -23,8 +24,10 @@ func TestZoneSettingPseudoIpv4Update(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.PseudoIpv4s.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingPseudoIpv4Update(t *testing.T) { } func TestZoneSettingPseudoIpv4List(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 @@ -52,8 +56,10 @@ func TestZoneSettingPseudoIpv4List(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.PseudoIpv4s.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingresponsebuffering_test.go b/zonesettingresponsebuffering_test.go index c7c6901acf8..5ea4d96066e 100644 --- a/zonesettingresponsebuffering_test.go +++ b/zonesettingresponsebuffering_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingResponseBufferingUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingResponseBufferingUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ResponseBufferings.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingResponseBufferingUpdate(t *testing.T) { } func TestZoneSettingResponseBufferingList(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 @@ -52,8 +56,10 @@ func TestZoneSettingResponseBufferingList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ResponseBufferings.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingrocketloader_test.go b/zonesettingrocketloader_test.go index 18a586ba4fb..be1a931cfb2 100644 --- a/zonesettingrocketloader_test.go +++ b/zonesettingrocketloader_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingRocketLoaderUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingRocketLoaderUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.RocketLoaders.Update( context.TODO(), @@ -46,6 +49,7 @@ func TestZoneSettingRocketLoaderUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingRocketLoaderList(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 @@ -55,8 +59,10 @@ func TestZoneSettingRocketLoaderList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.RocketLoaders.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingsecurityheader_test.go b/zonesettingsecurityheader_test.go index 3a646e7533d..c7228834060 100644 --- a/zonesettingsecurityheader_test.go +++ b/zonesettingsecurityheader_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingSecurityHeaderUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingSecurityHeaderUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SecurityHeaders.Update( context.TODO(), @@ -50,6 +53,7 @@ func TestZoneSettingSecurityHeaderUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingSecurityHeaderList(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 @@ -59,8 +63,10 @@ func TestZoneSettingSecurityHeaderList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SecurityHeaders.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingsecuritylevel_test.go b/zonesettingsecuritylevel_test.go index cb2c602c07d..6a2f3374e70 100644 --- a/zonesettingsecuritylevel_test.go +++ b/zonesettingsecuritylevel_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingSecurityLevelUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingSecurityLevelUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SecurityLevels.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingSecurityLevelUpdate(t *testing.T) { } func TestZoneSettingSecurityLevelList(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 @@ -52,8 +56,10 @@ func TestZoneSettingSecurityLevelList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SecurityLevels.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingserversideexclude_test.go b/zonesettingserversideexclude_test.go index 002cf028c78..9253e5a19d2 100644 --- a/zonesettingserversideexclude_test.go +++ b/zonesettingserversideexclude_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingServerSideExcludeUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingServerSideExcludeUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ServerSideExcludes.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingServerSideExcludeUpdate(t *testing.T) { } func TestZoneSettingServerSideExcludeList(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 @@ -52,8 +56,10 @@ func TestZoneSettingServerSideExcludeList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.ServerSideExcludes.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingsortquerystringforcach_test.go b/zonesettingsortquerystringforcach_test.go index 9fce8b89143..ec37ae15c23 100644 --- a/zonesettingsortquerystringforcach_test.go +++ b/zonesettingsortquerystringforcach_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingSortQueryStringForCachUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingSortQueryStringForCachUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SortQueryStringForCaches.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingSortQueryStringForCachUpdate(t *testing.T) { } func TestZoneSettingSortQueryStringForCachList(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 @@ -52,8 +56,10 @@ func TestZoneSettingSortQueryStringForCachList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SortQueryStringForCaches.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingssl_test.go b/zonesettingssl_test.go index 71fdf6c1ada..4db0029563b 100644 --- a/zonesettingssl_test.go +++ b/zonesettingssl_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingSslUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingSslUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Ssls.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingSslUpdate(t *testing.T) { } func TestZoneSettingSslList(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 @@ -52,8 +56,10 @@ func TestZoneSettingSslList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Ssls.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingsslrecommender.go b/zonesettingsslrecommender.go index 32888c97c51..e1876582015 100644 --- a/zonesettingsslrecommender.go +++ b/zonesettingsslrecommender.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "net/http" - "time" "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" "github.com/cloudflare/cloudflare-sdk-go/internal/param" @@ -55,10 +54,7 @@ func (r *ZoneSettingSslRecommenderService) List(ctx context.Context, zoneIdentif type ZoneSettingSslRecommenderUpdateResponse struct { Errors []ZoneSettingSslRecommenderUpdateResponseError `json:"errors"` Messages []ZoneSettingSslRecommenderUpdateResponseMessage `json:"messages"` - // Enrollment in the SSL/TLS Recommender service which tries to detect and - // recommend (by sending periodic emails) the most secure SSL/TLS setting your - // origin servers support. - Result ZoneSettingSslRecommenderUpdateResponseResult `json:"result"` + Result ZoneSettingSslRecommenderUpdateResponseResult `json:"result"` // Whether the API call was successful Success bool `json:"success"` JSON zoneSettingSslRecommenderUpdateResponseJSON `json:"-"` @@ -117,29 +113,19 @@ func (r *ZoneSettingSslRecommenderUpdateResponseMessage) UnmarshalJSON(data []by return apijson.UnmarshalRoot(data, r) } -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. type ZoneSettingSslRecommenderUpdateResponseResult struct { // Enrollment value for SSL/TLS Recommender. ID ZoneSettingSslRecommenderUpdateResponseResultID `json:"id"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable ZoneSettingSslRecommenderUpdateResponseResultEditable `json:"editable"` // ssl-recommender enrollment setting. - Enabled bool `json:"enabled"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON zoneSettingSslRecommenderUpdateResponseResultJSON `json:"-"` + Enabled bool `json:"enabled"` + JSON zoneSettingSslRecommenderUpdateResponseResultJSON `json:"-"` } // zoneSettingSslRecommenderUpdateResponseResultJSON contains the JSON metadata for // the struct [ZoneSettingSslRecommenderUpdateResponseResult] type zoneSettingSslRecommenderUpdateResponseResultJSON struct { ID apijson.Field - Editable apijson.Field Enabled apijson.Field - ModifiedOn apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -155,22 +141,10 @@ const ( ZoneSettingSslRecommenderUpdateResponseResultIDSslRecommender ZoneSettingSslRecommenderUpdateResponseResultID = "ssl_recommender" ) -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingSslRecommenderUpdateResponseResultEditable bool - -const ( - ZoneSettingSslRecommenderUpdateResponseResultEditableTrue ZoneSettingSslRecommenderUpdateResponseResultEditable = true - ZoneSettingSslRecommenderUpdateResponseResultEditableFalse ZoneSettingSslRecommenderUpdateResponseResultEditable = false -) - type ZoneSettingSslRecommenderListResponse struct { Errors []ZoneSettingSslRecommenderListResponseError `json:"errors"` Messages []ZoneSettingSslRecommenderListResponseMessage `json:"messages"` - // Enrollment in the SSL/TLS Recommender service which tries to detect and - // recommend (by sending periodic emails) the most secure SSL/TLS setting your - // origin servers support. - Result ZoneSettingSslRecommenderListResponseResult `json:"result"` + Result ZoneSettingSslRecommenderListResponseResult `json:"result"` // Whether the API call was successful Success bool `json:"success"` JSON zoneSettingSslRecommenderListResponseJSON `json:"-"` @@ -229,29 +203,19 @@ func (r *ZoneSettingSslRecommenderListResponseMessage) UnmarshalJSON(data []byte return apijson.UnmarshalRoot(data, r) } -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. type ZoneSettingSslRecommenderListResponseResult struct { // Enrollment value for SSL/TLS Recommender. ID ZoneSettingSslRecommenderListResponseResultID `json:"id"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable ZoneSettingSslRecommenderListResponseResultEditable `json:"editable"` // ssl-recommender enrollment setting. - Enabled bool `json:"enabled"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON zoneSettingSslRecommenderListResponseResultJSON `json:"-"` + Enabled bool `json:"enabled"` + JSON zoneSettingSslRecommenderListResponseResultJSON `json:"-"` } // zoneSettingSslRecommenderListResponseResultJSON contains the JSON metadata for // the struct [ZoneSettingSslRecommenderListResponseResult] type zoneSettingSslRecommenderListResponseResultJSON struct { ID apijson.Field - Editable apijson.Field Enabled apijson.Field - ModifiedOn apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -267,19 +231,7 @@ const ( ZoneSettingSslRecommenderListResponseResultIDSslRecommender ZoneSettingSslRecommenderListResponseResultID = "ssl_recommender" ) -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingSslRecommenderListResponseResultEditable bool - -const ( - ZoneSettingSslRecommenderListResponseResultEditableTrue ZoneSettingSslRecommenderListResponseResultEditable = true - ZoneSettingSslRecommenderListResponseResultEditableFalse ZoneSettingSslRecommenderListResponseResultEditable = false -) - type ZoneSettingSslRecommenderUpdateParams struct { - // Enrollment in the SSL/TLS Recommender service which tries to detect and - // recommend (by sending periodic emails) the most secure SSL/TLS setting your - // origin servers support. Value param.Field[ZoneSettingSslRecommenderUpdateParamsValue] `json:"value,required"` } @@ -287,9 +239,6 @@ func (r ZoneSettingSslRecommenderUpdateParams) MarshalJSON() (data []byte, err e return apijson.MarshalRoot(r) } -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. type ZoneSettingSslRecommenderUpdateParamsValue struct { // Enrollment value for SSL/TLS Recommender. ID param.Field[ZoneSettingSslRecommenderUpdateParamsValueID] `json:"id"` @@ -307,12 +256,3 @@ type ZoneSettingSslRecommenderUpdateParamsValueID string const ( ZoneSettingSslRecommenderUpdateParamsValueIDSslRecommender ZoneSettingSslRecommenderUpdateParamsValueID = "ssl_recommender" ) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type ZoneSettingSslRecommenderUpdateParamsValueEditable bool - -const ( - ZoneSettingSslRecommenderUpdateParamsValueEditableTrue ZoneSettingSslRecommenderUpdateParamsValueEditable = true - ZoneSettingSslRecommenderUpdateParamsValueEditableFalse ZoneSettingSslRecommenderUpdateParamsValueEditable = false -) diff --git a/zonesettingsslrecommender_test.go b/zonesettingsslrecommender_test.go index 2b2f711049d..e50dfec4f16 100644 --- a/zonesettingsslrecommender_test.go +++ b/zonesettingsslrecommender_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingSslRecommenderUpdateWithOptionalParams(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 @@ -23,8 +24,10 @@ func TestZoneSettingSslRecommenderUpdateWithOptionalParams(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SslRecommenders.Update( context.TODO(), @@ -46,6 +49,7 @@ func TestZoneSettingSslRecommenderUpdateWithOptionalParams(t *testing.T) { } func TestZoneSettingSslRecommenderList(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 @@ -55,8 +59,10 @@ func TestZoneSettingSslRecommenderList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.SslRecommenders.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingtls13_test.go b/zonesettingtls13_test.go index 88d55cb0237..ecb73891cc5 100644 --- a/zonesettingtls13_test.go +++ b/zonesettingtls13_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingTls1_3Update(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 @@ -23,8 +24,10 @@ func TestZoneSettingTls1_3Update(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Tls1_3s.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingTls1_3Update(t *testing.T) { } func TestZoneSettingTls1_3List(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 @@ -52,8 +56,10 @@ func TestZoneSettingTls1_3List(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Tls1_3s.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingtlsclientauth_test.go b/zonesettingtlsclientauth_test.go index e221059e799..3bdf0d2e32d 100644 --- a/zonesettingtlsclientauth_test.go +++ b/zonesettingtlsclientauth_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingTlsClientAuthUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingTlsClientAuthUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.TlsClientAuths.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingTlsClientAuthUpdate(t *testing.T) { } func TestZoneSettingTlsClientAuthList(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 @@ -52,8 +56,10 @@ func TestZoneSettingTlsClientAuthList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.TlsClientAuths.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingtrueclientipheader_test.go b/zonesettingtrueclientipheader_test.go index 2950e5acd49..75adaa40473 100644 --- a/zonesettingtrueclientipheader_test.go +++ b/zonesettingtrueclientipheader_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingTrueClientIPHeaderUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingTrueClientIPHeaderUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.TrueClientIPHeaders.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingTrueClientIPHeaderUpdate(t *testing.T) { } func TestZoneSettingTrueClientIPHeaderList(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 @@ -52,8 +56,10 @@ func TestZoneSettingTrueClientIPHeaderList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.TrueClientIPHeaders.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingwaf_test.go b/zonesettingwaf_test.go index 4b0334df6de..a73679018ad 100644 --- a/zonesettingwaf_test.go +++ b/zonesettingwaf_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingWafUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingWafUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Wafs.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingWafUpdate(t *testing.T) { } func TestZoneSettingWafList(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 @@ -52,8 +56,10 @@ func TestZoneSettingWafList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Wafs.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingwebp_test.go b/zonesettingwebp_test.go index 62c1e8a6c09..ad9bfb97fa0 100644 --- a/zonesettingwebp_test.go +++ b/zonesettingwebp_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingWebpUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingWebpUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Webps.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingWebpUpdate(t *testing.T) { } func TestZoneSettingWebpList(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 @@ -52,8 +56,10 @@ func TestZoneSettingWebpList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Webps.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingwebsocket_test.go b/zonesettingwebsocket_test.go index a6828a0af4e..ce685702b5a 100644 --- a/zonesettingwebsocket_test.go +++ b/zonesettingwebsocket_test.go @@ -14,6 +14,7 @@ import ( ) func TestZoneSettingWebsocketUpdate(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 @@ -23,8 +24,10 @@ func TestZoneSettingWebsocketUpdate(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Websockets.Update( context.TODO(), @@ -43,6 +46,7 @@ func TestZoneSettingWebsocketUpdate(t *testing.T) { } func TestZoneSettingWebsocketList(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 @@ -52,8 +56,10 @@ func TestZoneSettingWebsocketList(t *testing.T) { } client := cloudflare.NewClient( option.WithBaseURL(baseURL), + option.WithAPIEmail("dev@cloudflare.com"), option.WithAPIKey("my-cloudflare-api-key"), - option.WithEmail("dev@cloudflare.com"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), ) _, err := client.Zones.Settings.Websockets.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { diff --git a/zonesettingzaraz.go b/zonesettingzaraz.go new file mode 100644 index 00000000000..650ca551fac --- /dev/null +++ b/zonesettingzaraz.go @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZarazService 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 [NewZoneSettingZarazService] method +// instead. +type ZoneSettingZarazService struct { + Options []option.RequestOption + Config *ZoneSettingZarazConfigService + Default *ZoneSettingZarazDefaultService + Export *ZoneSettingZarazExportService + History *ZoneSettingZarazHistoryService + ConfigHistory *ZoneSettingZarazConfigHistoryService + Publish *ZoneSettingZarazPublishService +} + +// NewZoneSettingZarazService 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 NewZoneSettingZarazService(opts ...option.RequestOption) (r *ZoneSettingZarazService) { + r = &ZoneSettingZarazService{} + r.Options = opts + r.Config = NewZoneSettingZarazConfigService(opts...) + r.Default = NewZoneSettingZarazDefaultService(opts...) + r.Export = NewZoneSettingZarazExportService(opts...) + r.History = NewZoneSettingZarazHistoryService(opts...) + r.ConfigHistory = NewZoneSettingZarazConfigHistoryService(opts...) + r.Publish = NewZoneSettingZarazPublishService(opts...) + return +} diff --git a/zonesettingzarazconfig.go b/zonesettingzarazconfig.go new file mode 100644 index 00000000000..8a2e9cae73e --- /dev/null +++ b/zonesettingzarazconfig.go @@ -0,0 +1,420 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZarazConfigService 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 [NewZoneSettingZarazConfigService] +// method instead. +type ZoneSettingZarazConfigService struct { + Options []option.RequestOption +} + +// NewZoneSettingZarazConfigService 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 NewZoneSettingZarazConfigService(opts ...option.RequestOption) (r *ZoneSettingZarazConfigService) { + r = &ZoneSettingZarazConfigService{} + r.Options = opts + return +} + +// Gets latest Zaraz configuration for a zone. It can be preview or published +// configuration, whichever was the last updated. Secret variables values will not +// be included. +func (r *ZoneSettingZarazConfigService) Get(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZarazConfigResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/config", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates Zaraz configuration for a zone. +func (r *ZoneSettingZarazConfigService) Update(ctx context.Context, zoneIdentifier string, body ZoneSettingZarazConfigUpdateParams, opts ...option.RequestOption) (res *ZarazConfigResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/config", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZarazConfigResponse struct { + Errors []ZarazConfigResponseError `json:"errors"` + Messages []ZarazConfigResponseMessage `json:"messages"` + Result ZarazConfigResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zarazConfigResponseJSON `json:"-"` +} + +// zarazConfigResponseJSON contains the JSON metadata for the struct +// [ZarazConfigResponse] +type zarazConfigResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZarazConfigResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zarazConfigResponseErrorJSON `json:"-"` +} + +// zarazConfigResponseErrorJSON contains the JSON metadata for the struct +// [ZarazConfigResponseError] +type zarazConfigResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZarazConfigResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zarazConfigResponseMessageJSON `json:"-"` +} + +// zarazConfigResponseMessageJSON contains the JSON metadata for the struct +// [ZarazConfigResponseMessage] +type zarazConfigResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZarazConfigResponseResult struct { + // Consent management configuration. + Consent ZarazConfigResponseResultConsent `json:"consent"` + // Data layer compatibility mode enabled. + DataLayer bool `json:"dataLayer"` + // The key for Zaraz debug mode. + DebugKey string `json:"debugKey"` + // Single Page Application support enabled. + HistoryChange bool `json:"historyChange"` + // General Zaraz settings. + Settings ZarazConfigResponseResultSettings `json:"settings"` + // Tools set up under Zaraz configuration, where key is the alpha-numeric tool ID + // and value is the tool configuration object. + Tools interface{} `json:"tools"` + // Triggers set up under Zaraz configuration, where key is the trigger + // alpha-numeric ID and value is the trigger configuration. + Triggers interface{} `json:"triggers"` + // Variables set up under Zaraz configuration, where key is the variable + // alpha-numeric ID and value is the variable configuration. Values of variables of + // type secret are not included. + Variables interface{} `json:"variables"` + // Zaraz internal version of the config. + ZarazVersion int64 `json:"zarazVersion"` + JSON zarazConfigResponseResultJSON `json:"-"` +} + +// zarazConfigResponseResultJSON contains the JSON metadata for the struct +// [ZarazConfigResponseResult] +type zarazConfigResponseResultJSON struct { + Consent apijson.Field + DataLayer apijson.Field + DebugKey apijson.Field + HistoryChange apijson.Field + Settings apijson.Field + Tools apijson.Field + Triggers apijson.Field + Variables apijson.Field + ZarazVersion apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Consent management configuration. +type ZarazConfigResponseResultConsent struct { + Enabled bool `json:"enabled,required"` + ButtonTextTranslations ZarazConfigResponseResultConsentButtonTextTranslations `json:"buttonTextTranslations"` + CompanyEmail string `json:"companyEmail"` + CompanyName string `json:"companyName"` + CompanyStreetAddress string `json:"companyStreetAddress"` + ConsentModalIntroHTML string `json:"consentModalIntroHTML"` + // Object where keys are language codes + ConsentModalIntroHTMLWithTranslations interface{} `json:"consentModalIntroHTMLWithTranslations"` + CookieName string `json:"cookieName"` + CustomCss string `json:"customCSS"` + CustomIntroDisclaimerDismissed bool `json:"customIntroDisclaimerDismissed"` + DefaultLanguage string `json:"defaultLanguage"` + HideModal bool `json:"hideModal"` + // Object where keys are purpose alpha-numeric IDs + Purposes interface{} `json:"purposes"` + // Object where keys are purpose alpha-numeric IDs + PurposesWithTranslations interface{} `json:"purposesWithTranslations"` + JSON zarazConfigResponseResultConsentJSON `json:"-"` +} + +// zarazConfigResponseResultConsentJSON contains the JSON metadata for the struct +// [ZarazConfigResponseResultConsent] +type zarazConfigResponseResultConsentJSON struct { + Enabled apijson.Field + ButtonTextTranslations apijson.Field + CompanyEmail apijson.Field + CompanyName apijson.Field + CompanyStreetAddress apijson.Field + ConsentModalIntroHTML apijson.Field + ConsentModalIntroHTMLWithTranslations apijson.Field + CookieName apijson.Field + CustomCss apijson.Field + CustomIntroDisclaimerDismissed apijson.Field + DefaultLanguage apijson.Field + HideModal apijson.Field + Purposes apijson.Field + PurposesWithTranslations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponseResultConsent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZarazConfigResponseResultConsentButtonTextTranslations struct { + // Object where keys are language codes + AcceptAll interface{} `json:"accept_all,required"` + // Object where keys are language codes + ConfirmMyChoices interface{} `json:"confirm_my_choices,required"` + // Object where keys are language codes + RejectAll interface{} `json:"reject_all,required"` + JSON zarazConfigResponseResultConsentButtonTextTranslationsJSON `json:"-"` +} + +// zarazConfigResponseResultConsentButtonTextTranslationsJSON contains the JSON +// metadata for the struct [ZarazConfigResponseResultConsentButtonTextTranslations] +type zarazConfigResponseResultConsentButtonTextTranslationsJSON struct { + AcceptAll apijson.Field + ConfirmMyChoices apijson.Field + RejectAll apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponseResultConsentButtonTextTranslations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// General Zaraz settings. +type ZarazConfigResponseResultSettings struct { + // Automatic injection of Zaraz scripts enabled. + AutoInjectScript bool `json:"autoInjectScript,required"` + // Details of the worker that receives and edits Zaraz Context object. + ContextEnricher ZarazConfigResponseResultSettingsContextEnricher `json:"contextEnricher"` + // The domain Zaraz will use for writing and reading its cookies. + CookieDomain string `json:"cookieDomain"` + // Ecommerce API enabled. + Ecommerce bool `json:"ecommerce"` + // Custom endpoint for server-side track events. + EventsAPIPath string `json:"eventsApiPath"` + // Hiding external referrer URL enabled. + HideExternalReferer bool `json:"hideExternalReferer"` + // Trimming IP address enabled. + HideIPAddress bool `json:"hideIPAddress"` + // Removing URL query params enabled. + HideQueryParams bool `json:"hideQueryParams"` + // Removing sensitive data from User Aagent string enabled. + HideUserAgent bool `json:"hideUserAgent"` + // Custom endpoint for Zaraz init script. + InitPath string `json:"initPath"` + // Injection of Zaraz scripts into iframes enabled. + InjectIframes bool `json:"injectIframes"` + // Custom path for Managed Components server functionalities. + McRootPath string `json:"mcRootPath"` + // Custom endpoint for Zaraz main script. + ScriptPath string `json:"scriptPath"` + // Custom endpoint for Zaraz tracking requests. + TrackPath string `json:"trackPath"` + JSON zarazConfigResponseResultSettingsJSON `json:"-"` +} + +// zarazConfigResponseResultSettingsJSON contains the JSON metadata for the struct +// [ZarazConfigResponseResultSettings] +type zarazConfigResponseResultSettingsJSON struct { + AutoInjectScript apijson.Field + ContextEnricher apijson.Field + CookieDomain apijson.Field + Ecommerce apijson.Field + EventsAPIPath apijson.Field + HideExternalReferer apijson.Field + HideIPAddress apijson.Field + HideQueryParams apijson.Field + HideUserAgent apijson.Field + InitPath apijson.Field + InjectIframes apijson.Field + McRootPath apijson.Field + ScriptPath apijson.Field + TrackPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponseResultSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details of the worker that receives and edits Zaraz Context object. +type ZarazConfigResponseResultSettingsContextEnricher struct { + EscapedWorkerName string `json:"escapedWorkerName,required"` + WorkerTag string `json:"workerTag,required"` + JSON zarazConfigResponseResultSettingsContextEnricherJSON `json:"-"` +} + +// zarazConfigResponseResultSettingsContextEnricherJSON contains the JSON metadata +// for the struct [ZarazConfigResponseResultSettingsContextEnricher] +type zarazConfigResponseResultSettingsContextEnricherJSON struct { + EscapedWorkerName apijson.Field + WorkerTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazConfigResponseResultSettingsContextEnricher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazConfigUpdateParams struct { + // Consent management configuration. + Consent param.Field[ZoneSettingZarazConfigUpdateParamsConsent] `json:"consent"` + // Data layer compatibility mode enabled. + DataLayer param.Field[bool] `json:"dataLayer"` + // The key for Zaraz debug mode. + DebugKey param.Field[string] `json:"debugKey"` + // Single Page Application support enabled. + HistoryChange param.Field[bool] `json:"historyChange"` + // General Zaraz settings. + Settings param.Field[ZoneSettingZarazConfigUpdateParamsSettings] `json:"settings"` + // Tools set up under Zaraz configuration, where key is the alpha-numeric tool ID + // and value is the tool configuration object. + Tools param.Field[interface{}] `json:"tools"` + // Triggers set up under Zaraz configuration, where key is the trigger + // alpha-numeric ID and value is the trigger configuration. + Triggers param.Field[interface{}] `json:"triggers"` + // Variables set up under Zaraz configuration, where key is the variable + // alpha-numeric ID and value is the variable configuration. Values of variables of + // type secret are not included. + Variables param.Field[interface{}] `json:"variables"` + // Zaraz internal version of the config. + ZarazVersion param.Field[int64] `json:"zarazVersion"` +} + +func (r ZoneSettingZarazConfigUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Consent management configuration. +type ZoneSettingZarazConfigUpdateParamsConsent struct { + Enabled param.Field[bool] `json:"enabled,required"` + ButtonTextTranslations param.Field[ZoneSettingZarazConfigUpdateParamsConsentButtonTextTranslations] `json:"buttonTextTranslations"` + CompanyEmail param.Field[string] `json:"companyEmail"` + CompanyName param.Field[string] `json:"companyName"` + CompanyStreetAddress param.Field[string] `json:"companyStreetAddress"` + ConsentModalIntroHTML param.Field[string] `json:"consentModalIntroHTML"` + // Object where keys are language codes + ConsentModalIntroHTMLWithTranslations param.Field[interface{}] `json:"consentModalIntroHTMLWithTranslations"` + CookieName param.Field[string] `json:"cookieName"` + CustomCss param.Field[string] `json:"customCSS"` + CustomIntroDisclaimerDismissed param.Field[bool] `json:"customIntroDisclaimerDismissed"` + DefaultLanguage param.Field[string] `json:"defaultLanguage"` + HideModal param.Field[bool] `json:"hideModal"` + // Object where keys are purpose alpha-numeric IDs + Purposes param.Field[interface{}] `json:"purposes"` + // Object where keys are purpose alpha-numeric IDs + PurposesWithTranslations param.Field[interface{}] `json:"purposesWithTranslations"` +} + +func (r ZoneSettingZarazConfigUpdateParamsConsent) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSettingZarazConfigUpdateParamsConsentButtonTextTranslations struct { + // Object where keys are language codes + AcceptAll param.Field[interface{}] `json:"accept_all,required"` + // Object where keys are language codes + ConfirmMyChoices param.Field[interface{}] `json:"confirm_my_choices,required"` + // Object where keys are language codes + RejectAll param.Field[interface{}] `json:"reject_all,required"` +} + +func (r ZoneSettingZarazConfigUpdateParamsConsentButtonTextTranslations) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// General Zaraz settings. +type ZoneSettingZarazConfigUpdateParamsSettings struct { + // Automatic injection of Zaraz scripts enabled. + AutoInjectScript param.Field[bool] `json:"autoInjectScript,required"` + // Details of the worker that receives and edits Zaraz Context object. + ContextEnricher param.Field[ZoneSettingZarazConfigUpdateParamsSettingsContextEnricher] `json:"contextEnricher"` + // The domain Zaraz will use for writing and reading its cookies. + CookieDomain param.Field[string] `json:"cookieDomain"` + // Ecommerce API enabled. + Ecommerce param.Field[bool] `json:"ecommerce"` + // Custom endpoint for server-side track events. + EventsAPIPath param.Field[string] `json:"eventsApiPath"` + // Hiding external referrer URL enabled. + HideExternalReferer param.Field[bool] `json:"hideExternalReferer"` + // Trimming IP address enabled. + HideIPAddress param.Field[bool] `json:"hideIPAddress"` + // Removing URL query params enabled. + HideQueryParams param.Field[bool] `json:"hideQueryParams"` + // Removing sensitive data from User Aagent string enabled. + HideUserAgent param.Field[bool] `json:"hideUserAgent"` + // Custom endpoint for Zaraz init script. + InitPath param.Field[string] `json:"initPath"` + // Injection of Zaraz scripts into iframes enabled. + InjectIframes param.Field[bool] `json:"injectIframes"` + // Custom path for Managed Components server functionalities. + McRootPath param.Field[string] `json:"mcRootPath"` + // Custom endpoint for Zaraz main script. + ScriptPath param.Field[string] `json:"scriptPath"` + // Custom endpoint for Zaraz tracking requests. + TrackPath param.Field[string] `json:"trackPath"` +} + +func (r ZoneSettingZarazConfigUpdateParamsSettings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Details of the worker that receives and edits Zaraz Context object. +type ZoneSettingZarazConfigUpdateParamsSettingsContextEnricher struct { + EscapedWorkerName param.Field[string] `json:"escapedWorkerName,required"` + WorkerTag param.Field[string] `json:"workerTag,required"` +} + +func (r ZoneSettingZarazConfigUpdateParamsSettingsContextEnricher) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonesettingzarazconfig_test.go b/zonesettingzarazconfig_test.go new file mode 100644 index 00000000000..7c2501afd94 --- /dev/null +++ b/zonesettingzarazconfig_test.go @@ -0,0 +1,117 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingZarazConfigGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.Config.Get(context.TODO(), "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()) + } +} + +func TestZoneSettingZarazConfigUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.Config.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSettingZarazConfigUpdateParams{ + Consent: cloudflare.F(cloudflare.ZoneSettingZarazConfigUpdateParamsConsent{ + ButtonTextTranslations: cloudflare.F(cloudflare.ZoneSettingZarazConfigUpdateParamsConsentButtonTextTranslations{ + AcceptAll: cloudflare.F[any](map[string]interface{}{}), + ConfirmMyChoices: cloudflare.F[any](map[string]interface{}{}), + RejectAll: cloudflare.F[any](map[string]interface{}{}), + }), + CompanyEmail: cloudflare.F("string"), + CompanyName: cloudflare.F("string"), + CompanyStreetAddress: cloudflare.F("string"), + ConsentModalIntroHTML: cloudflare.F("string"), + ConsentModalIntroHTMLWithTranslations: cloudflare.F[any](map[string]interface{}{}), + CookieName: cloudflare.F("string"), + CustomCss: cloudflare.F("string"), + CustomIntroDisclaimerDismissed: cloudflare.F(true), + DefaultLanguage: cloudflare.F("string"), + Enabled: cloudflare.F(true), + HideModal: cloudflare.F(true), + Purposes: cloudflare.F[any](map[string]interface{}{}), + PurposesWithTranslations: cloudflare.F[any](map[string]interface{}{}), + }), + DataLayer: cloudflare.F(true), + DebugKey: cloudflare.F("string"), + HistoryChange: cloudflare.F(true), + Settings: cloudflare.F(cloudflare.ZoneSettingZarazConfigUpdateParamsSettings{ + AutoInjectScript: cloudflare.F(true), + ContextEnricher: cloudflare.F(cloudflare.ZoneSettingZarazConfigUpdateParamsSettingsContextEnricher{ + EscapedWorkerName: cloudflare.F("string"), + WorkerTag: cloudflare.F("string"), + }), + CookieDomain: cloudflare.F("string"), + Ecommerce: cloudflare.F(true), + EventsAPIPath: cloudflare.F("string"), + HideExternalReferer: cloudflare.F(true), + HideIPAddress: cloudflare.F(true), + HideQueryParams: cloudflare.F(true), + HideUserAgent: cloudflare.F(true), + InitPath: cloudflare.F("string"), + InjectIframes: cloudflare.F(true), + McRootPath: cloudflare.F("string"), + ScriptPath: cloudflare.F("string"), + TrackPath: cloudflare.F("string"), + }), + Tools: cloudflare.F[any](map[string]interface{}{}), + Triggers: cloudflare.F[any](map[string]interface{}{}), + Variables: cloudflare.F[any](map[string]interface{}{}), + ZarazVersion: cloudflare.F(int64(0)), + }, + ) + 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/zonesettingzarazconfighistory.go b/zonesettingzarazconfighistory.go new file mode 100644 index 00000000000..ccda996b3dc --- /dev/null +++ b/zonesettingzarazconfighistory.go @@ -0,0 +1,119 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZarazConfigHistoryService 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 +// [NewZoneSettingZarazConfigHistoryService] method instead. +type ZoneSettingZarazConfigHistoryService struct { + Options []option.RequestOption +} + +// NewZoneSettingZarazConfigHistoryService 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 NewZoneSettingZarazConfigHistoryService(opts ...option.RequestOption) (r *ZoneSettingZarazConfigHistoryService) { + r = &ZoneSettingZarazConfigHistoryService{} + r.Options = opts + return +} + +// Gets a history of published Zaraz configurations by ID(s) for a zone. +func (r *ZoneSettingZarazConfigHistoryService) Get(ctx context.Context, zoneIdentifier string, query ZoneSettingZarazConfigHistoryGetParams, opts ...option.RequestOption) (res *ZoneSettingZarazConfigHistoryGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/history/configs", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSettingZarazConfigHistoryGetResponse struct { + Errors []ZoneSettingZarazConfigHistoryGetResponseError `json:"errors"` + Messages []ZoneSettingZarazConfigHistoryGetResponseMessage `json:"messages"` + // Object where keys are numericc onfiguration IDs + Result interface{} `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingZarazConfigHistoryGetResponseJSON `json:"-"` +} + +// zoneSettingZarazConfigHistoryGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingZarazConfigHistoryGetResponse] +type zoneSettingZarazConfigHistoryGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazConfigHistoryGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazConfigHistoryGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZarazConfigHistoryGetResponseErrorJSON `json:"-"` +} + +// zoneSettingZarazConfigHistoryGetResponseErrorJSON contains the JSON metadata for +// the struct [ZoneSettingZarazConfigHistoryGetResponseError] +type zoneSettingZarazConfigHistoryGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazConfigHistoryGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazConfigHistoryGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZarazConfigHistoryGetResponseMessageJSON `json:"-"` +} + +// zoneSettingZarazConfigHistoryGetResponseMessageJSON contains the JSON metadata +// for the struct [ZoneSettingZarazConfigHistoryGetResponseMessage] +type zoneSettingZarazConfigHistoryGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazConfigHistoryGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazConfigHistoryGetParams struct { + // Comma separated list of Zaraz configuration IDs + IDs param.Field[[]int64] `query:"ids,required"` +} + +// URLQuery serializes [ZoneSettingZarazConfigHistoryGetParams]'s query parameters +// as `url.Values`. +func (r ZoneSettingZarazConfigHistoryGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zonesettingzarazconfighistory_test.go b/zonesettingzarazconfighistory_test.go new file mode 100644 index 00000000000..041eceae7ac --- /dev/null +++ b/zonesettingzarazconfighistory_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingZarazConfigHistoryGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.ConfigHistory.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSettingZarazConfigHistoryGetParams{ + IDs: cloudflare.F([]int64{int64(0), int64(0), int64(0)}), + }, + ) + 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/zonesettingzarazdefault.go b/zonesettingzarazdefault.go new file mode 100644 index 00000000000..1d61baca170 --- /dev/null +++ b/zonesettingzarazdefault.go @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZarazDefaultService 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 +// [NewZoneSettingZarazDefaultService] method instead. +type ZoneSettingZarazDefaultService struct { + Options []option.RequestOption +} + +// NewZoneSettingZarazDefaultService 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 NewZoneSettingZarazDefaultService(opts ...option.RequestOption) (r *ZoneSettingZarazDefaultService) { + r = &ZoneSettingZarazDefaultService{} + r.Options = opts + return +} + +// Gets default Zaraz configuration for a zone. +func (r *ZoneSettingZarazDefaultService) Get(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZarazConfigResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/default", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} diff --git a/zonesettingzarazdefault_test.go b/zonesettingzarazdefault_test.go new file mode 100644 index 00000000000..9d35ee6ded9 --- /dev/null +++ b/zonesettingzarazdefault_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingZarazDefaultGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.Default.Get(context.TODO(), "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/zonesettingzarazexport.go b/zonesettingzarazexport.go new file mode 100644 index 00000000000..b77fe31931e --- /dev/null +++ b/zonesettingzarazexport.go @@ -0,0 +1,237 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZarazExportService 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 [NewZoneSettingZarazExportService] +// method instead. +type ZoneSettingZarazExportService struct { + Options []option.RequestOption +} + +// NewZoneSettingZarazExportService 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 NewZoneSettingZarazExportService(opts ...option.RequestOption) (r *ZoneSettingZarazExportService) { + r = &ZoneSettingZarazExportService{} + r.Options = opts + return +} + +// Exports full current published Zaraz configuration for a zone, secret variables +// included. +func (r *ZoneSettingZarazExportService) Get(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSettingZarazExportGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/export", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSettingZarazExportGetResponse struct { + // Consent management configuration. + Consent ZoneSettingZarazExportGetResponseConsent `json:"consent"` + // Data layer compatibility mode enabled. + DataLayer bool `json:"dataLayer"` + // The key for Zaraz debug mode. + DebugKey string `json:"debugKey"` + // Single Page Application support enabled. + HistoryChange bool `json:"historyChange"` + // General Zaraz settings. + Settings ZoneSettingZarazExportGetResponseSettings `json:"settings"` + // Tools set up under Zaraz configuration, where key is the alpha-numeric tool ID + // and value is the tool configuration object. + Tools interface{} `json:"tools"` + // Triggers set up under Zaraz configuration, where key is the trigger + // alpha-numeric ID and value is the trigger configuration. + Triggers interface{} `json:"triggers"` + // Variables set up under Zaraz configuration, where key is the variable + // alpha-numeric ID and value is the variable configuration. Values of variables of + // type secret are not included. + Variables interface{} `json:"variables"` + // Zaraz internal version of the config. + ZarazVersion int64 `json:"zarazVersion"` + JSON zoneSettingZarazExportGetResponseJSON `json:"-"` +} + +// zoneSettingZarazExportGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingZarazExportGetResponse] +type zoneSettingZarazExportGetResponseJSON struct { + Consent apijson.Field + DataLayer apijson.Field + DebugKey apijson.Field + HistoryChange apijson.Field + Settings apijson.Field + Tools apijson.Field + Triggers apijson.Field + Variables apijson.Field + ZarazVersion apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazExportGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Consent management configuration. +type ZoneSettingZarazExportGetResponseConsent struct { + Enabled bool `json:"enabled,required"` + ButtonTextTranslations ZoneSettingZarazExportGetResponseConsentButtonTextTranslations `json:"buttonTextTranslations"` + CompanyEmail string `json:"companyEmail"` + CompanyName string `json:"companyName"` + CompanyStreetAddress string `json:"companyStreetAddress"` + ConsentModalIntroHTML string `json:"consentModalIntroHTML"` + // Object where keys are language codes + ConsentModalIntroHTMLWithTranslations interface{} `json:"consentModalIntroHTMLWithTranslations"` + CookieName string `json:"cookieName"` + CustomCss string `json:"customCSS"` + CustomIntroDisclaimerDismissed bool `json:"customIntroDisclaimerDismissed"` + DefaultLanguage string `json:"defaultLanguage"` + HideModal bool `json:"hideModal"` + // Object where keys are purpose alpha-numeric IDs + Purposes interface{} `json:"purposes"` + // Object where keys are purpose alpha-numeric IDs + PurposesWithTranslations interface{} `json:"purposesWithTranslations"` + JSON zoneSettingZarazExportGetResponseConsentJSON `json:"-"` +} + +// zoneSettingZarazExportGetResponseConsentJSON contains the JSON metadata for the +// struct [ZoneSettingZarazExportGetResponseConsent] +type zoneSettingZarazExportGetResponseConsentJSON struct { + Enabled apijson.Field + ButtonTextTranslations apijson.Field + CompanyEmail apijson.Field + CompanyName apijson.Field + CompanyStreetAddress apijson.Field + ConsentModalIntroHTML apijson.Field + ConsentModalIntroHTMLWithTranslations apijson.Field + CookieName apijson.Field + CustomCss apijson.Field + CustomIntroDisclaimerDismissed apijson.Field + DefaultLanguage apijson.Field + HideModal apijson.Field + Purposes apijson.Field + PurposesWithTranslations apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazExportGetResponseConsent) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazExportGetResponseConsentButtonTextTranslations struct { + // Object where keys are language codes + AcceptAll interface{} `json:"accept_all,required"` + // Object where keys are language codes + ConfirmMyChoices interface{} `json:"confirm_my_choices,required"` + // Object where keys are language codes + RejectAll interface{} `json:"reject_all,required"` + JSON zoneSettingZarazExportGetResponseConsentButtonTextTranslationsJSON `json:"-"` +} + +// zoneSettingZarazExportGetResponseConsentButtonTextTranslationsJSON contains the +// JSON metadata for the struct +// [ZoneSettingZarazExportGetResponseConsentButtonTextTranslations] +type zoneSettingZarazExportGetResponseConsentButtonTextTranslationsJSON struct { + AcceptAll apijson.Field + ConfirmMyChoices apijson.Field + RejectAll apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazExportGetResponseConsentButtonTextTranslations) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// General Zaraz settings. +type ZoneSettingZarazExportGetResponseSettings struct { + // Automatic injection of Zaraz scripts enabled. + AutoInjectScript bool `json:"autoInjectScript,required"` + // Details of the worker that receives and edits Zaraz Context object. + ContextEnricher ZoneSettingZarazExportGetResponseSettingsContextEnricher `json:"contextEnricher"` + // The domain Zaraz will use for writing and reading its cookies. + CookieDomain string `json:"cookieDomain"` + // Ecommerce API enabled. + Ecommerce bool `json:"ecommerce"` + // Custom endpoint for server-side track events. + EventsAPIPath string `json:"eventsApiPath"` + // Hiding external referrer URL enabled. + HideExternalReferer bool `json:"hideExternalReferer"` + // Trimming IP address enabled. + HideIPAddress bool `json:"hideIPAddress"` + // Removing URL query params enabled. + HideQueryParams bool `json:"hideQueryParams"` + // Removing sensitive data from User Aagent string enabled. + HideUserAgent bool `json:"hideUserAgent"` + // Custom endpoint for Zaraz init script. + InitPath string `json:"initPath"` + // Injection of Zaraz scripts into iframes enabled. + InjectIframes bool `json:"injectIframes"` + // Custom path for Managed Components server functionalities. + McRootPath string `json:"mcRootPath"` + // Custom endpoint for Zaraz main script. + ScriptPath string `json:"scriptPath"` + // Custom endpoint for Zaraz tracking requests. + TrackPath string `json:"trackPath"` + JSON zoneSettingZarazExportGetResponseSettingsJSON `json:"-"` +} + +// zoneSettingZarazExportGetResponseSettingsJSON contains the JSON metadata for the +// struct [ZoneSettingZarazExportGetResponseSettings] +type zoneSettingZarazExportGetResponseSettingsJSON struct { + AutoInjectScript apijson.Field + ContextEnricher apijson.Field + CookieDomain apijson.Field + Ecommerce apijson.Field + EventsAPIPath apijson.Field + HideExternalReferer apijson.Field + HideIPAddress apijson.Field + HideQueryParams apijson.Field + HideUserAgent apijson.Field + InitPath apijson.Field + InjectIframes apijson.Field + McRootPath apijson.Field + ScriptPath apijson.Field + TrackPath apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazExportGetResponseSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Details of the worker that receives and edits Zaraz Context object. +type ZoneSettingZarazExportGetResponseSettingsContextEnricher struct { + EscapedWorkerName string `json:"escapedWorkerName,required"` + WorkerTag string `json:"workerTag,required"` + JSON zoneSettingZarazExportGetResponseSettingsContextEnricherJSON `json:"-"` +} + +// zoneSettingZarazExportGetResponseSettingsContextEnricherJSON contains the JSON +// metadata for the struct +// [ZoneSettingZarazExportGetResponseSettingsContextEnricher] +type zoneSettingZarazExportGetResponseSettingsContextEnricherJSON struct { + EscapedWorkerName apijson.Field + WorkerTag apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazExportGetResponseSettingsContextEnricher) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingzarazexport_test.go b/zonesettingzarazexport_test.go new file mode 100644 index 00000000000..31df992dc61 --- /dev/null +++ b/zonesettingzarazexport_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingZarazExportGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.Export.Get(context.TODO(), "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/zonesettingzarazhistory.go b/zonesettingzarazhistory.go new file mode 100644 index 00000000000..b4f871897b3 --- /dev/null +++ b/zonesettingzarazhistory.go @@ -0,0 +1,191 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZarazHistoryService 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 +// [NewZoneSettingZarazHistoryService] method instead. +type ZoneSettingZarazHistoryService struct { + Options []option.RequestOption +} + +// NewZoneSettingZarazHistoryService 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 NewZoneSettingZarazHistoryService(opts ...option.RequestOption) (r *ZoneSettingZarazHistoryService) { + r = &ZoneSettingZarazHistoryService{} + r.Options = opts + return +} + +// Restores a historical published Zaraz configuration by ID for a zone. +func (r *ZoneSettingZarazHistoryService) Update(ctx context.Context, zoneIdentifier string, body ZoneSettingZarazHistoryUpdateParams, opts ...option.RequestOption) (res *ZarazConfigResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/history", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists a history of published Zaraz configuration records for a zone. +func (r *ZoneSettingZarazHistoryService) List(ctx context.Context, zoneIdentifier string, query ZoneSettingZarazHistoryListParams, opts ...option.RequestOption) (res *ZoneSettingZarazHistoryListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/history", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSettingZarazHistoryListResponse struct { + Errors []ZoneSettingZarazHistoryListResponseError `json:"errors"` + Messages []ZoneSettingZarazHistoryListResponseMessage `json:"messages"` + Result []ZoneSettingZarazHistoryListResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingZarazHistoryListResponseJSON `json:"-"` +} + +// zoneSettingZarazHistoryListResponseJSON contains the JSON metadata for the +// struct [ZoneSettingZarazHistoryListResponse] +type zoneSettingZarazHistoryListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazHistoryListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazHistoryListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZarazHistoryListResponseErrorJSON `json:"-"` +} + +// zoneSettingZarazHistoryListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSettingZarazHistoryListResponseError] +type zoneSettingZarazHistoryListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazHistoryListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazHistoryListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZarazHistoryListResponseMessageJSON `json:"-"` +} + +// zoneSettingZarazHistoryListResponseMessageJSON contains the JSON metadata for +// the struct [ZoneSettingZarazHistoryListResponseMessage] +type zoneSettingZarazHistoryListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazHistoryListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazHistoryListResponseResult struct { + // ID of the configuration + ID int64 `json:"id"` + // Date and time the configuration was created + CreatedAt time.Time `json:"createdAt" format:"date-time"` + // Configuration description provided by the user who published this configuration + Description string `json:"description"` + // Date and time the configuration was last updated + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + // Alpha-numeric ID of the account user who published the configuration + UserID string `json:"userId"` + JSON zoneSettingZarazHistoryListResponseResultJSON `json:"-"` +} + +// zoneSettingZarazHistoryListResponseResultJSON contains the JSON metadata for the +// struct [ZoneSettingZarazHistoryListResponseResult] +type zoneSettingZarazHistoryListResponseResultJSON struct { + ID apijson.Field + CreatedAt apijson.Field + Description apijson.Field + UpdatedAt apijson.Field + UserID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazHistoryListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazHistoryUpdateParams struct { + // ID of the Zaraz configuration to restore. + Body param.Field[int64] `json:"body,required"` +} + +func (r ZoneSettingZarazHistoryUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneSettingZarazHistoryListParams struct { + // Maximum amount of results to list. Default value is 10. + Limit param.Field[int64] `query:"limit"` + // Ordinal number to start listing the results with. Default value is 0. + Offset param.Field[int64] `query:"offset"` + // The field to sort by. Default is updated_at. + SortField param.Field[ZoneSettingZarazHistoryListParamsSortField] `query:"sortField"` + // Sorting order. Default is DESC. + SortOrder param.Field[ZoneSettingZarazHistoryListParamsSortOrder] `query:"sortOrder"` +} + +// URLQuery serializes [ZoneSettingZarazHistoryListParams]'s query parameters as +// `url.Values`. +func (r ZoneSettingZarazHistoryListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The field to sort by. Default is updated_at. +type ZoneSettingZarazHistoryListParamsSortField string + +const ( + ZoneSettingZarazHistoryListParamsSortFieldID ZoneSettingZarazHistoryListParamsSortField = "id" + ZoneSettingZarazHistoryListParamsSortFieldUserID ZoneSettingZarazHistoryListParamsSortField = "user_id" + ZoneSettingZarazHistoryListParamsSortFieldDescription ZoneSettingZarazHistoryListParamsSortField = "description" + ZoneSettingZarazHistoryListParamsSortFieldCreatedAt ZoneSettingZarazHistoryListParamsSortField = "created_at" + ZoneSettingZarazHistoryListParamsSortFieldUpdatedAt ZoneSettingZarazHistoryListParamsSortField = "updated_at" +) + +// Sorting order. Default is DESC. +type ZoneSettingZarazHistoryListParamsSortOrder string + +const ( + ZoneSettingZarazHistoryListParamsSortOrderDesc ZoneSettingZarazHistoryListParamsSortOrder = "DESC" + ZoneSettingZarazHistoryListParamsSortOrderAsc ZoneSettingZarazHistoryListParamsSortOrder = "ASC" +) diff --git a/zonesettingzarazhistory_test.go b/zonesettingzarazhistory_test.go new file mode 100644 index 00000000000..6bbdd3e77e0 --- /dev/null +++ b/zonesettingzarazhistory_test.go @@ -0,0 +1,81 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingZarazHistoryUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.History.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSettingZarazHistoryUpdateParams{ + Body: cloudflare.F(int64(12345)), + }, + ) + 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 TestZoneSettingZarazHistoryListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.History.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSettingZarazHistoryListParams{ + Limit: cloudflare.F(int64(1)), + Offset: cloudflare.F(int64(0)), + SortField: cloudflare.F(cloudflare.ZoneSettingZarazHistoryListParamsSortFieldID), + SortOrder: cloudflare.F(cloudflare.ZoneSettingZarazHistoryListParamsSortOrderDesc), + }, + ) + 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/zonesettingzarazpublish.go b/zonesettingzarazpublish.go new file mode 100644 index 00000000000..1b7c8c5ea17 --- /dev/null +++ b/zonesettingzarazpublish.go @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZarazPublishService 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 +// [NewZoneSettingZarazPublishService] method instead. +type ZoneSettingZarazPublishService struct { + Options []option.RequestOption +} + +// NewZoneSettingZarazPublishService 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 NewZoneSettingZarazPublishService(opts ...option.RequestOption) (r *ZoneSettingZarazPublishService) { + r = &ZoneSettingZarazPublishService{} + r.Options = opts + return +} + +// Publish current Zaraz preview configuration for a zone. +func (r *ZoneSettingZarazPublishService) New(ctx context.Context, zoneIdentifier string, body ZoneSettingZarazPublishNewParams, opts ...option.RequestOption) (res *ZoneSettingZarazPublishNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/publish", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneSettingZarazPublishNewResponse struct { + Errors []ZoneSettingZarazPublishNewResponseError `json:"errors"` + Messages []ZoneSettingZarazPublishNewResponseMessage `json:"messages"` + Result string `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingZarazPublishNewResponseJSON `json:"-"` +} + +// zoneSettingZarazPublishNewResponseJSON contains the JSON metadata for the struct +// [ZoneSettingZarazPublishNewResponse] +type zoneSettingZarazPublishNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazPublishNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazPublishNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZarazPublishNewResponseErrorJSON `json:"-"` +} + +// zoneSettingZarazPublishNewResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSettingZarazPublishNewResponseError] +type zoneSettingZarazPublishNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazPublishNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazPublishNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZarazPublishNewResponseMessageJSON `json:"-"` +} + +// zoneSettingZarazPublishNewResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSettingZarazPublishNewResponseMessage] +type zoneSettingZarazPublishNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZarazPublishNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZarazPublishNewParams struct { + // Zaraz configuration description. + Body param.Field[string] `json:"body,required"` +} + +func (r ZoneSettingZarazPublishNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} diff --git a/zonesettingzarazpublish_test.go b/zonesettingzarazpublish_test.go new file mode 100644 index 00000000000..838dd343b4a --- /dev/null +++ b/zonesettingzarazpublish_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingZarazPublishNew(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.Zaraz.Publish.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSettingZarazPublishNewParams{ + Body: cloudflare.F("Config with enabled ecommerce tracking"), + }, + ) + 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/zonesettingzerortt.go b/zonesettingzerortt.go new file mode 100644 index 00000000000..7e1e2a26e02 --- /dev/null +++ b/zonesettingzerortt.go @@ -0,0 +1,302 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZeroRttService 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 [NewZoneSettingZeroRttService] method +// instead. +type ZoneSettingZeroRttService struct { + Options []option.RequestOption +} + +// NewZoneSettingZeroRttService 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 NewZoneSettingZeroRttService(opts ...option.RequestOption) (r *ZoneSettingZeroRttService) { + r = &ZoneSettingZeroRttService{} + r.Options = opts + return +} + +// Gets 0-RTT session resumption setting. +func (r *ZoneSettingZeroRttService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSettingZeroRttListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/0rtt", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Changes the 0-RTT session resumption setting. +func (r *ZoneSettingZeroRttService) ZoneSettingsChange0RttSessionResumptionSetting(ctx context.Context, zoneIdentifier string, body ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParams, opts ...option.RequestOption) (res *ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/0rtt", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneSettingZeroRttListResponse struct { + Errors []ZoneSettingZeroRttListResponseError `json:"errors"` + Messages []ZoneSettingZeroRttListResponseMessage `json:"messages"` + // 0-RTT session resumption enabled for this zone. + Result ZoneSettingZeroRttListResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingZeroRttListResponseJSON `json:"-"` +} + +// zoneSettingZeroRttListResponseJSON contains the JSON metadata for the struct +// [ZoneSettingZeroRttListResponse] +type zoneSettingZeroRttListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRttListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRttListResponseErrorJSON `json:"-"` +} + +// zoneSettingZeroRttListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSettingZeroRttListResponseError] +type zoneSettingZeroRttListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRttListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRttListResponseMessageJSON `json:"-"` +} + +// zoneSettingZeroRttListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSettingZeroRttListResponseMessage] +type zoneSettingZeroRttListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingZeroRttListResponseResult struct { + // ID of the zone setting. + ID ZoneSettingZeroRttListResponseResultID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingZeroRttListResponseResultEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the 0-RTT setting. + Value ZoneSettingZeroRttListResponseResultValue `json:"value"` + JSON zoneSettingZeroRttListResponseResultJSON `json:"-"` +} + +// zoneSettingZeroRttListResponseResultJSON contains the JSON metadata for the +// struct [ZoneSettingZeroRttListResponseResult] +type zoneSettingZeroRttListResponseResultJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingZeroRttListResponseResultID string + +const ( + ZoneSettingZeroRttListResponseResultID0rtt ZoneSettingZeroRttListResponseResultID = "0rtt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingZeroRttListResponseResultEditable bool + +const ( + ZoneSettingZeroRttListResponseResultEditableTrue ZoneSettingZeroRttListResponseResultEditable = true + ZoneSettingZeroRttListResponseResultEditableFalse ZoneSettingZeroRttListResponseResultEditable = false +) + +// Value of the 0-RTT setting. +type ZoneSettingZeroRttListResponseResultValue string + +const ( + ZoneSettingZeroRttListResponseResultValueOn ZoneSettingZeroRttListResponseResultValue = "on" + ZoneSettingZeroRttListResponseResultValueOff ZoneSettingZeroRttListResponseResultValue = "off" +) + +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponse struct { + Errors []ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseError `json:"errors"` + Messages []ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseMessage `json:"messages"` + // 0-RTT session resumption enabled for this zone. + Result ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseJSON `json:"-"` +} + +// zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseJSON +// contains the JSON metadata for the struct +// [ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponse] +type zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseErrorJSON `json:"-"` +} + +// zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseError] +type zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseMessageJSON `json:"-"` +} + +// zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseMessage] +type zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResult struct { + // ID of the zone setting. + ID ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultID `json:"id"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the 0-RTT setting. + Value ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultValue `json:"value"` + JSON zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultJSON `json:"-"` +} + +// zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResult] +type zoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultJSON struct { + ID apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultID string + +const ( + ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultID0rtt ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultID = "0rtt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultEditable bool + +const ( + ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultEditableTrue ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultEditable = true + ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultEditableFalse ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultEditable = false +) + +// Value of the 0-RTT setting. +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultValue string + +const ( + ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultValueOn ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultValue = "on" + ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultValueOff ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingResponseResultValue = "off" +) + +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParams struct { + // Value of the 0-RTT setting. + Value param.Field[ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParamsValue] `json:"value,required"` +} + +func (r ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the 0-RTT setting. +type ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParamsValue string + +const ( + ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParamsValueOn ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParamsValue = "on" + ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParamsValueOff ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParamsValue = "off" +) diff --git a/zonesettingzerortt_test.go b/zonesettingzerortt_test.go new file mode 100644 index 00000000000..897b017af0f --- /dev/null +++ b/zonesettingzerortt_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingZeroRttList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.ZeroRtts.List(context.TODO(), "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()) + } +} + +func TestZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSetting(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Settings.ZeroRtts.ZoneSettingsChange0RttSessionResumptionSetting( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParams{ + Value: cloudflare.F(cloudflare.ZoneSettingZeroRttZoneSettingsChange0RttSessionResumptionSettingParamsValueOn), + }, + ) + 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/zonesnippet.go b/zonesnippet.go new file mode 100644 index 00000000000..f43a80c965a --- /dev/null +++ b/zonesnippet.go @@ -0,0 +1,471 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneSnippetService 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 [NewZoneSnippetService] method +// instead. +type ZoneSnippetService struct { + Options []option.RequestOption +} + +// NewZoneSnippetService 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 NewZoneSnippetService(opts ...option.RequestOption) (r *ZoneSnippetService) { + r = &ZoneSnippetService{} + r.Options = opts + return +} + +// Snippet +func (r *ZoneSnippetService) Get(ctx context.Context, zoneIdentifier string, snippetName string, opts ...option.RequestOption) (res *ZoneSnippetGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/snippets/%s", zoneIdentifier, snippetName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Put Snippet +func (r *ZoneSnippetService) Update(ctx context.Context, zoneIdentifier string, snippetName string, body ZoneSnippetUpdateParams, opts ...option.RequestOption) (res *ZoneSnippetUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/snippets/%s", zoneIdentifier, snippetName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// All Snippets +func (r *ZoneSnippetService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSnippetListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/snippets", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete Snippet +func (r *ZoneSnippetService) Delete(ctx context.Context, zoneIdentifier string, snippetName string, opts ...option.RequestOption) (res *ZoneSnippetDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/snippets/%s", zoneIdentifier, snippetName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Snippet Content +func (r *ZoneSnippetService) Content(ctx context.Context, zoneIdentifier string, snippetName string, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "multipart/form-data")}, opts...) + path := fmt.Sprintf("zones/%s/snippets/%s/content", zoneIdentifier, snippetName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSnippetGetResponse struct { + Errors []ZoneSnippetGetResponseError `json:"errors"` + Messages []ZoneSnippetGetResponseMessage `json:"messages"` + // Snippet Information + Result ZoneSnippetGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSnippetGetResponseSuccess `json:"success"` + JSON zoneSnippetGetResponseJSON `json:"-"` +} + +// zoneSnippetGetResponseJSON contains the JSON metadata for the struct +// [ZoneSnippetGetResponse] +type zoneSnippetGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetGetResponseErrorJSON `json:"-"` +} + +// zoneSnippetGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSnippetGetResponseError] +type zoneSnippetGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetGetResponseMessageJSON `json:"-"` +} + +// zoneSnippetGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneSnippetGetResponseMessage] +type zoneSnippetGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Snippet Information +type ZoneSnippetGetResponseResult struct { + // Creation time of the snippet + CreatedOn string `json:"created_on"` + // Modification time of the snippet + ModifiedOn string `json:"modified_on"` + // Snippet identifying name + SnippetName string `json:"snippet_name"` + JSON zoneSnippetGetResponseResultJSON `json:"-"` +} + +// zoneSnippetGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneSnippetGetResponseResult] +type zoneSnippetGetResponseResultJSON struct { + CreatedOn apijson.Field + ModifiedOn apijson.Field + SnippetName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSnippetGetResponseSuccess bool + +const ( + ZoneSnippetGetResponseSuccessTrue ZoneSnippetGetResponseSuccess = true +) + +type ZoneSnippetUpdateResponse struct { + Errors []ZoneSnippetUpdateResponseError `json:"errors"` + Messages []ZoneSnippetUpdateResponseMessage `json:"messages"` + // Snippet Information + Result ZoneSnippetUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSnippetUpdateResponseSuccess `json:"success"` + JSON zoneSnippetUpdateResponseJSON `json:"-"` +} + +// zoneSnippetUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneSnippetUpdateResponse] +type zoneSnippetUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetUpdateResponseErrorJSON `json:"-"` +} + +// zoneSnippetUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSnippetUpdateResponseError] +type zoneSnippetUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetUpdateResponseMessageJSON `json:"-"` +} + +// zoneSnippetUpdateResponseMessageJSON contains the JSON metadata for the struct +// [ZoneSnippetUpdateResponseMessage] +type zoneSnippetUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Snippet Information +type ZoneSnippetUpdateResponseResult struct { + // Creation time of the snippet + CreatedOn string `json:"created_on"` + // Modification time of the snippet + ModifiedOn string `json:"modified_on"` + // Snippet identifying name + SnippetName string `json:"snippet_name"` + JSON zoneSnippetUpdateResponseResultJSON `json:"-"` +} + +// zoneSnippetUpdateResponseResultJSON contains the JSON metadata for the struct +// [ZoneSnippetUpdateResponseResult] +type zoneSnippetUpdateResponseResultJSON struct { + CreatedOn apijson.Field + ModifiedOn apijson.Field + SnippetName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSnippetUpdateResponseSuccess bool + +const ( + ZoneSnippetUpdateResponseSuccessTrue ZoneSnippetUpdateResponseSuccess = true +) + +type ZoneSnippetListResponse struct { + Errors []ZoneSnippetListResponseError `json:"errors"` + Messages []ZoneSnippetListResponseMessage `json:"messages"` + // List of all zone snippets + Result []ZoneSnippetListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSnippetListResponseSuccess `json:"success"` + JSON zoneSnippetListResponseJSON `json:"-"` +} + +// zoneSnippetListResponseJSON contains the JSON metadata for the struct +// [ZoneSnippetListResponse] +type zoneSnippetListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetListResponseErrorJSON `json:"-"` +} + +// zoneSnippetListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSnippetListResponseError] +type zoneSnippetListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetListResponseMessageJSON `json:"-"` +} + +// zoneSnippetListResponseMessageJSON contains the JSON metadata for the struct +// [ZoneSnippetListResponseMessage] +type zoneSnippetListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Snippet Information +type ZoneSnippetListResponseResult struct { + // Creation time of the snippet + CreatedOn string `json:"created_on"` + // Modification time of the snippet + ModifiedOn string `json:"modified_on"` + // Snippet identifying name + SnippetName string `json:"snippet_name"` + JSON zoneSnippetListResponseResultJSON `json:"-"` +} + +// zoneSnippetListResponseResultJSON contains the JSON metadata for the struct +// [ZoneSnippetListResponseResult] +type zoneSnippetListResponseResultJSON struct { + CreatedOn apijson.Field + ModifiedOn apijson.Field + SnippetName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSnippetListResponseSuccess bool + +const ( + ZoneSnippetListResponseSuccessTrue ZoneSnippetListResponseSuccess = true +) + +type ZoneSnippetDeleteResponse struct { + Errors []ZoneSnippetDeleteResponseError `json:"errors,required"` + Messages []ZoneSnippetDeleteResponseMessage `json:"messages,required"` + Result ZoneSnippetDeleteResponseResult `json:"result,required"` + // Whether the API call was successful + Success ZoneSnippetDeleteResponseSuccess `json:"success,required"` + JSON zoneSnippetDeleteResponseJSON `json:"-"` +} + +// zoneSnippetDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneSnippetDeleteResponse] +type zoneSnippetDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetDeleteResponseErrorJSON `json:"-"` +} + +// zoneSnippetDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSnippetDeleteResponseError] +type zoneSnippetDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetDeleteResponseMessageJSON `json:"-"` +} + +// zoneSnippetDeleteResponseMessageJSON contains the JSON metadata for the struct +// [ZoneSnippetDeleteResponseMessage] +type zoneSnippetDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [ZoneSnippetDeleteResponseResultUnknown], +// [ZoneSnippetDeleteResponseResultArray] or [shared.UnionString]. +type ZoneSnippetDeleteResponseResult interface { + ImplementsZoneSnippetDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneSnippetDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ZoneSnippetDeleteResponseResultArray []interface{} + +func (r ZoneSnippetDeleteResponseResultArray) ImplementsZoneSnippetDeleteResponseResult() {} + +// Whether the API call was successful +type ZoneSnippetDeleteResponseSuccess bool + +const ( + ZoneSnippetDeleteResponseSuccessTrue ZoneSnippetDeleteResponseSuccess = true +) + +type ZoneSnippetUpdateParams struct { + // Content files of uploaded snippet + Files param.Field[string] `json:"files"` + Metadata param.Field[ZoneSnippetUpdateParamsMetadata] `json:"metadata"` +} + +func (r ZoneSnippetUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSnippetUpdateParamsMetadata struct { + // Main module name of uploaded snippet + MainModule param.Field[string] `json:"main_module"` +} + +func (r ZoneSnippetUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonesnippet_test.go b/zonesnippet_test.go new file mode 100644 index 00000000000..55dbdf29599 --- /dev/null +++ b/zonesnippet_test.go @@ -0,0 +1,182 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSnippetGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Snippets.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "snippet_name_01", + ) + 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 TestZoneSnippetUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Snippets.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "snippet_name_01", + cloudflare.ZoneSnippetUpdateParams{ + Files: cloudflare.F("export { async function fetch(request, env) {return new Response('some_response') } }"), + Metadata: cloudflare.F(cloudflare.ZoneSnippetUpdateParamsMetadata{ + MainModule: cloudflare.F("main.js"), + }), + }, + ) + 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 TestZoneSnippetList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Snippets.List(context.TODO(), "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()) + } +} + +func TestZoneSnippetDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Snippets.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "snippet_name_01", + ) + 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 TestZoneSnippetContent(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Zones.Snippets.Content( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "snippet_name_01", + ) + 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/zonesnippetsrule.go b/zonesnippetsrule.go new file mode 100644 index 00000000000..dd96c420346 --- /dev/null +++ b/zonesnippetsrule.go @@ -0,0 +1,257 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSnippetsRuleService 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 [NewZoneSnippetsRuleService] method +// instead. +type ZoneSnippetsRuleService struct { + Options []option.RequestOption +} + +// NewZoneSnippetsRuleService 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 NewZoneSnippetsRuleService(opts ...option.RequestOption) (r *ZoneSnippetsRuleService) { + r = &ZoneSnippetsRuleService{} + r.Options = opts + return +} + +// Put Rules +func (r *ZoneSnippetsRuleService) Update(ctx context.Context, zoneIdentifier string, body ZoneSnippetsRuleUpdateParams, opts ...option.RequestOption) (res *ZoneSnippetsRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/snippets/snippet_rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Rules +func (r *ZoneSnippetsRuleService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSnippetsRuleListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/snippets/snippet_rules", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSnippetsRuleUpdateResponse struct { + Errors []ZoneSnippetsRuleUpdateResponseError `json:"errors"` + Messages []ZoneSnippetsRuleUpdateResponseMessage `json:"messages"` + // List of snippet rules + Result []ZoneSnippetsRuleUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSnippetsRuleUpdateResponseSuccess `json:"success"` + JSON zoneSnippetsRuleUpdateResponseJSON `json:"-"` +} + +// zoneSnippetsRuleUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneSnippetsRuleUpdateResponse] +type zoneSnippetsRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetsRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetsRuleUpdateResponseErrorJSON `json:"-"` +} + +// zoneSnippetsRuleUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSnippetsRuleUpdateResponseError] +type zoneSnippetsRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetsRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetsRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneSnippetsRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSnippetsRuleUpdateResponseMessage] +type zoneSnippetsRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetsRuleUpdateResponseResult struct { + Description string `json:"description"` + Enabled bool `json:"enabled"` + Expression string `json:"expression"` + // Snippet identifying name + SnippetName string `json:"snippet_name"` + JSON zoneSnippetsRuleUpdateResponseResultJSON `json:"-"` +} + +// zoneSnippetsRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneSnippetsRuleUpdateResponseResult] +type zoneSnippetsRuleUpdateResponseResultJSON struct { + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + SnippetName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSnippetsRuleUpdateResponseSuccess bool + +const ( + ZoneSnippetsRuleUpdateResponseSuccessTrue ZoneSnippetsRuleUpdateResponseSuccess = true +) + +type ZoneSnippetsRuleListResponse struct { + Errors []ZoneSnippetsRuleListResponseError `json:"errors"` + Messages []ZoneSnippetsRuleListResponseMessage `json:"messages"` + // List of snippet rules + Result []ZoneSnippetsRuleListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSnippetsRuleListResponseSuccess `json:"success"` + JSON zoneSnippetsRuleListResponseJSON `json:"-"` +} + +// zoneSnippetsRuleListResponseJSON contains the JSON metadata for the struct +// [ZoneSnippetsRuleListResponse] +type zoneSnippetsRuleListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetsRuleListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetsRuleListResponseErrorJSON `json:"-"` +} + +// zoneSnippetsRuleListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSnippetsRuleListResponseError] +type zoneSnippetsRuleListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetsRuleListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSnippetsRuleListResponseMessageJSON `json:"-"` +} + +// zoneSnippetsRuleListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSnippetsRuleListResponseMessage] +type zoneSnippetsRuleListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSnippetsRuleListResponseResult struct { + Description string `json:"description"` + Enabled bool `json:"enabled"` + Expression string `json:"expression"` + // Snippet identifying name + SnippetName string `json:"snippet_name"` + JSON zoneSnippetsRuleListResponseResultJSON `json:"-"` +} + +// zoneSnippetsRuleListResponseResultJSON contains the JSON metadata for the struct +// [ZoneSnippetsRuleListResponseResult] +type zoneSnippetsRuleListResponseResultJSON struct { + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + SnippetName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSnippetsRuleListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSnippetsRuleListResponseSuccess bool + +const ( + ZoneSnippetsRuleListResponseSuccessTrue ZoneSnippetsRuleListResponseSuccess = true +) + +type ZoneSnippetsRuleUpdateParams struct { + // List of snippet rules + Rules param.Field[[]ZoneSnippetsRuleUpdateParamsRule] `json:"rules"` +} + +func (r ZoneSnippetsRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSnippetsRuleUpdateParamsRule struct { + Description param.Field[string] `json:"description"` + Enabled param.Field[bool] `json:"enabled"` + Expression param.Field[string] `json:"expression"` + // Snippet identifying name + SnippetName param.Field[string] `json:"snippet_name"` +} + +func (r ZoneSnippetsRuleUpdateParamsRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonesnippetsrule_test.go b/zonesnippetsrule_test.go new file mode 100644 index 00000000000..d2c25c5eca1 --- /dev/null +++ b/zonesnippetsrule_test.go @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSnippetsRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SnippetsRules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSnippetsRuleUpdateParams{ + Rules: cloudflare.F([]cloudflare.ZoneSnippetsRuleUpdateParamsRule{{ + Description: cloudflare.F("Rule description"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("http.cookie eq \"a=b\""), + SnippetName: cloudflare.F("snippet_name_01"), + }, { + Description: cloudflare.F("Rule description"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("http.cookie eq \"a=b\""), + SnippetName: cloudflare.F("snippet_name_01"), + }, { + Description: cloudflare.F("Rule description"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("http.cookie eq \"a=b\""), + SnippetName: cloudflare.F("snippet_name_01"), + }}), + }, + ) + 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 TestZoneSnippetsRuleList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SnippetsRules.List(context.TODO(), "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/zonespectrum.go b/zonespectrum.go new file mode 100644 index 00000000000..8a2c78aad0a --- /dev/null +++ b/zonespectrum.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpectrumService 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 [NewZoneSpectrumService] method +// instead. +type ZoneSpectrumService struct { + Options []option.RequestOption + Analytics *ZoneSpectrumAnalyticsService +} + +// NewZoneSpectrumService 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 NewZoneSpectrumService(opts ...option.RequestOption) (r *ZoneSpectrumService) { + r = &ZoneSpectrumService{} + r.Options = opts + r.Analytics = NewZoneSpectrumAnalyticsService(opts...) + return +} diff --git a/zonespectrumanalytics.go b/zonespectrumanalytics.go new file mode 100644 index 00000000000..d77ec387b18 --- /dev/null +++ b/zonespectrumanalytics.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpectrumAnalyticsService 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 [NewZoneSpectrumAnalyticsService] +// method instead. +type ZoneSpectrumAnalyticsService struct { + Options []option.RequestOption + Aggregates *ZoneSpectrumAnalyticsAggregateService + Events *ZoneSpectrumAnalyticsEventService +} + +// NewZoneSpectrumAnalyticsService 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 NewZoneSpectrumAnalyticsService(opts ...option.RequestOption) (r *ZoneSpectrumAnalyticsService) { + r = &ZoneSpectrumAnalyticsService{} + r.Options = opts + r.Aggregates = NewZoneSpectrumAnalyticsAggregateService(opts...) + r.Events = NewZoneSpectrumAnalyticsEventService(opts...) + return +} diff --git a/zonespectrumanalyticsaggregate.go b/zonespectrumanalyticsaggregate.go new file mode 100644 index 00000000000..8d8462a054d --- /dev/null +++ b/zonespectrumanalyticsaggregate.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpectrumAnalyticsAggregateService 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 +// [NewZoneSpectrumAnalyticsAggregateService] method instead. +type ZoneSpectrumAnalyticsAggregateService struct { + Options []option.RequestOption + Currents *ZoneSpectrumAnalyticsAggregateCurrentService +} + +// NewZoneSpectrumAnalyticsAggregateService 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 NewZoneSpectrumAnalyticsAggregateService(opts ...option.RequestOption) (r *ZoneSpectrumAnalyticsAggregateService) { + r = &ZoneSpectrumAnalyticsAggregateService{} + r.Options = opts + r.Currents = NewZoneSpectrumAnalyticsAggregateCurrentService(opts...) + return +} diff --git a/zonespectrumanalyticsaggregatecurrent.go b/zonespectrumanalyticsaggregatecurrent.go new file mode 100644 index 00000000000..ad768eb1448 --- /dev/null +++ b/zonespectrumanalyticsaggregatecurrent.go @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpectrumAnalyticsAggregateCurrentService 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 +// [NewZoneSpectrumAnalyticsAggregateCurrentService] method instead. +type ZoneSpectrumAnalyticsAggregateCurrentService struct { + Options []option.RequestOption +} + +// NewZoneSpectrumAnalyticsAggregateCurrentService 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 NewZoneSpectrumAnalyticsAggregateCurrentService(opts ...option.RequestOption) (r *ZoneSpectrumAnalyticsAggregateCurrentService) { + r = &ZoneSpectrumAnalyticsAggregateCurrentService{} + r.Options = opts + return +} + +// Retrieves analytics aggregated from the last minute of usage on Spectrum +// applications underneath a given zone. +func (r *ZoneSpectrumAnalyticsAggregateCurrentService) SpectrumAggregateAnalyticsGetCurrentAggregatedAnalytics(ctx context.Context, zone string, query ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsParams, opts ...option.RequestOption) (res *ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/spectrum/analytics/aggregate/current", zone) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponse struct { + Errors []ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseError `json:"errors"` + Messages []ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + // Whether the API call was successful + Success ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseSuccess `json:"success"` + JSON zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseJSON `json:"-"` +} + +// zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponse] +type zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseErrorJSON `json:"-"` +} + +// zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseError] +type zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseMessageJSON `json:"-"` +} + +// zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseMessage] +type zoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseSuccess bool + +const ( + ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseSuccessTrue ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsResponseSuccess = true +) + +type ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsParams struct { + // Comma-delimited list of Spectrum Application Id(s). If provided, the response + // will be limited to Spectrum Application Id(s) that match. + AppIDParam param.Field[string] `query:"app_id_param"` + // Comma-delimited list of Spectrum Application Id(s). If provided, the response + // will be limited to Spectrum Application Id(s) that match. + AppID param.Field[string] `query:"appID"` + // Co-location identifier. + ColoName param.Field[string] `query:"colo_name"` +} + +// URLQuery serializes +// [ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsParams]'s +// query parameters as `url.Values`. +func (r ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/zonespectrumanalyticsaggregatecurrent_test.go b/zonespectrumanalyticsaggregatecurrent_test.go new file mode 100644 index 00000000000..cd1c58ac899 --- /dev/null +++ b/zonespectrumanalyticsaggregatecurrent_test.go @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Spectrums.Analytics.Aggregates.Currents.SpectrumAggregateAnalyticsGetCurrentAggregatedAnalytics( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSpectrumAnalyticsAggregateCurrentSpectrumAggregateAnalyticsGetCurrentAggregatedAnalyticsParams{ + AppIDParam: cloudflare.F("ea95132c15732412d22c1476fa83f27a,d122c5f4bb71e25cc9e86ab43b142e2f"), + AppID: cloudflare.F("ea95132c15732412d22c1476fa83f27a,d122c5f4bb71e25cc9e86ab43b142e2f"), + ColoName: cloudflare.F("PDX"), + }, + ) + 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/zonespectrumanalyticsevent.go b/zonespectrumanalyticsevent.go new file mode 100644 index 00000000000..d772cb3a89b --- /dev/null +++ b/zonespectrumanalyticsevent.go @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpectrumAnalyticsEventService 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 +// [NewZoneSpectrumAnalyticsEventService] method instead. +type ZoneSpectrumAnalyticsEventService struct { + Options []option.RequestOption + Bytimes *ZoneSpectrumAnalyticsEventBytimeService + Summaries *ZoneSpectrumAnalyticsEventSummaryService +} + +// NewZoneSpectrumAnalyticsEventService 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 NewZoneSpectrumAnalyticsEventService(opts ...option.RequestOption) (r *ZoneSpectrumAnalyticsEventService) { + r = &ZoneSpectrumAnalyticsEventService{} + r.Options = opts + r.Bytimes = NewZoneSpectrumAnalyticsEventBytimeService(opts...) + r.Summaries = NewZoneSpectrumAnalyticsEventSummaryService(opts...) + return +} diff --git a/zonespectrumanalyticseventbytime.go b/zonespectrumanalyticseventbytime.go new file mode 100644 index 00000000000..c548fe67dd0 --- /dev/null +++ b/zonespectrumanalyticseventbytime.go @@ -0,0 +1,233 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneSpectrumAnalyticsEventBytimeService 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 +// [NewZoneSpectrumAnalyticsEventBytimeService] method instead. +type ZoneSpectrumAnalyticsEventBytimeService struct { + Options []option.RequestOption +} + +// NewZoneSpectrumAnalyticsEventBytimeService 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 NewZoneSpectrumAnalyticsEventBytimeService(opts ...option.RequestOption) (r *ZoneSpectrumAnalyticsEventBytimeService) { + r = &ZoneSpectrumAnalyticsEventBytimeService{} + r.Options = opts + return +} + +// Retrieves a list of aggregate metrics grouped by time interval. +func (r *ZoneSpectrumAnalyticsEventBytimeService) SpectrumAnalyticsByTimeGetAnalyticsByTime(ctx context.Context, zone string, query ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParams, opts ...option.RequestOption) (res *ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/spectrum/analytics/events/bytime", zone) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponse struct { + Errors []ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseError `json:"errors"` + Messages []ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseMessage `json:"messages"` + Result ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseSuccess `json:"success"` + JSON zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseJSON `json:"-"` +} + +// zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponse] +type zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseErrorJSON `json:"-"` +} + +// zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseError] +type zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseMessageJSON `json:"-"` +} + +// zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseMessage] +type zoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseResultUnknown] +// or [shared.UnionString]. +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseResult interface { + ImplementsZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseSuccess bool + +const ( + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseSuccessTrue ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeResponseSuccess = true +) + +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParams struct { + // Can be used to break down the data by given attributes. Options are: + // + // | Dimension | Name | Example | + // | --------- | ----------------------------- | ---------------------------------------------------------- | + // | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | + // | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | + // | coloName | Colo Name | SFO | + // | ipVersion | IP version used by the client | 4, 6. | + Dimensions param.Field[[]ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimension] `query:"dimensions"` + // Used to filter rows by one or more dimensions. Filters can be combined using OR + // and AND boolean logic. AND takes precedence over OR in all the expressions. The + // OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. + // The AND operator is defined using a semicolon (;) or AND keyword surrounded by + // whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) + // and needs to be percent-encoded as %3B. Comparison options are: + // + // | Operator | Name | URL Encoded | + // | -------- | ------------------------ | ----------- | + // | == | Equals | %3D%3D | + // | != | Does not equals | !%3D | + // | > | Greater Than | %3E | + // | < | Less Than | %3C | + // | >= | Greater than or equal to | %3E%3D | + // | <= | Less than or equal to | %3C%3D . | + Filters param.Field[string] `query:"filters"` + // One or more metrics to compute. Options are: + // + // | Metric | Name | Example | Unit | + // | -------------- | ----------------------------------- | ------- | --------------------- | + // | count | Count of total events | 1000 | Count | + // | bytesIngress | Sum of ingress bytes | 1000 | Sum | + // | bytesEgress | Sum of egress bytes | 1000 | Sum | + // | durationAvg | Average connection duration | 1.0 | Time in milliseconds | + // | durationMedian | Median connection duration | 1.0 | Time in milliseconds | + // | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | + // | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | + Metrics param.Field[[]ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric] `query:"metrics"` + // Start of time interval to query, defaults to `until` - 6 hours. Timestamp must + // be in RFC3339 format and uses UTC unless otherwise specified. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // The sort order for the result set; sort fields must be included in `metrics` or + // `dimensions`. + Sort param.Field[[]interface{}] `query:"sort"` + // Used to select time series resolution. + TimeDelta param.Field[ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta] `query:"time_delta"` + // End of time interval to query, defaults to current time. Timestamp must be in + // RFC3339 format and uses UTC unless otherwise specified. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes +// [ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParams]'s +// query parameters as `url.Values`. +func (r ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimension string + +const ( + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimensionEvent ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimension = "event" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimensionAppID ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimension = "appID" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimensionColoName ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimension = "coloName" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimensionIPVersion ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimension = "ipVersion" +) + +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric string + +const ( + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricCount ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric = "count" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricBytesIngress ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric = "bytesIngress" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricBytesEgress ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric = "bytesEgress" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricDurationAvg ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric = "durationAvg" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricDurationMedian ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric = "durationMedian" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricDuration90th ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric = "duration90th" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricDuration99th ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric = "duration99th" +) + +// Used to select time series resolution. +type ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta string + +const ( + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaYear ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "year" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaQuarter ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "quarter" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaMonth ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "month" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaWeek ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "week" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaDay ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "day" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaHour ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "hour" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaDekaminute ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "dekaminute" + ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaMinute ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDelta = "minute" +) diff --git a/zonespectrumanalyticseventbytime_test.go b/zonespectrumanalyticseventbytime_test.go new file mode 100644 index 00000000000..41984e7c1bb --- /dev/null +++ b/zonespectrumanalyticseventbytime_test.go @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Spectrums.Analytics.Events.Bytimes.SpectrumAnalyticsByTimeGetAnalyticsByTime( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParams{ + Dimensions: cloudflare.F([]cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimension{cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimensionEvent, cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsDimensionAppID}), + Filters: cloudflare.F("event==disconnect%20AND%20coloName!=SFO"), + Metrics: cloudflare.F([]cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetric{cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricCount, cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsMetricBytesIngress}), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F([]interface{}{"+count", "-bytesIngress"}), + TimeDelta: cloudflare.F(cloudflare.ZoneSpectrumAnalyticsEventBytimeSpectrumAnalyticsByTimeGetAnalyticsByTimeParamsTimeDeltaMinute), + Until: cloudflare.F(time.Now()), + }, + ) + 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/zonespectrumanalyticseventsummary.go b/zonespectrumanalyticseventsummary.go new file mode 100644 index 00000000000..e04e4229087 --- /dev/null +++ b/zonespectrumanalyticseventsummary.go @@ -0,0 +1,217 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneSpectrumAnalyticsEventSummaryService 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 +// [NewZoneSpectrumAnalyticsEventSummaryService] method instead. +type ZoneSpectrumAnalyticsEventSummaryService struct { + Options []option.RequestOption +} + +// NewZoneSpectrumAnalyticsEventSummaryService 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 NewZoneSpectrumAnalyticsEventSummaryService(opts ...option.RequestOption) (r *ZoneSpectrumAnalyticsEventSummaryService) { + r = &ZoneSpectrumAnalyticsEventSummaryService{} + r.Options = opts + return +} + +// Retrieves a list of summarised aggregate metrics over a given time period. +func (r *ZoneSpectrumAnalyticsEventSummaryService) SpectrumAnalyticsSummaryGetAnalyticsSummary(ctx context.Context, zone string, query ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParams, opts ...option.RequestOption) (res *ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/spectrum/analytics/events/summary", zone) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponse struct { + Errors []ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseError `json:"errors"` + Messages []ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseMessage `json:"messages"` + Result ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseSuccess `json:"success"` + JSON zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseJSON `json:"-"` +} + +// zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponse] +type zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseErrorJSON `json:"-"` +} + +// zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseError] +type zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseMessageJSON `json:"-"` +} + +// zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseMessage] +type zoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseResultUnknown] +// or [shared.UnionString]. +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseResult interface { + ImplementsZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseSuccess bool + +const ( + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseSuccessTrue ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryResponseSuccess = true +) + +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParams struct { + // Can be used to break down the data by given attributes. Options are: + // + // | Dimension | Name | Example | + // | --------- | ----------------------------- | ---------------------------------------------------------- | + // | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | + // | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | + // | coloName | Colo Name | SFO | + // | ipVersion | IP version used by the client | 4, 6. | + Dimensions param.Field[[]ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimension] `query:"dimensions"` + // Used to filter rows by one or more dimensions. Filters can be combined using OR + // and AND boolean logic. AND takes precedence over OR in all the expressions. The + // OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. + // The AND operator is defined using a semicolon (;) or AND keyword surrounded by + // whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) + // and needs to be percent-encoded as %3B. Comparison options are: + // + // | Operator | Name | URL Encoded | + // | -------- | ------------------------ | ----------- | + // | == | Equals | %3D%3D | + // | != | Does not equals | !%3D | + // | > | Greater Than | %3E | + // | < | Less Than | %3C | + // | >= | Greater than or equal to | %3E%3D | + // | <= | Less than or equal to | %3C%3D . | + Filters param.Field[string] `query:"filters"` + // One or more metrics to compute. Options are: + // + // | Metric | Name | Example | Unit | + // | -------------- | ----------------------------------- | ------- | --------------------- | + // | count | Count of total events | 1000 | Count | + // | bytesIngress | Sum of ingress bytes | 1000 | Sum | + // | bytesEgress | Sum of egress bytes | 1000 | Sum | + // | durationAvg | Average connection duration | 1.0 | Time in milliseconds | + // | durationMedian | Median connection duration | 1.0 | Time in milliseconds | + // | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | + // | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | + Metrics param.Field[[]ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric] `query:"metrics"` + // Start of time interval to query, defaults to `until` - 6 hours. Timestamp must + // be in RFC3339 format and uses UTC unless otherwise specified. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // The sort order for the result set; sort fields must be included in `metrics` or + // `dimensions`. + Sort param.Field[[]interface{}] `query:"sort"` + // End of time interval to query, defaults to current time. Timestamp must be in + // RFC3339 format and uses UTC unless otherwise specified. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes +// [ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParams]'s +// query parameters as `url.Values`. +func (r ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimension string + +const ( + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimensionEvent ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimension = "event" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimensionAppID ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimension = "appID" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimensionColoName ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimension = "coloName" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimensionIPVersion ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimension = "ipVersion" +) + +type ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric string + +const ( + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricCount ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric = "count" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricBytesIngress ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric = "bytesIngress" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricBytesEgress ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric = "bytesEgress" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricDurationAvg ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric = "durationAvg" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricDurationMedian ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric = "durationMedian" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricDuration90th ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric = "duration90th" + ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricDuration99th ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric = "duration99th" +) diff --git a/zonespectrumanalyticseventsummary_test.go b/zonespectrumanalyticseventsummary_test.go new file mode 100644 index 00000000000..c54db295fa9 --- /dev/null +++ b/zonespectrumanalyticseventsummary_test.go @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Spectrums.Analytics.Events.Summaries.SpectrumAnalyticsSummaryGetAnalyticsSummary( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParams{ + Dimensions: cloudflare.F([]cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimension{cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimensionEvent, cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsDimensionAppID}), + Filters: cloudflare.F("event==disconnect%20AND%20coloName!=SFO"), + Metrics: cloudflare.F([]cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetric{cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricCount, cloudflare.ZoneSpectrumAnalyticsEventSummarySpectrumAnalyticsSummaryGetAnalyticsSummaryParamsMetricBytesIngress}), + Since: cloudflare.F(time.Now()), + Sort: cloudflare.F([]interface{}{"+count", "-bytesIngress"}), + Until: cloudflare.F(time.Now()), + }, + ) + 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/zonespeedapi.go b/zonespeedapi.go new file mode 100644 index 00000000000..5b6971aaccc --- /dev/null +++ b/zonespeedapi.go @@ -0,0 +1,204 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpeedAPIService 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 [NewZoneSpeedAPIService] method +// instead. +type ZoneSpeedAPIService struct { + Options []option.RequestOption + Pages *ZoneSpeedAPIPageService + Schedule *ZoneSpeedAPIScheduleService +} + +// NewZoneSpeedAPIService 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 NewZoneSpeedAPIService(opts ...option.RequestOption) (r *ZoneSpeedAPIService) { + r = &ZoneSpeedAPIService{} + r.Options = opts + r.Pages = NewZoneSpeedAPIPageService(opts...) + r.Schedule = NewZoneSpeedAPIScheduleService(opts...) + return +} + +// Retrieves quota for all plans, as well as the current zone quota. +func (r *ZoneSpeedAPIService) Availabilities(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSpeedAPIAvailabilitiesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/availabilities", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSpeedAPIAvailabilitiesResponse struct { + Errors []ZoneSpeedAPIAvailabilitiesResponseError `json:"errors"` + Messages []ZoneSpeedAPIAvailabilitiesResponseMessage `json:"messages"` + Result ZoneSpeedAPIAvailabilitiesResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIAvailabilitiesResponseJSON `json:"-"` +} + +// zoneSpeedAPIAvailabilitiesResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIAvailabilitiesResponse] +type zoneSpeedAPIAvailabilitiesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIAvailabilitiesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIAvailabilitiesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIAvailabilitiesResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIAvailabilitiesResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIAvailabilitiesResponseError] +type zoneSpeedAPIAvailabilitiesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIAvailabilitiesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIAvailabilitiesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIAvailabilitiesResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIAvailabilitiesResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIAvailabilitiesResponseMessage] +type zoneSpeedAPIAvailabilitiesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIAvailabilitiesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIAvailabilitiesResponseResult struct { + Quota ZoneSpeedAPIAvailabilitiesResponseResultQuota `json:"quota"` + Regions []ZoneSpeedAPIAvailabilitiesResponseResultRegion `json:"regions"` + RegionsPerPlan interface{} `json:"regionsPerPlan"` + JSON zoneSpeedAPIAvailabilitiesResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIAvailabilitiesResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIAvailabilitiesResponseResult] +type zoneSpeedAPIAvailabilitiesResponseResultJSON struct { + Quota apijson.Field + Regions apijson.Field + RegionsPerPlan apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIAvailabilitiesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIAvailabilitiesResponseResultQuota struct { + // Cloudflare plan. + Plan string `json:"plan"` + // The number of tests available per plan. + QuotasPerPlan interface{} `json:"quotasPerPlan"` + // The number of remaining schedules available. + RemainingSchedules float64 `json:"remainingSchedules"` + // The number of remaining tests available. + RemainingTests float64 `json:"remainingTests"` + // The number of schedules available per plan. + ScheduleQuotasPerPlan interface{} `json:"scheduleQuotasPerPlan"` + JSON zoneSpeedAPIAvailabilitiesResponseResultQuotaJSON `json:"-"` +} + +// zoneSpeedAPIAvailabilitiesResponseResultQuotaJSON contains the JSON metadata for +// the struct [ZoneSpeedAPIAvailabilitiesResponseResultQuota] +type zoneSpeedAPIAvailabilitiesResponseResultQuotaJSON struct { + Plan apijson.Field + QuotasPerPlan apijson.Field + RemainingSchedules apijson.Field + RemainingTests apijson.Field + ScheduleQuotasPerPlan apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIAvailabilitiesResponseResultQuota) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region with a label. +type ZoneSpeedAPIAvailabilitiesResponseResultRegion struct { + Label string `json:"label"` + // A test region. + Value ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue `json:"value"` + JSON zoneSpeedAPIAvailabilitiesResponseResultRegionJSON `json:"-"` +} + +// zoneSpeedAPIAvailabilitiesResponseResultRegionJSON contains the JSON metadata +// for the struct [ZoneSpeedAPIAvailabilitiesResponseResultRegion] +type zoneSpeedAPIAvailabilitiesResponseResultRegionJSON struct { + Label apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIAvailabilitiesResponseResultRegion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region. +type ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue string + +const ( + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueAsiaEast1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "asia-east1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueAsiaNortheast1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "asia-northeast1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueAsiaNortheast2 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "asia-northeast2" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueAsiaSouth1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "asia-south1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueAsiaSoutheast1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "asia-southeast1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueAustraliaSoutheast1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "australia-southeast1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeNorth1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-north1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeSouthwest1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-southwest1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeWest1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-west1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeWest2 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-west2" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeWest3 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-west3" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeWest4 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-west4" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeWest8 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-west8" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueEuropeWest9 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "europe-west9" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueMeWest1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "me-west1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueSouthamericaEast1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "southamerica-east1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueUsCentral1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "us-central1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueUsEast1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "us-east1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueUsEast4 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "us-east4" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueUsSouth1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "us-south1" + ZoneSpeedAPIAvailabilitiesResponseResultRegionsValueUsWest1 ZoneSpeedAPIAvailabilitiesResponseResultRegionsValue = "us-west1" +) diff --git a/zonespeedapi_test.go b/zonespeedapi_test.go new file mode 100644 index 00000000000..840c2410005 --- /dev/null +++ b/zonespeedapi_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSpeedAPIAvailabilities(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Availabilities(context.TODO(), "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/zonespeedapipage.go b/zonespeedapipage.go new file mode 100644 index 00000000000..a926f9df2e2 --- /dev/null +++ b/zonespeedapipage.go @@ -0,0 +1,652 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpeedAPIPageService 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 [NewZoneSpeedAPIPageService] method +// instead. +type ZoneSpeedAPIPageService struct { + Options []option.RequestOption + Tests *ZoneSpeedAPIPageTestService +} + +// NewZoneSpeedAPIPageService 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 NewZoneSpeedAPIPageService(opts ...option.RequestOption) (r *ZoneSpeedAPIPageService) { + r = &ZoneSpeedAPIPageService{} + r.Options = opts + r.Tests = NewZoneSpeedAPIPageTestService(opts...) + return +} + +// Lists all webpages which have been tested. +func (r *ZoneSpeedAPIPageService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSpeedAPIPageListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/pages", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Lists the core web vital metrics trend over time for a specific page. +func (r *ZoneSpeedAPIPageService) Trend(ctx context.Context, zoneIdentifier string, url string, query ZoneSpeedAPIPageTrendParams, opts ...option.RequestOption) (res *ZoneSpeedAPIPageTrendResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/trend", zoneIdentifier, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSpeedAPIPageListResponse struct { + Errors []ZoneSpeedAPIPageListResponseError `json:"errors"` + Messages []ZoneSpeedAPIPageListResponseMessage `json:"messages"` + Result []ZoneSpeedAPIPageListResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIPageListResponseJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageListResponse] +type zoneSpeedAPIPageListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageListResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageListResponseError] +type zoneSpeedAPIPageListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageListResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageListResponseMessage] +type zoneSpeedAPIPageListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageListResponseResult struct { + // A test region with a label. + Region ZoneSpeedAPIPageListResponseResultRegion `json:"region"` + // The frequency of the test. + ScheduleFrequency ZoneSpeedAPIPageListResponseResultScheduleFrequency `json:"scheduleFrequency"` + Tests []ZoneSpeedAPIPageListResponseResultTest `json:"tests"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIPageListResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageListResponseResult] +type zoneSpeedAPIPageListResponseResultJSON struct { + Region apijson.Field + ScheduleFrequency apijson.Field + Tests apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region with a label. +type ZoneSpeedAPIPageListResponseResultRegion struct { + Label string `json:"label"` + // A test region. + Value ZoneSpeedAPIPageListResponseResultRegionValue `json:"value"` + JSON zoneSpeedAPIPageListResponseResultRegionJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultRegionJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageListResponseResultRegion] +type zoneSpeedAPIPageListResponseResultRegionJSON struct { + Label apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResultRegion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region. +type ZoneSpeedAPIPageListResponseResultRegionValue string + +const ( + ZoneSpeedAPIPageListResponseResultRegionValueAsiaEast1 ZoneSpeedAPIPageListResponseResultRegionValue = "asia-east1" + ZoneSpeedAPIPageListResponseResultRegionValueAsiaNortheast1 ZoneSpeedAPIPageListResponseResultRegionValue = "asia-northeast1" + ZoneSpeedAPIPageListResponseResultRegionValueAsiaNortheast2 ZoneSpeedAPIPageListResponseResultRegionValue = "asia-northeast2" + ZoneSpeedAPIPageListResponseResultRegionValueAsiaSouth1 ZoneSpeedAPIPageListResponseResultRegionValue = "asia-south1" + ZoneSpeedAPIPageListResponseResultRegionValueAsiaSoutheast1 ZoneSpeedAPIPageListResponseResultRegionValue = "asia-southeast1" + ZoneSpeedAPIPageListResponseResultRegionValueAustraliaSoutheast1 ZoneSpeedAPIPageListResponseResultRegionValue = "australia-southeast1" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeNorth1 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-north1" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeSouthwest1 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-southwest1" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeWest1 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-west1" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeWest2 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-west2" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeWest3 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-west3" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeWest4 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-west4" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeWest8 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-west8" + ZoneSpeedAPIPageListResponseResultRegionValueEuropeWest9 ZoneSpeedAPIPageListResponseResultRegionValue = "europe-west9" + ZoneSpeedAPIPageListResponseResultRegionValueMeWest1 ZoneSpeedAPIPageListResponseResultRegionValue = "me-west1" + ZoneSpeedAPIPageListResponseResultRegionValueSouthamericaEast1 ZoneSpeedAPIPageListResponseResultRegionValue = "southamerica-east1" + ZoneSpeedAPIPageListResponseResultRegionValueUsCentral1 ZoneSpeedAPIPageListResponseResultRegionValue = "us-central1" + ZoneSpeedAPIPageListResponseResultRegionValueUsEast1 ZoneSpeedAPIPageListResponseResultRegionValue = "us-east1" + ZoneSpeedAPIPageListResponseResultRegionValueUsEast4 ZoneSpeedAPIPageListResponseResultRegionValue = "us-east4" + ZoneSpeedAPIPageListResponseResultRegionValueUsSouth1 ZoneSpeedAPIPageListResponseResultRegionValue = "us-south1" + ZoneSpeedAPIPageListResponseResultRegionValueUsWest1 ZoneSpeedAPIPageListResponseResultRegionValue = "us-west1" +) + +// The frequency of the test. +type ZoneSpeedAPIPageListResponseResultScheduleFrequency string + +const ( + ZoneSpeedAPIPageListResponseResultScheduleFrequencyDaily ZoneSpeedAPIPageListResponseResultScheduleFrequency = "DAILY" + ZoneSpeedAPIPageListResponseResultScheduleFrequencyWeekly ZoneSpeedAPIPageListResponseResultScheduleFrequency = "WEEKLY" +) + +type ZoneSpeedAPIPageListResponseResultTest struct { + // UUID + ID string `json:"id"` + Date time.Time `json:"date" format:"date-time"` + // The Lighthouse report. + DesktopReport ZoneSpeedAPIPageListResponseResultTestsDesktopReport `json:"desktopReport"` + // The Lighthouse report. + MobileReport ZoneSpeedAPIPageListResponseResultTestsMobileReport `json:"mobileReport"` + // A test region with a label. + Region ZoneSpeedAPIPageListResponseResultTestsRegion `json:"region"` + // The frequency of the test. + ScheduleFrequency ZoneSpeedAPIPageListResponseResultTestsScheduleFrequency `json:"scheduleFrequency"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIPageListResponseResultTestJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultTestJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageListResponseResultTest] +type zoneSpeedAPIPageListResponseResultTestJSON struct { + ID apijson.Field + Date apijson.Field + DesktopReport apijson.Field + MobileReport apijson.Field + Region apijson.Field + ScheduleFrequency apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResultTest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The Lighthouse report. +type ZoneSpeedAPIPageListResponseResultTestsDesktopReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageListResponseResultTestsDesktopReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageListResponseResultTestsDesktopReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageListResponseResultTestsDesktopReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageListResponseResultTestsDesktopReportJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultTestsDesktopReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageListResponseResultTestsDesktopReport] +type zoneSpeedAPIPageListResponseResultTestsDesktopReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResultTestsDesktopReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageListResponseResultTestsDesktopReportDeviceType string + +const ( + ZoneSpeedAPIPageListResponseResultTestsDesktopReportDeviceTypeDesktop ZoneSpeedAPIPageListResponseResultTestsDesktopReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageListResponseResultTestsDesktopReportDeviceTypeMobile ZoneSpeedAPIPageListResponseResultTestsDesktopReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageListResponseResultTestsDesktopReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageListResponseResultTestsDesktopReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultTestsDesktopReportErrorJSON contains the JSON +// metadata for the struct +// [ZoneSpeedAPIPageListResponseResultTestsDesktopReportError] +type zoneSpeedAPIPageListResponseResultTestsDesktopReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResultTestsDesktopReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCode string + +const ( + ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCodeNotReachable ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCodeDNSFailure ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCodeNotHTML ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCodeUnknown ZoneSpeedAPIPageListResponseResultTestsDesktopReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageListResponseResultTestsDesktopReportState string + +const ( + ZoneSpeedAPIPageListResponseResultTestsDesktopReportStateRunning ZoneSpeedAPIPageListResponseResultTestsDesktopReportState = "RUNNING" + ZoneSpeedAPIPageListResponseResultTestsDesktopReportStateComplete ZoneSpeedAPIPageListResponseResultTestsDesktopReportState = "COMPLETE" + ZoneSpeedAPIPageListResponseResultTestsDesktopReportStateFailed ZoneSpeedAPIPageListResponseResultTestsDesktopReportState = "FAILED" +) + +// The Lighthouse report. +type ZoneSpeedAPIPageListResponseResultTestsMobileReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageListResponseResultTestsMobileReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageListResponseResultTestsMobileReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageListResponseResultTestsMobileReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageListResponseResultTestsMobileReportJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultTestsMobileReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageListResponseResultTestsMobileReport] +type zoneSpeedAPIPageListResponseResultTestsMobileReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResultTestsMobileReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageListResponseResultTestsMobileReportDeviceType string + +const ( + ZoneSpeedAPIPageListResponseResultTestsMobileReportDeviceTypeDesktop ZoneSpeedAPIPageListResponseResultTestsMobileReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageListResponseResultTestsMobileReportDeviceTypeMobile ZoneSpeedAPIPageListResponseResultTestsMobileReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageListResponseResultTestsMobileReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageListResponseResultTestsMobileReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultTestsMobileReportErrorJSON contains the JSON +// metadata for the struct +// [ZoneSpeedAPIPageListResponseResultTestsMobileReportError] +type zoneSpeedAPIPageListResponseResultTestsMobileReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResultTestsMobileReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCode string + +const ( + ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCodeNotReachable ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCodeDNSFailure ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCodeNotHTML ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCodeUnknown ZoneSpeedAPIPageListResponseResultTestsMobileReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageListResponseResultTestsMobileReportState string + +const ( + ZoneSpeedAPIPageListResponseResultTestsMobileReportStateRunning ZoneSpeedAPIPageListResponseResultTestsMobileReportState = "RUNNING" + ZoneSpeedAPIPageListResponseResultTestsMobileReportStateComplete ZoneSpeedAPIPageListResponseResultTestsMobileReportState = "COMPLETE" + ZoneSpeedAPIPageListResponseResultTestsMobileReportStateFailed ZoneSpeedAPIPageListResponseResultTestsMobileReportState = "FAILED" +) + +// A test region with a label. +type ZoneSpeedAPIPageListResponseResultTestsRegion struct { + Label string `json:"label"` + // A test region. + Value ZoneSpeedAPIPageListResponseResultTestsRegionValue `json:"value"` + JSON zoneSpeedAPIPageListResponseResultTestsRegionJSON `json:"-"` +} + +// zoneSpeedAPIPageListResponseResultTestsRegionJSON contains the JSON metadata for +// the struct [ZoneSpeedAPIPageListResponseResultTestsRegion] +type zoneSpeedAPIPageListResponseResultTestsRegionJSON struct { + Label apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageListResponseResultTestsRegion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region. +type ZoneSpeedAPIPageListResponseResultTestsRegionValue string + +const ( + ZoneSpeedAPIPageListResponseResultTestsRegionValueAsiaEast1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "asia-east1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueAsiaNortheast1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "asia-northeast1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueAsiaNortheast2 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "asia-northeast2" + ZoneSpeedAPIPageListResponseResultTestsRegionValueAsiaSouth1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "asia-south1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueAsiaSoutheast1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "asia-southeast1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueAustraliaSoutheast1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "australia-southeast1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeNorth1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-north1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeSouthwest1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-southwest1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeWest1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-west1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeWest2 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-west2" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeWest3 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-west3" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeWest4 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-west4" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeWest8 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-west8" + ZoneSpeedAPIPageListResponseResultTestsRegionValueEuropeWest9 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "europe-west9" + ZoneSpeedAPIPageListResponseResultTestsRegionValueMeWest1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "me-west1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueSouthamericaEast1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "southamerica-east1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueUsCentral1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "us-central1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueUsEast1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "us-east1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueUsEast4 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "us-east4" + ZoneSpeedAPIPageListResponseResultTestsRegionValueUsSouth1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "us-south1" + ZoneSpeedAPIPageListResponseResultTestsRegionValueUsWest1 ZoneSpeedAPIPageListResponseResultTestsRegionValue = "us-west1" +) + +// The frequency of the test. +type ZoneSpeedAPIPageListResponseResultTestsScheduleFrequency string + +const ( + ZoneSpeedAPIPageListResponseResultTestsScheduleFrequencyDaily ZoneSpeedAPIPageListResponseResultTestsScheduleFrequency = "DAILY" + ZoneSpeedAPIPageListResponseResultTestsScheduleFrequencyWeekly ZoneSpeedAPIPageListResponseResultTestsScheduleFrequency = "WEEKLY" +) + +type ZoneSpeedAPIPageTrendResponse struct { + Errors []ZoneSpeedAPIPageTrendResponseError `json:"errors"` + Messages []ZoneSpeedAPIPageTrendResponseMessage `json:"messages"` + Result ZoneSpeedAPIPageTrendResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIPageTrendResponseJSON `json:"-"` +} + +// zoneSpeedAPIPageTrendResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageTrendResponse] +type zoneSpeedAPIPageTrendResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTrendResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTrendResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTrendResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTrendResponseErrorJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageTrendResponseError] +type zoneSpeedAPIPageTrendResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTrendResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTrendResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTrendResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIPageTrendResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTrendResponseMessage] +type zoneSpeedAPIPageTrendResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTrendResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTrendResponseResult struct { + // Cumulative Layout Shift trend. + Cls []float64 `json:"cls"` + // First Contentful Paint trend. + Fcp []float64 `json:"fcp"` + // Largest Contentful Paint trend. + Lcp []float64 `json:"lcp"` + // The Lighthouse score trend. + PerformanceScore []float64 `json:"performanceScore"` + // Speed Index trend. + Si []float64 `json:"si"` + // Total Blocking Time trend. + Tbt []float64 `json:"tbt"` + // Time To First Byte trend. + Ttfb []float64 `json:"ttfb"` + // Time To Interactive trend. + Tti []float64 `json:"tti"` + JSON zoneSpeedAPIPageTrendResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIPageTrendResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTrendResponseResult] +type zoneSpeedAPIPageTrendResponseResultJSON struct { + Cls apijson.Field + Fcp apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTrendResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTrendParams struct { + // The type of device. + DeviceType param.Field[ZoneSpeedAPIPageTrendParamsDeviceType] `query:"deviceType,required"` + // A comma-separated list of metrics to include in the results. + Metrics param.Field[string] `query:"metrics,required"` + // A test region. + Region param.Field[ZoneSpeedAPIPageTrendParamsRegion] `query:"region,required"` + // The timezone of the start and end timestamps. + Tz param.Field[string] `query:"tz,required"` +} + +// URLQuery serializes [ZoneSpeedAPIPageTrendParams]'s query parameters as +// `url.Values`. +func (r ZoneSpeedAPIPageTrendParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The type of device. +type ZoneSpeedAPIPageTrendParamsDeviceType string + +const ( + ZoneSpeedAPIPageTrendParamsDeviceTypeDesktop ZoneSpeedAPIPageTrendParamsDeviceType = "DESKTOP" + ZoneSpeedAPIPageTrendParamsDeviceTypeMobile ZoneSpeedAPIPageTrendParamsDeviceType = "MOBILE" +) + +// A test region. +type ZoneSpeedAPIPageTrendParamsRegion string + +const ( + ZoneSpeedAPIPageTrendParamsRegionAsiaEast1 ZoneSpeedAPIPageTrendParamsRegion = "asia-east1" + ZoneSpeedAPIPageTrendParamsRegionAsiaNortheast1 ZoneSpeedAPIPageTrendParamsRegion = "asia-northeast1" + ZoneSpeedAPIPageTrendParamsRegionAsiaNortheast2 ZoneSpeedAPIPageTrendParamsRegion = "asia-northeast2" + ZoneSpeedAPIPageTrendParamsRegionAsiaSouth1 ZoneSpeedAPIPageTrendParamsRegion = "asia-south1" + ZoneSpeedAPIPageTrendParamsRegionAsiaSoutheast1 ZoneSpeedAPIPageTrendParamsRegion = "asia-southeast1" + ZoneSpeedAPIPageTrendParamsRegionAustraliaSoutheast1 ZoneSpeedAPIPageTrendParamsRegion = "australia-southeast1" + ZoneSpeedAPIPageTrendParamsRegionEuropeNorth1 ZoneSpeedAPIPageTrendParamsRegion = "europe-north1" + ZoneSpeedAPIPageTrendParamsRegionEuropeSouthwest1 ZoneSpeedAPIPageTrendParamsRegion = "europe-southwest1" + ZoneSpeedAPIPageTrendParamsRegionEuropeWest1 ZoneSpeedAPIPageTrendParamsRegion = "europe-west1" + ZoneSpeedAPIPageTrendParamsRegionEuropeWest2 ZoneSpeedAPIPageTrendParamsRegion = "europe-west2" + ZoneSpeedAPIPageTrendParamsRegionEuropeWest3 ZoneSpeedAPIPageTrendParamsRegion = "europe-west3" + ZoneSpeedAPIPageTrendParamsRegionEuropeWest4 ZoneSpeedAPIPageTrendParamsRegion = "europe-west4" + ZoneSpeedAPIPageTrendParamsRegionEuropeWest8 ZoneSpeedAPIPageTrendParamsRegion = "europe-west8" + ZoneSpeedAPIPageTrendParamsRegionEuropeWest9 ZoneSpeedAPIPageTrendParamsRegion = "europe-west9" + ZoneSpeedAPIPageTrendParamsRegionMeWest1 ZoneSpeedAPIPageTrendParamsRegion = "me-west1" + ZoneSpeedAPIPageTrendParamsRegionSouthamericaEast1 ZoneSpeedAPIPageTrendParamsRegion = "southamerica-east1" + ZoneSpeedAPIPageTrendParamsRegionUsCentral1 ZoneSpeedAPIPageTrendParamsRegion = "us-central1" + ZoneSpeedAPIPageTrendParamsRegionUsEast1 ZoneSpeedAPIPageTrendParamsRegion = "us-east1" + ZoneSpeedAPIPageTrendParamsRegionUsEast4 ZoneSpeedAPIPageTrendParamsRegion = "us-east4" + ZoneSpeedAPIPageTrendParamsRegionUsSouth1 ZoneSpeedAPIPageTrendParamsRegion = "us-south1" + ZoneSpeedAPIPageTrendParamsRegionUsWest1 ZoneSpeedAPIPageTrendParamsRegion = "us-west1" +) diff --git a/zonespeedapipage_test.go b/zonespeedapipage_test.go new file mode 100644 index 00000000000..757d9f88398 --- /dev/null +++ b/zonespeedapipage_test.go @@ -0,0 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSpeedAPIPageList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Pages.List(context.TODO(), "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()) + } +} + +func TestZoneSpeedAPIPageTrend(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Pages.Trend( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + cloudflare.ZoneSpeedAPIPageTrendParams{ + DeviceType: cloudflare.F(cloudflare.ZoneSpeedAPIPageTrendParamsDeviceTypeDesktop), + Metrics: cloudflare.F("performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls"), + Region: cloudflare.F(cloudflare.ZoneSpeedAPIPageTrendParamsRegionUsCentral1), + Tz: cloudflare.F("string"), + }, + ) + 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/zonespeedapipagetest.go b/zonespeedapipagetest.go new file mode 100644 index 00000000000..054042813aa --- /dev/null +++ b/zonespeedapipagetest.go @@ -0,0 +1,1374 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpeedAPIPageTestService 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 [NewZoneSpeedAPIPageTestService] +// method instead. +type ZoneSpeedAPIPageTestService struct { + Options []option.RequestOption +} + +// NewZoneSpeedAPIPageTestService 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 NewZoneSpeedAPIPageTestService(opts ...option.RequestOption) (r *ZoneSpeedAPIPageTestService) { + r = &ZoneSpeedAPIPageTestService{} + r.Options = opts + return +} + +// Starts a test for a specific webpage, in a specific region. +func (r *ZoneSpeedAPIPageTestService) New(ctx context.Context, zoneIdentifier string, url string, body ZoneSpeedAPIPageTestNewParams, opts ...option.RequestOption) (res *ZoneSpeedAPIPageTestNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", zoneIdentifier, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Retrieves the result of a specific test. +func (r *ZoneSpeedAPIPageTestService) Get(ctx context.Context, zoneIdentifier string, url string, testIdentifier string, opts ...option.RequestOption) (res *ZoneSpeedAPIPageTestGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests/%s", zoneIdentifier, url, testIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Test history (list of tests) for a specific webpage. +func (r *ZoneSpeedAPIPageTestService) List(ctx context.Context, zoneIdentifier string, url string, query ZoneSpeedAPIPageTestListParams, opts ...option.RequestOption) (res *ZoneSpeedAPIPageTestListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", zoneIdentifier, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Deletes all tests for a specific webpage from a specific region. Deleted tests +// are still counted as part of the quota. +func (r *ZoneSpeedAPIPageTestService) Delete(ctx context.Context, zoneIdentifier string, url string, body ZoneSpeedAPIPageTestDeleteParams, opts ...option.RequestOption) (res *ZoneSpeedAPIPageTestDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", zoneIdentifier, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +type ZoneSpeedAPIPageTestNewResponse struct { + Errors []ZoneSpeedAPIPageTestNewResponseError `json:"errors"` + Messages []ZoneSpeedAPIPageTestNewResponseMessage `json:"messages"` + Result ZoneSpeedAPIPageTestNewResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIPageTestNewResponseJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageTestNewResponse] +type zoneSpeedAPIPageTestNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestNewResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestNewResponseError] +type zoneSpeedAPIPageTestNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestNewResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestNewResponseMessage] +type zoneSpeedAPIPageTestNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestNewResponseResult struct { + // UUID + ID string `json:"id"` + Date time.Time `json:"date" format:"date-time"` + // The Lighthouse report. + DesktopReport ZoneSpeedAPIPageTestNewResponseResultDesktopReport `json:"desktopReport"` + // The Lighthouse report. + MobileReport ZoneSpeedAPIPageTestNewResponseResultMobileReport `json:"mobileReport"` + // A test region with a label. + Region ZoneSpeedAPIPageTestNewResponseResultRegion `json:"region"` + // The frequency of the test. + ScheduleFrequency ZoneSpeedAPIPageTestNewResponseResultScheduleFrequency `json:"scheduleFrequency"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIPageTestNewResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestNewResponseResult] +type zoneSpeedAPIPageTestNewResponseResultJSON struct { + ID apijson.Field + Date apijson.Field + DesktopReport apijson.Field + MobileReport apijson.Field + Region apijson.Field + ScheduleFrequency apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The Lighthouse report. +type ZoneSpeedAPIPageTestNewResponseResultDesktopReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageTestNewResponseResultDesktopReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageTestNewResponseResultDesktopReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageTestNewResponseResultDesktopReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageTestNewResponseResultDesktopReportJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseResultDesktopReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageTestNewResponseResultDesktopReport] +type zoneSpeedAPIPageTestNewResponseResultDesktopReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseResultDesktopReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageTestNewResponseResultDesktopReportDeviceType string + +const ( + ZoneSpeedAPIPageTestNewResponseResultDesktopReportDeviceTypeDesktop ZoneSpeedAPIPageTestNewResponseResultDesktopReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageTestNewResponseResultDesktopReportDeviceTypeMobile ZoneSpeedAPIPageTestNewResponseResultDesktopReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageTestNewResponseResultDesktopReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageTestNewResponseResultDesktopReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseResultDesktopReportErrorJSON contains the JSON +// metadata for the struct +// [ZoneSpeedAPIPageTestNewResponseResultDesktopReportError] +type zoneSpeedAPIPageTestNewResponseResultDesktopReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseResultDesktopReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCode string + +const ( + ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCodeNotReachable ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCodeDNSFailure ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCodeNotHTML ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCodeUnknown ZoneSpeedAPIPageTestNewResponseResultDesktopReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageTestNewResponseResultDesktopReportState string + +const ( + ZoneSpeedAPIPageTestNewResponseResultDesktopReportStateRunning ZoneSpeedAPIPageTestNewResponseResultDesktopReportState = "RUNNING" + ZoneSpeedAPIPageTestNewResponseResultDesktopReportStateComplete ZoneSpeedAPIPageTestNewResponseResultDesktopReportState = "COMPLETE" + ZoneSpeedAPIPageTestNewResponseResultDesktopReportStateFailed ZoneSpeedAPIPageTestNewResponseResultDesktopReportState = "FAILED" +) + +// The Lighthouse report. +type ZoneSpeedAPIPageTestNewResponseResultMobileReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageTestNewResponseResultMobileReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageTestNewResponseResultMobileReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageTestNewResponseResultMobileReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageTestNewResponseResultMobileReportJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseResultMobileReportJSON contains the JSON metadata +// for the struct [ZoneSpeedAPIPageTestNewResponseResultMobileReport] +type zoneSpeedAPIPageTestNewResponseResultMobileReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseResultMobileReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageTestNewResponseResultMobileReportDeviceType string + +const ( + ZoneSpeedAPIPageTestNewResponseResultMobileReportDeviceTypeDesktop ZoneSpeedAPIPageTestNewResponseResultMobileReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageTestNewResponseResultMobileReportDeviceTypeMobile ZoneSpeedAPIPageTestNewResponseResultMobileReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageTestNewResponseResultMobileReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageTestNewResponseResultMobileReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseResultMobileReportErrorJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageTestNewResponseResultMobileReportError] +type zoneSpeedAPIPageTestNewResponseResultMobileReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseResultMobileReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCode string + +const ( + ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCodeNotReachable ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCodeDNSFailure ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCodeNotHTML ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCodeUnknown ZoneSpeedAPIPageTestNewResponseResultMobileReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageTestNewResponseResultMobileReportState string + +const ( + ZoneSpeedAPIPageTestNewResponseResultMobileReportStateRunning ZoneSpeedAPIPageTestNewResponseResultMobileReportState = "RUNNING" + ZoneSpeedAPIPageTestNewResponseResultMobileReportStateComplete ZoneSpeedAPIPageTestNewResponseResultMobileReportState = "COMPLETE" + ZoneSpeedAPIPageTestNewResponseResultMobileReportStateFailed ZoneSpeedAPIPageTestNewResponseResultMobileReportState = "FAILED" +) + +// A test region with a label. +type ZoneSpeedAPIPageTestNewResponseResultRegion struct { + Label string `json:"label"` + // A test region. + Value ZoneSpeedAPIPageTestNewResponseResultRegionValue `json:"value"` + JSON zoneSpeedAPIPageTestNewResponseResultRegionJSON `json:"-"` +} + +// zoneSpeedAPIPageTestNewResponseResultRegionJSON contains the JSON metadata for +// the struct [ZoneSpeedAPIPageTestNewResponseResultRegion] +type zoneSpeedAPIPageTestNewResponseResultRegionJSON struct { + Label apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestNewResponseResultRegion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region. +type ZoneSpeedAPIPageTestNewResponseResultRegionValue string + +const ( + ZoneSpeedAPIPageTestNewResponseResultRegionValueAsiaEast1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "asia-east1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueAsiaNortheast1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "asia-northeast1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueAsiaNortheast2 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "asia-northeast2" + ZoneSpeedAPIPageTestNewResponseResultRegionValueAsiaSouth1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "asia-south1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueAsiaSoutheast1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "asia-southeast1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueAustraliaSoutheast1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "australia-southeast1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeNorth1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-north1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeSouthwest1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-southwest1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeWest1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-west1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeWest2 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-west2" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeWest3 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-west3" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeWest4 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-west4" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeWest8 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-west8" + ZoneSpeedAPIPageTestNewResponseResultRegionValueEuropeWest9 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "europe-west9" + ZoneSpeedAPIPageTestNewResponseResultRegionValueMeWest1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "me-west1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueSouthamericaEast1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "southamerica-east1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueUsCentral1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "us-central1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueUsEast1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "us-east1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueUsEast4 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "us-east4" + ZoneSpeedAPIPageTestNewResponseResultRegionValueUsSouth1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "us-south1" + ZoneSpeedAPIPageTestNewResponseResultRegionValueUsWest1 ZoneSpeedAPIPageTestNewResponseResultRegionValue = "us-west1" +) + +// The frequency of the test. +type ZoneSpeedAPIPageTestNewResponseResultScheduleFrequency string + +const ( + ZoneSpeedAPIPageTestNewResponseResultScheduleFrequencyDaily ZoneSpeedAPIPageTestNewResponseResultScheduleFrequency = "DAILY" + ZoneSpeedAPIPageTestNewResponseResultScheduleFrequencyWeekly ZoneSpeedAPIPageTestNewResponseResultScheduleFrequency = "WEEKLY" +) + +type ZoneSpeedAPIPageTestGetResponse struct { + Errors []ZoneSpeedAPIPageTestGetResponseError `json:"errors"` + Messages []ZoneSpeedAPIPageTestGetResponseMessage `json:"messages"` + Result ZoneSpeedAPIPageTestGetResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIPageTestGetResponseJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageTestGetResponse] +type zoneSpeedAPIPageTestGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestGetResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestGetResponseError] +type zoneSpeedAPIPageTestGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestGetResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestGetResponseMessage] +type zoneSpeedAPIPageTestGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestGetResponseResult struct { + // UUID + ID string `json:"id"` + Date time.Time `json:"date" format:"date-time"` + // The Lighthouse report. + DesktopReport ZoneSpeedAPIPageTestGetResponseResultDesktopReport `json:"desktopReport"` + // The Lighthouse report. + MobileReport ZoneSpeedAPIPageTestGetResponseResultMobileReport `json:"mobileReport"` + // A test region with a label. + Region ZoneSpeedAPIPageTestGetResponseResultRegion `json:"region"` + // The frequency of the test. + ScheduleFrequency ZoneSpeedAPIPageTestGetResponseResultScheduleFrequency `json:"scheduleFrequency"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIPageTestGetResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestGetResponseResult] +type zoneSpeedAPIPageTestGetResponseResultJSON struct { + ID apijson.Field + Date apijson.Field + DesktopReport apijson.Field + MobileReport apijson.Field + Region apijson.Field + ScheduleFrequency apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The Lighthouse report. +type ZoneSpeedAPIPageTestGetResponseResultDesktopReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageTestGetResponseResultDesktopReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageTestGetResponseResultDesktopReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageTestGetResponseResultDesktopReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageTestGetResponseResultDesktopReportJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseResultDesktopReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageTestGetResponseResultDesktopReport] +type zoneSpeedAPIPageTestGetResponseResultDesktopReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseResultDesktopReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageTestGetResponseResultDesktopReportDeviceType string + +const ( + ZoneSpeedAPIPageTestGetResponseResultDesktopReportDeviceTypeDesktop ZoneSpeedAPIPageTestGetResponseResultDesktopReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageTestGetResponseResultDesktopReportDeviceTypeMobile ZoneSpeedAPIPageTestGetResponseResultDesktopReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageTestGetResponseResultDesktopReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageTestGetResponseResultDesktopReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseResultDesktopReportErrorJSON contains the JSON +// metadata for the struct +// [ZoneSpeedAPIPageTestGetResponseResultDesktopReportError] +type zoneSpeedAPIPageTestGetResponseResultDesktopReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseResultDesktopReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCode string + +const ( + ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCodeNotReachable ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCodeDNSFailure ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCodeNotHTML ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCodeUnknown ZoneSpeedAPIPageTestGetResponseResultDesktopReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageTestGetResponseResultDesktopReportState string + +const ( + ZoneSpeedAPIPageTestGetResponseResultDesktopReportStateRunning ZoneSpeedAPIPageTestGetResponseResultDesktopReportState = "RUNNING" + ZoneSpeedAPIPageTestGetResponseResultDesktopReportStateComplete ZoneSpeedAPIPageTestGetResponseResultDesktopReportState = "COMPLETE" + ZoneSpeedAPIPageTestGetResponseResultDesktopReportStateFailed ZoneSpeedAPIPageTestGetResponseResultDesktopReportState = "FAILED" +) + +// The Lighthouse report. +type ZoneSpeedAPIPageTestGetResponseResultMobileReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageTestGetResponseResultMobileReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageTestGetResponseResultMobileReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageTestGetResponseResultMobileReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageTestGetResponseResultMobileReportJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseResultMobileReportJSON contains the JSON metadata +// for the struct [ZoneSpeedAPIPageTestGetResponseResultMobileReport] +type zoneSpeedAPIPageTestGetResponseResultMobileReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseResultMobileReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageTestGetResponseResultMobileReportDeviceType string + +const ( + ZoneSpeedAPIPageTestGetResponseResultMobileReportDeviceTypeDesktop ZoneSpeedAPIPageTestGetResponseResultMobileReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageTestGetResponseResultMobileReportDeviceTypeMobile ZoneSpeedAPIPageTestGetResponseResultMobileReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageTestGetResponseResultMobileReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageTestGetResponseResultMobileReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseResultMobileReportErrorJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageTestGetResponseResultMobileReportError] +type zoneSpeedAPIPageTestGetResponseResultMobileReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseResultMobileReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCode string + +const ( + ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCodeNotReachable ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCodeDNSFailure ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCodeNotHTML ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCodeUnknown ZoneSpeedAPIPageTestGetResponseResultMobileReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageTestGetResponseResultMobileReportState string + +const ( + ZoneSpeedAPIPageTestGetResponseResultMobileReportStateRunning ZoneSpeedAPIPageTestGetResponseResultMobileReportState = "RUNNING" + ZoneSpeedAPIPageTestGetResponseResultMobileReportStateComplete ZoneSpeedAPIPageTestGetResponseResultMobileReportState = "COMPLETE" + ZoneSpeedAPIPageTestGetResponseResultMobileReportStateFailed ZoneSpeedAPIPageTestGetResponseResultMobileReportState = "FAILED" +) + +// A test region with a label. +type ZoneSpeedAPIPageTestGetResponseResultRegion struct { + Label string `json:"label"` + // A test region. + Value ZoneSpeedAPIPageTestGetResponseResultRegionValue `json:"value"` + JSON zoneSpeedAPIPageTestGetResponseResultRegionJSON `json:"-"` +} + +// zoneSpeedAPIPageTestGetResponseResultRegionJSON contains the JSON metadata for +// the struct [ZoneSpeedAPIPageTestGetResponseResultRegion] +type zoneSpeedAPIPageTestGetResponseResultRegionJSON struct { + Label apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestGetResponseResultRegion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region. +type ZoneSpeedAPIPageTestGetResponseResultRegionValue string + +const ( + ZoneSpeedAPIPageTestGetResponseResultRegionValueAsiaEast1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "asia-east1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueAsiaNortheast1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "asia-northeast1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueAsiaNortheast2 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "asia-northeast2" + ZoneSpeedAPIPageTestGetResponseResultRegionValueAsiaSouth1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "asia-south1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueAsiaSoutheast1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "asia-southeast1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueAustraliaSoutheast1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "australia-southeast1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeNorth1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-north1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeSouthwest1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-southwest1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeWest1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-west1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeWest2 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-west2" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeWest3 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-west3" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeWest4 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-west4" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeWest8 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-west8" + ZoneSpeedAPIPageTestGetResponseResultRegionValueEuropeWest9 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "europe-west9" + ZoneSpeedAPIPageTestGetResponseResultRegionValueMeWest1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "me-west1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueSouthamericaEast1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "southamerica-east1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueUsCentral1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "us-central1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueUsEast1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "us-east1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueUsEast4 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "us-east4" + ZoneSpeedAPIPageTestGetResponseResultRegionValueUsSouth1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "us-south1" + ZoneSpeedAPIPageTestGetResponseResultRegionValueUsWest1 ZoneSpeedAPIPageTestGetResponseResultRegionValue = "us-west1" +) + +// The frequency of the test. +type ZoneSpeedAPIPageTestGetResponseResultScheduleFrequency string + +const ( + ZoneSpeedAPIPageTestGetResponseResultScheduleFrequencyDaily ZoneSpeedAPIPageTestGetResponseResultScheduleFrequency = "DAILY" + ZoneSpeedAPIPageTestGetResponseResultScheduleFrequencyWeekly ZoneSpeedAPIPageTestGetResponseResultScheduleFrequency = "WEEKLY" +) + +type ZoneSpeedAPIPageTestListResponse struct { + Errors []ZoneSpeedAPIPageTestListResponseError `json:"errors"` + Messages []ZoneSpeedAPIPageTestListResponseMessage `json:"messages"` + Result []ZoneSpeedAPIPageTestListResponseResult `json:"result"` + ResultInfo ZoneSpeedAPIPageTestListResponseResultInfo `json:"result_info"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIPageTestListResponseJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageTestListResponse] +type zoneSpeedAPIPageTestListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestListResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestListResponseError] +type zoneSpeedAPIPageTestListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestListResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestListResponseMessage] +type zoneSpeedAPIPageTestListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestListResponseResult struct { + // UUID + ID string `json:"id"` + Date time.Time `json:"date" format:"date-time"` + // The Lighthouse report. + DesktopReport ZoneSpeedAPIPageTestListResponseResultDesktopReport `json:"desktopReport"` + // The Lighthouse report. + MobileReport ZoneSpeedAPIPageTestListResponseResultMobileReport `json:"mobileReport"` + // A test region with a label. + Region ZoneSpeedAPIPageTestListResponseResultRegion `json:"region"` + // The frequency of the test. + ScheduleFrequency ZoneSpeedAPIPageTestListResponseResultScheduleFrequency `json:"scheduleFrequency"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIPageTestListResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestListResponseResult] +type zoneSpeedAPIPageTestListResponseResultJSON struct { + ID apijson.Field + Date apijson.Field + DesktopReport apijson.Field + MobileReport apijson.Field + Region apijson.Field + ScheduleFrequency apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The Lighthouse report. +type ZoneSpeedAPIPageTestListResponseResultDesktopReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageTestListResponseResultDesktopReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageTestListResponseResultDesktopReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageTestListResponseResultDesktopReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageTestListResponseResultDesktopReportJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseResultDesktopReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageTestListResponseResultDesktopReport] +type zoneSpeedAPIPageTestListResponseResultDesktopReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseResultDesktopReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageTestListResponseResultDesktopReportDeviceType string + +const ( + ZoneSpeedAPIPageTestListResponseResultDesktopReportDeviceTypeDesktop ZoneSpeedAPIPageTestListResponseResultDesktopReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageTestListResponseResultDesktopReportDeviceTypeMobile ZoneSpeedAPIPageTestListResponseResultDesktopReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageTestListResponseResultDesktopReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageTestListResponseResultDesktopReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseResultDesktopReportErrorJSON contains the JSON +// metadata for the struct +// [ZoneSpeedAPIPageTestListResponseResultDesktopReportError] +type zoneSpeedAPIPageTestListResponseResultDesktopReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseResultDesktopReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCode string + +const ( + ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCodeNotReachable ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCodeDNSFailure ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCodeNotHTML ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCodeUnknown ZoneSpeedAPIPageTestListResponseResultDesktopReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageTestListResponseResultDesktopReportState string + +const ( + ZoneSpeedAPIPageTestListResponseResultDesktopReportStateRunning ZoneSpeedAPIPageTestListResponseResultDesktopReportState = "RUNNING" + ZoneSpeedAPIPageTestListResponseResultDesktopReportStateComplete ZoneSpeedAPIPageTestListResponseResultDesktopReportState = "COMPLETE" + ZoneSpeedAPIPageTestListResponseResultDesktopReportStateFailed ZoneSpeedAPIPageTestListResponseResultDesktopReportState = "FAILED" +) + +// The Lighthouse report. +type ZoneSpeedAPIPageTestListResponseResultMobileReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIPageTestListResponseResultMobileReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIPageTestListResponseResultMobileReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIPageTestListResponseResultMobileReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIPageTestListResponseResultMobileReportJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseResultMobileReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIPageTestListResponseResultMobileReport] +type zoneSpeedAPIPageTestListResponseResultMobileReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseResultMobileReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIPageTestListResponseResultMobileReportDeviceType string + +const ( + ZoneSpeedAPIPageTestListResponseResultMobileReportDeviceTypeDesktop ZoneSpeedAPIPageTestListResponseResultMobileReportDeviceType = "DESKTOP" + ZoneSpeedAPIPageTestListResponseResultMobileReportDeviceTypeMobile ZoneSpeedAPIPageTestListResponseResultMobileReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIPageTestListResponseResultMobileReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIPageTestListResponseResultMobileReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseResultMobileReportErrorJSON contains the JSON +// metadata for the struct +// [ZoneSpeedAPIPageTestListResponseResultMobileReportError] +type zoneSpeedAPIPageTestListResponseResultMobileReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseResultMobileReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCode string + +const ( + ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCodeNotReachable ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCodeDNSFailure ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCodeNotHTML ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCode = "NOT_HTML" + ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCodeLighthouseTimeout ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCodeUnknown ZoneSpeedAPIPageTestListResponseResultMobileReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIPageTestListResponseResultMobileReportState string + +const ( + ZoneSpeedAPIPageTestListResponseResultMobileReportStateRunning ZoneSpeedAPIPageTestListResponseResultMobileReportState = "RUNNING" + ZoneSpeedAPIPageTestListResponseResultMobileReportStateComplete ZoneSpeedAPIPageTestListResponseResultMobileReportState = "COMPLETE" + ZoneSpeedAPIPageTestListResponseResultMobileReportStateFailed ZoneSpeedAPIPageTestListResponseResultMobileReportState = "FAILED" +) + +// A test region with a label. +type ZoneSpeedAPIPageTestListResponseResultRegion struct { + Label string `json:"label"` + // A test region. + Value ZoneSpeedAPIPageTestListResponseResultRegionValue `json:"value"` + JSON zoneSpeedAPIPageTestListResponseResultRegionJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseResultRegionJSON contains the JSON metadata for +// the struct [ZoneSpeedAPIPageTestListResponseResultRegion] +type zoneSpeedAPIPageTestListResponseResultRegionJSON struct { + Label apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseResultRegion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region. +type ZoneSpeedAPIPageTestListResponseResultRegionValue string + +const ( + ZoneSpeedAPIPageTestListResponseResultRegionValueAsiaEast1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "asia-east1" + ZoneSpeedAPIPageTestListResponseResultRegionValueAsiaNortheast1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "asia-northeast1" + ZoneSpeedAPIPageTestListResponseResultRegionValueAsiaNortheast2 ZoneSpeedAPIPageTestListResponseResultRegionValue = "asia-northeast2" + ZoneSpeedAPIPageTestListResponseResultRegionValueAsiaSouth1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "asia-south1" + ZoneSpeedAPIPageTestListResponseResultRegionValueAsiaSoutheast1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "asia-southeast1" + ZoneSpeedAPIPageTestListResponseResultRegionValueAustraliaSoutheast1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "australia-southeast1" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeNorth1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-north1" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeSouthwest1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-southwest1" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeWest1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-west1" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeWest2 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-west2" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeWest3 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-west3" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeWest4 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-west4" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeWest8 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-west8" + ZoneSpeedAPIPageTestListResponseResultRegionValueEuropeWest9 ZoneSpeedAPIPageTestListResponseResultRegionValue = "europe-west9" + ZoneSpeedAPIPageTestListResponseResultRegionValueMeWest1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "me-west1" + ZoneSpeedAPIPageTestListResponseResultRegionValueSouthamericaEast1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "southamerica-east1" + ZoneSpeedAPIPageTestListResponseResultRegionValueUsCentral1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "us-central1" + ZoneSpeedAPIPageTestListResponseResultRegionValueUsEast1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "us-east1" + ZoneSpeedAPIPageTestListResponseResultRegionValueUsEast4 ZoneSpeedAPIPageTestListResponseResultRegionValue = "us-east4" + ZoneSpeedAPIPageTestListResponseResultRegionValueUsSouth1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "us-south1" + ZoneSpeedAPIPageTestListResponseResultRegionValueUsWest1 ZoneSpeedAPIPageTestListResponseResultRegionValue = "us-west1" +) + +// The frequency of the test. +type ZoneSpeedAPIPageTestListResponseResultScheduleFrequency string + +const ( + ZoneSpeedAPIPageTestListResponseResultScheduleFrequencyDaily ZoneSpeedAPIPageTestListResponseResultScheduleFrequency = "DAILY" + ZoneSpeedAPIPageTestListResponseResultScheduleFrequencyWeekly ZoneSpeedAPIPageTestListResponseResultScheduleFrequency = "WEEKLY" +) + +type ZoneSpeedAPIPageTestListResponseResultInfo struct { + Count int64 `json:"count"` + Page int64 `json:"page"` + PerPage int64 `json:"per_page"` + TotalCount int64 `json:"total_count"` + JSON zoneSpeedAPIPageTestListResponseResultInfoJSON `json:"-"` +} + +// zoneSpeedAPIPageTestListResponseResultInfoJSON contains the JSON metadata for +// the struct [ZoneSpeedAPIPageTestListResponseResultInfo] +type zoneSpeedAPIPageTestListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestDeleteResponse struct { + Errors []ZoneSpeedAPIPageTestDeleteResponseError `json:"errors"` + Messages []ZoneSpeedAPIPageTestDeleteResponseMessage `json:"messages"` + Result ZoneSpeedAPIPageTestDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIPageTestDeleteResponseJSON `json:"-"` +} + +// zoneSpeedAPIPageTestDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIPageTestDeleteResponse] +type zoneSpeedAPIPageTestDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestDeleteResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIPageTestDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestDeleteResponseError] +type zoneSpeedAPIPageTestDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIPageTestDeleteResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIPageTestDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestDeleteResponseMessage] +type zoneSpeedAPIPageTestDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestDeleteResponseResult struct { + // Number of items affected. + Count float64 `json:"count"` + JSON zoneSpeedAPIPageTestDeleteResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIPageTestDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIPageTestDeleteResponseResult] +type zoneSpeedAPIPageTestDeleteResponseResultJSON struct { + Count apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIPageTestDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIPageTestNewParams struct { + // A test region. + Region param.Field[ZoneSpeedAPIPageTestNewParamsRegion] `json:"region"` +} + +func (r ZoneSpeedAPIPageTestNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A test region. +type ZoneSpeedAPIPageTestNewParamsRegion string + +const ( + ZoneSpeedAPIPageTestNewParamsRegionAsiaEast1 ZoneSpeedAPIPageTestNewParamsRegion = "asia-east1" + ZoneSpeedAPIPageTestNewParamsRegionAsiaNortheast1 ZoneSpeedAPIPageTestNewParamsRegion = "asia-northeast1" + ZoneSpeedAPIPageTestNewParamsRegionAsiaNortheast2 ZoneSpeedAPIPageTestNewParamsRegion = "asia-northeast2" + ZoneSpeedAPIPageTestNewParamsRegionAsiaSouth1 ZoneSpeedAPIPageTestNewParamsRegion = "asia-south1" + ZoneSpeedAPIPageTestNewParamsRegionAsiaSoutheast1 ZoneSpeedAPIPageTestNewParamsRegion = "asia-southeast1" + ZoneSpeedAPIPageTestNewParamsRegionAustraliaSoutheast1 ZoneSpeedAPIPageTestNewParamsRegion = "australia-southeast1" + ZoneSpeedAPIPageTestNewParamsRegionEuropeNorth1 ZoneSpeedAPIPageTestNewParamsRegion = "europe-north1" + ZoneSpeedAPIPageTestNewParamsRegionEuropeSouthwest1 ZoneSpeedAPIPageTestNewParamsRegion = "europe-southwest1" + ZoneSpeedAPIPageTestNewParamsRegionEuropeWest1 ZoneSpeedAPIPageTestNewParamsRegion = "europe-west1" + ZoneSpeedAPIPageTestNewParamsRegionEuropeWest2 ZoneSpeedAPIPageTestNewParamsRegion = "europe-west2" + ZoneSpeedAPIPageTestNewParamsRegionEuropeWest3 ZoneSpeedAPIPageTestNewParamsRegion = "europe-west3" + ZoneSpeedAPIPageTestNewParamsRegionEuropeWest4 ZoneSpeedAPIPageTestNewParamsRegion = "europe-west4" + ZoneSpeedAPIPageTestNewParamsRegionEuropeWest8 ZoneSpeedAPIPageTestNewParamsRegion = "europe-west8" + ZoneSpeedAPIPageTestNewParamsRegionEuropeWest9 ZoneSpeedAPIPageTestNewParamsRegion = "europe-west9" + ZoneSpeedAPIPageTestNewParamsRegionMeWest1 ZoneSpeedAPIPageTestNewParamsRegion = "me-west1" + ZoneSpeedAPIPageTestNewParamsRegionSouthamericaEast1 ZoneSpeedAPIPageTestNewParamsRegion = "southamerica-east1" + ZoneSpeedAPIPageTestNewParamsRegionUsCentral1 ZoneSpeedAPIPageTestNewParamsRegion = "us-central1" + ZoneSpeedAPIPageTestNewParamsRegionUsEast1 ZoneSpeedAPIPageTestNewParamsRegion = "us-east1" + ZoneSpeedAPIPageTestNewParamsRegionUsEast4 ZoneSpeedAPIPageTestNewParamsRegion = "us-east4" + ZoneSpeedAPIPageTestNewParamsRegionUsSouth1 ZoneSpeedAPIPageTestNewParamsRegion = "us-south1" + ZoneSpeedAPIPageTestNewParamsRegionUsWest1 ZoneSpeedAPIPageTestNewParamsRegion = "us-west1" +) + +type ZoneSpeedAPIPageTestListParams struct { + Page param.Field[int64] `query:"page"` + PerPage param.Field[int64] `query:"per_page"` + // A test region. + Region param.Field[ZoneSpeedAPIPageTestListParamsRegion] `query:"region"` +} + +// URLQuery serializes [ZoneSpeedAPIPageTestListParams]'s query parameters as +// `url.Values`. +func (r ZoneSpeedAPIPageTestListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type ZoneSpeedAPIPageTestListParamsRegion string + +const ( + ZoneSpeedAPIPageTestListParamsRegionAsiaEast1 ZoneSpeedAPIPageTestListParamsRegion = "asia-east1" + ZoneSpeedAPIPageTestListParamsRegionAsiaNortheast1 ZoneSpeedAPIPageTestListParamsRegion = "asia-northeast1" + ZoneSpeedAPIPageTestListParamsRegionAsiaNortheast2 ZoneSpeedAPIPageTestListParamsRegion = "asia-northeast2" + ZoneSpeedAPIPageTestListParamsRegionAsiaSouth1 ZoneSpeedAPIPageTestListParamsRegion = "asia-south1" + ZoneSpeedAPIPageTestListParamsRegionAsiaSoutheast1 ZoneSpeedAPIPageTestListParamsRegion = "asia-southeast1" + ZoneSpeedAPIPageTestListParamsRegionAustraliaSoutheast1 ZoneSpeedAPIPageTestListParamsRegion = "australia-southeast1" + ZoneSpeedAPIPageTestListParamsRegionEuropeNorth1 ZoneSpeedAPIPageTestListParamsRegion = "europe-north1" + ZoneSpeedAPIPageTestListParamsRegionEuropeSouthwest1 ZoneSpeedAPIPageTestListParamsRegion = "europe-southwest1" + ZoneSpeedAPIPageTestListParamsRegionEuropeWest1 ZoneSpeedAPIPageTestListParamsRegion = "europe-west1" + ZoneSpeedAPIPageTestListParamsRegionEuropeWest2 ZoneSpeedAPIPageTestListParamsRegion = "europe-west2" + ZoneSpeedAPIPageTestListParamsRegionEuropeWest3 ZoneSpeedAPIPageTestListParamsRegion = "europe-west3" + ZoneSpeedAPIPageTestListParamsRegionEuropeWest4 ZoneSpeedAPIPageTestListParamsRegion = "europe-west4" + ZoneSpeedAPIPageTestListParamsRegionEuropeWest8 ZoneSpeedAPIPageTestListParamsRegion = "europe-west8" + ZoneSpeedAPIPageTestListParamsRegionEuropeWest9 ZoneSpeedAPIPageTestListParamsRegion = "europe-west9" + ZoneSpeedAPIPageTestListParamsRegionMeWest1 ZoneSpeedAPIPageTestListParamsRegion = "me-west1" + ZoneSpeedAPIPageTestListParamsRegionSouthamericaEast1 ZoneSpeedAPIPageTestListParamsRegion = "southamerica-east1" + ZoneSpeedAPIPageTestListParamsRegionUsCentral1 ZoneSpeedAPIPageTestListParamsRegion = "us-central1" + ZoneSpeedAPIPageTestListParamsRegionUsEast1 ZoneSpeedAPIPageTestListParamsRegion = "us-east1" + ZoneSpeedAPIPageTestListParamsRegionUsEast4 ZoneSpeedAPIPageTestListParamsRegion = "us-east4" + ZoneSpeedAPIPageTestListParamsRegionUsSouth1 ZoneSpeedAPIPageTestListParamsRegion = "us-south1" + ZoneSpeedAPIPageTestListParamsRegionUsWest1 ZoneSpeedAPIPageTestListParamsRegion = "us-west1" +) + +type ZoneSpeedAPIPageTestDeleteParams struct { + // A test region. + Region param.Field[ZoneSpeedAPIPageTestDeleteParamsRegion] `query:"region"` +} + +// URLQuery serializes [ZoneSpeedAPIPageTestDeleteParams]'s query parameters as +// `url.Values`. +func (r ZoneSpeedAPIPageTestDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type ZoneSpeedAPIPageTestDeleteParamsRegion string + +const ( + ZoneSpeedAPIPageTestDeleteParamsRegionAsiaEast1 ZoneSpeedAPIPageTestDeleteParamsRegion = "asia-east1" + ZoneSpeedAPIPageTestDeleteParamsRegionAsiaNortheast1 ZoneSpeedAPIPageTestDeleteParamsRegion = "asia-northeast1" + ZoneSpeedAPIPageTestDeleteParamsRegionAsiaNortheast2 ZoneSpeedAPIPageTestDeleteParamsRegion = "asia-northeast2" + ZoneSpeedAPIPageTestDeleteParamsRegionAsiaSouth1 ZoneSpeedAPIPageTestDeleteParamsRegion = "asia-south1" + ZoneSpeedAPIPageTestDeleteParamsRegionAsiaSoutheast1 ZoneSpeedAPIPageTestDeleteParamsRegion = "asia-southeast1" + ZoneSpeedAPIPageTestDeleteParamsRegionAustraliaSoutheast1 ZoneSpeedAPIPageTestDeleteParamsRegion = "australia-southeast1" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeNorth1 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-north1" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeSouthwest1 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-southwest1" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeWest1 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-west1" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeWest2 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-west2" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeWest3 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-west3" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeWest4 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-west4" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeWest8 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-west8" + ZoneSpeedAPIPageTestDeleteParamsRegionEuropeWest9 ZoneSpeedAPIPageTestDeleteParamsRegion = "europe-west9" + ZoneSpeedAPIPageTestDeleteParamsRegionMeWest1 ZoneSpeedAPIPageTestDeleteParamsRegion = "me-west1" + ZoneSpeedAPIPageTestDeleteParamsRegionSouthamericaEast1 ZoneSpeedAPIPageTestDeleteParamsRegion = "southamerica-east1" + ZoneSpeedAPIPageTestDeleteParamsRegionUsCentral1 ZoneSpeedAPIPageTestDeleteParamsRegion = "us-central1" + ZoneSpeedAPIPageTestDeleteParamsRegionUsEast1 ZoneSpeedAPIPageTestDeleteParamsRegion = "us-east1" + ZoneSpeedAPIPageTestDeleteParamsRegionUsEast4 ZoneSpeedAPIPageTestDeleteParamsRegion = "us-east4" + ZoneSpeedAPIPageTestDeleteParamsRegionUsSouth1 ZoneSpeedAPIPageTestDeleteParamsRegion = "us-south1" + ZoneSpeedAPIPageTestDeleteParamsRegionUsWest1 ZoneSpeedAPIPageTestDeleteParamsRegion = "us-west1" +) diff --git a/zonespeedapipagetest_test.go b/zonespeedapipagetest_test.go new file mode 100644 index 00000000000..1edee52319e --- /dev/null +++ b/zonespeedapipagetest_test.go @@ -0,0 +1,146 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSpeedAPIPageTestNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Pages.Tests.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + cloudflare.ZoneSpeedAPIPageTestNewParams{ + Region: cloudflare.F(cloudflare.ZoneSpeedAPIPageTestNewParamsRegionUsCentral1), + }, + ) + 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 TestZoneSpeedAPIPageTestGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Pages.Tests.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + "string", + ) + 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 TestZoneSpeedAPIPageTestListWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Pages.Tests.List( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + cloudflare.ZoneSpeedAPIPageTestListParams{ + Page: cloudflare.F(int64(1)), + PerPage: cloudflare.F(int64(20)), + Region: cloudflare.F(cloudflare.ZoneSpeedAPIPageTestListParamsRegionUsCentral1), + }, + ) + 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 TestZoneSpeedAPIPageTestDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Pages.Tests.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + cloudflare.ZoneSpeedAPIPageTestDeleteParams{ + Region: cloudflare.F(cloudflare.ZoneSpeedAPIPageTestDeleteParamsRegionUsCentral1), + }, + ) + 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/zonespeedapischedule.go b/zonespeedapischedule.go new file mode 100644 index 00000000000..8d1c2282594 --- /dev/null +++ b/zonespeedapischedule.go @@ -0,0 +1,826 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSpeedAPIScheduleService 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 [NewZoneSpeedAPIScheduleService] +// method instead. +type ZoneSpeedAPIScheduleService struct { + Options []option.RequestOption +} + +// NewZoneSpeedAPIScheduleService 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 NewZoneSpeedAPIScheduleService(opts ...option.RequestOption) (r *ZoneSpeedAPIScheduleService) { + r = &ZoneSpeedAPIScheduleService{} + r.Options = opts + return +} + +// Creates a scheduled test for a page. +func (r *ZoneSpeedAPIScheduleService) New(ctx context.Context, zoneIdentifier string, url string, body ZoneSpeedAPIScheduleNewParams, opts ...option.RequestOption) (res *ZoneSpeedAPIScheduleNewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/schedule/%s", zoneIdentifier, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Retrieves the test schedule for a page in a specific region. +func (r *ZoneSpeedAPIScheduleService) Get(ctx context.Context, zoneIdentifier string, url string, query ZoneSpeedAPIScheduleGetParams, opts ...option.RequestOption) (res *ZoneSpeedAPIScheduleGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/schedule/%s", zoneIdentifier, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Deletes a scheduled test for a page. +func (r *ZoneSpeedAPIScheduleService) Delete(ctx context.Context, zoneIdentifier string, url string, body ZoneSpeedAPIScheduleDeleteParams, opts ...option.RequestOption) (res *ZoneSpeedAPIScheduleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/schedule/%s", zoneIdentifier, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return +} + +type ZoneSpeedAPIScheduleNewResponse struct { + Errors []ZoneSpeedAPIScheduleNewResponseError `json:"errors"` + Messages []ZoneSpeedAPIScheduleNewResponseMessage `json:"messages"` + Result ZoneSpeedAPIScheduleNewResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIScheduleNewResponseJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIScheduleNewResponse] +type zoneSpeedAPIScheduleNewResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleNewResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIScheduleNewResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleNewResponseError] +type zoneSpeedAPIScheduleNewResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleNewResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIScheduleNewResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleNewResponseMessage] +type zoneSpeedAPIScheduleNewResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleNewResponseResult struct { + // The test schedule. + Schedule ZoneSpeedAPIScheduleNewResponseResultSchedule `json:"schedule"` + Test ZoneSpeedAPIScheduleNewResponseResultTest `json:"test"` + JSON zoneSpeedAPIScheduleNewResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleNewResponseResult] +type zoneSpeedAPIScheduleNewResponseResultJSON struct { + Schedule apijson.Field + Test apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The test schedule. +type ZoneSpeedAPIScheduleNewResponseResultSchedule struct { + // The frequency of the test. + Frequency ZoneSpeedAPIScheduleNewResponseResultScheduleFrequency `json:"frequency"` + // A test region. + Region ZoneSpeedAPIScheduleNewResponseResultScheduleRegion `json:"region"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIScheduleNewResponseResultScheduleJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultScheduleJSON contains the JSON metadata for +// the struct [ZoneSpeedAPIScheduleNewResponseResultSchedule] +type zoneSpeedAPIScheduleNewResponseResultScheduleJSON struct { + Frequency apijson.Field + Region apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResultSchedule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency of the test. +type ZoneSpeedAPIScheduleNewResponseResultScheduleFrequency string + +const ( + ZoneSpeedAPIScheduleNewResponseResultScheduleFrequencyDaily ZoneSpeedAPIScheduleNewResponseResultScheduleFrequency = "DAILY" + ZoneSpeedAPIScheduleNewResponseResultScheduleFrequencyWeekly ZoneSpeedAPIScheduleNewResponseResultScheduleFrequency = "WEEKLY" +) + +// A test region. +type ZoneSpeedAPIScheduleNewResponseResultScheduleRegion string + +const ( + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionAsiaEast1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "asia-east1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionAsiaNortheast1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "asia-northeast1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionAsiaNortheast2 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "asia-northeast2" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionAsiaSouth1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "asia-south1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionAsiaSoutheast1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "asia-southeast1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionAustraliaSoutheast1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "australia-southeast1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeNorth1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-north1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeSouthwest1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-southwest1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeWest1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-west1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeWest2 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-west2" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeWest3 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-west3" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeWest4 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-west4" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeWest8 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-west8" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionEuropeWest9 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "europe-west9" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionMeWest1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "me-west1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionSouthamericaEast1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "southamerica-east1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionUsCentral1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "us-central1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionUsEast1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "us-east1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionUsEast4 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "us-east4" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionUsSouth1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "us-south1" + ZoneSpeedAPIScheduleNewResponseResultScheduleRegionUsWest1 ZoneSpeedAPIScheduleNewResponseResultScheduleRegion = "us-west1" +) + +type ZoneSpeedAPIScheduleNewResponseResultTest struct { + // UUID + ID string `json:"id"` + Date time.Time `json:"date" format:"date-time"` + // The Lighthouse report. + DesktopReport ZoneSpeedAPIScheduleNewResponseResultTestDesktopReport `json:"desktopReport"` + // The Lighthouse report. + MobileReport ZoneSpeedAPIScheduleNewResponseResultTestMobileReport `json:"mobileReport"` + // A test region with a label. + Region ZoneSpeedAPIScheduleNewResponseResultTestRegion `json:"region"` + // The frequency of the test. + ScheduleFrequency ZoneSpeedAPIScheduleNewResponseResultTestScheduleFrequency `json:"scheduleFrequency"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIScheduleNewResponseResultTestJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultTestJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleNewResponseResultTest] +type zoneSpeedAPIScheduleNewResponseResultTestJSON struct { + ID apijson.Field + Date apijson.Field + DesktopReport apijson.Field + MobileReport apijson.Field + Region apijson.Field + ScheduleFrequency apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResultTest) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The Lighthouse report. +type ZoneSpeedAPIScheduleNewResponseResultTestDesktopReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIScheduleNewResponseResultTestDesktopReportJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultTestDesktopReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIScheduleNewResponseResultTestDesktopReport] +type zoneSpeedAPIScheduleNewResponseResultTestDesktopReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResultTestDesktopReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportDeviceType string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportDeviceTypeDesktop ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportDeviceType = "DESKTOP" + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportDeviceTypeMobile ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorJSON contains the +// JSON metadata for the struct +// [ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportError] +type zoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCode string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCodeNotReachable ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCodeDNSFailure ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCodeNotHTML ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCode = "NOT_HTML" + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCodeLighthouseTimeout ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCodeUnknown ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportState string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportStateRunning ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportState = "RUNNING" + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportStateComplete ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportState = "COMPLETE" + ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportStateFailed ZoneSpeedAPIScheduleNewResponseResultTestDesktopReportState = "FAILED" +) + +// The Lighthouse report. +type ZoneSpeedAPIScheduleNewResponseResultTestMobileReport struct { + // Cumulative Layout Shift. + Cls float64 `json:"cls"` + // The type of device. + DeviceType ZoneSpeedAPIScheduleNewResponseResultTestMobileReportDeviceType `json:"deviceType"` + Error ZoneSpeedAPIScheduleNewResponseResultTestMobileReportError `json:"error"` + // First Contentful Paint. + Fcp float64 `json:"fcp"` + // The URL to the full Lighthouse JSON report. + JsonReportURL string `json:"jsonReportUrl"` + // Largest Contentful Paint. + Lcp float64 `json:"lcp"` + // The Lighthouse performance score. + PerformanceScore float64 `json:"performanceScore"` + // Speed Index. + Si float64 `json:"si"` + // The state of the Lighthouse report. + State ZoneSpeedAPIScheduleNewResponseResultTestMobileReportState `json:"state"` + // Total Blocking Time. + Tbt float64 `json:"tbt"` + // Time To First Byte. + Ttfb float64 `json:"ttfb"` + // Time To Interactive. + Tti float64 `json:"tti"` + JSON zoneSpeedAPIScheduleNewResponseResultTestMobileReportJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultTestMobileReportJSON contains the JSON +// metadata for the struct [ZoneSpeedAPIScheduleNewResponseResultTestMobileReport] +type zoneSpeedAPIScheduleNewResponseResultTestMobileReportJSON struct { + Cls apijson.Field + DeviceType apijson.Field + Error apijson.Field + Fcp apijson.Field + JsonReportURL apijson.Field + Lcp apijson.Field + PerformanceScore apijson.Field + Si apijson.Field + State apijson.Field + Tbt apijson.Field + Ttfb apijson.Field + Tti apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResultTestMobileReport) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The type of device. +type ZoneSpeedAPIScheduleNewResponseResultTestMobileReportDeviceType string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportDeviceTypeDesktop ZoneSpeedAPIScheduleNewResponseResultTestMobileReportDeviceType = "DESKTOP" + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportDeviceTypeMobile ZoneSpeedAPIScheduleNewResponseResultTestMobileReportDeviceType = "MOBILE" +) + +type ZoneSpeedAPIScheduleNewResponseResultTestMobileReportError struct { + // The error code of the Lighthouse result. + Code ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCode `json:"code"` + // Detailed error message. + Detail string `json:"detail"` + // The final URL displayed to the user. + FinalDisplayedURL string `json:"finalDisplayedUrl"` + JSON zoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorJSON contains the JSON +// metadata for the struct +// [ZoneSpeedAPIScheduleNewResponseResultTestMobileReportError] +type zoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorJSON struct { + Code apijson.Field + Detail apijson.Field + FinalDisplayedURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResultTestMobileReportError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The error code of the Lighthouse result. +type ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCode string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCodeNotReachable ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCode = "NOT_REACHABLE" + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCodeDNSFailure ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCode = "DNS_FAILURE" + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCodeNotHTML ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCode = "NOT_HTML" + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCodeLighthouseTimeout ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCode = "LIGHTHOUSE_TIMEOUT" + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCodeUnknown ZoneSpeedAPIScheduleNewResponseResultTestMobileReportErrorCode = "UNKNOWN" +) + +// The state of the Lighthouse report. +type ZoneSpeedAPIScheduleNewResponseResultTestMobileReportState string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportStateRunning ZoneSpeedAPIScheduleNewResponseResultTestMobileReportState = "RUNNING" + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportStateComplete ZoneSpeedAPIScheduleNewResponseResultTestMobileReportState = "COMPLETE" + ZoneSpeedAPIScheduleNewResponseResultTestMobileReportStateFailed ZoneSpeedAPIScheduleNewResponseResultTestMobileReportState = "FAILED" +) + +// A test region with a label. +type ZoneSpeedAPIScheduleNewResponseResultTestRegion struct { + Label string `json:"label"` + // A test region. + Value ZoneSpeedAPIScheduleNewResponseResultTestRegionValue `json:"value"` + JSON zoneSpeedAPIScheduleNewResponseResultTestRegionJSON `json:"-"` +} + +// zoneSpeedAPIScheduleNewResponseResultTestRegionJSON contains the JSON metadata +// for the struct [ZoneSpeedAPIScheduleNewResponseResultTestRegion] +type zoneSpeedAPIScheduleNewResponseResultTestRegionJSON struct { + Label apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleNewResponseResultTestRegion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// A test region. +type ZoneSpeedAPIScheduleNewResponseResultTestRegionValue string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueAsiaEast1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "asia-east1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueAsiaNortheast1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "asia-northeast1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueAsiaNortheast2 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "asia-northeast2" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueAsiaSouth1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "asia-south1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueAsiaSoutheast1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "asia-southeast1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueAustraliaSoutheast1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "australia-southeast1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeNorth1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-north1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeSouthwest1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-southwest1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeWest1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-west1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeWest2 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-west2" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeWest3 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-west3" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeWest4 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-west4" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeWest8 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-west8" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueEuropeWest9 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "europe-west9" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueMeWest1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "me-west1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueSouthamericaEast1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "southamerica-east1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueUsCentral1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "us-central1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueUsEast1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "us-east1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueUsEast4 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "us-east4" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueUsSouth1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "us-south1" + ZoneSpeedAPIScheduleNewResponseResultTestRegionValueUsWest1 ZoneSpeedAPIScheduleNewResponseResultTestRegionValue = "us-west1" +) + +// The frequency of the test. +type ZoneSpeedAPIScheduleNewResponseResultTestScheduleFrequency string + +const ( + ZoneSpeedAPIScheduleNewResponseResultTestScheduleFrequencyDaily ZoneSpeedAPIScheduleNewResponseResultTestScheduleFrequency = "DAILY" + ZoneSpeedAPIScheduleNewResponseResultTestScheduleFrequencyWeekly ZoneSpeedAPIScheduleNewResponseResultTestScheduleFrequency = "WEEKLY" +) + +type ZoneSpeedAPIScheduleGetResponse struct { + Errors []ZoneSpeedAPIScheduleGetResponseError `json:"errors"` + Messages []ZoneSpeedAPIScheduleGetResponseMessage `json:"messages"` + // The test schedule. + Result ZoneSpeedAPIScheduleGetResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIScheduleGetResponseJSON `json:"-"` +} + +// zoneSpeedAPIScheduleGetResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIScheduleGetResponse] +type zoneSpeedAPIScheduleGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIScheduleGetResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIScheduleGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleGetResponseError] +type zoneSpeedAPIScheduleGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIScheduleGetResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIScheduleGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleGetResponseMessage] +type zoneSpeedAPIScheduleGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The test schedule. +type ZoneSpeedAPIScheduleGetResponseResult struct { + // The frequency of the test. + Frequency ZoneSpeedAPIScheduleGetResponseResultFrequency `json:"frequency"` + // A test region. + Region ZoneSpeedAPIScheduleGetResponseResultRegion `json:"region"` + // A URL. + URL string `json:"url"` + JSON zoneSpeedAPIScheduleGetResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIScheduleGetResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleGetResponseResult] +type zoneSpeedAPIScheduleGetResponseResultJSON struct { + Frequency apijson.Field + Region apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The frequency of the test. +type ZoneSpeedAPIScheduleGetResponseResultFrequency string + +const ( + ZoneSpeedAPIScheduleGetResponseResultFrequencyDaily ZoneSpeedAPIScheduleGetResponseResultFrequency = "DAILY" + ZoneSpeedAPIScheduleGetResponseResultFrequencyWeekly ZoneSpeedAPIScheduleGetResponseResultFrequency = "WEEKLY" +) + +// A test region. +type ZoneSpeedAPIScheduleGetResponseResultRegion string + +const ( + ZoneSpeedAPIScheduleGetResponseResultRegionAsiaEast1 ZoneSpeedAPIScheduleGetResponseResultRegion = "asia-east1" + ZoneSpeedAPIScheduleGetResponseResultRegionAsiaNortheast1 ZoneSpeedAPIScheduleGetResponseResultRegion = "asia-northeast1" + ZoneSpeedAPIScheduleGetResponseResultRegionAsiaNortheast2 ZoneSpeedAPIScheduleGetResponseResultRegion = "asia-northeast2" + ZoneSpeedAPIScheduleGetResponseResultRegionAsiaSouth1 ZoneSpeedAPIScheduleGetResponseResultRegion = "asia-south1" + ZoneSpeedAPIScheduleGetResponseResultRegionAsiaSoutheast1 ZoneSpeedAPIScheduleGetResponseResultRegion = "asia-southeast1" + ZoneSpeedAPIScheduleGetResponseResultRegionAustraliaSoutheast1 ZoneSpeedAPIScheduleGetResponseResultRegion = "australia-southeast1" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeNorth1 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-north1" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeSouthwest1 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-southwest1" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeWest1 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-west1" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeWest2 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-west2" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeWest3 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-west3" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeWest4 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-west4" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeWest8 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-west8" + ZoneSpeedAPIScheduleGetResponseResultRegionEuropeWest9 ZoneSpeedAPIScheduleGetResponseResultRegion = "europe-west9" + ZoneSpeedAPIScheduleGetResponseResultRegionMeWest1 ZoneSpeedAPIScheduleGetResponseResultRegion = "me-west1" + ZoneSpeedAPIScheduleGetResponseResultRegionSouthamericaEast1 ZoneSpeedAPIScheduleGetResponseResultRegion = "southamerica-east1" + ZoneSpeedAPIScheduleGetResponseResultRegionUsCentral1 ZoneSpeedAPIScheduleGetResponseResultRegion = "us-central1" + ZoneSpeedAPIScheduleGetResponseResultRegionUsEast1 ZoneSpeedAPIScheduleGetResponseResultRegion = "us-east1" + ZoneSpeedAPIScheduleGetResponseResultRegionUsEast4 ZoneSpeedAPIScheduleGetResponseResultRegion = "us-east4" + ZoneSpeedAPIScheduleGetResponseResultRegionUsSouth1 ZoneSpeedAPIScheduleGetResponseResultRegion = "us-south1" + ZoneSpeedAPIScheduleGetResponseResultRegionUsWest1 ZoneSpeedAPIScheduleGetResponseResultRegion = "us-west1" +) + +type ZoneSpeedAPIScheduleDeleteResponse struct { + Errors []ZoneSpeedAPIScheduleDeleteResponseError `json:"errors"` + Messages []ZoneSpeedAPIScheduleDeleteResponseMessage `json:"messages"` + Result ZoneSpeedAPIScheduleDeleteResponseResult `json:"result"` + // Whether the API call was successful. + Success bool `json:"success"` + JSON zoneSpeedAPIScheduleDeleteResponseJSON `json:"-"` +} + +// zoneSpeedAPIScheduleDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneSpeedAPIScheduleDeleteResponse] +type zoneSpeedAPIScheduleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIScheduleDeleteResponseErrorJSON `json:"-"` +} + +// zoneSpeedAPIScheduleDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleDeleteResponseError] +type zoneSpeedAPIScheduleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSpeedAPIScheduleDeleteResponseMessageJSON `json:"-"` +} + +// zoneSpeedAPIScheduleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleDeleteResponseMessage] +type zoneSpeedAPIScheduleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleDeleteResponseResult struct { + // Number of items affected. + Count float64 `json:"count"` + JSON zoneSpeedAPIScheduleDeleteResponseResultJSON `json:"-"` +} + +// zoneSpeedAPIScheduleDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneSpeedAPIScheduleDeleteResponseResult] +type zoneSpeedAPIScheduleDeleteResponseResultJSON struct { + Count apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSpeedAPIScheduleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSpeedAPIScheduleNewParams struct { + // A test region. + Region param.Field[ZoneSpeedAPIScheduleNewParamsRegion] `query:"region"` +} + +// URLQuery serializes [ZoneSpeedAPIScheduleNewParams]'s query parameters as +// `url.Values`. +func (r ZoneSpeedAPIScheduleNewParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type ZoneSpeedAPIScheduleNewParamsRegion string + +const ( + ZoneSpeedAPIScheduleNewParamsRegionAsiaEast1 ZoneSpeedAPIScheduleNewParamsRegion = "asia-east1" + ZoneSpeedAPIScheduleNewParamsRegionAsiaNortheast1 ZoneSpeedAPIScheduleNewParamsRegion = "asia-northeast1" + ZoneSpeedAPIScheduleNewParamsRegionAsiaNortheast2 ZoneSpeedAPIScheduleNewParamsRegion = "asia-northeast2" + ZoneSpeedAPIScheduleNewParamsRegionAsiaSouth1 ZoneSpeedAPIScheduleNewParamsRegion = "asia-south1" + ZoneSpeedAPIScheduleNewParamsRegionAsiaSoutheast1 ZoneSpeedAPIScheduleNewParamsRegion = "asia-southeast1" + ZoneSpeedAPIScheduleNewParamsRegionAustraliaSoutheast1 ZoneSpeedAPIScheduleNewParamsRegion = "australia-southeast1" + ZoneSpeedAPIScheduleNewParamsRegionEuropeNorth1 ZoneSpeedAPIScheduleNewParamsRegion = "europe-north1" + ZoneSpeedAPIScheduleNewParamsRegionEuropeSouthwest1 ZoneSpeedAPIScheduleNewParamsRegion = "europe-southwest1" + ZoneSpeedAPIScheduleNewParamsRegionEuropeWest1 ZoneSpeedAPIScheduleNewParamsRegion = "europe-west1" + ZoneSpeedAPIScheduleNewParamsRegionEuropeWest2 ZoneSpeedAPIScheduleNewParamsRegion = "europe-west2" + ZoneSpeedAPIScheduleNewParamsRegionEuropeWest3 ZoneSpeedAPIScheduleNewParamsRegion = "europe-west3" + ZoneSpeedAPIScheduleNewParamsRegionEuropeWest4 ZoneSpeedAPIScheduleNewParamsRegion = "europe-west4" + ZoneSpeedAPIScheduleNewParamsRegionEuropeWest8 ZoneSpeedAPIScheduleNewParamsRegion = "europe-west8" + ZoneSpeedAPIScheduleNewParamsRegionEuropeWest9 ZoneSpeedAPIScheduleNewParamsRegion = "europe-west9" + ZoneSpeedAPIScheduleNewParamsRegionMeWest1 ZoneSpeedAPIScheduleNewParamsRegion = "me-west1" + ZoneSpeedAPIScheduleNewParamsRegionSouthamericaEast1 ZoneSpeedAPIScheduleNewParamsRegion = "southamerica-east1" + ZoneSpeedAPIScheduleNewParamsRegionUsCentral1 ZoneSpeedAPIScheduleNewParamsRegion = "us-central1" + ZoneSpeedAPIScheduleNewParamsRegionUsEast1 ZoneSpeedAPIScheduleNewParamsRegion = "us-east1" + ZoneSpeedAPIScheduleNewParamsRegionUsEast4 ZoneSpeedAPIScheduleNewParamsRegion = "us-east4" + ZoneSpeedAPIScheduleNewParamsRegionUsSouth1 ZoneSpeedAPIScheduleNewParamsRegion = "us-south1" + ZoneSpeedAPIScheduleNewParamsRegionUsWest1 ZoneSpeedAPIScheduleNewParamsRegion = "us-west1" +) + +type ZoneSpeedAPIScheduleGetParams struct { + // A test region. + Region param.Field[ZoneSpeedAPIScheduleGetParamsRegion] `query:"region"` +} + +// URLQuery serializes [ZoneSpeedAPIScheduleGetParams]'s query parameters as +// `url.Values`. +func (r ZoneSpeedAPIScheduleGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type ZoneSpeedAPIScheduleGetParamsRegion string + +const ( + ZoneSpeedAPIScheduleGetParamsRegionAsiaEast1 ZoneSpeedAPIScheduleGetParamsRegion = "asia-east1" + ZoneSpeedAPIScheduleGetParamsRegionAsiaNortheast1 ZoneSpeedAPIScheduleGetParamsRegion = "asia-northeast1" + ZoneSpeedAPIScheduleGetParamsRegionAsiaNortheast2 ZoneSpeedAPIScheduleGetParamsRegion = "asia-northeast2" + ZoneSpeedAPIScheduleGetParamsRegionAsiaSouth1 ZoneSpeedAPIScheduleGetParamsRegion = "asia-south1" + ZoneSpeedAPIScheduleGetParamsRegionAsiaSoutheast1 ZoneSpeedAPIScheduleGetParamsRegion = "asia-southeast1" + ZoneSpeedAPIScheduleGetParamsRegionAustraliaSoutheast1 ZoneSpeedAPIScheduleGetParamsRegion = "australia-southeast1" + ZoneSpeedAPIScheduleGetParamsRegionEuropeNorth1 ZoneSpeedAPIScheduleGetParamsRegion = "europe-north1" + ZoneSpeedAPIScheduleGetParamsRegionEuropeSouthwest1 ZoneSpeedAPIScheduleGetParamsRegion = "europe-southwest1" + ZoneSpeedAPIScheduleGetParamsRegionEuropeWest1 ZoneSpeedAPIScheduleGetParamsRegion = "europe-west1" + ZoneSpeedAPIScheduleGetParamsRegionEuropeWest2 ZoneSpeedAPIScheduleGetParamsRegion = "europe-west2" + ZoneSpeedAPIScheduleGetParamsRegionEuropeWest3 ZoneSpeedAPIScheduleGetParamsRegion = "europe-west3" + ZoneSpeedAPIScheduleGetParamsRegionEuropeWest4 ZoneSpeedAPIScheduleGetParamsRegion = "europe-west4" + ZoneSpeedAPIScheduleGetParamsRegionEuropeWest8 ZoneSpeedAPIScheduleGetParamsRegion = "europe-west8" + ZoneSpeedAPIScheduleGetParamsRegionEuropeWest9 ZoneSpeedAPIScheduleGetParamsRegion = "europe-west9" + ZoneSpeedAPIScheduleGetParamsRegionMeWest1 ZoneSpeedAPIScheduleGetParamsRegion = "me-west1" + ZoneSpeedAPIScheduleGetParamsRegionSouthamericaEast1 ZoneSpeedAPIScheduleGetParamsRegion = "southamerica-east1" + ZoneSpeedAPIScheduleGetParamsRegionUsCentral1 ZoneSpeedAPIScheduleGetParamsRegion = "us-central1" + ZoneSpeedAPIScheduleGetParamsRegionUsEast1 ZoneSpeedAPIScheduleGetParamsRegion = "us-east1" + ZoneSpeedAPIScheduleGetParamsRegionUsEast4 ZoneSpeedAPIScheduleGetParamsRegion = "us-east4" + ZoneSpeedAPIScheduleGetParamsRegionUsSouth1 ZoneSpeedAPIScheduleGetParamsRegion = "us-south1" + ZoneSpeedAPIScheduleGetParamsRegionUsWest1 ZoneSpeedAPIScheduleGetParamsRegion = "us-west1" +) + +type ZoneSpeedAPIScheduleDeleteParams struct { + // A test region. + Region param.Field[ZoneSpeedAPIScheduleDeleteParamsRegion] `query:"region"` +} + +// URLQuery serializes [ZoneSpeedAPIScheduleDeleteParams]'s query parameters as +// `url.Values`. +func (r ZoneSpeedAPIScheduleDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type ZoneSpeedAPIScheduleDeleteParamsRegion string + +const ( + ZoneSpeedAPIScheduleDeleteParamsRegionAsiaEast1 ZoneSpeedAPIScheduleDeleteParamsRegion = "asia-east1" + ZoneSpeedAPIScheduleDeleteParamsRegionAsiaNortheast1 ZoneSpeedAPIScheduleDeleteParamsRegion = "asia-northeast1" + ZoneSpeedAPIScheduleDeleteParamsRegionAsiaNortheast2 ZoneSpeedAPIScheduleDeleteParamsRegion = "asia-northeast2" + ZoneSpeedAPIScheduleDeleteParamsRegionAsiaSouth1 ZoneSpeedAPIScheduleDeleteParamsRegion = "asia-south1" + ZoneSpeedAPIScheduleDeleteParamsRegionAsiaSoutheast1 ZoneSpeedAPIScheduleDeleteParamsRegion = "asia-southeast1" + ZoneSpeedAPIScheduleDeleteParamsRegionAustraliaSoutheast1 ZoneSpeedAPIScheduleDeleteParamsRegion = "australia-southeast1" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeNorth1 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-north1" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeSouthwest1 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-southwest1" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeWest1 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-west1" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeWest2 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-west2" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeWest3 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-west3" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeWest4 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-west4" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeWest8 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-west8" + ZoneSpeedAPIScheduleDeleteParamsRegionEuropeWest9 ZoneSpeedAPIScheduleDeleteParamsRegion = "europe-west9" + ZoneSpeedAPIScheduleDeleteParamsRegionMeWest1 ZoneSpeedAPIScheduleDeleteParamsRegion = "me-west1" + ZoneSpeedAPIScheduleDeleteParamsRegionSouthamericaEast1 ZoneSpeedAPIScheduleDeleteParamsRegion = "southamerica-east1" + ZoneSpeedAPIScheduleDeleteParamsRegionUsCentral1 ZoneSpeedAPIScheduleDeleteParamsRegion = "us-central1" + ZoneSpeedAPIScheduleDeleteParamsRegionUsEast1 ZoneSpeedAPIScheduleDeleteParamsRegion = "us-east1" + ZoneSpeedAPIScheduleDeleteParamsRegionUsEast4 ZoneSpeedAPIScheduleDeleteParamsRegion = "us-east4" + ZoneSpeedAPIScheduleDeleteParamsRegionUsSouth1 ZoneSpeedAPIScheduleDeleteParamsRegion = "us-south1" + ZoneSpeedAPIScheduleDeleteParamsRegionUsWest1 ZoneSpeedAPIScheduleDeleteParamsRegion = "us-west1" +) diff --git a/zonespeedapischedule_test.go b/zonespeedapischedule_test.go new file mode 100644 index 00000000000..b22b2351e43 --- /dev/null +++ b/zonespeedapischedule_test.go @@ -0,0 +1,113 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSpeedAPIScheduleNewWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Schedule.New( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + cloudflare.ZoneSpeedAPIScheduleNewParams{ + Region: cloudflare.F(cloudflare.ZoneSpeedAPIScheduleNewParamsRegionUsCentral1), + }, + ) + 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 TestZoneSpeedAPIScheduleGetWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Schedule.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + cloudflare.ZoneSpeedAPIScheduleGetParams{ + Region: cloudflare.F(cloudflare.ZoneSpeedAPIScheduleGetParamsRegionUsCentral1), + }, + ) + 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 TestZoneSpeedAPIScheduleDeleteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.SpeedAPI.Schedule.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "example.com", + cloudflare.ZoneSpeedAPIScheduleDeleteParams{ + Region: cloudflare.F(cloudflare.ZoneSpeedAPIScheduleDeleteParamsRegionUsCentral1), + }, + ) + 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/zonessl.go b/zonessl.go new file mode 100644 index 00000000000..28c351241ba --- /dev/null +++ b/zonessl.go @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslService 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 [NewZoneSslService] method instead. +type ZoneSslService struct { + Options []option.RequestOption + Analyzes *ZoneSslAnalyzeService + CertificatePacks *ZoneSslCertificatePackService + Recommendations *ZoneSslRecommendationService + Universals *ZoneSslUniversalService + Verifications *ZoneSslVerificationService +} + +// NewZoneSslService 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 NewZoneSslService(opts ...option.RequestOption) (r *ZoneSslService) { + r = &ZoneSslService{} + r.Options = opts + r.Analyzes = NewZoneSslAnalyzeService(opts...) + r.CertificatePacks = NewZoneSslCertificatePackService(opts...) + r.Recommendations = NewZoneSslRecommendationService(opts...) + r.Universals = NewZoneSslUniversalService(opts...) + r.Verifications = NewZoneSslVerificationService(opts...) + return +} diff --git a/zonesslanalyze.go b/zonesslanalyze.go new file mode 100644 index 00000000000..b768a14fb63 --- /dev/null +++ b/zonesslanalyze.go @@ -0,0 +1,139 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslAnalyzeService 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 [NewZoneSslAnalyzeService] method +// instead. +type ZoneSslAnalyzeService struct { + Options []option.RequestOption +} + +// NewZoneSslAnalyzeService 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 NewZoneSslAnalyzeService(opts ...option.RequestOption) (r *ZoneSslAnalyzeService) { + r = &ZoneSslAnalyzeService{} + r.Options = opts + return +} + +// Returns the set of hostnames, the signature algorithm, and the expiration date +// of the certificate. +func (r *ZoneSslAnalyzeService) AnalyzeCertificateAnalyzeCertificate(ctx context.Context, identifier string, body ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParams, opts ...option.RequestOption) (res *ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/analyze", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponse struct { + Errors []ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseError `json:"errors"` + Messages []ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseSuccess `json:"success"` + JSON zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseJSON `json:"-"` +} + +// zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseJSON contains the JSON +// metadata for the struct +// [ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponse] +type zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseErrorJSON `json:"-"` +} + +// zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseError] +type zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseMessageJSON `json:"-"` +} + +// zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseMessage] +type zoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseSuccess bool + +const ( + ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseSuccessTrue ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateResponseSuccess = true +) + +type ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParams struct { + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod param.Field[ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethod] `json:"bundle_method"` + // The zone's SSL certificate or certificate and the intermediate(s). + Certificate param.Field[string] `json:"certificate"` +} + +func (r ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethod string + +const ( + ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethodUbiquitous ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethod = "ubiquitous" + ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethodOptimal ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethod = "optimal" + ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethodForce ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethod = "force" +) diff --git a/zonesslanalyze_test.go b/zonesslanalyze_test.go new file mode 100644 index 00000000000..6fac3561043 --- /dev/null +++ b/zonesslanalyze_test.go @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.Analyzes.AnalyzeCertificateAnalyzeCertificate( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParams{ + BundleMethod: cloudflare.F(cloudflare.ZoneSslAnalyzeAnalyzeCertificateAnalyzeCertificateParamsBundleMethodUbiquitous), + Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), + }, + ) + 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/zonesslcertificatepack.go b/zonesslcertificatepack.go new file mode 100644 index 00000000000..8ff82b1d201 --- /dev/null +++ b/zonesslcertificatepack.go @@ -0,0 +1,527 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslCertificatePackService 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 [NewZoneSslCertificatePackService] +// method instead. +type ZoneSslCertificatePackService struct { + Options []option.RequestOption + Orders *ZoneSslCertificatePackOrderService + Quotas *ZoneSslCertificatePackQuotaService +} + +// NewZoneSslCertificatePackService 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 NewZoneSslCertificatePackService(opts ...option.RequestOption) (r *ZoneSslCertificatePackService) { + r = &ZoneSslCertificatePackService{} + r.Options = opts + r.Orders = NewZoneSslCertificatePackOrderService(opts...) + r.Quotas = NewZoneSslCertificatePackQuotaService(opts...) + return +} + +// For a given zone, get a certificate pack. +func (r *ZoneSslCertificatePackService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneSslCertificatePackGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/certificate_packs/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// For a given zone, restart validation for an advanced certificate pack. This is +// only a validation operation for a Certificate Pack in a validation_timed_out +// status. +func (r *ZoneSslCertificatePackService) Update(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneSslCertificatePackUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/certificate_packs/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &res, opts...) + return +} + +// For a given zone, delete an advanced certificate pack. +func (r *ZoneSslCertificatePackService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneSslCertificatePackDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/certificate_packs/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// For a given zone, list all active certificate packs. +func (r *ZoneSslCertificatePackService) CertificatePacksListCertificatePacks(ctx context.Context, zoneIdentifier string, query ZoneSslCertificatePackCertificatePacksListCertificatePacksParams, opts ...option.RequestOption) (res *ZoneSslCertificatePackCertificatePacksListCertificatePacksResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/certificate_packs", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSslCertificatePackGetResponse struct { + Errors []ZoneSslCertificatePackGetResponseError `json:"errors"` + Messages []ZoneSslCertificatePackGetResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneSslCertificatePackGetResponseSuccess `json:"success"` + JSON zoneSslCertificatePackGetResponseJSON `json:"-"` +} + +// zoneSslCertificatePackGetResponseJSON contains the JSON metadata for the struct +// [ZoneSslCertificatePackGetResponse] +type zoneSslCertificatePackGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackGetResponseErrorJSON `json:"-"` +} + +// zoneSslCertificatePackGetResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSslCertificatePackGetResponseError] +type zoneSslCertificatePackGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackGetResponseMessageJSON `json:"-"` +} + +// zoneSslCertificatePackGetResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSslCertificatePackGetResponseMessage] +type zoneSslCertificatePackGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSslCertificatePackGetResponseSuccess bool + +const ( + ZoneSslCertificatePackGetResponseSuccessTrue ZoneSslCertificatePackGetResponseSuccess = true +) + +type ZoneSslCertificatePackUpdateResponse struct { + Errors []ZoneSslCertificatePackUpdateResponseError `json:"errors"` + Messages []ZoneSslCertificatePackUpdateResponseMessage `json:"messages"` + Result ZoneSslCertificatePackUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslCertificatePackUpdateResponseSuccess `json:"success"` + JSON zoneSslCertificatePackUpdateResponseJSON `json:"-"` +} + +// zoneSslCertificatePackUpdateResponseJSON contains the JSON metadata for the +// struct [ZoneSslCertificatePackUpdateResponse] +type zoneSslCertificatePackUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackUpdateResponseErrorJSON `json:"-"` +} + +// zoneSslCertificatePackUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSslCertificatePackUpdateResponseError] +type zoneSslCertificatePackUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackUpdateResponseMessageJSON `json:"-"` +} + +// zoneSslCertificatePackUpdateResponseMessageJSON contains the JSON metadata for +// the struct [ZoneSslCertificatePackUpdateResponseMessage] +type zoneSslCertificatePackUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackUpdateResponseResult struct { + // Identifier + ID string `json:"id"` + // Certificate Authority selected for the order. For information on any certificate + // authority specific details or restrictions + // [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) + CertificateAuthority ZoneSslCertificatePackUpdateResponseResultCertificateAuthority `json:"certificate_authority"` + // Whether or not to add Cloudflare Branding for the order. This will add + // sni.cloudflaressl.com as the Common Name if set true. + CloudflareBranding bool `json:"cloudflare_branding"` + // Comma separated list of valid host names for the certificate packs. Must contain + // the zone apex, may not contain more than 50 hosts, and may not be empty. + Hosts []string `json:"hosts"` + // Status of certificate pack. + Status ZoneSslCertificatePackUpdateResponseResultStatus `json:"status"` + // Type of certificate pack. + Type ZoneSslCertificatePackUpdateResponseResultType `json:"type"` + // Validation Method selected for the order. + ValidationMethod ZoneSslCertificatePackUpdateResponseResultValidationMethod `json:"validation_method"` + // Validity Days selected for the order. + ValidityDays ZoneSslCertificatePackUpdateResponseResultValidityDays `json:"validity_days"` + JSON zoneSslCertificatePackUpdateResponseResultJSON `json:"-"` +} + +// zoneSslCertificatePackUpdateResponseResultJSON contains the JSON metadata for +// the struct [ZoneSslCertificatePackUpdateResponseResult] +type zoneSslCertificatePackUpdateResponseResultJSON struct { + ID apijson.Field + CertificateAuthority apijson.Field + CloudflareBranding apijson.Field + Hosts apijson.Field + Status apijson.Field + Type apijson.Field + ValidationMethod apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate Authority selected for the order. For information on any certificate +// authority specific details or restrictions +// [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) +type ZoneSslCertificatePackUpdateResponseResultCertificateAuthority string + +const ( + ZoneSslCertificatePackUpdateResponseResultCertificateAuthorityGoogle ZoneSslCertificatePackUpdateResponseResultCertificateAuthority = "google" + ZoneSslCertificatePackUpdateResponseResultCertificateAuthorityLetsEncrypt ZoneSslCertificatePackUpdateResponseResultCertificateAuthority = "lets_encrypt" +) + +// Status of certificate pack. +type ZoneSslCertificatePackUpdateResponseResultStatus string + +const ( + ZoneSslCertificatePackUpdateResponseResultStatusInitializing ZoneSslCertificatePackUpdateResponseResultStatus = "initializing" + ZoneSslCertificatePackUpdateResponseResultStatusPendingValidation ZoneSslCertificatePackUpdateResponseResultStatus = "pending_validation" + ZoneSslCertificatePackUpdateResponseResultStatusDeleted ZoneSslCertificatePackUpdateResponseResultStatus = "deleted" + ZoneSslCertificatePackUpdateResponseResultStatusPendingIssuance ZoneSslCertificatePackUpdateResponseResultStatus = "pending_issuance" + ZoneSslCertificatePackUpdateResponseResultStatusPendingDeployment ZoneSslCertificatePackUpdateResponseResultStatus = "pending_deployment" + ZoneSslCertificatePackUpdateResponseResultStatusPendingDeletion ZoneSslCertificatePackUpdateResponseResultStatus = "pending_deletion" + ZoneSslCertificatePackUpdateResponseResultStatusPendingExpiration ZoneSslCertificatePackUpdateResponseResultStatus = "pending_expiration" + ZoneSslCertificatePackUpdateResponseResultStatusExpired ZoneSslCertificatePackUpdateResponseResultStatus = "expired" + ZoneSslCertificatePackUpdateResponseResultStatusActive ZoneSslCertificatePackUpdateResponseResultStatus = "active" + ZoneSslCertificatePackUpdateResponseResultStatusInitializingTimedOut ZoneSslCertificatePackUpdateResponseResultStatus = "initializing_timed_out" + ZoneSslCertificatePackUpdateResponseResultStatusValidationTimedOut ZoneSslCertificatePackUpdateResponseResultStatus = "validation_timed_out" + ZoneSslCertificatePackUpdateResponseResultStatusIssuanceTimedOut ZoneSslCertificatePackUpdateResponseResultStatus = "issuance_timed_out" + ZoneSslCertificatePackUpdateResponseResultStatusDeploymentTimedOut ZoneSslCertificatePackUpdateResponseResultStatus = "deployment_timed_out" + ZoneSslCertificatePackUpdateResponseResultStatusDeletionTimedOut ZoneSslCertificatePackUpdateResponseResultStatus = "deletion_timed_out" + ZoneSslCertificatePackUpdateResponseResultStatusPendingCleanup ZoneSslCertificatePackUpdateResponseResultStatus = "pending_cleanup" + ZoneSslCertificatePackUpdateResponseResultStatusStagingDeployment ZoneSslCertificatePackUpdateResponseResultStatus = "staging_deployment" + ZoneSslCertificatePackUpdateResponseResultStatusStagingActive ZoneSslCertificatePackUpdateResponseResultStatus = "staging_active" + ZoneSslCertificatePackUpdateResponseResultStatusDeactivating ZoneSslCertificatePackUpdateResponseResultStatus = "deactivating" + ZoneSslCertificatePackUpdateResponseResultStatusInactive ZoneSslCertificatePackUpdateResponseResultStatus = "inactive" + ZoneSslCertificatePackUpdateResponseResultStatusBackupIssued ZoneSslCertificatePackUpdateResponseResultStatus = "backup_issued" + ZoneSslCertificatePackUpdateResponseResultStatusHoldingDeployment ZoneSslCertificatePackUpdateResponseResultStatus = "holding_deployment" +) + +// Type of certificate pack. +type ZoneSslCertificatePackUpdateResponseResultType string + +const ( + ZoneSslCertificatePackUpdateResponseResultTypeAdvanced ZoneSslCertificatePackUpdateResponseResultType = "advanced" +) + +// Validation Method selected for the order. +type ZoneSslCertificatePackUpdateResponseResultValidationMethod string + +const ( + ZoneSslCertificatePackUpdateResponseResultValidationMethodTxt ZoneSslCertificatePackUpdateResponseResultValidationMethod = "txt" + ZoneSslCertificatePackUpdateResponseResultValidationMethodHTTP ZoneSslCertificatePackUpdateResponseResultValidationMethod = "http" + ZoneSslCertificatePackUpdateResponseResultValidationMethodEmail ZoneSslCertificatePackUpdateResponseResultValidationMethod = "email" +) + +// Validity Days selected for the order. +type ZoneSslCertificatePackUpdateResponseResultValidityDays int64 + +const ( + ZoneSslCertificatePackUpdateResponseResultValidityDays14 ZoneSslCertificatePackUpdateResponseResultValidityDays = 14 + ZoneSslCertificatePackUpdateResponseResultValidityDays30 ZoneSslCertificatePackUpdateResponseResultValidityDays = 30 + ZoneSslCertificatePackUpdateResponseResultValidityDays90 ZoneSslCertificatePackUpdateResponseResultValidityDays = 90 + ZoneSslCertificatePackUpdateResponseResultValidityDays365 ZoneSslCertificatePackUpdateResponseResultValidityDays = 365 +) + +// Whether the API call was successful +type ZoneSslCertificatePackUpdateResponseSuccess bool + +const ( + ZoneSslCertificatePackUpdateResponseSuccessTrue ZoneSslCertificatePackUpdateResponseSuccess = true +) + +type ZoneSslCertificatePackDeleteResponse struct { + Errors []ZoneSslCertificatePackDeleteResponseError `json:"errors"` + Messages []ZoneSslCertificatePackDeleteResponseMessage `json:"messages"` + Result ZoneSslCertificatePackDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslCertificatePackDeleteResponseSuccess `json:"success"` + JSON zoneSslCertificatePackDeleteResponseJSON `json:"-"` +} + +// zoneSslCertificatePackDeleteResponseJSON contains the JSON metadata for the +// struct [ZoneSslCertificatePackDeleteResponse] +type zoneSslCertificatePackDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackDeleteResponseErrorJSON `json:"-"` +} + +// zoneSslCertificatePackDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSslCertificatePackDeleteResponseError] +type zoneSslCertificatePackDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackDeleteResponseMessageJSON `json:"-"` +} + +// zoneSslCertificatePackDeleteResponseMessageJSON contains the JSON metadata for +// the struct [ZoneSslCertificatePackDeleteResponseMessage] +type zoneSslCertificatePackDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackDeleteResponseResult struct { + // Identifier + ID string `json:"id"` + JSON zoneSslCertificatePackDeleteResponseResultJSON `json:"-"` +} + +// zoneSslCertificatePackDeleteResponseResultJSON contains the JSON metadata for +// the struct [ZoneSslCertificatePackDeleteResponseResult] +type zoneSslCertificatePackDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSslCertificatePackDeleteResponseSuccess bool + +const ( + ZoneSslCertificatePackDeleteResponseSuccessTrue ZoneSslCertificatePackDeleteResponseSuccess = true +) + +type ZoneSslCertificatePackCertificatePacksListCertificatePacksResponse struct { + Errors []ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseError `json:"errors"` + Messages []ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseMessage `json:"messages"` + Result []interface{} `json:"result"` + ResultInfo ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseSuccess `json:"success"` + JSON zoneSslCertificatePackCertificatePacksListCertificatePacksResponseJSON `json:"-"` +} + +// zoneSslCertificatePackCertificatePacksListCertificatePacksResponseJSON contains +// the JSON metadata for the struct +// [ZoneSslCertificatePackCertificatePacksListCertificatePacksResponse] +type zoneSslCertificatePackCertificatePacksListCertificatePacksResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackCertificatePacksListCertificatePacksResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackCertificatePacksListCertificatePacksResponseErrorJSON `json:"-"` +} + +// zoneSslCertificatePackCertificatePacksListCertificatePacksResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseError] +type zoneSslCertificatePackCertificatePacksListCertificatePacksResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackCertificatePacksListCertificatePacksResponseMessageJSON `json:"-"` +} + +// zoneSslCertificatePackCertificatePacksListCertificatePacksResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseMessage] +type zoneSslCertificatePackCertificatePacksListCertificatePacksResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneSslCertificatePackCertificatePacksListCertificatePacksResponseResultInfoJSON `json:"-"` +} + +// zoneSslCertificatePackCertificatePacksListCertificatePacksResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseResultInfo] +type zoneSslCertificatePackCertificatePacksListCertificatePacksResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseSuccess bool + +const ( + ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseSuccessTrue ZoneSslCertificatePackCertificatePacksListCertificatePacksResponseSuccess = true +) + +type ZoneSslCertificatePackCertificatePacksListCertificatePacksParams struct { + // Include Certificate Packs of all statuses, not just active ones. + Status param.Field[ZoneSslCertificatePackCertificatePacksListCertificatePacksParamsStatus] `query:"status"` +} + +// URLQuery serializes +// [ZoneSslCertificatePackCertificatePacksListCertificatePacksParams]'s query +// parameters as `url.Values`. +func (r ZoneSslCertificatePackCertificatePacksListCertificatePacksParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Include Certificate Packs of all statuses, not just active ones. +type ZoneSslCertificatePackCertificatePacksListCertificatePacksParamsStatus string + +const ( + ZoneSslCertificatePackCertificatePacksListCertificatePacksParamsStatusAll ZoneSslCertificatePackCertificatePacksListCertificatePacksParamsStatus = "all" +) diff --git a/zonesslcertificatepack_test.go b/zonesslcertificatepack_test.go new file mode 100644 index 00000000000..aabf7cbc64b --- /dev/null +++ b/zonesslcertificatepack_test.go @@ -0,0 +1,136 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSslCertificatePackGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.CertificatePacks.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneSslCertificatePackUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.CertificatePacks.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneSslCertificatePackDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.CertificatePacks.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneSslCertificatePackCertificatePacksListCertificatePacksWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.CertificatePacks.CertificatePacksListCertificatePacks( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSslCertificatePackCertificatePacksListCertificatePacksParams{ + Status: cloudflare.F(cloudflare.ZoneSslCertificatePackCertificatePacksListCertificatePacksParamsStatusAll), + }, + ) + 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/zonesslcertificatepackorder.go b/zonesslcertificatepackorder.go new file mode 100644 index 00000000000..eaadcff6d6f --- /dev/null +++ b/zonesslcertificatepackorder.go @@ -0,0 +1,278 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslCertificatePackOrderService 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 +// [NewZoneSslCertificatePackOrderService] method instead. +type ZoneSslCertificatePackOrderService struct { + Options []option.RequestOption +} + +// NewZoneSslCertificatePackOrderService 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 NewZoneSslCertificatePackOrderService(opts ...option.RequestOption) (r *ZoneSslCertificatePackOrderService) { + r = &ZoneSslCertificatePackOrderService{} + r.Options = opts + return +} + +// For a given zone, order an advanced certificate pack. +func (r *ZoneSslCertificatePackOrderService) CertificatePacksOrderAdvancedCertificateManagerCertificatePack(ctx context.Context, zoneIdentifier string, body ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParams, opts ...option.RequestOption) (res *ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/certificate_packs/order", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponse struct { + Errors []ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseError `json:"errors"` + Messages []ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseMessage `json:"messages"` + Result ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseSuccess `json:"success"` + JSON zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseJSON `json:"-"` +} + +// zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponse] +type zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseErrorJSON `json:"-"` +} + +// zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseError] +type zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseMessageJSON `json:"-"` +} + +// zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseMessage] +type zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResult struct { + // Identifier + ID string `json:"id"` + // Certificate Authority selected for the order. For information on any certificate + // authority specific details or restrictions + // [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) + CertificateAuthority ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultCertificateAuthority `json:"certificate_authority"` + // Whether or not to add Cloudflare Branding for the order. This will add + // sni.cloudflaressl.com as the Common Name if set true. + CloudflareBranding bool `json:"cloudflare_branding"` + // Comma separated list of valid host names for the certificate packs. Must contain + // the zone apex, may not contain more than 50 hosts, and may not be empty. + Hosts []string `json:"hosts"` + // Status of certificate pack. + Status ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus `json:"status"` + // Type of certificate pack. + Type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultType `json:"type"` + // Validation Method selected for the order. + ValidationMethod ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethod `json:"validation_method"` + // Validity Days selected for the order. + ValidityDays ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays `json:"validity_days"` + JSON zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultJSON `json:"-"` +} + +// zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResult] +type zoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultJSON struct { + ID apijson.Field + CertificateAuthority apijson.Field + CloudflareBranding apijson.Field + Hosts apijson.Field + Status apijson.Field + Type apijson.Field + ValidationMethod apijson.Field + ValidityDays apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Certificate Authority selected for the order. For information on any certificate +// authority specific details or restrictions +// [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultCertificateAuthority string + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultCertificateAuthorityGoogle ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultCertificateAuthority = "google" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultCertificateAuthorityLetsEncrypt ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultCertificateAuthority = "lets_encrypt" +) + +// Status of certificate pack. +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus string + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusInitializing ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "initializing" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusPendingValidation ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "pending_validation" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusDeleted ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "deleted" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusPendingIssuance ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "pending_issuance" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusPendingDeployment ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "pending_deployment" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusPendingDeletion ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "pending_deletion" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusPendingExpiration ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "pending_expiration" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusExpired ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "expired" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusActive ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "active" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusInitializingTimedOut ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "initializing_timed_out" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusValidationTimedOut ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "validation_timed_out" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusIssuanceTimedOut ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "issuance_timed_out" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusDeploymentTimedOut ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "deployment_timed_out" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusDeletionTimedOut ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "deletion_timed_out" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusPendingCleanup ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "pending_cleanup" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusStagingDeployment ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "staging_deployment" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusStagingActive ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "staging_active" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusDeactivating ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "deactivating" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusInactive ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "inactive" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusBackupIssued ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "backup_issued" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatusHoldingDeployment ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultStatus = "holding_deployment" +) + +// Type of certificate pack. +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultType string + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultTypeAdvanced ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultType = "advanced" +) + +// Validation Method selected for the order. +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethod string + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethodTxt ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethod = "txt" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethodHTTP ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethod = "http" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethodEmail ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidationMethod = "email" +) + +// Validity Days selected for the order. +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays int64 + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays14 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays = 14 + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays30 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays = 30 + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays90 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays = 90 + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays365 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseResultValidityDays = 365 +) + +// Whether the API call was successful +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseSuccess bool + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseSuccessTrue ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackResponseSuccess = true +) + +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParams struct { + // Certificate Authority selected for the order. For information on any certificate + // authority specific details or restrictions + // [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) + CertificateAuthority param.Field[ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsCertificateAuthority] `json:"certificate_authority,required"` + // Comma separated list of valid host names for the certificate packs. Must contain + // the zone apex, may not contain more than 50 hosts, and may not be empty. + Hosts param.Field[[]string] `json:"hosts,required"` + // Type of certificate pack. + Type param.Field[ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsType] `json:"type,required"` + // Validation Method selected for the order. + ValidationMethod param.Field[ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethod] `json:"validation_method,required"` + // Validity Days selected for the order. + ValidityDays param.Field[ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays] `json:"validity_days,required"` + // Whether or not to add Cloudflare Branding for the order. This will add + // sni.cloudflaressl.com as the Common Name if set true. + CloudflareBranding param.Field[bool] `json:"cloudflare_branding"` +} + +func (r ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Certificate Authority selected for the order. For information on any certificate +// authority specific details or restrictions +// [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsCertificateAuthority string + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsCertificateAuthorityGoogle ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsCertificateAuthority = "google" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsCertificateAuthorityLetsEncrypt ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsCertificateAuthority = "lets_encrypt" +) + +// Type of certificate pack. +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsType string + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsTypeAdvanced ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsType = "advanced" +) + +// Validation Method selected for the order. +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethod string + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethodTxt ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethod = "txt" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethodHTTP ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethod = "http" + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethodEmail ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethod = "email" +) + +// Validity Days selected for the order. +type ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays int64 + +const ( + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays14 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays = 14 + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays30 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays = 30 + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays90 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays = 90 + ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays365 ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays = 365 +) diff --git a/zonesslcertificatepackorder_test.go b/zonesslcertificatepackorder_test.go new file mode 100644 index 00000000000..b095bb7bf41 --- /dev/null +++ b/zonesslcertificatepackorder_test.go @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.CertificatePacks.Orders.CertificatePacksOrderAdvancedCertificateManagerCertificatePack( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParams{ + CertificateAuthority: cloudflare.F(cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsCertificateAuthorityLetsEncrypt), + Hosts: cloudflare.F([]string{"example.com", "*.example.com", "www.example.com"}), + Type: cloudflare.F(cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsTypeAdvanced), + ValidationMethod: cloudflare.F(cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidationMethodTxt), + ValidityDays: cloudflare.F(cloudflare.ZoneSslCertificatePackOrderCertificatePacksOrderAdvancedCertificateManagerCertificatePackParamsValidityDays14), + CloudflareBranding: cloudflare.F(false), + }, + ) + 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/zonesslcertificatepackquota.go b/zonesslcertificatepackquota.go new file mode 100644 index 00000000000..f06b1043da4 --- /dev/null +++ b/zonesslcertificatepackquota.go @@ -0,0 +1,151 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslCertificatePackQuotaService 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 +// [NewZoneSslCertificatePackQuotaService] method instead. +type ZoneSslCertificatePackQuotaService struct { + Options []option.RequestOption +} + +// NewZoneSslCertificatePackQuotaService 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 NewZoneSslCertificatePackQuotaService(opts ...option.RequestOption) (r *ZoneSslCertificatePackQuotaService) { + r = &ZoneSslCertificatePackQuotaService{} + r.Options = opts + return +} + +// For a given zone, list certificate pack quotas. +func (r *ZoneSslCertificatePackQuotaService) CertificatePacksGetCertificatePackQuotas(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/certificate_packs/quota", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponse struct { + Errors []ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseError `json:"errors"` + Messages []ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseMessage `json:"messages"` + Result ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseSuccess `json:"success"` + JSON zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseJSON `json:"-"` +} + +// zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponse] +type zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseErrorJSON `json:"-"` +} + +// zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseError] +type zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseMessageJSON `json:"-"` +} + +// zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseMessage] +type zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResult struct { + Advanced ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultAdvanced `json:"advanced"` + JSON zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultJSON `json:"-"` +} + +// zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResult] +type zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultJSON struct { + Advanced apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultAdvanced struct { + // Quantity Allocated. + Allocated int64 `json:"allocated"` + // Quantity Used. + Used int64 `json:"used"` + JSON zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultAdvancedJSON `json:"-"` +} + +// zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultAdvancedJSON +// contains the JSON metadata for the struct +// [ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultAdvanced] +type zoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultAdvancedJSON struct { + Allocated apijson.Field + Used apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseResultAdvanced) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseSuccess bool + +const ( + ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseSuccessTrue ZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotasResponseSuccess = true +) diff --git a/zonesslcertificatepackquota_test.go b/zonesslcertificatepackquota_test.go new file mode 100644 index 00000000000..2e86ceaf1e3 --- /dev/null +++ b/zonesslcertificatepackquota_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSslCertificatePackQuotaCertificatePacksGetCertificatePackQuotas(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.CertificatePacks.Quotas.CertificatePacksGetCertificatePackQuotas(context.TODO(), "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/zonesslrecommendation.go b/zonesslrecommendation.go new file mode 100644 index 00000000000..eb814b8065b --- /dev/null +++ b/zonesslrecommendation.go @@ -0,0 +1,139 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslRecommendationService 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 [NewZoneSslRecommendationService] +// method instead. +type ZoneSslRecommendationService struct { + Options []option.RequestOption +} + +// NewZoneSslRecommendationService 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 NewZoneSslRecommendationService(opts ...option.RequestOption) (r *ZoneSslRecommendationService) { + r = &ZoneSslRecommendationService{} + r.Options = opts + return +} + +// Retrieve the SSL/TLS Recommender's recommendation for a zone. +func (r *ZoneSslRecommendationService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSslRecommendationListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/recommendation", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSslRecommendationListResponse struct { + Errors []ZoneSslRecommendationListResponseError `json:"errors"` + Messages []ZoneSslRecommendationListResponseMessage `json:"messages"` + Result ZoneSslRecommendationListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslRecommendationListResponseSuccess `json:"success"` + JSON zoneSslRecommendationListResponseJSON `json:"-"` +} + +// zoneSslRecommendationListResponseJSON contains the JSON metadata for the struct +// [ZoneSslRecommendationListResponse] +type zoneSslRecommendationListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslRecommendationListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslRecommendationListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslRecommendationListResponseErrorJSON `json:"-"` +} + +// zoneSslRecommendationListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSslRecommendationListResponseError] +type zoneSslRecommendationListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslRecommendationListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslRecommendationListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslRecommendationListResponseMessageJSON `json:"-"` +} + +// zoneSslRecommendationListResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSslRecommendationListResponseMessage] +type zoneSslRecommendationListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslRecommendationListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslRecommendationListResponseResult struct { + // Identifier of a recommedation result. + ID string `json:"id"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + Value ZoneSslRecommendationListResponseResultValue `json:"value"` + JSON zoneSslRecommendationListResponseResultJSON `json:"-"` +} + +// zoneSslRecommendationListResponseResultJSON contains the JSON metadata for the +// struct [ZoneSslRecommendationListResponseResult] +type zoneSslRecommendationListResponseResultJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslRecommendationListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslRecommendationListResponseResultValue string + +const ( + ZoneSslRecommendationListResponseResultValueFlexible ZoneSslRecommendationListResponseResultValue = "flexible" + ZoneSslRecommendationListResponseResultValueFull ZoneSslRecommendationListResponseResultValue = "full" + ZoneSslRecommendationListResponseResultValueStrict ZoneSslRecommendationListResponseResultValue = "strict" +) + +// Whether the API call was successful +type ZoneSslRecommendationListResponseSuccess bool + +const ( + ZoneSslRecommendationListResponseSuccessTrue ZoneSslRecommendationListResponseSuccess = true +) diff --git a/zonesslrecommendation_test.go b/zonesslrecommendation_test.go new file mode 100644 index 00000000000..291304e97da --- /dev/null +++ b/zonesslrecommendation_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSslRecommendationList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.Recommendations.List(context.TODO(), "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/zonessluniversal.go b/zonessluniversal.go new file mode 100644 index 00000000000..722be392364 --- /dev/null +++ b/zonessluniversal.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslUniversalService 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 [NewZoneSslUniversalService] method +// instead. +type ZoneSslUniversalService struct { + Options []option.RequestOption + Settings *ZoneSslUniversalSettingService +} + +// NewZoneSslUniversalService 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 NewZoneSslUniversalService(opts ...option.RequestOption) (r *ZoneSslUniversalService) { + r = &ZoneSslUniversalService{} + r.Options = opts + r.Settings = NewZoneSslUniversalSettingService(opts...) + return +} diff --git a/zonessluniversalsetting.go b/zonessluniversalsetting.go new file mode 100644 index 00000000000..d4ac879a329 --- /dev/null +++ b/zonessluniversalsetting.go @@ -0,0 +1,311 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslUniversalSettingService 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 +// [NewZoneSslUniversalSettingService] method instead. +type ZoneSslUniversalSettingService struct { + Options []option.RequestOption +} + +// NewZoneSslUniversalSettingService 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 NewZoneSslUniversalSettingService(opts ...option.RequestOption) (r *ZoneSslUniversalSettingService) { + r = &ZoneSslUniversalSettingService{} + r.Options = opts + return +} + +// Patch Universal SSL Settings for a Zone. +func (r *ZoneSslUniversalSettingService) UniversalSslSettingsForAZoneEditUniversalSslSettings(ctx context.Context, zoneIdentifier string, body ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsParams, opts ...option.RequestOption) (res *ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/universal/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Get Universal SSL Settings for a Zone. +func (r *ZoneSslUniversalSettingService) UniversalSslSettingsForAZoneUniversalSslSettingsDetails(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/universal/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponse struct { + Errors []ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseError `json:"errors"` + Messages []ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseMessage `json:"messages"` + Result ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseSuccess `json:"success"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponse] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseErrorJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseError] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseMessageJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseMessage] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseResult struct { + // Disabling Universal SSL removes any currently active Universal SSL certificates + // for your zone from the edge and prevents any future Universal SSL certificates + // from being ordered. If there are no advanced certificates or custom certificates + // uploaded for the domain, visitors will be unable to access the domain over + // HTTPS. + // + // By disabling Universal SSL, you understand that the following Cloudflare + // settings and preferences will result in visitors being unable to visit your + // domain unless you have uploaded a custom certificate or purchased an advanced + // certificate. + // + // - HSTS + // - Always Use HTTPS + // - Opportunistic Encryption + // - Onion Routing + // - Any Page Rules redirecting traffic to HTTPS + // + // Similarly, any HTTP redirect to HTTPS at the origin while the Cloudflare proxy + // is enabled will result in users being unable to visit your site without a valid + // certificate at Cloudflare's edge. + // + // If you do not have a valid custom or advanced certificate at Cloudflare's edge + // and are unsure if any of the above Cloudflare settings are enabled, or if any + // HTTP redirects exist at your origin, we advise leaving Universal SSL enabled for + // your domain. + Enabled bool `json:"enabled"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseResultJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseResult] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseResultJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseSuccess bool + +const ( + ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseSuccessTrue ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsResponseSuccess = true +) + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponse struct { + Errors []ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseError `json:"errors"` + Messages []ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseMessage `json:"messages"` + Result ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseSuccess `json:"success"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponse] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseErrorJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseError] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseMessageJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseMessage] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseResult struct { + // Disabling Universal SSL removes any currently active Universal SSL certificates + // for your zone from the edge and prevents any future Universal SSL certificates + // from being ordered. If there are no advanced certificates or custom certificates + // uploaded for the domain, visitors will be unable to access the domain over + // HTTPS. + // + // By disabling Universal SSL, you understand that the following Cloudflare + // settings and preferences will result in visitors being unable to visit your + // domain unless you have uploaded a custom certificate or purchased an advanced + // certificate. + // + // - HSTS + // - Always Use HTTPS + // - Opportunistic Encryption + // - Onion Routing + // - Any Page Rules redirecting traffic to HTTPS + // + // Similarly, any HTTP redirect to HTTPS at the origin while the Cloudflare proxy + // is enabled will result in users being unable to visit your site without a valid + // certificate at Cloudflare's edge. + // + // If you do not have a valid custom or advanced certificate at Cloudflare's edge + // and are unsure if any of the above Cloudflare settings are enabled, or if any + // HTTP redirects exist at your origin, we advise leaving Universal SSL enabled for + // your domain. + Enabled bool `json:"enabled"` + JSON zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseResultJSON `json:"-"` +} + +// zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseResult] +type zoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseResultJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseSuccess bool + +const ( + ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseSuccessTrue ZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetailsResponseSuccess = true +) + +type ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsParams struct { + // Disabling Universal SSL removes any currently active Universal SSL certificates + // for your zone from the edge and prevents any future Universal SSL certificates + // from being ordered. If there are no advanced certificates or custom certificates + // uploaded for the domain, visitors will be unable to access the domain over + // HTTPS. + // + // By disabling Universal SSL, you understand that the following Cloudflare + // settings and preferences will result in visitors being unable to visit your + // domain unless you have uploaded a custom certificate or purchased an advanced + // certificate. + // + // - HSTS + // - Always Use HTTPS + // - Opportunistic Encryption + // - Onion Routing + // - Any Page Rules redirecting traffic to HTTPS + // + // Similarly, any HTTP redirect to HTTPS at the origin while the Cloudflare proxy + // is enabled will result in users being unable to visit your site without a valid + // certificate at Cloudflare's edge. + // + // If you do not have a valid custom or advanced certificate at Cloudflare's edge + // and are unsure if any of the above Cloudflare settings are enabled, or if any + // HTTP redirects exist at your origin, we advise leaving Universal SSL enabled for + // your domain. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonessluniversalsetting_test.go b/zonessluniversalsetting_test.go new file mode 100644 index 00000000000..4f0f6c1048b --- /dev/null +++ b/zonessluniversalsetting_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.Universals.Settings.UniversalSslSettingsForAZoneEditUniversalSslSettings( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSslUniversalSettingUniversalSslSettingsForAZoneEditUniversalSslSettingsParams{ + Enabled: cloudflare.F(true), + }, + ) + 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 TestZoneSslUniversalSettingUniversalSslSettingsForAZoneUniversalSslSettingsDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.Universals.Settings.UniversalSslSettingsForAZoneUniversalSslSettingsDetails(context.TODO(), "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/zonesslverification.go b/zonesslverification.go new file mode 100644 index 00000000000..78c4a081a8f --- /dev/null +++ b/zonesslverification.go @@ -0,0 +1,335 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSslVerificationService 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 [NewZoneSslVerificationService] +// method instead. +type ZoneSslVerificationService struct { + Options []option.RequestOption +} + +// NewZoneSslVerificationService 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 NewZoneSslVerificationService(opts ...option.RequestOption) (r *ZoneSslVerificationService) { + r = &ZoneSslVerificationService{} + r.Options = opts + return +} + +// Edit SSL validation method for a certificate pack. A PATCH request will request +// an immediate validation check on any certificate, and return the updated status. +// If a validation method is provided, the validation will be immediately attempted +// using that method. +func (r *ZoneSslVerificationService) Update(ctx context.Context, zoneIdentifier string, certPackUuid string, body ZoneSslVerificationUpdateParams, opts ...option.RequestOption) (res *ZoneSslVerificationUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/verification/%s", zoneIdentifier, certPackUuid) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Get SSL Verification Info for a Zone. +func (r *ZoneSslVerificationService) SslVerificationSslVerificationDetails(ctx context.Context, zoneIdentifier string, query ZoneSslVerificationSslVerificationSslVerificationDetailsParams, opts ...option.RequestOption) (res *ZoneSslVerificationSslVerificationSslVerificationDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/ssl/verification", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +type ZoneSslVerificationUpdateResponse struct { + Errors []ZoneSslVerificationUpdateResponseError `json:"errors"` + Messages []ZoneSslVerificationUpdateResponseMessage `json:"messages"` + Result ZoneSslVerificationUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneSslVerificationUpdateResponseSuccess `json:"success"` + JSON zoneSslVerificationUpdateResponseJSON `json:"-"` +} + +// zoneSslVerificationUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneSslVerificationUpdateResponse] +type zoneSslVerificationUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslVerificationUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslVerificationUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslVerificationUpdateResponseErrorJSON `json:"-"` +} + +// zoneSslVerificationUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneSslVerificationUpdateResponseError] +type zoneSslVerificationUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslVerificationUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslVerificationUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSslVerificationUpdateResponseMessageJSON `json:"-"` +} + +// zoneSslVerificationUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneSslVerificationUpdateResponseMessage] +type zoneSslVerificationUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslVerificationUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslVerificationUpdateResponseResult struct { + // Result status. + Status string `json:"status"` + // Desired validation method. + ValidationMethod ZoneSslVerificationUpdateResponseResultValidationMethod `json:"validation_method"` + JSON zoneSslVerificationUpdateResponseResultJSON `json:"-"` +} + +// zoneSslVerificationUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneSslVerificationUpdateResponseResult] +type zoneSslVerificationUpdateResponseResultJSON struct { + Status apijson.Field + ValidationMethod apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslVerificationUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Desired validation method. +type ZoneSslVerificationUpdateResponseResultValidationMethod string + +const ( + ZoneSslVerificationUpdateResponseResultValidationMethodHTTP ZoneSslVerificationUpdateResponseResultValidationMethod = "http" + ZoneSslVerificationUpdateResponseResultValidationMethodCname ZoneSslVerificationUpdateResponseResultValidationMethod = "cname" + ZoneSslVerificationUpdateResponseResultValidationMethodTxt ZoneSslVerificationUpdateResponseResultValidationMethod = "txt" + ZoneSslVerificationUpdateResponseResultValidationMethodEmail ZoneSslVerificationUpdateResponseResultValidationMethod = "email" +) + +// Whether the API call was successful +type ZoneSslVerificationUpdateResponseSuccess bool + +const ( + ZoneSslVerificationUpdateResponseSuccessTrue ZoneSslVerificationUpdateResponseSuccess = true +) + +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponse struct { + Result []ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResult `json:"result"` + JSON zoneSslVerificationSslVerificationSslVerificationDetailsResponseJSON `json:"-"` +} + +// zoneSslVerificationSslVerificationSslVerificationDetailsResponseJSON contains +// the JSON metadata for the struct +// [ZoneSslVerificationSslVerificationSslVerificationDetailsResponse] +type zoneSslVerificationSslVerificationSslVerificationDetailsResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslVerificationSslVerificationSslVerificationDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResult struct { + // Current status of certificate. + CertificateStatus ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus `json:"certificate_status,required"` + // Certificate Authority is manually reviewing the order. + BrandCheck bool `json:"brand_check"` + // Certificate Pack UUID. + CertPackUuid string `json:"cert_pack_uuid"` + // Certificate's signature algorithm. + Signature ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignature `json:"signature"` + // Validation method in use for a certificate pack order. + ValidationMethod ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethod `json:"validation_method"` + // Certificate's required verification information. + VerificationInfo ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfo `json:"verification_info"` + // Status of the required verification information, omitted if verification status + // is unknown. + VerificationStatus bool `json:"verification_status"` + // Method of verification. + VerificationType ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationType `json:"verification_type"` + JSON zoneSslVerificationSslVerificationSslVerificationDetailsResponseResultJSON `json:"-"` +} + +// zoneSslVerificationSslVerificationSslVerificationDetailsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResult] +type zoneSslVerificationSslVerificationSslVerificationDetailsResponseResultJSON struct { + CertificateStatus apijson.Field + BrandCheck apijson.Field + CertPackUuid apijson.Field + Signature apijson.Field + ValidationMethod apijson.Field + VerificationInfo apijson.Field + VerificationStatus apijson.Field + VerificationType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Current status of certificate. +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus string + +const ( + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatusInitializing ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus = "initializing" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatusAuthorizing ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus = "authorizing" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatusActive ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus = "active" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatusExpired ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus = "expired" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatusIssuing ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus = "issuing" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatusTimingOut ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus = "timing_out" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatusPendingDeployment ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultCertificateStatus = "pending_deployment" +) + +// Certificate's signature algorithm. +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignature string + +const ( + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignatureEcdsaWithSha256 ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignature = "ECDSAWithSHA256" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignatureSha1WithRsa ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignature = "SHA1WithRSA" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignatureSha256WithRsa ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultSignature = "SHA256WithRSA" +) + +// Validation method in use for a certificate pack order. +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethod string + +const ( + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethodHTTP ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethod = "http" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethodCname ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethod = "cname" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethodTxt ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultValidationMethod = "txt" +) + +// Certificate's required verification information. +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfo struct { + // Name of CNAME record. + RecordName ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordName `json:"record_name"` + // Target of CNAME record. + RecordTarget ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTarget `json:"record_target"` + JSON zoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoJSON `json:"-"` +} + +// zoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoJSON +// contains the JSON metadata for the struct +// [ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfo] +type zoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoJSON struct { + RecordName apijson.Field + RecordTarget apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Name of CNAME record. +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordName string + +const ( + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordNameRecordName ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordName = "record_name" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordNameHTTPURL ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordName = "http_url" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordNameCname ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordName = "cname" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordNameTxtName ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordName = "txt_name" +) + +// Target of CNAME record. +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTarget string + +const ( + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTargetRecordValue ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTarget = "record_value" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTargetHTTPBody ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTarget = "http_body" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTargetCnameTarget ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTarget = "cname_target" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTargetTxtValue ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationInfoRecordTarget = "txt_value" +) + +// Method of verification. +type ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationType string + +const ( + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationTypeCname ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationType = "cname" + ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationTypeMetaTag ZoneSslVerificationSslVerificationSslVerificationDetailsResponseResultVerificationType = "meta tag" +) + +type ZoneSslVerificationUpdateParams struct { + // Desired validation method. + ValidationMethod param.Field[ZoneSslVerificationUpdateParamsValidationMethod] `json:"validation_method,required"` +} + +func (r ZoneSslVerificationUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Desired validation method. +type ZoneSslVerificationUpdateParamsValidationMethod string + +const ( + ZoneSslVerificationUpdateParamsValidationMethodHTTP ZoneSslVerificationUpdateParamsValidationMethod = "http" + ZoneSslVerificationUpdateParamsValidationMethodCname ZoneSslVerificationUpdateParamsValidationMethod = "cname" + ZoneSslVerificationUpdateParamsValidationMethodTxt ZoneSslVerificationUpdateParamsValidationMethod = "txt" + ZoneSslVerificationUpdateParamsValidationMethodEmail ZoneSslVerificationUpdateParamsValidationMethod = "email" +) + +type ZoneSslVerificationSslVerificationSslVerificationDetailsParams struct { + // Immediately retry SSL Verification. + Retry param.Field[ZoneSslVerificationSslVerificationSslVerificationDetailsParamsRetry] `query:"retry"` +} + +// URLQuery serializes +// [ZoneSslVerificationSslVerificationSslVerificationDetailsParams]'s query +// parameters as `url.Values`. +func (r ZoneSslVerificationSslVerificationSslVerificationDetailsParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Immediately retry SSL Verification. +type ZoneSslVerificationSslVerificationSslVerificationDetailsParamsRetry bool + +const ( + ZoneSslVerificationSslVerificationSslVerificationDetailsParamsRetryTrue ZoneSslVerificationSslVerificationSslVerificationDetailsParamsRetry = true +) diff --git a/zonesslverification_test.go b/zonesslverification_test.go new file mode 100644 index 00000000000..cbcd111ae36 --- /dev/null +++ b/zonesslverification_test.go @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSslVerificationUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.Verifications.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "a77f8bd7-3b47-46b4-a6f1-75cf98109948", + cloudflare.ZoneSslVerificationUpdateParams{ + ValidationMethod: cloudflare.F(cloudflare.ZoneSslVerificationUpdateParamsValidationMethodTxt), + }, + ) + 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 TestZoneSslVerificationSslVerificationSslVerificationDetailsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Ssls.Verifications.SslVerificationSslVerificationDetails( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneSslVerificationSslVerificationSslVerificationDetailsParams{ + Retry: cloudflare.F(cloudflare.ZoneSslVerificationSslVerificationSslVerificationDetailsParamsRetryTrue), + }, + ) + 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/zonesubscription.go b/zonesubscription.go new file mode 100644 index 00000000000..e94688d2c62 --- /dev/null +++ b/zonesubscription.go @@ -0,0 +1,434 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSubscriptionService 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 [NewZoneSubscriptionService] method +// instead. +type ZoneSubscriptionService struct { + Options []option.RequestOption +} + +// NewZoneSubscriptionService 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 NewZoneSubscriptionService(opts ...option.RequestOption) (r *ZoneSubscriptionService) { + r = &ZoneSubscriptionService{} + r.Options = opts + return +} + +// Create a zone subscription, either plan or add-ons. +func (r *ZoneSubscriptionService) ZoneSubscriptionNewZoneSubscription(ctx context.Context, identifier string, body ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParams, opts ...option.RequestOption) (res *ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/subscription", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Updates zone subscriptions, either plan or add-ons. +func (r *ZoneSubscriptionService) ZoneSubscriptionUpdateZoneSubscription(ctx context.Context, identifier string, body ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParams, opts ...option.RequestOption) (res *ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/subscription", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Lists zone subscription details. +func (r *ZoneSubscriptionService) ZoneSubscriptionZoneSubscriptionDetails(ctx context.Context, identifier string, opts ...option.RequestOption) (res *ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/subscription", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponse struct { + Errors []ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseError `json:"errors"` + Messages []ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseSuccess `json:"success"` + JSON zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseJSON contains the +// JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponse] +type zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseErrorJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseError] +type zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseMessageJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseMessage] +type zoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseSuccess bool + +const ( + ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseSuccessTrue ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionResponseSuccess = true +) + +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponse struct { + Errors []ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseError `json:"errors"` + Messages []ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseSuccess `json:"success"` + JSON zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseJSON contains the +// JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponse] +type zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseErrorJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseError] +type zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseMessageJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseMessage] +type zoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseSuccess bool + +const ( + ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseSuccessTrue ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionResponseSuccess = true +) + +type ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponse struct { + Errors []ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseError `json:"errors"` + Messages []ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseSuccess `json:"success"` + JSON zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseJSON contains the +// JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponse] +type zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseErrorJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseError] +type zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseMessageJSON `json:"-"` +} + +// zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseMessage] +type zoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseSuccess bool + +const ( + ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseSuccessTrue ZoneSubscriptionZoneSubscriptionZoneSubscriptionDetailsResponseSuccess = true +) + +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParams struct { + App param.Field[ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsApp] `json:"app"` + // The list of add-ons subscribed to. + ComponentValues param.Field[[]ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsComponentValue] `json:"component_values"` + // How often the subscription is renewed automatically. + Frequency param.Field[ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequency] `json:"frequency"` + // The rate plan applied to the subscription. + RatePlan param.Field[ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsRatePlan] `json:"rate_plan"` + // A simple zone object. May have null properties if not a zone subscription. + Zone param.Field[ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsZone] `json:"zone"` +} + +func (r ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsApp struct { + // app install id. + InstallID param.Field[string] `json:"install_id"` +} + +func (r ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsApp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A component value for a subscription. +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsComponentValue struct { + // The default amount assigned. + Default param.Field[float64] `json:"default"` + // The name of the component value. + Name param.Field[string] `json:"name"` + // The unit price for the component value. + Price param.Field[float64] `json:"price"` + // The amount of the component value assigned. + Value param.Field[float64] `json:"value"` +} + +func (r ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsComponentValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// How often the subscription is renewed automatically. +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequency string + +const ( + ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequencyWeekly ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequency = "weekly" + ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequencyMonthly ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequency = "monthly" + ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequencyQuarterly ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequency = "quarterly" + ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequencyYearly ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequency = "yearly" +) + +// The rate plan applied to the subscription. +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsRatePlan struct { + // The ID of the rate plan. + ID param.Field[interface{}] `json:"id"` + // The currency applied to the rate plan subscription. + Currency param.Field[string] `json:"currency"` + // Whether this rate plan is managed externally from Cloudflare. + ExternallyManaged param.Field[bool] `json:"externally_managed"` + // Whether a rate plan is enterprise-based (or newly adopted term contract). + IsContract param.Field[bool] `json:"is_contract"` + // The full name of the rate plan. + PublicName param.Field[string] `json:"public_name"` + // The scope that this rate plan applies to. + Scope param.Field[string] `json:"scope"` + // The list of sets this rate plan applies to. + Sets param.Field[[]string] `json:"sets"` +} + +func (r ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsRatePlan) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A simple zone object. May have null properties if not a zone subscription. +type ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsZone struct { +} + +func (r ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsZone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParams struct { + App param.Field[ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsApp] `json:"app"` + // The list of add-ons subscribed to. + ComponentValues param.Field[[]ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsComponentValue] `json:"component_values"` + // How often the subscription is renewed automatically. + Frequency param.Field[ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequency] `json:"frequency"` + // The rate plan applied to the subscription. + RatePlan param.Field[ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsRatePlan] `json:"rate_plan"` + // A simple zone object. May have null properties if not a zone subscription. + Zone param.Field[ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsZone] `json:"zone"` +} + +func (r ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsApp struct { + // app install id. + InstallID param.Field[string] `json:"install_id"` +} + +func (r ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsApp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A component value for a subscription. +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsComponentValue struct { + // The default amount assigned. + Default param.Field[float64] `json:"default"` + // The name of the component value. + Name param.Field[string] `json:"name"` + // The unit price for the component value. + Price param.Field[float64] `json:"price"` + // The amount of the component value assigned. + Value param.Field[float64] `json:"value"` +} + +func (r ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsComponentValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// How often the subscription is renewed automatically. +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequency string + +const ( + ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequencyWeekly ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequency = "weekly" + ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequencyMonthly ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequency = "monthly" + ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequencyQuarterly ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequency = "quarterly" + ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequencyYearly ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequency = "yearly" +) + +// The rate plan applied to the subscription. +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsRatePlan struct { + // The ID of the rate plan. + ID param.Field[interface{}] `json:"id"` + // The currency applied to the rate plan subscription. + Currency param.Field[string] `json:"currency"` + // Whether this rate plan is managed externally from Cloudflare. + ExternallyManaged param.Field[bool] `json:"externally_managed"` + // Whether a rate plan is enterprise-based (or newly adopted term contract). + IsContract param.Field[bool] `json:"is_contract"` + // The full name of the rate plan. + PublicName param.Field[string] `json:"public_name"` + // The scope that this rate plan applies to. + Scope param.Field[string] `json:"scope"` + // The list of sets this rate plan applies to. + Sets param.Field[[]string] `json:"sets"` +} + +func (r ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsRatePlan) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A simple zone object. May have null properties if not a zone subscription. +type ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsZone struct { +} + +func (r ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsZone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonesubscription_test.go b/zonesubscription_test.go new file mode 100644 index 00000000000..86f1d8c64dd --- /dev/null +++ b/zonesubscription_test.go @@ -0,0 +1,162 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSubscriptionZoneSubscriptionNewZoneSubscriptionWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Subscriptions.ZoneSubscriptionNewZoneSubscription( + context.TODO(), + "506e3185e9c882d175a2d0cb0093d9f2", + cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParams{ + App: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsApp{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsComponentValue{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsFrequencyMonthly), + RatePlan: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsRatePlan{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F[any]("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionNewZoneSubscriptionParamsZone{}), + }, + ) + 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 TestZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Subscriptions.ZoneSubscriptionUpdateZoneSubscription( + context.TODO(), + "506e3185e9c882d175a2d0cb0093d9f2", + cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParams{ + App: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsApp{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsComponentValue{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsFrequencyMonthly), + RatePlan: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsRatePlan{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F[any]("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(cloudflare.ZoneSubscriptionZoneSubscriptionUpdateZoneSubscriptionParamsZone{}), + }, + ) + 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 TestZoneSubscriptionZoneSubscriptionZoneSubscriptionDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Subscriptions.ZoneSubscriptionZoneSubscriptionDetails(context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2") + 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/zoneurlnormalization.go b/zoneurlnormalization.go new file mode 100644 index 00000000000..963bbb640d0 --- /dev/null +++ b/zoneurlnormalization.go @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneURLNormalizationService 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 [NewZoneURLNormalizationService] +// method instead. +type ZoneURLNormalizationService struct { + Options []option.RequestOption +} + +// NewZoneURLNormalizationService 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 NewZoneURLNormalizationService(opts ...option.RequestOption) (r *ZoneURLNormalizationService) { + r = &ZoneURLNormalizationService{} + r.Options = opts + return +} + +// Fetches the current URL normalization settings. +func (r *ZoneURLNormalizationService) URLNormalizationGetURLNormalizationSettings(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/url_normalization", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the URL normalization settings. +func (r *ZoneURLNormalizationService) URLNormalizationUpdateURLNormalizationSettings(ctx context.Context, zoneID string, body ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsParams, opts ...option.RequestOption) (res *ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/url_normalization", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponse struct { + // The scope of the URL normalization. + Scope string `json:"scope"` + // The type of URL normalization performed by Cloudflare. + Type string `json:"type"` + JSON zoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponseJSON `json:"-"` +} + +// zoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponseJSON +// contains the JSON metadata for the struct +// [ZoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponse] +type zoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponseJSON struct { + Scope apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneURLNormalizationURLNormalizationGetURLNormalizationSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponse struct { + // The scope of the URL normalization. + Scope string `json:"scope"` + // The type of URL normalization performed by Cloudflare. + Type string `json:"type"` + JSON zoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponseJSON `json:"-"` +} + +// zoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponseJSON +// contains the JSON metadata for the struct +// [ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponse] +type zoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponseJSON struct { + Scope apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsParams struct { + // The scope of the URL normalization. + Scope param.Field[string] `json:"scope"` + // The type of URL normalization performed by Cloudflare. + Type param.Field[string] `json:"type"` +} + +func (r ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneurlnormalization_test.go b/zoneurlnormalization_test.go new file mode 100644 index 00000000000..dc6cb9531ef --- /dev/null +++ b/zoneurlnormalization_test.go @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneURLNormalizationURLNormalizationGetURLNormalizationSettings(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.URLNormalizations.URLNormalizationGetURLNormalizationSettings(context.TODO(), "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()) + } +} + +func TestZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.URLNormalizations.URLNormalizationUpdateURLNormalizationSettings( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneURLNormalizationURLNormalizationUpdateURLNormalizationSettingsParams{ + Scope: cloudflare.F("incoming"), + Type: cloudflare.F("cloudflare"), + }, + ) + 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/zonewaitingroom.go b/zonewaitingroom.go new file mode 100644 index 00000000000..78f0beef7e3 --- /dev/null +++ b/zonewaitingroom.go @@ -0,0 +1,2322 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWaitingRoomService 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 [NewZoneWaitingRoomService] method +// instead. +type ZoneWaitingRoomService struct { + Options []option.RequestOption + Previews *ZoneWaitingRoomPreviewService + Events *ZoneWaitingRoomEventService + Rules *ZoneWaitingRoomRuleService + Statuses *ZoneWaitingRoomStatusService + Settings *ZoneWaitingRoomSettingService +} + +// NewZoneWaitingRoomService 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 NewZoneWaitingRoomService(opts ...option.RequestOption) (r *ZoneWaitingRoomService) { + r = &ZoneWaitingRoomService{} + r.Options = opts + r.Previews = NewZoneWaitingRoomPreviewService(opts...) + r.Events = NewZoneWaitingRoomEventService(opts...) + r.Rules = NewZoneWaitingRoomRuleService(opts...) + r.Statuses = NewZoneWaitingRoomStatusService(opts...) + r.Settings = NewZoneWaitingRoomSettingService(opts...) + return +} + +// Fetches a single configured waiting room. +func (r *ZoneWaitingRoomService) Get(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, opts ...option.RequestOption) (res *SingleWaitingRoomResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured waiting room. +func (r *ZoneWaitingRoomService) Update(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body ZoneWaitingRoomUpdateParams, opts ...option.RequestOption) (res *SingleWaitingRoomResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a waiting room. +func (r *ZoneWaitingRoomService) Delete(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, opts ...option.RequestOption) (res *ZoneWaitingRoomDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Patches a configured waiting room. +func (r *ZoneWaitingRoomService) Patch(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body ZoneWaitingRoomPatchParams, opts ...option.RequestOption) (res *SingleWaitingRoomResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Creates a new waiting room. +func (r *ZoneWaitingRoomService) WaitingRoomNewWaitingRoom(ctx context.Context, zoneIdentifier string, body ZoneWaitingRoomWaitingRoomNewWaitingRoomParams, opts ...option.RequestOption) (res *SingleWaitingRoomResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists waiting rooms. +func (r *ZoneWaitingRoomService) WaitingRoomListWaitingRooms(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type SingleWaitingRoomResponse struct { + Result SingleWaitingRoomResponseResult `json:"result"` + JSON singleWaitingRoomResponseJSON `json:"-"` +} + +// singleWaitingRoomResponseJSON contains the JSON metadata for the struct +// [SingleWaitingRoomResponse] +type singleWaitingRoomResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *SingleWaitingRoomResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type SingleWaitingRoomResponseResult struct { + ID interface{} `json:"id"` + // Only available for the Waiting Room Advanced subscription. Additional hostname + // and path combinations to which this waiting room will be applied. There is an + // implied wildcard at the end of the path. The hostname and path combination must + // be unique to this and all other waiting rooms. + AdditionalRoutes []SingleWaitingRoomResponseResultAdditionalRoute `json:"additional_routes"` + // Configures cookie attributes for the waiting room cookie. This encrypted cookie + // stores a user's status in the waiting room, such as queue position. + CookieAttributes SingleWaitingRoomResponseResultCookieAttributes `json:"cookie_attributes"` + // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie + // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be + // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. + CookieSuffix string `json:"cookie_suffix"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Only available for the Waiting Room Advanced subscription. This is a template + // html file that will be rendered at the edge. If no custom_page_html is provided, + // the default waiting room will be used. The template is based on mustache ( + // https://mustache.github.io/ ). There are several variables that are evaluated by + // the Cloudflare edge: + // + // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to + // take when wait time is not available, for instance when queue_all is + // **true**. + // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five + // minutes. Alternatively, you can use: + // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. + // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user + // (`Math.floor(waitTime/60)`). + // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value + // (`waitTime%60`). + // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the + // queue. + // + // To view the full list of variables, look at the `cfWaitingRoom` object described + // under the `json_response_enabled` property in other Waiting Room API calls. + CustomPageHTML string `json:"custom_page_html"` + // The language of the default page template. If no default_template_language is + // provided, then `en-US` (English) will be used. + DefaultTemplateLanguage SingleWaitingRoomResponseResultDefaultTemplateLanguage `json:"default_template_language"` + // A note that you can use to add more details about the waiting room. + Description string `json:"description"` + // Only available for the Waiting Room Advanced subscription. Disables automatic + // renewal of session cookies. If `true`, an accepted user will have + // session_duration minutes to browse the site. After that, they will have to go + // through the waiting room again. If `false`, a user's session cookie will be + // automatically renewed on every request. + DisableSessionRenewal bool `json:"disable_session_renewal"` + // The host name to which the waiting room will be applied (no wildcards). Please + // do not include the scheme (http:// or https://). The host and path combination + // must be unique. + Host string `json:"host"` + // Only available for the Waiting Room Advanced subscription. If `true`, requests + // to the waiting room with the header `Accept: application/json` will receive a + // JSON response object with information on the user's status in the waiting room + // as opposed to the configured static HTML page. This JSON response object has one + // property `cfWaitingRoom` which is an object containing the following fields: + // + // 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room + // (always **true**). + // 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are + // accurate. If **false**, they are not available. + // 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating + // the current estimated time in minutes the user will wait in the waiting room. + // When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. + // 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 25% of users that gain entry the fastest (25th percentile). + // 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 50% of users that gain entry the fastest (50th percentile). + // In other words, half of the queued users are expected to let into the origin + // website before `waitTime50Percentile` and half are expected to be let in + // after it. + // 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 75% of users that gain entry the fastest (75th percentile). + // 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English + // for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display + // **unavailable**. + // 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently + // full and not accepting new users at the moment. + // 9. `queueAll`: Boolean indicating if all users will be queued in the waiting + // room and no one will be let into the origin website. + // 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the + // user's last attempt to leave the waiting room and be let into the origin + // website. The user is able to make another attempt after + // `refreshIntervalSeconds` past this time. If the user makes a request too + // soon, it will be ignored and `lastUpdated` will not change. + // 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after + // `lastUpdated` until the user is able to make another attempt to leave the + // waiting room and be let into the origin website. When the `queueingMethod` + // is `reject`, there is no specified refresh time — it will always be + // **zero**. + // 12. `queueingMethod`: The queueing method currently used by the waiting room. It + // is either **fifo**, **random**, **passthrough**, or **reject**. + // 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO + // (First-In-First-Out) queue. + // 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue + // where users gain access randomly. + // 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a + // passthrough queue. Keep in mind that when passthrough is enabled, this JSON + // response will only exist when `queueAll` is **true** or `isEventPrequeueing` + // is **true** because in all other cases requests will go directly to the + // origin. + // 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. + // 17. `isEventActive`: Boolean indicating if an event is currently occurring. + // Events are able to change a waiting room's behavior during a specified + // period of time. For additional information, look at the event properties + // `prequeue_start_time`, `event_start_time`, and `event_end_time` in the + // documentation for creating waiting room events. Events are considered active + // between these start and end times, as well as during the prequeueing period + // if it exists. + // 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean + // indicating if an event is currently prequeueing users before it starts. + // 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. + // Integer indicating the number of minutes until the event starts. + // 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` + // formatted in English for users. If `isEventPrequeueing` is **false**, + // `timeUntilEventStartFormatted` will display **unavailable**. + // 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer + // indicating the number of minutes until the event ends. + // 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` + // formatted in English for users. If `isEventActive` is **false**, + // `timeUntilEventEndFormatted` will display **unavailable**. + // 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean + // indicating if the users in the prequeue are shuffled randomly when the event + // starts. + // + // An example cURL to a waiting room could be: + // + // curl -X GET "https://example.com/waitingroom" \ + // -H "Accept: application/json" + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **fifo** and no event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 0, + // "waitTime50Percentile": 0, + // "waitTime75Percentile": 0, + // "waitTimeFormatted": "10 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "fifo", + // "isFIFOQueue": true, + // "isRandomQueue": false, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": false, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 0, + // "timeUntilEventEndFormatted": "unavailable", + // "shuffleAtEventStart": false + // } + // } + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **random** and an event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 5, + // "waitTime50Percentile": 10, + // "waitTime75Percentile": 15, + // "waitTimeFormatted": "5 minutes to 15 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "random", + // "isFIFOQueue": false, + // "isRandomQueue": true, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": true, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 15, + // "timeUntilEventEndFormatted": "15 minutes", + // "shuffleAtEventStart": true + // } + // }. + JsonResponseEnabled bool `json:"json_response_enabled"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A unique name to identify the waiting room. Only alphanumeric characters, + // hyphens and underscores are allowed. + Name string `json:"name"` + // Sets the number of new users that will be let into the route every minute. This + // value is used as baseline for the number of users that are let in per minute. So + // it is possible that there is a little more or little less traffic coming to the + // route based on the traffic patterns at that time around the world. + NewUsersPerMinute int64 `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when the next event will begin queueing. + NextEventPrequeueStartTime string `json:"next_event_prequeue_start_time,nullable"` + // An ISO 8601 timestamp that marks when the next event will start. + NextEventStartTime string `json:"next_event_start_time,nullable"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path string `json:"path"` + // If queue_all is `true`, all the traffic that is coming to a route will be sent + // to the waiting room. No new traffic can get to the route once this field is set + // and estimated time will become unavailable. + QueueAll bool `json:"queue_all"` + // Sets the queueing method used by the waiting room. Changing this parameter from + // the **default** queueing method is only available for the Waiting Room Advanced + // subscription. Regardless of the queueing method, if `queue_all` is enabled or an + // event is prequeueing, users in the waiting room will not be accepted to the + // origin. These users will always see a waiting room page that refreshes + // automatically. The valid queueing methods are: + // + // 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in + // the order they arrived. + // 2. `random`: Random queue where customers gain access randomly, regardless of + // arrival time. + // 3. `passthrough`: Users will pass directly through the waiting room and into the + // origin website. As a result, any configured limits will not be respected + // while this is enabled. This method can be used as an alternative to disabling + // a waiting room (with `suspended`) so that analytics are still reported. This + // can be used if you wish to allow all traffic normally, but want to restrict + // traffic during a waiting room event, or vice versa. + // 4. `reject`: Users will be immediately rejected from the waiting room. As a + // result, no users will reach the origin website while this is enabled. This + // can be used if you wish to reject all traffic while performing maintenance, + // block traffic during a specified period of time (an event), or block traffic + // while events are not occurring. Consider a waiting room used for vaccine + // distribution that only allows traffic during sign-up events, and otherwise + // blocks all traffic. For this case, the waiting room uses `reject`, and its + // events override this with `fifo`, `random`, or `passthrough`. When this + // queueing method is enabled and neither `queueAll` is enabled nor an event is + // prequeueing, the waiting room page **will not refresh automatically**. + QueueingMethod SingleWaitingRoomResponseResultQueueingMethod `json:"queueing_method"` + // HTTP status code returned to a user while in the queue. + QueueingStatusCode SingleWaitingRoomResponseResultQueueingStatusCode `json:"queueing_status_code"` + // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to + // the route. If a user is not seen by Cloudflare again in that time period, they + // will be treated as a new user that visits the route. + SessionDuration int64 `json:"session_duration"` + // Suspends or allows traffic going to the waiting room. If set to `true`, the + // traffic will not go to the waiting room. + Suspended bool `json:"suspended"` + // Sets the total number of active user sessions on the route at a point in time. A + // route is a combination of host and path on which a waiting room is available. + // This value is used as a baseline for the total number of active user sessions on + // the route. It is possible to have a situation where there are more or less + // active users sessions on the route based on the traffic patterns at that time + // around the world. + TotalActiveUsers int64 `json:"total_active_users"` + JSON singleWaitingRoomResponseResultJSON `json:"-"` +} + +// singleWaitingRoomResponseResultJSON contains the JSON metadata for the struct +// [SingleWaitingRoomResponseResult] +type singleWaitingRoomResponseResultJSON struct { + ID apijson.Field + AdditionalRoutes apijson.Field + CookieAttributes apijson.Field + CookieSuffix apijson.Field + CreatedOn apijson.Field + CustomPageHTML apijson.Field + DefaultTemplateLanguage apijson.Field + Description apijson.Field + DisableSessionRenewal apijson.Field + Host apijson.Field + JsonResponseEnabled apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NewUsersPerMinute apijson.Field + NextEventPrequeueStartTime apijson.Field + NextEventStartTime apijson.Field + Path apijson.Field + QueueAll apijson.Field + QueueingMethod apijson.Field + QueueingStatusCode apijson.Field + SessionDuration apijson.Field + Suspended apijson.Field + TotalActiveUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *SingleWaitingRoomResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type SingleWaitingRoomResponseResultAdditionalRoute struct { + // The hostname to which this waiting room will be applied (no wildcards). The + // hostname must be the primary domain, subdomain, or custom hostname (if using SSL + // for SaaS) of this zone. Please do not include the scheme (http:// or https://). + Host string `json:"host"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path string `json:"path"` + JSON singleWaitingRoomResponseResultAdditionalRouteJSON `json:"-"` +} + +// singleWaitingRoomResponseResultAdditionalRouteJSON contains the JSON metadata +// for the struct [SingleWaitingRoomResponseResultAdditionalRoute] +type singleWaitingRoomResponseResultAdditionalRouteJSON struct { + Host apijson.Field + Path apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *SingleWaitingRoomResponseResultAdditionalRoute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures cookie attributes for the waiting room cookie. This encrypted cookie +// stores a user's status in the waiting room, such as queue position. +type SingleWaitingRoomResponseResultCookieAttributes struct { + // Configures the SameSite attribute on the waiting room cookie. Value `auto` will + // be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. + // Note that when using value `none`, the secure attribute cannot be set to + // `never`. + Samesite SingleWaitingRoomResponseResultCookieAttributesSamesite `json:"samesite"` + // Configures the Secure attribute on the waiting room cookie. Value `always` + // indicates that the Secure attribute will be set in the Set-Cookie header, + // `never` indicates that the Secure attribute will not be set, and `auto` will set + // the Secure attribute depending if **Always Use HTTPS** is enabled. + Secure SingleWaitingRoomResponseResultCookieAttributesSecure `json:"secure"` + JSON singleWaitingRoomResponseResultCookieAttributesJSON `json:"-"` +} + +// singleWaitingRoomResponseResultCookieAttributesJSON contains the JSON metadata +// for the struct [SingleWaitingRoomResponseResultCookieAttributes] +type singleWaitingRoomResponseResultCookieAttributesJSON struct { + Samesite apijson.Field + Secure apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *SingleWaitingRoomResponseResultCookieAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures the SameSite attribute on the waiting room cookie. Value `auto` will +// be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. +// Note that when using value `none`, the secure attribute cannot be set to +// `never`. +type SingleWaitingRoomResponseResultCookieAttributesSamesite string + +const ( + SingleWaitingRoomResponseResultCookieAttributesSamesiteAuto SingleWaitingRoomResponseResultCookieAttributesSamesite = "auto" + SingleWaitingRoomResponseResultCookieAttributesSamesiteLax SingleWaitingRoomResponseResultCookieAttributesSamesite = "lax" + SingleWaitingRoomResponseResultCookieAttributesSamesiteNone SingleWaitingRoomResponseResultCookieAttributesSamesite = "none" + SingleWaitingRoomResponseResultCookieAttributesSamesiteStrict SingleWaitingRoomResponseResultCookieAttributesSamesite = "strict" +) + +// Configures the Secure attribute on the waiting room cookie. Value `always` +// indicates that the Secure attribute will be set in the Set-Cookie header, +// `never` indicates that the Secure attribute will not be set, and `auto` will set +// the Secure attribute depending if **Always Use HTTPS** is enabled. +type SingleWaitingRoomResponseResultCookieAttributesSecure string + +const ( + SingleWaitingRoomResponseResultCookieAttributesSecureAuto SingleWaitingRoomResponseResultCookieAttributesSecure = "auto" + SingleWaitingRoomResponseResultCookieAttributesSecureAlways SingleWaitingRoomResponseResultCookieAttributesSecure = "always" + SingleWaitingRoomResponseResultCookieAttributesSecureNever SingleWaitingRoomResponseResultCookieAttributesSecure = "never" +) + +// The language of the default page template. If no default_template_language is +// provided, then `en-US` (English) will be used. +type SingleWaitingRoomResponseResultDefaultTemplateLanguage string + +const ( + SingleWaitingRoomResponseResultDefaultTemplateLanguageEnUs SingleWaitingRoomResponseResultDefaultTemplateLanguage = "en-US" + SingleWaitingRoomResponseResultDefaultTemplateLanguageEsEs SingleWaitingRoomResponseResultDefaultTemplateLanguage = "es-ES" + SingleWaitingRoomResponseResultDefaultTemplateLanguageDeDe SingleWaitingRoomResponseResultDefaultTemplateLanguage = "de-DE" + SingleWaitingRoomResponseResultDefaultTemplateLanguageFrFr SingleWaitingRoomResponseResultDefaultTemplateLanguage = "fr-FR" + SingleWaitingRoomResponseResultDefaultTemplateLanguageItIt SingleWaitingRoomResponseResultDefaultTemplateLanguage = "it-IT" + SingleWaitingRoomResponseResultDefaultTemplateLanguageJaJp SingleWaitingRoomResponseResultDefaultTemplateLanguage = "ja-JP" + SingleWaitingRoomResponseResultDefaultTemplateLanguageKoKr SingleWaitingRoomResponseResultDefaultTemplateLanguage = "ko-KR" + SingleWaitingRoomResponseResultDefaultTemplateLanguagePtBr SingleWaitingRoomResponseResultDefaultTemplateLanguage = "pt-BR" + SingleWaitingRoomResponseResultDefaultTemplateLanguageZhCn SingleWaitingRoomResponseResultDefaultTemplateLanguage = "zh-CN" + SingleWaitingRoomResponseResultDefaultTemplateLanguageZhTw SingleWaitingRoomResponseResultDefaultTemplateLanguage = "zh-TW" + SingleWaitingRoomResponseResultDefaultTemplateLanguageNlNl SingleWaitingRoomResponseResultDefaultTemplateLanguage = "nl-NL" + SingleWaitingRoomResponseResultDefaultTemplateLanguagePlPl SingleWaitingRoomResponseResultDefaultTemplateLanguage = "pl-PL" + SingleWaitingRoomResponseResultDefaultTemplateLanguageIDID SingleWaitingRoomResponseResultDefaultTemplateLanguage = "id-ID" + SingleWaitingRoomResponseResultDefaultTemplateLanguageTrTr SingleWaitingRoomResponseResultDefaultTemplateLanguage = "tr-TR" + SingleWaitingRoomResponseResultDefaultTemplateLanguageArEg SingleWaitingRoomResponseResultDefaultTemplateLanguage = "ar-EG" + SingleWaitingRoomResponseResultDefaultTemplateLanguageRuRu SingleWaitingRoomResponseResultDefaultTemplateLanguage = "ru-RU" + SingleWaitingRoomResponseResultDefaultTemplateLanguageFaIr SingleWaitingRoomResponseResultDefaultTemplateLanguage = "fa-IR" +) + +// Sets the queueing method used by the waiting room. Changing this parameter from +// the **default** queueing method is only available for the Waiting Room Advanced +// subscription. Regardless of the queueing method, if `queue_all` is enabled or an +// event is prequeueing, users in the waiting room will not be accepted to the +// origin. These users will always see a waiting room page that refreshes +// automatically. The valid queueing methods are: +// +// 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in +// the order they arrived. +// 2. `random`: Random queue where customers gain access randomly, regardless of +// arrival time. +// 3. `passthrough`: Users will pass directly through the waiting room and into the +// origin website. As a result, any configured limits will not be respected +// while this is enabled. This method can be used as an alternative to disabling +// a waiting room (with `suspended`) so that analytics are still reported. This +// can be used if you wish to allow all traffic normally, but want to restrict +// traffic during a waiting room event, or vice versa. +// 4. `reject`: Users will be immediately rejected from the waiting room. As a +// result, no users will reach the origin website while this is enabled. This +// can be used if you wish to reject all traffic while performing maintenance, +// block traffic during a specified period of time (an event), or block traffic +// while events are not occurring. Consider a waiting room used for vaccine +// distribution that only allows traffic during sign-up events, and otherwise +// blocks all traffic. For this case, the waiting room uses `reject`, and its +// events override this with `fifo`, `random`, or `passthrough`. When this +// queueing method is enabled and neither `queueAll` is enabled nor an event is +// prequeueing, the waiting room page **will not refresh automatically**. +type SingleWaitingRoomResponseResultQueueingMethod string + +const ( + SingleWaitingRoomResponseResultQueueingMethodFifo SingleWaitingRoomResponseResultQueueingMethod = "fifo" + SingleWaitingRoomResponseResultQueueingMethodRandom SingleWaitingRoomResponseResultQueueingMethod = "random" + SingleWaitingRoomResponseResultQueueingMethodPassthrough SingleWaitingRoomResponseResultQueueingMethod = "passthrough" + SingleWaitingRoomResponseResultQueueingMethodReject SingleWaitingRoomResponseResultQueueingMethod = "reject" +) + +// HTTP status code returned to a user while in the queue. +type SingleWaitingRoomResponseResultQueueingStatusCode int64 + +const ( + SingleWaitingRoomResponseResultQueueingStatusCode200 SingleWaitingRoomResponseResultQueueingStatusCode = 200 + SingleWaitingRoomResponseResultQueueingStatusCode202 SingleWaitingRoomResponseResultQueueingStatusCode = 202 + SingleWaitingRoomResponseResultQueueingStatusCode429 SingleWaitingRoomResponseResultQueueingStatusCode = 429 +) + +type ZoneWaitingRoomDeleteResponse struct { + Result ZoneWaitingRoomDeleteResponseResult `json:"result"` + JSON zoneWaitingRoomDeleteResponseJSON `json:"-"` +} + +// zoneWaitingRoomDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneWaitingRoomDeleteResponse] +type zoneWaitingRoomDeleteResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomDeleteResponseResult struct { + ID interface{} `json:"id"` + JSON zoneWaitingRoomDeleteResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomDeleteResponseResult] +type zoneWaitingRoomDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponse struct { + Errors []ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseError `json:"errors"` + Messages []ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseMessage `json:"messages"` + Result []ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResult `json:"result"` + ResultInfo ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseSuccess `json:"success"` + JSON zoneWaitingRoomWaitingRoomListWaitingRoomsResponseJSON `json:"-"` +} + +// zoneWaitingRoomWaitingRoomListWaitingRoomsResponseJSON contains the JSON +// metadata for the struct [ZoneWaitingRoomWaitingRoomListWaitingRoomsResponse] +type zoneWaitingRoomWaitingRoomListWaitingRoomsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomWaitingRoomListWaitingRoomsResponseErrorJSON `json:"-"` +} + +// zoneWaitingRoomWaitingRoomListWaitingRoomsResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseError] +type zoneWaitingRoomWaitingRoomListWaitingRoomsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomWaitingRoomListWaitingRoomsResponseMessageJSON `json:"-"` +} + +// zoneWaitingRoomWaitingRoomListWaitingRoomsResponseMessageJSON contains the JSON +// metadata for the struct +// [ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseMessage] +type zoneWaitingRoomWaitingRoomListWaitingRoomsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResult struct { + ID interface{} `json:"id"` + // Only available for the Waiting Room Advanced subscription. Additional hostname + // and path combinations to which this waiting room will be applied. There is an + // implied wildcard at the end of the path. The hostname and path combination must + // be unique to this and all other waiting rooms. + AdditionalRoutes []ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultAdditionalRoute `json:"additional_routes"` + // Configures cookie attributes for the waiting room cookie. This encrypted cookie + // stores a user's status in the waiting room, such as queue position. + CookieAttributes ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributes `json:"cookie_attributes"` + // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie + // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be + // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. + CookieSuffix string `json:"cookie_suffix"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Only available for the Waiting Room Advanced subscription. This is a template + // html file that will be rendered at the edge. If no custom_page_html is provided, + // the default waiting room will be used. The template is based on mustache ( + // https://mustache.github.io/ ). There are several variables that are evaluated by + // the Cloudflare edge: + // + // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to + // take when wait time is not available, for instance when queue_all is + // **true**. + // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five + // minutes. Alternatively, you can use: + // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. + // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user + // (`Math.floor(waitTime/60)`). + // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value + // (`waitTime%60`). + // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the + // queue. + // + // To view the full list of variables, look at the `cfWaitingRoom` object described + // under the `json_response_enabled` property in other Waiting Room API calls. + CustomPageHTML string `json:"custom_page_html"` + // The language of the default page template. If no default_template_language is + // provided, then `en-US` (English) will be used. + DefaultTemplateLanguage ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage `json:"default_template_language"` + // A note that you can use to add more details about the waiting room. + Description string `json:"description"` + // Only available for the Waiting Room Advanced subscription. Disables automatic + // renewal of session cookies. If `true`, an accepted user will have + // session_duration minutes to browse the site. After that, they will have to go + // through the waiting room again. If `false`, a user's session cookie will be + // automatically renewed on every request. + DisableSessionRenewal bool `json:"disable_session_renewal"` + // The host name to which the waiting room will be applied (no wildcards). Please + // do not include the scheme (http:// or https://). The host and path combination + // must be unique. + Host string `json:"host"` + // Only available for the Waiting Room Advanced subscription. If `true`, requests + // to the waiting room with the header `Accept: application/json` will receive a + // JSON response object with information on the user's status in the waiting room + // as opposed to the configured static HTML page. This JSON response object has one + // property `cfWaitingRoom` which is an object containing the following fields: + // + // 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room + // (always **true**). + // 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are + // accurate. If **false**, they are not available. + // 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating + // the current estimated time in minutes the user will wait in the waiting room. + // When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. + // 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 25% of users that gain entry the fastest (25th percentile). + // 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 50% of users that gain entry the fastest (50th percentile). + // In other words, half of the queued users are expected to let into the origin + // website before `waitTime50Percentile` and half are expected to be let in + // after it. + // 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 75% of users that gain entry the fastest (75th percentile). + // 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English + // for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display + // **unavailable**. + // 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently + // full and not accepting new users at the moment. + // 9. `queueAll`: Boolean indicating if all users will be queued in the waiting + // room and no one will be let into the origin website. + // 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the + // user's last attempt to leave the waiting room and be let into the origin + // website. The user is able to make another attempt after + // `refreshIntervalSeconds` past this time. If the user makes a request too + // soon, it will be ignored and `lastUpdated` will not change. + // 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after + // `lastUpdated` until the user is able to make another attempt to leave the + // waiting room and be let into the origin website. When the `queueingMethod` + // is `reject`, there is no specified refresh time — it will always be + // **zero**. + // 12. `queueingMethod`: The queueing method currently used by the waiting room. It + // is either **fifo**, **random**, **passthrough**, or **reject**. + // 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO + // (First-In-First-Out) queue. + // 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue + // where users gain access randomly. + // 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a + // passthrough queue. Keep in mind that when passthrough is enabled, this JSON + // response will only exist when `queueAll` is **true** or `isEventPrequeueing` + // is **true** because in all other cases requests will go directly to the + // origin. + // 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. + // 17. `isEventActive`: Boolean indicating if an event is currently occurring. + // Events are able to change a waiting room's behavior during a specified + // period of time. For additional information, look at the event properties + // `prequeue_start_time`, `event_start_time`, and `event_end_time` in the + // documentation for creating waiting room events. Events are considered active + // between these start and end times, as well as during the prequeueing period + // if it exists. + // 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean + // indicating if an event is currently prequeueing users before it starts. + // 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. + // Integer indicating the number of minutes until the event starts. + // 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` + // formatted in English for users. If `isEventPrequeueing` is **false**, + // `timeUntilEventStartFormatted` will display **unavailable**. + // 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer + // indicating the number of minutes until the event ends. + // 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` + // formatted in English for users. If `isEventActive` is **false**, + // `timeUntilEventEndFormatted` will display **unavailable**. + // 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean + // indicating if the users in the prequeue are shuffled randomly when the event + // starts. + // + // An example cURL to a waiting room could be: + // + // curl -X GET "https://example.com/waitingroom" \ + // -H "Accept: application/json" + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **fifo** and no event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 0, + // "waitTime50Percentile": 0, + // "waitTime75Percentile": 0, + // "waitTimeFormatted": "10 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "fifo", + // "isFIFOQueue": true, + // "isRandomQueue": false, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": false, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 0, + // "timeUntilEventEndFormatted": "unavailable", + // "shuffleAtEventStart": false + // } + // } + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **random** and an event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 5, + // "waitTime50Percentile": 10, + // "waitTime75Percentile": 15, + // "waitTimeFormatted": "5 minutes to 15 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "random", + // "isFIFOQueue": false, + // "isRandomQueue": true, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": true, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 15, + // "timeUntilEventEndFormatted": "15 minutes", + // "shuffleAtEventStart": true + // } + // }. + JsonResponseEnabled bool `json:"json_response_enabled"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A unique name to identify the waiting room. Only alphanumeric characters, + // hyphens and underscores are allowed. + Name string `json:"name"` + // Sets the number of new users that will be let into the route every minute. This + // value is used as baseline for the number of users that are let in per minute. So + // it is possible that there is a little more or little less traffic coming to the + // route based on the traffic patterns at that time around the world. + NewUsersPerMinute int64 `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when the next event will begin queueing. + NextEventPrequeueStartTime string `json:"next_event_prequeue_start_time,nullable"` + // An ISO 8601 timestamp that marks when the next event will start. + NextEventStartTime string `json:"next_event_start_time,nullable"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path string `json:"path"` + // If queue_all is `true`, all the traffic that is coming to a route will be sent + // to the waiting room. No new traffic can get to the route once this field is set + // and estimated time will become unavailable. + QueueAll bool `json:"queue_all"` + // Sets the queueing method used by the waiting room. Changing this parameter from + // the **default** queueing method is only available for the Waiting Room Advanced + // subscription. Regardless of the queueing method, if `queue_all` is enabled or an + // event is prequeueing, users in the waiting room will not be accepted to the + // origin. These users will always see a waiting room page that refreshes + // automatically. The valid queueing methods are: + // + // 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in + // the order they arrived. + // 2. `random`: Random queue where customers gain access randomly, regardless of + // arrival time. + // 3. `passthrough`: Users will pass directly through the waiting room and into the + // origin website. As a result, any configured limits will not be respected + // while this is enabled. This method can be used as an alternative to disabling + // a waiting room (with `suspended`) so that analytics are still reported. This + // can be used if you wish to allow all traffic normally, but want to restrict + // traffic during a waiting room event, or vice versa. + // 4. `reject`: Users will be immediately rejected from the waiting room. As a + // result, no users will reach the origin website while this is enabled. This + // can be used if you wish to reject all traffic while performing maintenance, + // block traffic during a specified period of time (an event), or block traffic + // while events are not occurring. Consider a waiting room used for vaccine + // distribution that only allows traffic during sign-up events, and otherwise + // blocks all traffic. For this case, the waiting room uses `reject`, and its + // events override this with `fifo`, `random`, or `passthrough`. When this + // queueing method is enabled and neither `queueAll` is enabled nor an event is + // prequeueing, the waiting room page **will not refresh automatically**. + QueueingMethod ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethod `json:"queueing_method"` + // HTTP status code returned to a user while in the queue. + QueueingStatusCode ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode `json:"queueing_status_code"` + // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to + // the route. If a user is not seen by Cloudflare again in that time period, they + // will be treated as a new user that visits the route. + SessionDuration int64 `json:"session_duration"` + // Suspends or allows traffic going to the waiting room. If set to `true`, the + // traffic will not go to the waiting room. + Suspended bool `json:"suspended"` + // Sets the total number of active user sessions on the route at a point in time. A + // route is a combination of host and path on which a waiting room is available. + // This value is used as a baseline for the total number of active user sessions on + // the route. It is possible to have a situation where there are more or less + // active users sessions on the route based on the traffic patterns at that time + // around the world. + TotalActiveUsers int64 `json:"total_active_users"` + JSON zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultJSON contains the JSON +// metadata for the struct +// [ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResult] +type zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultJSON struct { + ID apijson.Field + AdditionalRoutes apijson.Field + CookieAttributes apijson.Field + CookieSuffix apijson.Field + CreatedOn apijson.Field + CustomPageHTML apijson.Field + DefaultTemplateLanguage apijson.Field + Description apijson.Field + DisableSessionRenewal apijson.Field + Host apijson.Field + JsonResponseEnabled apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NewUsersPerMinute apijson.Field + NextEventPrequeueStartTime apijson.Field + NextEventStartTime apijson.Field + Path apijson.Field + QueueAll apijson.Field + QueueingMethod apijson.Field + QueueingStatusCode apijson.Field + SessionDuration apijson.Field + Suspended apijson.Field + TotalActiveUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultAdditionalRoute struct { + // The hostname to which this waiting room will be applied (no wildcards). The + // hostname must be the primary domain, subdomain, or custom hostname (if using SSL + // for SaaS) of this zone. Please do not include the scheme (http:// or https://). + Host string `json:"host"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path string `json:"path"` + JSON zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultAdditionalRouteJSON `json:"-"` +} + +// zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultAdditionalRouteJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultAdditionalRoute] +type zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultAdditionalRouteJSON struct { + Host apijson.Field + Path apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultAdditionalRoute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures cookie attributes for the waiting room cookie. This encrypted cookie +// stores a user's status in the waiting room, such as queue position. +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributes struct { + // Configures the SameSite attribute on the waiting room cookie. Value `auto` will + // be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. + // Note that when using value `none`, the secure attribute cannot be set to + // `never`. + Samesite ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesite `json:"samesite"` + // Configures the Secure attribute on the waiting room cookie. Value `always` + // indicates that the Secure attribute will be set in the Set-Cookie header, + // `never` indicates that the Secure attribute will not be set, and `auto` will set + // the Secure attribute depending if **Always Use HTTPS** is enabled. + Secure ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecure `json:"secure"` + JSON zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesJSON `json:"-"` +} + +// zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributes] +type zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesJSON struct { + Samesite apijson.Field + Secure apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Configures the SameSite attribute on the waiting room cookie. Value `auto` will +// be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. +// Note that when using value `none`, the secure attribute cannot be set to +// `never`. +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesite string + +const ( + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesiteAuto ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesite = "auto" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesiteLax ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesite = "lax" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesiteNone ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesite = "none" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesiteStrict ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSamesite = "strict" +) + +// Configures the Secure attribute on the waiting room cookie. Value `always` +// indicates that the Secure attribute will be set in the Set-Cookie header, +// `never` indicates that the Secure attribute will not be set, and `auto` will set +// the Secure attribute depending if **Always Use HTTPS** is enabled. +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecure string + +const ( + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecureAuto ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecure = "auto" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecureAlways ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecure = "always" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecureNever ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultCookieAttributesSecure = "never" +) + +// The language of the default page template. If no default_template_language is +// provided, then `en-US` (English) will be used. +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage string + +const ( + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageEnUs ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "en-US" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageEsEs ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "es-ES" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageDeDe ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "de-DE" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageFrFr ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "fr-FR" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageItIt ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "it-IT" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageJaJp ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "ja-JP" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageKoKr ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "ko-KR" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguagePtBr ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "pt-BR" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageZhCn ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "zh-CN" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageZhTw ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "zh-TW" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageNlNl ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "nl-NL" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguagePlPl ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "pl-PL" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageIDID ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "id-ID" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageTrTr ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "tr-TR" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageArEg ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "ar-EG" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageRuRu ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "ru-RU" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguageFaIr ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultDefaultTemplateLanguage = "fa-IR" +) + +// Sets the queueing method used by the waiting room. Changing this parameter from +// the **default** queueing method is only available for the Waiting Room Advanced +// subscription. Regardless of the queueing method, if `queue_all` is enabled or an +// event is prequeueing, users in the waiting room will not be accepted to the +// origin. These users will always see a waiting room page that refreshes +// automatically. The valid queueing methods are: +// +// 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in +// the order they arrived. +// 2. `random`: Random queue where customers gain access randomly, regardless of +// arrival time. +// 3. `passthrough`: Users will pass directly through the waiting room and into the +// origin website. As a result, any configured limits will not be respected +// while this is enabled. This method can be used as an alternative to disabling +// a waiting room (with `suspended`) so that analytics are still reported. This +// can be used if you wish to allow all traffic normally, but want to restrict +// traffic during a waiting room event, or vice versa. +// 4. `reject`: Users will be immediately rejected from the waiting room. As a +// result, no users will reach the origin website while this is enabled. This +// can be used if you wish to reject all traffic while performing maintenance, +// block traffic during a specified period of time (an event), or block traffic +// while events are not occurring. Consider a waiting room used for vaccine +// distribution that only allows traffic during sign-up events, and otherwise +// blocks all traffic. For this case, the waiting room uses `reject`, and its +// events override this with `fifo`, `random`, or `passthrough`. When this +// queueing method is enabled and neither `queueAll` is enabled nor an event is +// prequeueing, the waiting room page **will not refresh automatically**. +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethod string + +const ( + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethodFifo ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethod = "fifo" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethodRandom ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethod = "random" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethodPassthrough ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethod = "passthrough" + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethodReject ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingMethod = "reject" +) + +// HTTP status code returned to a user while in the queue. +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode int64 + +const ( + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode200 ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode = 200 + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode202 ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode = 202 + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode429 ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultQueueingStatusCode = 429 +) + +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultInfoJSON `json:"-"` +} + +// zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultInfoJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultInfo] +type zoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseSuccess bool + +const ( + ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseSuccessTrue ZoneWaitingRoomWaitingRoomListWaitingRoomsResponseSuccess = true +) + +type ZoneWaitingRoomUpdateParams struct { + // The host name to which the waiting room will be applied (no wildcards). Please + // do not include the scheme (http:// or https://). The host and path combination + // must be unique. + Host param.Field[string] `json:"host,required"` + // A unique name to identify the waiting room. Only alphanumeric characters, + // hyphens and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // Sets the number of new users that will be let into the route every minute. This + // value is used as baseline for the number of users that are let in per minute. So + // it is possible that there is a little more or little less traffic coming to the + // route based on the traffic patterns at that time around the world. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute,required"` + // Sets the total number of active user sessions on the route at a point in time. A + // route is a combination of host and path on which a waiting room is available. + // This value is used as a baseline for the total number of active user sessions on + // the route. It is possible to have a situation where there are more or less + // active users sessions on the route based on the traffic patterns at that time + // around the world. + TotalActiveUsers param.Field[int64] `json:"total_active_users,required"` + // Only available for the Waiting Room Advanced subscription. Additional hostname + // and path combinations to which this waiting room will be applied. There is an + // implied wildcard at the end of the path. The hostname and path combination must + // be unique to this and all other waiting rooms. + AdditionalRoutes param.Field[[]ZoneWaitingRoomUpdateParamsAdditionalRoute] `json:"additional_routes"` + // Configures cookie attributes for the waiting room cookie. This encrypted cookie + // stores a user's status in the waiting room, such as queue position. + CookieAttributes param.Field[ZoneWaitingRoomUpdateParamsCookieAttributes] `json:"cookie_attributes"` + // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie + // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be + // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. + CookieSuffix param.Field[string] `json:"cookie_suffix"` + // Only available for the Waiting Room Advanced subscription. This is a template + // html file that will be rendered at the edge. If no custom_page_html is provided, + // the default waiting room will be used. The template is based on mustache ( + // https://mustache.github.io/ ). There are several variables that are evaluated by + // the Cloudflare edge: + // + // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to + // take when wait time is not available, for instance when queue_all is + // **true**. + // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five + // minutes. Alternatively, you can use: + // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. + // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user + // (`Math.floor(waitTime/60)`). + // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value + // (`waitTime%60`). + // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the + // queue. + // + // To view the full list of variables, look at the `cfWaitingRoom` object described + // under the `json_response_enabled` property in other Waiting Room API calls. + CustomPageHTML param.Field[string] `json:"custom_page_html"` + // The language of the default page template. If no default_template_language is + // provided, then `en-US` (English) will be used. + DefaultTemplateLanguage param.Field[ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage] `json:"default_template_language"` + // A note that you can use to add more details about the waiting room. + Description param.Field[string] `json:"description"` + // Only available for the Waiting Room Advanced subscription. Disables automatic + // renewal of session cookies. If `true`, an accepted user will have + // session_duration minutes to browse the site. After that, they will have to go + // through the waiting room again. If `false`, a user's session cookie will be + // automatically renewed on every request. + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + // Only available for the Waiting Room Advanced subscription. If `true`, requests + // to the waiting room with the header `Accept: application/json` will receive a + // JSON response object with information on the user's status in the waiting room + // as opposed to the configured static HTML page. This JSON response object has one + // property `cfWaitingRoom` which is an object containing the following fields: + // + // 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room + // (always **true**). + // 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are + // accurate. If **false**, they are not available. + // 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating + // the current estimated time in minutes the user will wait in the waiting room. + // When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. + // 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 25% of users that gain entry the fastest (25th percentile). + // 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 50% of users that gain entry the fastest (50th percentile). + // In other words, half of the queued users are expected to let into the origin + // website before `waitTime50Percentile` and half are expected to be let in + // after it. + // 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 75% of users that gain entry the fastest (75th percentile). + // 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English + // for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display + // **unavailable**. + // 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently + // full and not accepting new users at the moment. + // 9. `queueAll`: Boolean indicating if all users will be queued in the waiting + // room and no one will be let into the origin website. + // 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the + // user's last attempt to leave the waiting room and be let into the origin + // website. The user is able to make another attempt after + // `refreshIntervalSeconds` past this time. If the user makes a request too + // soon, it will be ignored and `lastUpdated` will not change. + // 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after + // `lastUpdated` until the user is able to make another attempt to leave the + // waiting room and be let into the origin website. When the `queueingMethod` + // is `reject`, there is no specified refresh time — it will always be + // **zero**. + // 12. `queueingMethod`: The queueing method currently used by the waiting room. It + // is either **fifo**, **random**, **passthrough**, or **reject**. + // 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO + // (First-In-First-Out) queue. + // 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue + // where users gain access randomly. + // 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a + // passthrough queue. Keep in mind that when passthrough is enabled, this JSON + // response will only exist when `queueAll` is **true** or `isEventPrequeueing` + // is **true** because in all other cases requests will go directly to the + // origin. + // 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. + // 17. `isEventActive`: Boolean indicating if an event is currently occurring. + // Events are able to change a waiting room's behavior during a specified + // period of time. For additional information, look at the event properties + // `prequeue_start_time`, `event_start_time`, and `event_end_time` in the + // documentation for creating waiting room events. Events are considered active + // between these start and end times, as well as during the prequeueing period + // if it exists. + // 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean + // indicating if an event is currently prequeueing users before it starts. + // 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. + // Integer indicating the number of minutes until the event starts. + // 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` + // formatted in English for users. If `isEventPrequeueing` is **false**, + // `timeUntilEventStartFormatted` will display **unavailable**. + // 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer + // indicating the number of minutes until the event ends. + // 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` + // formatted in English for users. If `isEventActive` is **false**, + // `timeUntilEventEndFormatted` will display **unavailable**. + // 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean + // indicating if the users in the prequeue are shuffled randomly when the event + // starts. + // + // An example cURL to a waiting room could be: + // + // curl -X GET "https://example.com/waitingroom" \ + // -H "Accept: application/json" + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **fifo** and no event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 0, + // "waitTime50Percentile": 0, + // "waitTime75Percentile": 0, + // "waitTimeFormatted": "10 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "fifo", + // "isFIFOQueue": true, + // "isRandomQueue": false, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": false, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 0, + // "timeUntilEventEndFormatted": "unavailable", + // "shuffleAtEventStart": false + // } + // } + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **random** and an event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 5, + // "waitTime50Percentile": 10, + // "waitTime75Percentile": 15, + // "waitTimeFormatted": "5 minutes to 15 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "random", + // "isFIFOQueue": false, + // "isRandomQueue": true, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": true, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 15, + // "timeUntilEventEndFormatted": "15 minutes", + // "shuffleAtEventStart": true + // } + // }. + JsonResponseEnabled param.Field[bool] `json:"json_response_enabled"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path param.Field[string] `json:"path"` + // If queue_all is `true`, all the traffic that is coming to a route will be sent + // to the waiting room. No new traffic can get to the route once this field is set + // and estimated time will become unavailable. + QueueAll param.Field[bool] `json:"queue_all"` + // Sets the queueing method used by the waiting room. Changing this parameter from + // the **default** queueing method is only available for the Waiting Room Advanced + // subscription. Regardless of the queueing method, if `queue_all` is enabled or an + // event is prequeueing, users in the waiting room will not be accepted to the + // origin. These users will always see a waiting room page that refreshes + // automatically. The valid queueing methods are: + // + // 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in + // the order they arrived. + // 2. `random`: Random queue where customers gain access randomly, regardless of + // arrival time. + // 3. `passthrough`: Users will pass directly through the waiting room and into the + // origin website. As a result, any configured limits will not be respected + // while this is enabled. This method can be used as an alternative to disabling + // a waiting room (with `suspended`) so that analytics are still reported. This + // can be used if you wish to allow all traffic normally, but want to restrict + // traffic during a waiting room event, or vice versa. + // 4. `reject`: Users will be immediately rejected from the waiting room. As a + // result, no users will reach the origin website while this is enabled. This + // can be used if you wish to reject all traffic while performing maintenance, + // block traffic during a specified period of time (an event), or block traffic + // while events are not occurring. Consider a waiting room used for vaccine + // distribution that only allows traffic during sign-up events, and otherwise + // blocks all traffic. For this case, the waiting room uses `reject`, and its + // events override this with `fifo`, `random`, or `passthrough`. When this + // queueing method is enabled and neither `queueAll` is enabled nor an event is + // prequeueing, the waiting room page **will not refresh automatically**. + QueueingMethod param.Field[ZoneWaitingRoomUpdateParamsQueueingMethod] `json:"queueing_method"` + // HTTP status code returned to a user while in the queue. + QueueingStatusCode param.Field[ZoneWaitingRoomUpdateParamsQueueingStatusCode] `json:"queueing_status_code"` + // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to + // the route. If a user is not seen by Cloudflare again in that time period, they + // will be treated as a new user that visits the route. + SessionDuration param.Field[int64] `json:"session_duration"` + // Suspends or allows traffic going to the waiting room. If set to `true`, the + // traffic will not go to the waiting room. + Suspended param.Field[bool] `json:"suspended"` +} + +func (r ZoneWaitingRoomUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWaitingRoomUpdateParamsAdditionalRoute struct { + // The hostname to which this waiting room will be applied (no wildcards). The + // hostname must be the primary domain, subdomain, or custom hostname (if using SSL + // for SaaS) of this zone. Please do not include the scheme (http:// or https://). + Host param.Field[string] `json:"host"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path param.Field[string] `json:"path"` +} + +func (r ZoneWaitingRoomUpdateParamsAdditionalRoute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures cookie attributes for the waiting room cookie. This encrypted cookie +// stores a user's status in the waiting room, such as queue position. +type ZoneWaitingRoomUpdateParamsCookieAttributes struct { + // Configures the SameSite attribute on the waiting room cookie. Value `auto` will + // be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. + // Note that when using value `none`, the secure attribute cannot be set to + // `never`. + Samesite param.Field[ZoneWaitingRoomUpdateParamsCookieAttributesSamesite] `json:"samesite"` + // Configures the Secure attribute on the waiting room cookie. Value `always` + // indicates that the Secure attribute will be set in the Set-Cookie header, + // `never` indicates that the Secure attribute will not be set, and `auto` will set + // the Secure attribute depending if **Always Use HTTPS** is enabled. + Secure param.Field[ZoneWaitingRoomUpdateParamsCookieAttributesSecure] `json:"secure"` +} + +func (r ZoneWaitingRoomUpdateParamsCookieAttributes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures the SameSite attribute on the waiting room cookie. Value `auto` will +// be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. +// Note that when using value `none`, the secure attribute cannot be set to +// `never`. +type ZoneWaitingRoomUpdateParamsCookieAttributesSamesite string + +const ( + ZoneWaitingRoomUpdateParamsCookieAttributesSamesiteAuto ZoneWaitingRoomUpdateParamsCookieAttributesSamesite = "auto" + ZoneWaitingRoomUpdateParamsCookieAttributesSamesiteLax ZoneWaitingRoomUpdateParamsCookieAttributesSamesite = "lax" + ZoneWaitingRoomUpdateParamsCookieAttributesSamesiteNone ZoneWaitingRoomUpdateParamsCookieAttributesSamesite = "none" + ZoneWaitingRoomUpdateParamsCookieAttributesSamesiteStrict ZoneWaitingRoomUpdateParamsCookieAttributesSamesite = "strict" +) + +// Configures the Secure attribute on the waiting room cookie. Value `always` +// indicates that the Secure attribute will be set in the Set-Cookie header, +// `never` indicates that the Secure attribute will not be set, and `auto` will set +// the Secure attribute depending if **Always Use HTTPS** is enabled. +type ZoneWaitingRoomUpdateParamsCookieAttributesSecure string + +const ( + ZoneWaitingRoomUpdateParamsCookieAttributesSecureAuto ZoneWaitingRoomUpdateParamsCookieAttributesSecure = "auto" + ZoneWaitingRoomUpdateParamsCookieAttributesSecureAlways ZoneWaitingRoomUpdateParamsCookieAttributesSecure = "always" + ZoneWaitingRoomUpdateParamsCookieAttributesSecureNever ZoneWaitingRoomUpdateParamsCookieAttributesSecure = "never" +) + +// The language of the default page template. If no default_template_language is +// provided, then `en-US` (English) will be used. +type ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage string + +const ( + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageEnUs ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "en-US" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageEsEs ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "es-ES" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageDeDe ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "de-DE" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageFrFr ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "fr-FR" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageItIt ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "it-IT" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageJaJp ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "ja-JP" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageKoKr ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "ko-KR" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguagePtBr ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "pt-BR" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageZhCn ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "zh-CN" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageZhTw ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "zh-TW" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageNlNl ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "nl-NL" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguagePlPl ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "pl-PL" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageIDID ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "id-ID" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageTrTr ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "tr-TR" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageArEg ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "ar-EG" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageRuRu ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "ru-RU" + ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageFaIr ZoneWaitingRoomUpdateParamsDefaultTemplateLanguage = "fa-IR" +) + +// Sets the queueing method used by the waiting room. Changing this parameter from +// the **default** queueing method is only available for the Waiting Room Advanced +// subscription. Regardless of the queueing method, if `queue_all` is enabled or an +// event is prequeueing, users in the waiting room will not be accepted to the +// origin. These users will always see a waiting room page that refreshes +// automatically. The valid queueing methods are: +// +// 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in +// the order they arrived. +// 2. `random`: Random queue where customers gain access randomly, regardless of +// arrival time. +// 3. `passthrough`: Users will pass directly through the waiting room and into the +// origin website. As a result, any configured limits will not be respected +// while this is enabled. This method can be used as an alternative to disabling +// a waiting room (with `suspended`) so that analytics are still reported. This +// can be used if you wish to allow all traffic normally, but want to restrict +// traffic during a waiting room event, or vice versa. +// 4. `reject`: Users will be immediately rejected from the waiting room. As a +// result, no users will reach the origin website while this is enabled. This +// can be used if you wish to reject all traffic while performing maintenance, +// block traffic during a specified period of time (an event), or block traffic +// while events are not occurring. Consider a waiting room used for vaccine +// distribution that only allows traffic during sign-up events, and otherwise +// blocks all traffic. For this case, the waiting room uses `reject`, and its +// events override this with `fifo`, `random`, or `passthrough`. When this +// queueing method is enabled and neither `queueAll` is enabled nor an event is +// prequeueing, the waiting room page **will not refresh automatically**. +type ZoneWaitingRoomUpdateParamsQueueingMethod string + +const ( + ZoneWaitingRoomUpdateParamsQueueingMethodFifo ZoneWaitingRoomUpdateParamsQueueingMethod = "fifo" + ZoneWaitingRoomUpdateParamsQueueingMethodRandom ZoneWaitingRoomUpdateParamsQueueingMethod = "random" + ZoneWaitingRoomUpdateParamsQueueingMethodPassthrough ZoneWaitingRoomUpdateParamsQueueingMethod = "passthrough" + ZoneWaitingRoomUpdateParamsQueueingMethodReject ZoneWaitingRoomUpdateParamsQueueingMethod = "reject" +) + +// HTTP status code returned to a user while in the queue. +type ZoneWaitingRoomUpdateParamsQueueingStatusCode int64 + +const ( + ZoneWaitingRoomUpdateParamsQueueingStatusCode200 ZoneWaitingRoomUpdateParamsQueueingStatusCode = 200 + ZoneWaitingRoomUpdateParamsQueueingStatusCode202 ZoneWaitingRoomUpdateParamsQueueingStatusCode = 202 + ZoneWaitingRoomUpdateParamsQueueingStatusCode429 ZoneWaitingRoomUpdateParamsQueueingStatusCode = 429 +) + +type ZoneWaitingRoomPatchParams struct { + // The host name to which the waiting room will be applied (no wildcards). Please + // do not include the scheme (http:// or https://). The host and path combination + // must be unique. + Host param.Field[string] `json:"host,required"` + // A unique name to identify the waiting room. Only alphanumeric characters, + // hyphens and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // Sets the number of new users that will be let into the route every minute. This + // value is used as baseline for the number of users that are let in per minute. So + // it is possible that there is a little more or little less traffic coming to the + // route based on the traffic patterns at that time around the world. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute,required"` + // Sets the total number of active user sessions on the route at a point in time. A + // route is a combination of host and path on which a waiting room is available. + // This value is used as a baseline for the total number of active user sessions on + // the route. It is possible to have a situation where there are more or less + // active users sessions on the route based on the traffic patterns at that time + // around the world. + TotalActiveUsers param.Field[int64] `json:"total_active_users,required"` + // Only available for the Waiting Room Advanced subscription. Additional hostname + // and path combinations to which this waiting room will be applied. There is an + // implied wildcard at the end of the path. The hostname and path combination must + // be unique to this and all other waiting rooms. + AdditionalRoutes param.Field[[]ZoneWaitingRoomPatchParamsAdditionalRoute] `json:"additional_routes"` + // Configures cookie attributes for the waiting room cookie. This encrypted cookie + // stores a user's status in the waiting room, such as queue position. + CookieAttributes param.Field[ZoneWaitingRoomPatchParamsCookieAttributes] `json:"cookie_attributes"` + // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie + // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be + // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. + CookieSuffix param.Field[string] `json:"cookie_suffix"` + // Only available for the Waiting Room Advanced subscription. This is a template + // html file that will be rendered at the edge. If no custom_page_html is provided, + // the default waiting room will be used. The template is based on mustache ( + // https://mustache.github.io/ ). There are several variables that are evaluated by + // the Cloudflare edge: + // + // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to + // take when wait time is not available, for instance when queue_all is + // **true**. + // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five + // minutes. Alternatively, you can use: + // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. + // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user + // (`Math.floor(waitTime/60)`). + // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value + // (`waitTime%60`). + // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the + // queue. + // + // To view the full list of variables, look at the `cfWaitingRoom` object described + // under the `json_response_enabled` property in other Waiting Room API calls. + CustomPageHTML param.Field[string] `json:"custom_page_html"` + // The language of the default page template. If no default_template_language is + // provided, then `en-US` (English) will be used. + DefaultTemplateLanguage param.Field[ZoneWaitingRoomPatchParamsDefaultTemplateLanguage] `json:"default_template_language"` + // A note that you can use to add more details about the waiting room. + Description param.Field[string] `json:"description"` + // Only available for the Waiting Room Advanced subscription. Disables automatic + // renewal of session cookies. If `true`, an accepted user will have + // session_duration minutes to browse the site. After that, they will have to go + // through the waiting room again. If `false`, a user's session cookie will be + // automatically renewed on every request. + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + // Only available for the Waiting Room Advanced subscription. If `true`, requests + // to the waiting room with the header `Accept: application/json` will receive a + // JSON response object with information on the user's status in the waiting room + // as opposed to the configured static HTML page. This JSON response object has one + // property `cfWaitingRoom` which is an object containing the following fields: + // + // 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room + // (always **true**). + // 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are + // accurate. If **false**, they are not available. + // 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating + // the current estimated time in minutes the user will wait in the waiting room. + // When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. + // 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 25% of users that gain entry the fastest (25th percentile). + // 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 50% of users that gain entry the fastest (50th percentile). + // In other words, half of the queued users are expected to let into the origin + // website before `waitTime50Percentile` and half are expected to be let in + // after it. + // 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 75% of users that gain entry the fastest (75th percentile). + // 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English + // for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display + // **unavailable**. + // 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently + // full and not accepting new users at the moment. + // 9. `queueAll`: Boolean indicating if all users will be queued in the waiting + // room and no one will be let into the origin website. + // 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the + // user's last attempt to leave the waiting room and be let into the origin + // website. The user is able to make another attempt after + // `refreshIntervalSeconds` past this time. If the user makes a request too + // soon, it will be ignored and `lastUpdated` will not change. + // 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after + // `lastUpdated` until the user is able to make another attempt to leave the + // waiting room and be let into the origin website. When the `queueingMethod` + // is `reject`, there is no specified refresh time — it will always be + // **zero**. + // 12. `queueingMethod`: The queueing method currently used by the waiting room. It + // is either **fifo**, **random**, **passthrough**, or **reject**. + // 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO + // (First-In-First-Out) queue. + // 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue + // where users gain access randomly. + // 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a + // passthrough queue. Keep in mind that when passthrough is enabled, this JSON + // response will only exist when `queueAll` is **true** or `isEventPrequeueing` + // is **true** because in all other cases requests will go directly to the + // origin. + // 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. + // 17. `isEventActive`: Boolean indicating if an event is currently occurring. + // Events are able to change a waiting room's behavior during a specified + // period of time. For additional information, look at the event properties + // `prequeue_start_time`, `event_start_time`, and `event_end_time` in the + // documentation for creating waiting room events. Events are considered active + // between these start and end times, as well as during the prequeueing period + // if it exists. + // 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean + // indicating if an event is currently prequeueing users before it starts. + // 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. + // Integer indicating the number of minutes until the event starts. + // 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` + // formatted in English for users. If `isEventPrequeueing` is **false**, + // `timeUntilEventStartFormatted` will display **unavailable**. + // 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer + // indicating the number of minutes until the event ends. + // 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` + // formatted in English for users. If `isEventActive` is **false**, + // `timeUntilEventEndFormatted` will display **unavailable**. + // 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean + // indicating if the users in the prequeue are shuffled randomly when the event + // starts. + // + // An example cURL to a waiting room could be: + // + // curl -X GET "https://example.com/waitingroom" \ + // -H "Accept: application/json" + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **fifo** and no event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 0, + // "waitTime50Percentile": 0, + // "waitTime75Percentile": 0, + // "waitTimeFormatted": "10 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "fifo", + // "isFIFOQueue": true, + // "isRandomQueue": false, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": false, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 0, + // "timeUntilEventEndFormatted": "unavailable", + // "shuffleAtEventStart": false + // } + // } + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **random** and an event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 5, + // "waitTime50Percentile": 10, + // "waitTime75Percentile": 15, + // "waitTimeFormatted": "5 minutes to 15 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "random", + // "isFIFOQueue": false, + // "isRandomQueue": true, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": true, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 15, + // "timeUntilEventEndFormatted": "15 minutes", + // "shuffleAtEventStart": true + // } + // }. + JsonResponseEnabled param.Field[bool] `json:"json_response_enabled"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path param.Field[string] `json:"path"` + // If queue_all is `true`, all the traffic that is coming to a route will be sent + // to the waiting room. No new traffic can get to the route once this field is set + // and estimated time will become unavailable. + QueueAll param.Field[bool] `json:"queue_all"` + // Sets the queueing method used by the waiting room. Changing this parameter from + // the **default** queueing method is only available for the Waiting Room Advanced + // subscription. Regardless of the queueing method, if `queue_all` is enabled or an + // event is prequeueing, users in the waiting room will not be accepted to the + // origin. These users will always see a waiting room page that refreshes + // automatically. The valid queueing methods are: + // + // 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in + // the order they arrived. + // 2. `random`: Random queue where customers gain access randomly, regardless of + // arrival time. + // 3. `passthrough`: Users will pass directly through the waiting room and into the + // origin website. As a result, any configured limits will not be respected + // while this is enabled. This method can be used as an alternative to disabling + // a waiting room (with `suspended`) so that analytics are still reported. This + // can be used if you wish to allow all traffic normally, but want to restrict + // traffic during a waiting room event, or vice versa. + // 4. `reject`: Users will be immediately rejected from the waiting room. As a + // result, no users will reach the origin website while this is enabled. This + // can be used if you wish to reject all traffic while performing maintenance, + // block traffic during a specified period of time (an event), or block traffic + // while events are not occurring. Consider a waiting room used for vaccine + // distribution that only allows traffic during sign-up events, and otherwise + // blocks all traffic. For this case, the waiting room uses `reject`, and its + // events override this with `fifo`, `random`, or `passthrough`. When this + // queueing method is enabled and neither `queueAll` is enabled nor an event is + // prequeueing, the waiting room page **will not refresh automatically**. + QueueingMethod param.Field[ZoneWaitingRoomPatchParamsQueueingMethod] `json:"queueing_method"` + // HTTP status code returned to a user while in the queue. + QueueingStatusCode param.Field[ZoneWaitingRoomPatchParamsQueueingStatusCode] `json:"queueing_status_code"` + // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to + // the route. If a user is not seen by Cloudflare again in that time period, they + // will be treated as a new user that visits the route. + SessionDuration param.Field[int64] `json:"session_duration"` + // Suspends or allows traffic going to the waiting room. If set to `true`, the + // traffic will not go to the waiting room. + Suspended param.Field[bool] `json:"suspended"` +} + +func (r ZoneWaitingRoomPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWaitingRoomPatchParamsAdditionalRoute struct { + // The hostname to which this waiting room will be applied (no wildcards). The + // hostname must be the primary domain, subdomain, or custom hostname (if using SSL + // for SaaS) of this zone. Please do not include the scheme (http:// or https://). + Host param.Field[string] `json:"host"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path param.Field[string] `json:"path"` +} + +func (r ZoneWaitingRoomPatchParamsAdditionalRoute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures cookie attributes for the waiting room cookie. This encrypted cookie +// stores a user's status in the waiting room, such as queue position. +type ZoneWaitingRoomPatchParamsCookieAttributes struct { + // Configures the SameSite attribute on the waiting room cookie. Value `auto` will + // be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. + // Note that when using value `none`, the secure attribute cannot be set to + // `never`. + Samesite param.Field[ZoneWaitingRoomPatchParamsCookieAttributesSamesite] `json:"samesite"` + // Configures the Secure attribute on the waiting room cookie. Value `always` + // indicates that the Secure attribute will be set in the Set-Cookie header, + // `never` indicates that the Secure attribute will not be set, and `auto` will set + // the Secure attribute depending if **Always Use HTTPS** is enabled. + Secure param.Field[ZoneWaitingRoomPatchParamsCookieAttributesSecure] `json:"secure"` +} + +func (r ZoneWaitingRoomPatchParamsCookieAttributes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures the SameSite attribute on the waiting room cookie. Value `auto` will +// be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. +// Note that when using value `none`, the secure attribute cannot be set to +// `never`. +type ZoneWaitingRoomPatchParamsCookieAttributesSamesite string + +const ( + ZoneWaitingRoomPatchParamsCookieAttributesSamesiteAuto ZoneWaitingRoomPatchParamsCookieAttributesSamesite = "auto" + ZoneWaitingRoomPatchParamsCookieAttributesSamesiteLax ZoneWaitingRoomPatchParamsCookieAttributesSamesite = "lax" + ZoneWaitingRoomPatchParamsCookieAttributesSamesiteNone ZoneWaitingRoomPatchParamsCookieAttributesSamesite = "none" + ZoneWaitingRoomPatchParamsCookieAttributesSamesiteStrict ZoneWaitingRoomPatchParamsCookieAttributesSamesite = "strict" +) + +// Configures the Secure attribute on the waiting room cookie. Value `always` +// indicates that the Secure attribute will be set in the Set-Cookie header, +// `never` indicates that the Secure attribute will not be set, and `auto` will set +// the Secure attribute depending if **Always Use HTTPS** is enabled. +type ZoneWaitingRoomPatchParamsCookieAttributesSecure string + +const ( + ZoneWaitingRoomPatchParamsCookieAttributesSecureAuto ZoneWaitingRoomPatchParamsCookieAttributesSecure = "auto" + ZoneWaitingRoomPatchParamsCookieAttributesSecureAlways ZoneWaitingRoomPatchParamsCookieAttributesSecure = "always" + ZoneWaitingRoomPatchParamsCookieAttributesSecureNever ZoneWaitingRoomPatchParamsCookieAttributesSecure = "never" +) + +// The language of the default page template. If no default_template_language is +// provided, then `en-US` (English) will be used. +type ZoneWaitingRoomPatchParamsDefaultTemplateLanguage string + +const ( + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageEnUs ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "en-US" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageEsEs ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "es-ES" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageDeDe ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "de-DE" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageFrFr ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "fr-FR" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageItIt ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "it-IT" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageJaJp ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "ja-JP" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageKoKr ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "ko-KR" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguagePtBr ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "pt-BR" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageZhCn ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "zh-CN" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageZhTw ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "zh-TW" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageNlNl ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "nl-NL" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguagePlPl ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "pl-PL" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageIDID ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "id-ID" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageTrTr ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "tr-TR" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageArEg ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "ar-EG" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageRuRu ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "ru-RU" + ZoneWaitingRoomPatchParamsDefaultTemplateLanguageFaIr ZoneWaitingRoomPatchParamsDefaultTemplateLanguage = "fa-IR" +) + +// Sets the queueing method used by the waiting room. Changing this parameter from +// the **default** queueing method is only available for the Waiting Room Advanced +// subscription. Regardless of the queueing method, if `queue_all` is enabled or an +// event is prequeueing, users in the waiting room will not be accepted to the +// origin. These users will always see a waiting room page that refreshes +// automatically. The valid queueing methods are: +// +// 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in +// the order they arrived. +// 2. `random`: Random queue where customers gain access randomly, regardless of +// arrival time. +// 3. `passthrough`: Users will pass directly through the waiting room and into the +// origin website. As a result, any configured limits will not be respected +// while this is enabled. This method can be used as an alternative to disabling +// a waiting room (with `suspended`) so that analytics are still reported. This +// can be used if you wish to allow all traffic normally, but want to restrict +// traffic during a waiting room event, or vice versa. +// 4. `reject`: Users will be immediately rejected from the waiting room. As a +// result, no users will reach the origin website while this is enabled. This +// can be used if you wish to reject all traffic while performing maintenance, +// block traffic during a specified period of time (an event), or block traffic +// while events are not occurring. Consider a waiting room used for vaccine +// distribution that only allows traffic during sign-up events, and otherwise +// blocks all traffic. For this case, the waiting room uses `reject`, and its +// events override this with `fifo`, `random`, or `passthrough`. When this +// queueing method is enabled and neither `queueAll` is enabled nor an event is +// prequeueing, the waiting room page **will not refresh automatically**. +type ZoneWaitingRoomPatchParamsQueueingMethod string + +const ( + ZoneWaitingRoomPatchParamsQueueingMethodFifo ZoneWaitingRoomPatchParamsQueueingMethod = "fifo" + ZoneWaitingRoomPatchParamsQueueingMethodRandom ZoneWaitingRoomPatchParamsQueueingMethod = "random" + ZoneWaitingRoomPatchParamsQueueingMethodPassthrough ZoneWaitingRoomPatchParamsQueueingMethod = "passthrough" + ZoneWaitingRoomPatchParamsQueueingMethodReject ZoneWaitingRoomPatchParamsQueueingMethod = "reject" +) + +// HTTP status code returned to a user while in the queue. +type ZoneWaitingRoomPatchParamsQueueingStatusCode int64 + +const ( + ZoneWaitingRoomPatchParamsQueueingStatusCode200 ZoneWaitingRoomPatchParamsQueueingStatusCode = 200 + ZoneWaitingRoomPatchParamsQueueingStatusCode202 ZoneWaitingRoomPatchParamsQueueingStatusCode = 202 + ZoneWaitingRoomPatchParamsQueueingStatusCode429 ZoneWaitingRoomPatchParamsQueueingStatusCode = 429 +) + +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParams struct { + // The host name to which the waiting room will be applied (no wildcards). Please + // do not include the scheme (http:// or https://). The host and path combination + // must be unique. + Host param.Field[string] `json:"host,required"` + // A unique name to identify the waiting room. Only alphanumeric characters, + // hyphens and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // Sets the number of new users that will be let into the route every minute. This + // value is used as baseline for the number of users that are let in per minute. So + // it is possible that there is a little more or little less traffic coming to the + // route based on the traffic patterns at that time around the world. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute,required"` + // Sets the total number of active user sessions on the route at a point in time. A + // route is a combination of host and path on which a waiting room is available. + // This value is used as a baseline for the total number of active user sessions on + // the route. It is possible to have a situation where there are more or less + // active users sessions on the route based on the traffic patterns at that time + // around the world. + TotalActiveUsers param.Field[int64] `json:"total_active_users,required"` + // Only available for the Waiting Room Advanced subscription. Additional hostname + // and path combinations to which this waiting room will be applied. There is an + // implied wildcard at the end of the path. The hostname and path combination must + // be unique to this and all other waiting rooms. + AdditionalRoutes param.Field[[]ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsAdditionalRoute] `json:"additional_routes"` + // Configures cookie attributes for the waiting room cookie. This encrypted cookie + // stores a user's status in the waiting room, such as queue position. + CookieAttributes param.Field[ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributes] `json:"cookie_attributes"` + // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie + // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be + // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. + CookieSuffix param.Field[string] `json:"cookie_suffix"` + // Only available for the Waiting Room Advanced subscription. This is a template + // html file that will be rendered at the edge. If no custom_page_html is provided, + // the default waiting room will be used. The template is based on mustache ( + // https://mustache.github.io/ ). There are several variables that are evaluated by + // the Cloudflare edge: + // + // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to + // take when wait time is not available, for instance when queue_all is + // **true**. + // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five + // minutes. Alternatively, you can use: + // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. + // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user + // (`Math.floor(waitTime/60)`). + // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value + // (`waitTime%60`). + // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the + // queue. + // + // To view the full list of variables, look at the `cfWaitingRoom` object described + // under the `json_response_enabled` property in other Waiting Room API calls. + CustomPageHTML param.Field[string] `json:"custom_page_html"` + // The language of the default page template. If no default_template_language is + // provided, then `en-US` (English) will be used. + DefaultTemplateLanguage param.Field[ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage] `json:"default_template_language"` + // A note that you can use to add more details about the waiting room. + Description param.Field[string] `json:"description"` + // Only available for the Waiting Room Advanced subscription. Disables automatic + // renewal of session cookies. If `true`, an accepted user will have + // session_duration minutes to browse the site. After that, they will have to go + // through the waiting room again. If `false`, a user's session cookie will be + // automatically renewed on every request. + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + // Only available for the Waiting Room Advanced subscription. If `true`, requests + // to the waiting room with the header `Accept: application/json` will receive a + // JSON response object with information on the user's status in the waiting room + // as opposed to the configured static HTML page. This JSON response object has one + // property `cfWaitingRoom` which is an object containing the following fields: + // + // 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room + // (always **true**). + // 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are + // accurate. If **false**, they are not available. + // 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating + // the current estimated time in minutes the user will wait in the waiting room. + // When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. + // 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 25% of users that gain entry the fastest (25th percentile). + // 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 50% of users that gain entry the fastest (50th percentile). + // In other words, half of the queued users are expected to let into the origin + // website before `waitTime50Percentile` and half are expected to be let in + // after it. + // 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and + // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum + // wait time for the 75% of users that gain entry the fastest (75th percentile). + // 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English + // for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display + // **unavailable**. + // 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently + // full and not accepting new users at the moment. + // 9. `queueAll`: Boolean indicating if all users will be queued in the waiting + // room and no one will be let into the origin website. + // 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the + // user's last attempt to leave the waiting room and be let into the origin + // website. The user is able to make another attempt after + // `refreshIntervalSeconds` past this time. If the user makes a request too + // soon, it will be ignored and `lastUpdated` will not change. + // 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after + // `lastUpdated` until the user is able to make another attempt to leave the + // waiting room and be let into the origin website. When the `queueingMethod` + // is `reject`, there is no specified refresh time — it will always be + // **zero**. + // 12. `queueingMethod`: The queueing method currently used by the waiting room. It + // is either **fifo**, **random**, **passthrough**, or **reject**. + // 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO + // (First-In-First-Out) queue. + // 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue + // where users gain access randomly. + // 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a + // passthrough queue. Keep in mind that when passthrough is enabled, this JSON + // response will only exist when `queueAll` is **true** or `isEventPrequeueing` + // is **true** because in all other cases requests will go directly to the + // origin. + // 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. + // 17. `isEventActive`: Boolean indicating if an event is currently occurring. + // Events are able to change a waiting room's behavior during a specified + // period of time. For additional information, look at the event properties + // `prequeue_start_time`, `event_start_time`, and `event_end_time` in the + // documentation for creating waiting room events. Events are considered active + // between these start and end times, as well as during the prequeueing period + // if it exists. + // 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean + // indicating if an event is currently prequeueing users before it starts. + // 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. + // Integer indicating the number of minutes until the event starts. + // 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` + // formatted in English for users. If `isEventPrequeueing` is **false**, + // `timeUntilEventStartFormatted` will display **unavailable**. + // 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer + // indicating the number of minutes until the event ends. + // 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` + // formatted in English for users. If `isEventActive` is **false**, + // `timeUntilEventEndFormatted` will display **unavailable**. + // 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean + // indicating if the users in the prequeue are shuffled randomly when the event + // starts. + // + // An example cURL to a waiting room could be: + // + // curl -X GET "https://example.com/waitingroom" \ + // -H "Accept: application/json" + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **fifo** and no event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 0, + // "waitTime50Percentile": 0, + // "waitTime75Percentile": 0, + // "waitTimeFormatted": "10 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "fifo", + // "isFIFOQueue": true, + // "isRandomQueue": false, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": false, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 0, + // "timeUntilEventEndFormatted": "unavailable", + // "shuffleAtEventStart": false + // } + // } + // + // If `json_response_enabled` is **true** and the request hits the waiting room, an + // example JSON response when `queueingMethod` is **random** and an event is active + // could be: + // + // { + // "cfWaitingRoom": { + // "inWaitingRoom": true, + // "waitTimeKnown": true, + // "waitTime": 10, + // "waitTime25Percentile": 5, + // "waitTime50Percentile": 10, + // "waitTime75Percentile": 15, + // "waitTimeFormatted": "5 minutes to 15 minutes", + // "queueIsFull": false, + // "queueAll": false, + // "lastUpdated": "2020-08-03T23:46:00.000Z", + // "refreshIntervalSeconds": 20, + // "queueingMethod": "random", + // "isFIFOQueue": false, + // "isRandomQueue": true, + // "isPassthroughQueue": false, + // "isRejectQueue": false, + // "isEventActive": true, + // "isEventPrequeueing": false, + // "timeUntilEventStart": 0, + // "timeUntilEventStartFormatted": "unavailable", + // "timeUntilEventEnd": 15, + // "timeUntilEventEndFormatted": "15 minutes", + // "shuffleAtEventStart": true + // } + // }. + JsonResponseEnabled param.Field[bool] `json:"json_response_enabled"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path param.Field[string] `json:"path"` + // If queue_all is `true`, all the traffic that is coming to a route will be sent + // to the waiting room. No new traffic can get to the route once this field is set + // and estimated time will become unavailable. + QueueAll param.Field[bool] `json:"queue_all"` + // Sets the queueing method used by the waiting room. Changing this parameter from + // the **default** queueing method is only available for the Waiting Room Advanced + // subscription. Regardless of the queueing method, if `queue_all` is enabled or an + // event is prequeueing, users in the waiting room will not be accepted to the + // origin. These users will always see a waiting room page that refreshes + // automatically. The valid queueing methods are: + // + // 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in + // the order they arrived. + // 2. `random`: Random queue where customers gain access randomly, regardless of + // arrival time. + // 3. `passthrough`: Users will pass directly through the waiting room and into the + // origin website. As a result, any configured limits will not be respected + // while this is enabled. This method can be used as an alternative to disabling + // a waiting room (with `suspended`) so that analytics are still reported. This + // can be used if you wish to allow all traffic normally, but want to restrict + // traffic during a waiting room event, or vice versa. + // 4. `reject`: Users will be immediately rejected from the waiting room. As a + // result, no users will reach the origin website while this is enabled. This + // can be used if you wish to reject all traffic while performing maintenance, + // block traffic during a specified period of time (an event), or block traffic + // while events are not occurring. Consider a waiting room used for vaccine + // distribution that only allows traffic during sign-up events, and otherwise + // blocks all traffic. For this case, the waiting room uses `reject`, and its + // events override this with `fifo`, `random`, or `passthrough`. When this + // queueing method is enabled and neither `queueAll` is enabled nor an event is + // prequeueing, the waiting room page **will not refresh automatically**. + QueueingMethod param.Field[ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethod] `json:"queueing_method"` + // HTTP status code returned to a user while in the queue. + QueueingStatusCode param.Field[ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode] `json:"queueing_status_code"` + // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to + // the route. If a user is not seen by Cloudflare again in that time period, they + // will be treated as a new user that visits the route. + SessionDuration param.Field[int64] `json:"session_duration"` + // Suspends or allows traffic going to the waiting room. If set to `true`, the + // traffic will not go to the waiting room. + Suspended param.Field[bool] `json:"suspended"` +} + +func (r ZoneWaitingRoomWaitingRoomNewWaitingRoomParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsAdditionalRoute struct { + // The hostname to which this waiting room will be applied (no wildcards). The + // hostname must be the primary domain, subdomain, or custom hostname (if using SSL + // for SaaS) of this zone. Please do not include the scheme (http:// or https://). + Host param.Field[string] `json:"host"` + // Sets the path within the host to enable the waiting room on. The waiting room + // will be enabled for all subpaths as well. If there are two waiting rooms on the + // same subpath, the waiting room for the most specific path will be chosen. + // Wildcards and query parameters are not supported. + Path param.Field[string] `json:"path"` +} + +func (r ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsAdditionalRoute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures cookie attributes for the waiting room cookie. This encrypted cookie +// stores a user's status in the waiting room, such as queue position. +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributes struct { + // Configures the SameSite attribute on the waiting room cookie. Value `auto` will + // be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. + // Note that when using value `none`, the secure attribute cannot be set to + // `never`. + Samesite param.Field[ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesite] `json:"samesite"` + // Configures the Secure attribute on the waiting room cookie. Value `always` + // indicates that the Secure attribute will be set in the Set-Cookie header, + // `never` indicates that the Secure attribute will not be set, and `auto` will set + // the Secure attribute depending if **Always Use HTTPS** is enabled. + Secure param.Field[ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecure] `json:"secure"` +} + +func (r ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Configures the SameSite attribute on the waiting room cookie. Value `auto` will +// be translated to `lax` or `none` depending if **Always Use HTTPS** is enabled. +// Note that when using value `none`, the secure attribute cannot be set to +// `never`. +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesite string + +const ( + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesiteAuto ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesite = "auto" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesiteLax ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesite = "lax" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesiteNone ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesite = "none" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesiteStrict ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesite = "strict" +) + +// Configures the Secure attribute on the waiting room cookie. Value `always` +// indicates that the Secure attribute will be set in the Set-Cookie header, +// `never` indicates that the Secure attribute will not be set, and `auto` will set +// the Secure attribute depending if **Always Use HTTPS** is enabled. +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecure string + +const ( + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecureAuto ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecure = "auto" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecureAlways ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecure = "always" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecureNever ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecure = "never" +) + +// The language of the default page template. If no default_template_language is +// provided, then `en-US` (English) will be used. +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage string + +const ( + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageEnUs ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "en-US" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageEsEs ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "es-ES" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageDeDe ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "de-DE" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageFrFr ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "fr-FR" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageItIt ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "it-IT" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageJaJp ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "ja-JP" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageKoKr ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "ko-KR" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguagePtBr ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "pt-BR" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageZhCn ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "zh-CN" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageZhTw ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "zh-TW" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageNlNl ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "nl-NL" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguagePlPl ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "pl-PL" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageIDID ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "id-ID" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageTrTr ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "tr-TR" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageArEg ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "ar-EG" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageRuRu ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "ru-RU" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageFaIr ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguage = "fa-IR" +) + +// Sets the queueing method used by the waiting room. Changing this parameter from +// the **default** queueing method is only available for the Waiting Room Advanced +// subscription. Regardless of the queueing method, if `queue_all` is enabled or an +// event is prequeueing, users in the waiting room will not be accepted to the +// origin. These users will always see a waiting room page that refreshes +// automatically. The valid queueing methods are: +// +// 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in +// the order they arrived. +// 2. `random`: Random queue where customers gain access randomly, regardless of +// arrival time. +// 3. `passthrough`: Users will pass directly through the waiting room and into the +// origin website. As a result, any configured limits will not be respected +// while this is enabled. This method can be used as an alternative to disabling +// a waiting room (with `suspended`) so that analytics are still reported. This +// can be used if you wish to allow all traffic normally, but want to restrict +// traffic during a waiting room event, or vice versa. +// 4. `reject`: Users will be immediately rejected from the waiting room. As a +// result, no users will reach the origin website while this is enabled. This +// can be used if you wish to reject all traffic while performing maintenance, +// block traffic during a specified period of time (an event), or block traffic +// while events are not occurring. Consider a waiting room used for vaccine +// distribution that only allows traffic during sign-up events, and otherwise +// blocks all traffic. For this case, the waiting room uses `reject`, and its +// events override this with `fifo`, `random`, or `passthrough`. When this +// queueing method is enabled and neither `queueAll` is enabled nor an event is +// prequeueing, the waiting room page **will not refresh automatically**. +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethod string + +const ( + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethodFifo ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethod = "fifo" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethodRandom ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethod = "random" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethodPassthrough ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethod = "passthrough" + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethodReject ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethod = "reject" +) + +// HTTP status code returned to a user while in the queue. +type ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode int64 + +const ( + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode200 ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode = 200 + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode202 ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode = 202 + ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode429 ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode = 429 +) diff --git a/zonewaitingroom_test.go b/zonewaitingroom_test.go new file mode 100644 index 00000000000..e5e75aa7540 --- /dev/null +++ b/zonewaitingroom_test.go @@ -0,0 +1,285 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWaitingRoomGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + ) + 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 TestZoneWaitingRoomUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneWaitingRoomUpdateParams{ + Host: cloudflare.F("shop.example.com"), + Name: cloudflare.F("production_webinar"), + NewUsersPerMinute: cloudflare.F(int64(200)), + TotalActiveUsers: cloudflare.F(int64(200)), + AdditionalRoutes: cloudflare.F([]cloudflare.ZoneWaitingRoomUpdateParamsAdditionalRoute{{ + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }}), + CookieAttributes: cloudflare.F(cloudflare.ZoneWaitingRoomUpdateParamsCookieAttributes{ + Samesite: cloudflare.F(cloudflare.ZoneWaitingRoomUpdateParamsCookieAttributesSamesiteAuto), + Secure: cloudflare.F(cloudflare.ZoneWaitingRoomUpdateParamsCookieAttributesSecureAuto), + }), + CookieSuffix: cloudflare.F("abcd"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), + DefaultTemplateLanguage: cloudflare.F(cloudflare.ZoneWaitingRoomUpdateParamsDefaultTemplateLanguageEsEs), + Description: cloudflare.F("Production - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(false), + JsonResponseEnabled: cloudflare.F(false), + Path: cloudflare.F("/shop/checkout"), + QueueAll: cloudflare.F(true), + QueueingMethod: cloudflare.F(cloudflare.ZoneWaitingRoomUpdateParamsQueueingMethodFifo), + QueueingStatusCode: cloudflare.F(cloudflare.ZoneWaitingRoomUpdateParamsQueueingStatusCode202), + SessionDuration: cloudflare.F(int64(1)), + Suspended: cloudflare.F(true), + }, + ) + 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 TestZoneWaitingRoomDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + ) + 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 TestZoneWaitingRoomPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Patch( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneWaitingRoomPatchParams{ + Host: cloudflare.F("shop.example.com"), + Name: cloudflare.F("production_webinar"), + NewUsersPerMinute: cloudflare.F(int64(200)), + TotalActiveUsers: cloudflare.F(int64(200)), + AdditionalRoutes: cloudflare.F([]cloudflare.ZoneWaitingRoomPatchParamsAdditionalRoute{{ + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }}), + CookieAttributes: cloudflare.F(cloudflare.ZoneWaitingRoomPatchParamsCookieAttributes{ + Samesite: cloudflare.F(cloudflare.ZoneWaitingRoomPatchParamsCookieAttributesSamesiteAuto), + Secure: cloudflare.F(cloudflare.ZoneWaitingRoomPatchParamsCookieAttributesSecureAuto), + }), + CookieSuffix: cloudflare.F("abcd"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), + DefaultTemplateLanguage: cloudflare.F(cloudflare.ZoneWaitingRoomPatchParamsDefaultTemplateLanguageEsEs), + Description: cloudflare.F("Production - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(false), + JsonResponseEnabled: cloudflare.F(false), + Path: cloudflare.F("/shop/checkout"), + QueueAll: cloudflare.F(true), + QueueingMethod: cloudflare.F(cloudflare.ZoneWaitingRoomPatchParamsQueueingMethodFifo), + QueueingStatusCode: cloudflare.F(cloudflare.ZoneWaitingRoomPatchParamsQueueingStatusCode202), + SessionDuration: cloudflare.F(int64(1)), + Suspended: cloudflare.F(true), + }, + ) + 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 TestZoneWaitingRoomWaitingRoomNewWaitingRoomWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.WaitingRoomNewWaitingRoom( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParams{ + Host: cloudflare.F("shop.example.com"), + Name: cloudflare.F("production_webinar"), + NewUsersPerMinute: cloudflare.F(int64(200)), + TotalActiveUsers: cloudflare.F(int64(200)), + AdditionalRoutes: cloudflare.F([]cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsAdditionalRoute{{ + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }}), + CookieAttributes: cloudflare.F(cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributes{ + Samesite: cloudflare.F(cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSamesiteAuto), + Secure: cloudflare.F(cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsCookieAttributesSecureAuto), + }), + CookieSuffix: cloudflare.F("abcd"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), + DefaultTemplateLanguage: cloudflare.F(cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsDefaultTemplateLanguageEsEs), + Description: cloudflare.F("Production - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(false), + JsonResponseEnabled: cloudflare.F(false), + Path: cloudflare.F("/shop/checkout"), + QueueAll: cloudflare.F(true), + QueueingMethod: cloudflare.F(cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingMethodFifo), + QueueingStatusCode: cloudflare.F(cloudflare.ZoneWaitingRoomWaitingRoomNewWaitingRoomParamsQueueingStatusCode202), + SessionDuration: cloudflare.F(int64(1)), + Suspended: cloudflare.F(true), + }, + ) + 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 TestZoneWaitingRoomWaitingRoomListWaitingRooms(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.WaitingRoomListWaitingRooms(context.TODO(), "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/zonewaitingroomevent.go b/zonewaitingroomevent.go new file mode 100644 index 00000000000..f1d8381901d --- /dev/null +++ b/zonewaitingroomevent.go @@ -0,0 +1,553 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWaitingRoomEventService 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 [NewZoneWaitingRoomEventService] +// method instead. +type ZoneWaitingRoomEventService struct { + Options []option.RequestOption + Details *ZoneWaitingRoomEventDetailService +} + +// NewZoneWaitingRoomEventService 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 NewZoneWaitingRoomEventService(opts ...option.RequestOption) (r *ZoneWaitingRoomEventService) { + r = &ZoneWaitingRoomEventService{} + r.Options = opts + r.Details = NewZoneWaitingRoomEventDetailService(opts...) + return +} + +// Fetches a single configured event for a waiting room. +func (r *ZoneWaitingRoomEventService) Get(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}, opts ...option.RequestOption) (res *EventResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/events/%v", zoneIdentifier, waitingRoomID, eventID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates a configured event for a waiting room. +func (r *ZoneWaitingRoomEventService) Update(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}, body ZoneWaitingRoomEventUpdateParams, opts ...option.RequestOption) (res *EventResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/events/%v", zoneIdentifier, waitingRoomID, eventID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes an event for a waiting room. +func (r *ZoneWaitingRoomEventService) Delete(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}, opts ...option.RequestOption) (res *ZoneWaitingRoomEventDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/events/%v", zoneIdentifier, waitingRoomID, eventID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Patches a configured event for a waiting room. +func (r *ZoneWaitingRoomEventService) Patch(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}, body ZoneWaitingRoomEventPatchParams, opts ...option.RequestOption) (res *EventResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/events/%v", zoneIdentifier, waitingRoomID, eventID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Only available for the Waiting Room Advanced subscription. Creates an event for +// a waiting room. An event takes place during a specified period of time, +// temporarily changing the behavior of a waiting room. While the event is active, +// some of the properties in the event's configuration may either override or +// inherit from the waiting room's configuration. Note that events cannot overlap +// with each other, so only one event can be active at a time. +func (r *ZoneWaitingRoomEventService) WaitingRoomNewEvent(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body ZoneWaitingRoomEventWaitingRoomNewEventParams, opts ...option.RequestOption) (res *EventResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/events", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists events for a waiting room. +func (r *ZoneWaitingRoomEventService) WaitingRoomListEvents(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, opts ...option.RequestOption) (res *ZoneWaitingRoomEventWaitingRoomListEventsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/events", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type EventResponse struct { + Result EventResponseResult `json:"result"` + JSON eventResponseJSON `json:"-"` +} + +// eventResponseJSON contains the JSON metadata for the struct [EventResponse] +type eventResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type EventResponseResult struct { + ID interface{} `json:"id"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // If set, the event will override the waiting room's `custom_page_html` property + // while it is active. If null, the event will inherit it. + CustomPageHTML string `json:"custom_page_html,nullable"` + // A note that you can use to add more details about the event. + Description string `json:"description"` + // If set, the event will override the waiting room's `disable_session_renewal` + // property while it is active. If null, the event will inherit it. + DisableSessionRenewal bool `json:"disable_session_renewal,nullable"` + // An ISO 8601 timestamp that marks the end of the event. + EventEndTime string `json:"event_end_time"` + // An ISO 8601 timestamp that marks the start of the event. At this time, queued + // users will be processed with the event's configuration. The start time must be + // at least one minute before `event_end_time`. + EventStartTime string `json:"event_start_time"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A unique name to identify the event. Only alphanumeric characters, hyphens and + // underscores are allowed. + Name string `json:"name"` + // If set, the event will override the waiting room's `new_users_per_minute` + // property while it is active. If null, the event will inherit it. This can only + // be set if the event's `total_active_users` property is also set. + NewUsersPerMinute int64 `json:"new_users_per_minute,nullable"` + // An ISO 8601 timestamp that marks when to begin queueing all users before the + // event starts. The prequeue must start at least five minutes before + // `event_start_time`. + PrequeueStartTime string `json:"prequeue_start_time,nullable"` + // If set, the event will override the waiting room's `queueing_method` property + // while it is active. If null, the event will inherit it. + QueueingMethod string `json:"queueing_method,nullable"` + // If set, the event will override the waiting room's `session_duration` property + // while it is active. If null, the event will inherit it. + SessionDuration int64 `json:"session_duration,nullable"` + // If enabled, users in the prequeue will be shuffled randomly at the + // `event_start_time`. Requires that `prequeue_start_time` is not null. This is + // useful for situations when many users will join the event prequeue at the same + // time and you want to shuffle them to ensure fairness. Naturally, it makes the + // most sense to enable this feature when the `queueing_method` during the event + // respects ordering such as **fifo**, or else the shuffling may be unnecessary. + ShuffleAtEventStart bool `json:"shuffle_at_event_start"` + // Suspends or allows an event. If set to `true`, the event is ignored and traffic + // will be handled based on the waiting room configuration. + Suspended bool `json:"suspended"` + // If set, the event will override the waiting room's `total_active_users` property + // while it is active. If null, the event will inherit it. This can only be set if + // the event's `new_users_per_minute` property is also set. + TotalActiveUsers int64 `json:"total_active_users,nullable"` + JSON eventResponseResultJSON `json:"-"` +} + +// eventResponseResultJSON contains the JSON metadata for the struct +// [EventResponseResult] +type eventResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + CustomPageHTML apijson.Field + Description apijson.Field + DisableSessionRenewal apijson.Field + EventEndTime apijson.Field + EventStartTime apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NewUsersPerMinute apijson.Field + PrequeueStartTime apijson.Field + QueueingMethod apijson.Field + SessionDuration apijson.Field + ShuffleAtEventStart apijson.Field + Suspended apijson.Field + TotalActiveUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventDeleteResponse struct { + Result ZoneWaitingRoomEventDeleteResponseResult `json:"result"` + JSON zoneWaitingRoomEventDeleteResponseJSON `json:"-"` +} + +// zoneWaitingRoomEventDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneWaitingRoomEventDeleteResponse] +type zoneWaitingRoomEventDeleteResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventDeleteResponseResult struct { + ID interface{} `json:"id"` + JSON zoneWaitingRoomEventDeleteResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomEventDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomEventDeleteResponseResult] +type zoneWaitingRoomEventDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventWaitingRoomListEventsResponse struct { + Errors []ZoneWaitingRoomEventWaitingRoomListEventsResponseError `json:"errors"` + Messages []ZoneWaitingRoomEventWaitingRoomListEventsResponseMessage `json:"messages"` + Result []ZoneWaitingRoomEventWaitingRoomListEventsResponseResult `json:"result"` + ResultInfo ZoneWaitingRoomEventWaitingRoomListEventsResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWaitingRoomEventWaitingRoomListEventsResponseSuccess `json:"success"` + JSON zoneWaitingRoomEventWaitingRoomListEventsResponseJSON `json:"-"` +} + +// zoneWaitingRoomEventWaitingRoomListEventsResponseJSON contains the JSON metadata +// for the struct [ZoneWaitingRoomEventWaitingRoomListEventsResponse] +type zoneWaitingRoomEventWaitingRoomListEventsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventWaitingRoomListEventsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventWaitingRoomListEventsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomEventWaitingRoomListEventsResponseErrorJSON `json:"-"` +} + +// zoneWaitingRoomEventWaitingRoomListEventsResponseErrorJSON contains the JSON +// metadata for the struct [ZoneWaitingRoomEventWaitingRoomListEventsResponseError] +type zoneWaitingRoomEventWaitingRoomListEventsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventWaitingRoomListEventsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventWaitingRoomListEventsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomEventWaitingRoomListEventsResponseMessageJSON `json:"-"` +} + +// zoneWaitingRoomEventWaitingRoomListEventsResponseMessageJSON contains the JSON +// metadata for the struct +// [ZoneWaitingRoomEventWaitingRoomListEventsResponseMessage] +type zoneWaitingRoomEventWaitingRoomListEventsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventWaitingRoomListEventsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventWaitingRoomListEventsResponseResult struct { + ID interface{} `json:"id"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // If set, the event will override the waiting room's `custom_page_html` property + // while it is active. If null, the event will inherit it. + CustomPageHTML string `json:"custom_page_html,nullable"` + // A note that you can use to add more details about the event. + Description string `json:"description"` + // If set, the event will override the waiting room's `disable_session_renewal` + // property while it is active. If null, the event will inherit it. + DisableSessionRenewal bool `json:"disable_session_renewal,nullable"` + // An ISO 8601 timestamp that marks the end of the event. + EventEndTime string `json:"event_end_time"` + // An ISO 8601 timestamp that marks the start of the event. At this time, queued + // users will be processed with the event's configuration. The start time must be + // at least one minute before `event_end_time`. + EventStartTime string `json:"event_start_time"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A unique name to identify the event. Only alphanumeric characters, hyphens and + // underscores are allowed. + Name string `json:"name"` + // If set, the event will override the waiting room's `new_users_per_minute` + // property while it is active. If null, the event will inherit it. This can only + // be set if the event's `total_active_users` property is also set. + NewUsersPerMinute int64 `json:"new_users_per_minute,nullable"` + // An ISO 8601 timestamp that marks when to begin queueing all users before the + // event starts. The prequeue must start at least five minutes before + // `event_start_time`. + PrequeueStartTime string `json:"prequeue_start_time,nullable"` + // If set, the event will override the waiting room's `queueing_method` property + // while it is active. If null, the event will inherit it. + QueueingMethod string `json:"queueing_method,nullable"` + // If set, the event will override the waiting room's `session_duration` property + // while it is active. If null, the event will inherit it. + SessionDuration int64 `json:"session_duration,nullable"` + // If enabled, users in the prequeue will be shuffled randomly at the + // `event_start_time`. Requires that `prequeue_start_time` is not null. This is + // useful for situations when many users will join the event prequeue at the same + // time and you want to shuffle them to ensure fairness. Naturally, it makes the + // most sense to enable this feature when the `queueing_method` during the event + // respects ordering such as **fifo**, or else the shuffling may be unnecessary. + ShuffleAtEventStart bool `json:"shuffle_at_event_start"` + // Suspends or allows an event. If set to `true`, the event is ignored and traffic + // will be handled based on the waiting room configuration. + Suspended bool `json:"suspended"` + // If set, the event will override the waiting room's `total_active_users` property + // while it is active. If null, the event will inherit it. This can only be set if + // the event's `new_users_per_minute` property is also set. + TotalActiveUsers int64 `json:"total_active_users,nullable"` + JSON zoneWaitingRoomEventWaitingRoomListEventsResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomEventWaitingRoomListEventsResponseResultJSON contains the JSON +// metadata for the struct +// [ZoneWaitingRoomEventWaitingRoomListEventsResponseResult] +type zoneWaitingRoomEventWaitingRoomListEventsResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + CustomPageHTML apijson.Field + Description apijson.Field + DisableSessionRenewal apijson.Field + EventEndTime apijson.Field + EventStartTime apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NewUsersPerMinute apijson.Field + PrequeueStartTime apijson.Field + QueueingMethod apijson.Field + SessionDuration apijson.Field + ShuffleAtEventStart apijson.Field + Suspended apijson.Field + TotalActiveUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventWaitingRoomListEventsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventWaitingRoomListEventsResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWaitingRoomEventWaitingRoomListEventsResponseResultInfoJSON `json:"-"` +} + +// zoneWaitingRoomEventWaitingRoomListEventsResponseResultInfoJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomEventWaitingRoomListEventsResponseResultInfo] +type zoneWaitingRoomEventWaitingRoomListEventsResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventWaitingRoomListEventsResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWaitingRoomEventWaitingRoomListEventsResponseSuccess bool + +const ( + ZoneWaitingRoomEventWaitingRoomListEventsResponseSuccessTrue ZoneWaitingRoomEventWaitingRoomListEventsResponseSuccess = true +) + +type ZoneWaitingRoomEventUpdateParams struct { + // An ISO 8601 timestamp that marks the end of the event. + EventEndTime param.Field[string] `json:"event_end_time,required"` + // An ISO 8601 timestamp that marks the start of the event. At this time, queued + // users will be processed with the event's configuration. The start time must be + // at least one minute before `event_end_time`. + EventStartTime param.Field[string] `json:"event_start_time,required"` + // A unique name to identify the event. Only alphanumeric characters, hyphens and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // If set, the event will override the waiting room's `custom_page_html` property + // while it is active. If null, the event will inherit it. + CustomPageHTML param.Field[string] `json:"custom_page_html"` + // A note that you can use to add more details about the event. + Description param.Field[string] `json:"description"` + // If set, the event will override the waiting room's `disable_session_renewal` + // property while it is active. If null, the event will inherit it. + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + // If set, the event will override the waiting room's `new_users_per_minute` + // property while it is active. If null, the event will inherit it. This can only + // be set if the event's `total_active_users` property is also set. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when to begin queueing all users before the + // event starts. The prequeue must start at least five minutes before + // `event_start_time`. + PrequeueStartTime param.Field[string] `json:"prequeue_start_time"` + // If set, the event will override the waiting room's `queueing_method` property + // while it is active. If null, the event will inherit it. + QueueingMethod param.Field[string] `json:"queueing_method"` + // If set, the event will override the waiting room's `session_duration` property + // while it is active. If null, the event will inherit it. + SessionDuration param.Field[int64] `json:"session_duration"` + // If enabled, users in the prequeue will be shuffled randomly at the + // `event_start_time`. Requires that `prequeue_start_time` is not null. This is + // useful for situations when many users will join the event prequeue at the same + // time and you want to shuffle them to ensure fairness. Naturally, it makes the + // most sense to enable this feature when the `queueing_method` during the event + // respects ordering such as **fifo**, or else the shuffling may be unnecessary. + ShuffleAtEventStart param.Field[bool] `json:"shuffle_at_event_start"` + // Suspends or allows an event. If set to `true`, the event is ignored and traffic + // will be handled based on the waiting room configuration. + Suspended param.Field[bool] `json:"suspended"` + // If set, the event will override the waiting room's `total_active_users` property + // while it is active. If null, the event will inherit it. This can only be set if + // the event's `new_users_per_minute` property is also set. + TotalActiveUsers param.Field[int64] `json:"total_active_users"` +} + +func (r ZoneWaitingRoomEventUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWaitingRoomEventPatchParams struct { + // An ISO 8601 timestamp that marks the end of the event. + EventEndTime param.Field[string] `json:"event_end_time,required"` + // An ISO 8601 timestamp that marks the start of the event. At this time, queued + // users will be processed with the event's configuration. The start time must be + // at least one minute before `event_end_time`. + EventStartTime param.Field[string] `json:"event_start_time,required"` + // A unique name to identify the event. Only alphanumeric characters, hyphens and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // If set, the event will override the waiting room's `custom_page_html` property + // while it is active. If null, the event will inherit it. + CustomPageHTML param.Field[string] `json:"custom_page_html"` + // A note that you can use to add more details about the event. + Description param.Field[string] `json:"description"` + // If set, the event will override the waiting room's `disable_session_renewal` + // property while it is active. If null, the event will inherit it. + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + // If set, the event will override the waiting room's `new_users_per_minute` + // property while it is active. If null, the event will inherit it. This can only + // be set if the event's `total_active_users` property is also set. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when to begin queueing all users before the + // event starts. The prequeue must start at least five minutes before + // `event_start_time`. + PrequeueStartTime param.Field[string] `json:"prequeue_start_time"` + // If set, the event will override the waiting room's `queueing_method` property + // while it is active. If null, the event will inherit it. + QueueingMethod param.Field[string] `json:"queueing_method"` + // If set, the event will override the waiting room's `session_duration` property + // while it is active. If null, the event will inherit it. + SessionDuration param.Field[int64] `json:"session_duration"` + // If enabled, users in the prequeue will be shuffled randomly at the + // `event_start_time`. Requires that `prequeue_start_time` is not null. This is + // useful for situations when many users will join the event prequeue at the same + // time and you want to shuffle them to ensure fairness. Naturally, it makes the + // most sense to enable this feature when the `queueing_method` during the event + // respects ordering such as **fifo**, or else the shuffling may be unnecessary. + ShuffleAtEventStart param.Field[bool] `json:"shuffle_at_event_start"` + // Suspends or allows an event. If set to `true`, the event is ignored and traffic + // will be handled based on the waiting room configuration. + Suspended param.Field[bool] `json:"suspended"` + // If set, the event will override the waiting room's `total_active_users` property + // while it is active. If null, the event will inherit it. This can only be set if + // the event's `new_users_per_minute` property is also set. + TotalActiveUsers param.Field[int64] `json:"total_active_users"` +} + +func (r ZoneWaitingRoomEventPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWaitingRoomEventWaitingRoomNewEventParams struct { + // An ISO 8601 timestamp that marks the end of the event. + EventEndTime param.Field[string] `json:"event_end_time,required"` + // An ISO 8601 timestamp that marks the start of the event. At this time, queued + // users will be processed with the event's configuration. The start time must be + // at least one minute before `event_end_time`. + EventStartTime param.Field[string] `json:"event_start_time,required"` + // A unique name to identify the event. Only alphanumeric characters, hyphens and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // If set, the event will override the waiting room's `custom_page_html` property + // while it is active. If null, the event will inherit it. + CustomPageHTML param.Field[string] `json:"custom_page_html"` + // A note that you can use to add more details about the event. + Description param.Field[string] `json:"description"` + // If set, the event will override the waiting room's `disable_session_renewal` + // property while it is active. If null, the event will inherit it. + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + // If set, the event will override the waiting room's `new_users_per_minute` + // property while it is active. If null, the event will inherit it. This can only + // be set if the event's `total_active_users` property is also set. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when to begin queueing all users before the + // event starts. The prequeue must start at least five minutes before + // `event_start_time`. + PrequeueStartTime param.Field[string] `json:"prequeue_start_time"` + // If set, the event will override the waiting room's `queueing_method` property + // while it is active. If null, the event will inherit it. + QueueingMethod param.Field[string] `json:"queueing_method"` + // If set, the event will override the waiting room's `session_duration` property + // while it is active. If null, the event will inherit it. + SessionDuration param.Field[int64] `json:"session_duration"` + // If enabled, users in the prequeue will be shuffled randomly at the + // `event_start_time`. Requires that `prequeue_start_time` is not null. This is + // useful for situations when many users will join the event prequeue at the same + // time and you want to shuffle them to ensure fairness. Naturally, it makes the + // most sense to enable this feature when the `queueing_method` during the event + // respects ordering such as **fifo**, or else the shuffling may be unnecessary. + ShuffleAtEventStart param.Field[bool] `json:"shuffle_at_event_start"` + // Suspends or allows an event. If set to `true`, the event is ignored and traffic + // will be handled based on the waiting room configuration. + Suspended param.Field[bool] `json:"suspended"` + // If set, the event will override the waiting room's `total_active_users` property + // while it is active. If null, the event will inherit it. This can only be set if + // the event's `new_users_per_minute` property is also set. + TotalActiveUsers param.Field[int64] `json:"total_active_users"` +} + +func (r ZoneWaitingRoomEventWaitingRoomNewEventParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonewaitingroomevent_test.go b/zonewaitingroomevent_test.go new file mode 100644 index 00000000000..c3b82bb5509 --- /dev/null +++ b/zonewaitingroomevent_test.go @@ -0,0 +1,243 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWaitingRoomEventGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Events.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + "25756b2dfe6e378a06b033b670413757", + ) + 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 TestZoneWaitingRoomEventUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Events.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + "25756b2dfe6e378a06b033b670413757", + cloudflare.ZoneWaitingRoomEventUpdateParams{ + EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), + EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), + Name: cloudflare.F("production_webinar_event"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), + Description: cloudflare.F("Production event - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(true), + NewUsersPerMinute: cloudflare.F(int64(200)), + PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), + QueueingMethod: cloudflare.F("random"), + SessionDuration: cloudflare.F(int64(1)), + ShuffleAtEventStart: cloudflare.F(true), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, + ) + 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 TestZoneWaitingRoomEventDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Events.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + "25756b2dfe6e378a06b033b670413757", + ) + 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 TestZoneWaitingRoomEventPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Events.Patch( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + "25756b2dfe6e378a06b033b670413757", + cloudflare.ZoneWaitingRoomEventPatchParams{ + EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), + EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), + Name: cloudflare.F("production_webinar_event"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), + Description: cloudflare.F("Production event - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(true), + NewUsersPerMinute: cloudflare.F(int64(200)), + PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), + QueueingMethod: cloudflare.F("random"), + SessionDuration: cloudflare.F(int64(1)), + ShuffleAtEventStart: cloudflare.F(true), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, + ) + 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 TestZoneWaitingRoomEventWaitingRoomNewEventWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Events.WaitingRoomNewEvent( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneWaitingRoomEventWaitingRoomNewEventParams{ + EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), + EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), + Name: cloudflare.F("production_webinar_event"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), + Description: cloudflare.F("Production event - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(true), + NewUsersPerMinute: cloudflare.F(int64(200)), + PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), + QueueingMethod: cloudflare.F("random"), + SessionDuration: cloudflare.F(int64(1)), + ShuffleAtEventStart: cloudflare.F(true), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, + ) + 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 TestZoneWaitingRoomEventWaitingRoomListEvents(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Events.WaitingRoomListEvents( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + ) + 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/zonewaitingroomeventdetail.go b/zonewaitingroomeventdetail.go new file mode 100644 index 00000000000..ea0d7f6bc42 --- /dev/null +++ b/zonewaitingroomeventdetail.go @@ -0,0 +1,125 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWaitingRoomEventDetailService 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 +// [NewZoneWaitingRoomEventDetailService] method instead. +type ZoneWaitingRoomEventDetailService struct { + Options []option.RequestOption +} + +// NewZoneWaitingRoomEventDetailService 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 NewZoneWaitingRoomEventDetailService(opts ...option.RequestOption) (r *ZoneWaitingRoomEventDetailService) { + r = &ZoneWaitingRoomEventDetailService{} + r.Options = opts + return +} + +// Previews an event's configuration as if it was active. Inherited fields from the +// waiting room will be displayed with their current values. +func (r *ZoneWaitingRoomEventDetailService) WaitingRoomPreviewActiveEventDetails(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, eventID interface{}, opts ...option.RequestOption) (res *ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/events/%v/details", zoneIdentifier, waitingRoomID, eventID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponse struct { + Result ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseResult `json:"result"` + JSON zoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseJSON `json:"-"` +} + +// zoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponse] +type zoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseResult struct { + ID interface{} `json:"id"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + CustomPageHTML string `json:"custom_page_html"` + // A note that you can use to add more details about the event. + Description string `json:"description"` + DisableSessionRenewal bool `json:"disable_session_renewal"` + // An ISO 8601 timestamp that marks the end of the event. + EventEndTime string `json:"event_end_time"` + // An ISO 8601 timestamp that marks the start of the event. At this time, queued + // users will be processed with the event's configuration. The start time must be + // at least one minute before `event_end_time`. + EventStartTime string `json:"event_start_time"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A unique name to identify the event. Only alphanumeric characters, hyphens and + // underscores are allowed. + Name string `json:"name"` + NewUsersPerMinute int64 `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when to begin queueing all users before the + // event starts. The prequeue must start at least five minutes before + // `event_start_time`. + PrequeueStartTime string `json:"prequeue_start_time,nullable"` + QueueingMethod string `json:"queueing_method"` + SessionDuration int64 `json:"session_duration"` + // If enabled, users in the prequeue will be shuffled randomly at the + // `event_start_time`. Requires that `prequeue_start_time` is not null. This is + // useful for situations when many users will join the event prequeue at the same + // time and you want to shuffle them to ensure fairness. Naturally, it makes the + // most sense to enable this feature when the `queueing_method` during the event + // respects ordering such as **fifo**, or else the shuffling may be unnecessary. + ShuffleAtEventStart bool `json:"shuffle_at_event_start"` + // Suspends or allows an event. If set to `true`, the event is ignored and traffic + // will be handled based on the waiting room configuration. + Suspended bool `json:"suspended"` + TotalActiveUsers int64 `json:"total_active_users"` + JSON zoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseResult] +type zoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + CustomPageHTML apijson.Field + Description apijson.Field + DisableSessionRenewal apijson.Field + EventEndTime apijson.Field + EventStartTime apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NewUsersPerMinute apijson.Field + PrequeueStartTime apijson.Field + QueueingMethod apijson.Field + SessionDuration apijson.Field + ShuffleAtEventStart apijson.Field + Suspended apijson.Field + TotalActiveUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonewaitingroomeventdetail_test.go b/zonewaitingroomeventdetail_test.go new file mode 100644 index 00000000000..ab80c950eca --- /dev/null +++ b/zonewaitingroomeventdetail_test.go @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWaitingRoomEventDetailWaitingRoomPreviewActiveEventDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Events.Details.WaitingRoomPreviewActiveEventDetails( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + "25756b2dfe6e378a06b033b670413757", + ) + 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/zonewaitingroompreview.go b/zonewaitingroompreview.go new file mode 100644 index 00000000000..995352f6fa5 --- /dev/null +++ b/zonewaitingroompreview.go @@ -0,0 +1,141 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWaitingRoomPreviewService 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 [NewZoneWaitingRoomPreviewService] +// method instead. +type ZoneWaitingRoomPreviewService struct { + Options []option.RequestOption +} + +// NewZoneWaitingRoomPreviewService 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 NewZoneWaitingRoomPreviewService(opts ...option.RequestOption) (r *ZoneWaitingRoomPreviewService) { + r = &ZoneWaitingRoomPreviewService{} + r.Options = opts + return +} + +// Creates a waiting room page preview. Upload a custom waiting room page for +// preview. You will receive a preview URL in the form +// `http://waitingrooms.dev/preview/`. You can use the following query +// parameters to change the state of the preview: +// +// 1. `force_queue`: Boolean indicating if all users will be queued in the waiting +// room and no one will be let into the origin website (also known as queueAll). +// 2. `queue_is_full`: Boolean indicating if the waiting room's queue is currently +// full and not accepting new users at the moment. +// 3. `queueing_method`: The queueing method currently used by the waiting room. +// - **fifo** indicates a FIFO queue. +// - **random** indicates a Random queue. +// - **passthrough** indicates a Passthrough queue. Keep in mind that the +// waiting room page will only be displayed if `force_queue=true` or +// `event=prequeueing` — for other cases the request will pass through to the +// origin. For our preview, this will be a fake origin website returning +// "Welcome". +// - **reject** indicates a Reject queue. +// 4. `event`: Used to preview a waiting room event. +// - **none** indicates no event is occurring. +// - **prequeueing** indicates that an event is prequeueing (between +// `prequeue_start_time` and `event_start_time`). +// - **started** indicates that an event has started (between `event_start_time` +// and `event_end_time`). +// 5. `shuffle_at_event_start`: Boolean indicating if the event will shuffle users +// in the prequeue when it starts. This can only be set to **true** if an event +// is active (`event` is not **none**). +// +// For example, you can make a request to +// `http://waitingrooms.dev/preview/?force_queue=false&queue_is_full=false&queueing_method=random&event=started&shuffle_at_event_start=true` 6. +// `waitTime`: Non-zero, positive integer indicating the estimated wait time in +// minutes. The default value is 10 minutes. +// +// For example, you can make a request to +// `http://waitingrooms.dev/preview/?waitTime=50` to configure the estimated +// wait time as 50 minutes. +func (r *ZoneWaitingRoomPreviewService) WaitingRoomNewACustomWaitingRoomPagePreview(ctx context.Context, zoneIdentifier string, body ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewParams, opts ...option.RequestOption) (res *ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/preview", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponse struct { + Result ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseResult `json:"result"` + JSON zoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseJSON `json:"-"` +} + +// zoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponse] +type zoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseResult struct { + // URL where the custom waiting room page can temporarily be previewed. + PreviewURL string `json:"preview_url"` + JSON zoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseResult] +type zoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseResultJSON struct { + PreviewURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewParams struct { + // Only available for the Waiting Room Advanced subscription. This is a template + // html file that will be rendered at the edge. If no custom_page_html is provided, + // the default waiting room will be used. The template is based on mustache ( + // https://mustache.github.io/ ). There are several variables that are evaluated by + // the Cloudflare edge: + // + // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to + // take when wait time is not available, for instance when queue_all is + // **true**. + // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five + // minutes. Alternatively, you can use: + // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. + // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user + // (`Math.floor(waitTime/60)`). + // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value + // (`waitTime%60`). + // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the + // queue. + // + // To view the full list of variables, look at the `cfWaitingRoom` object described + // under the `json_response_enabled` property in other Waiting Room API calls. + CustomHTML param.Field[string] `json:"custom_html,required"` +} + +func (r ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonewaitingroompreview_test.go b/zonewaitingroompreview_test.go new file mode 100644 index 00000000000..f9eb2cd9ffd --- /dev/null +++ b/zonewaitingroompreview_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreview(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Previews.WaitingRoomNewACustomWaitingRoomPagePreview( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWaitingRoomPreviewWaitingRoomNewACustomWaitingRoomPagePreviewParams{ + CustomHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), + }, + ) + 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/zonewaitingroomrule.go b/zonewaitingroomrule.go new file mode 100644 index 00000000000..d029a179fb1 --- /dev/null +++ b/zonewaitingroomrule.go @@ -0,0 +1,890 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWaitingRoomRuleService 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 [NewZoneWaitingRoomRuleService] +// method instead. +type ZoneWaitingRoomRuleService struct { + Options []option.RequestOption +} + +// NewZoneWaitingRoomRuleService 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 NewZoneWaitingRoomRuleService(opts ...option.RequestOption) (r *ZoneWaitingRoomRuleService) { + r = &ZoneWaitingRoomRuleService{} + r.Options = opts + return +} + +// Patches a rule for a waiting room. +func (r *ZoneWaitingRoomRuleService) Update(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, ruleID string, body ZoneWaitingRoomRuleUpdateParams, opts ...option.RequestOption) (res *ZoneWaitingRoomRuleUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/rules/%s", zoneIdentifier, waitingRoomID, ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Deletes a rule for a waiting room. +func (r *ZoneWaitingRoomRuleService) Delete(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, ruleID string, opts ...option.RequestOption) (res *ZoneWaitingRoomRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/rules/%s", zoneIdentifier, waitingRoomID, ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Only available for the Waiting Room Advanced subscription. Creates a rule for a +// waiting room. +func (r *ZoneWaitingRoomRuleService) WaitingRoomNewWaitingRoomRule(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParams, opts ...option.RequestOption) (res *ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/rules", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Lists rules for a waiting room. +func (r *ZoneWaitingRoomRuleService) WaitingRoomListWaitingRoomRules(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, opts ...option.RequestOption) (res *ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/rules", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Only available for the Waiting Room Advanced subscription. Replaces all rules +// for a waiting room. +func (r *ZoneWaitingRoomRuleService) WaitingRoomReplaceWaitingRoomRules(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, body ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParams, opts ...option.RequestOption) (res *ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/rules", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneWaitingRoomRuleUpdateResponse struct { + Errors []ZoneWaitingRoomRuleUpdateResponseError `json:"errors"` + Messages []ZoneWaitingRoomRuleUpdateResponseMessage `json:"messages"` + Result []ZoneWaitingRoomRuleUpdateResponseResult `json:"result"` + ResultInfo ZoneWaitingRoomRuleUpdateResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWaitingRoomRuleUpdateResponseSuccess `json:"success"` + JSON zoneWaitingRoomRuleUpdateResponseJSON `json:"-"` +} + +// zoneWaitingRoomRuleUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneWaitingRoomRuleUpdateResponse] +type zoneWaitingRoomRuleUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleUpdateResponseErrorJSON `json:"-"` +} + +// zoneWaitingRoomRuleUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomRuleUpdateResponseError] +type zoneWaitingRoomRuleUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleUpdateResponseMessageJSON `json:"-"` +} + +// zoneWaitingRoomRuleUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomRuleUpdateResponseMessage] +type zoneWaitingRoomRuleUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleUpdateResponseResult struct { + // The ID of the rule. + ID string `json:"id"` + // The action to take when the expression matches. + Action ZoneWaitingRoomRuleUpdateResponseResultAction `json:"action"` + // The description of the rule. + Description string `json:"description"` + // When set to true, the rule is enabled. + Enabled bool `json:"enabled"` + // Criteria defining when there is a match for the current rule. + Expression string `json:"expression"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The version of the rule. + Version string `json:"version"` + JSON zoneWaitingRoomRuleUpdateResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomRuleUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomRuleUpdateResponseResult] +type zoneWaitingRoomRuleUpdateResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + LastUpdated apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleUpdateResponseResultAction string + +const ( + ZoneWaitingRoomRuleUpdateResponseResultActionBypassWaitingRoom ZoneWaitingRoomRuleUpdateResponseResultAction = "bypass_waiting_room" +) + +type ZoneWaitingRoomRuleUpdateResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWaitingRoomRuleUpdateResponseResultInfoJSON `json:"-"` +} + +// zoneWaitingRoomRuleUpdateResponseResultInfoJSON contains the JSON metadata for +// the struct [ZoneWaitingRoomRuleUpdateResponseResultInfo] +type zoneWaitingRoomRuleUpdateResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleUpdateResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWaitingRoomRuleUpdateResponseSuccess bool + +const ( + ZoneWaitingRoomRuleUpdateResponseSuccessTrue ZoneWaitingRoomRuleUpdateResponseSuccess = true +) + +type ZoneWaitingRoomRuleDeleteResponse struct { + Errors []ZoneWaitingRoomRuleDeleteResponseError `json:"errors"` + Messages []ZoneWaitingRoomRuleDeleteResponseMessage `json:"messages"` + Result []ZoneWaitingRoomRuleDeleteResponseResult `json:"result"` + ResultInfo ZoneWaitingRoomRuleDeleteResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWaitingRoomRuleDeleteResponseSuccess `json:"success"` + JSON zoneWaitingRoomRuleDeleteResponseJSON `json:"-"` +} + +// zoneWaitingRoomRuleDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneWaitingRoomRuleDeleteResponse] +type zoneWaitingRoomRuleDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleDeleteResponseErrorJSON `json:"-"` +} + +// zoneWaitingRoomRuleDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomRuleDeleteResponseError] +type zoneWaitingRoomRuleDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleDeleteResponseMessageJSON `json:"-"` +} + +// zoneWaitingRoomRuleDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomRuleDeleteResponseMessage] +type zoneWaitingRoomRuleDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleDeleteResponseResult struct { + // The ID of the rule. + ID string `json:"id"` + // The action to take when the expression matches. + Action ZoneWaitingRoomRuleDeleteResponseResultAction `json:"action"` + // The description of the rule. + Description string `json:"description"` + // When set to true, the rule is enabled. + Enabled bool `json:"enabled"` + // Criteria defining when there is a match for the current rule. + Expression string `json:"expression"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The version of the rule. + Version string `json:"version"` + JSON zoneWaitingRoomRuleDeleteResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomRuleDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneWaitingRoomRuleDeleteResponseResult] +type zoneWaitingRoomRuleDeleteResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + LastUpdated apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleDeleteResponseResultAction string + +const ( + ZoneWaitingRoomRuleDeleteResponseResultActionBypassWaitingRoom ZoneWaitingRoomRuleDeleteResponseResultAction = "bypass_waiting_room" +) + +type ZoneWaitingRoomRuleDeleteResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWaitingRoomRuleDeleteResponseResultInfoJSON `json:"-"` +} + +// zoneWaitingRoomRuleDeleteResponseResultInfoJSON contains the JSON metadata for +// the struct [ZoneWaitingRoomRuleDeleteResponseResultInfo] +type zoneWaitingRoomRuleDeleteResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleDeleteResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWaitingRoomRuleDeleteResponseSuccess bool + +const ( + ZoneWaitingRoomRuleDeleteResponseSuccessTrue ZoneWaitingRoomRuleDeleteResponseSuccess = true +) + +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponse struct { + Errors []ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseError `json:"errors"` + Messages []ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseMessage `json:"messages"` + Result []ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResult `json:"result"` + ResultInfo ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseSuccess `json:"success"` + JSON zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseJSON contains the JSON +// metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponse] +type zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseErrorJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseError] +type zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseMessageJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseMessage] +type zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResult struct { + // The ID of the rule. + ID string `json:"id"` + // The action to take when the expression matches. + Action ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultAction `json:"action"` + // The description of the rule. + Description string `json:"description"` + // When set to true, the rule is enabled. + Enabled bool `json:"enabled"` + // Criteria defining when there is a match for the current rule. + Expression string `json:"expression"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The version of the rule. + Version string `json:"version"` + JSON zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResult] +type zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + LastUpdated apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultAction string + +const ( + ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultActionBypassWaitingRoom ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultAction = "bypass_waiting_room" +) + +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultInfoJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultInfoJSON contains +// the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultInfo] +type zoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseSuccess bool + +const ( + ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseSuccessTrue ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleResponseSuccess = true +) + +type ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponse struct { + Errors []ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseError `json:"errors"` + Messages []ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseMessage `json:"messages"` + Result []ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResult `json:"result"` + ResultInfo ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseSuccess `json:"success"` + JSON zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseJSON contains the JSON +// metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponse] +type zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseErrorJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseError] +type zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseMessageJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseMessage] +type zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResult struct { + // The ID of the rule. + ID string `json:"id"` + // The action to take when the expression matches. + Action ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultAction `json:"action"` + // The description of the rule. + Description string `json:"description"` + // When set to true, the rule is enabled. + Enabled bool `json:"enabled"` + // Criteria defining when there is a match for the current rule. + Expression string `json:"expression"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The version of the rule. + Version string `json:"version"` + JSON zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResult] +type zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + LastUpdated apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultAction string + +const ( + ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultActionBypassWaitingRoom ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultAction = "bypass_waiting_room" +) + +type ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultInfoJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultInfo] +type zoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseSuccess bool + +const ( + ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseSuccessTrue ZoneWaitingRoomRuleWaitingRoomListWaitingRoomRulesResponseSuccess = true +) + +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponse struct { + Errors []ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseError `json:"errors"` + Messages []ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseMessage `json:"messages"` + Result []ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResult `json:"result"` + ResultInfo ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseSuccess `json:"success"` + JSON zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponse] +type zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseErrorJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseError] +type zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseMessageJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseMessage] +type zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResult struct { + // The ID of the rule. + ID string `json:"id"` + // The action to take when the expression matches. + Action ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultAction `json:"action"` + // The description of the rule. + Description string `json:"description"` + // When set to true, the rule is enabled. + Enabled bool `json:"enabled"` + // Criteria defining when there is a match for the current rule. + Expression string `json:"expression"` + LastUpdated time.Time `json:"last_updated" format:"date-time"` + // The version of the rule. + Version string `json:"version"` + JSON zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResult] +type zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultJSON struct { + ID apijson.Field + Action apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + LastUpdated apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultAction string + +const ( + ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultActionBypassWaitingRoom ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultAction = "bypass_waiting_room" +) + +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultInfoJSON `json:"-"` +} + +// zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultInfo] +type zoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseSuccess bool + +const ( + ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseSuccessTrue ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesResponseSuccess = true +) + +type ZoneWaitingRoomRuleUpdateParams struct { + // The action to take when the expression matches. + Action param.Field[ZoneWaitingRoomRuleUpdateParamsAction] `json:"action,required"` + // Criteria defining when there is a match for the current rule. + Expression param.Field[string] `json:"expression,required"` + // The description of the rule. + Description param.Field[string] `json:"description"` + // When set to true, the rule is enabled. + Enabled param.Field[bool] `json:"enabled"` + // Reorder the position of a rule + Position param.Field[ZoneWaitingRoomRuleUpdateParamsPosition] `json:"position"` +} + +func (r ZoneWaitingRoomRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleUpdateParamsAction string + +const ( + ZoneWaitingRoomRuleUpdateParamsActionBypassWaitingRoom ZoneWaitingRoomRuleUpdateParamsAction = "bypass_waiting_room" +) + +// Reorder the position of a rule +// +// Satisfied by [ZoneWaitingRoomRuleUpdateParamsPositionObject], +// [ZoneWaitingRoomRuleUpdateParamsPositionObject], +// [ZoneWaitingRoomRuleUpdateParamsPositionObject]. +type ZoneWaitingRoomRuleUpdateParamsPosition interface { + implementsZoneWaitingRoomRuleUpdateParamsPosition() +} + +type ZoneWaitingRoomRuleUpdateParamsPositionObject struct { + // Places the rule in the exact position specified by the integer number + // . Position numbers start with 1. Existing rules in the ruleset + // from the specified position number onward are shifted one position (no rule is + // overwritten). + Index param.Field[int64] `json:"index"` +} + +func (r ZoneWaitingRoomRuleUpdateParamsPositionObject) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneWaitingRoomRuleUpdateParamsPositionObject) implementsZoneWaitingRoomRuleUpdateParamsPosition() { +} + +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParams struct { + // The action to take when the expression matches. + Action param.Field[ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParamsAction] `json:"action,required"` + // Criteria defining when there is a match for the current rule. + Expression param.Field[string] `json:"expression,required"` + // The description of the rule. + Description param.Field[string] `json:"description"` + // When set to true, the rule is enabled. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParamsAction string + +const ( + ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParamsActionBypassWaitingRoom ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParamsAction = "bypass_waiting_room" +) + +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParams struct { + Body param.Field[[]ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBody] `json:"body,required"` +} + +func (r ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBody struct { + // The action to take when the expression matches. + Action param.Field[ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBodyAction] `json:"action,required"` + // Criteria defining when there is a match for the current rule. + Expression param.Field[string] `json:"expression,required"` + // The description of the rule. + Description param.Field[string] `json:"description"` + // When set to true, the rule is enabled. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to take when the expression matches. +type ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBodyAction string + +const ( + ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBodyActionBypassWaitingRoom ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBodyAction = "bypass_waiting_room" +) diff --git a/zonewaitingroomrule_test.go b/zonewaitingroomrule_test.go new file mode 100644 index 00000000000..2ec1086d819 --- /dev/null +++ b/zonewaitingroomrule_test.go @@ -0,0 +1,199 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWaitingRoomRuleUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Rules.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + "25756b2dfe6e378a06b033b670413757", + cloudflare.ZoneWaitingRoomRuleUpdateParams{ + Action: cloudflare.F(cloudflare.ZoneWaitingRoomRuleUpdateParamsActionBypassWaitingRoom), + Expression: cloudflare.F("ip.src in {10.20.30.40}"), + Description: cloudflare.F("allow all traffic from 10.20.30.40"), + Enabled: cloudflare.F(true), + Position: cloudflare.F[cloudflare.ZoneWaitingRoomRuleUpdateParamsPosition](cloudflare.ZoneWaitingRoomRuleUpdateParamsPositionObject(cloudflare.ZoneWaitingRoomRuleUpdateParamsPositionObject{ + Index: cloudflare.F(int64(0)), + })), + }, + ) + 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 TestZoneWaitingRoomRuleDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Rules.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + "25756b2dfe6e378a06b033b670413757", + ) + 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 TestZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Rules.WaitingRoomNewWaitingRoomRule( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParams{ + Action: cloudflare.F(cloudflare.ZoneWaitingRoomRuleWaitingRoomNewWaitingRoomRuleParamsActionBypassWaitingRoom), + Expression: cloudflare.F("ip.src in {10.20.30.40}"), + Description: cloudflare.F("allow all traffic from 10.20.30.40"), + Enabled: cloudflare.F(true), + }, + ) + 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 TestZoneWaitingRoomRuleWaitingRoomListWaitingRoomRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Rules.WaitingRoomListWaitingRoomRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + ) + 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 TestZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRules(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Rules.WaitingRoomReplaceWaitingRoomRules( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParams{ + Body: cloudflare.F([]cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBody{{ + Action: cloudflare.F(cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBodyActionBypassWaitingRoom), + Description: cloudflare.F("allow all traffic from 10.20.30.40"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("ip.src in {10.20.30.40}"), + }, { + Action: cloudflare.F(cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBodyActionBypassWaitingRoom), + Description: cloudflare.F("allow all traffic from 10.20.30.40"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("ip.src in {10.20.30.40}"), + }, { + Action: cloudflare.F(cloudflare.ZoneWaitingRoomRuleWaitingRoomReplaceWaitingRoomRulesParamsBodyActionBypassWaitingRoom), + Description: cloudflare.F("allow all traffic from 10.20.30.40"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("ip.src in {10.20.30.40}"), + }}), + }, + ) + 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/zonewaitingroomsetting.go b/zonewaitingroomsetting.go new file mode 100644 index 00000000000..777fc48d182 --- /dev/null +++ b/zonewaitingroomsetting.go @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWaitingRoomSettingService 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 [NewZoneWaitingRoomSettingService] +// method instead. +type ZoneWaitingRoomSettingService struct { + Options []option.RequestOption +} + +// NewZoneWaitingRoomSettingService 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 NewZoneWaitingRoomSettingService(opts ...option.RequestOption) (r *ZoneWaitingRoomSettingService) { + r = &ZoneWaitingRoomSettingService{} + r.Options = opts + return +} + +// Update zone-level Waiting Room settings +func (r *ZoneWaitingRoomSettingService) Update(ctx context.Context, zoneIdentifier string, body ZoneWaitingRoomSettingUpdateParams, opts ...option.RequestOption) (res *shared.WaitingRoomSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Get zone-level Waiting Room settings +func (r *ZoneWaitingRoomSettingService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *shared.WaitingRoomSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Patch zone-level Waiting Room settings +func (r *ZoneWaitingRoomSettingService) Patch(ctx context.Context, zoneIdentifier string, body ZoneWaitingRoomSettingPatchParams, opts ...option.RequestOption) (res *shared.WaitingRoomSettingsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/settings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +type ZoneWaitingRoomSettingUpdateParams struct { + // Whether to allow verified search engine crawlers to bypass all waiting rooms on + // this zone. Verified search engine crawlers will not be tracked or counted by the + // waiting room system, and will not appear in waiting room analytics. + SearchEngineCrawlerBypass param.Field[bool] `json:"search_engine_crawler_bypass"` +} + +func (r ZoneWaitingRoomSettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWaitingRoomSettingPatchParams struct { + // Whether to allow verified search engine crawlers to bypass all waiting rooms on + // this zone. Verified search engine crawlers will not be tracked or counted by the + // waiting room system, and will not appear in waiting room analytics. + SearchEngineCrawlerBypass param.Field[bool] `json:"search_engine_crawler_bypass"` +} + +func (r ZoneWaitingRoomSettingPatchParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zonewaitingroomsetting_test.go b/zonewaitingroomsetting_test.go new file mode 100644 index 00000000000..3b946863802 --- /dev/null +++ b/zonewaitingroomsetting_test.go @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWaitingRoomSettingUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Settings.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWaitingRoomSettingUpdateParams{ + SearchEngineCrawlerBypass: cloudflare.F(true), + }, + ) + 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 TestZoneWaitingRoomSettingList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Settings.List(context.TODO(), "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()) + } +} + +func TestZoneWaitingRoomSettingPatchWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Settings.Patch( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWaitingRoomSettingPatchParams{ + SearchEngineCrawlerBypass: cloudflare.F(true), + }, + ) + 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/zonewaitingroomstatus.go b/zonewaitingroomstatus.go new file mode 100644 index 00000000000..064e69eec9a --- /dev/null +++ b/zonewaitingroomstatus.go @@ -0,0 +1,108 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWaitingRoomStatusService 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 [NewZoneWaitingRoomStatusService] +// method instead. +type ZoneWaitingRoomStatusService struct { + Options []option.RequestOption +} + +// NewZoneWaitingRoomStatusService 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 NewZoneWaitingRoomStatusService(opts ...option.RequestOption) (r *ZoneWaitingRoomStatusService) { + r = &ZoneWaitingRoomStatusService{} + r.Options = opts + return +} + +// Fetches the status of a configured waiting room. Response fields include: +// +// 1. `status`: String indicating the status of the waiting room. The possible +// status are: +// - **not_queueing** indicates that the configured thresholds have not been met +// and all users are going through to the origin. +// - **queueing** indicates that the thresholds have been met and some users are +// held in the waiting room. +// - **event_prequeueing** indicates that an event is active and is currently +// prequeueing users before it starts. +// 2. `event_id`: String of the current event's `id` if an event is active, +// otherwise an empty string. +// 3. `estimated_queued_users`: Integer of the estimated number of users currently +// waiting in the queue. +// 4. `estimated_total_active_users`: Integer of the estimated number of users +// currently active on the origin. +// 5. `max_estimated_time_minutes`: Integer of the maximum estimated time currently +// presented to the users. +func (r *ZoneWaitingRoomStatusService) WaitingRoomGetWaitingRoomStatus(ctx context.Context, zoneIdentifier string, waitingRoomID interface{}, opts ...option.RequestOption) (res *ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/waiting_rooms/%v/status", zoneIdentifier, waitingRoomID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponse struct { + Result ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResult `json:"result"` + JSON zoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseJSON `json:"-"` +} + +// zoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseJSON contains the +// JSON metadata for the struct +// [ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponse] +type zoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResult struct { + EstimatedQueuedUsers int64 `json:"estimated_queued_users"` + EstimatedTotalActiveUsers int64 `json:"estimated_total_active_users"` + EventID string `json:"event_id"` + MaxEstimatedTimeMinutes int64 `json:"max_estimated_time_minutes"` + Status ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatus `json:"status"` + JSON zoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultJSON `json:"-"` +} + +// zoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResult] +type zoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultJSON struct { + EstimatedQueuedUsers apijson.Field + EstimatedTotalActiveUsers apijson.Field + EventID apijson.Field + MaxEstimatedTimeMinutes apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatus string + +const ( + ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatusEventPrequeueing ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatus = "event_prequeueing" + ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatusNotQueueing ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatus = "not_queueing" + ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatusQueueing ZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatusResponseResultStatus = "queueing" +) diff --git a/zonewaitingroomstatus_test.go b/zonewaitingroomstatus_test.go new file mode 100644 index 00000000000..7c051d612ec --- /dev/null +++ b/zonewaitingroomstatus_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWaitingRoomStatusWaitingRoomGetWaitingRoomStatus(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.WaitingRooms.Statuses.WaitingRoomGetWaitingRoomStatus( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "699d98642c564d2e855e9661899b7252", + ) + 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/zoneweb3.go b/zoneweb3.go new file mode 100644 index 00000000000..5bdb1f23bf2 --- /dev/null +++ b/zoneweb3.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWeb3Service 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 [NewZoneWeb3Service] method instead. +type ZoneWeb3Service struct { + Options []option.RequestOption + Hostnames *ZoneWeb3HostnameService +} + +// NewZoneWeb3Service 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 NewZoneWeb3Service(opts ...option.RequestOption) (r *ZoneWeb3Service) { + r = &ZoneWeb3Service{} + r.Options = opts + r.Hostnames = NewZoneWeb3HostnameService(opts...) + return +} diff --git a/zoneweb3hostname.go b/zoneweb3hostname.go new file mode 100644 index 00000000000..3b48f9cc1a1 --- /dev/null +++ b/zoneweb3hostname.go @@ -0,0 +1,736 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWeb3HostnameService 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 [NewZoneWeb3HostnameService] method +// instead. +type ZoneWeb3HostnameService struct { + Options []option.RequestOption + IpfsUniversalPaths *ZoneWeb3HostnameIpfsUniversalPathService +} + +// NewZoneWeb3HostnameService 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 NewZoneWeb3HostnameService(opts ...option.RequestOption) (r *ZoneWeb3HostnameService) { + r = &ZoneWeb3HostnameService{} + r.Options = opts + r.IpfsUniversalPaths = NewZoneWeb3HostnameIpfsUniversalPathService(opts...) + return +} + +// Web3 Hostname Details +func (r *ZoneWeb3HostnameService) Get(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneWeb3HostnameGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Edit Web3 Hostname +func (r *ZoneWeb3HostnameService) Update(ctx context.Context, zoneIdentifier string, identifier string, body ZoneWeb3HostnameUpdateParams, opts ...option.RequestOption) (res *ZoneWeb3HostnameUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...) + return +} + +// Delete Web3 Hostname +func (r *ZoneWeb3HostnameService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneWeb3HostnameDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create Web3 Hostname +func (r *ZoneWeb3HostnameService) Web3HostnameNewWeb3Hostname(ctx context.Context, zoneIdentifier string, body ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParams, opts ...option.RequestOption) (res *ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List Web3 Hostnames +func (r *ZoneWeb3HostnameService) Web3HostnameListWeb3Hostnames(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneWeb3HostnameGetResponse struct { + Errors []ZoneWeb3HostnameGetResponseError `json:"errors"` + Messages []ZoneWeb3HostnameGetResponseMessage `json:"messages"` + Result ZoneWeb3HostnameGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameGetResponseSuccess `json:"success"` + JSON zoneWeb3HostnameGetResponseJSON `json:"-"` +} + +// zoneWeb3HostnameGetResponseJSON contains the JSON metadata for the struct +// [ZoneWeb3HostnameGetResponse] +type zoneWeb3HostnameGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameGetResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneWeb3HostnameGetResponseError] +type zoneWeb3HostnameGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameGetResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneWeb3HostnameGetResponseMessage] +type zoneWeb3HostnameGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameGetResponseResult struct { + // Identifier + ID string `json:"id"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the hostname. + Description string `json:"description"` + // DNSLink value used if the target is ipfs. + Dnslink string `json:"dnslink"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The hostname that will point to the target gateway via CNAME. + Name string `json:"name"` + // Status of the hostname's activation. + Status ZoneWeb3HostnameGetResponseResultStatus `json:"status"` + // Target gateway of the hostname. + Target ZoneWeb3HostnameGetResponseResultTarget `json:"target"` + JSON zoneWeb3HostnameGetResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneWeb3HostnameGetResponseResult] +type zoneWeb3HostnameGetResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Dnslink apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Status apijson.Field + Target apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneWeb3HostnameGetResponseResultStatus string + +const ( + ZoneWeb3HostnameGetResponseResultStatusActive ZoneWeb3HostnameGetResponseResultStatus = "active" + ZoneWeb3HostnameGetResponseResultStatusPending ZoneWeb3HostnameGetResponseResultStatus = "pending" + ZoneWeb3HostnameGetResponseResultStatusDeleting ZoneWeb3HostnameGetResponseResultStatus = "deleting" + ZoneWeb3HostnameGetResponseResultStatusError ZoneWeb3HostnameGetResponseResultStatus = "error" +) + +// Target gateway of the hostname. +type ZoneWeb3HostnameGetResponseResultTarget string + +const ( + ZoneWeb3HostnameGetResponseResultTargetEthereum ZoneWeb3HostnameGetResponseResultTarget = "ethereum" + ZoneWeb3HostnameGetResponseResultTargetIpfs ZoneWeb3HostnameGetResponseResultTarget = "ipfs" + ZoneWeb3HostnameGetResponseResultTargetIpfsUniversalPath ZoneWeb3HostnameGetResponseResultTarget = "ipfs_universal_path" + ZoneWeb3HostnameGetResponseResultTargetPolygon ZoneWeb3HostnameGetResponseResultTarget = "polygon" +) + +// Whether the API call was successful +type ZoneWeb3HostnameGetResponseSuccess bool + +const ( + ZoneWeb3HostnameGetResponseSuccessTrue ZoneWeb3HostnameGetResponseSuccess = true +) + +type ZoneWeb3HostnameUpdateResponse struct { + Errors []ZoneWeb3HostnameUpdateResponseError `json:"errors"` + Messages []ZoneWeb3HostnameUpdateResponseMessage `json:"messages"` + Result ZoneWeb3HostnameUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameUpdateResponseSuccess `json:"success"` + JSON zoneWeb3HostnameUpdateResponseJSON `json:"-"` +} + +// zoneWeb3HostnameUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneWeb3HostnameUpdateResponse] +type zoneWeb3HostnameUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameUpdateResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneWeb3HostnameUpdateResponseError] +type zoneWeb3HostnameUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameUpdateResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWeb3HostnameUpdateResponseMessage] +type zoneWeb3HostnameUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameUpdateResponseResult struct { + // Identifier + ID string `json:"id"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the hostname. + Description string `json:"description"` + // DNSLink value used if the target is ipfs. + Dnslink string `json:"dnslink"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The hostname that will point to the target gateway via CNAME. + Name string `json:"name"` + // Status of the hostname's activation. + Status ZoneWeb3HostnameUpdateResponseResultStatus `json:"status"` + // Target gateway of the hostname. + Target ZoneWeb3HostnameUpdateResponseResultTarget `json:"target"` + JSON zoneWeb3HostnameUpdateResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneWeb3HostnameUpdateResponseResult] +type zoneWeb3HostnameUpdateResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Dnslink apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Status apijson.Field + Target apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneWeb3HostnameUpdateResponseResultStatus string + +const ( + ZoneWeb3HostnameUpdateResponseResultStatusActive ZoneWeb3HostnameUpdateResponseResultStatus = "active" + ZoneWeb3HostnameUpdateResponseResultStatusPending ZoneWeb3HostnameUpdateResponseResultStatus = "pending" + ZoneWeb3HostnameUpdateResponseResultStatusDeleting ZoneWeb3HostnameUpdateResponseResultStatus = "deleting" + ZoneWeb3HostnameUpdateResponseResultStatusError ZoneWeb3HostnameUpdateResponseResultStatus = "error" +) + +// Target gateway of the hostname. +type ZoneWeb3HostnameUpdateResponseResultTarget string + +const ( + ZoneWeb3HostnameUpdateResponseResultTargetEthereum ZoneWeb3HostnameUpdateResponseResultTarget = "ethereum" + ZoneWeb3HostnameUpdateResponseResultTargetIpfs ZoneWeb3HostnameUpdateResponseResultTarget = "ipfs" + ZoneWeb3HostnameUpdateResponseResultTargetIpfsUniversalPath ZoneWeb3HostnameUpdateResponseResultTarget = "ipfs_universal_path" + ZoneWeb3HostnameUpdateResponseResultTargetPolygon ZoneWeb3HostnameUpdateResponseResultTarget = "polygon" +) + +// Whether the API call was successful +type ZoneWeb3HostnameUpdateResponseSuccess bool + +const ( + ZoneWeb3HostnameUpdateResponseSuccessTrue ZoneWeb3HostnameUpdateResponseSuccess = true +) + +type ZoneWeb3HostnameDeleteResponse struct { + Errors []ZoneWeb3HostnameDeleteResponseError `json:"errors"` + Messages []ZoneWeb3HostnameDeleteResponseMessage `json:"messages"` + Result ZoneWeb3HostnameDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneWeb3HostnameDeleteResponseSuccess `json:"success"` + JSON zoneWeb3HostnameDeleteResponseJSON `json:"-"` +} + +// zoneWeb3HostnameDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneWeb3HostnameDeleteResponse] +type zoneWeb3HostnameDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameDeleteResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneWeb3HostnameDeleteResponseError] +type zoneWeb3HostnameDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameDeleteResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWeb3HostnameDeleteResponseMessage] +type zoneWeb3HostnameDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON zoneWeb3HostnameDeleteResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneWeb3HostnameDeleteResponseResult] +type zoneWeb3HostnameDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWeb3HostnameDeleteResponseSuccess bool + +const ( + ZoneWeb3HostnameDeleteResponseSuccessTrue ZoneWeb3HostnameDeleteResponseSuccess = true +) + +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponse struct { + Errors []ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseError `json:"errors"` + Messages []ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseMessage `json:"messages"` + Result ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseSuccess `json:"success"` + JSON zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseJSON contains the JSON +// metadata for the struct [ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponse] +type zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseError] +type zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseMessageJSON contains the JSON +// metadata for the struct +// [ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseMessage] +type zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResult struct { + // Identifier + ID string `json:"id"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the hostname. + Description string `json:"description"` + // DNSLink value used if the target is ipfs. + Dnslink string `json:"dnslink"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The hostname that will point to the target gateway via CNAME. + Name string `json:"name"` + // Status of the hostname's activation. + Status ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatus `json:"status"` + // Target gateway of the hostname. + Target ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTarget `json:"target"` + JSON zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultJSON contains the JSON +// metadata for the struct +// [ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResult] +type zoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Dnslink apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Status apijson.Field + Target apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatus string + +const ( + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatusActive ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatus = "active" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatusPending ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatus = "pending" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatusDeleting ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatus = "deleting" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatusError ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultStatus = "error" +) + +// Target gateway of the hostname. +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTarget string + +const ( + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTargetEthereum ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTarget = "ethereum" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTargetIpfs ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTarget = "ipfs" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTargetIpfsUniversalPath ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTarget = "ipfs_universal_path" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTargetPolygon ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseResultTarget = "polygon" +) + +// Whether the API call was successful +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseSuccess bool + +const ( + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseSuccessTrue ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameResponseSuccess = true +) + +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponse struct { + Errors []ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseError `json:"errors"` + Messages []ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseMessage `json:"messages"` + Result []ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResult `json:"result"` + ResultInfo ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseSuccess `json:"success"` + JSON zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseJSON contains the JSON +// metadata for the struct [ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponse] +type zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseErrorJSON contains the JSON +// metadata for the struct +// [ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseError] +type zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseMessage] +type zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResult struct { + // Identifier + ID string `json:"id"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the hostname. + Description string `json:"description"` + // DNSLink value used if the target is ipfs. + Dnslink string `json:"dnslink"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The hostname that will point to the target gateway via CNAME. + Name string `json:"name"` + // Status of the hostname's activation. + Status ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatus `json:"status"` + // Target gateway of the hostname. + Target ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTarget `json:"target"` + JSON zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResult] +type zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultJSON struct { + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + Dnslink apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + Status apijson.Field + Target apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the hostname's activation. +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatus string + +const ( + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatusActive ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatus = "active" + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatusPending ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatus = "pending" + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatusDeleting ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatus = "deleting" + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatusError ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultStatus = "error" +) + +// Target gateway of the hostname. +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTarget string + +const ( + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTargetEthereum ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTarget = "ethereum" + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTargetIpfs ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTarget = "ipfs" + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTargetIpfsUniversalPath ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTarget = "ipfs_universal_path" + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTargetPolygon ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultTarget = "polygon" +) + +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultInfoJSON `json:"-"` +} + +// zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultInfoJSON contains the +// JSON metadata for the struct +// [ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultInfo] +type zoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseSuccess bool + +const ( + ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseSuccessTrue ZoneWeb3HostnameWeb3HostnameListWeb3HostnamesResponseSuccess = true +) + +type ZoneWeb3HostnameUpdateParams struct { + // An optional description of the hostname. + Description param.Field[string] `json:"description"` + // DNSLink value used if the target is ipfs. + Dnslink param.Field[string] `json:"dnslink"` +} + +func (r ZoneWeb3HostnameUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParams struct { + // Target gateway of the hostname. + Target param.Field[ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTarget] `json:"target,required"` + // An optional description of the hostname. + Description param.Field[string] `json:"description"` + // DNSLink value used if the target is ipfs. + Dnslink param.Field[string] `json:"dnslink"` +} + +func (r ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Target gateway of the hostname. +type ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTarget string + +const ( + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTargetEthereum ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTarget = "ethereum" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTargetIpfs ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTarget = "ipfs" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTargetIpfsUniversalPath ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTarget = "ipfs_universal_path" + ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTargetPolygon ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTarget = "polygon" +) diff --git a/zoneweb3hostname_test.go b/zoneweb3hostname_test.go new file mode 100644 index 00000000000..30002624f33 --- /dev/null +++ b/zoneweb3hostname_test.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWeb3HostnameGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWeb3HostnameUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWeb3HostnameUpdateParams{ + Description: cloudflare.F("This is my IPFS gateway."), + Dnslink: cloudflare.F("/ipns/onboarding.ipfs.cloudflare.com"), + }, + ) + 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 TestZoneWeb3HostnameDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWeb3HostnameWeb3HostnameNewWeb3HostnameWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.Web3HostnameNewWeb3Hostname( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParams{ + Target: cloudflare.F(cloudflare.ZoneWeb3HostnameWeb3HostnameNewWeb3HostnameParamsTargetIpfs), + Description: cloudflare.F("This is my IPFS gateway."), + Dnslink: cloudflare.F("/ipns/onboarding.ipfs.cloudflare.com"), + }, + ) + 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 TestZoneWeb3HostnameWeb3HostnameListWeb3Hostnames(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.Web3HostnameListWeb3Hostnames(context.TODO(), "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/zoneweb3hostnameipfsuniversalpath.go b/zoneweb3hostnameipfsuniversalpath.go new file mode 100644 index 00000000000..2f87876a1f7 --- /dev/null +++ b/zoneweb3hostnameipfsuniversalpath.go @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWeb3HostnameIpfsUniversalPathService 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 +// [NewZoneWeb3HostnameIpfsUniversalPathService] method instead. +type ZoneWeb3HostnameIpfsUniversalPathService struct { + Options []option.RequestOption + ContentLists *ZoneWeb3HostnameIpfsUniversalPathContentListService +} + +// NewZoneWeb3HostnameIpfsUniversalPathService 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 NewZoneWeb3HostnameIpfsUniversalPathService(opts ...option.RequestOption) (r *ZoneWeb3HostnameIpfsUniversalPathService) { + r = &ZoneWeb3HostnameIpfsUniversalPathService{} + r.Options = opts + r.ContentLists = NewZoneWeb3HostnameIpfsUniversalPathContentListService(opts...) + return +} diff --git a/zoneweb3hostnameipfsuniversalpathcontentlist.go b/zoneweb3hostnameipfsuniversalpathcontentlist.go new file mode 100644 index 00000000000..f888288114e --- /dev/null +++ b/zoneweb3hostnameipfsuniversalpathcontentlist.go @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWeb3HostnameIpfsUniversalPathContentListService 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 [NewZoneWeb3HostnameIpfsUniversalPathContentListService] method instead. +type ZoneWeb3HostnameIpfsUniversalPathContentListService struct { + Options []option.RequestOption + Entries *ZoneWeb3HostnameIpfsUniversalPathContentListEntryService +} + +// NewZoneWeb3HostnameIpfsUniversalPathContentListService 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 NewZoneWeb3HostnameIpfsUniversalPathContentListService(opts ...option.RequestOption) (r *ZoneWeb3HostnameIpfsUniversalPathContentListService) { + r = &ZoneWeb3HostnameIpfsUniversalPathContentListService{} + r.Options = opts + r.Entries = NewZoneWeb3HostnameIpfsUniversalPathContentListEntryService(opts...) + return +} + +// IPFS Universal Path Gateway Content List Details +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListService) Web3HostnameIpfsUniversalPathGatewayContentListDetails(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Update IPFS Universal Path Gateway Content List +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListService) Web3HostnameUpdateIpfsUniversalPathGatewayContentList(ctx context.Context, zoneIdentifier string, identifier string, body ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParams, opts ...option.RequestOption) (res *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponse struct { + Errors []ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseError `json:"errors"` + Messages []ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseMessage `json:"messages"` + Result ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseSuccess `json:"success"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponse] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseError] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseMessage] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResult struct { + // Behavior of the content list. + Action ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResultAction `json:"action"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResult] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResultJSON struct { + Action apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Behavior of the content list. +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResultAction string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResultActionBlock ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseResultAction = "block" +) + +// Whether the API call was successful +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseSuccess bool + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseSuccessTrue ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetailsResponseSuccess = true +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponse struct { + Errors []ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseError `json:"errors"` + Messages []ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseMessage `json:"messages"` + Result ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseSuccess `json:"success"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponse] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseError] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseMessage] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResult struct { + // Behavior of the content list. + Action ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResultAction `json:"action"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResult] +type zoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResultJSON struct { + Action apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Behavior of the content list. +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResultAction string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResultActionBlock ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseResultAction = "block" +) + +// Whether the API call was successful +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseSuccess bool + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseSuccessTrue ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListResponseSuccess = true +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParams struct { + // Behavior of the content list. + Action param.Field[ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsAction] `json:"action,required"` + // Content list entries. + Entries param.Field[[]ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntry] `json:"entries,required"` +} + +func (r ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Behavior of the content list. +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsAction string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsActionBlock ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsAction = "block" +) + +// Content list entry to be blocked. +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntry struct { + // CID or content path of content to block. + Content param.Field[string] `json:"content"` + // An optional description of the content list entry. + Description param.Field[string] `json:"description"` + // Type of content list entry to block. + Type param.Field[ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesType] `json:"type"` +} + +func (r ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntry) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of content list entry to block. +type ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesType string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesTypeCid ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesType = "cid" + ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesTypeContentPath ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesType = "content_path" +) diff --git a/zoneweb3hostnameipfsuniversalpathcontentlist_test.go b/zoneweb3hostnameipfsuniversalpathcontentlist_test.go new file mode 100644 index 00000000000..efb82b1bf3c --- /dev/null +++ b/zoneweb3hostnameipfsuniversalpathcontentlist_test.go @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameIpfsUniversalPathGatewayContentListDetails(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Web3HostnameIpfsUniversalPathGatewayContentListDetails( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Web3HostnameUpdateIpfsUniversalPathGatewayContentList( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParams{ + Action: cloudflare.F(cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsActionBlock), + Entries: cloudflare.F([]cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntry{{ + Content: cloudflare.F("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB"), + Description: cloudflare.F("this is my content list entry"), + Type: cloudflare.F(cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesTypeCid), + }, { + Content: cloudflare.F("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB"), + Description: cloudflare.F("this is my content list entry"), + Type: cloudflare.F(cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesTypeCid), + }, { + Content: cloudflare.F("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB"), + Description: cloudflare.F("this is my content list entry"), + Type: cloudflare.F(cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListWeb3HostnameUpdateIpfsUniversalPathGatewayContentListParamsEntriesTypeCid), + }}), + }, + ) + 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/zoneweb3hostnameipfsuniversalpathcontentlistentry.go b/zoneweb3hostnameipfsuniversalpathcontentlistentry.go new file mode 100644 index 00000000000..00a70fbbe0d --- /dev/null +++ b/zoneweb3hostnameipfsuniversalpathcontentlistentry.go @@ -0,0 +1,712 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWeb3HostnameIpfsUniversalPathContentListEntryService 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 [NewZoneWeb3HostnameIpfsUniversalPathContentListEntryService] method +// instead. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryService struct { + Options []option.RequestOption +} + +// NewZoneWeb3HostnameIpfsUniversalPathContentListEntryService 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 NewZoneWeb3HostnameIpfsUniversalPathContentListEntryService(opts ...option.RequestOption) (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryService) { + r = &ZoneWeb3HostnameIpfsUniversalPathContentListEntryService{} + r.Options = opts + return +} + +// IPFS Universal Path Gateway Content List Entry Details +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryService) Get(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, opts ...option.RequestOption) (res *ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list/entries/%s", zoneIdentifier, identifier, contentListEntryIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Edit IPFS Universal Path Gateway Content List Entry +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryService) Update(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, body ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParams, opts ...option.RequestOption) (res *ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list/entries/%s", zoneIdentifier, identifier, contentListEntryIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete IPFS Universal Path Gateway Content List Entry +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryService) Delete(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, opts ...option.RequestOption) (res *ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list/entries/%s", zoneIdentifier, identifier, contentListEntryIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create IPFS Universal Path Gateway Content List Entry +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryService) Web3HostnameNewIpfsUniversalPathGatewayContentListEntry(ctx context.Context, zoneIdentifier string, identifier string, body ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParams, opts ...option.RequestOption) (res *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list/entries", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List IPFS Universal Path Gateway Content List Entries +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryService) Web3HostnameListIpfsUniversalPathGatewayContentListEntries(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list/entries", zoneIdentifier, identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponse struct { + Errors []ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseError `json:"errors"` + Messages []ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseMessage `json:"messages"` + // Content list entry to be blocked. + Result ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseSuccess `json:"success"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseJSON contains the +// JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponse] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseErrorJSON contains +// the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseError] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseMessage] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Content list entry to be blocked. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResult struct { + // Identifier + ID string `json:"id"` + // CID or content path of content to block. + Content string `json:"content"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the content list entry. + Description string `json:"description"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Type of content list entry to block. + Type ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultType `json:"type"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResult] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultJSON struct { + ID apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of content list entry to block. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultType string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultTypeCid ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultType = "cid" + ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultTypeContentPath ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseResultType = "content_path" +) + +// Whether the API call was successful +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseSuccess bool + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseSuccessTrue ZoneWeb3HostnameIpfsUniversalPathContentListEntryGetResponseSuccess = true +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponse struct { + Errors []ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseError `json:"errors"` + Messages []ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseMessage `json:"messages"` + // Content list entry to be blocked. + Result ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseSuccess `json:"success"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseJSON contains the +// JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponse] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseError] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseMessage] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Content list entry to be blocked. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResult struct { + // Identifier + ID string `json:"id"` + // CID or content path of content to block. + Content string `json:"content"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the content list entry. + Description string `json:"description"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Type of content list entry to block. + Type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultType `json:"type"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResult] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultJSON struct { + ID apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of content list entry to block. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultType string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultTypeCid ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultType = "cid" + ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultTypeContentPath ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseResultType = "content_path" +) + +// Whether the API call was successful +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseSuccess bool + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseSuccessTrue ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateResponseSuccess = true +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponse struct { + Errors []ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseError `json:"errors"` + Messages []ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseMessage `json:"messages"` + Result ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseSuccess `json:"success"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseJSON contains the +// JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponse] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseError] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseMessage] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseResult] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseSuccess bool + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseSuccessTrue ZoneWeb3HostnameIpfsUniversalPathContentListEntryDeleteResponseSuccess = true +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponse struct { + Errors []ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseError `json:"errors"` + Messages []ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseMessage `json:"messages"` + // Content list entry to be blocked. + Result ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseSuccess `json:"success"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponse] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseError] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseMessage] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Content list entry to be blocked. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResult struct { + // Identifier + ID string `json:"id"` + // CID or content path of content to block. + Content string `json:"content"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the content list entry. + Description string `json:"description"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Type of content list entry to block. + Type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultType `json:"type"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResult] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultJSON struct { + ID apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of content list entry to block. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultType string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultTypeCid ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultType = "cid" + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultTypeContentPath ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseResultType = "content_path" +) + +// Whether the API call was successful +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseSuccess bool + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseSuccessTrue ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryResponseSuccess = true +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponse struct { + Errors []ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseError `json:"errors"` + Messages []ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseMessage `json:"messages"` + Result ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResult `json:"result"` + ResultInfo ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultInfo `json:"result_info"` + // Whether the API call was successful + Success ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseSuccess `json:"success"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponse] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + ResultInfo apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseErrorJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseErrorJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseError] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseMessageJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseMessageJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseMessage] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResult struct { + // Content list entries. + Entries []ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntry `json:"entries"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResult] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultJSON struct { + Entries apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Content list entry to be blocked. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntry struct { + // Identifier + ID string `json:"id"` + // CID or content path of content to block. + Content string `json:"content"` + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the content list entry. + Description string `json:"description"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Type of content list entry to block. + Type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntriesType `json:"type"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntryJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntryJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntry] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntryJSON struct { + ID apijson.Field + Content apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntry) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Type of content list entry to block. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntriesType string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntriesTypeCid ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntriesType = "cid" + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntriesTypeContentPath ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultEntriesType = "content_path" +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultInfoJSON `json:"-"` +} + +// zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultInfoJSON +// contains the JSON metadata for the struct +// [ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultInfo] +type zoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseSuccess bool + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseSuccessTrue ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntriesResponseSuccess = true +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParams struct { + // CID or content path of content to block. + Content param.Field[string] `json:"content,required"` + // Type of content list entry to block. + Type param.Field[ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParamsType] `json:"type,required"` + // An optional description of the content list entry. + Description param.Field[string] `json:"description"` +} + +func (r ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of content list entry to block. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParamsType string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParamsTypeCid ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParamsType = "cid" + ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParamsTypeContentPath ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParamsType = "content_path" +) + +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParams struct { + // CID or content path of content to block. + Content param.Field[string] `json:"content,required"` + // Type of content list entry to block. + Type param.Field[ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParamsType] `json:"type,required"` + // An optional description of the content list entry. + Description param.Field[string] `json:"description"` +} + +func (r ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Type of content list entry to block. +type ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParamsType string + +const ( + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParamsTypeCid ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParamsType = "cid" + ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParamsTypeContentPath ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParamsType = "content_path" +) diff --git a/zoneweb3hostnameipfsuniversalpathcontentlistentry_test.go b/zoneweb3hostnameipfsuniversalpathcontentlistentry_test.go new file mode 100644 index 00000000000..8009e3301f5 --- /dev/null +++ b/zoneweb3hostnameipfsuniversalpathcontentlistentry_test.go @@ -0,0 +1,177 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWeb3HostnameIpfsUniversalPathContentListEntryGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParams{ + Content: cloudflare.F("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB"), + Type: cloudflare.F(cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryUpdateParamsTypeCid), + Description: cloudflare.F("this is my content list entry"), + }, + ) + 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 TestZoneWeb3HostnameIpfsUniversalPathContentListEntryDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Web3HostnameNewIpfsUniversalPathGatewayContentListEntry( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParams{ + Content: cloudflare.F("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB"), + Type: cloudflare.F(cloudflare.ZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameNewIpfsUniversalPathGatewayContentListEntryParamsTypeCid), + Description: cloudflare.F("this is my content list entry"), + }, + ) + 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 TestZoneWeb3HostnameIpfsUniversalPathContentListEntryWeb3HostnameListIpfsUniversalPathGatewayContentListEntries(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Web3s.Hostnames.IpfsUniversalPaths.ContentLists.Entries.Web3HostnameListIpfsUniversalPathGatewayContentListEntries( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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/zoneworker.go b/zoneworker.go new file mode 100644 index 00000000000..380e5728d01 --- /dev/null +++ b/zoneworker.go @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWorkerService 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 [NewZoneWorkerService] method instead. +type ZoneWorkerService struct { + Options []option.RequestOption + Scripts *ZoneWorkerScriptService + Filters *ZoneWorkerFilterService + Routes *ZoneWorkerRouteService +} + +// NewZoneWorkerService 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 NewZoneWorkerService(opts ...option.RequestOption) (r *ZoneWorkerService) { + r = &ZoneWorkerService{} + r.Options = opts + r.Scripts = NewZoneWorkerScriptService(opts...) + r.Filters = NewZoneWorkerFilterService(opts...) + r.Routes = NewZoneWorkerRouteService(opts...) + return +} diff --git a/zoneworkerfilter.go b/zoneworkerfilter.go new file mode 100644 index 00000000000..5b4d0833678 --- /dev/null +++ b/zoneworkerfilter.go @@ -0,0 +1,446 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWorkerFilterService 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 [NewZoneWorkerFilterService] method +// instead. +type ZoneWorkerFilterService struct { + Options []option.RequestOption +} + +// NewZoneWorkerFilterService 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 NewZoneWorkerFilterService(opts ...option.RequestOption) (r *ZoneWorkerFilterService) { + r = &ZoneWorkerFilterService{} + r.Options = opts + return +} + +// Update Filter +func (r *ZoneWorkerFilterService) Update(ctx context.Context, zoneID string, filterID string, body ZoneWorkerFilterUpdateParams, opts ...option.RequestOption) (res *ZoneWorkerFilterUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/filters/%s", zoneID, filterID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Delete Filter +func (r *ZoneWorkerFilterService) Delete(ctx context.Context, zoneID string, filterID string, opts ...option.RequestOption) (res *ZoneWorkerFilterDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/filters/%s", zoneID, filterID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Create Filter +func (r *ZoneWorkerFilterService) WorkerFiltersDeprecatedNewFilter(ctx context.Context, zoneID string, body ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterParams, opts ...option.RequestOption) (res *ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/filters", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// List Filters +func (r *ZoneWorkerFilterService) WorkerFiltersDeprecatedListFilters(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/filters", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneWorkerFilterUpdateResponse struct { + Errors []ZoneWorkerFilterUpdateResponseError `json:"errors"` + Messages []ZoneWorkerFilterUpdateResponseMessage `json:"messages"` + Result ZoneWorkerFilterUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerFilterUpdateResponseSuccess `json:"success"` + JSON zoneWorkerFilterUpdateResponseJSON `json:"-"` +} + +// zoneWorkerFilterUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneWorkerFilterUpdateResponse] +type zoneWorkerFilterUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterUpdateResponseErrorJSON `json:"-"` +} + +// zoneWorkerFilterUpdateResponseErrorJSON contains the JSON metadata for the +// struct [ZoneWorkerFilterUpdateResponseError] +type zoneWorkerFilterUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterUpdateResponseMessageJSON `json:"-"` +} + +// zoneWorkerFilterUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWorkerFilterUpdateResponseMessage] +type zoneWorkerFilterUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterUpdateResponseResult struct { + // Identifier + ID string `json:"id,required"` + Enabled bool `json:"enabled,required"` + Pattern string `json:"pattern,required"` + JSON zoneWorkerFilterUpdateResponseResultJSON `json:"-"` +} + +// zoneWorkerFilterUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneWorkerFilterUpdateResponseResult] +type zoneWorkerFilterUpdateResponseResultJSON struct { + ID apijson.Field + Enabled apijson.Field + Pattern apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerFilterUpdateResponseSuccess bool + +const ( + ZoneWorkerFilterUpdateResponseSuccessTrue ZoneWorkerFilterUpdateResponseSuccess = true +) + +type ZoneWorkerFilterDeleteResponse struct { + Errors []ZoneWorkerFilterDeleteResponseError `json:"errors"` + Messages []ZoneWorkerFilterDeleteResponseMessage `json:"messages"` + Result ZoneWorkerFilterDeleteResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneWorkerFilterDeleteResponseSuccess `json:"success"` + JSON zoneWorkerFilterDeleteResponseJSON `json:"-"` +} + +// zoneWorkerFilterDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneWorkerFilterDeleteResponse] +type zoneWorkerFilterDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterDeleteResponseErrorJSON `json:"-"` +} + +// zoneWorkerFilterDeleteResponseErrorJSON contains the JSON metadata for the +// struct [ZoneWorkerFilterDeleteResponseError] +type zoneWorkerFilterDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterDeleteResponseMessageJSON `json:"-"` +} + +// zoneWorkerFilterDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWorkerFilterDeleteResponseMessage] +type zoneWorkerFilterDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterDeleteResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON zoneWorkerFilterDeleteResponseResultJSON `json:"-"` +} + +// zoneWorkerFilterDeleteResponseResultJSON contains the JSON metadata for the +// struct [ZoneWorkerFilterDeleteResponseResult] +type zoneWorkerFilterDeleteResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterDeleteResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerFilterDeleteResponseSuccess bool + +const ( + ZoneWorkerFilterDeleteResponseSuccessTrue ZoneWorkerFilterDeleteResponseSuccess = true +) + +type ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponse struct { + Errors []ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseError `json:"errors"` + Messages []ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseMessage `json:"messages"` + Result ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseResult `json:"result,nullable"` + // Whether the API call was successful + Success ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseSuccess `json:"success"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseJSON contains the JSON +// metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponse] +type zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseErrorJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseError] +type zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseMessageJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseMessageJSON contains the +// JSON metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseMessage] +type zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseResult struct { + // Identifier + ID string `json:"id,required"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseResultJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseResultJSON contains the +// JSON metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseResult] +type zoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseResultJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseSuccess bool + +const ( + ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseSuccessTrue ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterResponseSuccess = true +) + +type ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponse struct { + Errors []ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseError `json:"errors"` + Messages []ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseMessage `json:"messages"` + Result []ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseSuccess `json:"success"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseJSON contains the JSON +// metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponse] +type zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseErrorJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseError] +type zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseMessageJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseMessage] +type zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseResult struct { + // Identifier + ID string `json:"id,required"` + Enabled bool `json:"enabled,required"` + Pattern string `json:"pattern,required"` + JSON zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseResultJSON `json:"-"` +} + +// zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseResultJSON contains +// the JSON metadata for the struct +// [ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseResult] +type zoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseResultJSON struct { + ID apijson.Field + Enabled apijson.Field + Pattern apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseSuccess bool + +const ( + ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseSuccessTrue ZoneWorkerFilterWorkerFiltersDeprecatedListFiltersResponseSuccess = true +) + +type ZoneWorkerFilterUpdateParams struct { + Enabled param.Field[bool] `json:"enabled,required"` + Pattern param.Field[string] `json:"pattern,required"` +} + +func (r ZoneWorkerFilterUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterParams struct { + Enabled param.Field[bool] `json:"enabled,required"` + Pattern param.Field[string] `json:"pattern,required"` +} + +func (r ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneworkerfilter_test.go b/zoneworkerfilter_test.go new file mode 100644 index 00000000000..e84e4ff83ee --- /dev/null +++ b/zoneworkerfilter_test.go @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWorkerFilterUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Filters.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWorkerFilterUpdateParams{ + Enabled: cloudflare.F(true), + Pattern: cloudflare.F("example.net/*"), + }, + ) + 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 TestZoneWorkerFilterDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Filters.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWorkerFilterWorkerFiltersDeprecatedNewFilter(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Filters.WorkerFiltersDeprecatedNewFilter( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWorkerFilterWorkerFiltersDeprecatedNewFilterParams{ + Enabled: cloudflare.F(true), + Pattern: cloudflare.F("example.net/*"), + }, + ) + 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 TestZoneWorkerFilterWorkerFiltersDeprecatedListFilters(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Filters.WorkerFiltersDeprecatedListFilters(context.TODO(), "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/zoneworkerroute.go b/zoneworkerroute.go new file mode 100644 index 00000000000..16f9d35eb8a --- /dev/null +++ b/zoneworkerroute.go @@ -0,0 +1,545 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneWorkerRouteService 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 [NewZoneWorkerRouteService] method +// instead. +type ZoneWorkerRouteService struct { + Options []option.RequestOption +} + +// NewZoneWorkerRouteService 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 NewZoneWorkerRouteService(opts ...option.RequestOption) (r *ZoneWorkerRouteService) { + r = &ZoneWorkerRouteService{} + r.Options = opts + return +} + +// Returns information about a route, including URL pattern and Worker. +func (r *ZoneWorkerRouteService) Get(ctx context.Context, zoneID string, routeID string, opts ...option.RequestOption) (res *ZoneWorkerRouteGetResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/routes/%s", zoneID, routeID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates the URL pattern or Worker associated with a route. +func (r *ZoneWorkerRouteService) Update(ctx context.Context, zoneID string, routeID string, body ZoneWorkerRouteUpdateParams, opts ...option.RequestOption) (res *ZoneWorkerRouteUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/routes/%s", zoneID, routeID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +// Deletes a route. +func (r *ZoneWorkerRouteService) Delete(ctx context.Context, zoneID string, routeID string, opts ...option.RequestOption) (res *ZoneWorkerRouteDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/routes/%s", zoneID, routeID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) + return +} + +// Creates a route that maps a URL pattern to a Worker. +func (r *ZoneWorkerRouteService) WorkerRoutesNewRoute(ctx context.Context, zoneID string, body ZoneWorkerRouteWorkerRoutesNewRouteParams, opts ...option.RequestOption) (res *ZoneWorkerRouteWorkerRoutesNewRouteResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/routes", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +// Returns routes for a zone. +func (r *ZoneWorkerRouteService) WorkerRoutesListRoutes(ctx context.Context, zoneID string, opts ...option.RequestOption) (res *ZoneWorkerRouteWorkerRoutesListRoutesResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/routes", zoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneWorkerRouteGetResponse struct { + Errors []ZoneWorkerRouteGetResponseError `json:"errors"` + Messages []ZoneWorkerRouteGetResponseMessage `json:"messages"` + Result ZoneWorkerRouteGetResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerRouteGetResponseSuccess `json:"success"` + JSON zoneWorkerRouteGetResponseJSON `json:"-"` +} + +// zoneWorkerRouteGetResponseJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteGetResponse] +type zoneWorkerRouteGetResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteGetResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteGetResponseErrorJSON `json:"-"` +} + +// zoneWorkerRouteGetResponseErrorJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteGetResponseError] +type zoneWorkerRouteGetResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteGetResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteGetResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteGetResponseMessageJSON `json:"-"` +} + +// zoneWorkerRouteGetResponseMessageJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteGetResponseMessage] +type zoneWorkerRouteGetResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteGetResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteGetResponseResult struct { + // Identifier + ID string `json:"id,required"` + Pattern string `json:"pattern,required"` + // Name of the script, used in URLs and route configuration. + Script string `json:"script,required"` + JSON zoneWorkerRouteGetResponseResultJSON `json:"-"` +} + +// zoneWorkerRouteGetResponseResultJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteGetResponseResult] +type zoneWorkerRouteGetResponseResultJSON struct { + ID apijson.Field + Pattern apijson.Field + Script apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteGetResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerRouteGetResponseSuccess bool + +const ( + ZoneWorkerRouteGetResponseSuccessTrue ZoneWorkerRouteGetResponseSuccess = true +) + +type ZoneWorkerRouteUpdateResponse struct { + Errors []ZoneWorkerRouteUpdateResponseError `json:"errors"` + Messages []ZoneWorkerRouteUpdateResponseMessage `json:"messages"` + Result ZoneWorkerRouteUpdateResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerRouteUpdateResponseSuccess `json:"success"` + JSON zoneWorkerRouteUpdateResponseJSON `json:"-"` +} + +// zoneWorkerRouteUpdateResponseJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteUpdateResponse] +type zoneWorkerRouteUpdateResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteUpdateResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteUpdateResponseErrorJSON `json:"-"` +} + +// zoneWorkerRouteUpdateResponseErrorJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteUpdateResponseError] +type zoneWorkerRouteUpdateResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteUpdateResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteUpdateResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteUpdateResponseMessageJSON `json:"-"` +} + +// zoneWorkerRouteUpdateResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWorkerRouteUpdateResponseMessage] +type zoneWorkerRouteUpdateResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteUpdateResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteUpdateResponseResult struct { + // Identifier + ID string `json:"id,required"` + Pattern string `json:"pattern,required"` + // Name of the script, used in URLs and route configuration. + Script string `json:"script,required"` + JSON zoneWorkerRouteUpdateResponseResultJSON `json:"-"` +} + +// zoneWorkerRouteUpdateResponseResultJSON contains the JSON metadata for the +// struct [ZoneWorkerRouteUpdateResponseResult] +type zoneWorkerRouteUpdateResponseResultJSON struct { + ID apijson.Field + Pattern apijson.Field + Script apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteUpdateResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerRouteUpdateResponseSuccess bool + +const ( + ZoneWorkerRouteUpdateResponseSuccessTrue ZoneWorkerRouteUpdateResponseSuccess = true +) + +type ZoneWorkerRouteDeleteResponse struct { + Errors []ZoneWorkerRouteDeleteResponseError `json:"errors"` + Messages []ZoneWorkerRouteDeleteResponseMessage `json:"messages"` + Result ZoneWorkerRouteDeleteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerRouteDeleteResponseSuccess `json:"success"` + JSON zoneWorkerRouteDeleteResponseJSON `json:"-"` +} + +// zoneWorkerRouteDeleteResponseJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteDeleteResponse] +type zoneWorkerRouteDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteDeleteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteDeleteResponseErrorJSON `json:"-"` +} + +// zoneWorkerRouteDeleteResponseErrorJSON contains the JSON metadata for the struct +// [ZoneWorkerRouteDeleteResponseError] +type zoneWorkerRouteDeleteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteDeleteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteDeleteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteDeleteResponseMessageJSON `json:"-"` +} + +// zoneWorkerRouteDeleteResponseMessageJSON contains the JSON metadata for the +// struct [ZoneWorkerRouteDeleteResponseMessage] +type zoneWorkerRouteDeleteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteDeleteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [ZoneWorkerRouteDeleteResponseResultUnknown] or +// [shared.UnionString]. +type ZoneWorkerRouteDeleteResponseResult interface { + ImplementsZoneWorkerRouteDeleteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneWorkerRouteDeleteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type ZoneWorkerRouteDeleteResponseSuccess bool + +const ( + ZoneWorkerRouteDeleteResponseSuccessTrue ZoneWorkerRouteDeleteResponseSuccess = true +) + +type ZoneWorkerRouteWorkerRoutesNewRouteResponse struct { + Errors []ZoneWorkerRouteWorkerRoutesNewRouteResponseError `json:"errors"` + Messages []ZoneWorkerRouteWorkerRoutesNewRouteResponseMessage `json:"messages"` + Result ZoneWorkerRouteWorkerRoutesNewRouteResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerRouteWorkerRoutesNewRouteResponseSuccess `json:"success"` + JSON zoneWorkerRouteWorkerRoutesNewRouteResponseJSON `json:"-"` +} + +// zoneWorkerRouteWorkerRoutesNewRouteResponseJSON contains the JSON metadata for +// the struct [ZoneWorkerRouteWorkerRoutesNewRouteResponse] +type zoneWorkerRouteWorkerRoutesNewRouteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteWorkerRoutesNewRouteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteWorkerRoutesNewRouteResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteWorkerRoutesNewRouteResponseErrorJSON `json:"-"` +} + +// zoneWorkerRouteWorkerRoutesNewRouteResponseErrorJSON contains the JSON metadata +// for the struct [ZoneWorkerRouteWorkerRoutesNewRouteResponseError] +type zoneWorkerRouteWorkerRoutesNewRouteResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteWorkerRoutesNewRouteResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteWorkerRoutesNewRouteResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteWorkerRoutesNewRouteResponseMessageJSON `json:"-"` +} + +// zoneWorkerRouteWorkerRoutesNewRouteResponseMessageJSON contains the JSON +// metadata for the struct [ZoneWorkerRouteWorkerRoutesNewRouteResponseMessage] +type zoneWorkerRouteWorkerRoutesNewRouteResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteWorkerRoutesNewRouteResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [ZoneWorkerRouteWorkerRoutesNewRouteResponseResultUnknown] or +// [shared.UnionString]. +type ZoneWorkerRouteWorkerRoutesNewRouteResponseResult interface { + ImplementsZoneWorkerRouteWorkerRoutesNewRouteResponseResult() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneWorkerRouteWorkerRoutesNewRouteResponseResult)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + DiscriminatorValue: "", + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Whether the API call was successful +type ZoneWorkerRouteWorkerRoutesNewRouteResponseSuccess bool + +const ( + ZoneWorkerRouteWorkerRoutesNewRouteResponseSuccessTrue ZoneWorkerRouteWorkerRoutesNewRouteResponseSuccess = true +) + +type ZoneWorkerRouteWorkerRoutesListRoutesResponse struct { + Errors []ZoneWorkerRouteWorkerRoutesListRoutesResponseError `json:"errors"` + Messages []ZoneWorkerRouteWorkerRoutesListRoutesResponseMessage `json:"messages"` + Result []ZoneWorkerRouteWorkerRoutesListRoutesResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerRouteWorkerRoutesListRoutesResponseSuccess `json:"success"` + JSON zoneWorkerRouteWorkerRoutesListRoutesResponseJSON `json:"-"` +} + +// zoneWorkerRouteWorkerRoutesListRoutesResponseJSON contains the JSON metadata for +// the struct [ZoneWorkerRouteWorkerRoutesListRoutesResponse] +type zoneWorkerRouteWorkerRoutesListRoutesResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteWorkerRoutesListRoutesResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteWorkerRoutesListRoutesResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteWorkerRoutesListRoutesResponseErrorJSON `json:"-"` +} + +// zoneWorkerRouteWorkerRoutesListRoutesResponseErrorJSON contains the JSON +// metadata for the struct [ZoneWorkerRouteWorkerRoutesListRoutesResponseError] +type zoneWorkerRouteWorkerRoutesListRoutesResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteWorkerRoutesListRoutesResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteWorkerRoutesListRoutesResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerRouteWorkerRoutesListRoutesResponseMessageJSON `json:"-"` +} + +// zoneWorkerRouteWorkerRoutesListRoutesResponseMessageJSON contains the JSON +// metadata for the struct [ZoneWorkerRouteWorkerRoutesListRoutesResponseMessage] +type zoneWorkerRouteWorkerRoutesListRoutesResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteWorkerRoutesListRoutesResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerRouteWorkerRoutesListRoutesResponseResult struct { + // Identifier + ID string `json:"id,required"` + Pattern string `json:"pattern,required"` + // Name of the script, used in URLs and route configuration. + Script string `json:"script,required"` + JSON zoneWorkerRouteWorkerRoutesListRoutesResponseResultJSON `json:"-"` +} + +// zoneWorkerRouteWorkerRoutesListRoutesResponseResultJSON contains the JSON +// metadata for the struct [ZoneWorkerRouteWorkerRoutesListRoutesResponseResult] +type zoneWorkerRouteWorkerRoutesListRoutesResponseResultJSON struct { + ID apijson.Field + Pattern apijson.Field + Script apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerRouteWorkerRoutesListRoutesResponseResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerRouteWorkerRoutesListRoutesResponseSuccess bool + +const ( + ZoneWorkerRouteWorkerRoutesListRoutesResponseSuccessTrue ZoneWorkerRouteWorkerRoutesListRoutesResponseSuccess = true +) + +type ZoneWorkerRouteUpdateParams struct { + Pattern param.Field[string] `json:"pattern,required"` + // Name of the script, used in URLs and route configuration. + Script param.Field[string] `json:"script"` +} + +func (r ZoneWorkerRouteUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneWorkerRouteWorkerRoutesNewRouteParams struct { + Pattern param.Field[string] `json:"pattern,required"` + // Name of the script, used in URLs and route configuration. + Script param.Field[string] `json:"script"` +} + +func (r ZoneWorkerRouteWorkerRoutesNewRouteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/zoneworkerroute_test.go b/zoneworkerroute_test.go new file mode 100644 index 00000000000..71373f033bf --- /dev/null +++ b/zoneworkerroute_test.go @@ -0,0 +1,167 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWorkerRouteGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Routes.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWorkerRouteUpdateWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Routes.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWorkerRouteUpdateParams{ + Pattern: cloudflare.F("example.net/*"), + Script: cloudflare.F("this-is_my_script-01"), + }, + ) + 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 TestZoneWorkerRouteDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Routes.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "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()) + } +} + +func TestZoneWorkerRouteWorkerRoutesNewRouteWithOptionalParams(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Routes.WorkerRoutesNewRoute( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneWorkerRouteWorkerRoutesNewRouteParams{ + Pattern: cloudflare.F("example.net/*"), + Script: cloudflare.F("this-is_my_script-01"), + }, + ) + 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 TestZoneWorkerRouteWorkerRoutesListRoutes(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Routes.WorkerRoutesListRoutes(context.TODO(), "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/zoneworkerscript.go b/zoneworkerscript.go new file mode 100644 index 00000000000..9c3c82a2055 --- /dev/null +++ b/zoneworkerscript.go @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWorkerScriptService 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 [NewZoneWorkerScriptService] method +// instead. +type ZoneWorkerScriptService struct { + Options []option.RequestOption + Bindings *ZoneWorkerScriptBindingService +} + +// NewZoneWorkerScriptService 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 NewZoneWorkerScriptService(opts ...option.RequestOption) (r *ZoneWorkerScriptService) { + r = &ZoneWorkerScriptService{} + r.Options = opts + r.Bindings = NewZoneWorkerScriptBindingService(opts...) + return +} + +// Fetch raw script content for your worker. Note this is the original script +// content, not JSON encoded. +func (r *ZoneWorkerScriptService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "undefined")}, opts...) + path := fmt.Sprintf("zones/%s/workers/script", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Delete your Worker. This call has no response body on a successful delete. +func (r *ZoneWorkerScriptService) Delete(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("zones/%s/workers/script", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) + return +} + +// Upload a worker, or a new version of a worker. +func (r *ZoneWorkerScriptService) WorkerScriptDeprecatedUploadWorker(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/script", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &res, opts...) + return +} + +type ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponse struct { + Errors []ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseError `json:"errors"` + Messages []ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseMessage `json:"messages"` + Result interface{} `json:"result"` + // Whether the API call was successful + Success ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseSuccess `json:"success"` + JSON zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseJSON `json:"-"` +} + +// zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseJSON contains the JSON +// metadata for the struct +// [ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponse] +type zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseErrorJSON `json:"-"` +} + +// zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseErrorJSON contains the +// JSON metadata for the struct +// [ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseError] +type zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseMessageJSON `json:"-"` +} + +// zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseMessageJSON contains +// the JSON metadata for the struct +// [ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseMessage] +type zoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseSuccess bool + +const ( + ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseSuccessTrue ZoneWorkerScriptWorkerScriptDeprecatedUploadWorkerResponseSuccess = true +) diff --git a/zoneworkerscript_test.go b/zoneworkerscript_test.go new file mode 100644 index 00000000000..070b59d459d --- /dev/null +++ b/zoneworkerscript_test.go @@ -0,0 +1,108 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWorkerScriptList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + resp, err := client.Zones.Workers.Scripts.List(context.TODO(), "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) + } +} + +func TestZoneWorkerScriptDelete(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + err := client.Zones.Workers.Scripts.Delete(context.TODO(), "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()) + } +} + +func TestZoneWorkerScriptWorkerScriptDeprecatedUploadWorker(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Scripts.WorkerScriptDeprecatedUploadWorker(context.TODO(), "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/zoneworkerscriptbinding.go b/zoneworkerscriptbinding.go new file mode 100644 index 00000000000..ca0c20505eb --- /dev/null +++ b/zoneworkerscriptbinding.go @@ -0,0 +1,187 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWorkerScriptBindingService 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 +// [NewZoneWorkerScriptBindingService] method instead. +type ZoneWorkerScriptBindingService struct { + Options []option.RequestOption +} + +// NewZoneWorkerScriptBindingService 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 NewZoneWorkerScriptBindingService(opts ...option.RequestOption) (r *ZoneWorkerScriptBindingService) { + r = &ZoneWorkerScriptBindingService{} + r.Options = opts + return +} + +// List the bindings for a Workers script. +func (r *ZoneWorkerScriptBindingService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneWorkerScriptBindingListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/workers/script/bindings", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +type ZoneWorkerScriptBindingListResponse struct { + Errors []ZoneWorkerScriptBindingListResponseError `json:"errors"` + Messages []ZoneWorkerScriptBindingListResponseMessage `json:"messages"` + Result []ZoneWorkerScriptBindingListResponseResult `json:"result"` + // Whether the API call was successful + Success ZoneWorkerScriptBindingListResponseSuccess `json:"success"` + JSON zoneWorkerScriptBindingListResponseJSON `json:"-"` +} + +// zoneWorkerScriptBindingListResponseJSON contains the JSON metadata for the +// struct [ZoneWorkerScriptBindingListResponse] +type zoneWorkerScriptBindingListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptBindingListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerScriptBindingListResponseError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerScriptBindingListResponseErrorJSON `json:"-"` +} + +// zoneWorkerScriptBindingListResponseErrorJSON contains the JSON metadata for the +// struct [ZoneWorkerScriptBindingListResponseError] +type zoneWorkerScriptBindingListResponseErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptBindingListResponseError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerScriptBindingListResponseMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerScriptBindingListResponseMessageJSON `json:"-"` +} + +// zoneWorkerScriptBindingListResponseMessageJSON contains the JSON metadata for +// the struct [ZoneWorkerScriptBindingListResponseMessage] +type zoneWorkerScriptBindingListResponseMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptBindingListResponseMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by +// [ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBinding] or +// [ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBinding]. +type ZoneWorkerScriptBindingListResponseResult interface { + implementsZoneWorkerScriptBindingListResponseResult() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneWorkerScriptBindingListResponseResult)(nil)).Elem(), "") +} + +type ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // Namespace identifier tag. + NamespaceID string `json:"namespace_id,required"` + // The class of resource that the binding provides. + Type ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBindingType `json:"type,required"` + JSON zoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBindingJSON `json:"-"` +} + +// zoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBindingJSON contains +// the JSON metadata for the struct +// [ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBinding] +type zoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBindingJSON struct { + Name apijson.Field + NamespaceID apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBinding) implementsZoneWorkerScriptBindingListResponseResult() { +} + +// The class of resource that the binding provides. +type ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBindingType string + +const ( + ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBindingTypeKvNamespace ZoneWorkerScriptBindingListResponseResultAvYbsl2uKvNamespaceBindingType = "kv_namespace" +) + +type ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBinding struct { + // A JavaScript variable name for the binding. + Name string `json:"name,required"` + // The class of resource that the binding provides. + Type ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBindingType `json:"type,required"` + JSON zoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBindingJSON `json:"-"` +} + +// zoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBindingJSON contains +// the JSON metadata for the struct +// [ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBinding] +type zoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBindingJSON struct { + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBinding) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBinding) implementsZoneWorkerScriptBindingListResponseResult() { +} + +// The class of resource that the binding provides. +type ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBindingType string + +const ( + ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBindingTypeWasmModule ZoneWorkerScriptBindingListResponseResultAvYbsl2uWasmModuleBindingType = "wasm_module" +) + +// Whether the API call was successful +type ZoneWorkerScriptBindingListResponseSuccess bool + +const ( + ZoneWorkerScriptBindingListResponseSuccessTrue ZoneWorkerScriptBindingListResponseSuccess = true +) diff --git a/zoneworkerscriptbinding_test.go b/zoneworkerscriptbinding_test.go new file mode 100644 index 00000000000..04d04beae10 --- /dev/null +++ b/zoneworkerscriptbinding_test.go @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWorkerScriptBindingList(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Workers.Scripts.Bindings.List(context.TODO(), "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/zonezaraz.go b/zonezaraz.go new file mode 100644 index 00000000000..9662e2f2d33 --- /dev/null +++ b/zonezaraz.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneZarazService 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 [NewZoneZarazService] method instead. +type ZoneZarazService struct { + Options []option.RequestOption + Workflow *ZoneZarazWorkflowService +} + +// NewZoneZarazService 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 NewZoneZarazService(opts ...option.RequestOption) (r *ZoneZarazService) { + r = &ZoneZarazService{} + r.Options = opts + r.Workflow = NewZoneZarazWorkflowService(opts...) + return +} diff --git a/zonezarazworkflow.go b/zonezarazworkflow.go new file mode 100644 index 00000000000..d57079c189f --- /dev/null +++ b/zonezarazworkflow.go @@ -0,0 +1,135 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneZarazWorkflowService 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 [NewZoneZarazWorkflowService] method +// instead. +type ZoneZarazWorkflowService struct { + Options []option.RequestOption +} + +// NewZoneZarazWorkflowService 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 NewZoneZarazWorkflowService(opts ...option.RequestOption) (r *ZoneZarazWorkflowService) { + r = &ZoneZarazWorkflowService{} + r.Options = opts + return +} + +// Gets Zaraz workflow for a zone. +func (r *ZoneZarazWorkflowService) Get(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZarazWorkflow, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/workflow", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) + return +} + +// Updates Zaraz workflow for a zone. +func (r *ZoneZarazWorkflowService) Update(ctx context.Context, zoneIdentifier string, body ZoneZarazWorkflowUpdateParams, opts ...option.RequestOption) (res *ZarazWorkflow, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/settings/zaraz/v2/workflow", zoneIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + +type ZarazWorkflow struct { + Errors []ZarazWorkflowError `json:"errors"` + Messages []ZarazWorkflowMessage `json:"messages"` + // Zaraz workflow + Result ZarazWorkflowResult `json:"result"` + // Whether the API call was successful + Success bool `json:"success"` + JSON zarazWorkflowJSON `json:"-"` +} + +// zarazWorkflowJSON contains the JSON metadata for the struct [ZarazWorkflow] +type zarazWorkflowJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazWorkflow) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZarazWorkflowError struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zarazWorkflowErrorJSON `json:"-"` +} + +// zarazWorkflowErrorJSON contains the JSON metadata for the struct +// [ZarazWorkflowError] +type zarazWorkflowErrorJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazWorkflowError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZarazWorkflowMessage struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zarazWorkflowMessageJSON `json:"-"` +} + +// zarazWorkflowMessageJSON contains the JSON metadata for the struct +// [ZarazWorkflowMessage] +type zarazWorkflowMessageJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZarazWorkflowMessage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Zaraz workflow +type ZarazWorkflowResult string + +const ( + ZarazWorkflowResultRealtime ZarazWorkflowResult = "realtime" + ZarazWorkflowResultPreview ZarazWorkflowResult = "preview" +) + +type ZoneZarazWorkflowUpdateParams struct { + // Zaraz workflow + Body param.Field[ZoneZarazWorkflowUpdateParamsBody] `json:"body,required"` +} + +func (r ZoneZarazWorkflowUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +// Zaraz workflow +type ZoneZarazWorkflowUpdateParamsBody string + +const ( + ZoneZarazWorkflowUpdateParamsBodyRealtime ZoneZarazWorkflowUpdateParamsBody = "realtime" + ZoneZarazWorkflowUpdateParamsBodyPreview ZoneZarazWorkflowUpdateParamsBody = "preview" +) diff --git a/zonezarazworkflow_test.go b/zonezarazworkflow_test.go new file mode 100644 index 00000000000..cefffd56270 --- /dev/null +++ b/zonezarazworkflow_test.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneZarazWorkflowGet(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Zarazs.Workflow.Get(context.TODO(), "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()) + } +} + +func TestZoneZarazWorkflowUpdate(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.WithAPIEmail("dev@cloudflare.com"), + option.WithAPIKey("my-cloudflare-api-key"), + option.WithAPIToken("my-cloudflare-api-token"), + option.WithUserServiceKey("my-cloudflare-user-service-key"), + ) + _, err := client.Zones.Zarazs.Workflow.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + cloudflare.ZoneZarazWorkflowUpdateParams{ + Body: cloudflare.F(cloudflare.ZoneZarazWorkflowUpdateParamsBodyRealtime), + }, + ) + 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()) + } +}